linux/drivers/pcmcia/sa1111_neponset.c
<<
>>
Prefs
   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
  13#include <asm/mach-types.h>
  14
  15#include "sa1111_generic.h"
  16#include "max1600.h"
  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 */
  41static 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}
  54
  55static int
  56neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
  57{
  58        struct max1600 *m = skt->driver_data;
  59        int ret;
  60
  61        ret = sa1111_pcmcia_configure_socket(skt, state);
  62        if (ret == 0)
  63                ret = max1600_configure(m, state->Vcc, state->Vpp);
  64
  65        return ret;
  66}
  67
  68static 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,
  74};
  75
  76int pcmcia_neponset_init(struct sa1111_dev *sadev)
  77{
  78        sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops);
  79        return sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops,
  80                                 sa11xx_drv_pcmcia_add_one);
  81}
  82