Skip to contentSkip to conversation

SA11xx PCMCIA updates and GPIOD conversion

PATCH New Russell King - ARM Linux 4 participants 14 messages Nov 28, 2018 – Nov 30, 2018

Subsystems (5)
lore
Share & tools
lore

Russell King - ARM Linux

author maintainer
#0 lore raw

cover SA11xx PCMCIA updates and GPIOD conversion

This series adds a generic MAX1600 library which uses the GPIOD interfaces to control the PCMCIA power switches, and converts some SA11x0/PXA drivers to it, reducing the code duplication. This also allows us to kill the SA1111 private GPIO interfaces.

 arch/arm/common/sa1111.c                   |  59 --------------
 arch/arm/include/asm/hardware/sa1111.h     |   4 -
 arch/arm/mach-pxa/Kconfig                  |   1 +
 arch/arm/mach-pxa/include/mach/mainstone.h |   4 +
 arch/arm/mach-pxa/lubbock.c                |  16 ++++
 arch/arm/mach-pxa/mainstone.c              |  53 +++++++++++++
 arch/arm/mach-sa1100/generic.c             |  10 ---
 arch/arm/mach-sa1100/h3100.c               |   1 +
 arch/arm/mach-sa1100/jornada720.c          |  12 +++
 arch/arm/mach-sa1100/neponset.c            |  19 +++++
 drivers/pcmcia/Kconfig                     |   6 ++
 drivers/pcmcia/Makefile                    |   1 +
 drivers/pcmcia/max1600.c                   | 122 +++++++++++++++++++++++++++++
 drivers/pcmcia/max1600.h                   |  32 ++++++++
 drivers/pcmcia/pxa2xx_mainstone.c          | 113 ++++++++------------------
 drivers/pcmcia/sa1100_simpad.c             |   4 +-
 drivers/pcmcia/sa1111_jornada720.c         |  83 +++++++++++++-------
 drivers/pcmcia/sa1111_lubbock.c            | 110 +++++---------------------
 drivers/pcmcia/sa1111_neponset.c           |  79 +++++--------------
 19 files changed, 396 insertions(+), 333 deletions(-)
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
#1 lore raw

PATCH 1/8 ARM: sa1100: explicitly register sa11x0-pcmcia devices

Simplify the code by getting rid of the conditional automatic registration of the sa11x0 PCMCIA interfaces in sa1100_init(), and require all platforms to explicitly call sa11x0_register_pcmcia(). Only one platform (iPAQ) is affected by this change.

---
 arch/arm/mach-sa1100/generic.c | 10 ----------
 arch/arm/mach-sa1100/h3100.c   |  1 +
 2 files changed, 1 insertion(+), 10 deletions(-)
arch/arm/mach-sa1100/generic.c +0 -10
index 800321c6cbd8..755290bf658b 100644
@@ -235,18 +235,11 @@ void sa11x0_register_lcd(struct sa1100fb_mach_info *inf)
 	sa11x0_register_device(&sa11x0fb_device, inf);
 }
 
-static bool sa11x0pcmcia_legacy = true;
-static struct platform_device sa11x0pcmcia_device = {
-	.name		= "sa11x0-pcmcia",
-	.id		= -1,
-};
-
 void sa11x0_register_pcmcia(int socket, struct gpiod_lookup_table *table)
 {
 	if (table)
 		gpiod_add_lookup_table(table);
 	platform_device_register_simple("sa11x0-pcmcia", socket, NULL, 0);
-	sa11x0pcmcia_legacy = false;
 }
 
 static struct platform_device sa11x0mtd_device = {
@@ -331,9 +324,6 @@ static int __init sa1100_init(void)
 {
 	pm_power_off = sa1100_power_off;
 
-	if (sa11x0pcmcia_legacy)
-		platform_device_register(&sa11x0pcmcia_device);
-
 	regulator_has_full_constraints();
 
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
arch/arm/mach-sa1100/h3100.c +1 -0
index c6b412054a3c..9dc5bcb7326b 100644
@@ -126,6 +126,7 @@ static void __init h3100_mach_init(void)
 {
 	h3xxx_mach_init();
 
+	sa11x0_register_pcmcia(-1, NULL);
 	sa11x0_register_lcd(&h3100_lcd_info);
 	sa11x0_register_irda(&h3100_irda_data);
 }
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/8 pcmcia: add MAX1600 library

In reply to Russell King - ARM Linux

Add a library for the MAX1600 PCMCIA power switch device. This is a dual-channel device, controlled via four GPIO signals per channel. Two signals control the Vcc output, and two control the Vpp output.

---
 drivers/pcmcia/Kconfig   |   3 ++
 drivers/pcmcia/Makefile  |   1 +
 drivers/pcmcia/max1600.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pcmcia/max1600.h |  32 +++++++++++++
 4 files changed, 158 insertions(+)
 create mode 100644 drivers/pcmcia/max1600.c
 create mode 100644 drivers/pcmcia/max1600.h
drivers/pcmcia/Kconfig +3 -0
index cbbe4a285b48..1a257a323923 100644
@@ -63,6 +63,9 @@ config CARDBUS
 
 	  If unsure, say Y.
 
+config PCMCIA_MAX1600
+	tristate
+
 comment "PC-card bridges"
 
 config YENTA
drivers/pcmcia/Makefile +1 -0
index 28502bd159e0..01779c5c45f3 100644
@@ -35,6 +35,7 @@ obj-$(CONFIG_OMAP_CF)				+= omap_cf.o
 obj-$(CONFIG_AT91_CF)				+= at91_cf.o
 obj-$(CONFIG_ELECTRA_CF)			+= electra_cf.o
 obj-$(CONFIG_PCMCIA_ALCHEMY_DEVBOARD)		+= db1xxx_ss.o
+obj-$(CONFIG_PCMCIA_MAX1600)			+= max1600.o
 
 sa1111_cs-y					+= sa1111_generic.o
 sa1111_cs-$(CONFIG_ASSABET_NEPONSET)		+= sa1111_neponset.o
drivers/pcmcia/max1600.c new file +122 -0

122 lines not on this page · raw message

drivers/pcmcia/max1600.h new file +32 -0
new file mode 100644
index 000000000000..00bf1a09464f
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef MAX1600_H
+#define MAX1600_H
+
+struct gpio_desc;
+
+enum {
+	MAX1600_GPIO_0VCC = 0,
+	MAX1600_GPIO_1VCC,
+	MAX1600_GPIO_0VPP,
+	MAX1600_GPIO_1VPP,
+	MAX1600_GPIO_MAX,
+
+	MAX1600_CHAN_A,
+	MAX1600_CHAN_B,
+
+	MAX1600_CODE_LOW,
+	MAX1600_CODE_HIGH,
+};
+
+struct max1600 {
+	struct gpio_desc *gpio[MAX1600_GPIO_MAX];
+	struct device *dev;
+	unsigned int code;
+};
+
+int max1600_init(struct device *dev, struct max1600 **ptr,
+	unsigned int channel, unsigned int code);
+
+int max1600_configure(struct max1600 *, unsigned int vcc, unsigned int vpp);
+
+#endif
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/8 ARM: sa1100/jornada720: switch PCMCIA to gpiod APIs

In reply to Russell King - ARM Linux

Convert the low level PCMCIA driver to gpiod APIs for controlling the socket power.

---
 arch/arm/mach-sa1100/jornada720.c  | 12 ++++++
 drivers/pcmcia/sa1111_jornada720.c | 83 +++++++++++++++++++++++++-------------
 2 files changed, 67 insertions(+), 28 deletions(-)
arch/arm/mach-sa1100/jornada720.c +12 -0
index 0a2ca9be00e6..6298bad09ef3 100644
@@ -190,6 +190,17 @@ static struct platform_device s1d13xxxfb_device = {
 	.resource	= s1d13xxxfb_resources,
 };
 
+static struct gpiod_lookup_table jornada_pcmcia_gpiod_table = {
+	.dev_id = "1800",
+	.table = {
+		GPIO_LOOKUP("sa1111", 0, "s0-power", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sa1111", 1, "s1-power", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sa1111", 2, "s0-3v", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sa1111", 3, "s1-3v", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 static struct resource sa1111_resources[] = {
 	[0] = DEFINE_RES_MEM(SA1111REGSTART, SA1111REGLEN),
 	[1] = DEFINE_RES_IRQ(IRQ_GPIO1),
@@ -265,6 +276,7 @@ static int __init jornada720_init(void)
 		udelay(20);		/* give it some time to restart */
 
 		gpiod_add_lookup_table(&jornada_ts_gpiod_table);
+		gpiod_add_lookup_table(&jornada_pcmcia_gpiod_table);
 
 		ret = platform_add_devices(devices, ARRAY_SIZE(devices));
 	}
drivers/pcmcia/sa1111_jornada720.c +55 -28

148 lines not on this page · raw message

Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/8 ARM: sa1100/neponset: switch PCMCIA to MAX1600 library and gpiod APIs

In reply to Russell King - ARM Linux

Convert Neponset to use the gpiod API to specify which GPIOs are used for PCMCIA, and use the MAX1600 power switch library for Neponset, simplifying the neponset pcmcia driver as a result.

---
 arch/arm/mach-sa1100/neponset.c  | 19 ++++++++++
 drivers/pcmcia/Kconfig           |  1 +
 drivers/pcmcia/sa1111_neponset.c | 79 +++++++++-------------------------------
 3 files changed, 38 insertions(+), 61 deletions(-)
arch/arm/mach-sa1100/neponset.c +19 -0
index b1823f445358..eb60a71cf125 100644
@@ -5,6 +5,7 @@
 #include <linux/err.h>
 #include <linux/gpio/driver.h>
 #include <linux/gpio/gpio-reg.h>
+#include <linux/gpio/machine.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/irq.h>
@@ -96,6 +97,19 @@ struct neponset_drvdata {
 	struct gpio_chip *gpio[4];
 };
 
+static struct gpiod_lookup_table neponset_pcmcia_table = {
+	.dev_id = "1800",
+	.table = {
+		GPIO_LOOKUP("sa1111", 1, "a0vcc", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sa1111", 0, "a1vcc", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("neponset-ncr", 5, "a0vpp", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("neponset-ncr", 6, "a1vpp", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sa1111", 2, "b0vcc", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sa1111", 3, "b1vcc", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 static struct neponset_drvdata *nep;
 
 void neponset_ncr_frob(unsigned int mask, unsigned int val)
@@ -374,6 +388,8 @@ static int neponset_probe(struct platform_device *dev)
 			   d->base + AUD_CTL, AUD_NGPIO, false,
 			   neponset_aud_names);
 
+	gpiod_add_lookup_table(&neponset_pcmcia_table);
+
 	/*
 	 * We would set IRQ_GPIO25 to be a wake-up IRQ, but unfortunately
 	 * something on the Neponset activates this IRQ on sleep (eth?)
@@ -424,6 +440,9 @@ static int neponset_remove(struct platform_device *dev)
 		platform_device_unregister(d->sa1111);
 	if (!IS_ERR(d->smc91x))
 		platform_device_unregister(d->smc91x);
+
+	gpiod_remove_lookup_table(&neponset_pcmcia_table);
+
 	irq_set_chained_handler(irq, NULL);
 	irq_free_descs(d->irq_base, NEP_IRQ_NR);
 	nep = NULL;
drivers/pcmcia/Kconfig +1 -0
index 1a257a323923..8e8db3aa9fce 100644
@@ -194,6 +194,7 @@ config PCMCIA_SA1111
 	select PCMCIA_SOC_COMMON
 	select PCMCIA_SA11XX_BASE if ARCH_SA1100
 	select PCMCIA_PXA2XX if ARCH_LUBBOCK && SA1111
+	select PCMCIA_MAX1600 if ASSABET_NEPONSET
 	help
 	  Say Y  here to include support for SA1111-based PCMCIA or CF
 	  sockets, found on the Jornada 720, Graphicsmaster and other
drivers/pcmcia/sa1111_neponset.c +18 -61

113 lines not on this page · raw message

Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/8 ARM: pxa/mainstone: switch PCMCIA to MAX1600 library and gpiod APIs

In reply to Russell King - ARM Linux

Convert mainstone to use the MAX1600 library and gpiod APIs for socket status and control signals.

---
 arch/arm/mach-pxa/Kconfig                  |   1 +
 arch/arm/mach-pxa/include/mach/mainstone.h |   4 +
 arch/arm/mach-pxa/mainstone.c              |  53 ++++++++++++++
 drivers/pcmcia/Kconfig                     |   1 +
 drivers/pcmcia/pxa2xx_mainstone.c          | 113 +++++++++--------------------
 5 files changed, 93 insertions(+), 79 deletions(-)
arch/arm/mach-pxa/Kconfig +1 -0
index a68b34183107..fd724a71c2e1 100644
@@ -46,6 +46,7 @@ config ARCH_LUBBOCK
 
 config MACH_MAINSTONE
 	bool "Intel HCDDBBVA0 Development Platform (aka Mainstone)"
+	select GPIO_REG
 	select PXA27x
 
 config MACH_ZYLONITE
arch/arm/mach-pxa/include/mach/mainstone.h +4 -0
index e82a7d31104e..474041a83d80 100644
@@ -119,6 +119,10 @@
 #define MST_PCMCIA_PWR_VCC_33   0x8	   /* voltage VCC = 3.3V */
 #define MST_PCMCIA_PWR_VCC_50   0x4	   /* voltage VCC = 5.0V */
 
+#define MST_PCMCIA_INPUTS \
+	(MST_PCMCIA_nIRQ | MST_PCMCIA_nSPKR_BVD2 | MST_PCMCIA_nSTSCHG_BVD1 | \
+	 MST_PCMCIA_nVS2 | MST_PCMCIA_nVS1 | MST_PCMCIA_nCD)
+
 /* board specific IRQs */
 #define MAINSTONE_NR_IRQS	IRQ_BOARD_START
 
arch/arm/mach-pxa/mainstone.c +53 -0

71 lines not on this page · raw message

drivers/pcmcia/Kconfig +1 -0
index 8e8db3aa9fce..9ac3d4a68075 100644
@@ -211,6 +211,7 @@ config PCMCIA_PXA2XX
 		    || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI \
 		    || MACH_COLIBRI320 || MACH_H4700)
 	select PCMCIA_SOC_COMMON
+	select PCMCIA_MAX1600 if MACH_MAINSTONE
 	help
 	  Say Y here to include support for the PXA2xx PCMCIA controller
 
drivers/pcmcia/pxa2xx_mainstone.c +34 -79

152 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#6 lore raw

Re: [PATCH 5/8] ARM: pxa/mainstone: switch PCMCIA to MAX1600 library and gpiod APIs

Russell King <[email protected]> writes:

Hi Russell,

I reviewed the code, and I didn't quite understand this chunk :

Quoted 6 lines
drivers/pcmcia/pxa2xx_mainstone.c +0 -2
@@ -68,62 +67,18 @@ static void mst_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 	 * as needed to avoid IRQ locks.
 	 */
 	if (flip) {
-		mst_pcmcia_status[skt->nr] = status;
-		if (status & MST_PCMCIA_nSTSCHG_BVD1)

drivers/pcmcia/pxa2xx_mainstone.c static void mst_pcmcia_socket_state(struct soc_pcmcia_socket *skt, · line 75

Quoted 10 lines
drivers/pcmcia/pxa2xx_mainstone.c +4 -4
-			enable_irq( (skt->nr == 0) ? MAINSTONE_S0_STSCHG_IRQ
-						   : MAINSTONE_S1_STSCHG_IRQ );
+		mst_pcmcia_bvd1_status[skt->nr] = state->bvd1;
+		if (state->bvd1)
+			enable_irq(skt->stat[SOC_STAT_BVD1].irq);
 		else
-			disable_irq( (skt->nr == 0) ? MAINSTONE_S0_STSCHG_IRQ
-						    : MAINSTONE_S1_STSCHG_IRQ );
+			disable_irq(skt->stat[SOC_STAT_BVD2].irq);
 	}

In the former code, the enable_irq() and disable_irq() were called with the same interrupt number. But with the new code, if I understand it correctly, the irq is different. As I don't fully grasp this chunk, I'll pinpoint it so that you can have a second look.

I'll try to have a live test, but as PCMCIA is not working on my mainstone board (ie. kernel side regression I'm trying to catch), I might not be able to test it properly.

Cheers.

Signature · 78 lines
Robert

PS: The "regression" I'm talking about, which is there before your changes and
after them as well, is in the exact same area, so I'll leave you the backtrace
of linux-master (without your patches) for information (but not analysis,
spare your free time) :

------------[ cut here ]------------
WARNING: CPU: 0 PID: 114 at kernel/irq/manage.c:559 enable_irq+0x34/0x6c
Unbalanced enable for IRQ 314
Modules linked in: pxa2xx_mainstone(+) pxa2xx_base soc_common
CPU: 0 PID: 114 Comm: modprobe Not tainted 4.20.0-rc4-00098-g60b5482 #2931
Hardware name: Intel HCDDBBVA0 Development Platform (aka Mainstone)
[<c00101ac>] (unwind_backtrace) from [<c000db80>] (show_stack+0x10/0x14)
[<c000db80>] (show_stack) from [<c0019e38>] (__warn+0xe4/0x10c)
[<c0019e38>] (__warn) from [<c0019e98>] (warn_slowpath_fmt+0x38/0x48)
[<c0019e98>] (warn_slowpath_fmt) from [<c0051ff8>] (enable_irq+0x34/0x6c)
[<c0051ff8>] (enable_irq) from [<bf00a140>] (mst_pcmcia_socket_state+0x5c/0xe4 [pxa2xx_mainstone])
[<bf00a140>] (mst_pcmcia_socket_state [pxa2xx_mainstone]) from [<bf0007e8>] (soc_common_pcmcia_skt_state+0x134/0x1d0 [soc_common])
[<bf0007e8>] (soc_common_pcmcia_skt_state [soc_common]) from [<bf000b00>] (soc_pcmcia_add_one+0x27c/0x374 [soc_common])
[<bf000b00>] (soc_pcmcia_add_one [soc_common]) from [<bf0063e4>] (pxa2xx_drv_pcmcia_probe+0xbc/0x138 [pxa2xx_base])
[<bf0063e4>] (pxa2xx_drv_pcmcia_probe [pxa2xx_base]) from [<c0267128>] (platform_drv_probe+0x30/0x80)
[<c0267128>] (platform_drv_probe) from [<c026507c>] (really_probe+0x1e4/0x404)
[<c026507c>] (really_probe) from [<c0265450>] (driver_probe_device+0x74/0x1c0)
[<c0265450>] (driver_probe_device) from [<c0263174>] (bus_for_each_drv+0x5c/0x8c)
[<c0263174>] (bus_for_each_drv) from [<c0264dfc>] (__device_attach+0xac/0x140)
[<c0264dfc>] (__device_attach) from [<c02640f8>] (bus_probe_device+0x84/0x90)
[<c02640f8>] (bus_probe_device) from [<c0261ee0>] (device_add+0x3e8/0x5e4)
[<c0261ee0>] (device_add) from [<c0266e34>] (platform_device_add+0xbc/0x250)
[<c0266e34>] (platform_device_add) from [<bf00c040>] (mst_pcmcia_init+0x40/0xc0 [pxa2xx_mainstone])
[<bf00c040>] (mst_pcmcia_init [pxa2xx_mainstone]) from [<c000a640>] (do_one_initcall+0x48/0x1ac)
[<c000a640>] (do_one_initcall) from [<c00790c4>] (do_init_module+0x58/0x2fc)
[<c00790c4>] (do_init_module) from [<c0077eb4>] (load_module+0x1adc/0x2080)
[<c0077eb4>] (load_module) from [<c007855c>] (sys_init_module+0x104/0x16c)
[<c007855c>] (sys_init_module) from [<c0009000>] (ret_fast_syscall+0x0/0x50)
Exception stack(0xc294dfa8 to 0xc294dff0)
dfa0:                   000b86c8 000b85d0 000b96e8 0000155c 000b85d0 00000000
dfc0: 000b86c8 000b85d0 000b96e8 00000080 000b86c8 00000000 000b78bc 000b9600
dfe0: b6f7b1bc bea76b7c 0001ca3c b6f7b1cc
---[ end trace 36648ae9205933e8 ]---
------------[ cut here ]------------
WARNING: CPU: 0 PID: 114 at kernel/irq/manage.c:559 enable_irq+0x34/0x6c
Unbalanced enable for IRQ 318
Modules linked in: pxa2xx_mainstone(+) pxa2xx_base soc_common
CPU: 0 PID: 114 Comm: modprobe Tainted: G        W         4.20.0-rc4-00098-g60b5482 #2931
Hardware name: Intel HCDDBBVA0 Development Platform (aka Mainstone)
[<c00101ac>] (unwind_backtrace) from [<c000db80>] (show_stack+0x10/0x14)
[<c000db80>] (show_stack) from [<c0019e38>] (__warn+0xe4/0x10c)
[<c0019e38>] (__warn) from [<c0019e98>] (warn_slowpath_fmt+0x38/0x48)
[<c0019e98>] (warn_slowpath_fmt) from [<c0051ff8>] (enable_irq+0x34/0x6c)
[<c0051ff8>] (enable_irq) from [<bf00a140>] (mst_pcmcia_socket_state+0x5c/0xe4 [pxa2xx_mainstone])
[<bf00a140>] (mst_pcmcia_socket_state [pxa2xx_mainstone]) from [<bf0007e8>] (soc_common_pcmcia_skt_state+0x134/0x1d0 [soc_common])
[<bf0007e8>] (soc_common_pcmcia_skt_state [soc_common]) from [<bf000b00>] (soc_pcmcia_add_one+0x27c/0x374 [soc_common])
[<bf000b00>] (soc_pcmcia_add_one [soc_common]) from [<bf0063e4>] (pxa2xx_drv_pcmcia_probe+0xbc/0x138 [pxa2xx_base])
[<bf0063e4>] (pxa2xx_drv_pcmcia_probe [pxa2xx_base]) from [<c0267128>] (platform_drv_probe+0x30/0x80)
[<c0267128>] (platform_drv_probe) from [<c026507c>] (really_probe+0x1e4/0x404)
[<c026507c>] (really_probe) from [<c0265450>] (driver_probe_device+0x74/0x1c0)
[<c0265450>] (driver_probe_device) from [<c0263174>] (bus_for_each_drv+0x5c/0x8c)
[<c0263174>] (bus_for_each_drv) from [<c0264dfc>] (__device_attach+0xac/0x140)
[<c0264dfc>] (__device_attach) from [<c02640f8>] (bus_probe_device+0x84/0x90)
[<c02640f8>] (bus_probe_device) from [<c0261ee0>] (device_add+0x3e8/0x5e4)
[<c0261ee0>] (device_add) from [<c0266e34>] (platform_device_add+0xbc/0x250)
[<c0266e34>] (platform_device_add) from [<bf00c040>] (mst_pcmcia_init+0x40/0xc0 [pxa2xx_mainstone])
[<bf00c040>] (mst_pcmcia_init [pxa2xx_mainstone]) from [<c000a640>] (do_one_initcall+0x48/0x1ac)
[<c000a640>] (do_one_initcall) from [<c00790c4>] (do_init_module+0x58/0x2fc)
[<c00790c4>] (do_init_module) from [<c0077eb4>] (load_module+0x1adc/0x2080)
[<c0077eb4>] (load_module) from [<c007855c>] (sys_init_module+0x104/0x16c)
[<c007855c>] (sys_init_module) from [<c0009000>] (ret_fast_syscall+0x0/0x50)
Exception stack(0xc294dfa8 to 0xc294dff0)
dfa0:                   000b86c8 000b85d0 000b96e8 0000155c 000b85d0 00000000
dfc0: 000b86c8 000b85d0 000b96e8 00000080 000b86c8 00000000 000b78bc 000b9600
dfe0: b6f7b1bc bea76b7c 0001ca3c b6f7b1cc
---[ end trace 36648ae9205933e9 ]---

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#7 lore raw

Re: [PATCH 5/8] ARM: pxa/mainstone: switch PCMCIA to MAX1600 library and gpiod APIs

Quoted 18 lines · Robert Jarzmik

Russell King <[email protected]> writes:

Hi Russell,

I reviewed the code, and I didn't quite understand this chunk :

Quoted 13 lines
drivers/pcmcia/pxa2xx_mainstone.c +3 -5
@@ -68,62 +67,18 @@ static void mst_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 	 * as needed to avoid IRQ locks.
 	 */
 	if (flip) {
-		mst_pcmcia_status[skt->nr] = status;
-		if (status & MST_PCMCIA_nSTSCHG_BVD1)
-			enable_irq( (skt->nr == 0) ? MAINSTONE_S0_STSCHG_IRQ
-						   : MAINSTONE_S1_STSCHG_IRQ );
+		mst_pcmcia_bvd1_status[skt->nr] = state->bvd1;
+		if (state->bvd1)
+			enable_irq(skt->stat[SOC_STAT_BVD1].irq);
 		else
-			disable_irq( (skt->nr == 0) ? MAINSTONE_S0_STSCHG_IRQ
Quoted 8 lines

drivers/pcmcia/pxa2xx_mainstone.c static void mst_pcmcia_socket_state(struct soc_pcmcia_socket *skt, · line 75

Quoted 3 lines
drivers/pcmcia/pxa2xx_mainstone.c +1 -1
-						    : MAINSTONE_S1_STSCHG_IRQ );
+			disable_irq(skt->stat[SOC_STAT_BVD2].irq);
 	}

In the former code, the enable_irq() and disable_irq() were called with the same interrupt number. But with the new code, if I understand it correctly, the irq is different. As I don't fully grasp this chunk, I'll pinpoint it so that you can have a second look.

Good catch, that's supposed to be SOC_STAT_BVD1 not SOC_STAT_BVD2 there.

Quoted 30 lines

PS: The "regression" I'm talking about, which is there before your changes and after them as well, is in the exact same area, so I'll leave you the backtrace of linux-master (without your patches) for information (but not analysis, spare your free time) :

------------[ cut here ]------------
WARNING: CPU: 0 PID: 114 at kernel/irq/manage.c:559 enable_irq+0x34/0x6c
Unbalanced enable for IRQ 314
Modules linked in: pxa2xx_mainstone(+) pxa2xx_base soc_common
CPU: 0 PID: 114 Comm: modprobe Not tainted 4.20.0-rc4-00098-g60b5482 #2931
Hardware name: Intel HCDDBBVA0 Development Platform (aka Mainstone)
[<c00101ac>] (unwind_backtrace) from [<c000db80>] (show_stack+0x10/0x14)
[<c000db80>] (show_stack) from [<c0019e38>] (__warn+0xe4/0x10c)
[<c0019e38>] (__warn) from [<c0019e98>] (warn_slowpath_fmt+0x38/0x48)
[<c0019e98>] (warn_slowpath_fmt) from [<c0051ff8>] (enable_irq+0x34/0x6c)
[<c0051ff8>] (enable_irq) from [<bf00a140>] (mst_pcmcia_socket_state+0x5c/0xe4 [pxa2xx_mainstone])
[<bf00a140>] (mst_pcmcia_socket_state [pxa2xx_mainstone]) from [<bf0007e8>] (soc_common_pcmcia_skt_state+0x134/0x1d0 [soc_common])
[<bf0007e8>] (soc_common_pcmcia_skt_state [soc_common]) from [<bf000b00>] (soc_pcmcia_add_one+0x27c/0x374 [soc_common])
[<bf000b00>] (soc_pcmcia_add_one [soc_common]) from [<bf0063e4>] (pxa2xx_drv_pcmcia_probe+0xbc/0x138 [pxa2xx_base])
[<bf0063e4>] (pxa2xx_drv_pcmcia_probe [pxa2xx_base]) from [<c0267128>] (platform_drv_probe+0x30/0x80)
[<c0267128>] (platform_drv_probe) from [<c026507c>] (really_probe+0x1e4/0x404)
[<c026507c>] (really_probe) from [<c0265450>] (driver_probe_device+0x74/0x1c0)
[<c0265450>] (driver_probe_device) from [<c0263174>] (bus_for_each_drv+0x5c/0x8c)
[<c0263174>] (bus_for_each_drv) from [<c0264dfc>] (__device_attach+0xac/0x140)
[<c0264dfc>] (__device_attach) from [<c02640f8>] (bus_probe_device+0x84/0x90)
[<c02640f8>] (bus_probe_device) from [<c0261ee0>] (device_add+0x3e8/0x5e4)
[<c0261ee0>] (device_add) from [<c0266e34>] (platform_device_add+0xbc/0x250)
[<c0266e34>] (platform_device_add) from [<bf00c040>] (mst_pcmcia_init+0x40/0xc0 [pxa2xx_mainstone])
[<bf00c040>] (mst_pcmcia_init [pxa2xx_mainstone]) from [<c000a640>] (do_one_initcall+0x48/0x1ac)
[<c000a640>] (do_one_initcall) from [<c00790c4>] (do_init_module+0x58/0x2fc)
Quoted 8 lines
[<c00790c4>] (do_init_module) from [<c0077eb4>] (load_module+0x1adc/0x2080)
[<c0077eb4>] (load_module) from [<c007855c>] (sys_init_module+0x104/0x16c)
[<c007855c>] (sys_init_module) from [<c0009000>] (ret_fast_syscall+0x0/0x50)
Exception stack(0xc294dfa8 to 0xc294dff0)
dfa0:                   000b86c8 000b85d0 000b96e8 0000155c 000b85d0 00000000
dfc0: 000b86c8 000b85d0 000b96e8 00000080 000b86c8 00000000 000b78bc 000b9600
dfe0: b6f7b1bc bea76b7c 0001ca3c b6f7b1cc
---[ end trace 36648ae9205933e8 ]---

Please try initialising mst_pcmcia_bvd1_status[] to 1.

Thanks for testing.

Signature · 8 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Acked-by
#8 lore raw

Re: [PATCH 5/8] ARM: pxa/mainstone: switch PCMCIA to MAX1600 library and gpiod APIs

Quoted 1 line · Russell King - ARM Linux

Please try initialising mst_pcmcia_bvd1_status[] to 1.

Indeed, that removes the warning.

With the fix to the interrupt thing, please have my :

Quoted 1 line

Thanks for testing.

That was rather done on the Lubbock side in the following patch, but I hope that's a good enough health sign for the serie.

Cheers.

Signature · 6 lines
Robert

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#9 lore raw

PATCH 6/8 ARM: pxa/lubbock: switch PCMCIA to MAX1600 library

In reply to Russell King - ARM Linux

As Lubbock now provides GPIOs via gpiolib for controlling the socket power, we can use the MAX1600 driver. Switch Lubbock to use this driver, which simplifies the code.

---
 arch/arm/mach-pxa/lubbock.c     |  16 ++++++
 drivers/pcmcia/Kconfig          |   1 +
 drivers/pcmcia/sa1111_lubbock.c | 110 ++++++++--------------------------------
 3 files changed, 37 insertions(+), 90 deletions(-)
arch/arm/mach-pxa/lubbock.c +16 -0
index fe2ef9b78602..8e24455facd8 100644
@@ -136,10 +136,26 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
 	// no D+ pullup; lubbock can't connect/disconnect in software
 };
 
+/* GPIOs for SA1111 PCMCIA */
+static struct gpiod_lookup_table sa1111_pcmcia_gpio_table = {
+	.dev_id = "1800",
+	.table = {
+		{ "sa1111", 0, "a0vpp", GPIO_ACTIVE_HIGH },
+		{ "sa1111", 1, "a1vpp", GPIO_ACTIVE_HIGH },
+		{ "sa1111", 2, "a0vcc", GPIO_ACTIVE_HIGH },
+		{ "sa1111", 3, "a1vcc", GPIO_ACTIVE_HIGH },
+		{ "lubbock", 14, "b0vcc", GPIO_ACTIVE_HIGH },
+		{ "lubbock", 15, "b1vcc", GPIO_ACTIVE_HIGH },
+		{ },
+	},
+};
+
 static void lubbock_init_pcmcia(void)
 {
 	struct clk *clk;
 
+	gpiod_add_lookup_table(&sa1111_pcmcia_gpio_table);
+
 	/* Add an alias for the SA1111 PCMCIA clock */
 	clk = clk_get_sys("pxa2xx-pcmcia", NULL);
 	if (!IS_ERR(clk)) {
drivers/pcmcia/Kconfig +1 -0
index 9ac3d4a68075..d687a7640f6a 100644
@@ -195,6 +195,7 @@ config PCMCIA_SA1111
 	select PCMCIA_SA11XX_BASE if ARCH_SA1100
 	select PCMCIA_PXA2XX if ARCH_LUBBOCK && SA1111
 	select PCMCIA_MAX1600 if ASSABET_NEPONSET
+	select PCMCIA_MAX1600 if ARCH_LUBBOCK && SA1111
 	help
 	  Say Y  here to include support for SA1111-based PCMCIA or CF
 	  sockets, found on the Jornada 720, Graphicsmaster and other
drivers/pcmcia/sa1111_lubbock.c +20 -90

156 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer Acked-by Tested-by on v1 6/8
#10 lore raw

Re: [PATCH 6/8] ARM: pxa/lubbock: switch PCMCIA to MAX1600 library

Quoted 5 lines · Russell King

As Lubbock now provides GPIOs via gpiolib for controlling the socket power, we can use the MAX1600 driver. Switch Lubbock to use this driver, which simplifies the code.

The test is only a read of the CIS of a PCCard in the PCMCIA slot, not actual access to the storage.

Cheers.

--
Robert

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#11 lore raw

PATCH 7/8 pcmcia: sa1100*: remove redundant bvd1/bvd2 setting

In reply to Russell King - ARM Linux

bvd1 and bvd2 both default to 1 in the generic soc_common code, so having a driver repeat this is redundant. Remove it.

---
 drivers/pcmcia/sa1100_simpad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pcmcia/sa1100_simpad.c +2 -2
index e235ee14eaa6..e2e8729afd9d 100644
@@ -39,8 +39,8 @@ simpad_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 {
 	long cs3reg = simpad_get_cs3_ro();
 
-	state->bvd1 = 1; /* Might be cs3reg & PCMCIA_BVD1 */
-	state->bvd2 = 1; /* Might be cs3reg & PCMCIA_BVD2 */
+	/* bvd1 might be cs3reg & PCMCIA_BVD1 */
+	/* bvd2 might be cs3reg & PCMCIA_BVD2 */
 
 	if ((cs3reg & (PCMCIA_VS1|PCMCIA_VS2)) ==
 			(PCMCIA_VS1|PCMCIA_VS2)) {
Signature · 1 line
2.7.4
#12 lore raw

PATCH 8/8 ARM: sa1111: remove legacy GPIO interfaces

In reply to Russell King - ARM Linux

Now that we have migrated all users of the legacy private SA1111 gpio interfaces, we can remove these redundant GPIO interfaces.

---
 arch/arm/common/sa1111.c               | 59 ----------------------------------
 arch/arm/include/asm/hardware/sa1111.h |  4 ---
 2 files changed, 63 deletions(-)
arch/arm/common/sa1111.c +0 -59
index a2c878769eaf..45412d21aa6b 100644
@@ -1282,65 +1282,6 @@ int sa1111_get_audio_rate(struct sa1111_dev *sadev)
 }
 EXPORT_SYMBOL(sa1111_get_audio_rate);
 
-void sa1111_set_io_dir(struct sa1111_dev *sadev,
-		       unsigned int bits, unsigned int dir,
-		       unsigned int sleep_dir)
-{
-	struct sa1111 *sachip = sa1111_chip_driver(sadev);
-	unsigned long flags;
-	unsigned int val;
-	void __iomem *gpio = sachip->base + SA1111_GPIO;
-
-#define MODIFY_BITS(port, mask, dir)		\
-	if (mask) {				\
-		val = readl_relaxed(port);	\
-		val &= ~(mask);			\
-		val |= (dir) & (mask);		\
-		writel_relaxed(val, port);	\
-	}
-
-	spin_lock_irqsave(&sachip->lock, flags);
-	MODIFY_BITS(gpio + SA1111_GPIO_PADDR, bits & 15, dir);
-	MODIFY_BITS(gpio + SA1111_GPIO_PBDDR, (bits >> 8) & 255, dir >> 8);
-	MODIFY_BITS(gpio + SA1111_GPIO_PCDDR, (bits >> 16) & 255, dir >> 16);
-
-	MODIFY_BITS(gpio + SA1111_GPIO_PASDR, bits & 15, sleep_dir);
-	MODIFY_BITS(gpio + SA1111_GPIO_PBSDR, (bits >> 8) & 255, sleep_dir >> 8);
-	MODIFY_BITS(gpio + SA1111_GPIO_PCSDR, (bits >> 16) & 255, sleep_dir >> 16);
-	spin_unlock_irqrestore(&sachip->lock, flags);
-}
-EXPORT_SYMBOL(sa1111_set_io_dir);
-
-void sa1111_set_io(struct sa1111_dev *sadev, unsigned int bits, unsigned int v)
-{
-	struct sa1111 *sachip = sa1111_chip_driver(sadev);
-	unsigned long flags;
-	unsigned int val;
-	void __iomem *gpio = sachip->base + SA1111_GPIO;
-
-	spin_lock_irqsave(&sachip->lock, flags);
-	MODIFY_BITS(gpio + SA1111_GPIO_PADWR, bits & 15, v);
-	MODIFY_BITS(gpio + SA1111_GPIO_PBDWR, (bits >> 8) & 255, v >> 8);
-	MODIFY_BITS(gpio + SA1111_GPIO_PCDWR, (bits >> 16) & 255, v >> 16);
-	spin_unlock_irqrestore(&sachip->lock, flags);
-}
-EXPORT_SYMBOL(sa1111_set_io);
-
-void sa1111_set_sleep_io(struct sa1111_dev *sadev, unsigned int bits, unsigned int v)
-{
-	struct sa1111 *sachip = sa1111_chip_driver(sadev);
-	unsigned long flags;
-	unsigned int val;
-	void __iomem *gpio = sachip->base + SA1111_GPIO;
-
-	spin_lock_irqsave(&sachip->lock, flags);
-	MODIFY_BITS(gpio + SA1111_GPIO_PASSR, bits & 15, v);
-	MODIFY_BITS(gpio + SA1111_GPIO_PBSSR, (bits >> 8) & 255, v >> 8);
-	MODIFY_BITS(gpio + SA1111_GPIO_PCSSR, (bits >> 16) & 255, v >> 16);
-	spin_unlock_irqrestore(&sachip->lock, flags);
-}
-EXPORT_SYMBOL(sa1111_set_sleep_io);
-
 /*
  * Individual device operations.
  */
arch/arm/include/asm/hardware/sa1111.h +0 -4
index 798e520e8a49..d134b9a5ff94 100644
@@ -433,10 +433,6 @@ int sa1111_check_dma_bug(dma_addr_t addr);
 int sa1111_driver_register(struct sa1111_driver *);
 void sa1111_driver_unregister(struct sa1111_driver *);
 
-void sa1111_set_io_dir(struct sa1111_dev *sadev, unsigned int bits, unsigned int dir, unsigned int sleep_dir);
-void sa1111_set_io(struct sa1111_dev *sadev, unsigned int bits, unsigned int v);
-void sa1111_set_sleep_io(struct sa1111_dev *sadev, unsigned int bits, unsigned int v);
-
 struct sa1111_platform_data {
 	int	irq_base;	/* base for cascaded on-chip IRQs */
 	unsigned disable_devs;
Signature · 1 line
2.7.4
#13 lore raw

cover SA11xx PCMCIA updates and GPIOD conversion

In reply to Russell King - ARM Linux
Quoted 4 lines · Russell King - ARM Linux

This series adds a generic MAX1600 library which uses the GPIOD interfaces to control the PCMCIA power switches, and converts some SA11x0/PXA drivers to it, reducing the code duplication. This also allows us to kill the SA1111 private GPIO interfaces.

As I'll presume you'll push this upstream via arm, you may add my

in relation to the PCMCIA-related changes.

Thanks,
Dominik