Skip to content

Commit 3d25218

Browse files
aakoskinpaulburton
authored andcommitted
MIPS: OCTEON: program rx/tx-delay always from DT
Program rx/tx-delay always from DT. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org
1 parent 1836c2b commit 3d25218

File tree

6 files changed

+52
-52
lines changed

6 files changed

+52
-52
lines changed

arch/mips/boot/dts/cavium-octeon/octeon_3xxx.dts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@
180180
ethernet@0 {
181181
phy-handle = <&phy2>;
182182
cavium,alt-phy-handle = <&phy100>;
183+
rx-delay = <0>;
184+
tx-delay = <0>;
183185
fixed-link {
184186
speed = <1000>;
185187
full-duplex;
@@ -188,6 +190,8 @@
188190
ethernet@1 {
189191
phy-handle = <&phy3>;
190192
cavium,alt-phy-handle = <&phy101>;
193+
rx-delay = <0>;
194+
tx-delay = <0>;
191195
fixed-link {
192196
speed = <1000>;
193197
full-duplex;
@@ -196,6 +200,8 @@
196200
ethernet@2 {
197201
phy-handle = <&phy4>;
198202
cavium,alt-phy-handle = <&phy102>;
203+
rx-delay = <0>;
204+
tx-delay = <0>;
199205
};
200206
ethernet@3 {
201207
compatible = "cavium,octeon-3860-pip-port";

arch/mips/boot/dts/cavium-octeon/ubnt_e100.dts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,18 @@
3333
interface@0 {
3434
ethernet@0 {
3535
phy-handle = <&phy7>;
36+
rx-delay = <0>;
37+
tx-delay = <0x10>;
3638
};
3739
ethernet@1 {
3840
phy-handle = <&phy6>;
41+
rx-delay = <0>;
42+
tx-delay = <0x10>;
3943
};
4044
ethernet@2 {
4145
phy-handle = <&phy5>;
46+
rx-delay = <0>;
47+
tx-delay = <0x10>;
4248
};
4349
};
4450
};

arch/mips/cavium-octeon/executive/cvmx-helper-board.c

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -320,45 +320,6 @@ int __cvmx_helper_board_interface_probe(int interface, int supported_ports)
320320
return supported_ports;
321321
}
322322

323-
/**
324-
* Enable packet input/output from the hardware. This function is
325-
* called after by cvmx_helper_packet_hardware_enable() to
326-
* perform board specific initialization. For most boards
327-
* nothing is needed.
328-
*
329-
* @interface: Interface to enable
330-
*
331-
* Returns Zero on success, negative on failure
332-
*/
333-
int __cvmx_helper_board_hardware_enable(int interface)
334-
{
335-
if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CN3005_EVB_HS5) {
336-
if (interface == 0) {
337-
/* Different config for switch port */
338-
cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(1, interface), 0);
339-
cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(1, interface), 0);
340-
/*
341-
* Boards with gigabit WAN ports need a
342-
* different setting that is compatible with
343-
* 100 Mbit settings
344-
*/
345-
cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(0, interface),
346-
0xc);
347-
cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(0, interface),
348-
0xc);
349-
}
350-
} else if (cvmx_sysinfo_get()->board_type ==
351-
CVMX_BOARD_TYPE_UBNT_E100) {
352-
cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(0, interface), 0);
353-
cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(0, interface), 0x10);
354-
cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(1, interface), 0);
355-
cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(1, interface), 0x10);
356-
cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(2, interface), 0);
357-
cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(2, interface), 0x10);
358-
}
359-
return 0;
360-
}
361-
362323
/**
363324
* Get the clock type used for the USB block based on board type.
364325
* Used by the USB code for auto configuration of clock type.

arch/mips/cavium-octeon/executive/cvmx-helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,6 @@ static int __cvmx_helper_packet_hardware_enable(int interface)
762762
result = __cvmx_helper_loop_enable(interface);
763763
break;
764764
}
765-
result |= __cvmx_helper_board_hardware_enable(interface);
766765
return result;
767766
}
768767

arch/mips/cavium-octeon/octeon-platform.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,45 @@ static void __init octeon_fdt_rm_ethernet(int node)
603603
fdt_nop_node(initial_boot_params, node);
604604
}
605605

606+
static void __init _octeon_rx_tx_delay(int eth, int rx_delay, int tx_delay)
607+
{
608+
fdt_setprop_inplace_cell(initial_boot_params, eth, "rx-delay",
609+
rx_delay);
610+
fdt_setprop_inplace_cell(initial_boot_params, eth, "tx-delay",
611+
tx_delay);
612+
}
613+
614+
static void __init octeon_rx_tx_delay(int eth, int iface, int port)
615+
{
616+
switch (cvmx_sysinfo_get()->board_type) {
617+
case CVMX_BOARD_TYPE_CN3005_EVB_HS5:
618+
if (iface == 0) {
619+
if (port == 0) {
620+
/*
621+
* Boards with gigabit WAN ports need a
622+
* different setting that is compatible with
623+
* 100 Mbit settings
624+
*/
625+
_octeon_rx_tx_delay(eth, 0xc, 0x0c);
626+
return;
627+
} else if (port == 1) {
628+
/* Different config for switch port. */
629+
_octeon_rx_tx_delay(eth, 0x0, 0x0);
630+
return;
631+
}
632+
}
633+
break;
634+
case CVMX_BOARD_TYPE_UBNT_E100:
635+
if (iface == 0 && port <= 2) {
636+
_octeon_rx_tx_delay(eth, 0x0, 0x10);
637+
return;
638+
}
639+
break;
640+
}
641+
fdt_nop_property(initial_boot_params, eth, "rx-delay");
642+
fdt_nop_property(initial_boot_params, eth, "tx-delay");
643+
}
644+
606645
static void __init octeon_fdt_pip_port(int iface, int i, int p, int max)
607646
{
608647
char name_buffer[20];
@@ -633,6 +672,7 @@ static void __init octeon_fdt_pip_port(int iface, int i, int p, int max)
633672
WARN_ON(octeon_has_fixed_link(ipd_port));
634673
else if (!octeon_has_fixed_link(ipd_port))
635674
fdt_nop_node(initial_boot_params, fixed_link);
675+
octeon_rx_tx_delay(eth, i, p);
636676
}
637677

638678
static void __init octeon_fdt_pip_iface(int pip, int idx)

arch/mips/include/asm/octeon/cvmx-helper-board.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,6 @@ extern cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port);
119119
extern int __cvmx_helper_board_interface_probe(int interface,
120120
int supported_ports);
121121

122-
/**
123-
* Enable packet input/output from the hardware. This function is
124-
* called after by cvmx_helper_packet_hardware_enable() to
125-
* perform board specific initialization. For most boards
126-
* nothing is needed.
127-
*
128-
* @interface: Interface to enable
129-
*
130-
* Returns Zero on success, negative on failure
131-
*/
132-
extern int __cvmx_helper_board_hardware_enable(int interface);
133-
134122
enum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(void);
135123

136124
#endif /* __CVMX_HELPER_BOARD_H__ */

0 commit comments

Comments
 (0)