Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <linux/device.h> |
| 10 | #include <linux/errno.h> |
| 11 | #include <linux/init.h> |
| 12 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <asm/mach-types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | |
| 15 | #include "sa1111_generic.h" |
Russell King | e2125d0 | 2018-11-28 13:57:23 +0000 | [diff] [blame] | 16 | #include "max1600.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
| 18 | /* |
| 19 | * Neponset uses the Maxim MAX1600, with the following connections: |
| 20 | * |
| 21 | * MAX1600 Neponset |
| 22 | * |
| 23 | * A0VCC SA-1111 GPIO A<1> |
| 24 | * A1VCC SA-1111 GPIO A<0> |
| 25 | * A0VPP CPLD NCR A0VPP |
| 26 | * A1VPP CPLD NCR A1VPP |
| 27 | * B0VCC SA-1111 GPIO A<2> |
| 28 | * B1VCC SA-1111 GPIO A<3> |
| 29 | * B0VPP ground (slot B is CF) |
| 30 | * B1VPP ground (slot B is CF) |
| 31 | * |
| 32 | * VX VCC (5V) |
| 33 | * VY VCC3_3 (3.3V) |
| 34 | * 12INA 12V |
| 35 | * 12INB ground (slot B is CF) |
| 36 | * |
| 37 | * The MAX1600 CODE pin is tied to ground, placing the device in |
| 38 | * "Standard Intel code" mode. Refer to the Maxim data sheet for |
| 39 | * the corresponding truth table. |
| 40 | */ |
Russell King | e2125d0 | 2018-11-28 13:57:23 +0000 | [diff] [blame] | 41 | static int neponset_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
| 42 | { |
| 43 | struct max1600 *m; |
| 44 | int ret; |
| 45 | |
| 46 | ret = max1600_init(skt->socket.dev.parent, &m, |
| 47 | skt->nr ? MAX1600_CHAN_B : MAX1600_CHAN_A, |
| 48 | MAX1600_CODE_LOW); |
| 49 | if (ret == 0) |
| 50 | skt->driver_data = m; |
| 51 | |
| 52 | return ret; |
| 53 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
| 55 | static int |
| 56 | neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) |
| 57 | { |
Russell King | e2125d0 | 2018-11-28 13:57:23 +0000 | [diff] [blame] | 58 | struct max1600 *m = skt->driver_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | int ret; |
| 60 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | ret = sa1111_pcmcia_configure_socket(skt, state); |
Russell King | e2125d0 | 2018-11-28 13:57:23 +0000 | [diff] [blame] | 62 | if (ret == 0) |
| 63 | ret = max1600_configure(m, state->Vcc, state->Vpp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
Russell King | 65c77dc | 2012-01-16 09:27:33 +0000 | [diff] [blame] | 65 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | } |
| 67 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | static struct pcmcia_low_level neponset_pcmcia_ops = { |
| 69 | .owner = THIS_MODULE, |
Russell King | e2125d0 | 2018-11-28 13:57:23 +0000 | [diff] [blame] | 70 | .hw_init = neponset_pcmcia_hw_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | .configure_socket = neponset_pcmcia_configure_socket, |
Russell King - ARM Linux | 701a5dc | 2009-03-29 19:42:44 +0100 | [diff] [blame] | 72 | .first = 0, |
| 73 | .nr = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | }; |
| 75 | |
Russell King | b29cf62 | 2009-09-27 17:30:21 +0100 | [diff] [blame] | 76 | int pcmcia_neponset_init(struct sa1111_dev *sadev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | { |
Russell King | 3f8df89 | 2016-09-02 10:14:20 +0100 | [diff] [blame] | 78 | sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); |
| 79 | return sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, |
| 80 | sa11xx_drv_pcmcia_add_one); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | } |