Skip to content

Commit

Permalink
Merge branch 'netcp-K2G-SoC-support'
Browse files Browse the repository at this point in the history
Murali Karicheri says:

====================
Add support for netcp driver on K2G SoC

K2G SoC is another variant of Keystone family of SoCs. This patch
series add support for NetCP driver on this SoC. The QMSS found on
K2G SoC is a cut down version of the QMSS found on other keystone
devices with less number of queues, internal link ram etc. The patch
series has 2 patch sets that goes into the drivers/soc and the
rest has to be applied to net sub system. Please review and merge
if this looks good.

K2G TRM is located at http://www.ti.com/lit/ug/spruhy8g/spruhy8g.pdf
Thanks

The boot logs on K2G ICE board (tftp boot over Ethernet and from mmc)
https://pastebin.ubuntu.com/p/yvZ6drFhkW/

The boot logs on K2G GP board (tftp boot over Ethernet and from mmc)
https://pastebin.ubuntu.com/p/QTr6K7s4Zp/

Also regressed boot on K2HK and K2L EVMs as we have modified GBE
version detection logic (K2E uses same version of NetCP as in K2L.
So regression on one of them is needed).

Boot log on K2L and K2HK EVMs are at
https://pastebin.ubuntu.com/p/N9DBdPjbvR/

This series applies to net-next master branch.

Change history:
  v4 - ready for merge to net-next
       Folded the series "Add promiscous mode support in k2g network driver"
       into this.
       Fixed a typo in 5/11 (sgmii to rgmii) based on TI internal comment
       Reworked 4/11 and title changed to reflect additional changes to
       exclude sgmii configuration code for 2U cpsw. Use IS_SS_ID_2U()
       macro for customization.
       Added Reviewed-by from Rob Herring against 1/13
  v3 - Addressed comments from Andrew Lunn and Grygorii Strashko
       against v2.
  v2 - Addressed following comments on initial version
       - split patch 3/5 to multiple patches from Andrew Lunn
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Apr 19, 2018
2 parents 0565de2 + 8585661 commit e8f3f70
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ pool management.


Required properties:
- compatible : Must be "ti,keystone-navigator-qmss";
- compatible : Must be "ti,keystone-navigator-qmss".
: Must be "ti,66ak2g-navss-qm" for QMSS on K2G SoC.
- clocks : phandle to the reference clock for this device.
- queue-range : <start number> total range of queue numbers for the device.
- linkram0 : <address size> for internal link ram, where size is the total
Expand All @@ -39,6 +40,12 @@ Required properties:
- Descriptor memory setup region.
- Queue Management/Queue Proxy region for queue Push.
- Queue Management/Queue Proxy region for queue Pop.

For QMSS on K2G SoC, following QM reg indexes are used in that order
- Queue Peek region.
- Queue configuration region.
- Queue Management/Queue Proxy region for queue Push/Pop.

- queue-pools : child node classifying the queue ranges into pools.
Queue ranges are grouped into 3 type of pools:
- qpend : pool of qpend(interruptible) queues
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/ti/netcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#define SGMII_LINK_MAC_MAC_FORCED 2
#define SGMII_LINK_MAC_FIBER 3
#define SGMII_LINK_MAC_PHY_NO_MDIO 4
#define RGMII_LINK_MAC_PHY 5
#define RGMII_LINK_MAC_PHY_NO_MDIO 7
#define XGMII_LINK_MAC_PHY 10
#define XGMII_LINK_MAC_MAC_FORCED 11

Expand Down Expand Up @@ -212,6 +214,7 @@ struct netcp_module {
int (*add_vid)(void *intf_priv, int vid);
int (*del_vid)(void *intf_priv, int vid);
int (*ioctl)(void *intf_priv, struct ifreq *req, int cmd);
int (*set_rx_mode)(void *intf_priv, bool promisc);

/* used internally */
struct list_head module_list;
Expand Down
32 changes: 32 additions & 0 deletions drivers/net/ethernet/ti/netcp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,24 @@ static void netcp_addr_sweep_add(struct netcp_intf *netcp)
}
}

static int netcp_set_promiscuous(struct netcp_intf *netcp, bool promisc)
{
struct netcp_intf_modpriv *priv;
struct netcp_module *module;
int error;

for_each_module(netcp, priv) {
module = priv->netcp_module;
if (!module->set_rx_mode)
continue;

error = module->set_rx_mode(priv->module_priv, promisc);
if (error)
return error;
}
return 0;
}

static void netcp_set_rx_mode(struct net_device *ndev)
{
struct netcp_intf *netcp = netdev_priv(ndev);
Expand Down Expand Up @@ -1538,6 +1556,7 @@ static void netcp_set_rx_mode(struct net_device *ndev)
/* finally sweep and callout into modules */
netcp_addr_sweep_del(netcp);
netcp_addr_sweep_add(netcp);
netcp_set_promiscuous(netcp, promisc);
spin_unlock(&netcp->lock);
}

Expand Down Expand Up @@ -2155,8 +2174,13 @@ static int netcp_probe(struct platform_device *pdev)
struct device_node *child, *interfaces;
struct netcp_device *netcp_device;
struct device *dev = &pdev->dev;
struct netcp_module *module;
int ret;

if (!knav_dma_device_ready() ||
!knav_qmss_device_ready())
return -EPROBE_DEFER;

if (!node) {
dev_err(dev, "could not find device info\n");
return -ENODEV;
Expand Down Expand Up @@ -2203,6 +2227,14 @@ static int netcp_probe(struct platform_device *pdev)
/* Add the device instance to the list */
list_add_tail(&netcp_device->device_list, &netcp_devices);

/* Probe & attach any modules already registered */
mutex_lock(&netcp_modules_lock);
for_each_netcp_module(module) {
ret = netcp_module_probe(netcp_device, module);
if (ret < 0)
dev_err(dev, "module(%s) probe failed\n", module->name);
}
mutex_unlock(&netcp_modules_lock);
return 0;

probe_quit_interface:
Expand Down
Loading

0 comments on commit e8f3f70

Please sign in to comment.