svn commit: r303778 - head/sys/mips/atheros
Adrian Chadd
adrian at FreeBSD.org
Fri Aug 5 17:16:36 UTC 2016
Author: adrian
Date: Fri Aug 5 17:16:35 2016
New Revision: 303778
URL: https://svnweb.freebsd.org/changeset/base/303778
Log:
[arge] add some extra MDIO debugging support
* add an ANY debug level which will always echo the message if debugging
is compiled in;
* log MDIO transaction timeouts if debugging is compiled in;
* the argemdio device is different to arge, so turning on MDIO debugging
flags in arge->sc_debug doesn't help. Add a debug sysctl to argemdio
as well so that MDIO transactions can be debugged.
Tested:
* AR9331
Modified:
head/sys/mips/atheros/if_arge.c
Modified: head/sys/mips/atheros/if_arge.c
==============================================================================
--- head/sys/mips/atheros/if_arge.c Fri Aug 5 17:14:45 2016 (r303777)
+++ head/sys/mips/atheros/if_arge.c Fri Aug 5 17:16:35 2016 (r303778)
@@ -108,6 +108,7 @@ typedef enum {
ARGE_DBG_ERR = 0x00000010,
ARGE_DBG_RESET = 0x00000020,
ARGE_DBG_PLL = 0x00000040,
+ ARGE_DBG_ANY = 0xffffffff,
} arge_debug_flags;
static const char * arge_miicfg_str[] = {
@@ -122,7 +123,7 @@ static const char * arge_miicfg_str[] =
#ifdef ARGE_DEBUG
#define ARGEDEBUG(_sc, _m, ...) \
do { \
- if ((_m) & (_sc)->arge_debug) \
+ if (((_m) & (_sc)->arge_debug) || ((_m) == ARGE_DBG_ANY)) \
device_printf((_sc)->arge_dev, __VA_ARGS__); \
} while (0)
#else
@@ -1123,7 +1124,7 @@ arge_miibus_readreg(device_t dev, int ph
if (arge_mdio_busy(sc) != 0) {
mtx_unlock(&miibus_mtx);
- ARGEDEBUG(sc, ARGE_DBG_MII, "%s timedout\n", __func__);
+ ARGEDEBUG(sc, ARGE_DBG_ANY, "%s timedout\n", __func__);
/* XXX: return ERRNO istead? */
return (-1);
}
@@ -1160,7 +1161,7 @@ arge_miibus_writereg(device_t dev, int p
if (arge_mdio_busy(sc) != 0) {
mtx_unlock(&miibus_mtx);
- ARGEDEBUG(sc, ARGE_DBG_MII, "%s timedout\n", __func__);
+ ARGEDEBUG(sc, ARGE_DBG_ANY, "%s timedout\n", __func__);
/* XXX: return ERRNO istead? */
return (-1);
}
@@ -2690,7 +2691,10 @@ argemdio_attach(device_t dev)
{
struct arge_softc *sc;
int error = 0;
-
+#ifdef ARGE_DEBUG
+ struct sysctl_ctx_list *ctx;
+ struct sysctl_oid *tree;
+#endif
sc = device_get_softc(dev);
sc->arge_dev = dev;
sc->arge_mac_unit = device_get_unit(dev);
@@ -2703,6 +2707,14 @@ argemdio_attach(device_t dev)
goto fail;
}
+#ifdef ARGE_DEBUG
+ ctx = device_get_sysctl_ctx(dev);
+ tree = device_get_sysctl_tree(dev);
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "debug", CTLFLAG_RW, &sc->arge_debug, 0,
+ "argemdio interface debugging flags");
+#endif
+
/* Reset MAC - required for AR71xx MDIO to successfully occur */
arge_reset_mac(sc);
/* Reset MII bus */
More information about the svn-src-head
mailing list