bus: ti-sysc: Handle otg force idle quirk
authorTony Lindgren <tony@atomide.com>
Tue, 21 Sep 2021 09:42:25 +0000 (12:42 +0300)
committerTony Lindgren <tony@atomide.com>
Tue, 21 Sep 2021 09:56:14 +0000 (12:56 +0300)
Let's add handling the otg force idle quirk for the old omap2430 glue layer
used up to omap4 as the musb driver quirk only works if the driver is
loaded. Unlike with the am335x glue layer, looks like we don't need the
quirk handling for SYSC_QUIRK_REINIT_ON_CTX_LOST.

Eventually when all the musb using SoCs are booting with device tree based
configuration, we can just remove the related quirk handling from the
musb driver.

Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/bus/ti-sysc.c
include/linux/platform_data/ti-sysc.h

index 88524faa61cc6c475f2f41fcdfc23adacd10ae09..fc6968dc73975ad05553d1af7a6f3f52f9df6416 100644 (file)
@@ -1610,7 +1610,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
        SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -ENODEV, 0x50700101, 0xffffffff,
                   SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
        SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050,
-                  0xffffffff, SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
+                  0xffffffff, SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY |
+                  SYSC_MODULE_QUIRK_OTG),
        SYSC_QUIRK("usb_otg_hs", 0, 0, 0x10, -ENODEV, 0x4ea2080d, 0xffffffff,
                   SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY |
                   SYSC_QUIRK_REINIT_ON_CTX_LOST),
@@ -1969,6 +1970,22 @@ static void sysc_module_lock_quirk_rtc(struct sysc *ddata)
        sysc_quirk_rtc(ddata, true);
 }
 
+/* OTG omap2430 glue layer up to omap4 needs OTG_FORCESTDBY configured */
+static void sysc_module_enable_quirk_otg(struct sysc *ddata)
+{
+       int offset = 0x414;     /* OTG_FORCESTDBY */
+
+       sysc_write(ddata, offset, 0);
+}
+
+static void sysc_module_disable_quirk_otg(struct sysc *ddata)
+{
+       int offset = 0x414;     /* OTG_FORCESTDBY */
+       u32 val = BIT(0);       /* ENABLEFORCE */
+
+       sysc_write(ddata, offset, val);
+}
+
 /* 36xx SGX needs a quirk for to bypass OCP IPG interrupt logic */
 static void sysc_module_enable_quirk_sgx(struct sysc *ddata)
 {
@@ -2051,6 +2068,11 @@ static void sysc_init_module_quirks(struct sysc *ddata)
                return;
        }
 
+       if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_OTG) {
+               ddata->module_enable_quirk = sysc_module_enable_quirk_otg;
+               ddata->module_disable_quirk = sysc_module_disable_quirk_otg;
+       }
+
        if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_SGX)
                ddata->module_enable_quirk = sysc_module_enable_quirk_sgx;
 
index f11244f5c0b676682efec5e5e81c062535339830..eb556f988d5768b72ec5c20770ac3c61c6817152 100644 (file)
@@ -50,6 +50,7 @@ struct sysc_regbits {
        s8 emufree_shift;
 };
 
+#define SYSC_MODULE_QUIRK_OTG          BIT(30)
 #define SYSC_QUIRK_RESET_ON_CTX_LOST   BIT(29)
 #define SYSC_QUIRK_REINIT_ON_CTX_LOST  BIT(28)
 #define SYSC_QUIRK_REINIT_ON_RESUME    BIT(27)