CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: andvar Date: Fri Oct 7 22:30:48 UTC 2022 Modified Files: src/sys/arch/arm/omap: omapl1x_timer.c Log Message: fix typos in chained/unchained mode definitions (s/CHANINED/CHAINED). fix typo in comment s/32 bot/32-bit/. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omapl1x_timer.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/omap/omapl1x_timer.c diff -u src/sys/arch/arm/omap/omapl1x_timer.c:1.4 src/sys/arch/arm/omap/omapl1x_timer.c:1.5 --- src/sys/arch/arm/omap/omapl1x_timer.c:1.4 Sat Feb 12 17:09:43 2022 +++ src/sys/arch/arm/omap/omapl1x_timer.c Fri Oct 7 22:30:48 2022 @@ -25,7 +25,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: omapl1x_timer.c,v 1.4 2022/02/12 17:09:43 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omapl1x_timer.c,v 1.5 2022/10/07 22:30:48 andvar Exp $"); #include "opt_timer.h" @@ -117,9 +117,9 @@ static struct omapl1xtmr_softc *ref_sc; /* Timer modes */ #define TGCR_TIMMODE_64BIT 0x0 -#define TGCR_TIMMODE_32BIT_UNCHANINED 0x1 +#define TGCR_TIMMODE_32BIT_UNCHAINED 0x1 #define TGCR_TIMMODE_64BIT_WDOG 0x2 -#define TGCR_TIMMODE_32BIT_CHANINED 0x3 +#define TGCR_TIMMODE_32BIT_CHAINED 0x3 #define TGCR_TIMMODE_SHIFT 2 #define TGCR_RS_STOP 0x0 @@ -277,8 +277,8 @@ timer_init (struct omapl1xtmr_softc *sc, if (intr) omapl1xtimer_prd_intr_enb(sc); - /* Set timers to 32 bot unchained mode */ - val = TGCR_TIMMODE_32BIT_UNCHANINED << TGCR_TIMMODE_SHIFT; + /* Set timers to 32-bit unchained mode */ + val = TGCR_TIMMODE_32BIT_UNCHAINED << TGCR_TIMMODE_SHIFT; bus_space_write_4(sc->sc_iot, sc->sc_ioh, TGCR, val); omapl1xtimer_start(sc);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: andvar Date: Fri Oct 7 22:30:48 UTC 2022 Modified Files: src/sys/arch/arm/omap: omapl1x_timer.c Log Message: fix typos in chained/unchained mode definitions (s/CHANINED/CHAINED). fix typo in comment s/32 bot/32-bit/. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omapl1x_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: thorpej Date: Sun Sep 18 15:19:36 UTC 2022 Modified Files: src/sys/arch/arm/omap: omapl1x_emac.c Log Message: Eliminate use of IFF_OACTIVE. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/omap/omapl1x_emac.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/omap/omapl1x_emac.c diff -u src/sys/arch/arm/omap/omapl1x_emac.c:1.11 src/sys/arch/arm/omap/omapl1x_emac.c:1.12 --- src/sys/arch/arm/omap/omapl1x_emac.c:1.11 Thu May 30 02:32:17 2019 +++ src/sys/arch/arm/omap/omapl1x_emac.c Sun Sep 18 15:19:36 2022 @@ -30,7 +30,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: omapl1x_emac.c,v 1.11 2019/05/30 02:32:17 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omapl1x_emac.c,v 1.12 2022/09/18 15:19:36 thorpej Exp $"); #include "opt_omapl1x.h" @@ -713,13 +713,9 @@ emac_desc_dequeue (struct emac_softc *sc { int ret; struct emac_chain *entry; - struct ifnet * const ifp = >sc_if; if (chan->ch == TXCH) { ret = emac_tx_desc_dequeue(sc, chan); - if (ret == 0) { - ifp->if_flags &= ~IFF_OACTIVE; - } } else { /* Process the received packet */ ret = emac_rx_desc_process(sc, chan); @@ -862,8 +858,7 @@ emac_ifstart (struct ifnet *ifp) bus_dmamap_t map; int error; - if (__predict_false((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != - IFF_RUNNING)) { + if (__predict_false((ifp->if_flags & IFF_RUNNING) == 0)) { return; } @@ -943,9 +938,6 @@ remap: goto unlock; } - device_printf(sc->sc_dev, "TX desc's full, setting IFF_OACTIVE\n"); - ifp->if_flags |= IFF_OACTIVE; - unlock: mutex_exit(chan->lock); } @@ -1020,7 +1012,7 @@ emac_ifstop (struct ifnet *ifp, int disa mutex_exit(rx_chan->lock); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; } static int @@ -1093,7 +1085,6 @@ emac_ifinit (struct ifnet *ifp) rx_chan->run = true; callout_schedule(>sc_mii_callout, hz); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; mutex_enter(sc->sc_hwlock); emac_int_enable(sc);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: thorpej Date: Sun Sep 18 15:19:36 UTC 2022 Modified Files: src/sys/arch/arm/omap: omapl1x_emac.c Log Message: Eliminate use of IFF_OACTIVE. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/omap/omapl1x_emac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: thorpej Date: Sun Sep 18 15:14:06 UTC 2022 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: Eliminate use of IFF_OACTIVE. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/omap/if_cpsw.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/omap/if_cpsw.c diff -u src/sys/arch/arm/omap/if_cpsw.c:1.28 src/sys/arch/arm/omap/if_cpsw.c:1.29 --- src/sys/arch/arm/omap/if_cpsw.c:1.28 Tue Feb 4 07:35:34 2020 +++ src/sys/arch/arm/omap/if_cpsw.c Sun Sep 18 15:14:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.28 2020/02/04 07:35:34 skrll Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.29 2022/09/18 15:14:06 thorpej Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.28 2020/02/04 07:35:34 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.29 2022/09/18 15:14:06 thorpej Exp $"); #include #include @@ -129,6 +129,7 @@ struct cpsw_softc { volatile u_int sc_txnext; volatile u_int sc_txhead; volatile u_int sc_rxhead; + bool sc_txbusy; void *sc_rxthih; void *sc_rxih; void *sc_txih; @@ -596,8 +597,10 @@ cpsw_start(struct ifnet *ifp) KERNHIST_FUNC(__func__); KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, 0, 0, 0); - if (__predict_false((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != - IFF_RUNNING)) { + if (__predict_false((ifp->if_flags & IFF_RUNNING) == 0)) { + return; + } + if (__predict_false(sc->sc_txbusy)) { return; } @@ -629,7 +632,7 @@ cpsw_start(struct ifnet *ifp) } if (dm->dm_nsegs + 1 >= txfree) { - ifp->if_flags |= IFF_OACTIVE; + sc->sc_txbusy = true; bus_dmamap_unload(sc->sc_bdt, dm); break; } @@ -1007,7 +1010,7 @@ cpsw_init(struct ifnet *ifp) sc->sc_txeoq = true; callout_schedule(>sc_tick_ch, hz); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + sc->sc_txbusy = false; return 0; } @@ -1075,8 +1078,9 @@ cpsw_stop(struct ifnet *ifp, int disable rdp->tx_mb[i] = NULL; } - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; ifp->if_timer = 0; + sc->sc_txbusy = false; if (!disable) return; @@ -1270,7 +1274,7 @@ cpsw_txintr(void *arg) handled = true; - ifp->if_flags &= ~IFF_OACTIVE; + sc->sc_txbusy = false; next: if (ISSET(dw[3], CPDMA_BD_EOP) && ISSET(dw[3], CPDMA_BD_EOQ)) {
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: thorpej Date: Sun Sep 18 15:14:06 UTC 2022 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: Eliminate use of IFF_OACTIVE. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/omap/if_cpsw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: christos Date: Mon Jun 21 03:18:40 UTC 2021 Modified Files: src/sys/arch/arm/omap: omap3_ehci.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/omap/omap3_ehci.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/omap/omap3_ehci.c diff -u src/sys/arch/arm/omap/omap3_ehci.c:1.14 src/sys/arch/arm/omap/omap3_ehci.c:1.15 --- src/sys/arch/arm/omap/omap3_ehci.c:1.14 Sat Apr 24 19:36:28 2021 +++ src/sys/arch/arm/omap/omap3_ehci.c Sun Jun 20 23:18:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_ehci.c,v 1.14 2021/04/24 23:36:28 thorpej Exp $ */ +/* $NetBSD: omap3_ehci.c,v 1.15 2021/06/21 03:18:40 christos Exp $ */ /*- * Copyright (c) 2010-2012 Jared D. McNeill @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_ehci.c,v 1.14 2021/04/24 23:36:28 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_ehci.c,v 1.15 2021/06/21 03:18:40 christos Exp $"); #include "locators.h" @@ -365,7 +365,7 @@ omap3_ehci_get_port_mode(prop_dictionary const char *s = NULL; enum omap3_ehci_port_mode mode = OMAP3_EHCI_PORT_MODE_NONE; - if (prop_dictionary_get_cstring_nocopy(prop, key, ) && s != NULL) { + if (prop_dictionary_get_string(prop, key, ) && s != NULL) { if (strcmp(s, "phy") == 0) { mode = OMAP3_EHCI_PORT_MODE_PHY; #ifdef OMAP_3XXX
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: christos Date: Mon Jun 21 03:18:40 UTC 2021 Modified Files: src/sys/arch/arm/omap: omap3_ehci.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/omap/omap3_ehci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: thorpej Date: Thu Mar 25 16:34:59 UTC 2021 Modified Files: src/sys/arch/arm/omap: ti_iic.c Log Message: ti_iic_{acquire,release}_bus are no more. Missed in rev 1.11. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/omap/ti_iic.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/omap/ti_iic.c diff -u src/sys/arch/arm/omap/ti_iic.c:1.12 src/sys/arch/arm/omap/ti_iic.c:1.13 --- src/sys/arch/arm/omap/ti_iic.c:1.12 Thu May 14 08:34:20 2020 +++ src/sys/arch/arm/omap/ti_iic.c Thu Mar 25 16:34:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_iic.c,v 1.12 2020/05/14 08:34:20 msaitoh Exp $ */ +/* $NetBSD: ti_iic.c,v 1.13 2021/03/25 16:34:59 thorpej Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.12 2020/05/14 08:34:20 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.13 2021/03/25 16:34:59 thorpej Exp $"); #include "opt_omap.h" #include "locators.h" @@ -216,8 +216,6 @@ ti_iic_attach(device_t parent, device_t iic_tag_init(>sc_ic); sc->sc_ic.ic_cookie = sc; - sc->sc_ic.ic_acquire_bus = ti_iic_acquire_bus; - sc->sc_ic.ic_release_bus = ti_iic_release_bus; sc->sc_ic.ic_exec = ti_iic_exec; if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size,
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: thorpej Date: Thu Mar 25 16:34:59 UTC 2021 Modified Files: src/sys/arch/arm/omap: ti_iic.c Log Message: ti_iic_{acquire,release}_bus are no more. Missed in rev 1.11. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/omap/ti_iic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: ryo Date: Tue Mar 13 06:41:54 UTC 2018 Modified Files: src/sys/arch/arm/omap: omap_gpio.c Log Message: fix compile error (variable set but not used) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/omap/omap_gpio.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/omap/omap_gpio.c diff -u src/sys/arch/arm/omap/omap_gpio.c:1.7 src/sys/arch/arm/omap/omap_gpio.c:1.8 --- src/sys/arch/arm/omap/omap_gpio.c:1.7 Mon Nov 12 18:00:37 2012 +++ src/sys/arch/arm/omap/omap_gpio.c Tue Mar 13 06:41:53 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: omap_gpio.c,v 1.7 2012/11/12 18:00:37 skrll Exp $ */ +/* $NetBSD: omap_gpio.c,v 1.8 2018/03/13 06:41:53 ryo Exp $ */ /* * The OMAP GPIO Controller interface is inspired by pxa2x0_gpio.c @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap_gpio.c,v 1.7 2012/11/12 18:00:37 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap_gpio.c,v 1.8 2018/03/13 06:41:53 ryo Exp $"); #include #include @@ -388,6 +388,7 @@ omap_gpio_intr_mask(void *cookie) sc = device_lookup_private(_cd, GPIO_MODULE(gpio)); bit = GPIO_BIT(gpio); relnum = GPIO_RELNUM(gpio); + __USE(relnum); /* Disable interrupt generation for that gpio. */ bus_space_write_4(sc->sc_bust, sc->sc_bush, GPIO_CLEAR_IRQENABLE, @@ -410,6 +411,7 @@ omap_gpio_intr_unmask(void *cookie) sc = device_lookup_private(_cd, GPIO_MODULE(gpio)); bit = GPIO_BIT(gpio); relnum = GPIO_RELNUM(gpio); + __USE(relnum); /* Enable interrupt generation for that pin. */ bus_space_write_4(sc->sc_bust, sc->sc_bush, GPIO_SET_IRQENABLE, @@ -432,6 +434,7 @@ omap_gpio_intr_wakeup(void *cookie, int sc = device_lookup_private(_cd, GPIO_MODULE(gpio)); bit = GPIO_BIT(gpio); relnum = GPIO_RELNUM(gpio); + __USE(relnum); if (enable) bus_space_write_4(sc->sc_bust, sc->sc_bush,
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: ryo Date: Tue Mar 13 06:41:54 UTC 2018 Modified Files: src/sys/arch/arm/omap: omap_gpio.c Log Message: fix compile error (variable set but not used) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/omap/omap_gpio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Wed Aug 23 14:14:59 UTC 2017 Modified Files: src/sys/arch/arm/omap: am335x_prcm.c Log Message: Always perform code previously code under #ifdef DIAGNOSTIC - it appears that the read is needed to help make the chip work. Someone with time and a datasheet can hopefully work out why. Fixes John D. Baker's boot problem reported on port-arm here: http://mail-index.netbsd.org/port-arm/2017/07/27/msg004323.html To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/am335x_prcm.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/omap/am335x_prcm.c diff -u src/sys/arch/arm/omap/am335x_prcm.c:1.9 src/sys/arch/arm/omap/am335x_prcm.c:1.10 --- src/sys/arch/arm/omap/am335x_prcm.c:1.9 Tue Oct 18 15:10:35 2016 +++ src/sys/arch/arm/omap/am335x_prcm.c Wed Aug 23 14:14:59 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_prcm.c,v 1.9 2016/10/18 15:10:35 kiyohara Exp $ */ +/* $NetBSD: am335x_prcm.c,v 1.10 2017/08/23 14:14:59 skrll Exp $ */ /* * TI OMAP Power, Reset, and Clock Management on the AM335x @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.9 2016/10/18 15:10:35 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.10 2017/08/23 14:14:59 skrll Exp $"); #include "tps65217pmic.h" @@ -61,18 +61,12 @@ static void am335x_prcm_check_clkctrl(bus_size_t cm_module, bus_size_t clkctrl_reg, uint32_t v) { -#ifdef DIAGNOSTIC uint32_t u = prcm_read_4(cm_module, clkctrl_reg); if (__SHIFTOUT(u, AM335X_CLKCTRL_MODULEMODE_MASK) != __SHIFTOUT(v, AM335X_CLKCTRL_MODULEMODE_MASK)) aprint_error("clkctrl didn't take: %"PRIx32" -/-> %"PRIx32"\n", u, v); -#else - (void)cm_module; - (void)clkctrl_reg; - (void)v; -#endif } void
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Wed Aug 23 14:14:59 UTC 2017 Modified Files: src/sys/arch/arm/omap: am335x_prcm.c Log Message: Always perform code previously code under #ifdef DIAGNOSTIC - it appears that the read is needed to help make the chip work. Someone with time and a datasheet can hopefully work out why. Fixes John D. Baker's boot problem reported on port-arm here: http://mail-index.netbsd.org/port-arm/2017/07/27/msg004323.html To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/am335x_prcm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Tue Mar 14 15:11:41 UTC 2017 Modified Files: src/sys/arch/arm/omap: omap_edma.c Log Message: PR/51380: Mutex error: mutex_vector_enter: locking against myself Change the interrupt handler IPL level to IPL_VM (aka IPL_BIO aka IPL_SDMMC) so that the sdhc_host_lock prevents edma_intr from running To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap_edma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Tue Mar 14 15:11:41 UTC 2017 Modified Files: src/sys/arch/arm/omap: omap_edma.c Log Message: PR/51380: Mutex error: mutex_vector_enter: locking against myself Change the interrupt handler IPL level to IPL_VM (aka IPL_BIO aka IPL_SDMMC) so that the sdhc_host_lock prevents edma_intr from running To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap_edma.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/omap/omap_edma.c diff -u src/sys/arch/arm/omap/omap_edma.c:1.3 src/sys/arch/arm/omap/omap_edma.c:1.4 --- src/sys/arch/arm/omap/omap_edma.c:1.3 Sat Jul 9 15:04:06 2016 +++ src/sys/arch/arm/omap/omap_edma.c Tue Mar 14 15:11:41 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: omap_edma.c,v 1.3 2016/07/09 15:04:06 kiyohara Exp $ */ +/* $NetBSD: omap_edma.c,v 1.4 2017/03/14 15:11:41 skrll Exp $ */ /*- * Copyright (c) 2014 Jared D. McNeill@@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap_edma.c,v 1.3 2016/07/09 15:04:06 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap_edma.c,v 1.4 2017/03/14 15:11:41 skrll Exp $"); #include "opt_omap.h" @@ -143,7 +143,7 @@ edma_attach(device_t parent, device_t se sc->sc_dev = self; sc->sc_iot = _bs_tag; - mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_SCHED); + mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM); if (bus_space_map(sc->sc_iot, mb->mb_iobase, mb->mb_iosize, 0, >sc_ioh) != 0) { aprint_error(": couldn't map address spcae\n"); @@ -166,13 +166,13 @@ edma_attach(device_t parent, device_t se edma_init(sc); sc->sc_ih = intr_establish(mb->mb_intrbase + 0, - IPL_SCHED, IST_LEVEL, edma_intr, sc); + IPL_VM, IST_LEVEL | IST_MPSAFE, edma_intr, sc); KASSERT(sc->sc_ih != NULL); sc->sc_mperr_ih = intr_establish(mb->mb_intrbase + 1, - IPL_SCHED, IST_LEVEL, edma_mperr_intr, sc); + IPL_VM, IST_LEVEL, edma_mperr_intr, sc); sc->sc_errint_ih = intr_establish(mb->mb_intrbase + 2, - IPL_SCHED, IST_LEVEL, edma_errint_intr, sc); + IPL_VM, IST_LEVEL, edma_errint_intr, sc); } /*
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Wed Mar 1 16:27:25 UTC 2017 Modified Files: src/sys/arch/arm/omap: tifb.c Log Message: Fix compile... is this right? To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/tifb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Wed Mar 1 16:27:25 UTC 2017 Modified Files: src/sys/arch/arm/omap: tifb.c Log Message: Fix compile... is this right? To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/tifb.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/omap/tifb.c diff -u src/sys/arch/arm/omap/tifb.c:1.6 src/sys/arch/arm/omap/tifb.c:1.7 --- src/sys/arch/arm/omap/tifb.c:1.6 Tue Oct 18 14:14:51 2016 +++ src/sys/arch/arm/omap/tifb.c Wed Mar 1 16:27:25 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: tifb.c,v 1.6 2016/10/18 14:14:51 kiyohara Exp $ */ +/* $NetBSD: tifb.c,v 1.7 2017/03/01 16:27:25 skrll Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.6 2016/10/18 14:14:51 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.7 2017/03/01 16:27:25 skrll Exp $"); #include "opt_omap.h" @@ -803,6 +803,7 @@ tifb_ioctl(void *v, void *vs, u_long cmd case WSDISPLAYIO_SCURSOR: // cursor = data; // return omapfb_do_cursor(sc, cursor); + break; } return EPASSTHROUGH; }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 18 14:08:53 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_gpio.c Log Message: The variable gpio_module[] into #ifdef TI_AM335X - #endif. Thanks for joerg@. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/omap/omap2_gpio.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/omap/omap2_gpio.c diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.20 src/sys/arch/arm/omap/omap2_gpio.c:1.21 --- src/sys/arch/arm/omap/omap2_gpio.c:1.20 Tue Oct 18 14:02:48 2016 +++ src/sys/arch/arm/omap/omap2_gpio.c Tue Oct 18 14:08:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_gpio.c,v 1.20 2016/10/18 14:02:48 kiyohara Exp $ */ +/* $NetBSD: omap2_gpio.c,v 1.21 2016/10/18 14:08:53 kiyohara Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.20 2016/10/18 14:02:48 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.21 2016/10/18 14:08:53 kiyohara Exp $"); #define _INTR_PRIVATE @@ -64,12 +64,14 @@ __KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c #include #endif +#ifdef TI_AM335X static const struct omap_module gpio_module[] = { { 0, 0 }, { AM335X_PRCM_CM_PER, CM_PER_GPIO1_CLKCTRL }, { AM335X_PRCM_CM_PER, CM_PER_GPIO2_CLKCTRL }, { AM335X_PRCM_CM_PER, CM_PER_GPIO3_CLKCTRL }, }; +#endif static void gpio_pic_block_irqs(struct pic_softc *, size_t, uint32_t); static void gpio_pic_block_irqs2(struct pic_softc *, size_t, uint32_t);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 18 14:08:53 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_gpio.c Log Message: The variable gpio_module[] into #ifdef TI_AM335X - #endif. Thanks for joerg@. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/omap/omap2_gpio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 18 14:14:51 UTC 2016 Modified Files: src/sys/arch/arm/omap: tifb.c tifbreg.h Added Files: src/sys/arch/arm/omap: tifbvar.h Log Message: Update unused tifb. wscons is working. Tested on PEPPER and VTC100. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/tifb.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/tifbreg.h cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/omap/tifbvar.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/omap/tifb.c diff -u src/sys/arch/arm/omap/tifb.c:1.5 src/sys/arch/arm/omap/tifb.c:1.6 --- src/sys/arch/arm/omap/tifb.c:1.5 Sun Apr 12 20:00:42 2015 +++ src/sys/arch/arm/omap/tifb.c Tue Oct 18 14:14:51 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tifb.c,v 1.5 2015/04/12 20:00:42 bouyer Exp $ */ +/* $NetBSD: tifb.c,v 1.6 2016/10/18 14:14:51 kiyohara Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.5 2015/04/12 20:00:42 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.6 2016/10/18 14:14:51 kiyohara Exp $"); #include "opt_omap.h" @@ -76,6 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.5 #include #include +#include #include #include #include @@ -92,55 +93,8 @@ __KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.5 #include #include -#include - #include "locators.h" -struct panel_info { - uint32_t panel_width; - uint32_t panel_height; - uint32_t panel_hfp; - uint32_t panel_hbp; - uint32_t panel_hsw; - uint32_t panel_vfp; - uint32_t panel_vbp; - uint32_t panel_vsw; - uint32_t ac_bias; - uint32_t ac_bias_intrpt; - uint32_t dma_burst_sz; - uint32_t bpp; - uint32_t fdd; - uint32_t invert_line_clock; - uint32_t invert_frm_clock; - uint32_t sync_edge; - uint32_t sync_ctrl; - uint32_t panel_pxl_clk; - uint32_t panel_invert_pxl_clk; -}; - -/* for chalk elec cape with 12" panel */ -struct panel_info default_panel_info = { - .panel_width = 1280, - .panel_height = 800, - .panel_hfp = 48, - .panel_hbp = 80, - .panel_hsw = 32, - .panel_vfp = 2, - .panel_vbp = 15, - .panel_vsw = 6, - .ac_bias = 255, - .ac_bias_intrpt = 0, - .dma_burst_sz = 16, - .bpp = 16, - .fdd = 16, - .invert_line_clock = 0, - .invert_frm_clock = 0, - .sync_edge = 0, - .sync_ctrl = 1, - .panel_pxl_clk = 6930, - .panel_invert_pxl_clk = 0, -}; - struct tifb_softc { device_t sc_dev; @@ -154,9 +108,7 @@ struct tifb_softc { size_t sc_palettesize; int sc_stride; - int sc_locked; void *sc_fbaddr, *sc_vramaddr; - void *sc_shadowfb; bus_addr_t sc_fbhwaddr; uint16_t *sc_palette; @@ -170,14 +122,12 @@ struct tifb_softc { uint8_t sc_cmap_red[256], sc_cmap_green[256], sc_cmap_blue[256]; void (*sc_putchar)(void *, int, int, u_int, long); - uint8_t sc_edid_data[1024]; - size_t sc_edid_size; - - struct panel_info *sc_panel; + struct tifb_panel_info *sc_pi; }; -#define TIFB_READ(sc, reg) bus_space_read_4(sc->sc_iot, sc->sc_regh, reg) -#define TIFB_WRITE(sc, reg, val) bus_space_write_4(sc->sc_iot, sc->sc_regh, reg, val) +#define TIFB_READ(sc, reg) bus_space_read_4(sc->sc_iot, sc->sc_regh, reg) +#define TIFB_WRITE(sc, reg, val) \ + bus_space_write_4(sc->sc_iot, sc->sc_regh, reg, val) static int tifb_match(device_t, cfdata_t, void *); static void tifb_attach(device_t, device_t, void *); @@ -193,18 +143,15 @@ static int am335x_clk_get_arm_disp_freq CFATTACH_DECL_NEW(tifb, sizeof(struct tifb_softc), tifb_match, tifb_attach, NULL, NULL); -static int tifb_ioctl(void *, void *, u_long, void *, int, - struct lwp *); +static int tifb_ioctl(void *, void *, u_long, void *, int, struct lwp *); static paddr_t tifb_mmap(void *, void *, off_t, int); static void tifb_init_screen(void *, struct vcons_screen *, int, long *); static int tifb_putcmap(struct tifb_softc *, struct wsdisplay_cmap *); static int tifb_getcmap(struct tifb_softc *, struct wsdisplay_cmap *); -#if 0 -static void tifb_restore_palette(struct tifb_softc *); -static void tifb_putpalreg(struct tifb_softc *, int, uint8_t, - uint8_t, uint8_t); +static void tifb_restore_palette(struct tifb_softc *, int, int); +#if 0 static int tifb_set_depth(struct tifb_softc *, int); #endif static void tifb_set_video(struct tifb_softc *, int); @@ -239,9 +186,9 @@ am335x_lcd_calc_divisor(uint32_t referen /* Raster mode case: divisors are in range from 2 to 255 */ for (div = 2; div < 255; div++) if (reference/div <= freq) - return (div); + return div; - return (255); + return 255; } static int @@ -249,7 +196,8 @@ tifb_match(device_t parent, cfdata_t mat { struct obio_attach_args *obio = aux; - if ((obio->obio_addr == -1) || (obio->obio_size == 0)) + if ((obio->obio_addr == OBIOCF_ADDR_DEFAULT) || + (obio->obio_size == OBIOCF_SIZE_DEFAULT)) return 0; return 1; } @@ -261,12 +209,12 @@ tifb_attach(device_t parent,
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 18 14:02:48 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_gpio.c Log Message: Allow obio_intr == OBIOCF_INTR_DEFAULT. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/omap/omap2_gpio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 18 14:02:48 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_gpio.c Log Message: Allow obio_intr == OBIOCF_INTR_DEFAULT. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/omap/omap2_gpio.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/omap/omap2_gpio.c diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.19 src/sys/arch/arm/omap/omap2_gpio.c:1.20 --- src/sys/arch/arm/omap/omap2_gpio.c:1.19 Sat Oct 15 15:11:56 2016 +++ src/sys/arch/arm/omap/omap2_gpio.c Tue Oct 18 14:02:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $ */ +/* $NetBSD: omap2_gpio.c,v 1.20 2016/10/18 14:02:48 kiyohara Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.20 2016/10/18 14:02:48 kiyohara Exp $"); #define _INTR_PRIVATE @@ -489,9 +489,6 @@ gpio_attach(device_t parent, device_t se gpio->gpio_dev = self; - if (oa->obio_intr == OBIOCF_INTR_DEFAULT) - panic("\n%s: no intr assigned", device_xname(self)); - if (oa->obio_size == OBIOCF_SIZE_DEFAULT) panic("\n%s: no size assigned", device_xname(self));
Re: CVS commit: src/sys/arch/arm/omap
On Sat, Oct 15, 2016 at 03:11:56PM +, KIYOHARA Takashi wrote: > Module Name: src > Committed By: kiyohara > Date: Sat Oct 15 15:11:56 UTC 2016 > > Modified Files: > src/sys/arch/arm/omap: files.omap2 omap2_gpio.c > > Log Message: > Support TI_AM335X gpio to omap2_gpio.c. From https://releng.netbsd.org/builds/HEAD-llvm/201610161110Z/evbarm-earm.build.failed /home/source/ab/HEAD-llvm/src/sys/arch/arm/omap/omap2_gpio.c:67:33: error: unused variable 'gpio_module' [-Werror,-Wunused-const-variable] Joerg
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sun Oct 16 13:09:57 UTC 2016 Modified Files: src/sys/arch/arm/omap: ti_iic.c Log Message: Fix miss commit. Add macro OMAP2_I2C_FIFOBYTES. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/ti_iic.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/omap/ti_iic.c diff -u src/sys/arch/arm/omap/ti_iic.c:1.9 src/sys/arch/arm/omap/ti_iic.c:1.10 --- src/sys/arch/arm/omap/ti_iic.c:1.9 Sat Oct 15 15:08:59 2016 +++ src/sys/arch/arm/omap/ti_iic.c Sun Oct 16 13:09:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_iic.c,v 1.9 2016/10/15 15:08:59 kiyohara Exp $ */ +/* $NetBSD: ti_iic.c,v 1.10 2016/10/16 13:09:57 kiyohara Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.9 2016/10/15 15:08:59 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.10 2016/10/16 13:09:57 kiyohara Exp $"); #include "opt_omap.h" #include "locators.h" @@ -83,6 +83,8 @@ __KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1 #define OMAP2_I2C_SLAVE_ADDR 0x01 #endif +#define OMAP2_I2C_FIFOBYTES(fd) (8 << (fd)) + #ifdef I2CDEBUG #define DPRINTF(args) printf args #else
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sun Oct 16 13:09:57 UTC 2016 Modified Files: src/sys/arch/arm/omap: ti_iic.c Log Message: Fix miss commit. Add macro OMAP2_I2C_FIFOBYTES. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/ti_iic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/arm/omap
Hi, On Sat, Oct 15, 2016 at 03:09:00PM +, KIYOHARA Takashi wrote: > + fifo = OMAP2_I2C_FIFOBYTES(fifodepth); >From >http://releng.netbsd.org/builds/HEAD/201610160020Z/evbarm-earmv7hf.build.failed --- kern-BEAGLEBONE --- /home/source/ab/HEAD/src/sys/arch/arm/omap/ti_iic.c: In function 'ti_iic_attach': /home/source/ab/HEAD/src/sys/arch/arm/omap/ti_iic.c:281:9: error: implicit declaration of function 'OMAP2_I2C_FIFOBYTES' [-Werror=implicit-function-declaration] fifo = OMAP2_I2C_FIFOBYTES(fifodepth); ^
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Oct 15 15:14:20 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_obio.c Log Message: Attach icu before attaching gpio. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/omap/omap2_obio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Oct 15 15:14:20 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_obio.c Log Message: Attach icu before attaching gpio. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/omap/omap2_obio.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/omap/omap2_obio.c diff -u src/sys/arch/arm/omap/omap2_obio.c:1.23 src/sys/arch/arm/omap/omap2_obio.c:1.24 --- src/sys/arch/arm/omap/omap2_obio.c:1.23 Mon Apr 25 13:17:16 2016 +++ src/sys/arch/arm/omap/omap2_obio.c Sat Oct 15 15:14:20 2016 @@ -1,7 +1,7 @@ -/* $Id: omap2_obio.c,v 1.23 2016/04/25 13:17:16 kiyohara Exp $ */ +/* $Id: omap2_obio.c,v 1.24 2016/10/15 15:14:20 kiyohara Exp $ */ /* adapted from: */ -/* $NetBSD: omap2_obio.c,v 1.23 2016/04/25 13:17:16 kiyohara Exp $ */ +/* $NetBSD: omap2_obio.c,v 1.24 2016/10/15 15:14:20 kiyohara Exp $ */ /* @@ -103,7 +103,7 @@ #include "opt_omap.h" #include -__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.23 2016/04/25 13:17:16 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.24 2016/10/15 15:14:20 kiyohara Exp $"); #include "locators.h" #include "obio.h" @@ -378,6 +378,9 @@ static const struct { #if defined(OMAP_3530) { .name = "avic",.addr = INTC_BASE_3530, .required = true }, #endif +#if defined(TI_AM335X) + { .name = "omapicu", .addr = 0x4820, .required = true }, +#endif { .name = "gpio1", .addr = GPIO1_BASE, .required = false }, { .name = "gpio2", .addr = GPIO2_BASE, .required = false }, { .name = "gpio3", .addr = GPIO3_BASE, .required = false }, @@ -400,7 +403,6 @@ static const struct { { .name = "dmac", .addr = DMAC_BASE, .required = true }, #endif #if defined(TI_AM335X) - { .name = "omapicu", .addr = 0x4820, .required = true }, { .name = "prcm", .addr = 0x44e0, .required = true }, { .name = "sitaracm", .addr = 0x44e1, .required = true }, { .name = "edma", .addr = 0x4900, .required = false },
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Oct 15 15:11:56 UTC 2016 Modified Files: src/sys/arch/arm/omap: files.omap2 omap2_gpio.c Log Message: Support TI_AM335X gpio to omap2_gpio.c. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/omap/files.omap2 cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/omap/omap2_gpio.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/omap/files.omap2 diff -u src/sys/arch/arm/omap/files.omap2:1.35 src/sys/arch/arm/omap/files.omap2:1.36 --- src/sys/arch/arm/omap/files.omap2:1.35 Tue Oct 4 16:10:34 2016 +++ src/sys/arch/arm/omap/files.omap2 Sat Oct 15 15:11:56 2016 @@ -1,4 +1,4 @@ -# $NetBSD: files.omap2,v 1.35 2016/10/04 16:10:34 kiyohara Exp $ +# $NetBSD: files.omap2,v 1.36 2016/10/15 15:11:56 kiyohara Exp $ # # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support # Based on xscale/files.pxa2x0 @@ -59,8 +59,7 @@ file arch/arm/omap/omap2430_intr.c omap # OMAP2 GPIO controllers device omapgpio: gpiobus attach omapgpio at obio with omap2gpio -file arch/arm/omap/omap2_gpio.c (omap2 | omap3) & !ti_am335x & omapgpio -file arch/arm/omap/am335x_gpio.c ti_am335x & omapgpio +file arch/arm/omap/omap2_gpio.c (omap2 | omap3) & omapgpio # TI_AM335X (and maybe TI OMAP4) I2C controllers device tiiic: i2cbus, i2cexec Index: src/sys/arch/arm/omap/omap2_gpio.c diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.18 src/sys/arch/arm/omap/omap2_gpio.c:1.19 --- src/sys/arch/arm/omap/omap2_gpio.c:1.18 Mon Jul 11 14:53:05 2016 +++ src/sys/arch/arm/omap/omap2_gpio.c Sat Oct 15 15:11:56 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_gpio.c,v 1.18 2016/07/11 14:53:05 kiyohara Exp $ */ +/* $NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.18 2016/07/11 14:53:05 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $"); #define _INTR_PRIVATE @@ -50,9 +50,13 @@ __KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c #include +#include #include #include #include +#include +#include +#include #include #if NGPIO > 0 @@ -60,6 +64,13 @@ __KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c #include #endif +static const struct omap_module gpio_module[] = { + { 0, 0 }, + { AM335X_PRCM_CM_PER, CM_PER_GPIO1_CLKCTRL }, + { AM335X_PRCM_CM_PER, CM_PER_GPIO2_CLKCTRL }, + { AM335X_PRCM_CM_PER, CM_PER_GPIO3_CLKCTRL }, +}; + static void gpio_pic_block_irqs(struct pic_softc *, size_t, uint32_t); static void gpio_pic_block_irqs2(struct pic_softc *, size_t, uint32_t); static void gpio_pic_unblock_irqs(struct pic_softc *, size_t, uint32_t); @@ -318,16 +329,11 @@ omap2gpio_pin_write(void *arg, int pin, { struct gpio_softc * const gpio = arg; uint32_t mask = 1 << pin; - uint32_t old, new; - old = GPIO_READ(gpio, GPIO_DATAOUT); if (value) - new = old | mask; + GPIO_WRITE(gpio, GPIO_SETDATAOUT, mask); else - new = old & ~mask; - - if (old != new) - GPIO_WRITE(gpio, GPIO_DATAOUT, new); + GPIO_WRITE(gpio, GPIO_CLEARDATAOUT, mask); } static void @@ -524,6 +530,23 @@ gpio_attach(device_t parent, device_t se aprint_normal(", intr %d", oa->obio_intr); } aprint_normal("\n"); + +#ifdef TI_AM335X + switch (oa->obio_addr) { + case GPIO0_BASE_TI_AM335X: + break; + case GPIO1_BASE_TI_AM335X: + prcm_module_enable(_module[1]); + break; + case GPIO2_BASE_TI_AM335X: + prcm_module_enable(_module[2]); + break; + case GPIO3_BASE_TI_AM335X: + prcm_module_enable(_module[3]); + break; + } +#endif + #if NGPIO > 0 #if 0 config_interrupts(self, gpio_attach1);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Oct 15 15:11:56 UTC 2016 Modified Files: src/sys/arch/arm/omap: files.omap2 omap2_gpio.c Log Message: Support TI_AM335X gpio to omap2_gpio.c. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/omap/files.omap2 cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/omap/omap2_gpio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Oct 15 15:08:59 UTC 2016 Modified Files: src/sys/arch/arm/omap: ti_iic.c ti_iicreg.h Log Message: Fix broken settings for AM335X's I2C[12]. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/ti_iic.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/ti_iicreg.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/omap/ti_iic.c diff -u src/sys/arch/arm/omap/ti_iic.c:1.8 src/sys/arch/arm/omap/ti_iic.c:1.9 --- src/sys/arch/arm/omap/ti_iic.c:1.8 Sat Oct 15 15:00:12 2016 +++ src/sys/arch/arm/omap/ti_iic.c Sat Oct 15 15:08:59 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_iic.c,v 1.8 2016/10/15 15:00:12 kiyohara Exp $ */ +/* $NetBSD: ti_iic.c,v 1.9 2016/10/15 15:08:59 kiyohara Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.8 2016/10/15 15:00:12 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.9 2016/10/15 15:08:59 kiyohara Exp $"); #include "opt_omap.h" #include "locators.h" @@ -163,7 +163,7 @@ struct am335x_iic { static const struct am335x_iic am335x_iic[] = { { "I2C0", OMAP2_I2C0_BASE, 70, { AM335X_PRCM_CM_WKUP, 0xb8 } }, { "I2C1", OMAP2_I2C1_BASE, 71, { AM335X_PRCM_CM_PER, 0x48 } }, - { "I2C2", OMAP2_I2C1_BASE, 30, { AM335X_PRCM_CM_PER, 0x44 } }, + { "I2C2", OMAP2_I2C2_BASE, 30, { AM335X_PRCM_CM_PER, 0x44 } }, }; #endif @@ -199,6 +199,7 @@ ti_iic_attach(device_t parent, device_t { struct ti_iic_softc *sc = device_private(self); struct obio_attach_args *obio = opaque; + int scheme, major, minor, fifodepth, fifo; uint16_t rev; #ifdef TI_AM335X int i; @@ -219,8 +220,6 @@ ti_iic_attach(device_t parent, device_t sc->sc_ic.ic_release_bus = ti_iic_release_bus; sc->sc_ic.ic_exec = ti_iic_exec; - sc->sc_rxthres = sc->sc_txthres = 4; - if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size, 0, >sc_ioh) != 0) { aprint_error(": couldn't map address space\n"); @@ -248,27 +247,40 @@ ti_iic_attach(device_t parent, device_t snprintf(buf, sizeof(buf), "%s_SDA", am335x_iic[i].as_name); if (sitara_cm_padconf_get(buf, , ) == 0) { aprint_debug(": SDA mode %s state %d ", mode, state); - } - if (sitara_cm_padconf_set(buf, buf, - (0x01 << 4) | (0x01 << 5) | (0x01 << 6)) != 0) { - aprint_error(": can't switch %s pad\n", buf); - return; + + if (sitara_cm_padconf_set(buf, buf, + (0x01 << 4) | (0x01 << 5) | (0x01 << 6)) != 0) { + aprint_error(": can't switch %s pad\n", buf); + return; + } } snprintf(buf, sizeof(buf), "%s_SCL", am335x_iic[i].as_name); if (sitara_cm_padconf_get(buf, , ) == 0) { aprint_debug(": SCL mode %s state %d ", mode, state); - } - if (sitara_cm_padconf_set(buf, buf, - (0x01 << 4) | (0x01 << 5) | (0x01 << 6)) != 0) { - aprint_error(": can't switch %s pad\n", buf); - return; + + if (sitara_cm_padconf_set(buf, buf, + (0x01 << 4) | (0x01 << 5) | (0x01 << 6)) != 0) { + aprint_error(": can't switch %s pad\n", buf); + return; + } } #endif + scheme = I2C_REVNB_HI_SCHEME(I2C_READ_REG(sc, OMAP2_I2C_REVNB_HI)); rev = I2C_READ_REG(sc, OMAP2_I2C_REVNB_LO); - aprint_normal(": rev %d.%d\n", - (int)I2C_REVNB_LO_MAJOR(rev), - (int)I2C_REVNB_LO_MINOR(rev)); + if (scheme == 0) { + major = I2C_REV_SCHEME_0_MAJOR(rev); + minor = I2C_REV_SCHEME_0_MINOR(rev); + } else { + major = I2C_REVNB_LO_MAJOR(rev); + minor = I2C_REVNB_LO_MINOR(rev); + } + aprint_normal(": rev %d.%d, scheme %d\n", major, minor, scheme); + + fifodepth = I2C_BUFSTAT_FIFODEPTH(I2C_READ_REG(sc, OMAP2_I2C_BUFSTAT)); + fifo = OMAP2_I2C_FIFOBYTES(fifodepth); + aprint_normal_dev(self, "%d-bytes FIFO\n", fifo); + sc->sc_rxthres = sc->sc_txthres = fifo >> 1; ti_iic_reset(sc); ti_iic_flush(sc); @@ -310,9 +322,9 @@ ti_iic_intr(void *arg) mutex_enter(>sc_mtx); DPRINTF(("ti_iic_intr\n")); stat = I2C_READ_REG(sc, OMAP2_I2C_IRQSTATUS); - I2C_WRITE_REG(sc, OMAP2_I2C_IRQSTATUS, stat); DPRINTF(("ti_iic_intr pre handle sc->sc_op eq %#x\n", sc->sc_op)); ti_iic_handle_intr(sc, stat); + I2C_WRITE_REG(sc, OMAP2_I2C_IRQSTATUS, stat); if (sc->sc_op == TI_I2CERROR || sc->sc_op == TI_I2CDONE) { DPRINTF(("ti_iic_intr post handle sc->sc_op %#x\n", sc->sc_op)); cv_signal(>sc_cv); @@ -418,7 +430,7 @@ ti_iic_reset(struct ti_iic_softc *sc) aprint_error_dev(sc->sc_dev, ": couldn't reset module\n"); return 1; } - + /* XXX standard speed only */ psc = 3; @@ -451,7 +463,7 @@ ti_iic_op(struct ti_iic_softc *sc, i2c_a int err, retry; KASSERT(op == TI_I2CREAD || op == TI_I2CWRITE); - DPRINTF(("ti_iic_op: addr %#x op %#x buf %p buflen %#x flags %#x\n", + DPRINTF(("ti_iic_op: addr %#x op %#x buf %p buflen %#x flags %#x\n", addr, op, buf, (unsigned int) buflen, flags)); mask = I2C_IRQSTATUS_ARDY | I2C_IRQSTATUS_NACK |
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Oct 15 15:08:59 UTC 2016 Modified Files: src/sys/arch/arm/omap: ti_iic.c ti_iicreg.h Log Message: Fix broken settings for AM335X's I2C[12]. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/ti_iic.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/ti_iicreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Oct 15 15:00:13 UTC 2016 Modified Files: src/sys/arch/arm/omap: ti_iic.c Log Message: Add support OMAP_4430. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/omap/ti_iic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Oct 15 15:00:13 UTC 2016 Modified Files: src/sys/arch/arm/omap: ti_iic.c Log Message: Add support OMAP_4430. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/omap/ti_iic.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/omap/ti_iic.c diff -u src/sys/arch/arm/omap/ti_iic.c:1.7 src/sys/arch/arm/omap/ti_iic.c:1.8 --- src/sys/arch/arm/omap/ti_iic.c:1.7 Wed Mar 26 11:59:05 2014 +++ src/sys/arch/arm/omap/ti_iic.c Sat Oct 15 15:00:12 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_iic.c,v 1.7 2014/03/26 11:59:05 ozaki-r Exp $ */ +/* $NetBSD: ti_iic.c,v 1.8 2016/10/15 15:00:12 kiyohara Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.7 2014/03/26 11:59:05 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.8 2016/10/15 15:00:12 kiyohara Exp $"); #include "opt_omap.h" #include "locators.h" @@ -183,6 +183,13 @@ ti_iic_match(device_t parent, cfdata_t m obio->obio_addr == OMAP2_I2C2_BASE) return 1; #endif +#if defined(OMAP_4430) + if (obio->obio_addr == 0x4807 || /* I2C1 */ + obio->obio_addr == 0x48072000 || /* I2C2 */ + obio->obio_addr == 0x4806 || /* I2C3 */ + obio->obio_addr == 0x4835) /* I2C4 */ + return 1; +#endif return 0; }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: christos Date: Wed Oct 5 16:27:15 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: fix typo To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.28 src/sys/arch/arm/omap/omap3_sdhc.c:1.29 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.28 Wed Oct 5 09:37:48 2016 +++ src/sys/arch/arm/omap/omap3_sdhc.c Wed Oct 5 12:27:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.28 2016/10/05 13:37:48 christos Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.29 2016/10/05 16:27:15 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.28 2016/10/05 13:37:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.29 2016/10/05 16:27:15 christos Exp $"); #include "opt_omap.h" #include "edma.h" @@ -200,7 +200,7 @@ obiosdhc_match(device_t parent, cfdata_t #endif #ifdef TI_AM335X - for (size _t i = 0; i < __arraycount(am335x_mmchs); i++) + for (size_t i = 0; i < __arraycount(am335x_mmchs); i++) if (device_is_a(parent, am335x_mmchs[i].as_parent_name) && (oa->obio_addr == am335x_mmchs[i].as_base_addr) && (oa->obio_intr == am335x_mmchs[i].as_intr))
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: christos Date: Wed Oct 5 16:27:15 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: fix typo To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/omap/omap3_sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: christos Date: Wed Oct 5 13:37:48 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: fix compilation. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.27 src/sys/arch/arm/omap/omap3_sdhc.c:1.28 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.27 Wed Oct 5 09:12:08 2016 +++ src/sys/arch/arm/omap/omap3_sdhc.c Wed Oct 5 09:37:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.27 2016/10/05 13:12:08 kiyohara Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.28 2016/10/05 13:37:48 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.27 2016/10/05 13:12:08 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.28 2016/10/05 13:37:48 christos Exp $"); #include "opt_omap.h" #include "edma.h" @@ -178,9 +178,7 @@ static int obiosdhc_match(device_t parent, cfdata_t cf, void *aux) { struct obio_attach_args * const oa = aux; -#ifdef TI_AM335X - size_t i; -#endif + __USE(oa); // Simpler than complex ifdef. #if defined(OMAP_3430) if (oa->obio_addr == SDMMC1_BASE_3430 @@ -202,7 +200,7 @@ obiosdhc_match(device_t parent, cfdata_t #endif #ifdef TI_AM335X - for (i = 0; i < __arraycount(am335x_mmchs); i++) + for (size _t i = 0; i < __arraycount(am335x_mmchs); i++) if (device_is_a(parent, am335x_mmchs[i].as_parent_name) && (oa->obio_addr == am335x_mmchs[i].as_base_addr) && (oa->obio_intr == am335x_mmchs[i].as_intr))
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Wed Oct 5 13:12:08 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: Fix rejected patch. Support am335x's MMCHS2(sdhc@mainbus). Tested on Gumstix Pepper 43C. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/omap/omap3_sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Wed Oct 5 13:12:08 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: Fix rejected patch. Support am335x's MMCHS2(sdhc@mainbus). Tested on Gumstix Pepper 43C. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.26 src/sys/arch/arm/omap/omap3_sdhc.c:1.27 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.26 Tue Oct 4 16:06:42 2016 +++ src/sys/arch/arm/omap/omap3_sdhc.c Wed Oct 5 13:12:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.26 2016/10/04 16:06:42 kiyohara Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.27 2016/10/05 13:12:08 kiyohara Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.26 2016/10/04 16:06:42 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.27 2016/10/05 13:12:08 kiyohara Exp $"); #include "opt_omap.h" #include "edma.h" @@ -483,32 +483,36 @@ no_dma: delay(1); } if (timo == 0) - aprint_error_dev(self, "Soft reset timeout\n"); + aprint_error_dev(dev, "Soft reset timeout\n"); bus_space_write_4(sc->sc_bst, sc->sc_bsh, MMCHS_SYSCONFIG, - SYSCONFIG_ENAWAKEUP | SYSCONFIG_AUTOIDLE | SYSCONFIG_SIDLEMODE_AUTO | - SYSCONFIG_CLOCKACTIVITY_FCLK | SYSCONFIG_CLOCKACTIVITY_ICLK); + SYSCONFIG_ENAWAKEUP | + SYSCONFIG_AUTOIDLE | + SYSCONFIG_SIDLEMODE_AUTO | + SYSCONFIG_CLOCKACTIVITY_FCLK | + SYSCONFIG_CLOCKACTIVITY_ICLK); - sc->sc_ih = intr_establish(oa->obio_intr, IPL_VM, IST_LEVEL, + sc->sc_ih = intr_establish(sc->sc_irq, IPL_VM, IST_LEVEL, sdhc_intr, >sc); if (sc->sc_ih == NULL) { - aprint_error_dev(self, "failed to establish interrupt %d\n", - oa->obio_intr); - goto fail; + aprint_error_dev(dev, "failed to establish interrupt %d\n", + sc->sc_irq); + return; } error = sdhc_host_found(>sc, sc->sc_bst, sc->sc_sdhc_bsh, - oa->obio_size - OMAP3_SDMMC_SDHC_OFFSET); + OMAP3_SDMMC_SDHC_SIZE); if (error != 0) { - aprint_error_dev(self, "couldn't initialize host, error=%d\n", + aprint_error_dev(dev, "couldn't initialize host, error=%d\n", error); - goto fail; + intr_disestablish(sc->sc_ih); + return; } + clksft = ffs(sc->sc.sc_clkmsk) - 1; + /* Set SDVS 1.8v and DTW 1bit mode */ SDHC_WRITE(sc, SDHC_HOST_CTL, SDHC_VOLTAGE_1_8V << (SDHC_VOLTAGE_SHIFT + 8)); - bus_space_write_4(sc->sc_bst, sc->sc_bsh, MMCHS_CON, - bus_space_read_4(sc->sc_bst, sc->sc_bsh, MMCHS_CON) | CON_OD); SDHC_WRITE(sc, SDHC_CLOCK_CTL, SDHC_READ(sc, SDHC_CLOCK_CTL) | SDHC_INTCLK_ENABLE | SDHC_SDCLK_ENABLE);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 16:10:34 UTC 2016 Modified Files: src/sys/arch/arm/omap: files.omap2 Log Message: Support am335x's MMCHS2(sdhc@mainbus). Tested on Gumstix Pepper 43C. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/omap/files.omap2 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/omap/files.omap2 diff -u src/sys/arch/arm/omap/files.omap2:1.34 src/sys/arch/arm/omap/files.omap2:1.35 --- src/sys/arch/arm/omap/files.omap2:1.34 Tue Oct 4 15:23:40 2016 +++ src/sys/arch/arm/omap/files.omap2 Tue Oct 4 16:10:34 2016 @@ -1,4 +1,4 @@ -# $NetBSD: files.omap2,v 1.34 2016/10/04 15:23:40 kiyohara Exp $ +# $NetBSD: files.omap2,v 1.35 2016/10/04 16:10:34 kiyohara Exp $ # # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support # Based on xscale/files.pxa2x0 @@ -134,8 +134,9 @@ file arch/arm/omap/tiotg.c tiotg attach motg at tiotg_port # SDMMC controller +attach sdhc at mainbus with mainbussdhc attach sdhc at obio with obiosdhc -file arch/arm/omap/omap3_sdhc.c obiosdhc +file arch/arm/omap/omap3_sdhc.c mainbussdhc | obiosdhc # NAND flash controller device omapnand: nandbus
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 16:10:34 UTC 2016 Modified Files: src/sys/arch/arm/omap: files.omap2 Log Message: Support am335x's MMCHS2(sdhc@mainbus). Tested on Gumstix Pepper 43C. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/omap/files.omap2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 16:06:42 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: Support am335x's MMCHS2(sdhc@mainbus). Tested on Gumstix Pepper 43C. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.25 src/sys/arch/arm/omap/omap3_sdhc.c:1.26 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.25 Tue Oct 4 15:51:34 2016 +++ src/sys/arch/arm/omap/omap3_sdhc.c Tue Oct 4 16:06:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.25 2016/10/04 15:51:34 kiyohara Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.26 2016/10/04 16:06:42 kiyohara Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.25 2016/10/04 15:51:34 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.26 2016/10/04 16:06:42 kiyohara Exp $"); #include "opt_omap.h" #include "edma.h" @@ -37,6 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c #include #include #include +#include #include #include #include @@ -49,8 +50,10 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c #include #ifdef TI_AM335X +# include # include # include +# include # include # include #endif @@ -82,25 +85,19 @@ int om3sdhcdebug = 1; #define SDHC_WRITE(sc, reg, val) \ bus_space_write_4((sc)->sc_bst, (sc)->sc_sdhc_bsh, (reg), (val)) -static int obiosdhc_match(device_t, cfdata_t, void *); -static void obiosdhc_attach(device_t, device_t, void *); -static int obiosdhc_detach(device_t, int); - -static int obiosdhc_bus_width(struct sdhc_softc *, int); -static int obiosdhc_rod(struct sdhc_softc *, int); -static int obiosdhc_write_protect(struct sdhc_softc *); -static int obiosdhc_card_detect(struct sdhc_softc *); - -struct obiosdhc_softc { +struct mmchs_softc { struct sdhc_softc sc; + bus_addr_t sc_addr; bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; bus_space_handle_t sc_hl_bsh; bus_space_handle_t sc_sdhc_bsh; struct sdhc_host *sc_hosts[1]; + int sc_irq; void *sc_ih; /* interrupt vectoring */ #if NEDMA > 0 + int sc_edmabase; struct edma_channel *sc_edma_tx; struct edma_channel *sc_edma_rx; uint16_t sc_edma_param_tx[EDMA_MAX_PARAMS]; @@ -114,26 +111,45 @@ struct obiosdhc_softc { #endif }; +static int obiosdhc_match(device_t, cfdata_t, void *); +static void obiosdhc_attach(device_t, device_t, void *); +#ifdef TI_AM335X +static int mainbussdhc_match(device_t, cfdata_t, void *); +static void mainbussdhc_attach(device_t, device_t, void *); +#endif +static int mmchs_detach(device_t, int); + +static int mmchs_attach(struct mmchs_softc *); +static void mmchs_init(device_t); + +static int mmchs_bus_width(struct sdhc_softc *, int); +static int mmchs_rod(struct sdhc_softc *, int); +static int mmchs_write_protect(struct sdhc_softc *); +static int mmchs_card_detect(struct sdhc_softc *); + #if NEDMA > 0 -static int obiosdhc_edma_init(struct obiosdhc_softc *, unsigned int); -static int obiosdhc_edma_xfer_data(struct sdhc_softc *, struct sdmmc_command *); -static void obiosdhc_edma_done(void *); -static int obiosdhc_edma_transfer(struct sdhc_softc *, struct sdmmc_command *); +static int mmchs_edma_init(struct mmchs_softc *, unsigned int); +static int mmchs_edma_xfer_data(struct sdhc_softc *, struct sdmmc_command *); +static void mmchs_edma_done(void *); +static int mmchs_edma_transfer(struct sdhc_softc *, struct sdmmc_command *); #endif #ifdef TI_AM335X -struct am335x_sdhc { +struct am335x_mmchs { const char *as_name; + const char *as_parent_name; bus_addr_t as_base_addr; int as_intr; struct omap_module as_module; }; -static const struct am335x_sdhc am335x_sdhc[] = { - /* XXX All offset by 0x100 because of the am335x's mmc registers. */ - { "MMCHS0", SDMMC1_BASE_TIAM335X, 64, { AM335X_PRCM_CM_PER, 0x3c } }, - { "MMC1", SDMMC2_BASE_TIAM335X, 28, { AM335X_PRCM_CM_PER, 0xf4 } }, - { "MMCHS2", SDMMC3_BASE_TIAM335X, 29, { AM335X_PRCM_CM_WKUP, 0xf8 } }, +static const struct am335x_mmchs am335x_mmchs[] = { + { "MMCHS0", "obio", + SDMMC1_BASE_TIAM335X, 64, { AM335X_PRCM_CM_PER, 0x3c } }, + { "MMC1", "obio", + SDMMC2_BASE_TIAM335X, 28, { AM335X_PRCM_CM_PER, 0xf4 } }, + { "MMCHS2", "mainbus", + SDMMC3_BASE_TIAM335X, 29, { AM335X_PRCM_CM_PER, 0xf8 } }, }; struct am335x_padconf { @@ -155,17 +171,14 @@ const struct am335x_padconf am335x_padco }; #endif -CFATTACH_DECL_NEW(obiosdhc, sizeof(struct obiosdhc_softc), -obiosdhc_match, obiosdhc_attach, obiosdhc_detach, NULL); +CFATTACH_DECL_NEW(obiosdhc, sizeof(struct mmchs_softc), +obiosdhc_match, obiosdhc_attach, mmchs_detach, NULL); static int obiosdhc_match(device_t parent,
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 16:03:39 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_reg.h sitara_cm.c sitara_cmreg.h Log Message: Print am335x ID and fetures. Also add omap_{chip,dev}id(). To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/omap/omap2_reg.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/sitara_cm.c \ src/sys/arch/arm/omap/sitara_cmreg.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/omap/omap2_reg.h diff -u src/sys/arch/arm/omap/omap2_reg.h:1.33 src/sys/arch/arm/omap/omap2_reg.h:1.34 --- src/sys/arch/arm/omap/omap2_reg.h:1.33 Mon Jul 11 14:51:11 2016 +++ src/sys/arch/arm/omap/omap2_reg.h Tue Oct 4 16:03:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_reg.h,v 1.33 2016/07/11 14:51:11 kiyohara Exp $ */ +/* $NetBSD: omap2_reg.h,v 1.34 2016/10/04 16:03:39 kiyohara Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -163,6 +163,18 @@ #define DEVID_AMDM37X_ES11 0x1b89102f #define DEVID_AMDM37X_ES12 0x2b89102f +#define CHIPID_AM3351 0x00fc0302 +#define CHIPID_AM3352 0x00fc0382 +#define CHIPID_AM3354 0x20fc0382 +#define CHIPID_AM3356 0x00fd0383 +#define CHIPID_AM3357 0x00ff0383 +#define CHIPID_AM3358 0x20fd0383 +#define CHIPID_AM3359 0x20ff0383 + +#define DEVID_AM335X_SR_10 0x0b94402e +#define DEVID_AM335X_SR_20 0x1b94402e +#define DEVID_AM335X_SR_21 0x2b94402e + /* * Clock Management registers base, offsets, and size */ Index: src/sys/arch/arm/omap/sitara_cm.c diff -u src/sys/arch/arm/omap/sitara_cm.c:1.2 src/sys/arch/arm/omap/sitara_cm.c:1.3 --- src/sys/arch/arm/omap/sitara_cm.c:1.2 Sat Oct 18 08:33:24 2014 +++ src/sys/arch/arm/omap/sitara_cm.c Tue Oct 4 16:03:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sitara_cm.c,v 1.2 2014/10/18 08:33:24 snj Exp $ */ +/* $NetBSD: sitara_cm.c,v 1.3 2016/10/04 16:03:39 kiyohara Exp $ */ /* * Copyright (c) 2010 * Ben Gray. @@ -47,7 +47,7 @@ * */ #include -__KERNEL_RCSID(0, "$NetBSD: sitara_cm.c,v 1.2 2014/10/18 08:33:24 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sitara_cm.c,v 1.3 2016/10/04 16:03:39 kiyohara Exp $"); #include "opt_omap.h" @@ -60,13 +60,17 @@ __KERNEL_RCSID(0, "$NetBSD: sitara_cm.c, #include #include +#include #include #include struct sitara_cm_softc { -device_tsc_dev; - bus_space_tag_t sc_iot; - bus_space_handle_t sc_ioh; + device_t sc_dev; + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + + uint32_t sc_cid; /* Chip Identification */ + uint32_t sc_did; /* Device IDCODE */ }; @@ -391,6 +395,15 @@ sitara_cm_attach(device_t parent, device struct sitara_cm_softc *sc = device_private(self); struct obio_attach_args *obio = opaque; uint32_t rev; + char cid, buf[256]; + const char *did; + const char *fmt = "\177\020" + "b\0ICSS\0" + "b\1CPSW\0" + "b\7DCAN\0" + "f\16\1ICSS_FEA EtherCAT functionality\0=\0disabled\0=\1enabled\0" + "f\17\1ICSS_FEA TX_AUTO_SEQUENCE\0=\0disabled\0=\1enabled\0" + "b\29SGX\0"; aprint_naive("\n"); @@ -412,4 +425,60 @@ sitara_cm_attach(device_t parent, device panic("sitara_cm_attach: read revision"); aprint_normal(": control module, rev %d.%d\n", SCM_REVISION_MAJOR(rev), SCM_REVISION_MINOR(rev)); + + sitara_cm_reg_read_4(OMAP2SCM_DEVID, >sc_did); + sitara_cm_reg_read_4(OMAP2SCM_DEV_FEATURE, >sc_cid); + switch (sc->sc_cid) { + case CHIPID_AM3351: cid = '1'; break; + case CHIPID_AM3352: cid = '2'; break; + case CHIPID_AM3354: cid = '4'; break; + case CHIPID_AM3356: cid = '6'; break; + case CHIPID_AM3357: cid = '7'; break; + case CHIPID_AM3358: cid = '8'; break; + case CHIPID_AM3359: cid = '9'; break; + default: + aprint_normal_dev(self, "unknwon ChipID found 0x%08x\n", + sc->sc_cid); + cid = 'x'; + break; + } + aprint_normal_dev(self, "AM335%c", cid); + switch (sc->sc_did) { + case DEVID_AM335X_SR_10: did = "1.0"; break; + case DEVID_AM335X_SR_20: did = "2.0"; break; + case DEVID_AM335X_SR_21: did = "2.1"; break; + default: + aprint_normal_dev(self, "unknwon DeviceID found 0x%08x\n", + sc->sc_did); + did = NULL; + break; + } + if (did != NULL) + aprint_normal(" Silicon Revision %s", did); + snprintb(buf, sizeof(buf), fmt, sc->sc_cid); + aprint_normal(": %s\n", buf); +} + +uint32_t +omap_chipid(void) +{ + struct sitara_cm_softc *sc; + device_t dev; + + dev = device_find_by_xname("sitaracm0"); + KASSERT(dev != NULL); + sc = device_private(dev); + return sc->sc_cid; +} + +uint32_t +omap_devid(void) +{ + struct sitara_cm_softc *sc; + device_t dev; + + dev = device_find_by_xname("sitaracm0"); + KASSERT(dev != NULL); + sc = device_private(dev); + return sc->sc_did; } Index: src/sys/arch/arm/omap/sitara_cmreg.h diff -u src/sys/arch/arm/omap/sitara_cmreg.h:1.2 src/sys/arch/arm/omap/sitara_cmreg.h:1.3 --- src/sys/arch/arm/omap/sitara_cmreg.h:1.2 Wed Jul 16 18:25:24
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 16:03:39 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_reg.h sitara_cm.c sitara_cmreg.h Log Message: Print am335x ID and fetures. Also add omap_{chip,dev}id(). To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/omap/omap2_reg.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/sitara_cm.c \ src/sys/arch/arm/omap/sitara_cmreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:59:36 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_ehci.c Log Message: Support extclk. This value get from prop-dictionary "port?-extclk". To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/omap/omap3_ehci.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/omap/omap3_ehci.c diff -u src/sys/arch/arm/omap/omap3_ehci.c:1.11 src/sys/arch/arm/omap/omap3_ehci.c:1.12 --- src/sys/arch/arm/omap/omap3_ehci.c:1.11 Sat Apr 23 10:15:28 2016 +++ src/sys/arch/arm/omap/omap3_ehci.c Tue Oct 4 15:59:36 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_ehci.c,v 1.11 2016/04/23 10:15:28 skrll Exp $ */ +/* $NetBSD: omap3_ehci.c,v 1.12 2016/10/04 15:59:36 kiyohara Exp $ */ /*- * Copyright (c) 2010-2012 Jared D. McNeill@@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_ehci.c,v 1.11 2016/04/23 10:15:28 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_ehci.c,v 1.12 2016/10/04 15:59:36 kiyohara Exp $"); #include "locators.h" @@ -196,6 +196,7 @@ struct omap3_ehci_softc { enum omap3_ehci_port_mode mode; int gpio; bool value; + bool extclk; } sc_portconfig[3]; struct { uint16_t m, n, m2; @@ -405,15 +406,24 @@ omap3_ehci_parse_properties(struct omap3 sc->sc_portconfig[0].mode = omap3_ehci_get_port_mode(prop, "port0-mode"); sc->sc_portconfig[0].gpio = omap3_ehci_get_port_gpio(prop, "port0-gpio"); prop_dictionary_get_bool(prop, "port0-gpioval", >sc_portconfig[0].value); +#if defined(OMAP4) || defined(OMAP5) + prop_dictionary_get_bool(prop, "port0-extclk", >sc_portconfig[0].extclk); +#endif if (sc->sc_nports > 1) { sc->sc_portconfig[1].mode = omap3_ehci_get_port_mode(prop, "port1-mode"); sc->sc_portconfig[1].gpio = omap3_ehci_get_port_gpio(prop, "port1-gpio"); prop_dictionary_get_bool(prop, "port1-gpioval", >sc_portconfig[1].value); +#if defined(OMAP4) || defined(OMAP5) + prop_dictionary_get_bool(prop, "port1-extclk", >sc_portconfig[1].extclk); +#endif } if (sc->sc_nports > 2) { sc->sc_portconfig[2].mode = omap3_ehci_get_port_mode(prop, "port2-mode"); sc->sc_portconfig[2].gpio = omap3_ehci_get_port_gpio(prop, "port2-gpio"); prop_dictionary_get_bool(prop, "port2-gpioval", >sc_portconfig[2].value); +#if defined(OMAP4) || defined(OMAP5) + prop_dictionary_get_bool(prop, "port2-extclk", >sc_portconfig[2].extclk); +#endif } #ifdef OMAP_3XXX @@ -670,17 +680,43 @@ omap4_usbhost_init(struct omap3_ehci_sof KASSERT(err == 0); val = bus_space_read_4(iot, ioh, OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL); - val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P3_CLK - | OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P2_CLK - | OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P3_CLK - | OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P2_CLK - | OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P3_CLK - | OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P2_CLK; + if (sc->sc_portconfig[0].mode != OMAP3_EHCI_PORT_MODE_NONE) { + if (sc->sc_portconfig[0].extclk) + val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_CLKSEL_UTMI_P1; + else + val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P1_CLK; + if (sc->sc_portconfig[0].mode == OMAP3_EHCI_PORT_MODE_HSIC) + val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P1_CLK + | OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P1_CLK; + } + if (sc->sc_nports > 1 + && sc->sc_portconfig[1].mode != OMAP3_EHCI_PORT_MODE_NONE) { + if (sc->sc_portconfig[1].extclk) + val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_CLKSEL_UTMI_P2; + else + val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P2_CLK; + if (sc->sc_portconfig[1].mode == OMAP3_EHCI_PORT_MODE_HSIC) + val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P2_CLK + | OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P2_CLK; + } + if (sc->sc_nports > 2 + && sc->sc_portconfig[2].mode != OMAP3_EHCI_PORT_MODE_NONE) { + val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P3_CLK; + if (sc->sc_portconfig[2].mode == OMAP3_EHCI_PORT_MODE_HSIC) + val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P3_CLK + | OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P3_CLK; + } bus_space_write_4(iot, ioh, OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL, val); val = bus_space_read_4(iot, ioh, OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL); - val |= OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH2_CLK - | OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH1_CLK; + if (sc->sc_portconfig[0].mode != OMAP3_EHCI_PORT_MODE_NONE) + val |= OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH0_CLK; + if (sc->sc_nports > 1 + && sc->sc_portconfig[1].mode != OMAP3_EHCI_PORT_MODE_NONE) + val |= OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH1_CLK; + if
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:59:36 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_ehci.c Log Message: Support extclk. This value get from prop-dictionary "port?-extclk". To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/omap/omap3_ehci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:47:53 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdmmcreg.h Log Message: Add OMAP4430 MMCHS_CON macros. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap3_sdmmcreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:54:10 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2430_intr.h Log Message: am335x's main interrupt source is 128. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omap2430_intr.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/omap/omap2430_intr.h diff -u src/sys/arch/arm/omap/omap2430_intr.h:1.4 src/sys/arch/arm/omap/omap2430_intr.h:1.5 --- src/sys/arch/arm/omap/omap2430_intr.h:1.4 Sat Jul 14 07:42:57 2012 +++ src/sys/arch/arm/omap/omap2430_intr.h Tue Oct 4 15:54:09 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2430_intr.h,v 1.4 2012/07/14 07:42:57 matt Exp $ */ +/* $NetBSD: omap2430_intr.h,v 1.5 2016/10/04 15:54:09 kiyohara Exp $ */ /* * Define the SDP2430 specific information and then include the generic OMAP @@ -161,7 +161,11 @@ uint32_t omap_microtimer_interval(uint32 #define IRQ_MMC3 94 /* (3530) MMC/SD module 3 */ #define IRQ_GPT12_3530 95 /* (3530) GPT12 */ +#if defined(TI_AM335X) +#define PIC_MAXSOURCES 128 +#else #define PIC_MAXSOURCES 96 +#endif #define PIC_MAXMAXSOURCES (PIC_MAXSOURCES+192) void omap_irq_handler(void *);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:54:10 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2430_intr.h Log Message: am335x's main interrupt source is 128. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omap2430_intr.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:46:07 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_uhhreg.h Log Message: Fix revision value. VERS2 is 0. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap3_uhhreg.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/omap/omap3_uhhreg.h diff -u src/sys/arch/arm/omap/omap3_uhhreg.h:1.3 src/sys/arch/arm/omap/omap3_uhhreg.h:1.4 --- src/sys/arch/arm/omap/omap3_uhhreg.h:1.3 Sat Mar 29 23:32:41 2014 +++ src/sys/arch/arm/omap/omap3_uhhreg.h Tue Oct 4 15:46:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_uhhreg.h,v 1.3 2014/03/29 23:32:41 matt Exp $ */ +/* $NetBSD: omap3_uhhreg.h,v 1.4 2016/10/04 15:46:07 kiyohara Exp $ */ /*- * Copyright (c) 2010 Jared D. McNeill@@ -32,7 +32,7 @@ #define UHH_REVISION0x00 #define UHH_REVISION_MAJOR(x) (((x) >> 4) & 0xf) #define UHH_REVISION_MINOR(x) ((x) & 0xf) -#define UHH_REVISION_VERS2 2 +#define UHH_REVISION_VERS2 0 #define UHH_HWINFO0x04 #define UHH_HWINFO_SAR_CNTX_SIZE __BITS(9,0)
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:46:07 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_uhhreg.h Log Message: Fix revision value. VERS2 is 0. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap3_uhhreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:51:34 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: Support ADMA2 on OMAP4430. Tested on Gumstix DuoVero. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/omap/omap3_sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:51:34 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: Support ADMA2 on OMAP4430. Tested on Gumstix DuoVero. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.24 src/sys/arch/arm/omap/omap3_sdhc.c:1.25 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.24 Mon Aug 15 13:02:07 2016 +++ src/sys/arch/arm/omap/omap3_sdhc.c Tue Oct 4 15:51:34 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.24 2016/08/15 13:02:07 mlelstv Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.25 2016/10/04 15:51:34 kiyohara Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.24 2016/08/15 13:02:07 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.25 2016/10/04 15:51:34 kiyohara Exp $"); #include "opt_omap.h" #include "edma.h" @@ -259,8 +259,8 @@ obiosdhc_attach(device_t parent, device_ */ sc->sc.sc_flags |= SDHC_FLAG_NO_HS_BIT; -// sc->sc.sc_flags |= SDHC_FLAG_USE_DMA; -// sc->sc.sc_flags |= SDHC_FLAG_USE_ADMA2; + sc->sc.sc_flags |= SDHC_FLAG_USE_DMA; + sc->sc.sc_flags |= SDHC_FLAG_USE_ADMA2; #endif sc->sc.sc_host = sc->sc_hosts; sc->sc.sc_clkbase = 96000; /* 96MHZ */ @@ -480,6 +480,11 @@ no_dma: SDHC_WRITE(sc, SDHC_CLOCK_CTL, SDHC_READ(sc, SDHC_CLOCK_CTL) | SDHC_SDCLK_ENABLE); + if (sc->sc.sc_flags & SDHC_FLAG_USE_ADMA2) + bus_space_write_4(sc->sc_bst, sc->sc_bsh, MMCHS_CON, + bus_space_read_4(sc->sc_bst, sc->sc_bsh, MMCHS_CON) | + CON_MNS); + return; fail:
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:47:53 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdmmcreg.h Log Message: Add OMAP4430 MMCHS_CON macros. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap3_sdmmcreg.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/omap/omap3_sdmmcreg.h diff -u src/sys/arch/arm/omap/omap3_sdmmcreg.h:1.9 src/sys/arch/arm/omap/omap3_sdmmcreg.h:1.10 --- src/sys/arch/arm/omap/omap3_sdmmcreg.h:1.9 Thu Aug 4 07:14:50 2016 +++ src/sys/arch/arm/omap/omap3_sdmmcreg.h Tue Oct 4 15:47:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdmmcreg.h,v 1.9 2016/08/04 07:14:50 kiyohara Exp $ */ +/* $NetBSD: omap3_sdmmcreg.h,v 1.10 2016/10/04 15:47:53 kiyohara Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -92,6 +92,11 @@ #define MMCHS_CSRE 0x024 /* Card status response error */ #define MMCHS_SYSTEST 0x028 /* System Test */ #define MMCHS_CON 0x02c /* Configuration */ +# define CON_SDMA_LNE (1 << 21) /*Slave DMA Lvl/Edg Rq*/ +# define CON_MNS (1 << 20) /* DMA Mstr/Slv sel */ +# define CON_DDR (1 << 19) /* Dual Data Rate */ +# define CON_CF0 (1 << 18) /*Boot status support*/ +# define CON_BOOTACK (1 << 17) /*Boot acknowledge rcv*/ # define CON_CLKEXTFREE (1 << 16) # define CON_PADEN (1 << 15) /* Ctrl Pow for MMC */ # define CON_OBIE (1 << 14) /* Out-of-Band Intr */
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:38:31 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_icu.c Log Message: am335x's main interrupt source is 128. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap2_icu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:38:31 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_icu.c Log Message: am335x's main interrupt source is 128. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap2_icu.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/omap/omap2_icu.c diff -u src/sys/arch/arm/omap/omap2_icu.c:1.9 src/sys/arch/arm/omap/omap2_icu.c:1.10 --- src/sys/arch/arm/omap/omap2_icu.c:1.9 Mon Aug 20 12:38:28 2012 +++ src/sys/arch/arm/omap/omap2_icu.c Tue Oct 4 15:38:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_icu.c,v 1.9 2012/08/20 12:38:28 matt Exp $ */ +/* $NetBSD: omap2_icu.c,v 1.10 2016/10/04 15:38:31 kiyohara Exp $ */ /* * Define the SDP2430 specific information and then include the generic OMAP * interrupt header. @@ -30,7 +30,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: omap2_icu.c,v 1.9 2012/08/20 12:38:28 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_icu.c,v 1.10 2016/10/04 15:38:31 kiyohara Exp $"); #include #include @@ -82,11 +82,19 @@ static struct omap2icu_softc { bus_space_tag_t sc_memt; bus_space_handle_t sc_memh; struct pic_softc sc_pic; +#if defined(TI_AM335X) + uint32_t sc_enabled_irqs[4]; +#else uint32_t sc_enabled_irqs[3]; +#endif } omap2icu_softc = { .sc_pic = { .pic_ops = _picops, +#if defined(TI_AM335X) + .pic_maxsources = 128, +#else .pic_maxsources = 96, +#endif .pic_name = "omap2icu", }, }; @@ -161,7 +169,7 @@ omap_irq_handler(void *frame) void omap2icu_establish_irq(struct pic_softc *pic, struct intrsource *is) { - KASSERT(is->is_irq < 96); + KASSERT(is->is_irq < omap2icu_softc.sc_pic.pic_maxsources); KASSERT(is->is_type == IST_LEVEL); }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:32:03 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_nand.c Log Message: Remove a comment-out-ed and no-need line. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/omap2_nand.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/omap/omap2_nand.c diff -u src/sys/arch/arm/omap/omap2_nand.c:1.5 src/sys/arch/arm/omap/omap2_nand.c:1.6 --- src/sys/arch/arm/omap/omap2_nand.c:1.5 Sat Oct 27 17:17:40 2012 +++ src/sys/arch/arm/omap/omap2_nand.c Tue Oct 4 15:32:02 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_nand.c,v 1.5 2012/10/27 17:17:40 chs Exp $ */ +/* $NetBSD: omap2_nand.c,v 1.6 2016/10/04 15:32:02 kiyohara Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap2_nand.c,v 1.5 2012/10/27 17:17:40 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_nand.c,v 1.6 2016/10/04 15:32:02 kiyohara Exp $"); #include "opt_omap.h" #include "opt_flash.h" @@ -209,7 +209,6 @@ omap2_nand_attach(device_t parent, devic sc->sc_dev = self; sc->sc_cs = gpmc->gpmc_cs; -// cs_offset = GPMC_BASE + GPMC_CONFIG1_0 + sc->sc_cs * GPMC_CS_SIZE; cs_offset = GPMC_CS_CONFIG_BASE(sc->sc_cs); /* map i/o space */
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:32:03 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_nand.c Log Message: Remove a comment-out-ed and no-need line. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/omap2_nand.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:23:40 UTC 2016 Modified Files: src/sys/arch/arm/omap: files.omap2 omap2_gpmc.c Log Message: Support locator "cs". To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/omap/files.omap2 cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap2_gpmc.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/omap/files.omap2 diff -u src/sys/arch/arm/omap/files.omap2:1.33 src/sys/arch/arm/omap/files.omap2:1.34 --- src/sys/arch/arm/omap/files.omap2:1.33 Mon Jul 4 15:35:55 2016 +++ src/sys/arch/arm/omap/files.omap2 Tue Oct 4 15:23:40 2016 @@ -1,4 +1,4 @@ -# $NetBSD: files.omap2,v 1.33 2016/07/04 15:35:55 kiyohara Exp $ +# $NetBSD: files.omap2,v 1.34 2016/10/04 15:23:40 kiyohara Exp $ # # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support # Based on xscale/files.pxa2x0 @@ -117,7 +117,7 @@ file arch/arm/omap/omap2_l3i.c omap2 | # General Purpose Memory Controller # XXX some addl. chip select config parms may be desired here (e.g. timing) # XXX so far we just use the setup established by boot firmware -device gpmc { [addr=-1], [size=0], [intr=-1], [mult=1], [nobyteacc=0] +device gpmc { [cs=-1], [addr=-1], [size=0], [intr=-1], [mult=1], [nobyteacc=0] } : bus_space_generic attach gpmc at mainbus file arch/arm/omap/omap2_gpmc.c gpmc Index: src/sys/arch/arm/omap/omap2_gpmc.c diff -u src/sys/arch/arm/omap/omap2_gpmc.c:1.9 src/sys/arch/arm/omap/omap2_gpmc.c:1.10 --- src/sys/arch/arm/omap/omap2_gpmc.c:1.9 Fri Jul 1 20:30:21 2011 +++ src/sys/arch/arm/omap/omap2_gpmc.c Tue Oct 4 15:23:40 2016 @@ -1,7 +1,7 @@ -/* $Id: omap2_gpmc.c,v 1.9 2011/07/01 20:30:21 dyoung Exp $ */ +/* $Id: omap2_gpmc.c,v 1.10 2016/10/04 15:23:40 kiyohara Exp $ */ /* adapted from: */ -/* $NetBSD: omap2_gpmc.c,v 1.9 2011/07/01 20:30:21 dyoung Exp $ */ +/* $NetBSD: omap2_gpmc.c,v 1.10 2016/10/04 15:23:40 kiyohara Exp $ */ /* @@ -102,7 +102,7 @@ #include "opt_omap.h" #include -__KERNEL_RCSID(0, "$NetBSD: omap2_gpmc.c,v 1.9 2011/07/01 20:30:21 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_gpmc.c,v 1.10 2016/10/04 15:23:40 kiyohara Exp $"); #include "locators.h" @@ -278,7 +278,22 @@ gpmc_search(device_t parent, cfdata_t cf aa.gpmc_intr = cf->cf_loc[GPMCCF_INTR]; cs = >sc_csconfig[0]; - for (i=0; i < GPMC_NCS; i++) { + for (i = 0; i < GPMC_NCS; i++) { + if (cf->cf_loc[GPMCCF_CS] != GPMCCF_CS_DEFAULT) { + if (i != cf->cf_loc[GPMCCF_CS]) { +cs++; +continue; + } + + if (aa.gpmc_addr != GPMCCF_ADDR_DEFAULT + && aa.gpmc_addr != cs->cs_addr) +panic("cs:addr missmatch:" +" cs %d(0x%08lx), addr 0x%08lx\n", +cf->cf_loc[GPMCCF_CS], cs->cs_addr, +aa.gpmc_addr); + aa.gpmc_addr = cs->cs_addr; + } + if ((aa.gpmc_addr >= cs->cs_addr) && (aa.gpmc_addr < (cs->cs_addr + cs->cs_size))) { /* XXX
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:23:40 UTC 2016 Modified Files: src/sys/arch/arm/omap: files.omap2 omap2_gpmc.c Log Message: Support locator "cs". To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/omap/files.omap2 cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap2_gpmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: mlelstv Date: Mon Aug 15 13:02:07 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: use symbolic interrupt level for sdmmc, no functional change. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/omap/omap3_sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: mlelstv Date: Mon Aug 15 13:02:07 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: use symbolic interrupt level for sdmmc, no functional change. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.23 src/sys/arch/arm/omap/omap3_sdhc.c:1.24 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.23 Thu Aug 4 20:07:18 2016 +++ src/sys/arch/arm/omap/omap3_sdhc.c Mon Aug 15 13:02:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.23 2016/08/04 20:07:18 jakllsch Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.24 2016/08/15 13:02:07 mlelstv Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.23 2016/08/04 20:07:18 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.24 2016/08/15 13:02:07 mlelstv Exp $"); #include "opt_omap.h" #include "edma.h" @@ -399,7 +399,7 @@ no_dma: SYSCONFIG_ENAWAKEUP | SYSCONFIG_AUTOIDLE | SYSCONFIG_SIDLEMODE_AUTO | SYSCONFIG_CLOCKACTIVITY_FCLK | SYSCONFIG_CLOCKACTIVITY_ICLK); - sc->sc_ih = intr_establish(oa->obio_intr, IPL_VM, IST_LEVEL, + sc->sc_ih = intr_establish(oa->obio_intr, IPL_SDMMC, IST_LEVEL, sdhc_intr, >sc); if (sc->sc_ih == NULL) { aprint_error_dev(self, "failed to establish interrupt %d\n",
Re: CVS commit: src/sys/arch/arm/omap
Hi! From: "Jonathan A. Kollasch"Date: Thu, 4 Aug 2016 22:02:54 -0500 > On Fri, Aug 05, 2016 at 11:27:13AM +0900, KIYOHARA Takashi wrote: >> Hi! >> >> >> From: "Jonathan A. Kollasch" >> Date: Thu, 4 Aug 2016 20:07:18 + >> >> > Module Name: src >> > Committed By: jakllsch >> > Date: Thu Aug 4 20:07:18 UTC 2016 >> > >> > Modified Files: >> >src/sys/arch/arm/omap: omap3_sdhc.c >> > >> > Log Message: >> > TI_DM37xx does not currently have a working omapscm(4), which provides >> > omap_devid(). Avoid using omap_devid() until correctly fixed. >> >> Why not attach omapscm? >> My Overo EarthSTORM(AM3703) is working with omapscm. The OVERO supports >> OMAP 3503, 3530, DM3730 and AM3703. > BEAGLEBOARDXM w/ > omapscm0at obio0 addr 0x48002000 size 0x1000 : > > src/sys/arch/arm/omap/omap3_scm.c: In function 'omap3_scm_match': > src/sys/arch/arm/omap/omap3_scm.c:138:25: > error: 'SCM_BASE' undeclared (first use in this function) > if (obio->obio_addr == SCM_BASE) > Please try after 'cvs update'. Thanks, -- kiyohara
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Fri Aug 5 14:32:36 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_scm.c Log Message: Support TI_DM37XX. These register maps like to OMAP 34xx/35xx. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/omap3_scm.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/omap/omap3_scm.c diff -u src/sys/arch/arm/omap/omap3_scm.c:1.5 src/sys/arch/arm/omap/omap3_scm.c:1.6 --- src/sys/arch/arm/omap/omap3_scm.c:1.5 Sun Jul 3 12:27:04 2016 +++ src/sys/arch/arm/omap/omap3_scm.c Fri Aug 5 14:32:36 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_scm.c,v 1.5 2016/07/03 12:27:04 kiyohara Exp $ */ +/* $NetBSD: omap3_scm.c,v 1.6 2016/08/05 14:32:36 kiyohara Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill@@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_scm.c,v 1.5 2016/07/03 12:27:04 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_scm.c,v 1.6 2016/08/05 14:32:36 kiyohara Exp $"); #include "opt_omap.h" @@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_scm.c, #define SCM_OFFSET_INTERFACE_3530 0 #define SCM_OFFSET_GENERAL_3530 0x270 -#if defined(OMAP_3430) || defined(OMAP_3530) +#if defined(OMAP_3430) || defined(OMAP_3530) || defined(TI_DM37XX) #define SCM_BASE SCM_BASE_3530 #define SCM_SIZE SCM_SIZE_3530 #define SCM_CONTROL_IDCODE SCM_CONTROL_IDCODE_3530
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Fri Aug 5 14:32:36 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_scm.c Log Message: Support TI_DM37XX. These register maps like to OMAP 34xx/35xx. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/omap3_scm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/arm/omap
On Fri, Aug 05, 2016 at 11:27:13AM +0900, KIYOHARA Takashi wrote: > Hi! > > > From: "Jonathan A. Kollasch"> Date: Thu, 4 Aug 2016 20:07:18 + > > > Module Name:src > > Committed By: jakllsch > > Date: Thu Aug 4 20:07:18 UTC 2016 > > > > Modified Files: > > src/sys/arch/arm/omap: omap3_sdhc.c > > > > Log Message: > > TI_DM37xx does not currently have a working omapscm(4), which provides > > omap_devid(). Avoid using omap_devid() until correctly fixed. > > Why not attach omapscm? > My Overo EarthSTORM(AM3703) is working with omapscm. The OVERO supports > OMAP 3503, 3530, DM3730 and AM3703. > > Thanks, > -- > kiyohara BEAGLEBOARDXM w/o omapscm0: src/sys/arch/arm/omap/omap3_sdhc.c:236: undefined reference to `omap_devid' BEAGLEBOARDXM w/ omapscm0at obio0 addr 0x48002000 size 0x1000 : src/sys/arch/arm/omap/omap3_scm.c: In function 'omap3_scm_match': src/sys/arch/arm/omap/omap3_scm.c:138:25: error: 'SCM_BASE' undeclared (first use in this function) if (obio->obio_addr == SCM_BASE) Jonathan Kollasch
Re: CVS commit: src/sys/arch/arm/omap
Hi! From: "Jonathan A. Kollasch"Date: Thu, 4 Aug 2016 20:07:18 + > Module Name: src > Committed By: jakllsch > Date: Thu Aug 4 20:07:18 UTC 2016 > > Modified Files: > src/sys/arch/arm/omap: omap3_sdhc.c > > Log Message: > TI_DM37xx does not currently have a working omapscm(4), which provides > omap_devid(). Avoid using omap_devid() until correctly fixed. Why not attach omapscm? My Overo EarthSTORM(AM3703) is working with omapscm. The OVERO supports OMAP 3503, 3530, DM3730 and AM3703. Thanks, -- kiyohara
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jakllsch Date: Thu Aug 4 20:07:18 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: TI_DM37xx does not currently have a working omapscm(4), which provides omap_devid(). Avoid using omap_devid() until correctly fixed. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/omap/omap3_sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jakllsch Date: Thu Aug 4 20:07:18 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: TI_DM37xx does not currently have a working omapscm(4), which provides omap_devid(). Avoid using omap_devid() until correctly fixed. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.22 src/sys/arch/arm/omap/omap3_sdhc.c:1.23 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.22 Thu Aug 4 07:14:50 2016 +++ src/sys/arch/arm/omap/omap3_sdhc.c Thu Aug 4 20:07:18 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.22 2016/08/04 07:14:50 kiyohara Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.23 2016/08/04 20:07:18 jakllsch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.22 2016/08/04 07:14:50 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.23 2016/08/04 20:07:18 jakllsch Exp $"); #include "opt_omap.h" #include "edma.h" @@ -225,7 +225,7 @@ obiosdhc_attach(device_t parent, device_ sc->sc.sc_flags |= SDHC_FLAG_RSP136_CRC; if (support8bit) sc->sc.sc_flags |= SDHC_FLAG_8BIT_MODE; -#if defined(OMAP_3430) +#if defined(OMAP_3430) || /* XXX until TI_DM37XX has working omap_devid() */ defined(TI_DM37XX) sc->sc.sc_flags |= SDHC_FLAG_SINGLE_ONLY; #elif defined(OMAP_3530) || defined(TI_DM37XX) /*
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Aug 4 14:08:23 UTC 2016 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: s/for(/for (/. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/omap/if_cpsw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Aug 4 14:08:23 UTC 2016 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: s/for(/for (/. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/omap/if_cpsw.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/omap/if_cpsw.c diff -u src/sys/arch/arm/omap/if_cpsw.c:1.15 src/sys/arch/arm/omap/if_cpsw.c:1.16 --- src/sys/arch/arm/omap/if_cpsw.c:1.15 Thu Aug 4 14:05:20 2016 +++ src/sys/arch/arm/omap/if_cpsw.c Thu Aug 4 14:08:23 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.15 2016/08/04 14:05:20 kiyohara Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.16 2016/08/04 14:08:23 kiyohara Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.15 2016/08/04 14:05:20 kiyohara Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.16 2016/08/04 14:08:23 kiyohara Exp $"); #include #include @@ -745,7 +745,7 @@ cpsw_mii_wait(struct cpsw_softc * const { u_int tries; - for(tries = 0; tries < 1000; tries++) { + for (tries = 0; tries < 1000; tries++) { if ((cpsw_read_4(sc, reg) & __BIT(31)) == 0) return 0; delay(1);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Aug 4 14:05:20 UTC 2016 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: Change message for aprint_normal() "CPSW Ethernet" to "Layer 2 3-Port Switch". Its described in Technical Reference Manual. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/omap/if_cpsw.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/omap/if_cpsw.c diff -u src/sys/arch/arm/omap/if_cpsw.c:1.14 src/sys/arch/arm/omap/if_cpsw.c:1.15 --- src/sys/arch/arm/omap/if_cpsw.c:1.14 Fri Jun 10 13:27:11 2016 +++ src/sys/arch/arm/omap/if_cpsw.c Thu Aug 4 14:05:20 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.14 2016/06/10 13:27:11 ozaki-r Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.15 2016/08/04 14:05:20 kiyohara Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.14 2016/06/10 13:27:11 ozaki-r Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.15 2016/08/04 14:05:20 kiyohara Exp $"); #include #include @@ -403,7 +403,7 @@ cpsw_attach(device_t parent, device_t se sc->sc_dev = self; - aprint_normal(": TI CPSW Ethernet\n"); + aprint_normal(": TI Layer 2 3-Port Switch\n"); aprint_naive("\n"); callout_init(>sc_tick_ch, 0);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Aug 4 14:05:20 UTC 2016 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: Change message for aprint_normal() "CPSW Ethernet" to "Layer 2 3-Port Switch". Its described in Technical Reference Manual. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/omap/if_cpsw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Aug 4 07:14:50 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c omap3_sdmmcreg.h Log Message: Support OMAP 4430. But ADMA2 don't working yet. tested on Gumstix DuoVero. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/omap/omap3_sdhc.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/omap3_sdmmcreg.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/omap/omap3_sdhc.c diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.21 src/sys/arch/arm/omap/omap3_sdhc.c:1.22 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.21 Mon Jul 4 15:45:37 2016 +++ src/sys/arch/arm/omap/omap3_sdhc.c Thu Aug 4 07:14:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.21 2016/07/04 15:45:37 kiyohara Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.22 2016/08/04 07:14:50 kiyohara Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.21 2016/07/04 15:45:37 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.22 2016/08/04 07:14:50 kiyohara Exp $"); #include "opt_omap.h" #include "edma.h" @@ -87,7 +87,6 @@ static void obiosdhc_attach(device_t, de static int obiosdhc_detach(device_t, int); static int obiosdhc_bus_width(struct sdhc_softc *, int); -static int obiosdhc_bus_clock(struct sdhc_softc *, int); static int obiosdhc_rod(struct sdhc_softc *, int); static int obiosdhc_write_protect(struct sdhc_softc *); static int obiosdhc_card_detect(struct sdhc_softc *); @@ -96,6 +95,7 @@ struct obiosdhc_softc { struct sdhc_softc sc; bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; + bus_space_handle_t sc_hl_bsh; bus_space_handle_t sc_sdhc_bsh; struct sdhc_host *sc_hosts[1]; void *sc_ih; /* interrupt vectoring */ @@ -173,19 +173,19 @@ obiosdhc_match(device_t parent, cfdata_t if (oa->obio_addr == SDMMC1_BASE_3430 || oa->obio_addr == SDMMC2_BASE_3430 || oa->obio_addr == SDMMC3_BASE_3430) -return 1; + return 1; #elif defined(OMAP_3530) if (oa->obio_addr == SDMMC1_BASE_3530 || oa->obio_addr == SDMMC2_BASE_3530 || oa->obio_addr == SDMMC3_BASE_3530) -return 1; + return 1; #elif defined(OMAP4) || defined(OMAP5) if (oa->obio_addr == SDMMC1_BASE_4430 || oa->obio_addr == SDMMC2_BASE_4430 || oa->obio_addr == SDMMC3_BASE_4430 || oa->obio_addr == SDMMC4_BASE_4430 || oa->obio_addr == SDMMC5_BASE_4430) -return 1; + return 1; #endif #ifdef TI_AM335X @@ -195,7 +195,7 @@ obiosdhc_match(device_t parent, cfdata_t return 1; #endif -return 0; + return 0; } static void @@ -208,6 +208,10 @@ obiosdhc_attach(device_t parent, device_ int error, timo, clksft, n; bool support8bit = false; const char *transfer_mode = "PIO"; +#if defined(OMAP4) + uint32_t v; + int x, y; +#endif #ifdef TI_AM335X size_t i; #endif @@ -219,16 +223,44 @@ obiosdhc_attach(device_t parent, device_ sc->sc.sc_flags |= SDHC_FLAG_32BIT_ACCESS; sc->sc.sc_flags |= SDHC_FLAG_NO_LED_ON; sc->sc.sc_flags |= SDHC_FLAG_RSP136_CRC; - sc->sc.sc_flags |= SDHC_FLAG_SINGLE_ONLY; if (support8bit) sc->sc.sc_flags |= SDHC_FLAG_8BIT_MODE; -#ifdef TI_AM335X +#if defined(OMAP_3430) + sc->sc.sc_flags |= SDHC_FLAG_SINGLE_ONLY; +#elif defined(OMAP_3530) || defined(TI_DM37XX) + /* + * Advisory 2.1.1.128: MMC: Multiple Block Read Operation Issue + * from "OMAP3530/25/15/03 Applications Processor Silicon Revisions + * 3.1.2, 3.1, 3.0, 2.1, and 2.0". + */ + switch (omap_devid()) { + case DEVID_OMAP35X_ES10: + case DEVID_OMAP35X_ES20: + case DEVID_OMAP35X_ES21: + case DEVID_AMDM37X_ES10: /* ? */ + case DEVID_AMDM37X_ES11: /* ? */ + case DEVID_AMDM37X_ES12: /* ? */ + sc->sc.sc_flags |= SDHC_FLAG_SINGLE_ONLY; + break; + default: + break; + } + sc->sc.sc_flags |= SDHC_FLAG_NO_HS_BIT; +#elif defined(TI_AM335X) sc->sc.sc_flags |= SDHC_FLAG_WAIT_RESET; - sc->sc.sc_flags &= ~SDHC_FLAG_SINGLE_ONLY; -#endif -#if defined(OMAP_3530) - if (omap_chipid() == CHIPID_OMAP3530) - sc->sc.sc_flags &= ~SDHC_FLAG_SINGLE_ONLY; +#elif defined(OMAP_4430) + /* + * MMCHS_HCTL.HSPE Is Not Functional + * Errata ID: i626 + * + * Due to design issue MMCHS_HCTL.HSPE bit does not work as intended. + * This means that the configuration must always be the normal speed + * mode configuration (MMCHS_HCTL.HSPE=0). + */ + sc->sc.sc_flags |= SDHC_FLAG_NO_HS_BIT; + +// sc->sc.sc_flags |= SDHC_FLAG_USE_DMA; +// sc->sc.sc_flags |= SDHC_FLAG_USE_ADMA2; #endif sc->sc.sc_host = sc->sc_hosts; sc->sc.sc_clkbase = 96000; /* 96MHZ */ @@ -237,7 +269,6 @@ obiosdhc_attach(device_t parent, device_ sc->sc.sc_vendor_rod = obiosdhc_rod; sc->sc.sc_vendor_write_protect = obiosdhc_write_protect; sc->sc.sc_vendor_card_detect = obiosdhc_card_detect;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Aug 4 07:14:50 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c omap3_sdmmcreg.h Log Message: Support OMAP 4430. But ADMA2 don't working yet. tested on Gumstix DuoVero. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/omap/omap3_sdhc.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/omap3_sdmmcreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Aug 4 06:44:58 UTC 2016 Modified Files: src/sys/arch/arm/omap: tiotg.c Log Message: Set host-mode always. motg(4) doesn't supports device and OTG modes. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/tiotg.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/omap/tiotg.c diff -u src/sys/arch/arm/omap/tiotg.c:1.5 src/sys/arch/arm/omap/tiotg.c:1.6 --- src/sys/arch/arm/omap/tiotg.c:1.5 Mon Jul 11 14:46:33 2016 +++ src/sys/arch/arm/omap/tiotg.c Thu Aug 4 06:44:58 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tiotg.c,v 1.5 2016/07/11 14:46:33 kiyohara Exp $ */ +/* $NetBSD: tiotg.c,v 1.6 2016/08/04 06:44:58 kiyohara Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. * @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tiotg.c,v 1.5 2016/07/11 14:46:33 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tiotg.c,v 1.6 2016/08/04 06:44:58 kiyohara Exp $"); #include "opt_omap.h" #include "locators.h" @@ -335,10 +335,18 @@ ti_motg_attach(device_t parent, device_t DPRINTF("now val 0x%x", val, 0, 0, 0); #endif /* XXX configure mode */ +#if 0 if (sc->sc_ctrlport == 0) sc->sc_motg.sc_mode = MOTG_MODE_DEVICE; else sc->sc_motg.sc_mode = MOTG_MODE_HOST; +#else + /* X + * Both ports always the host mode only. + * And motg(4) doesn't supports device and OTG modes. + */ + sc->sc_motg.sc_mode = MOTG_MODE_HOST; +#endif if (sc->sc_motg.sc_mode == MOTG_MODE_HOST) { val = TIOTG_USBC_READ4(sc, USBCTRL_MODE); val |= USBCTRL_MODE_IDDIGMUX;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Aug 4 06:44:58 UTC 2016 Modified Files: src/sys/arch/arm/omap: tiotg.c Log Message: Set host-mode always. motg(4) doesn't supports device and OTG modes. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/tiotg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Jul 11 14:53:05 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_gpio.c Log Message: Support OMAP 4430. tested on Gumstix DuoVero. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/omap/omap2_gpio.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/omap/omap2_gpio.c diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.17 src/sys/arch/arm/omap/omap2_gpio.c:1.18 --- src/sys/arch/arm/omap/omap2_gpio.c:1.17 Sat Jul 9 15:04:06 2016 +++ src/sys/arch/arm/omap/omap2_gpio.c Mon Jul 11 14:53:05 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_gpio.c,v 1.17 2016/07/09 15:04:06 kiyohara Exp $ */ +/* $NetBSD: omap2_gpio.c,v 1.18 2016/07/11 14:53:05 kiyohara Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.17 2016/07/09 15:04:06 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.18 2016/07/11 14:53:05 kiyohara Exp $"); #define _INTR_PRIVATE @@ -61,8 +61,11 @@ __KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c #endif static void gpio_pic_block_irqs(struct pic_softc *, size_t, uint32_t); +static void gpio_pic_block_irqs2(struct pic_softc *, size_t, uint32_t); static void gpio_pic_unblock_irqs(struct pic_softc *, size_t, uint32_t); +static void gpio_pic_unblock_irqs2(struct pic_softc *, size_t, uint32_t); static int gpio_pic_find_pending_irqs(struct pic_softc *); +static int gpio_pic_find_pending_irqs2(struct pic_softc *); static void gpio_pic_establish_irq(struct pic_softc *, struct intrsource *); const struct pic_ops gpio_pic_ops = { @@ -71,6 +74,12 @@ const struct pic_ops gpio_pic_ops = { .pic_find_pending_irqs = gpio_pic_find_pending_irqs, .pic_establish_irq = gpio_pic_establish_irq, }; +const struct pic_ops gpio_pic_ops2 = { + .pic_block_irqs = gpio_pic_block_irqs2, + .pic_unblock_irqs = gpio_pic_unblock_irqs2, + .pic_find_pending_irqs = gpio_pic_find_pending_irqs2, + .pic_establish_irq = gpio_pic_establish_irq, +}; struct gpio_softc { device_t gpio_dev; @@ -78,6 +87,7 @@ struct gpio_softc { struct intrsource *gpio_is; bus_space_tag_t gpio_memt; bus_space_handle_t gpio_memh; + bus_space_handle_t gpio_memh2; uint32_t gpio_enable_mask; uint32_t gpio_edge_mask; uint32_t gpio_edge_falling_mask; @@ -100,6 +110,10 @@ struct gpio_softc { bus_space_read_4((gpio)->gpio_memt, (gpio)->gpio_memh, (reg)) #define GPIO_WRITE(gpio, reg, val) \ bus_space_write_4((gpio)->gpio_memt, (gpio)->gpio_memh, (reg), (val)) +#define GPIO_READ2(gpio, reg) \ + bus_space_read_4((gpio)->gpio_memt, (gpio)->gpio_memh2, (reg)) +#define GPIO_WRITE2(gpio, reg, val) \ + bus_space_write_4((gpio)->gpio_memt, (gpio)->gpio_memh2, (reg), (val)) void gpio_pic_unblock_irqs(struct pic_softc *pic, size_t irq_base, uint32_t irq_mask) @@ -119,6 +133,22 @@ gpio_pic_unblock_irqs(struct pic_softc * } void +gpio_pic_unblock_irqs2(struct pic_softc *pic, size_t irq_base, uint32_t irq_mask) +{ + struct gpio_softc * const gpio = PIC_TO_SOFTC(pic); + KASSERT(irq_base == 0); + + /* + * If this a level source, ack it now. If it's still asserted + * it'll come back. + */ + GPIO_WRITE2(gpio, GPIO_IRQSTATUS_SET_0, irq_mask); + if (irq_mask & gpio->gpio_level_mask) + GPIO_WRITE2(gpio, GPIO_IRQSTATUS_0, + irq_mask & gpio->gpio_level_mask); +} + +void gpio_pic_block_irqs(struct pic_softc *pic, size_t irq_base, uint32_t irq_mask) { struct gpio_softc * const gpio = PIC_TO_SOFTC(pic); @@ -135,6 +165,22 @@ gpio_pic_block_irqs(struct pic_softc *pi irq_mask & gpio->gpio_edge_mask); } +void +gpio_pic_block_irqs2(struct pic_softc *pic, size_t irq_base, uint32_t irq_mask) +{ + struct gpio_softc * const gpio = PIC_TO_SOFTC(pic); + KASSERT(irq_base == 0); + + GPIO_WRITE2(gpio, GPIO_IRQSTATUS_CLR_0, irq_mask); + /* + * If any of the sources are edge triggered, ack them now so + * we won't lose them. + */ + if (irq_mask & gpio->gpio_edge_mask) + GPIO_WRITE2(gpio, GPIO_IRQSTATUS_0, + irq_mask & gpio->gpio_edge_mask); +} + int gpio_pic_find_pending_irqs(struct pic_softc *pic) { @@ -155,6 +201,24 @@ gpio_pic_find_pending_irqs(struct pic_so return 1; } +int +gpio_pic_find_pending_irqs2(struct pic_softc *pic) +{ + struct gpio_softc * const gpio = PIC_TO_SOFTC(pic); + uint32_t pending; + + pending = GPIO_READ2(gpio, GPIO_IRQSTATUS_0); + if (pending == 0) + return 0; + + /* + * Now find all the pending bits and mark them as pending. + */ + (void) pic_mark_pending_sources(>gpio_pic, 0, pending); + + return 1; +} + void gpio_pic_establish_irq(struct pic_softc *pic, struct intrsource *is) { @@ -170,9 +234,14 @@ gpio_pic_establish_irq(struct pic_softc /* * Make sure the irq isn't enabled and not asserting. */ +#if defined(OMAP_4430) ||
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Jul 11 14:53:05 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_gpio.c Log Message: Support OMAP 4430. tested on Gumstix DuoVero. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/omap/omap2_gpio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Jul 11 14:51:11 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_reg.h Log Message: Add more GPIO registers. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/omap/omap2_reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Jul 11 14:51:11 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_reg.h Log Message: Add more GPIO registers. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/omap/omap2_reg.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/omap/omap2_reg.h diff -u src/sys/arch/arm/omap/omap2_reg.h:1.32 src/sys/arch/arm/omap/omap2_reg.h:1.33 --- src/sys/arch/arm/omap/omap2_reg.h:1.32 Sun Jul 3 12:27:04 2016 +++ src/sys/arch/arm/omap/omap2_reg.h Mon Jul 11 14:51:11 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_reg.h,v 1.32 2016/07/03 12:27:04 kiyohara Exp $ */ +/* $NetBSD: omap2_reg.h,v 1.33 2016/07/11 14:51:11 kiyohara Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -789,6 +789,23 @@ #define GPIO5_BASE_TI_DM37XX 0x49056000 #define GPIO6_BASE_TI_DM37XX 0x49058000 +#define GPIO_SIZE2 0x100 + +#define GPIO_REVISION 0x000 +#define GPIO_SYSCONFIG 0x010 +#define GPIO_EOI 0x020 /* AM33xx */ +#define GPIO_IRQSTATUS_RAW_0 0x024 +#define GPIO_IRQSTATUS_RAW_1 0x028 +#define GPIO_IRQSTATUS_0 0x02c +#define GPIO_IRQSTATUS_1 0x030 +#define GPIO_IRQSTATUS_SET_0 0x034 +#define GPIO_IRQSTATUS_SET_1 0x038 +#define GPIO_IRQSTATUS_CLR_0 0x03c +#define GPIO_IRQSTATUS_CLR_1 0x040 +#define GPIO_IRQWAKEN_0 0x044 +#define GPIO_IRQWAKEN_1 0x048 +#define GPIO_SYSSTATUS 0x114 + #define GPIO_IRQSTATUS1 0x018 #define GPIO_IRQENABLE1 0x01c #define GPIO_WAKEUPENABLE 0x020
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Jul 11 14:46:33 UTC 2016 Modified Files: src/sys/arch/arm/omap: tiotg.c Log Message: s/^ +/ / To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/tiotg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Jul 11 14:46:33 UTC 2016 Modified Files: src/sys/arch/arm/omap: tiotg.c Log Message: s/^ +/ / To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/tiotg.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/omap/tiotg.c diff -u src/sys/arch/arm/omap/tiotg.c:1.4 src/sys/arch/arm/omap/tiotg.c:1.5 --- src/sys/arch/arm/omap/tiotg.c:1.4 Mon Jul 4 15:35:55 2016 +++ src/sys/arch/arm/omap/tiotg.c Mon Jul 11 14:46:33 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tiotg.c,v 1.4 2016/07/04 15:35:55 kiyohara Exp $ */ +/* $NetBSD: tiotg.c,v 1.5 2016/07/11 14:46:33 kiyohara Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. * @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tiotg.c,v 1.4 2016/07/04 15:35:55 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tiotg.c,v 1.5 2016/07/11 14:46:33 kiyohara Exp $"); #include "opt_omap.h" #include "locators.h" @@ -133,14 +133,14 @@ tiotg_match(device_t parent, cfdata_t ma if (mb->mb_iobase == MAINBUSCF_BASE_DEFAULT || mb->mb_iosize == MAINBUSCF_SIZE_DEFAULT || mb->mb_intrbase == MAINBUSCF_INTRBASE_DEFAULT) -return 0; -return 1; + return 0; + return 1; } static void tiotg_attach(device_t parent, device_t self, void *aux) { - struct tiotg_softc *sc = device_private(self); + struct tiotg_softc *sc = device_private(self); struct mainbus_attach_args *mb = aux; uint32_t val; @@ -157,7 +157,7 @@ tiotg_attach(device_t parent, device_t s sc->sc_intrbase = mb->mb_intrbase; sc->sc_ih = intr_establish(mb->mb_intrbase, IPL_USB, IST_LEVEL, tiotg_intr, sc); -KASSERT(sc->sc_ih != NULL); + KASSERT(sc->sc_ih != NULL); aprint_normal(": TI dual-port USB controller"); /* XXX this looks wrong */ prcm_write_4(AM335X_PRCM_CM_WKUP, CM_WKUP_CM_CLKDCOLDO_DPLL_PER,
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Jul 9 15:04:06 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_gpio.c omap_edma.c Log Message: Remove white-spaces. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/omap/omap2_gpio.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/omap_edma.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/omap/omap2_gpio.c diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.16 src/sys/arch/arm/omap/omap2_gpio.c:1.17 --- src/sys/arch/arm/omap/omap2_gpio.c:1.16 Sat Jun 15 21:59:37 2013 +++ src/sys/arch/arm/omap/omap2_gpio.c Sat Jul 9 15:04:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_gpio.c,v 1.16 2013/06/15 21:59:37 matt Exp $ */ +/* $NetBSD: omap2_gpio.c,v 1.17 2016/07/09 15:04:06 kiyohara Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. @@ -28,22 +28,22 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.16 2013/06/15 21:59:37 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.17 2016/07/09 15:04:06 kiyohara Exp $"); #define _INTR_PRIVATE #include "locators.h" #include "gpio.h" #include "opt_omap.h" - + #include #include #include - + #include - + #include - + #include #include #include @@ -175,7 +175,7 @@ gpio_pic_establish_irq(struct pic_softc GPIO_WRITE(gpio, GPIO_IRQSTATUS1, irq_mask); /* - * Convert the type to a gpio type and figure out which bits in what + * Convert the type to a gpio type and figure out which bits in what * register we have to tweak. */ gpio->gpio_edge_rising_mask &= ~irq_mask; @@ -209,7 +209,7 @@ gpio_pic_establish_irq(struct pic_softc */ v = GPIO_READ(gpio, GPIO_OE); v |= irq_mask; - GPIO_WRITE(gpio, GPIO_OE, v); + GPIO_WRITE(gpio, GPIO_OE, v); #if 0 for (i = 0, maybe_is = NULL; i < 32; i++) { if ((is = pic->pic_sources[i]) != NULL) { @@ -222,7 +222,7 @@ gpio_pic_establish_irq(struct pic_softc KASSERT(is != NULL); is->is_ipl = maybe_is->is_ipl; (*is->is_pic->pic_ops->pic_establish_irq)(is->is_pic, is); - } + } #endif } @@ -253,7 +253,7 @@ omap2gpio_pin_write(void *arg, int pin, old = GPIO_READ(gpio, GPIO_DATAOUT); if (value) - new = old | mask; + new = old | mask; else new = old & ~mask; @@ -438,7 +438,7 @@ gpio_attach(device_t parent, device_t se pic_add(>gpio_pic, oa->obio_intrbase); aprint_normal(": interrupts %d..%d", oa->obio_intrbase, oa->obio_intrbase + 31); - gpio->gpio_is = intr_establish(oa->obio_intr, + gpio->gpio_is = intr_establish(oa->obio_intr, IPL_HIGH, IST_LEVEL, pic_handle_intr, >gpio_pic); KASSERT(gpio->gpio_is != NULL); aprint_normal(", intr %d", oa->obio_intr); Index: src/sys/arch/arm/omap/omap_edma.c diff -u src/sys/arch/arm/omap/omap_edma.c:1.2 src/sys/arch/arm/omap/omap_edma.c:1.3 --- src/sys/arch/arm/omap/omap_edma.c:1.2 Mon Jul 4 15:35:55 2016 +++ src/sys/arch/arm/omap/omap_edma.c Sat Jul 9 15:04:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap_edma.c,v 1.2 2016/07/04 15:35:55 kiyohara Exp $ */ +/* $NetBSD: omap_edma.c,v 1.3 2016/07/09 15:04:06 kiyohara Exp $ */ /*- * Copyright (c) 2014 Jared D. McNeill@@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap_edma.c,v 1.2 2016/07/04 15:35:55 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap_edma.c,v 1.3 2016/07/09 15:04:06 kiyohara Exp $"); #include "opt_omap.h" @@ -504,7 +504,7 @@ edma_halt(struct edma_channel *ch) bus_size_t off = (ch->ch_index < 32 ? 0 : 4); uint32_t bit = __BIT(ch->ch_index < 32 ? ch->ch_index : ch->ch_index - 32); - + EDMA_WRITE(sc, EDMA_EECR_REG + off, bit); EDMA_WRITE(sc, EDMA_ECR_REG + off, bit); EDMA_WRITE(sc, EDMA_SECR_REG + off, bit);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sat Jul 9 15:04:06 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_gpio.c omap_edma.c Log Message: Remove white-spaces. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/omap/omap2_gpio.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/omap_edma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Jul 7 15:27:42 UTC 2016 Modified Files: src/sys/arch/arm/omap: obio_com.c Log Message: com@obio's type is COM_TYPE_OMAP. This mean is able to change the baudrate. tested on VTC100's com1(GPS). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/obio_com.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Jul 7 15:27:42 UTC 2016 Modified Files: src/sys/arch/arm/omap: obio_com.c Log Message: com@obio's type is COM_TYPE_OMAP. This mean is able to change the baudrate. tested on VTC100's com1(GPS). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/obio_com.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/omap/obio_com.c diff -u src/sys/arch/arm/omap/obio_com.c:1.6 src/sys/arch/arm/omap/obio_com.c:1.7 --- src/sys/arch/arm/omap/obio_com.c:1.6 Thu Jul 7 15:20:58 2016 +++ src/sys/arch/arm/omap/obio_com.c Thu Jul 7 15:27:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: obio_com.c,v 1.6 2016/07/07 15:20:58 kiyohara Exp $ */ +/* $NetBSD: obio_com.c,v 1.7 2016/07/07 15:27:42 kiyohara Exp $ */ /* * Based on arch/arm/omap/omap_com.c @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: obio_com.c,v 1.6 2016/07/07 15:20:58 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obio_com.c,v 1.7 2016/07/07 15:27:42 kiyohara Exp $"); #include "opt_omap.h" #include "opt_com.h" @@ -151,7 +151,7 @@ obiouart_attach(device_t parent, device_ iot = obio->obio_iot; iobase = obio->obio_addr; sc->sc_frequency = OMAP_COM_FREQ; - sc->sc_type = COM_TYPE_NORMAL; + sc->sc_type = COM_TYPE_OMAP; if (com_is_console(iot, iobase, ) == 0 && bus_space_map(iot, iobase, obio->obio_size, 0, )) {
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Jul 7 15:20:58 UTC 2016 Modified Files: src/sys/arch/arm/omap: obio_com.c Log Message: Call uart_enable() before comprobe1(). And rename to uart_enable_omap(). Also do soft reset in new uart_enable(). Add uart_enable_am335x(). Its enable to clocks. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/obio_com.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Thu Jul 7 15:20:58 UTC 2016 Modified Files: src/sys/arch/arm/omap: obio_com.c Log Message: Call uart_enable() before comprobe1(). And rename to uart_enable_omap(). Also do soft reset in new uart_enable(). Add uart_enable_am335x(). Its enable to clocks. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/obio_com.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/omap/obio_com.c diff -u src/sys/arch/arm/omap/obio_com.c:1.5 src/sys/arch/arm/omap/obio_com.c:1.6 --- src/sys/arch/arm/omap/obio_com.c:1.5 Wed Apr 9 21:02:31 2014 +++ src/sys/arch/arm/omap/obio_com.c Thu Jul 7 15:20:58 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: obio_com.c,v 1.5 2014/04/09 21:02:31 hans Exp $ */ +/* $NetBSD: obio_com.c,v 1.6 2016/07/07 15:20:58 kiyohara Exp $ */ /* * Based on arch/arm/omap/omap_com.c @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: obio_com.c,v 1.5 2014/04/09 21:02:31 hans Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obio_com.c,v 1.6 2016/07/07 15:20:58 kiyohara Exp $"); #include "opt_omap.h" #include "opt_com.h" @@ -59,13 +59,38 @@ __KERNEL_RCSID(0, "$NetBSD: obio_com.c,v #include #include +#include +#include + #include "locators.h" static int obiouart_match(device_t, cfdata_t, void *); static void obiouart_attach(device_t, device_t, void *); -static int uart_enable(struct obio_attach_args *); +#if defined(TI_AM335X) +static int uart_enable_am335x(struct obio_attach_args *); +#else +static int uart_enable_omap(struct obio_attach_args *); +#endif +static int uart_enable(struct obio_attach_args *, bus_space_handle_t); static void obiouart_callout(void *); +#if defined(TI_AM335X) +struct am335x_com { + bus_addr_t as_base_addr; + int as_intr; + struct omap_module as_module; +}; + +static const struct am335x_com am335x_com[] = { + { 0x44e09000, 72, { AM335X_PRCM_CM_WKUP, 0xb4 } }, + { 0x48022000, 73, { AM335X_PRCM_CM_PER, 0x6c } }, + { 0x48024000, 74, { AM335X_PRCM_CM_PER, 0x70 } }, + { 0x481a6000, 44, { AM335X_PRCM_CM_PER, 0x74 } }, + { 0x481a8000, 45, { AM335X_PRCM_CM_PER, 0x78 } }, + { 0x481aa000, 46, { AM335X_PRCM_CM_PER, 0x38 } }, +}; +#endif + struct com_obio_softc { struct com_softc sc_sc; struct callout sc_callout; @@ -87,7 +112,7 @@ obiouart_match(device_t parent, cfdata_t #if 0 /* * XXX this should be ifdefed on a board-dependent switch - * We don't know what is the irq for com0 on the sdp2430 + * We don't know what is the irq for com0 on the sdp2430 */ if (obio->obio_intr == OBIOCF_INTR_DEFAULT) panic("obiouart must have intr specified in config."); @@ -99,14 +124,12 @@ obiouart_match(device_t parent, cfdata_t if (com_is_console(obio->obio_iot, obio->obio_addr, NULL)) return 1; - if (uart_enable(obio) != 0) - return 1; - if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size, - 0, )) - return 1; - - rv = comprobe1(obio->obio_iot, bh); + 0, ) != 0) + return 0; + rv = 0; + if (uart_enable(obio, bh) == 0) + rv = comprobe1(obio->obio_iot, bh); bus_space_unmap(obio->obio_iot, bh, obio->obio_size); @@ -161,8 +184,29 @@ obiouart_callout(void *arg) } +#if defined(TI_AM335X) + static int -uart_enable(struct obio_attach_args *obio) +uart_enable_am335x(struct obio_attach_args *obio) +{ + int i; + + /* XXX Not really AM335X-specific. */ + for (i = 0; i < __arraycount(am335x_com); i++) + if ((obio->obio_addr == am335x_com[i].as_base_addr) && + (obio->obio_intr == am335x_com[i].as_intr)) { + prcm_module_enable(_com[i].as_module); + break; + } + KASSERT(i < __arraycount(am335x_com)); + + return 0; +} + +#else + +static int +uart_enable_omap(struct obio_attach_args *obio) { bus_space_handle_t ioh; uint32_t r; @@ -222,3 +266,33 @@ err: return 0; } + +#endif + +static int +uart_enable(struct obio_attach_args *obio, bus_space_handle_t bh) +{ + uint32_t v; + +#if defined(TI_AM335X) + if (uart_enable_am335x(obio) != 0) + return -1; +#else + if (uart_enable_omap(obio) != 0) + return -1; +#endif + + v = bus_space_read_4(obio->obio_iot, bh, OMAP_COM_SYSC); + v |= OMAP_COM_SYSC_SOFT_RESET; + bus_space_write_4(obio->obio_iot, bh, OMAP_COM_SYSC, v); + v = bus_space_read_4(obio->obio_iot, bh, OMAP_COM_SYSS); + while (!(v & OMAP_COM_SYSS_RESET_DONE)) + v = bus_space_read_4(obio->obio_iot, bh, OMAP_COM_SYSS); + + /* Disable smart idle */ + v = bus_space_read_4(obio->obio_iot, bh, OMAP_COM_SYSC); + v |= OMAP_COM_SYSC_NO_IDLE; + bus_space_write_4(obio->obio_iot, bh, OMAP_COM_SYSC, v); + + return 0; +}
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sun Jul 3 12:27:04 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_obiovar.h omap2_reg.h omap3_scm.c Log Message: Print DeviceID in attach(). Also test OMAP35x/AM37x/DM37x. And add omap_devid(). Tested on OMAP3503, OMAP3530 and AM3703. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omap2_obiovar.h \ src/sys/arch/arm/omap/omap3_scm.c cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/omap/omap2_reg.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/omap/omap2_obiovar.h diff -u src/sys/arch/arm/omap/omap2_obiovar.h:1.4 src/sys/arch/arm/omap/omap2_obiovar.h:1.5 --- src/sys/arch/arm/omap/omap2_obiovar.h:1.4 Mon Apr 25 13:14:37 2016 +++ src/sys/arch/arm/omap/omap2_obiovar.h Sun Jul 3 12:27:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_obiovar.h,v 1.4 2016/04/25 13:14:37 kiyohara Exp $ */ +/* $NetBSD: omap2_obiovar.h,v 1.5 2016/07/03 12:27:04 kiyohara Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -54,5 +54,6 @@ struct obio_softc { }; uint32_t omap_chipid(void); +uint32_t omap_devid(void); #endif /* _ARM_OMAP_OMAP2_OBIOVAR_H_ */ Index: src/sys/arch/arm/omap/omap3_scm.c diff -u src/sys/arch/arm/omap/omap3_scm.c:1.4 src/sys/arch/arm/omap/omap3_scm.c:1.5 --- src/sys/arch/arm/omap/omap3_scm.c:1.4 Mon Apr 25 13:14:37 2016 +++ src/sys/arch/arm/omap/omap3_scm.c Sun Jul 3 12:27:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_scm.c,v 1.4 2016/04/25 13:14:37 kiyohara Exp $ */ +/* $NetBSD: omap3_scm.c,v 1.5 2016/07/03 12:27:04 kiyohara Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill@@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_scm.c,v 1.4 2016/04/25 13:14:37 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_scm.c,v 1.5 2016/07/03 12:27:04 kiyohara Exp $"); #include "opt_omap.h" @@ -47,12 +47,14 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_scm.c, #define SCM_BASE_3530 0x48002000 #define SCM_SIZE_3530 0x1000 +#define SCM_CONTROL_IDCODE_3530 0x308204 #define SCM_OFFSET_INTERFACE_3530 0 #define SCM_OFFSET_GENERAL_3530 0x270 #if defined(OMAP_3430) || defined(OMAP_3530) #define SCM_BASE SCM_BASE_3530 #define SCM_SIZE SCM_SIZE_3530 +#define SCM_CONTROL_IDCODE SCM_CONTROL_IDCODE_3530 #define SCM_OFFSET_INTERFACE SCM_OFFSET_INTERFACE_3530 #define SCM_OFFSET_GENERAL SCM_OFFSET_GENERAL_3530 #endif @@ -105,7 +107,8 @@ struct omap3_scm_softc { bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; - uint32_t sc_cid; + uint32_t sc_cid; /* Chip Identification */ + uint32_t sc_did; /* Device IDCODE */ /* GENERAL */ struct sysmon_envsys *sc_sme; @@ -143,9 +146,28 @@ omap3_scm_attach(device_t parent, device { struct omap3_scm_softc *sc = device_private(self); struct obio_attach_args *obio = opaque; + bus_space_handle_t ioh; uint32_t rev; char buf[256]; - const char *cid; + const char *cid, *did, *fmt; + const char *omap35x_fmt = "\177\020" + "b\0TO_OUT\0" + "b\1four_bit_mmc\0" + "b\2CCP2_CSI1\0" + "b\3CMADS_FL3G\0" + "b\4NEON_VFPLite\0" + "b\5ISP_disable\0" + "f\6\2IVA2_MHz\0=\0 430\0=\2 266\0" + "f\10\2ARM_MHz\0=\0 600\0=\1 400\0=\2 266\0" + "f\12\2MPU_L2_cache_size\0=\0 0KB\0=\1 64KB\0=\2 128KB\0=\3 Full\0" + "b\14IVA_disable_acc\0" + "f\15\2SGX_scalable_control\0=\0Full\0=\1Half\0=\2not-present\0\0"; + const char *amdm37x_fmt = "\177\020" + "f\0\4Feature Tiering\0=\0All features aval\0=\1ISP not avail\0" + "f\11\1MPU/IVA frequency\0=\0 800/600 MHz\0=\1 1000/800 MHz\0" + "f\12\2MPU_L2_cache_size\0=\0 0KB\0=\2 128KB\0=\3 Full\0" + "f\14\1IVA 2.2 subsystem\0=\0Full use\0=\1Not available\0" + "f\15\2 2D/3D accelerator\0=\0Full use\0=\2HW not present\0"; aprint_naive("\n"); @@ -159,32 +181,83 @@ omap3_scm_attach(device_t parent, device aprint_error(": couldn't map address space\n"); return; } + if (bus_space_map(obio->obio_iot, + obio->obio_addr + SCM_CONTROL_IDCODE, sizeof(uint32_t), + 0, ) != 0) { + aprint_error(": couldn't map CONTROL_IDCODE space\n"); + return; + } + sc->sc_did = bus_space_read_4(sc->sc_iot, ioh, 0); + bus_space_unmap(sc->sc_iot, ioh, sizeof(uint32_t)); rev = SCM_READ_REG(sc, CONTROL_REVISION); aprint_normal(": rev. 0x%x\n", rev & 0xff); sc->sc_cid = SCM_READ_REG(sc, CONTROL_OMAP_STATUS & 0x); - switch (sc->sc_cid) { - case CHIPID_OMAP3503: cid = "OMAP3503"; break; - case CHIPID_OMAP3515: cid = "OMAP3515"; break; - case CHIPID_OMAP3525: cid = "OMAP3525"; break; - case CHIPID_OMAP3530: cid = "OMAP3530"; break; - default: cid = "unknwon"; break; + cid = did = fmt = NULL; + switch (sc->sc_did) { + case DEVID_OMAP35X_ES10: + case DEVID_OMAP35X_ES20: + case DEVID_OMAP35X_ES21: + case DEVID_OMAP35X_ES30: + case DEVID_OMAP35X_ES31: + case DEVID_OMAP35X_ES312: + switch (sc->sc_cid) { + case
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Sun Jul 3 12:27:04 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_obiovar.h omap2_reg.h omap3_scm.c Log Message: Print DeviceID in attach(). Also test OMAP35x/AM37x/DM37x. And add omap_devid(). Tested on OMAP3503, OMAP3530 and AM3703. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omap2_obiovar.h \ src/sys/arch/arm/omap/omap3_scm.c cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/omap/omap2_reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: dholland Date: Tue May 31 02:26:00 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2430_intr.c Log Message: PR 50755 David Binderman: assert about table entries only when they exist. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/omap2430_intr.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/omap/omap2430_intr.c diff -u src/sys/arch/arm/omap/omap2430_intr.c:1.6 src/sys/arch/arm/omap/omap2430_intr.c:1.7 --- src/sys/arch/arm/omap/omap2430_intr.c:1.6 Fri Jul 1 20:30:21 2011 +++ src/sys/arch/arm/omap/omap2430_intr.c Tue May 31 02:26:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2430_intr.c,v 1.6 2011/07/01 20:30:21 dyoung Exp $ */ +/* $NetBSD: omap2430_intr.c,v 1.7 2016/05/31 02:26:00 dholland Exp $ */ /* * Define the SDP2430 specific information and then include the generic OMAP * interrupt header. @@ -35,7 +35,7 @@ #include "opt_omap.h" #include -__KERNEL_RCSID(0, "$NetBSD: omap2430_intr.c,v 1.6 2011/07/01 20:30:21 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2430_intr.c,v 1.7 2016/05/31 02:26:00 dholland Exp $"); #include #include @@ -455,7 +455,9 @@ deliver_irqs(register_t psw, int ipl, vo KASSERT((intrgroups[4].ig_pending_irqs & intrgroups[4].ig_irqsbyipl[ipl]) == 0); KASSERT((intrgroups[5].ig_pending_irqs & intrgroups[5].ig_irqsbyipl[ipl]) == 0); KASSERT((intrgroups[6].ig_pending_irqs & intrgroups[6].ig_irqsbyipl[ipl]) == 0); +#ifdef OMAP_2430 KASSERT((intrgroups[7].ig_pending_irqs & intrgroups[7].ig_irqsbyipl[ipl]) == 0); +#endif if (frame == NULL) last_delivered_ipl = saved_ipl; }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: dholland Date: Tue May 31 02:26:00 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2430_intr.c Log Message: PR 50755 David Binderman: assert about table entries only when they exist. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/omap2430_intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Apr 25 13:20:42 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: Check ChipID == OMAP3530. OVERO supports both OMAP3530/3503. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.19 src/sys/arch/arm/omap/omap3_sdhc.c:1.20 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.19 Mon Nov 2 22:21:01 2015 +++ src/sys/arch/arm/omap/omap3_sdhc.c Mon Apr 25 13:20:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.19 2015/11/02 22:21:01 jmcneill Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.20 2016/04/25 13:20:42 kiyohara Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.19 2015/11/02 22:21:01 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.20 2016/04/25 13:20:42 kiyohara Exp $"); #include "opt_omap.h" #include "edma.h" @@ -227,7 +227,8 @@ obiosdhc_attach(device_t parent, device_ sc->sc.sc_flags &= ~SDHC_FLAG_SINGLE_ONLY; #endif #if defined(OMAP_3530) - sc->sc.sc_flags &= ~SDHC_FLAG_SINGLE_ONLY; + if (omap_chipid() == CHIPID_OMAP3530) + sc->sc.sc_flags &= ~SDHC_FLAG_SINGLE_ONLY; #endif sc->sc.sc_host = sc->sc_hosts; sc->sc.sc_clkbase = 96000; /* 96MHZ */
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Apr 25 13:20:42 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: Check ChipID == OMAP3530. OVERO supports both OMAP3530/3503. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/omap/omap3_sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Apr 25 13:17:16 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_obio.c Log Message: Add omapscm to critical_devs[]. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/omap/omap2_obio.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/omap/omap2_obio.c diff -u src/sys/arch/arm/omap/omap2_obio.c:1.22 src/sys/arch/arm/omap/omap2_obio.c:1.23 --- src/sys/arch/arm/omap/omap2_obio.c:1.22 Tue Apr 14 18:37:43 2015 +++ src/sys/arch/arm/omap/omap2_obio.c Mon Apr 25 13:17:16 2016 @@ -1,7 +1,7 @@ -/* $Id: omap2_obio.c,v 1.22 2015/04/14 18:37:43 bouyer Exp $ */ +/* $Id: omap2_obio.c,v 1.23 2016/04/25 13:17:16 kiyohara Exp $ */ /* adapted from: */ -/* $NetBSD: omap2_obio.c,v 1.22 2015/04/14 18:37:43 bouyer Exp $ */ +/* $NetBSD: omap2_obio.c,v 1.23 2016/04/25 13:17:16 kiyohara Exp $ */ /* @@ -103,7 +103,7 @@ #include "opt_omap.h" #include -__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.22 2015/04/14 18:37:43 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.23 2016/04/25 13:17:16 kiyohara Exp $"); #include "locators.h" #include "obio.h" @@ -366,6 +366,9 @@ static const struct { bus_addr_t addr; bool required; } critical_devs[] = { +#if defined(OMAP_3530) + { .name = "omapscm", .addr = 0x48002000, .required = true }, +#endif #if defined(OMAP_2430) || defined(OMAP_2420) { .name = "avic", .addr = INTC_BASE, .required = true }, #endif
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Apr 25 13:17:16 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_obio.c Log Message: Add omapscm to critical_devs[]. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/omap/omap2_obio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Apr 25 13:14:37 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_obiovar.h omap3_scm.c Log Message: Add function omap_chipid(). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap2_obiovar.h \ src/sys/arch/arm/omap/omap3_scm.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/omap/omap2_obiovar.h diff -u src/sys/arch/arm/omap/omap2_obiovar.h:1.3 src/sys/arch/arm/omap/omap2_obiovar.h:1.4 --- src/sys/arch/arm/omap/omap2_obiovar.h:1.3 Tue Apr 14 18:37:43 2015 +++ src/sys/arch/arm/omap/omap2_obiovar.h Mon Apr 25 13:14:37 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_obiovar.h,v 1.3 2015/04/14 18:37:43 bouyer Exp $ */ +/* $NetBSD: omap2_obiovar.h,v 1.4 2016/04/25 13:14:37 kiyohara Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -53,4 +53,6 @@ struct obio_softc { device_t sc_obio_dev; }; +uint32_t omap_chipid(void); + #endif /* _ARM_OMAP_OMAP2_OBIOVAR_H_ */ Index: src/sys/arch/arm/omap/omap3_scm.c diff -u src/sys/arch/arm/omap/omap3_scm.c:1.3 src/sys/arch/arm/omap/omap3_scm.c:1.4 --- src/sys/arch/arm/omap/omap3_scm.c:1.3 Mon Apr 25 13:07:03 2016 +++ src/sys/arch/arm/omap/omap3_scm.c Mon Apr 25 13:14:37 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_scm.c,v 1.3 2016/04/25 13:07:03 kiyohara Exp $ */ +/* $NetBSD: omap3_scm.c,v 1.4 2016/04/25 13:14:37 kiyohara Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill@@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_scm.c,v 1.3 2016/04/25 13:07:03 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_scm.c,v 1.4 2016/04/25 13:14:37 kiyohara Exp $"); #include "opt_omap.h" @@ -254,3 +254,15 @@ omap3_scm_sensor_refresh(struct sysmon_e edata->state = ENVSYS_SVALID; } } + +uint32_t +omap_chipid(void) +{ + struct omap3_scm_softc *sc; + device_t dev; + + dev = device_find_by_xname("omapscm0"); + KASSERT(dev != NULL); + sc = device_private(dev); + return sc->sc_cid; +}
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: kiyohara Date: Mon Apr 25 13:14:37 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_obiovar.h omap3_scm.c Log Message: Add function omap_chipid(). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap2_obiovar.h \ src/sys/arch/arm/omap/omap3_scm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.