Skip to content

Commit

Permalink
realtek: phy: add serdes driver
Browse files Browse the repository at this point in the history
Until now we miy a lot of things in the normal net/phy driver.
The SerDes stuff does not belong there. Looking around we can
take a lot of ideas from the ocelot/felix drivers and provide
a nice implementation for the realtek target.

Add the driver and enable it in the readonly mode for the
RTL838x, RTL839x, RTL930x targets.

WHat can we do later with this:

1. Inject patch commands through the devicetree.

2. Lookup the SerDes thorugh the net/phy driver to control
the SerDes at appropriate events (e.g. mac_config()).

Signed-off-by: Markus Stockhausen <[email protected]>
  • Loading branch information
plappermaul committed Oct 2, 2024
1 parent d03f3dc commit 654ea4c
Show file tree
Hide file tree
Showing 10 changed files with 1,167 additions and 2 deletions.
18 changes: 18 additions & 0 deletions target/linux/realtek/dts/rtl838x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
phy-mode = #m ; \
};

#define SWITCH_PORT_SDS(n, s, m, sds1, sds2) \
port@##n { \
reg = <##n>; \
label = SWITCH_PORT_LABEL(s) ; \
phy-handle = <&phy##n>; \
phy-mode = #m ; \
phys = <&serdes0 sds1 sds2>; \
};

#define SWITCH_SFP_PORT(n, s, m) \
port##n: port@##n { \
reg = <##n>; \
Expand Down Expand Up @@ -276,6 +285,15 @@
};
};

serdes0: serdes@1b00e780 {
compatible = "realtek,rtl8380-serdes", "realtek,otto-serdes";
reg = <0x1b00e780 0x1200>;
port-count = <6>;
page-count = <4>;
controlled-ports = <0x0000>;
#phy-cells = <2>;
};

sram0: sram@9f000000 {
compatible = "mmio-sram";
reg = <0x9f000000 0x10000>;
Expand Down
22 changes: 20 additions & 2 deletions target/linux/realtek/dts/rtl839x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
phy-mode = #m ; \
};

#define SWITCH_PORT_SDS(n, s, m, sds1, sds2) \
port@##n { \
reg = <##n>; \
label = SWITCH_PORT_LABEL(s) ; \
phy-handle = <&phy##n>; \
phy-mode = #m ; \
phys = <&serdes0 sds1 sds2>; \
};

#define SWITCH_SFP_PORT(n, s, m) \
port@##n { \
reg = <##n>; \
Expand Down Expand Up @@ -292,9 +301,9 @@
};
};

ethernet0: ethernet@1b00a300 {
ethernet0: ethernet@1b00780c {
compatible = "realtek,rtl838x-eth";
reg = <0x1b00a300 0x100>;
reg = <0x1b00780c 0x74>;

interrupt-parent = <&intc>;
interrupts = <24 3>;
Expand All @@ -307,6 +316,15 @@
};
};

serdes0: serdes@1b00a000 {
compatible = "realtek,rtl8390-serdes", "realtek,otto-serdes";
reg = <0x1b00a000 0x1c00>;
port-count = <14>;
page-count = <12>;
controlled-ports = <0x0000>;
#phy-cells = <2>;
};

sram0: sram@9f000000 {
compatible = "mmio-sram";
reg = <0x9f000000 0x18000>;
Expand Down
10 changes: 10 additions & 0 deletions target/linux/realtek/dts/rtl930x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@
};
};

serdes0: serdes@1b0003b0 {
compatible = "realtek,rtl9300-serdes", "realtek,otto-serdes";
reg = <0x1b0003b0 0x8>;
port-count = <12>;
page-count = <64>;
controlled-ports = <0x0000>;
#phy-cells = <2>;
};


switch0: switch@1b000000 {
compatible = "realtek,rtl83xx-switch";
status = "okay";
Expand Down
Loading

0 comments on commit 654ea4c

Please sign in to comment.