]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/net/cpsw.c
karo: cleanup after merge of v2015.10-rc2
[karo-tx-uboot.git] / drivers / net / cpsw.c
index 725108d0ea392f15f7e09c178093a9eb6eb9db91..5fd2b08cfca99a0b487c14a2bea86b4fd79e2ec6 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <cpsw.h>
 #include <net.h>
 #include <miiphy.h>
 #include <malloc.h>
@@ -227,7 +228,7 @@ struct cpdma_chan {
 #define chan_read_ptr(chan, fld)       ((void *)__raw_readl((chan)->fld))
 
 #define for_active_slave(slave, priv) \
-       slave = (priv)->slaves + (priv)->data.active_slave; if (slave)
+       slave = (priv)->slaves + (priv)->data->active_slave; if (slave)
 #define for_each_slave(slave, priv) \
        for (slave = (priv)->slaves; slave != (priv)->slaves + \
                                (priv)->data->slaves; slave++)
@@ -304,7 +305,7 @@ static inline void cpsw_ale_get_addr(u32 *ale_entry, u8 *addr)
                addr[i] = cpsw_ale_get_field(ale_entry, 40 - 8*i, 8);
 }
 
-static inline void cpsw_ale_set_addr(u32 *ale_entry, u8 *addr)
+static inline void cpsw_ale_set_addr(u32 *ale_entry, const u8 *addr)
 {
        int i;
 
@@ -336,7 +337,7 @@ static int cpsw_ale_write(struct cpsw_priv *priv, int idx, u32 *ale_entry)
        return idx;
 }
 
-static int cpsw_ale_match_addr(struct cpsw_priv *priv, u8* addr)
+static int cpsw_ale_match_addr(struct cpsw_priv *priv, const u8 *addr)
 {
        u32 ale_entry[ALE_ENTRY_WORDS];
        int type, idx;
@@ -389,7 +390,7 @@ static int cpsw_ale_find_ageable(struct cpsw_priv *priv)
        return -ENOENT;
 }
 
-static int cpsw_ale_add_ucast(struct cpsw_priv *priv, u8 *addr,
+static int cpsw_ale_add_ucast(struct cpsw_priv *priv, const u8 *addr,
                              int port, int flags)
 {
        u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
@@ -414,7 +415,8 @@ static int cpsw_ale_add_ucast(struct cpsw_priv *priv, u8 *addr,
        return 0;
 }
 
-static int cpsw_ale_add_mcast(struct cpsw_priv *priv, u8 *addr, int port_mask)
+static int cpsw_ale_add_mcast(struct cpsw_priv *priv, const u8 *addr,
+                             int port_mask)
 {
        u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
        int idx, mask;
@@ -598,7 +600,7 @@ static void cpsw_set_slave_mac(struct cpsw_slave *slave,
 static void cpsw_slave_update_link(struct cpsw_slave *slave,
                                   struct cpsw_priv *priv, int *link)
 {
-       struct phy_device *phy;
+       struct phy_device *phy = priv->phydev;
        u32 mac_control = 0;
        int retries = NUM_TRIES;
 
@@ -676,7 +678,7 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv)
        slave_port = cpsw_get_slave_port(priv, slave->slave_num);
        cpsw_ale_port_state(priv, slave_port, ALE_PORT_STATE_FORWARD);
 
-       cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << slave_port);
+       cpsw_ale_add_mcast(priv, net_bcast_ethaddr, 1 << slave_port);
 
        priv->phy_mask |= 1 << slave->data->phy_addr;
 }
@@ -833,7 +835,7 @@ static int cpsw_init(struct eth_device *dev, bd_t *bis)
 
        cpsw_ale_add_ucast(priv, priv->dev->enetaddr, priv->host_port,
                           ALE_SECURE);
-       cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << priv->host_port);
+       cpsw_ale_add_mcast(priv, net_bcast_ethaddr, 1 << priv->host_port);
 
        for_active_slave(slave, priv)
                cpsw_slave_init(slave, priv);
@@ -900,7 +902,7 @@ static int cpsw_init(struct eth_device *dev, bd_t *bis)
 
        /* submit rx descs */
        for (i = 0; i < PKTBUFSRX; i++) {
-               ret = cpdma_submit(priv, &priv->rx_chan, NetRxPackets[i],
+               ret = cpdma_submit(priv, &priv->rx_chan, net_rx_packets[i],
                                   PKTSIZE);
                if (ret < 0) {
                        printf("error %d submitting rx desc\n", ret);
@@ -975,7 +977,7 @@ static int cpsw_recv(struct eth_device *dev)
 
        while (cpdma_process(priv, &priv->rx_chan, &buffer, &len) == 0) {
                if (buffer) {
-                       NetReceive(buffer, len);
+                       net_process_received_packet(buffer, len);
                        cpdma_submit(priv, &priv->rx_chan, buffer, PKTSIZE);
                } else {
                        printf("NULL buffer returned from cpdma_process\n");
@@ -1006,7 +1008,7 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave)
        struct phy_device *phydev;
        u32 supported = PHY_GBIT_FEATURES;
 
-       if (slave->data->phy_id < 0) {
+       if (slave->data->phy_addr < 0) {
                u32 phy_addr;
 
                for (phy_addr = 0; phy_addr < 32; phy_addr++) {
@@ -1019,7 +1021,7 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave)
                }
        } else {
                phydev = phy_connect(priv->bus,
-                               slave->data->phy_id,
+                               slave->data->phy_addr,
                                dev,
                                slave->data->phy_if);
        }
@@ -1047,7 +1049,6 @@ int cpsw_register(struct cpsw_platform_data *data)
        struct cpsw_slave       *slave;
        void                    *regs = (void *)data->cpsw_base;
        struct eth_device       *dev;
-       int i;
        int idx = 0;
 
        debug("%s@%d\n", __func__, __LINE__);
@@ -1077,7 +1078,6 @@ int cpsw_register(struct cpsw_platform_data *data)
        priv->host_port_regs    = regs + data->host_port_reg_ofs;
        priv->dma_regs          = regs + data->cpdma_reg_ofs;
        priv->ale_regs          = regs + data->ale_reg_ofs;
-       priv->descs             = (void *)regs + data->bd_ram_ofs;
 
        for_each_slave(slave, priv) {
                cpsw_slave_setup(slave, idx, priv);
@@ -1096,10 +1096,8 @@ int cpsw_register(struct cpsw_platform_data *data)
 
        cpsw_mdio_init(dev->name, data->mdio_base, data->mdio_div);
        priv->bus = miiphy_get_dev_by_name(dev->name);
-       for_active_slave(slave, priv) {
+       for_active_slave(slave, priv)
                ret = cpsw_phy_init(dev, slave);
-               if (ret < 0)
-                       break;
-       }
+
        return ret;
 }