svn commit: r353125 - head/sys/arm64/rockchip

Emmanuel Vadot manu at FreeBSD.org
Sat Oct 5 17:36:34 UTC 2019


Author: manu
Date: Sat Oct  5 17:36:33 2019
New Revision: 353125
URL: https://svnweb.freebsd.org/changeset/base/353125

Log:
  arm64: rockchip: usb2phy: Add set/get mode
  
  We only support host mode so those functions are just added so
  we won't panic when generic-{e,o}hci will set the phy to host mode.
  
  MFC after:	1 month
  X-MFC-With:	r353062

Modified:
  head/sys/arm64/rockchip/rk_usb2phy.c

Modified: head/sys/arm64/rockchip/rk_usb2phy.c
==============================================================================
--- head/sys/arm64/rockchip/rk_usb2phy.c	Sat Oct  5 14:56:27 2019	(r353124)
+++ head/sys/arm64/rockchip/rk_usb2phy.c	Sat Oct  5 17:36:33 2019	(r353125)
@@ -87,12 +87,17 @@ struct rk_usb2phy_softc {
 	struct syscon		*grf;
 	regulator_t		phy_supply;
 	clk_t			clk;
+	int			mode;
 };
 
 /* Phy class and methods. */
 static int rk_usb2phy_enable(struct phynode *phynode, bool enable);
+static int rk_usb2phy_get_mode(struct phynode *phy, int *mode);
+static int rk_usb2phy_set_mode(struct phynode *phy, int mode);
 static phynode_method_t rk_usb2phy_phynode_methods[] = {
-	PHYNODEMETHOD(phynode_enable,	rk_usb2phy_enable),
+	PHYNODEMETHOD(phynode_enable,		rk_usb2phy_enable),
+	PHYNODEMETHOD(phynode_usb_get_mode,	rk_usb2phy_get_mode),
+	PHYNODEMETHOD(phynode_usb_set_mode,	rk_usb2phy_set_mode),
 
 	PHYNODEMETHOD_END
 };
@@ -136,6 +141,44 @@ rk_usb2phy_enable(struct phynode *phynode, bool enable
 	return (0);
 fail:
 	return (ENXIO);
+}
+
+static int
+rk_usb2phy_get_mode(struct phynode *phynode, int *mode)
+{
+	struct rk_usb2phy_softc *sc;
+	intptr_t phy;
+	device_t dev;
+
+	dev = phynode_get_device(phynode);
+	phy = phynode_get_id(phynode);
+	sc = device_get_softc(dev);
+
+	if (phy != RK3399_USBPHY_HOST)
+		return (ERANGE);
+
+	*mode = sc->mode;
+
+	return (0);
+}
+
+static int
+rk_usb2phy_set_mode(struct phynode *phynode, int mode)
+{
+	struct rk_usb2phy_softc *sc;
+	intptr_t phy;
+	device_t dev;
+
+	dev = phynode_get_device(phynode);
+	phy = phynode_get_id(phynode);
+	sc = device_get_softc(dev);
+
+	if (phy != RK3399_USBPHY_HOST)
+		return (ERANGE);
+
+	sc->mode = mode;
+
+	return (0);
 }
 
 /* Clock class and method */


More information about the svn-src-head mailing list