Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Nov 2016 20:14:55 +0900 (JST)
From:      Mori Hiroki <yamori813@yahoo.co.jp>
To:        "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>
Subject:   ukswitch non 0 start phy patch
Message-ID:  <472260.68795.qm@web101710.mail.ssk.yahoo.co.jp>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Hi.

This is ukswitch patch for non 0 start phy register.
I check this patch at KENDIN KS8995XA. This switch chip
phy register address is start at 1.

hint.ukswitch.0.at="mdio0"
hint.ukswitch.0.numports=5
hint.ukswitch.0.phymask=0x1f
hint.ukswitch.0.phyoffset=1

My target is only MDIO connection for SOC. Not connect SPI
interface. I have other module at KS8995MA. I will try to 
manage this module on etherswitch framework by SPI.

Regards

Hiroki Mori

[-- Attachment #2 --]
diff --git a/sys/dev/etherswitch/ukswitch/ukswitch.c b/sys/dev/etherswitch/ukswitch/ukswitch.c
index 876aa9d..5d8c95e 100644
--- a/sys/dev/etherswitch/ukswitch/ukswitch.c
+++ b/sys/dev/etherswitch/ukswitch/ukswitch.c
@@ -67,6 +67,7 @@ struct ukswitch_softc {
 	int		media;		/* cpu port media */
 	int		cpuport;	/* which PHY is connected to the CPU */
 	int		phymask;	/* PHYs we manage */
+	int		phyoffset;	/* PHYs register offset */
 	int		numports;	/* number of ports */
 	int		ifpport[MII_NPHY];
 	int		*portphy;
@@ -133,7 +134,7 @@ ukswitch_attach_phys(struct ukswitch_softc *sc)
 		    M_WAITOK | M_ZERO);
 		err = mii_attach(sc->sc_dev, sc->miibus[port], sc->ifp[port],
 		    ukswitch_ifmedia_upd, ukswitch_ifmedia_sts, \
-		    BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
+		    BMSR_DEFCAPMASK, phy + sc->phyoffset, MII_OFFSET_ANY, 0);
 		DPRINTF(sc->sc_dev, "%s attached to pseudo interface %s\n",
 		    device_get_nameunit(*sc->miibus[port]),
 		    sc->ifp[port]->if_xname);
@@ -166,6 +167,7 @@ ukswitch_attach(device_t dev)
 	/* XXX Defaults */
 	sc->numports = 6;
 	sc->phymask = 0x0f;
+	sc->phyoffset = 0;
 	sc->cpuport = -1;
 	sc->media = 100;
 
@@ -174,6 +176,8 @@ ukswitch_attach(device_t dev)
 	(void) resource_int_value(device_get_name(dev), device_get_unit(dev),
 	    "phymask", &sc->phymask);
 	(void) resource_int_value(device_get_name(dev), device_get_unit(dev),
+	    "phyoffset", &sc->phyoffset);
+	(void) resource_int_value(device_get_name(dev), device_get_unit(dev),
 	    "cpuport", &sc->cpuport);
 	(void) resource_int_value(device_get_name(dev), device_get_unit(dev),
 	    "media", &sc->media);
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?472260.68795.qm>