backfire: generic: rtl8366s: allow initial register values to be passed via platform_...
authorGabor Juhos <juhosg@openwrt.org>
Sun, 30 Jan 2011 21:15:02 +0000 (21:15 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sun, 30 Jan 2011 21:15:02 +0000 (21:15 +0000)
SVN-Revision: 25256

target/linux/generic-2.6/files/drivers/net/phy/rtl8366s.c
target/linux/generic-2.6/files/include/linux/rtl8366s.h

index 3b7fcce329c0e24a4c285c6bcf0f92b0af2f10a6..7e72164131b6c99fb59f23c790df5423a3e7f177 100644 (file)
@@ -251,8 +251,19 @@ static int rtl8366s_reset_chip(struct rtl8366_smi *smi)
 
 static int rtl8366s_hw_init(struct rtl8366_smi *smi)
 {
+       struct rtl8366s_platform_data *pdata;
        int err;
 
+       pdata = smi->parent->platform_data;
+       if (pdata->num_initvals && pdata->initvals) {
+               unsigned i;
+
+               dev_info(smi->parent, "applying initvals\n");
+               for (i = 0; i < pdata->num_initvals; i++)
+                       REG_WR(smi, pdata->initvals[i].reg,
+                              pdata->initvals[i].val);
+       }
+
        /* set maximum packet length to 1536 bytes */
        REG_RMW(smi, RTL8366S_SGCR, RTL8366S_SGCR_MAX_LENGTH_MASK,
                RTL8366S_SGCR_MAX_LENGTH_1536);
index 09173ec2008ecd171b64031965d723e5d505a2c9..7d5daa4817b42a51ed38c810abcbbd140e595485 100644 (file)
 
 #define RTL8366S_DRIVER_NAME   "rtl8366s"
 
+struct rtl8366s_initval {
+       unsigned        reg;
+       u16             val;
+};
+
 struct rtl8366s_platform_data {
        unsigned        gpio_sda;
        unsigned        gpio_sck;
+       unsigned        num_initvals;
+       struct rtl8366s_initval *initvals;
 };
 
 #endif /*  _RTL8366_SMI_H */