Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips/cavium/dev fetch properties in attach rather t...
details: https://anonhg.NetBSD.org/src/rev/925c7d718e99
branches: trunk
changeset: 1009480:925c7d718e99
user: mrg <mrg%NetBSD.org@localhost>
date: Fri Apr 24 09:29:26 2020 +0000
description:
fetch properties in attach rather than every re-init.
this avoids a rwlock while spinlock held problem likely introduced
with MII locking rework, as fetching a property takes an rwlock,
and prior to the rework, only kernel lock would have been held.
ok skrll@.
diffstat:
sys/arch/mips/cavium/dev/if_cnmac.c | 15 +++++++++++++--
sys/arch/mips/cavium/dev/octeon_gmx.c | 16 ++++------------
sys/arch/mips/cavium/dev/octeon_gmxvar.h | 5 ++++-
3 files changed, 21 insertions(+), 15 deletions(-)
diffs (103 lines):
diff -r 6a9fdf48d78a -r 925c7d718e99 sys/arch/mips/cavium/dev/if_cnmac.c
--- a/sys/arch/mips/cavium/dev/if_cnmac.c Fri Apr 24 07:50:24 2020 +0000
+++ b/sys/arch/mips/cavium/dev/if_cnmac.c Fri Apr 24 09:29:26 2020 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $ */
+/* $NetBSD: if_cnmac.c,v 1.18 2020/04/24 09:29:26 mrg Exp $ */
#include <sys/cdefs.h>
#if 0
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.18 2020/04/24 09:29:26 mrg Exp $");
#endif
#include "opt_octeon.h"
@@ -292,6 +292,8 @@
struct octeon_eth_softc *sc = device_private(self);
struct octeon_gmx_attach_args *ga = aux;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+ prop_dictionary_t dict;
+ prop_object_t clk;
uint8_t enaddr[ETHER_ADDR_LEN];
sc->sc_dev = self;
@@ -399,6 +401,15 @@
OCTEON_EVCNT_ATTACH_EVCNTS(sc, octeon_evcnt_entries,
device_xname(sc->sc_dev));
+
+ dict = device_properties(sc->sc_gmx->sc_dev);
+
+ clk = prop_dictionary_get(dict, "rgmii-tx");
+ KASSERT(clk != NULL);
+ sc->sc_gmx_port->sc_clk_tx_setting = prop_number_integer_value(clk);
+ clk = prop_dictionary_get(dict, "rgmii-rx");
+ KASSERT(clk != NULL);
+ sc->sc_gmx_port->sc_clk_rx_setting = prop_number_integer_value(clk);
}
/* ---- submodules */
diff -r 6a9fdf48d78a -r 925c7d718e99 sys/arch/mips/cavium/dev/octeon_gmx.c
--- a/sys/arch/mips/cavium/dev/octeon_gmx.c Fri Apr 24 07:50:24 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_gmx.c Fri Apr 24 09:29:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $ */
+/* $NetBSD: octeon_gmx.c,v 1.9 2020/04/24 09:29:26 mrg Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.9 2020/04/24 09:29:26 mrg Exp $");
#include "opt_octeon.h"
@@ -847,9 +847,6 @@
static int
octeon_gmx_rgmii_timing(struct octeon_gmx_port_softc *sc)
{
- prop_dictionary_t dict = device_properties(sc->sc_port_gmx->sc_dev);
- prop_object_t clk;
- int clk_tx_setting, clk_rx_setting;
uint64_t rx_frm_ctl;
/* RGMII TX Threshold Registers
@@ -887,14 +884,9 @@
/* RGMII TX Clock-Delay Registers
* Delay setting to place n TXC (RGMII transmit clock) delay line.
*/
- clk = prop_dictionary_get(dict, "rgmii-tx");
- KASSERT(clk != NULL);
- clk_tx_setting = prop_number_integer_value(clk);
- clk = prop_dictionary_get(dict, "rgmii-rx");
- KASSERT(clk != NULL);
- clk_rx_setting = prop_number_integer_value(clk);
- octeon_asx_clk_set(sc->sc_port_asx, clk_tx_setting, clk_rx_setting);
+ octeon_asx_clk_set(sc->sc_port_asx,
+ sc->sc_clk_tx_setting, sc->sc_clk_rx_setting);
return 0;
}
diff -r 6a9fdf48d78a -r 925c7d718e99 sys/arch/mips/cavium/dev/octeon_gmxvar.h
--- a/sys/arch/mips/cavium/dev/octeon_gmxvar.h Fri Apr 24 07:50:24 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_gmxvar.h Fri Apr 24 09:29:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_gmxvar.h,v 1.2 2018/04/19 21:50:06 christos Exp $ */
+/* $NetBSD: octeon_gmxvar.h,v 1.3 2020/04/24 09:29:26 mrg Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -69,6 +69,9 @@
struct octeon_ipd_softc *sc_ipd;
int sc_port_flowflags;
+ int sc_clk_tx_setting;
+ int sc_clk_rx_setting;
+
#if defined(OCTEON_DEBUG) || defined(OCTEON_ETH_DEBUG)
#if 0
/* XXX */
Home |
Main Index |
Thread Index |
Old Index