Commit 23a1e7d118fb08dea762e992471b1a570e8084a3

Authored by Chandan Nath
Committed by Afzal Mohammed
1 parent d44df8fdd7
Exists in master

AM33XX: cpsw - enabled two port in switch

Enabled the two slaves of the CPSW with port forwarding enabled.
Port forward is moved from slave open to link up so that queues
are not used when link is down.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Chandan Nath <chandan.nath@ti.com>

Showing 2 changed files with 18 additions and 13 deletions Side-by-side Diff

arch/arm/mach-omap2/devices.c
... ... @@ -705,7 +705,7 @@
705 705 .ss_reg_ofs = 0x1200,
706 706 .channels = 8,
707 707 .cpdma_reg_ofs = 0x800,
708   - .slaves = 1,
  708 + .slaves = 2,
709 709 .slave_data = am33xx_cpsw_slaves,
710 710 .ale_reg_ofs = 0xd00,
711 711 .ale_entries = 1024,
... ... @@ -366,16 +366,31 @@
366 366 __raw_writel(mac_lo(priv->mac_addr), &slave->regs->sa_lo);
367 367 }
368 368  
  369 +static inline u32 cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num)
  370 +{
  371 + if (priv->host_port == 0)
  372 + return slave_num + 1;
  373 + else
  374 + return slave_num;
  375 +}
  376 +
369 377 static void _cpsw_adjust_link(struct cpsw_slave *slave,
370 378 struct cpsw_priv *priv, bool *link)
371 379 {
372 380 struct phy_device *phy = slave->phy;
373 381 u32 mac_control = 0;
  382 + u32 slave_port;
374 383  
375 384 if (!phy)
376 385 return;
377 386  
  387 + slave_port = cpsw_get_slave_port(priv, slave->slave_num);
  388 +
378 389 if (phy->link) {
  390 + /* enable forwarding */
  391 + cpsw_ale_control_set(priv->ale, slave_port,
  392 + ALE_PORT_STATE, ALE_PORT_STATE_FORWARD);
  393 +
379 394 mac_control = priv->data.mac_control;
380 395 if (phy->speed == 10)
381 396 mac_control |= BIT(18); /* In Band mode */
... ... @@ -387,6 +402,8 @@
387 402 mac_control |= (BIT(15)|BIT(16));
388 403 *link = true;
389 404 } else {
  405 + cpsw_ale_control_set(priv->ale, slave_port,
  406 + ALE_PORT_STATE, ALE_PORT_STATE_DISABLE);
390 407 mac_control = 0;
391 408 }
392 409  
... ... @@ -486,14 +503,6 @@
486 503  
487 504 DEVICE_ATTR(hw_stats, S_IRUGO, cpsw_hw_stats_show, NULL);
488 505  
489   -static inline u32 cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num)
490   -{
491   - if (priv->host_port == 0)
492   - return slave_num + 1;
493   - else
494   - return slave_num;
495   -}
496   -
497 506 #define PHY_CONFIG_REG 22
498 507 static void cpsw_set_phy_config(struct cpsw_priv *priv, struct phy_device *phy)
499 508 {
500 509  
... ... @@ -574,11 +583,7 @@
574 583  
575 584 slave->mac_control = 0; /* no link yet */
576 585  
577   - /* enable forwarding */
578 586 slave_port = cpsw_get_slave_port(priv, slave->slave_num);
579   - cpsw_ale_control_set(priv->ale, slave_port,
580   - ALE_PORT_STATE, ALE_PORT_STATE_FORWARD);
581   -
582 587 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
583 588 1 << slave_port);
584 589