[Letux-kernel] omap_hsmmc + gta04 + sdio irq + runtime_suspend + 4 bit = trouble

Andreas Kemnade andreas at kemnade.info
Tue Sep 4 21:41:17 CEST 2018


Hi,

On Tue, 4 Sep 2018 08:47:50 -0700
Tony Lindgren <tony at atomide.com> wrote:

> * Andreas Kemnade <andreas at kemnade.info> [180902 20:46]:
> >         mmc2_pins: pinmux_mmc2_pins {
> >                 pinctrl-single,pins = <
> >                         /* sdmmc2_clk.sdmmc2_clk */
> >                         OMAP3_CORE1_IOPAD(0x2158, PIN_INPUT_PULLUP | MUX_MODE0)
> > 
> >                         /* sdmmc2_cmd.sdmmc2_cmd */
> >                         OMAP3_CORE1_IOPAD(0x215a, PIN_INPUT_PULLUP | MUX_MODE0)
> > 
> >                         /* sdmmc2_dat0.sdmmc2_dat0 */
> >                         OMAP3_CORE1_IOPAD(0x215c, PIN_INPUT_PULLUP | MUX_MODE0)
> > 
> >                         /* sdmmc2_dat0.sdmmc2_dat1 */
> >                         OMAP3_CORE1_IOPAD(0x215e, PIN_INPUT_PULLUP | MUX_MODE0 | WAKEUP_EN)  
> 
> Having WAKEUP_EN here is wrong nowadays, this bit is managed by
> Linux generic wakeirqs.
> 
> > &mmc2 {
> >         pinctrl-names = "default";
> >         pinctrl-0 = <&mmc2_pins>;
> > 
> >         interrupts-extended = <&intc 86>, <&omap3_pmx_core 0x12e>;   
> 
> And then the second interrupt here must match padconf register like
> you have 0x215e - 0x2030 = 0x12e which seems correct. And you should
> start seeing interrupts with grep wake /proc/interrupts.
> 
Here is another try:
       mmc2_pins: pinmux_mmc2_pins {
                pinctrl-single,pins = <
                        /* sdmmc2_clk.sdmmc2_clk */
                        OMAP3_CORE1_IOPAD(0x2158, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_cmd.sdmmc2_cmd */
                        OMAP3_CORE1_IOPAD(0x215a, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_dat0.sdmmc2_dat0 */
                        OMAP3_CORE1_IOPAD(0x215c, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_dat0.sdmmc2_dat1 */
                        OMAP3_CORE1_IOPAD(0x215e, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_dat2.sdmmc2_dat2 */
                        OMAP3_CORE1_IOPAD(0x2160, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_dat2.sdmmc2_dat3 */
                        OMAP3_CORE1_IOPAD(0x2162, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_dat4.sdmmc2_dir_dat0 */
                        OMAP3_CORE1_IOPAD(0x2164, PIN_INPUT_PULLUP | MUX_MODE1)

                        /* sdmmc2_dat4.sdmmc2_dir_dat1 */
                        OMAP3_CORE1_IOPAD(0x2166,
                                          PIN_INPUT_PULLDOWN | MUX_MODE1)

                        /* sdmmc2_dat6.sdmmc2_dir_cmd */
                        OMAP3_CORE1_IOPAD(0x2168, PIN_INPUT_PULLUP | MUX_MODE1)

                        /* sdmmc2_dat6.sdmmc2_clkin */
                        OMAP3_CORE1_IOPAD(0x216a, PIN_INPUT_PULLUP | MUX_MODE1)
                >;
        };

        mmc2_idle_pins: pinmux_mmc2_idle_pins {
                pinctrl-single,pins = <
                        /* sdmmc2_clk.sdmmc2_clk */
                        OMAP3_CORE1_IOPAD(0x2158, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_cmd.sdmmc2_cmd */
                        OMAP3_CORE1_IOPAD(0x215a, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_dat0.sdmmc2_dat0 */
                        OMAP3_CORE1_IOPAD(0x215c, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_dat0.gpio133 */
                        OMAP3_CORE1_IOPAD(0x215e, PIN_INPUT_PULLUP | MUX_MODE4)

                        /* sdmmc2_dat2.sdmmc2_dat2 */
                        OMAP3_CORE1_IOPAD(0x2160, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_dat2.sdmmc2_dat3 */
                        OMAP3_CORE1_IOPAD(0x2162, PIN_INPUT_PULLUP | MUX_MODE0)

                        /* sdmmc2_dat4.sdmmc2_dir_dat0 */
                        OMAP3_CORE1_IOPAD(0x2164, PIN_INPUT_PULLUP | MUX_MODE1)

                        /* sdmmc2_dat4.sdmmc2_dir_dat1 */
                        OMAP3_CORE1_IOPAD(0x2166,
                                          PIN_INPUT_PULLUP | MUX_MODE1)

                        /* sdmmc2_dat6.sdmmc2_dir_cmd */
                        OMAP3_CORE1_IOPAD(0x2168, PIN_INPUT_PULLUP | MUX_MODE1)

                        /* sdmmc2_dat6.sdmmc2_clkin */
                        OMAP3_CORE1_IOPAD(0x216a, PIN_INPUT_PULLUP | MUX_MODE1)
                >;
        };


                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                               

[...]
     &mmc2 {
        pinctrl-names = "default", "idle";
        pinctrl-0 = <&mmc2_pins>;
        pinctrl-1 = <&mmc2_idle_pins>;

        /* dat1 remuxed as gpio133 */
        interrupts-extended = <&intc 86>, <&gpio5 5 IRQ_TYPE_LEVEL_LOW>;
        vmmc-supply = <&vaux4>;
        bus-width = <4>;
        ti,non-removable;       /* remove ti, */
        mmc-pwrseq = <&wifi_pwrseq>;
        cap-power-off-card;     /* remove! */
};
                                                                                                                                                                                                                                                               

Result: works with 4bit, Irq count is sane as long as the card
is powered on. On a wifi with low traffic I get around 2 irqs per second
But if as soon as I power off the card by doing ifconfig down, I get
around 10 irqs per second which could be explained by the fact that
autosuspend time is 100ms, and it is waking up just immediately.
Reason is probably that the other side of the level shifter powered
off and low, so
dat1 will be low permanently. And since wakeup is enabled regardless of
whether sdio irq or anything else is enabled, hsmmc will never get a
good sleep.
That behavior (I have to check that) was probably introduced by
5b83b2234be6 ("mmc: omap_hsmmc: Change wake-up interrupt to use generic wakeirq").

I guess there is also a race somehow involved here. 

Regards,
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.goldelico.com/pipermail/letux-kernel/attachments/20180904/56db53ea/attachment.asc>


More information about the Letux-kernel mailing list