Skip to content

Commit 34bfff4

Browse files
tlendackydavem330
authored andcommitted
amd-xgbe: Support defining PHY resources in ETH device node
Simplify the device tree support of the amd-xgbe driver by defining the PHY-related resources within the ethernet device node. The support provides backwards compatibility with the original way. Update the driver version to 1.0.2. Signed-off-by: Tom Lendacky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c12aa0 commit 34bfff4

File tree

3 files changed

+29
-37
lines changed

3 files changed

+29
-37
lines changed

Documentation/devicetree/bindings/net/amd-xgbe.txt

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
* AMD 10GbE driver (amd-xgbe)
22

3-
Required properties (ethernet device):
3+
Required properties:
44
- compatible: Should be "amd,xgbe-seattle-v1a"
55
- reg: Address and length of the register sets for the device
66
- MAC registers
77
- PCS registers
8+
- SerDes Rx/Tx registers
9+
- SerDes integration registers (1/2)
10+
- SerDes integration registers (2/2)
811
- interrupt-parent: Should be the phandle for the interrupt controller
912
that services interrupts for this device
1013
- interrupts: Should contain the amd-xgbe interrupt(s). The first interrupt
1114
listed is required and is the general device interrupt. If the optional
1215
amd,per-channel-interrupt property is specified, then one additional
13-
interrupt for each DMA channel supported by the device should be specified
16+
interrupt for each DMA channel supported by the device should be specified.
17+
The last interrupt listed should be the PCS auto-negotiation interrupt.
1418
- clocks:
1519
- DMA clock for the amd-xgbe device (used for calculating the
1620
correct Rx interrupt watchdog timer value on a DMA channel
@@ -19,28 +23,15 @@ Required properties (ethernet device):
1923
- clock-names: Should be the names of the clocks
2024
- "dma_clk" for the DMA clock
2125
- "ptp_clk" for the PTP clock
22-
- phy-handle: See ethernet.txt file in the same directory
2326
- phy-mode: See ethernet.txt file in the same directory
2427

25-
Optional properties (ethernet device):
28+
Optional properties:
2629
- mac-address: mac address to be assigned to the device. Can be overridden
2730
by UEFI.
2831
- dma-coherent: Present if dma operations are coherent
2932
- amd,per-channel-interrupt: Indicates that Rx and Tx complete will generate
3033
a unique interrupt for each DMA channel - this requires an additional
3134
interrupt be configured for each DMA channel
32-
33-
Required properties (phy device):
34-
- compatible: Should be "amd,xgbe-phy-seattle-v1a"
35-
- reg: Address and length of the register sets for the device
36-
- SerDes Rx/Tx registers
37-
- SerDes integration registers (1/2)
38-
- SerDes integration registers (2/2)
39-
- interrupt-parent: Should be the phandle for the interrupt controller
40-
that services interrupts for this device
41-
- interrupts: Should contain the amd-xgbe-phy interrupt.
42-
43-
Optional properties (phy device):
4435
- amd,speed-set: Speed capabilities of the device
4536
0 - 1GbE and 10GbE (default)
4637
1 - 2.5GbE and 10GbE
@@ -63,25 +54,19 @@ Example:
6354
xgbe@e0700000 {
6455
compatible = "amd,xgbe-seattle-v1a";
6556
reg = <0 0xe0700000 0 0x80000>,
66-
<0 0xe0780000 0 0x80000>;
57+
<0 0xe0780000 0 0x80000>,
58+
<0 0xe1240800 0 0x00400>,
59+
<0 0xe1250000 0 0x00060>,
60+
<0 0xe1250080 0 0x00004>;
6761
interrupt-parent = <&gic>;
6862
interrupts = <0 325 4>,
69-
<0 326 1>, <0 327 1>, <0 328 1>, <0 329 1>;
63+
<0 326 1>, <0 327 1>, <0 328 1>, <0 329 1>,
64+
<0 323 4>;
7065
amd,per-channel-interrupt;
7166
clocks = <&xgbe_dma_clk>, <&xgbe_ptp_clk>;
7267
clock-names = "dma_clk", "ptp_clk";
73-
phy-handle = <&xgbe_phy>;
7468
phy-mode = "xgmii";
7569
mac-address = [ 02 a1 a2 a3 a4 a5 ];
76-
};
77-
78-
xgbe_phy@e1240800 {
79-
compatible = "amd,xgbe-phy-seattle-v1a";
80-
reg = <0 0xe1240800 0 0x00400>,
81-
<0 0xe1250000 0 0x00060>,
82-
<0 0xe1250080 0 0x00004>;
83-
interrupt-parent = <&gic>;
84-
interrupts = <0 323 4>;
8570
amd,speed-set = <0>;
8671
amd,serdes-blwc = <1>, <1>, <0>;
8772
amd,serdes-cdr-rate = <2>, <2>, <7>;

drivers/net/ethernet/amd/xgbe/xgbe-main.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,21 @@ static struct platform_device *xgbe_of_get_phy_pdev(struct xgbe_prv_data *pdata)
300300
struct platform_device *phy_pdev;
301301

302302
phy_node = of_parse_phandle(dev->of_node, "phy-handle", 0);
303-
if (!phy_node) {
304-
dev_err(dev, "unable to locate phy device\n");
305-
return NULL;
303+
if (phy_node) {
304+
/* Old style device tree:
305+
* The XGBE and PHY resources are separate
306+
*/
307+
phy_pdev = of_find_device_by_node(phy_node);
308+
of_node_put(phy_node);
309+
} else {
310+
/* New style device tree:
311+
* The XGBE and PHY resources are grouped together with
312+
* the PHY resources listed last
313+
*/
314+
get_device(dev);
315+
phy_pdev = pdata->pdev;
306316
}
307317

308-
phy_pdev = of_find_device_by_node(phy_node);
309-
of_node_put(phy_node);
310-
311318
return phy_pdev;
312319
}
313320
#else /* CONFIG_OF */
@@ -401,14 +408,14 @@ static int xgbe_probe(struct platform_device *pdev)
401408
phy_dev = &phy_pdev->dev;
402409

403410
if (pdev == phy_pdev) {
404-
/* ACPI:
411+
/* New style device tree or ACPI:
405412
* The XGBE and PHY resources are grouped together with
406413
* the PHY resources listed last
407414
*/
408415
phy_memnum = xgbe_resource_count(pdev, IORESOURCE_MEM) - 3;
409416
phy_irqnum = xgbe_resource_count(pdev, IORESOURCE_IRQ) - 1;
410417
} else {
411-
/* Device tree:
418+
/* Old style device tree:
412419
* The XGBE and PHY resources are separate
413420
*/
414421
phy_memnum = 0;

drivers/net/ethernet/amd/xgbe/xgbe.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
#include <net/dcbnl.h>
130130

131131
#define XGBE_DRV_NAME "amd-xgbe"
132-
#define XGBE_DRV_VERSION "1.0.1"
132+
#define XGBE_DRV_VERSION "1.0.2"
133133
#define XGBE_DRV_DESC "AMD 10 Gigabit Ethernet Driver"
134134

135135
/* Descriptor related defines */

0 commit comments

Comments
 (0)