Skip to content

Commit 57ea850

Browse files
committed
Merge branch 'ti-am65x-cpts-follow-up-dt-bindings-update'
Grygorii Strashko says: ==================== net: ethernet: ti: am65x-cpts: follow up dt bindings update This series is follow update for TI A65x/J721E Common platform time sync (CPTS) driver [1] to implement DT bindings review comments from Rob Herring <robh@kernel.org> [2]. - "reg" and "compatible" properties are made required for CPTS DT nodes which also required to change K3 CPSW driver to use of_platform_device_create() instead of of_platform_populate() for proper CPTS and MDIO initialization - minor DT bindings format changes - K3 CPTS example added to K3 MCU CPSW bindings [1] https://lwn.net/Articles/819313/ [2] https://lwn.net/ml/linux-kernel/20200505040419.GA8509@bogus/ ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents a8c9baf + ef2d136 commit 57ea850

6 files changed

Lines changed: 49 additions & 25 deletions

File tree

‎Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ patternProperties:
144144
description:
145145
CPSW MDIO bus.
146146

147-
"^cpts$":
147+
"^cpts@[0-9a-f]+":
148148
type: object
149149
allOf:
150150
- $ref: "ti,k3-am654-cpts.yaml#"
@@ -171,6 +171,8 @@ examples:
171171
#include <dt-bindings/pinctrl/k3.h>
172172
#include <dt-bindings/soc/ti,sci_pm_domain.h>
173173
#include <dt-bindings/net/ti-dp83867.h>
174+
#include <dt-bindings/interrupt-controller/irq.h>
175+
#include <dt-bindings/interrupt-controller/arm-gic.h>
174176
175177
mcu_cpsw: ethernet@46000000 {
176178
compatible = "ti,am654-cpsw-nuss";
@@ -229,4 +231,15 @@ examples:
229231
ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
230232
};
231233
};
234+
235+
cpts@3d000 {
236+
compatible = "ti,am65-cpts";
237+
reg = <0x0 0x3d000 0x0 0x400>;
238+
clocks = <&k3_clks 18 2>;
239+
clock-names = "cpts";
240+
interrupts-extended = <&gic500 GIC_SPI 858 IRQ_TYPE_LEVEL_HIGH>;
241+
interrupt-names = "cpts";
242+
ti,cpts-ext-ts-inputs = <4>;
243+
ti,cpts-periodic-outputs = <2>;
244+
};
232245
};

‎Documentation/devicetree/bindings/net/ti,k3-am654-cpts.yaml‎

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ description: |+
4242
4343
properties:
4444
$nodename:
45-
pattern: "^cpts(@.*|-[0-9a-f])*$"
45+
pattern: "^cpts@[0-9a-f]+$"
4646

4747
compatible:
4848
oneOf:
@@ -52,7 +52,7 @@ properties:
5252
reg:
5353
maxItems: 1
5454
description:
55-
The physical base address and size of CPTS IO range
55+
The physical base address and size of CPTS IO range
5656

5757
reg-names:
5858
items:
@@ -65,27 +65,27 @@ properties:
6565
items:
6666
- const: cpts
6767

68-
interrupts-extended:
68+
interrupts:
6969
items:
7070
- description: CPTS events interrupt
7171

7272
interrupt-names:
7373
items:
74-
- const: "cpts"
74+
- const: cpts
7575

7676
ti,cpts-ext-ts-inputs:
7777
allOf:
7878
- $ref: /schemas/types.yaml#/definitions/uint32
7979
maximum: 8
8080
description:
81-
Number of hardware timestamp push inputs (HWx_TS_PUSH)
81+
Number of hardware timestamp push inputs (HWx_TS_PUSH)
8282

8383
ti,cpts-periodic-outputs:
8484
allOf:
8585
- $ref: /schemas/types.yaml#/definitions/uint32
8686
maximum: 8
8787
description:
88-
Number of timestamp Generator function outputs (TS_GENFx)
88+
Number of timestamp Generator function outputs (TS_GENFx)
8989

9090
refclk-mux:
9191
type: object
@@ -107,9 +107,11 @@ properties:
107107
- clocks
108108

109109
required:
110+
- compatible
111+
- reg
110112
- clocks
111113
- clock-names
112-
- interrupts-extended
114+
- interrupts
113115
- interrupt-names
114116

115117
additionalProperties: false
@@ -140,13 +142,4 @@ examples:
140142
assigned-clock-parents = <&k3_clks 118 11>;
141143
};
142144
};
143-
- |
144145
145-
cpts {
146-
clocks = <&k3_clks 18 2>;
147-
clock-names = "cpts";
148-
interrupts-extended = <&gic500 GIC_SPI 858 IRQ_TYPE_LEVEL_HIGH>;
149-
interrupt-names = "cpts";
150-
ti,cpts-ext-ts-inputs = <4>;
151-
ti,cpts-periodic-outputs = <2>;
152-
};

‎arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@
248248
bus_freq = <1000000>;
249249
};
250250

251-
cpts {
251+
cpts@3d000 {
252+
compatible = "ti,am65-cpts";
253+
reg = <0x0 0x3d000 0x0 0x400>;
252254
clocks = <&mcu_cpsw_cpts_mux>;
253255
clock-names = "cpts";
254256
interrupts-extended = <&gic500 GIC_SPI 570 IRQ_TYPE_LEVEL_HIGH>;

‎arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,9 @@
339339
bus_freq = <1000000>;
340340
};
341341

342-
cpts {
342+
cpts@3d000 {
343+
compatible = "ti,am65-cpts";
344+
reg = <0x0 0x3d000 0x0 0x400>;
343345
clocks = <&k3_clks 18 2>;
344346
clock-names = "cpts";
345347
interrupts-extended = <&gic500 GIC_SPI 858 IRQ_TYPE_LEVEL_HIGH>;

‎drivers/net/ethernet/ti/am65-cpsw-nuss.c‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,10 +2031,21 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
20312031
return ret;
20322032
}
20332033

2034-
ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
2035-
/* We do not want to force this, as in some cases may not have child */
2036-
if (ret)
2037-
dev_warn(dev, "populating child nodes err:%d\n", ret);
2034+
node = of_get_child_by_name(dev->of_node, "mdio");
2035+
if (!node) {
2036+
dev_warn(dev, "MDIO node not found\n");
2037+
} else if (of_device_is_available(node)) {
2038+
struct platform_device *mdio_pdev;
2039+
2040+
mdio_pdev = of_platform_device_create(node, NULL, dev);
2041+
if (!mdio_pdev) {
2042+
ret = -ENODEV;
2043+
goto err_pm_clear;
2044+
}
2045+
2046+
common->mdio_dev = &mdio_pdev->dev;
2047+
}
2048+
of_node_put(node);
20382049

20392050
am65_cpsw_nuss_get_ver(common);
20402051

@@ -2090,7 +2101,8 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
20902101
return 0;
20912102

20922103
err_of_clear:
2093-
of_platform_depopulate(dev);
2104+
of_platform_device_destroy(common->mdio_dev, NULL);
2105+
err_pm_clear:
20942106
pm_runtime_put_sync(dev);
20952107
pm_runtime_disable(dev);
20962108
return ret;
@@ -2115,7 +2127,7 @@ static int am65_cpsw_nuss_remove(struct platform_device *pdev)
21152127
*/
21162128
am65_cpsw_nuss_cleanup_ndev(common);
21172129

2118-
of_platform_depopulate(dev);
2130+
of_platform_device_destroy(common->mdio_dev, NULL);
21192131

21202132
pm_runtime_put_sync(&pdev->dev);
21212133
pm_runtime_disable(&pdev->dev);

‎drivers/net/ethernet/ti/am65-cpsw-nuss.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/kernel.h>
1010
#include <linux/module.h>
1111
#include <linux/netdevice.h>
12+
#include <linux/platform_device.h>
1213

1314
struct am65_cpts;
1415

@@ -76,6 +77,7 @@ struct am65_cpsw_pdata {
7677

7778
struct am65_cpsw_common {
7879
struct device *dev;
80+
struct device *mdio_dev;
7981
const struct am65_cpsw_pdata *pdata;
8082

8183
void __iomem *ss_base;

0 commit comments

Comments
 (0)