Date: Sat, 5 Oct 2019 17:36:33 +0000 (UTC) From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353125 - head/sys/arm64/rockchip Message-ID: <201910051736.x95HaXgr068480@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910051736.x95HaXgr068480>