aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@openwrt.org>2013-10-02 22:25:26 +0000
committerHauke Mehrtens <hauke@openwrt.org>2013-10-02 22:25:26 +0000
commit6212ba0165143f05182d561391d67beaa4c9a4c5 (patch)
tree7855b38a68a728b1a4bfa284185bbce33b2487f7 /target/linux
parent66144f5c63315ee1008e752de76b842f0743cb31 (diff)
downloadupstream-6212ba0165143f05182d561391d67beaa4c9a4c5.tar.gz
upstream-6212ba0165143f05182d561391d67beaa4c9a4c5.tar.bz2
upstream-6212ba0165143f05182d561391d67beaa4c9a4c5.zip
kernel: bgmac: move other bgmac patches to generic
The bgmac driver will be used on the brcm47xx and the bcm53xx target. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38289 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/bcm53xx/patches-3.10/202-bgmac-make-bgmac-work-on-systems-without-nvram.patch4
-rw-r--r--target/linux/bcm53xx/patches-3.10/203-bgmac-register-phy.patch189
-rw-r--r--target/linux/generic/patches-3.10/771-bgmac-phylib.patch (renamed from target/linux/brcm47xx/patches-3.10/770-bgmac-phylib.patch)5
-rw-r--r--target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch (renamed from target/linux/bcm53xx/patches-3.10/204-bgmac-add-supprot-for-BCM4707.patch)15
-rw-r--r--target/linux/generic/patches-3.10/773-bgmac-add-srab-switch.patch (renamed from target/linux/bcm53xx/patches-3.10/205-bgmac-add-srab-switch.patch)14
5 files changed, 21 insertions, 206 deletions
diff --git a/target/linux/bcm53xx/patches-3.10/202-bgmac-make-bgmac-work-on-systems-without-nvram.patch b/target/linux/bcm53xx/patches-3.10/202-bgmac-make-bgmac-work-on-systems-without-nvram.patch
index eda49b6416..07ba44a53e 100644
--- a/target/linux/bcm53xx/patches-3.10/202-bgmac-make-bgmac-work-on-systems-without-nvram.patch
+++ b/target/linux/bcm53xx/patches-3.10/202-bgmac-make-bgmac-work-on-systems-without-nvram.patch
@@ -7,10 +7,10 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -16,7 +16,11 @@
- #include <linux/phy.h>
+@@ -17,7 +17,11 @@
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
+ #include <linux/platform_data/b53.h>
+#ifdef CONFIG_BCM47XX
#include <bcm47xx_nvram.h>
+#else
diff --git a/target/linux/bcm53xx/patches-3.10/203-bgmac-register-phy.patch b/target/linux/bcm53xx/patches-3.10/203-bgmac-register-phy.patch
deleted file mode 100644
index 7bf66dfaf4..0000000000
--- a/target/linux/bcm53xx/patches-3.10/203-bgmac-register-phy.patch
+++ /dev/null
@@ -1,189 +0,0 @@
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1233,27 +1233,14 @@ static int bgmac_set_mac_address(struct
- static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
- {
- struct bgmac *bgmac = netdev_priv(net_dev);
-- struct mii_ioctl_data *data = if_mii(ifr);
-
-- switch (cmd) {
-- case SIOCGMIIPHY:
-- data->phy_id = bgmac->phyaddr;
-- /* fallthru */
-- case SIOCGMIIREG:
-- if (!netif_running(net_dev))
-- return -EAGAIN;
-- data->val_out = bgmac_phy_read(bgmac, data->phy_id,
-- data->reg_num & 0x1f);
-- return 0;
-- case SIOCSMIIREG:
-- if (!netif_running(net_dev))
-- return -EAGAIN;
-- bgmac_phy_write(bgmac, data->phy_id, data->reg_num & 0x1f,
-- data->val_in);
-- return 0;
-- default:
-- return -EOPNOTSUPP;
-- }
-+ if (!netif_running(net_dev))
-+ return -EINVAL;
-+
-+ if (!bgmac->phydev)
-+ return -EINVAL;
-+
-+ return phy_mii_ioctl(bgmac->phydev, ifr, cmd);
- }
-
- static const struct net_device_ops bgmac_netdev_ops = {
-@@ -1275,61 +1262,16 @@ static int bgmac_get_settings(struct net
- {
- struct bgmac *bgmac = netdev_priv(net_dev);
-
-- cmd->supported = SUPPORTED_10baseT_Half |
-- SUPPORTED_10baseT_Full |
-- SUPPORTED_100baseT_Half |
-- SUPPORTED_100baseT_Full |
-- SUPPORTED_1000baseT_Half |
-- SUPPORTED_1000baseT_Full |
-- SUPPORTED_Autoneg;
--
-- if (bgmac->autoneg) {
-- WARN_ON(cmd->advertising);
-- if (bgmac->full_duplex) {
-- if (bgmac->speed & BGMAC_SPEED_10)
-- cmd->advertising |= ADVERTISED_10baseT_Full;
-- if (bgmac->speed & BGMAC_SPEED_100)
-- cmd->advertising |= ADVERTISED_100baseT_Full;
-- if (bgmac->speed & BGMAC_SPEED_1000)
-- cmd->advertising |= ADVERTISED_1000baseT_Full;
-- } else {
-- if (bgmac->speed & BGMAC_SPEED_10)
-- cmd->advertising |= ADVERTISED_10baseT_Half;
-- if (bgmac->speed & BGMAC_SPEED_100)
-- cmd->advertising |= ADVERTISED_100baseT_Half;
-- if (bgmac->speed & BGMAC_SPEED_1000)
-- cmd->advertising |= ADVERTISED_1000baseT_Half;
-- }
-- } else {
-- switch (bgmac->speed) {
-- case BGMAC_SPEED_10:
-- ethtool_cmd_speed_set(cmd, SPEED_10);
-- break;
-- case BGMAC_SPEED_100:
-- ethtool_cmd_speed_set(cmd, SPEED_100);
-- break;
-- case BGMAC_SPEED_1000:
-- ethtool_cmd_speed_set(cmd, SPEED_1000);
-- break;
-- }
-- }
--
-- cmd->duplex = bgmac->full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
--
-- cmd->autoneg = bgmac->autoneg;
--
-- return 0;
-+ return phy_ethtool_gset(bgmac->phydev, cmd);
- }
-
--#if 0
- static int bgmac_set_settings(struct net_device *net_dev,
- struct ethtool_cmd *cmd)
- {
- struct bgmac *bgmac = netdev_priv(net_dev);
-
-- return -1;
-+ return phy_ethtool_sset(bgmac->phydev, cmd);
- }
--#endif
-
- static void bgmac_get_drvinfo(struct net_device *net_dev,
- struct ethtool_drvinfo *info)
-@@ -1340,6 +1282,7 @@ static void bgmac_get_drvinfo(struct net
-
- static const struct ethtool_ops bgmac_ethtool_ops = {
- .get_settings = bgmac_get_settings,
-+ .set_settings = bgmac_set_settings,
- .get_drvinfo = bgmac_get_drvinfo,
- };
-
-@@ -1358,10 +1301,36 @@ static int bgmac_mii_write(struct mii_bu
- return bgmac_phy_write(bus->priv, mii_id, regnum, value);
- }
-
-+static void bgmac_adjust_link(struct net_device *dev)
-+{
-+ struct bgmac *bgmac = netdev_priv(dev);
-+ struct phy_device *phydev = bgmac->phydev;
-+ bool status_changed = 0;
-+
-+ BUG_ON(!phydev);
-+
-+ if (bgmac->old_link != phydev->link) {
-+ status_changed = 1;
-+ bgmac->old_link = phydev->link;
-+ }
-+
-+ /* reflect duplex change */
-+ if (phydev->link && (bgmac->old_duplex != phydev->duplex)) {
-+ status_changed = 1;
-+ bgmac->old_duplex = phydev->duplex;
-+ }
-+
-+ if (status_changed)
-+ phy_print_status(phydev);
-+}
-+
- static int bgmac_mii_register(struct bgmac *bgmac)
- {
- struct mii_bus *mii_bus;
- int i, err = 0;
-+ struct phy_device *phydev = NULL;
-+ char phy_id[MII_BUS_ID_SIZE + 3];
-+ struct net_device *net_dev = bgmac->net_dev;
-
- mii_bus = mdiobus_alloc();
- if (!mii_bus)
-@@ -1392,7 +1361,28 @@ static int bgmac_mii_register(struct bgm
-
- bgmac->mii_bus = mii_bus;
-
-- return err;
-+ /* connect to PHY */
-+ snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
-+ mii_bus->id, bgmac->phyaddr);
-+
-+ phydev = phy_connect(net_dev, phy_id, &bgmac_adjust_link,
-+ PHY_INTERFACE_MODE_MII);
-+
-+ if (IS_ERR(phydev)) {
-+ netdev_err(net_dev, "could not attach PHY: %s\n", phy_id);
-+ bgmac->phyaddr = BGMAC_PHY_NOREGS;
-+ return PTR_ERR(phydev);
-+ }
-+
-+ bgmac->phydev = phydev;
-+ bgmac->old_link = 0;
-+ bgmac->old_duplex = -1;
-+ bgmac->phyaddr = phydev->addr;
-+
-+ netdev_info(net_dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
-+ phydev->drv->name, dev_name(&phydev->dev));
-+
-+ return 0;
-
- err_free_irq:
- kfree(mii_bus->irq);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -401,7 +401,10 @@ struct bgmac {
- struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */
- struct net_device *net_dev;
- struct napi_struct napi;
-+ struct phy_device *phydev;
- struct mii_bus *mii_bus;
-+ int old_link;
-+ int old_duplex;
-
- /* DMA */
- struct bgmac_dma_ring tx_ring[BGMAC_MAX_TX_RINGS];
diff --git a/target/linux/brcm47xx/patches-3.10/770-bgmac-phylib.patch b/target/linux/generic/patches-3.10/771-bgmac-phylib.patch
index 50aaeaa14d..6f8f4d251f 100644
--- a/target/linux/brcm47xx/patches-3.10/770-bgmac-phylib.patch
+++ b/target/linux/generic/patches-3.10/771-bgmac-phylib.patch
@@ -1,3 +1,8 @@
+Use phy lib for the phy. This is needed to get the switch connected to
+the phy and driven by b53 working.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -1229,27 +1229,14 @@ static int bgmac_set_mac_address(struct
diff --git a/target/linux/bcm53xx/patches-3.10/204-bgmac-add-supprot-for-BCM4707.patch b/target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch
index 63959a9570..5b8901c170 100644
--- a/target/linux/bcm53xx/patches-3.10/204-bgmac-add-supprot-for-BCM4707.patch
+++ b/target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch
@@ -1,15 +1,10 @@
bgmac: add supprot for BCM4707
-
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
----
- drivers/net/ethernet/broadcom/bgmac.c | 56 +++++++++++++++++++++++----------
- drivers/net/ethernet/broadcom/bgmac.h | 2 ++
- 2 files changed, 42 insertions(+), 16 deletions(-)
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -868,6 +868,8 @@ static void bgmac_speed(struct bgmac *bg
+@@ -864,6 +864,8 @@ static void bgmac_speed(struct bgmac *bg
set |= BGMAC_CMDCFG_ES_100;
if (speed & BGMAC_SPEED_1000)
set |= BGMAC_CMDCFG_ES_1000;
@@ -18,7 +13,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
if (!bgmac->full_duplex)
set |= BGMAC_CMDCFG_HD;
bgmac_cmdcfg_maskset(bgmac, mask, set, true);
-@@ -875,13 +877,28 @@ static void bgmac_speed(struct bgmac *bg
+@@ -871,13 +873,28 @@ static void bgmac_speed(struct bgmac *bg
static void bgmac_miiconfig(struct bgmac *bgmac)
{
@@ -53,7 +48,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
}
}
-@@ -927,7 +944,8 @@ static void bgmac_chip_reset(struct bgma
+@@ -923,7 +940,8 @@ static void bgmac_chip_reset(struct bgma
bcma_core_enable(core, flags);
@@ -63,7 +58,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
bgmac_set(bgmac, BCMA_CLKCTLST, 1 << 8);
bgmac_wait_value(bgmac->core, BCMA_CLKCTLST, 1 << 24, 1 << 24,
1000);
-@@ -948,10 +966,13 @@ static void bgmac_chip_reset(struct bgma
+@@ -944,10 +962,13 @@ static void bgmac_chip_reset(struct bgma
et_swtype &= 0x0f;
et_swtype <<= 4;
sw_type = et_swtype;
@@ -80,7 +75,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
}
-@@ -1058,12 +1079,15 @@ static void bgmac_enable(struct bgmac *b
+@@ -1054,12 +1075,15 @@ static void bgmac_enable(struct bgmac *b
break;
}
diff --git a/target/linux/bcm53xx/patches-3.10/205-bgmac-add-srab-switch.patch b/target/linux/generic/patches-3.10/773-bgmac-add-srab-switch.patch
index cb498154a4..680adf5f17 100644
--- a/target/linux/bcm53xx/patches-3.10/205-bgmac-add-srab-switch.patch
+++ b/target/linux/generic/patches-3.10/773-bgmac-add-srab-switch.patch
@@ -1,3 +1,7 @@
+Register switch connected to srab
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -16,6 +16,7 @@
@@ -5,10 +9,10 @@
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
+#include <linux/platform_data/b53.h>
- #ifdef CONFIG_BCM47XX
#include <bcm47xx_nvram.h>
- #else
-@@ -1424,6 +1425,17 @@ static void bgmac_mii_unregister(struct
+
+ static const struct bcma_device_id bgmac_bcma_tbl[] = {
+@@ -1420,6 +1421,17 @@ static void bgmac_mii_unregister(struct
mdiobus_free(mii_bus);
}
@@ -26,7 +30,7 @@
/**************************************************
* BCMA bus ops
**************************************************/
-@@ -1523,6 +1535,16 @@ static int bgmac_probe(struct bcma_devic
+@@ -1519,6 +1531,16 @@ static int bgmac_probe(struct bcma_devic
goto err_dma_free;
}
@@ -43,7 +47,7 @@
err = register_netdev(bgmac->net_dev);
if (err) {
bgmac_err(bgmac, "Cannot register net device\n");
-@@ -1552,6 +1574,10 @@ static void bgmac_remove(struct bcma_dev
+@@ -1548,6 +1570,10 @@ static void bgmac_remove(struct bcma_dev
{
struct bgmac *bgmac = bcma_get_drvdata(core);