Skip to contentSkip to conversation

XLR/XLS network driver update and fixes

PATCH In review [email protected] 2 participants 6 messages Jun 18, 2014 – Jun 19, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover XLR/XLS network driver update and fixes

From: Ganesan Ramalingam <[email protected]>

Patches has following changes:

* Fixed compilation failure caused by change in COP2 API
* SGMII PHY address calculation was wrong, fixed
* Updated the driver to have single parent device for a XLR/XLS network block with multiple network devices under it
* Fixed comment format

Ganesan Ramalingam (3):
Staging: Fix compilation error
Staging: PHY address calculation fix
Staging: Move all the netdev under single parent device per
controller

 drivers/staging/netlogic/TODO           |    1 -
 drivers/staging/netlogic/platform_net.c |  213 ++++++++++++----------
 drivers/staging/netlogic/platform_net.h |    7 +-
 drivers/staging/netlogic/xlr_net.c      |  301 +++++++++++++++++--------------
 drivers/staging/netlogic/xlr_net.h      |    8 +-
 5 files changed, 292 insertions(+), 238 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 Staging: Fix compilation error

From: Ganesan Ramalingam <[email protected]>

Cop2 save and restore function names are changed, added that change

---
 drivers/staging/netlogic/xlr_net.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/netlogic/xlr_net.c +4 -4
index 75d7c63..69ae8b6 100644
@@ -125,9 +125,9 @@ static int send_to_rfr_fifo(struct xlr_net_priv *priv, void *addr)
 	msg.msg3 = 0;
 	stnid = priv->nd->rfr_station;
 	do {
-		mflags = nlm_cop2_enable();
+		mflags = nlm_cop2_enable_irqsave();
 		ret = nlm_fmn_send(1, 0, stnid, &msg);
-		nlm_cop2_restore(mflags);
+		nlm_cop2_disable_irqrestore(mflags);
 		if (ret == 0)
 			return 0;
 	} while (++num_try < 10000);
@@ -299,9 +299,9 @@ static netdev_tx_t xlr_net_start_xmit(struct sk_buff *skb,
 	u32 flags;
 
 	xlr_make_tx_desc(&msg, virt_to_phys(skb->data), skb);
-	flags = nlm_cop2_enable();
+	flags = nlm_cop2_enable_irqsave();
 	ret = nlm_fmn_send(2, 0, priv->nd->tx_stnid, &msg);
-	nlm_cop2_restore(flags);
+	nlm_cop2_disable_irqrestore(flags);
 	if (ret)
 		dev_kfree_skb_any(skb);
 	return NETDEV_TX_OK;
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/3 Staging: PHY address calculation fix

In reply to [email protected]

From: Ganesan Ramalingam <[email protected]>

SGMII PHY address calculation should be based on phy_addr of priv data

---
 drivers/staging/netlogic/xlr_net.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/netlogic/xlr_net.c +1 -1
index 69ae8b6..6d7a6a7 100644
@@ -776,7 +776,7 @@ static void xlr_sgmii_init(struct xlr_net_priv *priv)
 	xlr_nae_wreg(priv->gpio_addr, 0x21, 0x7104);
 
 	/* enable autoneg - more magic */
-	phy = priv->port_id % 4 + 27;
+	phy = priv->phy_addr % 4 + 27;
 	xlr_phy_write(priv->pcs_addr, phy, 0, 0x1000);
 	xlr_phy_write(priv->pcs_addr, phy, 0, 0x0200);
 }
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/3 Staging: Move all the netdev under single parent device per controller

In reply to [email protected]

From: Ganesan Ramalingam <[email protected]>

XLR and XLS has one and two network controller respectively, each controller has 4 gmac devices. So changing the per device initialization to per controller, all devices of a controller are linked to single parent device.

---
 drivers/staging/netlogic/TODO           |    1 -
 drivers/staging/netlogic/platform_net.c |  213 ++++++++++++----------
 drivers/staging/netlogic/platform_net.h |    7 +-
 drivers/staging/netlogic/xlr_net.c      |  291 +++++++++++++++++--------------
 drivers/staging/netlogic/xlr_net.h      |    8 +-
 5 files changed, 287 insertions(+), 233 deletions(-)
drivers/staging/netlogic/TODO +0 -1
index 08e6d52..8f172b0 100644
@@ -1,6 +1,5 @@
 * Implementing 64bit stat counter in software
 * All memory allocation should be changed to DMA allocations
-* All the netdev should be linked to single pdev as parent
 * Changing comments in to linux standred format
 
 Please send patches
drivers/staging/netlogic/platform_net.c +118 -95

265 lines not on this page · raw message

drivers/staging/netlogic/platform_net.h +5 -2
index 29deeea..e1b27f6 100644
@@ -31,6 +31,9 @@
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
+#define PORTS_PER_CONTROLLER		4
+
 struct xlr_net_data {
 	int cpu_mask;
 	u32 __iomem *mii_addr;
@@ -39,8 +42,8 @@ struct xlr_net_data {
 	u32 __iomem *gpio_addr;
 	int phy_interface;
 	int rfr_station;
-	int tx_stnid;
+	int tx_stnid[PORTS_PER_CONTROLLER];
 	int *bucket_size;
-	int phy_addr;
+	int phy_addr[PORTS_PER_CONTROLLER];
 	struct xlr_fmn_info *gmac_fmn_info;
 };
drivers/staging/netlogic/xlr_net.c +157 -134

473 lines not on this page · raw message

drivers/staging/netlogic/xlr_net.h +7 -1
index cea7966..13e03f0 100644
@@ -1069,14 +1069,20 @@ enum tsv_rsv_reg {
 	CARRY_REG_2 = 0x4d,
 };
 
+struct xlr_adapter {
+	struct net_device *netdev[4];
+};
+
 struct xlr_net_priv {
 	u32 __iomem *base_addr;
 	struct net_device *ndev;
+	struct xlr_adapter *adapter;
 	struct mii_bus *mii_bus;
 	int num_rx_desc;
 	int phy_addr;	/* PHY addr on MDIO bus */
 	int pcs_id;	/* PCS id on MDIO bus */
 	int port_id;	/* Port(gmac/xgmac) number, i.e 0-7 */
+	int tx_stnid;
 	u32 __iomem *mii_addr;
 	u32 __iomem *serdes_addr;
 	u32 __iomem *pcs_addr;
@@ -1096,4 +1102,4 @@ struct xlr_net_priv {
 	u64 *class_3_spill;
 };
 
-void xlr_set_gmac_speed(struct xlr_net_priv *priv);
+extern void xlr_set_gmac_speed(struct xlr_net_priv *priv);
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 3/3 Staging: Move all the netdev under single parent device

From: Ganesan Ramalingam <[email protected]>

XLR and XLS has one and two network controller respectively, each controller has 4 gmac devices. So changing the per device initialization to per controller, all devices of a controller are linked to single parent device.

---

v1:
Resolved the apply patch rejection caused by SET_ETHTOOL_OPS overwritten

 drivers/staging/netlogic/TODO           |    1 -
 drivers/staging/netlogic/platform_net.c |  212 +++++++++++++----------
 drivers/staging/netlogic/platform_net.h |    7 +-
 drivers/staging/netlogic/xlr_net.c      |  287 +++++++++++++++++--------------
 drivers/staging/netlogic/xlr_net.h      |    8 +-
 5 files changed, 283 insertions(+), 232 deletions(-)
drivers/staging/netlogic/TODO +0 -1
index 08e6d52..8f172b0 100644
@@ -1,6 +1,5 @@
 * Implementing 64bit stat counter in software
 * All memory allocation should be changed to DMA allocations
-* All the netdev should be linked to single pdev as parent
 * Changing comments in to linux standred format
 
 Please send patches
drivers/staging/netlogic/platform_net.c +117 -95

261 lines not on this page · raw message

drivers/staging/netlogic/platform_net.h +5 -2
index 29deeea..e1b27f6 100644
@@ -31,6 +31,9 @@
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
+#define PORTS_PER_CONTROLLER		4
+
 struct xlr_net_data {
 	int cpu_mask;
 	u32 __iomem *mii_addr;
@@ -39,8 +42,8 @@ struct xlr_net_data {
 	u32 __iomem *gpio_addr;
 	int phy_interface;
 	int rfr_station;
-	int tx_stnid;
+	int tx_stnid[PORTS_PER_CONTROLLER];
 	int *bucket_size;
-	int phy_addr;
+	int phy_addr[PORTS_PER_CONTROLLER];
 	struct xlr_fmn_info *gmac_fmn_info;
 };
drivers/staging/netlogic/xlr_net.c +154 -133

468 lines not on this page · raw message

drivers/staging/netlogic/xlr_net.h +7 -1
index cea7966..13e03f0 100644
@@ -1069,14 +1069,20 @@ enum tsv_rsv_reg {
 	CARRY_REG_2 = 0x4d,
 };
 
+struct xlr_adapter {
+	struct net_device *netdev[4];
+};
+
 struct xlr_net_priv {
 	u32 __iomem *base_addr;
 	struct net_device *ndev;
+	struct xlr_adapter *adapter;
 	struct mii_bus *mii_bus;
 	int num_rx_desc;
 	int phy_addr;	/* PHY addr on MDIO bus */
 	int pcs_id;	/* PCS id on MDIO bus */
 	int port_id;	/* Port(gmac/xgmac) number, i.e 0-7 */
+	int tx_stnid;
 	u32 __iomem *mii_addr;
 	u32 __iomem *serdes_addr;
 	u32 __iomem *pcs_addr;
@@ -1096,4 +1102,4 @@ struct xlr_net_priv {
 	u64 *class_3_spill;
 };
 
-void xlr_set_gmac_speed(struct xlr_net_priv *priv);
+extern void xlr_set_gmac_speed(struct xlr_net_priv *priv);
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to [email protected]
Quoted 9 lines · On Wed, Jun 18, 2014 at 06:43:55PM +0530, [email protected] wrote:

From: Ganesan Ramalingam <[email protected]>

Patches has following changes:

* Fixed compilation failure caused by change in COP2 API
* SGMII PHY address calculation was wrong, fixed
* Updated the driver to have single parent device for a XLR/XLS network block with multiple network devices under it
* Fixed comment format

Patches 1 and 2 apply cleanly but I'm getting a reject for patch 3.

Ralf