diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-08-31 03:49:47 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2018-03-24 10:17:07 -0400 |
commit | 29786e9b6551b822de66aa64b07e21eeb36ded89 (patch) | |
tree | 9e27ec5caccfa256fa44e713d2f9e3bbfb299ae6 | |
parent | 0920ca103f8d8b53619bb69fa34185013f448ca2 (diff) |
ARM: sa1100/assabet: convert to generic CF sockets
Convert Assabet to use the generic CF socket support.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | arch/arm/mach-sa1100/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/assabet.c | 39 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/include/mach/assabet.h | 6 | ||||
-rw-r--r-- | drivers/pcmcia/Makefile | 1 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_assabet.c | 100 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_generic.c | 3 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_generic.h | 1 |
7 files changed, 40 insertions, 112 deletions
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig index 07df3a59b13f..5ca5847d89cc 100644 --- a/arch/arm/mach-sa1100/Kconfig +++ b/arch/arm/mach-sa1100/Kconfig | |||
@@ -6,6 +6,8 @@ config SA1100_ASSABET | |||
6 | bool "Assabet" | 6 | bool "Assabet" |
7 | select ARM_SA1110_CPUFREQ | 7 | select ARM_SA1110_CPUFREQ |
8 | select GPIO_REG | 8 | select GPIO_REG |
9 | select REGULATOR | ||
10 | select REGULATOR_FIXED_VOLTAGE | ||
9 | help | 11 | help |
10 | Say Y here if you are using the Intel(R) StrongARM(R) SA-1110 | 12 | Say Y here if you are using the Intel(R) StrongARM(R) SA-1110 |
11 | Microprocessor Development Board (also known as the Assabet). | 13 | Microprocessor Development Board (also known as the Assabet). |
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index f68241d995f2..575ec085cffa 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c | |||
@@ -14,8 +14,11 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/gpio/gpio-reg.h> | 16 | #include <linux/gpio/gpio-reg.h> |
17 | #include <linux/gpio/machine.h> | ||
17 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
18 | #include <linux/platform_data/sa11x0-serial.h> | 19 | #include <linux/platform_data/sa11x0-serial.h> |
20 | #include <linux/regulator/fixed.h> | ||
21 | #include <linux/regulator/machine.h> | ||
19 | #include <linux/serial_core.h> | 22 | #include <linux/serial_core.h> |
20 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
21 | #include <linux/mfd/ucb1x00.h> | 24 | #include <linux/mfd/ucb1x00.h> |
@@ -445,6 +448,29 @@ static struct resource neponset_resources[] = { | |||
445 | }; | 448 | }; |
446 | #endif | 449 | #endif |
447 | 450 | ||
451 | static struct gpiod_lookup_table assabet_cf_gpio_table = { | ||
452 | .dev_id = "sa11x0-pcmcia.1", | ||
453 | .table = { | ||
454 | GPIO_LOOKUP("gpio", 21, "ready", GPIO_ACTIVE_HIGH), | ||
455 | GPIO_LOOKUP("gpio", 22, "detect", GPIO_ACTIVE_LOW), | ||
456 | GPIO_LOOKUP("gpio", 24, "bvd2", GPIO_ACTIVE_HIGH), | ||
457 | GPIO_LOOKUP("gpio", 25, "bvd1", GPIO_ACTIVE_HIGH), | ||
458 | GPIO_LOOKUP("assabet", 1, "reset", GPIO_ACTIVE_HIGH), | ||
459 | GPIO_LOOKUP("assabet", 7, "bus-enable", GPIO_ACTIVE_LOW), | ||
460 | { }, | ||
461 | }, | ||
462 | }; | ||
463 | |||
464 | static struct regulator_consumer_supply assabet_cf_vcc_consumers[] = { | ||
465 | REGULATOR_SUPPLY("vcc", "sa11x0-pcmcia.1"), | ||
466 | }; | ||
467 | |||
468 | static struct fixed_voltage_config assabet_cf_vcc_pdata __initdata = { | ||
469 | .supply_name = "cf-power", | ||
470 | .microvolts = 3300000, | ||
471 | .enable_high = 1, | ||
472 | }; | ||
473 | |||
448 | static void __init assabet_init(void) | 474 | static void __init assabet_init(void) |
449 | { | 475 | { |
450 | /* | 476 | /* |
@@ -490,6 +516,11 @@ static void __init assabet_init(void) | |||
490 | platform_device_register_simple("neponset", 0, | 516 | platform_device_register_simple("neponset", 0, |
491 | neponset_resources, ARRAY_SIZE(neponset_resources)); | 517 | neponset_resources, ARRAY_SIZE(neponset_resources)); |
492 | #endif | 518 | #endif |
519 | } else { | ||
520 | sa11x0_register_fixed_regulator(0, &assabet_cf_vcc_pdata, | ||
521 | assabet_cf_vcc_consumers, | ||
522 | ARRAY_SIZE(assabet_cf_vcc_consumers)); | ||
523 | |||
493 | } | 524 | } |
494 | 525 | ||
495 | #ifndef ASSABET_PAL_VIDEO | 526 | #ifndef ASSABET_PAL_VIDEO |
@@ -501,6 +532,9 @@ static void __init assabet_init(void) | |||
501 | ARRAY_SIZE(assabet_flash_resources)); | 532 | ARRAY_SIZE(assabet_flash_resources)); |
502 | sa11x0_register_irda(&assabet_irda_data); | 533 | sa11x0_register_irda(&assabet_irda_data); |
503 | sa11x0_register_mcp(&assabet_mcp_data); | 534 | sa11x0_register_mcp(&assabet_mcp_data); |
535 | |||
536 | if (!machine_has_neponset()) | ||
537 | sa11x0_register_pcmcia(1, &assabet_cf_gpio_table); | ||
504 | } | 538 | } |
505 | 539 | ||
506 | /* | 540 | /* |
@@ -768,6 +802,7 @@ fs_initcall(assabet_leds_init); | |||
768 | 802 | ||
769 | void __init assabet_init_irq(void) | 803 | void __init assabet_init_irq(void) |
770 | { | 804 | { |
805 | unsigned int assabet_gpio_base; | ||
771 | u32 def_val; | 806 | u32 def_val; |
772 | 807 | ||
773 | sa1100_init_irq(); | 808 | sa1100_init_irq(); |
@@ -782,7 +817,9 @@ void __init assabet_init_irq(void) | |||
782 | * | 817 | * |
783 | * This must precede any driver calls to BCR_set() or BCR_clear(). | 818 | * This must precede any driver calls to BCR_set() or BCR_clear(). |
784 | */ | 819 | */ |
785 | assabet_init_gpio((void *)&ASSABET_BCR, def_val); | 820 | assabet_gpio_base = assabet_init_gpio((void *)&ASSABET_BCR, def_val); |
821 | |||
822 | assabet_cf_vcc_pdata.gpio = assabet_gpio_base + 0; | ||
786 | } | 823 | } |
787 | 824 | ||
788 | MACHINE_START(ASSABET, "Intel-Assabet") | 825 | MACHINE_START(ASSABET, "Intel-Assabet") |
diff --git a/arch/arm/mach-sa1100/include/mach/assabet.h b/arch/arm/mach-sa1100/include/mach/assabet.h index 558b45323a2d..641a961653af 100644 --- a/arch/arm/mach-sa1100/include/mach/assabet.h +++ b/arch/arm/mach-sa1100/include/mach/assabet.h | |||
@@ -96,10 +96,4 @@ extern void assabet_uda1341_reset(int set); | |||
96 | #define ASSABET_GPIO_BATT_LOW GPIO_GPIO (26) /* Low battery */ | 96 | #define ASSABET_GPIO_BATT_LOW GPIO_GPIO (26) /* Low battery */ |
97 | #define ASSABET_GPIO_RCLK GPIO_GPIO (26) /* CCLK/2 */ | 97 | #define ASSABET_GPIO_RCLK GPIO_GPIO (26) /* CCLK/2 */ |
98 | 98 | ||
99 | /* These are gpiolib GPIO numbers, not bitmasks */ | ||
100 | #define ASSABET_GPIO_CF_IRQ 21 /* CF IRQ */ | ||
101 | #define ASSABET_GPIO_CF_CD 22 /* CF CD */ | ||
102 | #define ASSABET_GPIO_CF_BVD2 24 /* CF BVD / IOSPKR */ | ||
103 | #define ASSABET_GPIO_CF_BVD1 25 /* CF BVD / IOSTSCHG */ | ||
104 | |||
105 | #endif | 99 | #endif |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index e7dae16b9a43..130a06649b41 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -46,7 +46,6 @@ sa1111_cs-$(CONFIG_SA1100_JORNADA720) += sa1111_jornada720.o | |||
46 | sa1111_cs-$(CONFIG_ARCH_LUBBOCK) += sa1111_lubbock.o | 46 | sa1111_cs-$(CONFIG_ARCH_LUBBOCK) += sa1111_lubbock.o |
47 | 47 | ||
48 | sa1100_cs-y += sa1100_generic.o | 48 | sa1100_cs-y += sa1100_generic.o |
49 | sa1100_cs-$(CONFIG_SA1100_ASSABET) += sa1100_assabet.o | ||
50 | sa1100_cs-$(CONFIG_SA1100_CERF) += sa1100_cerf.o | 49 | sa1100_cs-$(CONFIG_SA1100_CERF) += sa1100_cerf.o |
51 | sa1100_cs-$(CONFIG_SA1100_COLLIE) += pxa2xx_sharpsl.o | 50 | sa1100_cs-$(CONFIG_SA1100_COLLIE) += pxa2xx_sharpsl.o |
52 | sa1100_cs-$(CONFIG_SA1100_H3100) += sa1100_h3600.o | 51 | sa1100_cs-$(CONFIG_SA1100_H3100) += sa1100_h3600.o |
diff --git a/drivers/pcmcia/sa1100_assabet.c b/drivers/pcmcia/sa1100_assabet.c deleted file mode 100644 index 78ad2bba76db..000000000000 --- a/drivers/pcmcia/sa1100_assabet.c +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | /* | ||
3 | * drivers/pcmcia/sa1100_assabet.c | ||
4 | * | ||
5 | * PCMCIA implementation routines for Assabet | ||
6 | * | ||
7 | */ | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/errno.h> | ||
11 | #include <linux/interrupt.h> | ||
12 | #include <linux/device.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/gpio.h> | ||
15 | |||
16 | #include <asm/mach-types.h> | ||
17 | #include <mach/assabet.h> | ||
18 | |||
19 | #include "sa1100_generic.h" | ||
20 | |||
21 | static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
22 | { | ||
23 | skt->stat[SOC_STAT_CD].gpio = ASSABET_GPIO_CF_CD; | ||
24 | skt->stat[SOC_STAT_CD].name = "CF CD"; | ||
25 | skt->stat[SOC_STAT_BVD1].gpio = ASSABET_GPIO_CF_BVD1; | ||
26 | skt->stat[SOC_STAT_BVD1].name = "CF BVD1"; | ||
27 | skt->stat[SOC_STAT_BVD2].gpio = ASSABET_GPIO_CF_BVD2; | ||
28 | skt->stat[SOC_STAT_BVD2].name = "CF BVD2"; | ||
29 | skt->stat[SOC_STAT_RDY].gpio = ASSABET_GPIO_CF_IRQ; | ||
30 | skt->stat[SOC_STAT_RDY].name = "CF RDY"; | ||
31 | |||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static int | ||
36 | assabet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | ||
37 | { | ||
38 | unsigned int mask; | ||
39 | |||
40 | switch (state->Vcc) { | ||
41 | case 0: | ||
42 | mask = 0; | ||
43 | break; | ||
44 | |||
45 | case 50: | ||
46 | printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V...\n", | ||
47 | __func__); | ||
48 | |||
49 | case 33: /* Can only apply 3.3V to the CF slot. */ | ||
50 | mask = ASSABET_BCR_CF_PWR; | ||
51 | break; | ||
52 | |||
53 | default: | ||
54 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __func__, | ||
55 | state->Vcc); | ||
56 | return -1; | ||
57 | } | ||
58 | |||
59 | /* Silently ignore Vpp, speaker enable. */ | ||
60 | |||
61 | if (state->flags & SS_RESET) | ||
62 | mask |= ASSABET_BCR_CF_RST; | ||
63 | if (!(state->flags & SS_OUTPUT_ENA)) | ||
64 | mask |= ASSABET_BCR_CF_BUS_OFF; | ||
65 | |||
66 | ASSABET_BCR_frob(ASSABET_BCR_CF_RST | ASSABET_BCR_CF_PWR | | ||
67 | ASSABET_BCR_CF_BUS_OFF, mask); | ||
68 | |||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | /* | ||
73 | * Disable card status IRQs on suspend. | ||
74 | */ | ||
75 | static void assabet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
76 | { | ||
77 | /* | ||
78 | * Tristate the CF bus signals. Also assert CF | ||
79 | * reset as per user guide page 4-11. | ||
80 | */ | ||
81 | ASSABET_BCR_set(ASSABET_BCR_CF_BUS_OFF | ASSABET_BCR_CF_RST); | ||
82 | } | ||
83 | |||
84 | static struct pcmcia_low_level assabet_pcmcia_ops = { | ||
85 | .owner = THIS_MODULE, | ||
86 | .hw_init = assabet_pcmcia_hw_init, | ||
87 | .socket_state = soc_common_cf_socket_state, | ||
88 | .configure_socket = assabet_pcmcia_configure_socket, | ||
89 | .socket_suspend = assabet_pcmcia_socket_suspend, | ||
90 | }; | ||
91 | |||
92 | int pcmcia_assabet_init(struct device *dev) | ||
93 | { | ||
94 | int ret = -ENODEV; | ||
95 | |||
96 | if (machine_is_assabet() && !machine_has_neponset()) | ||
97 | ret = sa11xx_drv_pcmcia_probe(dev, &assabet_pcmcia_ops, 1, 1); | ||
98 | |||
99 | return ret; | ||
100 | } | ||
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index 324e3e631353..1987d94361e9 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
@@ -98,9 +98,6 @@ static struct pcmcia_low_level sa11x0_cf_ops = { | |||
98 | int __init pcmcia_collie_init(struct device *dev); | 98 | int __init pcmcia_collie_init(struct device *dev); |
99 | 99 | ||
100 | static int (*sa11x0_pcmcia_legacy_hw_init[])(struct device *dev) = { | 100 | static int (*sa11x0_pcmcia_legacy_hw_init[])(struct device *dev) = { |
101 | #ifdef CONFIG_SA1100_ASSABET | ||
102 | pcmcia_assabet_init, | ||
103 | #endif | ||
104 | #ifdef CONFIG_SA1100_CERF | 101 | #ifdef CONFIG_SA1100_CERF |
105 | pcmcia_cerf_init, | 102 | pcmcia_cerf_init, |
106 | #endif | 103 | #endif |
diff --git a/drivers/pcmcia/sa1100_generic.h b/drivers/pcmcia/sa1100_generic.h index a5f1f1dd63cb..597c796f7dad 100644 --- a/drivers/pcmcia/sa1100_generic.h +++ b/drivers/pcmcia/sa1100_generic.h | |||
@@ -6,7 +6,6 @@ | |||
6 | * Declaration for all machine specific init/exit functions. | 6 | * Declaration for all machine specific init/exit functions. |
7 | */ | 7 | */ |
8 | extern int pcmcia_adsbitsy_init(struct device *); | 8 | extern int pcmcia_adsbitsy_init(struct device *); |
9 | extern int pcmcia_assabet_init(struct device *); | ||
10 | extern int pcmcia_badge4_init(struct device *); | 9 | extern int pcmcia_badge4_init(struct device *); |
11 | extern int pcmcia_cerf_init(struct device *); | 10 | extern int pcmcia_cerf_init(struct device *); |
12 | extern int pcmcia_flexanet_init(struct device *); | 11 | extern int pcmcia_flexanet_init(struct device *); |