mmc: omap_hsmmc: Enable SDIO IRQ.
Subsystems (3)
PATCH 1/3 mmc: omap_hsmmc: Enable SDIO IRQ.
From: Andreas Fenkart <[email protected]>
For now, only support SDIO interrupt if we are booted with DT. This is because some platforms need special quirks. And we don't want to add new legacy mux platform init code callbacks any longer as we are moving to DT based booting anyways.
Broken hardware, missing the swakueup line, should fallback to polling, by setting 'ti,quirk-swakup-missing' in the device tree. Otherwise pending SDIO IRQ are not detected while in suspend. This affects am33xx processors.
For the DT-Binding portion:
--- .../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 18 ++++ drivers/mmc/host/omap_hsmmc.c | 86 ++++++++++++++++++-- 2 files changed, 95 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt +18 -0
@@ -20,6 +20,24 @@ ti,dual-volt: boolean, supports dual voltage cards ti,non-removable: non-removable slot (like eMMC) ti,needs-special-reset: Requires a special softreset sequence ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High Speed +ti,quirk-swakup-missing: SOC missing the swakeup line, will not detect +SDIO irq while in suspend. Fallback to polling. Affected chips are +am335x, + + ------ + | PRCM | + ------ + ^ | + swakeup | | fclk + | v + ------ ------- ----- + | card | -- CIRQ --> | hsmmc | -- IRQ --> | CPU | + ------ ------- ----- + +In suspend the fclk is off and the module is disfunctional. Even +register reads will fail. A small logic in the host will request fclk +restore, when an external event is detected. Once the clock is +restored, the host detects the event normally. Example: mmc1: mmc@0x4809c000 {
drivers/mmc/host/omap_hsmmc.c +77 -9
143 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 2/3 mmc: omap_hsmmc: Pin remux workaround to support SDIO interrupt on AM335x.
From: Andreas Fenkart <[email protected]>
The am335x can't detect pending cirq in PM runtime suspend. This patch reconfigures dat1 as a GPIO before going to suspend. SDIO interrupts are detected with the GPIO, the GPIO will only wake the module from suspend, SDIO irq detection will still happen through the IP block.
Idea of remuxing the pins by Tony Lindgren as well as the implementation of omap_hsmmc_pin_init.
--- .../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 28 ++- drivers/mmc/host/omap_hsmmc.c | 195 ++++++++++++++++++-- include/linux/platform_data/mmc-omap.h | 4 + 3 files changed, 213 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt +26 -2
@@ -21,8 +21,11 @@ ti,non-removable: non-removable slot (like eMMC) ti,needs-special-reset: Requires a special softreset sequence ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High Speed ti,quirk-swakup-missing: SOC missing the swakeup line, will not detect -SDIO irq while in suspend. Fallback to polling. Affected chips are -am335x, +SDIO irq while in suspend. The workaround is to reconfigure the dat1 line as a +GPIO upon suspend. Beyond this option and the GPIO config, you also need to set +named pinctrl states "default", "active" and "idle ", see example below. The +MMC driver will then then toggle between default and idle during the runtime +Affected chips are am335x, ------ | PRCM |
@@ -49,3 +52,24 @@ Example: vmmc-supply = <&vmmc>; /* phandle to regulator node */ ti,non-removable; }; + +[am335x with with gpio for sdio irq] + + mmc1_cirq_pin: pinmux_cirq_pin { + pinctrl-single,pins = < + 0x0f8 0x3f /* MMC0_DAT1 as GPIO2_28 */ + >; + }; + + mmc1: mmc@48060000 { + ti,non-removable; + bus-width = <4>; + vmmc-supply = <&ldo2_reg>; + vmmc_aux-supply = <&vmmc>; + ti,quirk-swakeup-missing; + pinctrl-names = "default", "active", "idle"; + pinctrl-0 = <&mmc1_pins>; + pinctrl-1 = <&mmc1_pins>; + pinctrl-2 = <&mmc1_cirq_pin>; + ti,cirq-gpio = <&gpio3 28 0>; + };
drivers/mmc/host/omap_hsmmc.c +183 -12
302 lines not on this page · raw message
include/linux/platform_data/mmc-omap.h +4 -0
@@ -115,6 +115,7 @@ struct omap_mmc_platform_data {int switch_pin;/* gpio (card detect) */ int gpio_wp;/* gpio (write protect) */ +int gpio_cirq;/* gpio (card irq) */ int (*set_bus_mode)(struct device *dev,int slot,int bus_mode); int (*set_power)(struct device *dev, int slot,
@@ -145,6 +146,9 @@ struct omap_mmc_platform_data {int card_detect_irq;int (*card_detect)(struct device *dev,int slot); +/* SDIO IRQs */ +int sdio_irq; + unsigned int ban_openended:1; } slots[OMAP_MMC_MAX_SLOTS ];
Signature · 1 line
1.7.10.4
PATCH 3/3 mmc: omap_hsmmc: Extend debugfs for SDIO IRQ, GPIO and pinmux.
In reply to Andreas FenkartFrom: Andreas Fenkart <[email protected]>
Add SDIO IRQ entries to debugfs entry. Note that PSTATE shows current state of data lines, incl. SDIO IRQ pending
--- drivers/mmc/host/omap_hsmmc.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/mmc/host/omap_hsmmc.c +21 -1
@@ -81,6 +81,7 @@ static void apply_clk_hack(struct device *dev)#define OMAP_HSMMC_RSP54 0x0118#define OMAP_HSMMC_RSP76 0x011C#define OMAP_HSMMC_DATA 0x0120 +#define OMAP_HSMMC_PSTATE 0x0124#define OMAP_HSMMC_HCTL 0x0128#define OMAP_HSMMC_SYSCTL 0x012C#define OMAP_HSMMC_STAT 0x0130
@@ -1800,6 +1801,23 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void *data) {struct mmc_host *mmc = s->private;struct omap_hsmmc_host *host =mmc_priv (mmc); +unsigned long flags; +bool suspended; + +spin_lock_irqsave (&host->irq_lock, flags); +seq_printf (s,"\n" ); +seq_printf (s,"sdio irq\t%s\n" , ((host->flags &HSMMC_SDIO_IRQ_ENABLED ) + ?"enabled" :"disabled" )); + suspended = host->dev->power.runtime_status !=RPM_ACTIVE ; +if (host->flags &HSMMC_SWAKEUP_QUIRK ) { +seq_printf (s,"pinmux config\t%s\n" , (suspended ? +"gpio" :"sdio" )); +if (suspended) +seq_printf (s,"sdio irq pin\t%s\n" , +gpio_get_value (mmc_slot (host).gpio_cirq) ? +"high" :"low" ); + } +spin_unlock_irqrestore (&host->irq_lock, flags);if (host->suspended) {seq_printf (s,"host suspended, can't read registers\n" );
@@ -1807,9 +1825,11 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void *data) }pm_runtime_get_sync (host->dev); - +seq_printf (s,"\nregs:\n" );seq_printf (s,"CON:\t\t0x%08x\n" ,OMAP_HSMMC_READ (host->base,CON )); +seq_printf (s,"PSTATE:\t\t0x%08x\n" , +OMAP_HSMMC_READ (host->base,PSTATE ));seq_printf (s,"HCTL:\t\t0x%08x\n" ,OMAP_HSMMC_READ (host->base,HCTL )); seq_printf(s, "SYSCTL:\t\t0x%08x\n",
Signature · 1 line
1.7.10.4