sa1111_neponset.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/drivers/pcmcia/sa1100_neponset.c
  4. *
  5. * Neponset PCMCIA specific routines
  6. */
  7. #include <linux/module.h>
  8. #include <linux/kernel.h>
  9. #include <linux/device.h>
  10. #include <linux/errno.h>
  11. #include <linux/init.h>
  12. #include <asm/mach-types.h>
  13. #include "sa1111_generic.h"
  14. #include "max1600.h"
  15. /*
  16. * Neponset uses the Maxim MAX1600, with the following connections:
  17. *
  18. * MAX1600 Neponset
  19. *
  20. * A0VCC SA-1111 GPIO A<1>
  21. * A1VCC SA-1111 GPIO A<0>
  22. * A0VPP CPLD NCR A0VPP
  23. * A1VPP CPLD NCR A1VPP
  24. * B0VCC SA-1111 GPIO A<2>
  25. * B1VCC SA-1111 GPIO A<3>
  26. * B0VPP ground (slot B is CF)
  27. * B1VPP ground (slot B is CF)
  28. *
  29. * VX VCC (5V)
  30. * VY VCC3_3 (3.3V)
  31. * 12INA 12V
  32. * 12INB ground (slot B is CF)
  33. *
  34. * The MAX1600 CODE pin is tied to ground, placing the device in
  35. * "Standard Intel code" mode. Refer to the Maxim data sheet for
  36. * the corresponding truth table.
  37. */
  38. static int neponset_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
  39. {
  40. struct max1600 *m;
  41. int ret;
  42. ret = max1600_init(skt->socket.dev.parent, &m,
  43. skt->nr ? MAX1600_CHAN_B : MAX1600_CHAN_A,
  44. MAX1600_CODE_LOW);
  45. if (ret == 0)
  46. skt->driver_data = m;
  47. return ret;
  48. }
  49. static int
  50. neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
  51. {
  52. struct max1600 *m = skt->driver_data;
  53. int ret;
  54. ret = sa1111_pcmcia_configure_socket(skt, state);
  55. if (ret == 0)
  56. ret = max1600_configure(m, state->Vcc, state->Vpp);
  57. return ret;
  58. }
  59. static struct pcmcia_low_level neponset_pcmcia_ops = {
  60. .owner = THIS_MODULE,
  61. .hw_init = neponset_pcmcia_hw_init,
  62. .configure_socket = neponset_pcmcia_configure_socket,
  63. .first = 0,
  64. .nr = 2,
  65. };
  66. int pcmcia_neponset_init(struct sa1111_dev *sadev)
  67. {
  68. sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops);
  69. return sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops,
  70. sa11xx_drv_pcmcia_add_one);
  71. }