Module Name: src Committed By: cliff Date: Fri Jan 29 00:24:33 UTC 2010
Modified Files: src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_usbi.c Log Message: - use rmixl_probe_4 to match - fail attach if USB interface is disabled GPIO LOW_PWR_DIS reg (?) - fail attach if USB interface BIST failed (?) - enable HW byteswap enable if LITTLE_ENDIAN To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_usbi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/rmi/rmixl_usbi.c diff -u src/sys/arch/mips/rmi/rmixl_usbi.c:1.1.2.2 src/sys/arch/mips/rmi/rmixl_usbi.c:1.1.2.3 --- src/sys/arch/mips/rmi/rmixl_usbi.c:1.1.2.2 Sun Jan 10 02:48:47 2010 +++ src/sys/arch/mips/rmi/rmixl_usbi.c Fri Jan 29 00:24:33 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: rmixl_usbi.c,v 1.1.2.2 2010/01/10 02:48:47 matt Exp $ */ +/* $NetBSD: rmixl_usbi.c,v 1.1.2.3 2010/01/29 00:24:33 cliff Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rmixl_usbi.c,v 1.1.2.2 2010/01/10 02:48:47 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rmixl_usbi.c,v 1.1.2.3 2010/01/29 00:24:33 cliff Exp $"); #include "locators.h" @@ -107,7 +107,7 @@ struct obio_attach_args *obio = aux; if (obio->obio_addr == RMIXL_IO_DEV_USB_B) - return 1; + return rmixl_probe_4((volatile uint32_t *)RMIXL_IOREG_VADDR(obio->obio_addr)); return 0; } @@ -117,6 +117,7 @@ { rmixl_usbi_softc_t *sc = device_private(self); struct obio_attach_args *obio = aux; + uint32_t r; void *ih; #ifdef RMIXL_USBI_DEBUG @@ -129,6 +130,39 @@ sc->sc_size = obio->obio_size; sc->sc_dmat = obio->obio_32bit_dmat; + aprint_normal("\n%s", device_xname(self)); + + /* + * fail attach if USB interface is disabled GPIO LOW_PWR_DIS reg + */ + r = RMIXL_IOREG_READ(RMIXL_IO_DEV_GPIO + RMIXL_GPIO_LOW_PWR_DIS); + if ((r & RMIXL_GPIO_LOW_PWR_DIS_USB) != 0) { + aprint_error(": USB_DIS set in LOW_PWR_DIS, abort attach\n"); + return; + } + + /* + * fail attach if USB interface BIST failed + */ + r = RMIXL_IOREG_READ(RMIXL_IO_DEV_GPIO + RMIXL_GPIO_BIST_EACH_STS); + aprint_normal(": BIST status="); + if ((r & __BIT(18)) == 0) { /* XXX USB_BIST */ + aprint_normal("FAIL\n"); + return; + } + aprint_normal("OK"); + + /* + * set BYTESWAP_EN register nonzero when software is little endian + */ +#if BYTE_ORDER == BIG_ENDIAN + r = 0; +#else + r = 1; +#endif + RMIXL_USBI_GEN_WRITE(RMIXL_USB_BYTESWAP_EN, r); + aprint_normal(" byteswap enable=%d", r); + for (int intr=0; intr <= RMIXL_UB_INTERRUPT_MAX; intr++) { evcnt_attach_dynamic(&sc->sc_dispatch[intr].count, EVCNT_TYPE_INTR, NULL, "rmixl_usbi",