CVS commit: [netbsd-6] src/sys/arch/arm/marvell
Module Name:src Committed By: bouyer Date: Sun Jan 13 19:03:06 UTC 2013 Modified Files: src/sys/arch/arm/marvell [netbsd-6]: files.marvell mvsoctmr.c Log Message: Pull up following revision(s) (requested by riz in ticket #770): sys/arch/arm/marvell/files.marvell: revision 1.5 sys/arch/arm/marvell/mvsoctmr.c: revision 1.4 sys/arch/arm/marvell/mvsoctmr.c: revision 1.5 sys/arch/arm/marvell/mvsoctmr.c: revision 1.6 sys/arch/arm/marvell/mvsoctmr.c: revision 1.7 Add support for the watchdog timer in mvsoctmr. Tested on DreamPlug system. When disabling watchdog timer, do not set the counter to 0. Having the watchdog counter at 0 and having WDRstOutEn set to 1 causes immediate watchdog reset on my 88F5182 A2. Remove duplicate global variable. The maximum watchdog period is dependant on mvTclk; calculate at runtime. This gets the maximum period up to 25 seconds at 166⅔MHz mvTclk. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/arch/arm/marvell/files.marvell cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/arch/arm/marvell/mvsoctmr.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/arm/marvell/files.marvell diff -u src/sys/arch/arm/marvell/files.marvell:1.4 src/sys/arch/arm/marvell/files.marvell:1.4.10.1 --- src/sys/arch/arm/marvell/files.marvell:1.4 Sat Mar 12 22:34:52 2011 +++ src/sys/arch/arm/marvell/files.marvell Sun Jan 13 19:03:05 2013 @@ -1,4 +1,4 @@ -# $NetBSD: files.marvell,v 1.4 2011/03/12 22:34:52 nonaka Exp $ +# $NetBSD: files.marvell,v 1.4.10.1 2013/01/13 19:03:05 bouyer Exp $ # # Configuration info for Marvell System on Chip support # @@ -24,7 +24,7 @@ file arch/arm/marvell/kirkwood.c kirkwo include "dev/marvell/files.discovery" # Timers -device mvsoctmr +device mvsoctmr: sysmon_wdog attach mvsoctmr at mvsoc file arch/arm/marvell/mvsoctmr.c mvsoctmr Index: src/sys/arch/arm/marvell/mvsoctmr.c diff -u src/sys/arch/arm/marvell/mvsoctmr.c:1.3 src/sys/arch/arm/marvell/mvsoctmr.c:1.3.2.1 --- src/sys/arch/arm/marvell/mvsoctmr.c:1.3 Sun Feb 12 16:34:07 2012 +++ src/sys/arch/arm/marvell/mvsoctmr.c Sun Jan 13 19:03:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsoctmr.c,v 1.3 2012/02/12 16:34:07 matt Exp $ */ +/* $NetBSD: mvsoctmr.c,v 1.3.2.1 2013/01/13 19:03:05 bouyer Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v 1.3 2012/02/12 16:34:07 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v 1.3.2.1 2013/01/13 19:03:05 bouyer Exp $"); + +#include "opt_ddb.h" #include #include @@ -36,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v #include #include #include +#include #include @@ -47,10 +50,21 @@ __KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v #include +#include + +#ifdef DDB +#include +#include +#endif + struct mvsoctmr_softc { device_t sc_dev; + struct sysmon_wdog sc_wdog; + uint32_t sc_wdog_period; + uint32_t sc_wdog_armed; + bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; @@ -65,6 +79,15 @@ static u_int mvsoctmr_get_timecount(stru static void mvsoctmr_cntl(struct mvsoctmr_softc *, int, u_int, int, int); +static int mvsoctmr_wdog_tickle(struct sysmon_wdog *); +static int mvsoctmr_wdog_setmode(struct sysmon_wdog *); + +#ifdef DDB +static void mvsoctmr_wdog_ddb_trap(int); +#endif + +#define MVSOC_WDOG_MAX_PERIOD (0x / mvTclk) + static struct mvsoctmr_softc *mvsoctmr_sc; static struct timecounter mvsoctmr_timecounter = { mvsoctmr_get_timecount, /* get_timecount */ @@ -102,6 +125,7 @@ mvsoctmr_attach(device_t parent, device_ { struct mvsoctmr_softc *sc = device_private(self); struct marvell_attach_args *mva = aux; + uint32_t rstoutn; aprint_naive("\n"); aprint_normal(": Marvell SoC Timer\n"); @@ -117,6 +141,28 @@ mvsoctmr_attach(device_t parent, device_ mvsoctmr_timecounter.tc_name = device_xname(self); mvsoctmr_cntl(sc, MVSOCTMR_TIMER1, 0x, 1, 1); + + /* + * stop watchdog timer, enable watchdog timer resets + */ + mvsoctmr_cntl(sc, MVSOCTMR_WATCHDOG, 0x, 0, 0); + rstoutn = read_mlmbreg(MVSOC_MLMB_RSTOUTNMASKR); + write_mlmbreg(MVSOC_MLMB_RSTOUTNMASKR, + rstoutn | MVSOC_MLMB_RSTOUTNMASKR_WDRSTOUTEN); + +#ifdef DDB + db_trap_callback = mvsoctmr_wdog_ddb_trap; +#endif + + sc->sc_wdog.smw_name = device_xname(self); + sc->sc_wdog.smw_cookie = sc; + sc->sc_wdog.smw_setmode = mvsoctmr_wdog_setmode; + sc->sc_wdog.smw_tickle = mvsoctmr_wdog_tickle; + sc->sc_wdog.smw_period = MVSOC_WDOG_MAX_PERIOD; + + if (sysmon_wdog_register(&sc->sc_wdog) != 0) + aprint_error_dev(self, + "unable to register watchdog with sysmon\n"); } /* @@ -257,3 +303,54 @@ mvsoctmr_cntl(struct mvsoctmr_softc *sc, ctrl &= ~MVSOCTMR_CTCR_CPUTIMERAUTO(num); bus_space_write_4(sc->sc_iot, sc->sc_i
CVS commit: [netbsd-6] src/sys/arch/arm/marvell
Module Name:src Committed By: riz Date: Sat Oct 20 22:31:05 UTC 2012 Modified Files: src/sys/arch/arm/marvell [netbsd-6]: kirkwood.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #609): sys/arch/arm/marvell/kirkwood.c: revision 1.5 Fix always check high. macro KIRKWOOD_IRQ_* means bit number. HIGH is bit0. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/arch/arm/marvell/kirkwood.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/arm/marvell/kirkwood.c diff -u src/sys/arch/arm/marvell/kirkwood.c:1.4 src/sys/arch/arm/marvell/kirkwood.c:1.4.10.1 --- src/sys/arch/arm/marvell/kirkwood.c:1.4 Tue May 24 17:45:49 2011 +++ src/sys/arch/arm/marvell/kirkwood.c Sat Oct 20 22:31:05 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: kirkwood.c,v 1.4 2011/05/24 17:45:49 matt Exp $ */ +/* $NetBSD: kirkwood.c,v 1.4.10.1 2012/10/20 22:31:05 riz Exp $ */ /* * Copyright (c) 2010 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kirkwood.c,v 1.4 2011/05/24 17:45:49 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kirkwood.c,v 1.4.10.1 2012/10/20 22:31:05 riz Exp $"); #define _INTR_PRIVATE @@ -188,7 +188,7 @@ kirkwood_find_pending_irqs(void) if (pendinglow != 0) ipl |= pic_mark_pending_sources(&kirkwood_pic, 0, pendinglow); - if ((causelow & KIRKWOOD_IRQ_HIGH) == KIRKWOOD_IRQ_HIGH) { + if ((causelow & (1 << KIRKWOOD_IRQ_HIGH)) == (1 << KIRKWOOD_IRQ_HIGH)) { uint32_t causehigh = read_mlmbreg(KIRKWOOD_MLMB_MICHR); uint32_t pendinghigh = read_mlmbreg(KIRKWOOD_MLMB_MIRQIMHR); pendinghigh &= causehigh;
CVS commit: [netbsd-6] src/sys/arch/arm/marvell
Module Name:src Committed By: riz Date: Tue Oct 23 16:27:16 UTC 2012 Modified Files: src/sys/arch/arm/marvell [netbsd-6]: kirkwood.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #620): sys/arch/arm/marvell/kirkwood.c: revision 1.7 Add missing ',' It will fix a bug that "vmstat -e" shows the incorrect counts in wrong entries. To generate a diff of this commit: cvs rdiff -u -r1.4.10.1 -r1.4.10.2 src/sys/arch/arm/marvell/kirkwood.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/arm/marvell/kirkwood.c diff -u src/sys/arch/arm/marvell/kirkwood.c:1.4.10.1 src/sys/arch/arm/marvell/kirkwood.c:1.4.10.2 --- src/sys/arch/arm/marvell/kirkwood.c:1.4.10.1 Sat Oct 20 22:31:05 2012 +++ src/sys/arch/arm/marvell/kirkwood.c Tue Oct 23 16:27:15 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: kirkwood.c,v 1.4.10.1 2012/10/20 22:31:05 riz Exp $ */ +/* $NetBSD: kirkwood.c,v 1.4.10.2 2012/10/23 16:27:15 riz Exp $ */ /* * Copyright (c) 2010 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kirkwood.c,v 1.4.10.1 2012/10/20 22:31:05 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kirkwood.c,v 1.4.10.2 2012/10/23 16:27:15 riz Exp $"); #define _INTR_PRIVATE @@ -64,15 +64,15 @@ static const char * const sources[64] = "GbE1Rx(16)", "GbE1Tx(17)", "GbE1Misc(18)","USB0Cnt(19)", "Reserved(20)","Sata(21)","SecurityInt(22)", "SPIInt(23)", "AudioINT(24)","Reserved(25)","TS0Int(26)", "Reserved(27)", -"SDIOInt(28)", "TWSI(29)","AVBInt(30)", "TDMInt(31)" +"SDIOInt(28)", "TWSI(29)","AVBInt(30)", "TDMInt(31)", -"Reserved(32)","Uart0Int(33)","Uart1Int(34)","GPIOLo7_0(35)" -"GPIOLo8_15(36)", "GPIOLo16_23(37)", "GPIOLo24_31(38)", "GPIOHi7_0(39)" -"GPIOHi8_15(40)", "GPIOHi16_23(41)", "XOR0Err(42)", "XOR1Err(43)" -"PEX0Err(44)", "Reserved(45)","GbE0Err(46)", "GbE1Err(47)" -"USBErr(48)", "SecurityErr(49)", "AudioErr(50)","Reserved(51)" -"Reserved(52)","RTCInt(53)", "Reserved(54)","Reserved(55)" -"Reserved(56)","Reserved(57)","Reserved(58)","Reserved(59)" +"Reserved(32)","Uart0Int(33)","Uart1Int(34)","GPIOLo7_0(35)", +"GPIOLo8_15(36)", "GPIOLo16_23(37)", "GPIOLo24_31(38)", "GPIOHi7_0(39)", +"GPIOHi8_15(40)", "GPIOHi16_23(41)", "XOR0Err(42)", "XOR1Err(43)", +"PEX0Err(44)", "Reserved(45)","GbE0Err(46)", "GbE1Err(47)", +"USBErr(48)", "SecurityErr(49)", "AudioErr(50)","Reserved(51)", +"Reserved(52)","RTCInt(53)", "Reserved(54)","Reserved(55)", +"Reserved(56)","Reserved(57)","Reserved(58)","Reserved(59)", "Reserved(60)","Reserved(61)","Reserved(62)","Reserved(63)" };
CVS commit: [netbsd-6] src/sys/arch/arm/marvell
Module Name:src Committed By: riz Date: Tue Oct 23 19:50:49 UTC 2012 Modified Files: src/sys/arch/arm/marvell [netbsd-6]: mvsocgpp.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #623): sys/arch/arm/marvell/mvsocgpp.c: revision 1.4 Fix a bug that the irq_masks of GPIO are set on Marvell SoCs. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.8.1 src/sys/arch/arm/marvell/mvsocgpp.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/arm/marvell/mvsocgpp.c diff -u src/sys/arch/arm/marvell/mvsocgpp.c:1.3 src/sys/arch/arm/marvell/mvsocgpp.c:1.3.8.1 --- src/sys/arch/arm/marvell/mvsocgpp.c:1.3 Sat Aug 13 15:38:47 2011 +++ src/sys/arch/arm/marvell/mvsocgpp.c Tue Oct 23 19:50:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsocgpp.c,v 1.3 2011/08/13 15:38:47 jakllsch Exp $ */ +/* $NetBSD: mvsocgpp.c,v 1.3.8.1 2012/10/23 19:50:49 riz Exp $ */ /* * Copyright (c) 2008, 2010 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsocgpp.c,v 1.3 2011/08/13 15:38:47 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsocgpp.c,v 1.3.8.1 2012/10/23 19:50:49 riz Exp $"); #include "gpio.h" @@ -71,6 +71,7 @@ struct mvsocgpp_softc { struct mvsocgpp_pic { struct pic_softc gpio_pic; int group; + int shift; uint32_t edge; uint32_t level; } *sc_pic; @@ -183,6 +184,7 @@ mvsocgpp_attach(device_t parent, device_ aprint_normal(", intr %d\n", mva->mva_irq + j); (sc->sc_pic + j)->group = j; + (sc->sc_pic + j)->shift = (j & 3) * 8; } #ifdef MVSOCGPP_DUMPREG @@ -244,6 +246,7 @@ gpio_pic_unblock_irqs(struct pic_softc * uint32_t mask; int pin = mvsocgpp_pic->group << 3; + irq_mask = irq_mask << mvsocgpp_pic->shift; MVSOCGPP_WRITE(sc, MVSOCGPP_GPIOIC(pin), MVSOCGPP_READ(sc, MVSOCGPP_GPIOIC(pin)) & ~irq_mask); if (irq_mask & mvsocgpp_pic->edge) { @@ -266,6 +269,7 @@ gpio_pic_block_irqs(struct pic_softc *pi struct mvsocgpp_pic *mvsocgpp_pic = (struct mvsocgpp_pic *)pic; int pin = mvsocgpp_pic->group << 3; + irq_mask = irq_mask << mvsocgpp_pic->shift; MVSOCGPP_WRITE(sc, MVSOCGPP_GPIOIM(pin), MVSOCGPP_READ(sc, MVSOCGPP_GPIOIM(pin)) & ~irq_mask); MVSOCGPP_WRITE(sc, MVSOCGPP_GPIOILM(pin), @@ -281,9 +285,10 @@ gpio_pic_find_pending_irqs(struct pic_so int pin = mvsocgpp_pic->group << 3; pending = MVSOCGPP_READ(sc, MVSOCGPP_GPIOIC(pin)); - pending &= (0xff << mvsocgpp_pic->group); + pending &= (0xff << mvsocgpp_pic->shift); pending &= (MVSOCGPP_READ(sc, MVSOCGPP_GPIOIM(pin)) | MVSOCGPP_READ(sc, MVSOCGPP_GPIOILM(pin))); + pending = pending >> mvsocgpp_pic->shift; if (pending == 0) return 0;
CVS commit: [netbsd-6] src/sys/arch/arm/marvell
Module Name:src Committed By: jdc Date: Sat Nov 24 20:53:13 UTC 2012 Modified Files: src/sys/arch/arm/marvell [netbsd-6]: mvsocgpp.c Log Message: Pull up revision 1.5 (requested by msaitoh in ticket #713). Fix a uvm_fault panic that memory is not allocated for the last few GPIO bits. To generate a diff of this commit: cvs rdiff -u -r1.3.8.1 -r1.3.8.2 src/sys/arch/arm/marvell/mvsocgpp.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/arm/marvell/mvsocgpp.c diff -u src/sys/arch/arm/marvell/mvsocgpp.c:1.3.8.1 src/sys/arch/arm/marvell/mvsocgpp.c:1.3.8.2 --- src/sys/arch/arm/marvell/mvsocgpp.c:1.3.8.1 Tue Oct 23 19:50:49 2012 +++ src/sys/arch/arm/marvell/mvsocgpp.c Sat Nov 24 20:53:13 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsocgpp.c,v 1.3.8.1 2012/10/23 19:50:49 riz Exp $ */ +/* $NetBSD: mvsocgpp.c,v 1.3.8.2 2012/11/24 20:53:13 jdc Exp $ */ /* * Copyright (c) 2008, 2010 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsocgpp.c,v 1.3.8.1 2012/10/23 19:50:49 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsocgpp.c,v 1.3.8.2 2012/11/24 20:53:13 jdc Exp $"); #include "gpio.h" @@ -168,7 +168,8 @@ mvsocgpp_attach(device_t parent, device_ MVSOCGPP_WRITE(sc, MVSOCGPP_GPIOIC(i), 0); sc->sc_pic = - kmem_zalloc(sizeof(struct mvsocgpp_pic) * gpp_npins / 8, KM_SLEEP); + kmem_zalloc(sizeof(struct mvsocgpp_pic) * howmany(gpp_npins, 8), + KM_SLEEP); for (i = 0, j = 0; i < gpp_npins; i += 8, j++) { gpio_pic = &(sc->sc_pic + j)->gpio_pic; gpio_pic->pic_ops = &gpio_pic_ops;
CVS commit: [netbsd-6] src/sys/arch/arm/marvell
Module Name:src Committed By: riz Date: Tue Dec 11 04:44:03 UTC 2012 Modified Files: src/sys/arch/arm/marvell [netbsd-6]: mvsoc.c mvsocreg.h Log Message: sys/arch/arm/marvell/mvsoc.cpatch sys/arch/arm/marvell/mvsocreg.h patch Add CLKGATING_BIT, enable it for some 88F6281 devices, and don't configure devices if their clock is disabled. [msaitoh, ticket #737] To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.5.2.1 src/sys/arch/arm/marvell/mvsoc.c cvs rdiff -u -r1.2 -r1.2.12.1 src/sys/arch/arm/marvell/mvsocreg.h 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/arm/marvell/mvsoc.c diff -u src/sys/arch/arm/marvell/mvsoc.c:1.5 src/sys/arch/arm/marvell/mvsoc.c:1.5.2.1 --- src/sys/arch/arm/marvell/mvsoc.c:1.5 Sun Feb 12 16:34:07 2012 +++ src/sys/arch/arm/marvell/mvsoc.c Tue Dec 11 04:44:02 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsoc.c,v 1.5 2012/02/12 16:34:07 matt Exp $ */ +/* $NetBSD: mvsoc.c,v 1.5.2.1 2012/12/11 04:44:02 riz Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsoc.c,v 1.5 2012/02/12 16:34:07 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsoc.c,v 1.5.2.1 2012/12/11 04:44:02 riz Exp $"); #include "opt_cputypes.h" #include "opt_mvsoc.h" @@ -193,6 +193,7 @@ static const struct mvsoc_periph { int unit; bus_size_t offset; int irq; + uint32_t clkpwr_bit; } mvsoc_periphs[] = { #if defined(ORION) { ORION_1(88F1181), "mvsoctmr",0, MVSOC_TMR_BASE, IRQ_DEFAULT }, @@ -333,15 +334,23 @@ static const struct mvsoc_periph { { KIRKWOOD(88F6281),"mvsocrtc",0, KIRKWOOD_RTC_BASE,IRQ_DEFAULT }, { KIRKWOOD(88F6281),"com", 0, MVSOC_COM0_BASE, KIRKWOOD_IRQ_UART0INT }, { KIRKWOOD(88F6281),"com", 1, MVSOC_COM1_BASE, KIRKWOOD_IRQ_UART1INT }, -{ KIRKWOOD(88F6281),"ehci",0, KIRKWOOD_USB_BASE,KIRKWOOD_IRQ_USB0CNT }, +{ KIRKWOOD(88F6281),"ehci",0, KIRKWOOD_USB_BASE,KIRKWOOD_IRQ_USB0CNT, + MVSOC_MLMB_CLKGATING_BIT(3) }, // { KIRKWOOD(88F6281),"gtidmac", 0, KIRKWOOD_IDMAC_BASE,? }, { KIRKWOOD(88F6281),"gttwsi", 0, MVSOC_TWSI_BASE, KIRKWOOD_IRQ_TWSI }, -{ KIRKWOOD(88F6281),"mvcesa", 0, KIRKWOOD_CESA_BASE,KIRKWOOD_IRQ_SECURITYINT}, -{ KIRKWOOD(88F6281),"mvgbec", 0, KIRKWOOD_GBE0_BASE,IRQ_DEFAULT }, -{ KIRKWOOD(88F6281),"mvgbec", 1, KIRKWOOD_GBE1_BASE,IRQ_DEFAULT }, -{ KIRKWOOD(88F6281),"mvpex", 0, MVSOC_PEX_BASE, KIRKWOOD_IRQ_PEX0INT }, -{ KIRKWOOD(88F6281),"mvsata", 0, KIRKWOOD_SATAHC_BASE,KIRKWOOD_IRQ_SATA }, -{ KIRKWOOD(88F6281),"mvsdio", 0, KIRKWOOD_SDIO_BASE,KIRKWOOD_IRQ_SDIOINT }, +{ KIRKWOOD(88F6281),"mvcesa", 0, KIRKWOOD_CESA_BASE,KIRKWOOD_IRQ_SECURITYINT, + MVSOC_MLMB_CLKGATING_BIT(17) }, +{ KIRKWOOD(88F6281),"mvgbec", 0, KIRKWOOD_GBE0_BASE,IRQ_DEFAULT, + MVSOC_MLMB_CLKGATING_BIT(0) }, +{ KIRKWOOD(88F6281),"mvgbec", 1, KIRKWOOD_GBE1_BASE,IRQ_DEFAULT, + MVSOC_MLMB_CLKGATING_BIT(19) }, +{ KIRKWOOD(88F6281),"mvpex", 0, MVSOC_PEX_BASE, KIRKWOOD_IRQ_PEX0INT, + MVSOC_MLMB_CLKGATING_BIT(2) }, +{ KIRKWOOD(88F6281),"mvsata", 0, KIRKWOOD_SATAHC_BASE,KIRKWOOD_IRQ_SATA, + MVSOC_MLMB_CLKGATING_BIT(14) | + MVSOC_MLMB_CLKGATING_BIT(15) }, +{ KIRKWOOD(88F6281),"mvsdio", 0, KIRKWOOD_SDIO_BASE,KIRKWOOD_IRQ_SDIOINT, + MVSOC_MLMB_CLKGATING_BIT(4) }, #endif #if defined(MV78XX0) @@ -381,6 +390,7 @@ mvsoc_attach(device_t parent, device_t s struct marvell_attach_args mva; uint16_t model; uint8_t rev; + uint32_t clkpwr, clkpwrbit; int i; sc->sc_dev = self; @@ -420,6 +430,20 @@ mvsoc_attach(device_t parent, device_t s if (mvsoc_periphs[i].model != model) continue; + /* Skip clock disabled devices */ + clkpwrbit = mvsoc_periphs[i].clkpwr_bit; + if (clkpwrbit != 0) { + clkpwr = read_mlmbreg(MVSOC_MLMB_CLKGATING); + + if ((clkpwr & clkpwrbit) == 0) { +aprint_normal("%s: %s%d clock disabled\n", +device_xname(self), +mvsoc_periphs[i].name, +mvsoc_periphs[i].unit); +continue; + } + } + mva.mva_name = mvsoc_periphs[i].name; mva.mva_model = model; mva.mva_revision = rev; Index: src/sys/arch/arm/marvell/mvsocreg.h diff -u src/sys/arch/arm/marvell/mvsocreg.h:1.2 src/sys/arch/arm/marvell/mvsocreg.h:1.2.12.1 --- src/sys/arch/arm/marvell/mvsocreg.h:1.2 Tue Feb 1 22:54:24 2011 +++ src/sys/arch/arm/marvell/mvsocreg.h Tue Dec 11 04:44:03 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsocreg.h,v 1.2 2011/02/01 22:54:24 jakllsch Exp $ */ +/* $NetBSD: mvsocreg.h,v 1.2.12.1 2012/12/11 04:44:03 riz Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -110,6 +110,9 @@ #define MVSOC_MLMB_MLMBICR 0x110 /*Mb-L to Mb Bridge Intr Cause*/ #define MVSOC_MLMB_MLMBIMR 0x114 /*Mb-L to Mb Bridge Intr Mask */ +#define MVSOC_MLMB_CL