Commit 5e59c83f authored by David S. Miller's avatar David S. Miller

Merge branch 'xgene-channel-number'

Iyappan Subramanian says:

====================
drivers: net: xgene: fix: Get channel number from device binding

This patch set adds 'channel' property to get ethernet to CPU channel number,
thus decoupling the Linux driver from static resource selection.

v2: Address review comments from v1
- removed irq reference from Linux driver
- added 'channel' property to get ethernet to CPU channel number

v1:
- Initial version
====================
Signed-off-by: default avatarIyappan Subramanian <isubramanian@apm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 582a1db9 6619ac5a
...@@ -18,6 +18,8 @@ Required properties for all the ethernet interfaces: ...@@ -18,6 +18,8 @@ Required properties for all the ethernet interfaces:
- First is the Rx interrupt. This irq is mandatory. - First is the Rx interrupt. This irq is mandatory.
- Second is the Tx completion interrupt. - Second is the Tx completion interrupt.
This is supported only on SGMII based 1GbE and 10GbE interfaces. This is supported only on SGMII based 1GbE and 10GbE interfaces.
- channel: Ethernet to CPU, start channel (prefetch buffer) number
- Must map to the first irq and irqs must be sequential
- port-id: Port number (0 or 1) - port-id: Port number (0 or 1)
- clocks: Reference to the clock entry. - clocks: Reference to the clock entry.
- local-mac-address: MAC address assigned to this device - local-mac-address: MAC address assigned to this device
......
...@@ -653,6 +653,7 @@ xgenet1: ethernet@1f620000 { ...@@ -653,6 +653,7 @@ xgenet1: ethernet@1f620000 {
<0 113 4>, <0 113 4>,
<0 114 4>, <0 114 4>,
<0 115 4>; <0 115 4>;
channel = <12>;
port-id = <1>; port-id = <1>;
dma-coherent; dma-coherent;
clocks = <&xge1clk 0>; clocks = <&xge1clk 0>;
......
...@@ -993,6 +993,7 @@ xgenet: ethernet@1f610000 { ...@@ -993,6 +993,7 @@ xgenet: ethernet@1f610000 {
<0x0 0x65 0x4>, <0x0 0x65 0x4>,
<0x0 0x66 0x4>, <0x0 0x66 0x4>,
<0x0 0x67 0x4>; <0x0 0x67 0x4>;
channel = <0>;
dma-coherent; dma-coherent;
clocks = <&xge0clk 0>; clocks = <&xge0clk 0>;
/* mac address will be overwritten by the bootloader */ /* mac address will be overwritten by the bootloader */
......
...@@ -973,6 +973,17 @@ static enum xgene_ring_owner xgene_derive_ring_owner(struct xgene_enet_pdata *p) ...@@ -973,6 +973,17 @@ static enum xgene_ring_owner xgene_derive_ring_owner(struct xgene_enet_pdata *p)
return owner; return owner;
} }
static u8 xgene_start_cpu_bufnum(struct xgene_enet_pdata *pdata)
{
struct device *dev = &pdata->pdev->dev;
u32 cpu_bufnum;
int ret;
ret = device_property_read_u32(dev, "channel", &cpu_bufnum);
return (!ret) ? cpu_bufnum : pdata->cpu_bufnum;
}
static int xgene_enet_create_desc_rings(struct net_device *ndev) static int xgene_enet_create_desc_rings(struct net_device *ndev)
{ {
struct xgene_enet_pdata *pdata = netdev_priv(ndev); struct xgene_enet_pdata *pdata = netdev_priv(ndev);
...@@ -981,13 +992,15 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev) ...@@ -981,13 +992,15 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev)
struct xgene_enet_desc_ring *buf_pool = NULL; struct xgene_enet_desc_ring *buf_pool = NULL;
enum xgene_ring_owner owner; enum xgene_ring_owner owner;
dma_addr_t dma_exp_bufs; dma_addr_t dma_exp_bufs;
u8 cpu_bufnum = pdata->cpu_bufnum; u8 cpu_bufnum;
u8 eth_bufnum = pdata->eth_bufnum; u8 eth_bufnum = pdata->eth_bufnum;
u8 bp_bufnum = pdata->bp_bufnum; u8 bp_bufnum = pdata->bp_bufnum;
u16 ring_num = pdata->ring_num; u16 ring_num = pdata->ring_num;
u16 ring_id; u16 ring_id;
int i, ret, size; int i, ret, size;
cpu_bufnum = xgene_start_cpu_bufnum(pdata);
for (i = 0; i < pdata->rxq_cnt; i++) { for (i = 0; i < pdata->rxq_cnt; i++) {
/* allocate rx descriptor ring */ /* allocate rx descriptor ring */
owner = xgene_derive_ring_owner(pdata); owner = xgene_derive_ring_owner(pdata);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment