ARM: sa1100/shannon: convert to generic CF sockets
authorRussell King <rmk+kernel@armlinux.org.uk>
Wed, 31 Aug 2016 07:49:48 +0000 (08:49 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Fri, 6 Apr 2018 14:53:22 +0000 (15:53 +0100)
Convert shannon to use the generic CF socket support.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/mach-sa1100/Kconfig
arch/arm/mach-sa1100/shannon.c
drivers/pcmcia/Makefile
drivers/pcmcia/sa1100_generic.c
drivers/pcmcia/sa1100_generic.h
drivers/pcmcia/sa1100_shannon.c [deleted file]

index 5ca5847..fde7ef1 100644 (file)
@@ -139,6 +139,8 @@ config SA1100_PLEB
 config SA1100_SHANNON
        bool "Shannon"
        select ARM_SA1100_CPUFREQ
+       select REGULATOR
+       select REGULATOR_FIXED_VOLTAGE
        help
          The Shannon (also known as a Tuxscreen, and also as a IS2630) was a
          limited edition webphone produced by Philips. The Shannon is a SA1100
index 856664c..22f7fe0 100644 (file)
@@ -5,11 +5,14 @@
 
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/gpio/machine.h>
 #include <linux/kernel.h>
 #include <linux/platform_data/sa11x0-serial.h>
 #include <linux/tty.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/regulator/fixed.h>
+#include <linux/regulator/machine.h>
 
 #include <video/sa1100fb.h>
 
@@ -72,8 +75,43 @@ static struct sa1100fb_mach_info shannon_lcd_info = {
        .lccr3          = LCCR3_ACBsDiv(512),
 };
 
+static struct gpiod_lookup_table shannon_pcmcia0_gpio_table = {
+       .dev_id = "sa11x0-pcmcia.0",
+       .table = {
+               GPIO_LOOKUP("gpio", 24, "detect", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("gpio", 26, "ready", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table shannon_pcmcia1_gpio_table = {
+       .dev_id = "sa11x0-pcmcia.1",
+       .table = {
+               GPIO_LOOKUP("gpio", 25, "detect", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("gpio", 27, "ready", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct regulator_consumer_supply shannon_cf_vcc_consumers[] = {
+       REGULATOR_SUPPLY("vcc", "sa11x0-pcmcia.0"),
+       REGULATOR_SUPPLY("vcc", "sa11x0-pcmcia.1"),
+};
+
+static struct fixed_voltage_config shannon_cf_vcc_pdata __initdata = {
+       .supply_name = "cf-power",
+       .microvolts = 3300000,
+       .enabled_at_boot = 1,
+       .gpio = -EINVAL,
+};
+
 static void __init shannon_init(void)
 {
+       sa11x0_register_fixed_regulator(0, &shannon_cf_vcc_pdata,
+                                       shannon_cf_vcc_consumers,
+                                       ARRAY_SIZE(shannon_cf_vcc_consumers));
+       sa11x0_register_pcmcia(0, &shannon_pcmcia0_gpio_table);
+       sa11x0_register_pcmcia(1, &shannon_pcmcia1_gpio_table);
        sa11x0_ppc_configure_mcp();
        sa11x0_register_lcd(&shannon_lcd_info);
        sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1);
index 722871a..7f501d3 100644 (file)
@@ -49,7 +49,6 @@ sa1100_cs-y                                   += sa1100_generic.o
 sa1100_cs-$(CONFIG_SA1100_COLLIE)              += pxa2xx_sharpsl.o
 sa1100_cs-$(CONFIG_SA1100_H3100)               += sa1100_h3600.o
 sa1100_cs-$(CONFIG_SA1100_H3600)               += sa1100_h3600.o
-sa1100_cs-$(CONFIG_SA1100_SHANNON)             += sa1100_shannon.o
 sa1100_cs-$(CONFIG_SA1100_SIMPAD)              += sa1100_simpad.o
 
 pxa2xx_cm_x2xx_cs-y                            += pxa2xx_cm_x2xx.o pxa2xx_cm_x255.o pxa2xx_cm_x270.o
index 59a670f..47b060c 100644 (file)
@@ -101,9 +101,6 @@ static int (*sa11x0_pcmcia_legacy_hw_init[])(struct device *dev) = {
 #if defined(CONFIG_SA1100_H3100) || defined(CONFIG_SA1100_H3600)
        pcmcia_h3600_init,
 #endif
-#ifdef CONFIG_SA1100_SHANNON
-       pcmcia_shannon_init,
-#endif
 #ifdef CONFIG_SA1100_SIMPAD
        pcmcia_simpad_init,
 #endif
index 1e255c1..7b7cdcd 100644 (file)
@@ -14,7 +14,6 @@ extern int pcmcia_graphicsmaster_init(struct device *);
 extern int pcmcia_h3600_init(struct device *);
 extern int pcmcia_pangolin_init(struct device *);
 extern int pcmcia_pfs168_init(struct device *);
-extern int pcmcia_shannon_init(struct device *);
 extern int pcmcia_simpad_init(struct device *);
 extern int pcmcia_stork_init(struct device *);
 extern int pcmcia_system3_init(struct device *);
diff --git a/drivers/pcmcia/sa1100_shannon.c b/drivers/pcmcia/sa1100_shannon.c
deleted file mode 100644 (file)
index 0e52a57..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * drivers/pcmcia/sa1100_shannon.c
- *
- * PCMCIA implementation routines for Shannon
- *
- */
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/device.h>
-#include <linux/init.h>
-#include <linux/io.h>
-
-#include <mach/hardware.h>
-#include <asm/mach-types.h>
-#include <mach/shannon.h>
-#include <asm/irq.h>
-#include "sa1100_generic.h"
-
-static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
-{
-       /* All those are inputs */
-       GAFR &= ~(GPIO_GPIO(SHANNON_GPIO_EJECT_0) |
-                 GPIO_GPIO(SHANNON_GPIO_EJECT_1) |
-                 GPIO_GPIO(SHANNON_GPIO_RDY_0) |
-                 GPIO_GPIO(SHANNON_GPIO_RDY_1));
-
-       if (skt->nr == 0) {
-               skt->stat[SOC_STAT_CD].gpio = SHANNON_GPIO_EJECT_0;
-               skt->stat[SOC_STAT_CD].name = "PCMCIA_CD_0";
-               skt->stat[SOC_STAT_RDY].gpio = SHANNON_GPIO_RDY_0;
-               skt->stat[SOC_STAT_RDY].name = "PCMCIA_RDY_0";
-       } else {
-               skt->stat[SOC_STAT_CD].gpio = SHANNON_GPIO_EJECT_1;
-               skt->stat[SOC_STAT_CD].name = "PCMCIA_CD_1";
-               skt->stat[SOC_STAT_RDY].gpio = SHANNON_GPIO_RDY_1;
-               skt->stat[SOC_STAT_RDY].name = "PCMCIA_RDY_1";
-       }
-
-       return 0;
-}
-
-static void
-shannon_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
-                           struct pcmcia_state *state)
-{
-       switch (skt->nr) {
-       case 0:
-               state->bvd1   = 1; 
-               state->bvd2   = 1; 
-               state->vs_3v  = 1; /* FIXME Can only apply 3.3V on Shannon. */
-               state->vs_Xv  = 0;
-               break;
-
-       case 1:
-               state->bvd1   = 1; 
-               state->bvd2   = 1; 
-               state->vs_3v  = 1; /* FIXME Can only apply 3.3V on Shannon. */
-               state->vs_Xv  = 0;
-               break;
-       }
-}
-
-static int
-shannon_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
-                               const socket_state_t *state)
-{
-       switch (state->Vcc) {
-       case 0: /* power off */
-               printk(KERN_WARNING "%s(): CS asked for 0V, still applying 3.3V..\n", __func__);
-               break;
-       case 50:
-               printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V..\n", __func__);
-       case 33:
-               break;
-       default:
-               printk(KERN_ERR "%s(): unrecognized Vcc %u\n",
-                      __func__, state->Vcc);
-               return -1;
-       }
-
-       printk(KERN_WARNING "%s(): Warning, Can't perform reset\n", __func__);
-       
-       /* Silently ignore Vpp, output enable, speaker enable. */
-
-       return 0;
-}
-
-static struct pcmcia_low_level shannon_pcmcia_ops = {
-       .owner                  = THIS_MODULE,
-       .hw_init                = shannon_pcmcia_hw_init,
-       .socket_state           = shannon_pcmcia_socket_state,
-       .configure_socket       = shannon_pcmcia_configure_socket,
-};
-
-int pcmcia_shannon_init(struct device *dev)
-{
-       int ret = -ENODEV;
-
-       if (machine_is_shannon())
-               ret = sa11xx_drv_pcmcia_probe(dev, &shannon_pcmcia_ops, 0, 2);
-
-       return ret;
-}