treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / pcmcia / sa1111_neponset.c
blobde0ce13355b449855d7789accca7e72be8242d1e
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * linux/drivers/pcmcia/sa1100_neponset.c
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>
13 #include <asm/mach-types.h>
15 #include "sa1111_generic.h"
16 #include "max1600.h"
19 * Neponset uses the Maxim MAX1600, with the following connections:
21 * MAX1600 Neponset
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)
32 * VX VCC (5V)
33 * VY VCC3_3 (3.3V)
34 * 12INA 12V
35 * 12INB ground (slot B is CF)
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.
41 static int neponset_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
43 struct max1600 *m;
44 int ret;
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;
52 return ret;
55 static int
56 neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
58 struct max1600 *m = skt->driver_data;
59 int ret;
61 ret = sa1111_pcmcia_configure_socket(skt, state);
62 if (ret == 0)
63 ret = max1600_configure(m, state->Vcc, state->Vpp);
65 return ret;
68 static struct pcmcia_low_level neponset_pcmcia_ops = {
69 .owner = THIS_MODULE,
70 .hw_init = neponset_pcmcia_hw_init,
71 .configure_socket = neponset_pcmcia_configure_socket,
72 .first = 0,
73 .nr = 2,
76 int pcmcia_neponset_init(struct sa1111_dev *sadev)
78 sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops);
79 return sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops,
80 sa11xx_drv_pcmcia_add_one);