From 133fffba95deb138ac07db5579c57048a2473008 Mon Sep 17 00:00:00 2001 From: visa Date: Thu, 4 Feb 2021 16:16:10 +0000 Subject: [PATCH] Handle Netgear ProSecure UTM25 This makes the system recognize and configure Netgear ProSecure UTM25. Of the network ports, LAN1-4 and WAN1 are functional. WAN2 does not work for some reason. Even though WAN1 has a separate link to the SoC, the connection appears to go through the same switch that the LAN ports use. At the moment, the system relies on U-Boot to set up the switch so that the LAN and WAN segments stay separate. Initial diff and input from Thaison Nguyen, thank you! --- sys/arch/octeon/dev/cn30xxgmx.c | 11 ++++++++++- sys/arch/octeon/dev/cn30xxsmi.c | 11 ++++++++++- sys/arch/octeon/include/octeonvar.h | 3 ++- sys/arch/octeon/octeon/machdep.c | 5 ++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/sys/arch/octeon/dev/cn30xxgmx.c b/sys/arch/octeon/dev/cn30xxgmx.c index 803cb9c5cc5..f27b180e493 100644 --- a/sys/arch/octeon/dev/cn30xxgmx.c +++ b/sys/arch/octeon/dev/cn30xxgmx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxgmx.c,v 1.48 2021/01/30 14:59:13 visa Exp $ */ +/* $OpenBSD: cn30xxgmx.c,v 1.49 2021/02/04 16:16:10 visa Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -1339,6 +1339,15 @@ cn30xxgmx_rgmii_timing(struct cn30xxgmx_port_softc *sc) clk_tx_setting = 24; clk_rx_setting = 24; break; + case BOARD_NETGEAR_UTM25: + if (sc->sc_port_no == 0) { + clk_tx_setting = 9; + clk_rx_setting = 9; + } else { + clk_tx_setting = 24; + clk_rx_setting = 24; + } + break; case BOARD_UBIQUITI_E100: case BOARD_UBIQUITI_E120: clk_tx_setting = 16; diff --git a/sys/arch/octeon/dev/cn30xxsmi.c b/sys/arch/octeon/dev/cn30xxsmi.c index 9b475281518..0a44f6cc287 100644 --- a/sys/arch/octeon/dev/cn30xxsmi.c +++ b/sys/arch/octeon/dev/cn30xxsmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxsmi.c,v 1.8 2021/01/30 14:59:13 visa Exp $ */ +/* $OpenBSD: cn30xxsmi.c,v 1.9 2021/02/04 16:16:10 visa Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -155,6 +155,10 @@ cn30xxsmi_get_phy(int phandle, int port, struct cn30xxsmi_softc **psmi, static const int cam0100_phys[] = { 0x02, 0x03, 0x22 }; + /* PHY addresses for Netgear ProSecure UTM25 */ + static const int nutm25_phys[] = { + 0x00, 0x04, 0x09 + }; struct cn30xxsmi_softc *smi; int parent, phynode; @@ -180,6 +184,11 @@ cn30xxsmi_get_phy(int phandle, int port, struct cn30xxsmi_softc **psmi, return ENOENT; switch (octeon_board) { + case BOARD_NETGEAR_UTM25: + if (port >= nitems(nutm25_phys)) + return ENOENT; + reg = nutm25_phys[port]; + break; case BOARD_UBIQUITI_E100: case BOARD_UBIQUITI_E120: if (port > 2) diff --git a/sys/arch/octeon/include/octeonvar.h b/sys/arch/octeon/include/octeonvar.h index 1fb0063a9a2..a1e23746436 100644 --- a/sys/arch/octeon/include/octeonvar.h +++ b/sys/arch/octeon/include/octeonvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: octeonvar.h,v 1.50 2021/01/30 14:59:14 visa Exp $ */ +/* $OpenBSD: octeonvar.h,v 1.51 2021/02/04 16:16:11 visa Exp $ */ /* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */ /*- @@ -215,6 +215,7 @@ enum octeon_board { BOARD_UNKNOWN, BOARD_CN3010_EVB_HS5, BOARD_DLINK_DSR_500, + BOARD_NETGEAR_UTM25, BOARD_RHINOLABS_UTM8, BOARD_UBIQUITI_E100, BOARD_UBIQUITI_E120, diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index a92959b8789..a8618fdb9b1 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.128 2021/01/30 14:59:14 visa Exp $ */ +/* $OpenBSD: machdep.c,v 1.129 2021/02/04 16:16:11 visa Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -835,6 +835,9 @@ get_octeon_board(void) case 20003: return BOARD_UBIQUITI_E200; case 20004: + /* E120 has two cores, whereas UTM25 has one core. */ + if (ncpusfound == 1) + return BOARD_NETGEAR_UTM25; return BOARD_UBIQUITI_E120; case 20005: return BOARD_UBIQUITI_E220; -- 2.20.1