diff options
author | Koen Kooi <koen@openembedded.org> | 2009-11-25 10:27:57 +0100 |
---|---|---|
committer | Koen Kooi <koen@openembedded.org> | 2009-11-25 10:27:57 +0100 |
commit | 24c8c7b88f2271a95289fdf3e9b0c61a3e254ca9 (patch) | |
tree | c6d5dcf6b2dcea0f397a826d811ecd0d9ca7e4bf /recipes/linux/linux-omap-2.6.29/smsc | |
parent | 46a3e348d56cb51ba75c291613e535510203225e (diff) |
linux-omap 2.6.29: add smsc patches and update overo defconfig
Diffstat (limited to 'recipes/linux/linux-omap-2.6.29/smsc')
4 files changed, 349 insertions, 0 deletions
diff --git a/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-1.patch b/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-1.patch new file mode 100644 index 0000000000..1efe181872 --- /dev/null +++ b/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-1.patch @@ -0,0 +1,71 @@ +From: Steve Glendinning <steve.glendinning@smsc.com> + +This patch adds support for the platform_device's resources to indicate +additional flags to use when registering the irq, for example +IORESOURCE_IRQ_LOWLEVEL (which corresponds to IRQF_TRIGGER_LOW). These +should be set in the irq resource flags field. + +Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> +--- + drivers/net/smsc911x.c | 19 ++++++++++++++----- + 1 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c +index f513bdf..3565df1 100644 +--- a/drivers/net/smsc911x.c ++++ b/drivers/net/smsc911x.c +@@ -1892,9 +1892,9 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) + struct net_device *dev; + struct smsc911x_data *pdata; + struct smsc911x_platform_config *config = pdev->dev.platform_data; +- struct resource *res; ++ struct resource *res, *irq_res; + unsigned int intcfg = 0; +- int res_size; ++ int res_size, irq_flags; + int retval; + DECLARE_MAC_BUF(mac); + +@@ -1919,6 +1919,14 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) + } + res_size = res->end - res->start; + ++ irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); ++ if (!irq_res) { ++ pr_warning("%s: Could not allocate irq resource.\n", ++ SMSC_CHIPNAME); ++ retval = -ENODEV; ++ goto out_0; ++ } ++ + if (!request_mem_region(res->start, res_size, SMSC_CHIPNAME)) { + retval = -EBUSY; + goto out_0; +@@ -1935,7 +1943,8 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) + + pdata = netdev_priv(dev); + +- dev->irq = platform_get_irq(pdev, 0); ++ dev->irq = irq_res->start; ++ irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; + pdata->ioaddr = ioremap_nocache(res->start, res_size); + + /* copy config parameters across to pdata */ +@@ -1968,8 +1977,8 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) + smsc911x_reg_write(pdata, INT_EN, 0); + smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF); + +- retval = request_irq(dev->irq, smsc911x_irqhandler, IRQF_DISABLED, +- dev->name, dev); ++ retval = request_irq(dev->irq, smsc911x_irqhandler, ++ irq_flags | IRQF_DISABLED, dev->name, dev); + if (retval) { + SMSC_WARNING(PROBE, + "Unable to claim requested irq: %d", dev->irq); +-- +1.6.0.6 + +-- +To unsubscribe from this list: send the line "unsubscribe netdev" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-2.patch b/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-2.patch new file mode 100644 index 0000000000..15b4d04498 --- /dev/null +++ b/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-2.patch @@ -0,0 +1,33 @@ +From: Steve Glendinning <steve.glendinning@smsc.com> + +The isr supports shared operation, so register it with the IRQF_SHARED +flag to indicate this. + +This patch also removes the IRQF_DISABLED flag. This driver doesn't +need it, and IRQF_DISABLED isn't guaranteed when using shared interrupts. + +Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> +--- + drivers/net/smsc911x.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c +index 3565df1..f882fd5 100644 +--- a/drivers/net/smsc911x.c ++++ b/drivers/net/smsc911x.c +@@ -1978,7 +1978,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) + smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF); + + retval = request_irq(dev->irq, smsc911x_irqhandler, +- irq_flags | IRQF_DISABLED, dev->name, dev); ++ irq_flags | IRQF_SHARED, dev->name, dev); + if (retval) { + SMSC_WARNING(PROBE, + "Unable to claim requested irq: %d", dev->irq); +-- +1.6.0.6 + +-- +To unsubscribe from this list: send the line "unsubscribe netdev" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-3.patch b/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-3.patch new file mode 100644 index 0000000000..0fb7f4f0cc --- /dev/null +++ b/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-3.patch @@ -0,0 +1,152 @@ +From: Steve Glendinning <steve.glendinning@smsc.com> + +On LAN9115/LAN9117/LAN9215/LAN9217, external phys are supported. These +are usually indicated by a hardware strap which sets an "external PHY +detected" bit in the HW_CFG register. + +In some cases it is desirable to override this hardware strap and force +use of either the internal phy or an external PHY. This patch adds +SMSC911X_FORCE_INTERNAL_PHY and SMSC911X_FORCE_EXTERNAL_PHY flags so a +platform can indicate this preference via its platform_data. + +Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> +Acked-by: Sascha Hauer <s.hauer@pengutronix.de> +Tested-by: Sascha Hauer <s.hauer@pengutronix.de> +--- + drivers/net/smsc911x.c | 75 +++++++++++++++++++++++---------------------- + include/linux/smsc911x.h | 2 + + 2 files changed, 40 insertions(+), 37 deletions(-) + +diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c +index f882fd5..c7379f5 100644 +--- a/drivers/net/smsc911x.c ++++ b/drivers/net/smsc911x.c +@@ -368,48 +368,53 @@ out: + return reg; + } + +-/* Autodetects and initialises external phy for SMSC9115 and SMSC9117 flavors. +- * If something goes wrong, returns -ENODEV to revert back to internal phy. +- * Performed at initialisation only, so interrupts are enabled */ +-static int smsc911x_phy_initialise_external(struct smsc911x_data *pdata) ++/* Switch to external phy. Assumes tx and rx are stopped. */ ++static void smsc911x_phy_enable_external(struct smsc911x_data *pdata) + { + unsigned int hwcfg = smsc911x_reg_read(pdata, HW_CFG); + +- /* External phy is requested, supported, and detected */ +- if (hwcfg & HW_CFG_EXT_PHY_DET_) { ++ /* Disable phy clocks to the MAC */ ++ hwcfg &= (~HW_CFG_PHY_CLK_SEL_); ++ hwcfg |= HW_CFG_PHY_CLK_SEL_CLK_DIS_; ++ smsc911x_reg_write(pdata, HW_CFG, hwcfg); ++ udelay(10); /* Enough time for clocks to stop */ + +- /* Switch to external phy. Assuming tx and rx are stopped +- * because smsc911x_phy_initialise is called before +- * smsc911x_rx_initialise and tx_initialise. */ ++ /* Switch to external phy */ ++ hwcfg |= HW_CFG_EXT_PHY_EN_; ++ smsc911x_reg_write(pdata, HW_CFG, hwcfg); + +- /* Disable phy clocks to the MAC */ +- hwcfg &= (~HW_CFG_PHY_CLK_SEL_); +- hwcfg |= HW_CFG_PHY_CLK_SEL_CLK_DIS_; +- smsc911x_reg_write(pdata, HW_CFG, hwcfg); +- udelay(10); /* Enough time for clocks to stop */ ++ /* Enable phy clocks to the MAC */ ++ hwcfg &= (~HW_CFG_PHY_CLK_SEL_); ++ hwcfg |= HW_CFG_PHY_CLK_SEL_EXT_PHY_; ++ smsc911x_reg_write(pdata, HW_CFG, hwcfg); ++ udelay(10); /* Enough time for clocks to restart */ + +- /* Switch to external phy */ +- hwcfg |= HW_CFG_EXT_PHY_EN_; +- smsc911x_reg_write(pdata, HW_CFG, hwcfg); +- +- /* Enable phy clocks to the MAC */ +- hwcfg &= (~HW_CFG_PHY_CLK_SEL_); +- hwcfg |= HW_CFG_PHY_CLK_SEL_EXT_PHY_; +- smsc911x_reg_write(pdata, HW_CFG, hwcfg); +- udelay(10); /* Enough time for clocks to restart */ ++ hwcfg |= HW_CFG_SMI_SEL_; ++ smsc911x_reg_write(pdata, HW_CFG, hwcfg); ++} + +- hwcfg |= HW_CFG_SMI_SEL_; +- smsc911x_reg_write(pdata, HW_CFG, hwcfg); ++/* Autodetects and enables external phy if present on supported chips. ++ * autodetection can be overridden by specifying SMSC911X_FORCE_INTERNAL_PHY ++ * or SMSC911X_FORCE_EXTERNAL_PHY in the platform_data flags. */ ++static void smsc911x_phy_initialise_external(struct smsc911x_data *pdata) ++{ ++ unsigned int hwcfg = smsc911x_reg_read(pdata, HW_CFG); + +- SMSC_TRACE(HW, "Successfully switched to external PHY"); ++ if (pdata->config.flags & SMSC911X_FORCE_INTERNAL_PHY) { ++ SMSC_TRACE(HW, "Forcing internal PHY"); ++ pdata->using_extphy = 0; ++ } else if (pdata->config.flags & SMSC911X_FORCE_EXTERNAL_PHY) { ++ SMSC_TRACE(HW, "Forcing external PHY"); ++ smsc911x_phy_enable_external(pdata); ++ pdata->using_extphy = 1; ++ } else if (hwcfg & HW_CFG_EXT_PHY_DET_) { ++ SMSC_TRACE(HW, "HW_CFG EXT_PHY_DET set, using external PHY"); ++ smsc911x_phy_enable_external(pdata); + pdata->using_extphy = 1; + } else { +- SMSC_WARNING(HW, "No external PHY detected, " +- "Using internal PHY instead."); +- /* Use internal phy */ +- return -ENODEV; ++ SMSC_TRACE(HW, "HW_CFG EXT_PHY_DET clear, using internal PHY"); ++ pdata->using_extphy = 0; + } +- return 0; + } + + /* Fetches a tx status out of the status fifo */ +@@ -824,22 +829,18 @@ static int __devinit smsc911x_mii_init(struct platform_device *pdev, + + pdata->mii_bus->parent = &pdev->dev; + +- pdata->using_extphy = 0; +- + switch (pdata->idrev & 0xFFFF0000) { + case 0x01170000: + case 0x01150000: + case 0x117A0000: + case 0x115A0000: + /* External PHY supported, try to autodetect */ +- if (smsc911x_phy_initialise_external(pdata) < 0) { +- SMSC_TRACE(HW, "No external PHY detected, " +- "using internal PHY"); +- } ++ smsc911x_phy_initialise_external(pdata); + break; + default: + SMSC_TRACE(HW, "External PHY is not supported, " + "using internal PHY"); ++ pdata->using_extphy = 0; + break; + } + +diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h +index 1cbf031..170c76b 100644 +--- a/include/linux/smsc911x.h ++++ b/include/linux/smsc911x.h +@@ -43,5 +43,7 @@ struct smsc911x_platform_config { + /* Constants for flags */ + #define SMSC911X_USE_16BIT (BIT(0)) + #define SMSC911X_USE_32BIT (BIT(1)) ++#define SMSC911X_FORCE_INTERNAL_PHY (BIT(2)) ++#define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3)) + + #endif /* __LINUX_SMSC911X_H__ */ +-- +1.6.0.6 + +-- +To unsubscribe from this list: send the line "unsubscribe netdev" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-4.patch b/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-4.patch new file mode 100644 index 0000000000..8afa06f400 --- /dev/null +++ b/recipes/linux/linux-omap-2.6.29/smsc/smsc911x-4.patch @@ -0,0 +1,93 @@ +From: Steve Glendinning <steve.glendinning@smsc.com> + +Some platforms (for example pcm037) do not have an EEPROM fitted, +instead storing their mac address somewhere else. The bootloader +fetches this and configures the ethernet adapter before the kernel is +started. + +This patch allows a platform to indicate to the driver via the +SMSC911X_SAVE_MAC_ADDRESS flag that the mac address has already been +configured via such a mechanism, and should be saved before resetting +the chip. + +Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> +Acked-by: Sascha Hauer <s.hauer@pengutronix.de> +Tested-by: Sascha Hauer <s.hauer@pengutronix.de> +--- + drivers/net/smsc911x.c | 30 ++++++++++++++++++++++-------- + include/linux/smsc911x.h | 1 + + 2 files changed, 23 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c +index c7379f5..2f7399e 100644 +--- a/drivers/net/smsc911x.c ++++ b/drivers/net/smsc911x.c +@@ -1748,6 +1748,21 @@ static const struct net_device_ops smsc911x_netdev_ops = { + #endif + }; + ++/* copies the current mac address from hardware to dev->dev_addr */ ++static void __devinit smsc911x_read_mac_address(struct net_device *dev) ++{ ++ struct smsc911x_data *pdata = netdev_priv(dev); ++ u32 mac_high16 = smsc911x_mac_read(pdata, ADDRH); ++ u32 mac_low32 = smsc911x_mac_read(pdata, ADDRL); ++ ++ dev->dev_addr[0] = (u8)(mac_low32); ++ dev->dev_addr[1] = (u8)(mac_low32 >> 8); ++ dev->dev_addr[2] = (u8)(mac_low32 >> 16); ++ dev->dev_addr[3] = (u8)(mac_low32 >> 24); ++ dev->dev_addr[4] = (u8)(mac_high16); ++ dev->dev_addr[5] = (u8)(mac_high16 >> 8); ++} ++ + /* Initializing private device structures, only called from probe */ + static int __devinit smsc911x_init(struct net_device *dev) + { +@@ -1835,6 +1850,12 @@ static int __devinit smsc911x_init(struct net_device *dev) + SMSC_WARNING(PROBE, + "This driver is not intended for this chip revision"); + ++ /* workaround for platforms without an eeprom, where the mac address ++ * is stored elsewhere and set by the bootloader. This saves the ++ * mac address before resetting the device */ ++ if (pdata->config.flags & SMSC911X_SAVE_MAC_ADDRESS) ++ smsc911x_read_mac_address(dev); ++ + /* Reset the LAN911x */ + if (smsc911x_soft_reset(pdata)) + return -ENODEV; +@@ -2015,14 +2036,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) + } else { + /* Try reading mac address from device. if EEPROM is present + * it will already have been set */ +- u32 mac_high16 = smsc911x_mac_read(pdata, ADDRH); +- u32 mac_low32 = smsc911x_mac_read(pdata, ADDRL); +- dev->dev_addr[0] = (u8)(mac_low32); +- dev->dev_addr[1] = (u8)(mac_low32 >> 8); +- dev->dev_addr[2] = (u8)(mac_low32 >> 16); +- dev->dev_addr[3] = (u8)(mac_low32 >> 24); +- dev->dev_addr[4] = (u8)(mac_high16); +- dev->dev_addr[5] = (u8)(mac_high16 >> 8); ++ smsc911x_read_mac_address(dev); + + if (is_valid_ether_addr(dev->dev_addr)) { + /* eeprom values are valid so use them */ +diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h +index 170c76b..b327250 100644 +--- a/include/linux/smsc911x.h ++++ b/include/linux/smsc911x.h +@@ -45,5 +45,6 @@ struct smsc911x_platform_config { + #define SMSC911X_USE_32BIT (BIT(1)) + #define SMSC911X_FORCE_INTERNAL_PHY (BIT(2)) + #define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3)) ++#define SMSC911X_SAVE_MAC_ADDRESS (BIT(4)) + + #endif /* __LINUX_SMSC911X_H__ */ +-- +1.6.0.6 + +-- +To unsubscribe from this list: send the line "unsubscribe netdev" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html |