]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-epos/sitara-epos-kernel.git/commitdiff
ARM: OMAP: AM33XX: NET: cpsw: Set SYSC for NO_IDLE and NO_STDBY
authorVaibhav Bedia <vaibhav.bedia@ti.com>
Wed, 14 Mar 2012 20:19:25 +0000 (01:49 +0530)
committerVaibhav Bedia <vaibhav.bedia@ti.com>
Wed, 14 Mar 2012 20:19:25 +0000 (01:49 +0530)
In a successful suspend-resume cycle the register context is
lost and hence SYSC will go back to its default value of
NO_IDLE and NO_STDBY. However, in a suspend failure/abort due
to some or the other reason, the register is set to
FORCE_IDLE and FORCE_STDBY but never cleared.

If the driver had been fully converted to HWMOD this would have
been taken care of in the generic code. For now, after enabling the
CPSW clock explicitly set the SYSC of CPSW to NO_IDLE and NO_STDBY.

Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
drivers/net/ethernet/ti/davinci_mdio.c

index 213d204dbc51387b755310dc52bfa2a012fb913c..ecc2a9be3130551a589d3c53d6f5b6b40d7b6442 100644 (file)
@@ -49,6 +49,8 @@
 #define DEF_OUT_FREQ           2200000         /* 2.2 MHz */
 
 #define CPGMAC_CLK_CTRL_REG    0x44E00014
+#define CPGMAC_CLK_SYSC         0x4A101208
+#define CPSW_NO_IDLE_NO_STDBY   0xA
 
 struct davinci_mdio_regs {
        u32     version;
@@ -408,20 +410,25 @@ static inline int wait_for_clock_enable(struct davinci_mdio_data *data)
 {
        unsigned long timeout = jiffies + msecs_to_jiffies(MDIO_TIMEOUT);
        u32 __iomem *cpgmac_clk = ioremap(CPGMAC_CLK_CTRL_REG, 4);
+       u32 __iomem *cpgmac_sysc = ioremap(CPGMAC_CLK_SYSC, 4);
        u32 reg = 0;
 
        while (time_after(timeout, jiffies)) {
                reg = readl(cpgmac_clk);
-               if ((reg & 0x70000) == 0)
+               if ((reg & 0x30000) == 0) {
+                        writel(CPSW_NO_IDLE_NO_STDBY, cpgmac_sysc);
                        goto iounmap_ret;
+                }
        }
        dev_err(data->dev,
                "timed out waiting for CPGMAC clock enable, value = 0x%x\n",
                reg);
+       iounmap(cpgmac_sysc);
        iounmap(cpgmac_clk);
        return -ETIMEDOUT;
 
 iounmap_ret:
+       iounmap(cpgmac_sysc);
        iounmap(cpgmac_clk);
        return 0;
 }