Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Feb 2019 21:04:41 +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: r344634 - in head/sys: arm64/conf conf dev/usb/controller
Message-ID:  <201902272104.x1RL4fiR025868@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Wed Feb 27 21:04:40 2019
New Revision: 344634
URL: https://svnweb.freebsd.org/changeset/base/344634

Log:
  xhci_mv: Move the driver to generic_xhci
  
  Marvell XHCI is in fact generic-xhci, so move the driver and
  add the compatible string.
  While here, get and enable the phy if the dtb provide one.
  The xhci bindings state that phys should be in a 'phys' property but
  Marvell DTS uses 'usb-phy', only add support for 'usb-phy' for now.
  
  Sponsored-by:      Rubicon Communications, LCC ("Netgate")

Added:
  head/sys/dev/usb/controller/generic_xhci.c
     - copied, changed from r344633, head/sys/dev/usb/controller/xhci_mv.c
Deleted:
  head/sys/dev/usb/controller/xhci_mv.c
Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm64/conf/GENERIC
==============================================================================
--- head/sys/arm64/conf/GENERIC	Wed Feb 27 20:52:35 2019	(r344633)
+++ head/sys/arm64/conf/GENERIC	Wed Feb 27 21:04:40 2019	(r344634)
@@ -196,7 +196,6 @@ device		ohci			# OHCI USB interface
 device		ehci			# EHCI USB interface (USB 2.0)
 device		ehci_mv			# Marvell EHCI USB interface
 device		xhci			# XHCI PCI->USB interface (USB 3.0)
-device		xhci_mv			# Marvell XHCI USB interface
 device		usb			# USB Bus (required)
 device		ukbd			# Keyboard
 device		umass			# Disks/Mass storage - Requires scbus and da

Modified: head/sys/conf/files.arm64
==============================================================================
--- head/sys/conf/files.arm64	Wed Feb 27 20:52:35 2019	(r344633)
+++ head/sys/conf/files.arm64	Wed Feb 27 21:04:40 2019	(r344634)
@@ -233,8 +233,8 @@ dev/usb/controller/ehci_mv.c	optional	ehci_mv fdt
 dev/usb/controller/generic_ehci.c optional	ehci acpi
 dev/usb/controller/generic_ohci.c optional	ohci fdt
 dev/usb/controller/generic_usb_if.m optional	ohci fdt
-dev/usb/controller/xhci_mv.c	optional	xhci_mv fdt
 dev/usb/controller/usb_nop_xceiv.c	optional fdt ext_resources
+dev/usb/controller/generic_xhci.c	optional	xhci fdt
 dev/vnic/mrml_bridge.c		optional	vnic fdt
 dev/vnic/nic_main.c		optional	vnic pci
 dev/vnic/nicvf_main.c		optional	vnic pci pci_iov

Copied and modified: head/sys/dev/usb/controller/generic_xhci.c (from r344633, head/sys/dev/usb/controller/xhci_mv.c)
==============================================================================
--- head/sys/dev/usb/controller/xhci_mv.c	Wed Feb 27 20:52:35 2019	(r344633, copy source)
+++ head/sys/dev/usb/controller/generic_xhci.c	Wed Feb 27 21:04:40 2019	(r344634)
@@ -64,6 +64,10 @@ __FBSDID("$FreeBSD$");
 #include <dev/usb/controller/xhci.h>
 #include <dev/usb/controller/xhcireg.h>
 
+#ifdef EXT_RESOURCES
+#include <dev/extres/phy/phy.h>
+#endif
+
 #define	XHCI_HC_DEVSTR	"Marvell Integrated USB 3.0 controller"
 #define	XHCI_HC_VENDOR	"Marvell"
 
@@ -76,6 +80,7 @@ static struct ofw_compat_data compat_data[] = {
 	{"marvell,armada-380-xhci",	true},
 	{"marvell,armada3700-xhci",	true},
 	{"marvell,armada-8k-xhci",	true},
+	{"generic-xhci",		true},
 	{NULL,				false}
 };
 
@@ -99,6 +104,10 @@ xhci_attach(device_t dev)
 {
 	struct xhci_softc *sc = device_get_softc(dev);
 	int err = 0, rid = 0;
+#ifdef EXT_RESOURCES
+	phandle_t node;
+	phy_t phy;
+#endif
 
 	sc->sc_bus.parent = dev;
 	sc->sc_bus.devices = sc->sc_devices;
@@ -123,6 +132,13 @@ xhci_attach(device_t dev)
 		xhci_detach(dev);
 		return (ENXIO);
 	}
+
+#ifdef EXT_RESOURCES
+	node = ofw_bus_get_node(dev);
+	if (phy_get_by_ofw_property(dev, node, "usb-phy", &phy) == 0)
+		if (phy_enable(phy) != 0)
+			device_printf(dev, "Cannot enable phy\n");
+#endif
 
 	sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
 	if (sc->sc_bus.bdev == NULL) {



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