Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm USBMODE register's initialization should be don...
details: https://anonhg.NetBSD.org/src/rev/5cbe4cd0eb71
branches: trunk
changeset: 340514:5cbe4cd0eb71
user: hkenken <hkenken%NetBSD.org@localhost>
date: Thu Sep 10 04:00:32 2015 +0000
description:
USBMODE register's initialization should be done in sc_vendor_init() after sending EHCI_CMD_HCRESET command.
diffstat:
sys/arch/arm/imx/imxusb.c | 24 ++++++++++--------------
sys/arch/arm/imx/imxusbvar.h | 2 --
sys/arch/arm/zynq/zynq_usb.c | 23 +++++++++++------------
sys/arch/arm/zynq/zynq_usbvar.h | 5 +----
4 files changed, 22 insertions(+), 32 deletions(-)
diffs (213 lines):
diff -r 230cb1502f4e -r 5cbe4cd0eb71 sys/arch/arm/imx/imxusb.c
--- a/sys/arch/arm/imx/imxusb.c Wed Sep 09 20:05:57 2015 +0000
+++ b/sys/arch/arm/imx/imxusb.c Thu Sep 10 04:00:32 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: imxusb.c,v 1.8 2015/09/04 07:34:32 skrll Exp $ */
+/* $NetBSD: imxusb.c,v 1.9 2015/09/10 04:00:32 hkenken Exp $ */
/*
* Copyright (c) 2009, 2010 Genetec Corporation. All rights reserved.
* Written by Hashimoto Kenichi and Hiroyuki Bessho for Genetec Corporation.
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imxusb.c,v 1.8 2015/09/04 07:34:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxusb.c,v 1.9 2015/09/10 04:00:32 hkenken Exp $");
#include "opt_imx.h"
@@ -61,7 +61,8 @@
void imxusb_ulpi_write(struct imxehci_softc *sc, int addr, uint8_t data);
static void ulpi_reset(struct imxehci_softc *sc);
-
+static void imxehci_select_interface(struct imxehci_softc *, enum imx_usb_if);
+static void imxehci_init(struct ehci_softc *);
/* attach structures */
CFATTACH_DECL_NEW(imxehci, sizeof(struct imxehci_softc),
@@ -98,6 +99,7 @@
sc->sc_usbc = usbc;
hsc->sc_bus.hci_private = sc;
hsc->sc_flags |= EHCIF_ETTF;
+ hsc->sc_vendor_init = imxehci_init;
aprint_naive("\n");
aprint_normal(": i.MX USB Controller\n");
@@ -153,7 +155,6 @@
/* Platform dependent setup */
if (usbc->sc_init_md_hook)
usbc->sc_init_md_hook(sc);
-
imxehci_reset(sc);
imxehci_select_interface(sc, sc->sc_iftype);
@@ -172,8 +173,6 @@
}
- imxehci_host_mode(sc);
-
if (usbc->sc_setup_md_hook)
usbc->sc_setup_md_hook(sc, IMXUSB_HOST);
@@ -214,10 +213,7 @@
hsc->sc_child = config_found(self, &hsc->sc_bus, usbctlprint);
}
-
-
-
-void
+static void
imxehci_select_interface(struct imxehci_softc *sc, enum imx_usb_if interface)
{
uint32_t reg;
@@ -244,7 +240,6 @@
EOWRITE4(hsc, EHCI_PORTSC(1), reg);
}
-
static uint32_t
ulpi_wakeup(struct imxehci_softc *sc, int tout)
{
@@ -407,10 +402,10 @@
usb_delay_ms(&hsc->sc_bus, 100);
}
-void
-imxehci_host_mode(struct imxehci_softc *sc)
+static void
+imxehci_init(struct ehci_softc *hsc)
{
- struct ehci_softc *hsc = &sc->sc_hsc;
+ struct imxehci_softc *sc = device_private(hsc->sc_dev);
uint32_t reg;
reg = EOREAD4(hsc, EHCI_PORTSC(1));
@@ -426,6 +421,7 @@
bus_space_write_4(sc->sc_iot, sc->sc_ioh, IMXUSB_OTGSC, reg);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, IMXUSB_USBMODE);
+ reg &= ~USBMODE_CM;
reg |= USBMODE_CM_HOST;
bus_space_write_4(sc->sc_iot, sc->sc_ioh, IMXUSB_USBMODE, reg);
}
diff -r 230cb1502f4e -r 5cbe4cd0eb71 sys/arch/arm/imx/imxusbvar.h
--- a/sys/arch/arm/imx/imxusbvar.h Wed Sep 09 20:05:57 2015 +0000
+++ b/sys/arch/arm/imx/imxusbvar.h Thu Sep 10 04:00:32 2015 +0000
@@ -45,8 +45,6 @@
};
int imxusbc_attach_common(device_t, device_t, bus_space_tag_t);
-void imxehci_select_interface(struct imxehci_softc *, enum imx_usb_if);
-void imxehci_host_mode(struct imxehci_softc *);
void imxehci_reset(struct imxehci_softc *);
#endif /* _ARM_IMX_IMXUSBVAR_H */
diff -r 230cb1502f4e -r 5cbe4cd0eb71 sys/arch/arm/zynq/zynq_usb.c
--- a/sys/arch/arm/zynq/zynq_usb.c Wed Sep 09 20:05:57 2015 +0000
+++ b/sys/arch/arm/zynq/zynq_usb.c Thu Sep 10 04:00:32 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: zynq_usb.c,v 1.2 2015/09/04 07:38:05 skrll Exp $ */
+/* $NetBSD: zynq_usb.c,v 1.3 2015/09/10 04:00:32 hkenken Exp $ */
/*-
* Copyright (c) 2015 Genetec Corporation. All rights reserved.
* Written by Hashimoto Kenichi for Genetec Corporation.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zynq_usb.c,v 1.2 2015/09/04 07:38:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zynq_usb.c,v 1.3 2015/09/10 04:00:32 hkenken Exp $");
#include "opt_zynq.h"
@@ -56,6 +56,9 @@
static void ulpi_write(struct zynqehci_softc *sc, int addr, uint8_t data);
static void ulpi_reset(struct zynqehci_softc *sc);
+static void zynqusb_select_interface(struct zynqehci_softc *, enum zynq_usb_if);
+static void zynqusb_init(struct ehci_softc *);
+
/* attach structures */
CFATTACH_DECL_NEW(zynqusb, sizeof(struct zynqehci_softc),
zynqusb_match, zynqusb_attach, NULL, NULL);
@@ -80,6 +83,7 @@
hsc->sc_bus.hci_private = sc;
hsc->sc_bus.usbrev = USBREV_2_0;
hsc->sc_flags |= EHCIF_ETTF;
+ hsc->sc_vendor_init = zynqusb_init;
aprint_normal("\n");
@@ -149,8 +153,6 @@
ulpi_reset(sc);
}
- zynqusb_host_mode(sc);
-
if (sc->sc_iftype == ZYNQUSBC_IF_ULPI) {
if(hsc->sc_bus.usbrev == USBREV_2_0) {
ulpi_write(sc, ULPI_FUNCTION_CONTROL + ULPI_REG_CLEAR,
@@ -189,10 +191,7 @@
hsc->sc_child = config_found(self, &hsc->sc_bus, usbctlprint);
}
-
-
-
-void
+static void
zynqusb_select_interface(struct zynqehci_softc *sc, enum zynq_usb_if interface)
{
uint32_t reg;
@@ -219,7 +218,6 @@
EOWRITE4(hsc, EHCI_PORTSC(1), reg);
}
-
static uint32_t
ulpi_wakeup(struct zynqehci_softc *sc, int tout)
{
@@ -356,10 +354,10 @@
usb_delay_ms(&hsc->sc_bus, 100);
}
-void
-zynqusb_host_mode(struct zynqehci_softc *sc)
+static void
+zynqusb_init(struct ehci_softc *hsc)
{
- struct ehci_softc *hsc = &sc->sc_hsc;
+ struct zynqehci_softc *sc = device_private(hsc->sc_dev);
uint32_t reg;
reg = EOREAD4(hsc, EHCI_PORTSC(1));
@@ -373,6 +371,7 @@
bus_space_write_4(sc->sc_iot, sc->sc_ioh, ZYNQUSB_OTGSC, reg);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, ZYNQUSB_USBMODE);
+ reg &= ~USBMODE_CM;
reg |= USBMODE_CM_HOST;
bus_space_write_4(sc->sc_iot, sc->sc_ioh, ZYNQUSB_USBMODE, reg);
}
diff -r 230cb1502f4e -r 5cbe4cd0eb71 sys/arch/arm/zynq/zynq_usbvar.h
--- a/sys/arch/arm/zynq/zynq_usbvar.h Wed Sep 09 20:05:57 2015 +0000
+++ b/sys/arch/arm/zynq/zynq_usbvar.h Thu Sep 10 04:00:32 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: zynq_usbvar.h,v 1.1 2015/01/23 12:34:09 hkenken Exp $ */
+/* $NetBSD: zynq_usbvar.h,v 1.2 2015/09/10 04:00:32 hkenken Exp $ */
/*-
* Copyright (c) 2015 Genetec Corporation. All rights reserved.
* Written by Hashimoto Kenichi for Genetec Corporation.
@@ -63,9 +63,6 @@
*/
int zynqusb_match(device_t, cfdata_t, void *);
void zynqusb_attach(device_t, device_t, void *);
-
-void zynqusb_select_interface(struct zynqehci_softc *, enum zynq_usb_if);
-void zynqusb_host_mode(struct zynqehci_softc *);
void zynqusb_reset(struct zynqehci_softc *);
#endif /* _ARM_ZYNQ_ZYNQ_USBVAR_H */
Home |
Main Index |
Thread Index |
Old Index