Skip to content

Commit 5e59c83

Browse files
committed
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: Iyappan Subramanian <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2 parents 582a1db + 6619ac5 commit 5e59c83

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

Documentation/devicetree/bindings/net/apm-xgene-enet.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Required properties for all the ethernet interfaces:
1818
- First is the Rx interrupt. This irq is mandatory.
1919
- Second is the Tx completion interrupt.
2020
This is supported only on SGMII based 1GbE and 10GbE interfaces.
21+
- channel: Ethernet to CPU, start channel (prefetch buffer) number
22+
- Must map to the first irq and irqs must be sequential
2123
- port-id: Port number (0 or 1)
2224
- clocks: Reference to the clock entry.
2325
- local-mac-address: MAC address assigned to this device

arch/arm64/boot/dts/apm/apm-shadowcat.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@
653653
<0 113 4>,
654654
<0 114 4>,
655655
<0 115 4>;
656+
channel = <12>;
656657
port-id = <1>;
657658
dma-coherent;
658659
clocks = <&xge1clk 0>;

arch/arm64/boot/dts/apm/apm-storm.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,7 @@
993993
<0x0 0x65 0x4>,
994994
<0x0 0x66 0x4>,
995995
<0x0 0x67 0x4>;
996+
channel = <0>;
996997
dma-coherent;
997998
clocks = <&xge0clk 0>;
998999
/* mac address will be overwritten by the bootloader */

drivers/net/ethernet/apm/xgene/xgene_enet_main.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,17 @@ static enum xgene_ring_owner xgene_derive_ring_owner(struct xgene_enet_pdata *p)
973973
return owner;
974974
}
975975

976+
static u8 xgene_start_cpu_bufnum(struct xgene_enet_pdata *pdata)
977+
{
978+
struct device *dev = &pdata->pdev->dev;
979+
u32 cpu_bufnum;
980+
int ret;
981+
982+
ret = device_property_read_u32(dev, "channel", &cpu_bufnum);
983+
984+
return (!ret) ? cpu_bufnum : pdata->cpu_bufnum;
985+
}
986+
976987
static int xgene_enet_create_desc_rings(struct net_device *ndev)
977988
{
978989
struct xgene_enet_pdata *pdata = netdev_priv(ndev);
@@ -981,13 +992,15 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev)
981992
struct xgene_enet_desc_ring *buf_pool = NULL;
982993
enum xgene_ring_owner owner;
983994
dma_addr_t dma_exp_bufs;
984-
u8 cpu_bufnum = pdata->cpu_bufnum;
995+
u8 cpu_bufnum;
985996
u8 eth_bufnum = pdata->eth_bufnum;
986997
u8 bp_bufnum = pdata->bp_bufnum;
987998
u16 ring_num = pdata->ring_num;
988999
u16 ring_id;
9891000
int i, ret, size;
9901001

1002+
cpu_bufnum = xgene_start_cpu_bufnum(pdata);
1003+
9911004
for (i = 0; i < pdata->rxq_cnt; i++) {
9921005
/* allocate rx descriptor ring */
9931006
owner = xgene_derive_ring_owner(pdata);

0 commit comments

Comments
 (0)