Skip to content

Commit 565485b

Browse files
aakoskinpaulburton
authored andcommitted
MIPS: OCTEON: add fixed-link nodes to in-kernel device tree
Currently OCTEON ethernet falls back to phyless operation on boards where we have no known PHY address or a fixed-link node. Add fixed-link support for boards that need it, so we can clean up the platform code and ethernet driver from some legacy code. 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 3315b6b commit 565485b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,18 @@
180180
ethernet@0 {
181181
phy-handle = <&phy2>;
182182
cavium,alt-phy-handle = <&phy100>;
183+
fixed-link {
184+
speed = <1000>;
185+
full-duplex;
186+
};
183187
};
184188
ethernet@1 {
185189
phy-handle = <&phy3>;
186190
cavium,alt-phy-handle = <&phy101>;
191+
fixed-link {
192+
speed = <1000>;
193+
full-duplex;
194+
};
187195
};
188196
ethernet@2 {
189197
phy-handle = <&phy4>;

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,23 @@ static bool __init octeon_has_88e1145(void)
458458
!OCTEON_IS_MODEL(OCTEON_CN56XX);
459459
}
460460

461+
static bool __init octeon_has_fixed_link(int ipd_port)
462+
{
463+
switch (cvmx_sysinfo_get()->board_type) {
464+
case CVMX_BOARD_TYPE_CN3005_EVB_HS5:
465+
case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
466+
case CVMX_BOARD_TYPE_CN3020_EVB_HS5:
467+
case CVMX_BOARD_TYPE_CUST_NB5:
468+
case CVMX_BOARD_TYPE_EBH3100:
469+
/* Port 1 on these boards is always gigabit. */
470+
return ipd_port == 1;
471+
case CVMX_BOARD_TYPE_BBGW_REF:
472+
/* Ports 0 and 1 connect to the switch. */
473+
return ipd_port == 0 || ipd_port == 1;
474+
}
475+
return false;
476+
}
477+
461478
static void __init octeon_fdt_set_phy(int eth, int phy_addr)
462479
{
463480
const __be32 *phy_handle;
@@ -592,6 +609,7 @@ static void __init octeon_fdt_pip_port(int iface, int i, int p, int max)
592609
int eth;
593610
int phy_addr;
594611
int ipd_port;
612+
int fixed_link;
595613

596614
snprintf(name_buffer, sizeof(name_buffer), "ethernet@%x", p);
597615
eth = fdt_subnode_offset(initial_boot_params, iface, name_buffer);
@@ -609,6 +627,12 @@ static void __init octeon_fdt_pip_port(int iface, int i, int p, int max)
609627

610628
phy_addr = cvmx_helper_board_get_mii_address(ipd_port);
611629
octeon_fdt_set_phy(eth, phy_addr);
630+
631+
fixed_link = fdt_subnode_offset(initial_boot_params, eth, "fixed-link");
632+
if (fixed_link < 0)
633+
WARN_ON(octeon_has_fixed_link(ipd_port));
634+
else if (!octeon_has_fixed_link(ipd_port))
635+
fdt_nop_node(initial_boot_params, fixed_link);
612636
}
613637

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

0 commit comments

Comments
 (0)