Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * linux/drivers/pcmcia/sa1100_neponset.c
0004  *
0005  * Neponset PCMCIA specific routines
0006  */
0007 #include <linux/module.h>
0008 #include <linux/kernel.h>
0009 #include <linux/device.h>
0010 #include <linux/errno.h>
0011 #include <linux/init.h>
0012 
0013 #include <asm/mach-types.h>
0014 
0015 #include "sa1111_generic.h"
0016 #include "max1600.h"
0017 
0018 /*
0019  * Neponset uses the Maxim MAX1600, with the following connections:
0020  *
0021  *   MAX1600      Neponset
0022  *
0023  *    A0VCC        SA-1111 GPIO A<1>
0024  *    A1VCC        SA-1111 GPIO A<0>
0025  *    A0VPP        CPLD NCR A0VPP
0026  *    A1VPP        CPLD NCR A1VPP
0027  *    B0VCC        SA-1111 GPIO A<2>
0028  *    B1VCC        SA-1111 GPIO A<3>
0029  *    B0VPP        ground (slot B is CF)
0030  *    B1VPP        ground (slot B is CF)
0031  *
0032  *     VX          VCC (5V)
0033  *     VY          VCC3_3 (3.3V)
0034  *     12INA       12V
0035  *     12INB       ground (slot B is CF)
0036  *
0037  * The MAX1600 CODE pin is tied to ground, placing the device in 
0038  * "Standard Intel code" mode. Refer to the Maxim data sheet for
0039  * the corresponding truth table.
0040  */
0041 static int neponset_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
0042 {
0043     struct max1600 *m;
0044     int ret;
0045 
0046     ret = max1600_init(skt->socket.dev.parent, &m,
0047                skt->nr ? MAX1600_CHAN_B : MAX1600_CHAN_A,
0048                MAX1600_CODE_LOW);
0049     if (ret == 0)
0050         skt->driver_data = m;
0051 
0052     return ret;
0053 }
0054 
0055 static int
0056 neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
0057 {
0058     struct max1600 *m = skt->driver_data;
0059     int ret;
0060 
0061     ret = sa1111_pcmcia_configure_socket(skt, state);
0062     if (ret == 0)
0063         ret = max1600_configure(m, state->Vcc, state->Vpp);
0064 
0065     return ret;
0066 }
0067 
0068 static struct pcmcia_low_level neponset_pcmcia_ops = {
0069     .owner          = THIS_MODULE,
0070     .hw_init        = neponset_pcmcia_hw_init,
0071     .configure_socket   = neponset_pcmcia_configure_socket,
0072     .first          = 0,
0073     .nr         = 2,
0074 };
0075 
0076 int pcmcia_neponset_init(struct sa1111_dev *sadev)
0077 {
0078     sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops);
0079     return sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops,
0080                  sa11xx_drv_pcmcia_add_one);
0081 }