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) && s != NULL) { + if (prop_dictionary_get_string(prop, key, &s) && 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: 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->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: 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(&omapgpio_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(&omapgpio_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(&omapgpio_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: 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: 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 = &omap_bs_tag; - mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SCHED); + mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM); if (bus_space_map(sc->sc_iot, mb->mb_iobase, mb->mb_iosize, 0, &sc->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. 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: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, device_
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));
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: 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(&gpio_module[1]); + break; + case GPIO2_BASE_TI_AM335X: + prcm_module_enable(&gpio_module[2]); + break; + case GPIO3_BASE_TI_AM335X: + prcm_module_enable(&gpio_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: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->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, &mode, &state) == 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, &mode, &state) == 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->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->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_A
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 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. 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->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->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: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, cfdata
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->sc_did); + sitara_cm_reg_read_4(OMAP2SCM_DEV_FEATURE, &sc->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 2014 +++ src/sys/a
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->sc_portconfig[0].value); +#if defined(OMAP4) || defined(OMAP5) + prop_dictionary_get_bool(prop, "port0-extclk", &sc->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->sc_portconfig[1].value); +#if defined(OMAP4) || defined(OMAP5) + prop_dictionary_get_bool(prop, "port1-extclk", &sc->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->sc_portconfig[2].value); +#if defined(OMAP4) || defined(OMAP5) + prop_dictionary_get_bool(prop, "port2-extclk", &sc->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 (sc->sc_
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: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: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. 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 = &omap2icu_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: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->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: 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->sc); if (sc->sc_ih == NULL) { aprint_error_dev(self, "failed to establish interrupt %d\n",
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: 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. 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->sc_tick_ch, 0);
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 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: 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->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) || defined(TI_A
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. 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->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->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: 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, &ioh) == 0 && bus_space_map(iot, iobase, obio->obio_size, 0, &ioh)) {
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, &bh)) - return 1; - - rv = comprobe1(obio->obio_iot, bh); + 0, &bh) != 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(&am335x_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, &ioh) != 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 CHIPID_OMAP3503: cid = "OMAP3503";
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: 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: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: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:07:03 UTC 2016 Modified Files: src/sys/arch/arm/omap: omap2_reg.h omap3_scm.c Log Message: Print OMAP3 ChipID. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/omap/omap2_reg.h cvs rdiff -u -r1.2 -r1.3 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_reg.h diff -u src/sys/arch/arm/omap/omap2_reg.h:1.30 src/sys/arch/arm/omap/omap2_reg.h:1.31 --- src/sys/arch/arm/omap/omap2_reg.h:1.30 Sat Jun 6 14:00:32 2015 +++ src/sys/arch/arm/omap/omap2_reg.h Mon Apr 25 13:07:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_reg.h,v 1.30 2015/06/06 14:00:32 jmcneill Exp $ */ +/* $NetBSD: omap2_reg.h,v 1.31 2016/04/25 13:07:03 kiyohara Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -141,6 +141,12 @@ #define TI_DM37XX_L4_EMULATION_BASE 0x5400 #define TI_DM37XX_L4_EMULATION_SIZE 0x0080 /* 8MB */ + +#define CHIPID_OMAP3503 0x5c00 +#define CHIPID_OMAP3515 0x1c00 +#define CHIPID_OMAP3525 0x4c00 +#define CHIPID_OMAP3530 0x0c00 + /* * Clock Management registers base, offsets, and size */ Index: src/sys/arch/arm/omap/omap3_scm.c diff -u src/sys/arch/arm/omap/omap3_scm.c:1.2 src/sys/arch/arm/omap/omap3_scm.c:1.3 --- src/sys/arch/arm/omap/omap3_scm.c:1.2 Wed Mar 13 03:08:17 2013 +++ src/sys/arch/arm/omap/omap3_scm.c Mon Apr 25 13:07:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_scm.c,v 1.2 2013/03/13 03:08:17 khorben Exp $ */ +/* $NetBSD: omap3_scm.c,v 1.3 2016/04/25 13:07:03 kiyohara Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_scm.c,v 1.2 2013/03/13 03:08:17 khorben Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_scm.c,v 1.3 2016/04/25 13:07:03 kiyohara Exp $"); #include "opt_omap.h" @@ -67,6 +67,8 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_scm.c, #define CONTROL_TEMP_SENSOR_EOCZ __BIT(7) #define CONTROL_TEMP_SENSOR_TEMP_MASK __BITS(6,0) +#define CONTROL_OMAP_STATUS 0x44c + /* CONTROL_TEMP_SENSOR TEMP bits to tenths of a degree */ static const int omap3_scm_adc2temp[128] = { -400, -400, -400, -400, -400, @@ -103,6 +105,8 @@ struct omap3_scm_softc { bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; + uint32_t sc_cid; + /* GENERAL */ struct sysmon_envsys *sc_sme; envsys_data_t sc_sensor; @@ -140,6 +144,8 @@ omap3_scm_attach(device_t parent, device struct omap3_scm_softc *sc = device_private(self); struct obio_attach_args *obio = opaque; uint32_t rev; + char buf[256]; + const char *cid; aprint_naive("\n"); @@ -156,6 +162,29 @@ omap3_scm_attach(device_t parent, device 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; + } + aprint_normal_dev(self, "%s: ", cid); + snprintb(buf, sizeof(buf), "\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", + sc->sc_cid); + aprint_normal("%s\n", buf); omap3_scm_sensor_attach(sc); }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jakllsch Date: Sat Apr 23 17:05:30 UTC 2016 Modified Files: src/sys/arch/arm/omap: obio_wdt.c Log Message: Put omapwdt32k(4) in known state (disarmed) on attach. Some newer U-Boot builds for am335x_evm (BeagleBone) hand us the hardware with an armed watchdog. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/obio_wdt.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_wdt.c diff -u src/sys/arch/arm/omap/obio_wdt.c:1.6 src/sys/arch/arm/omap/obio_wdt.c:1.7 --- src/sys/arch/arm/omap/obio_wdt.c:1.6 Wed Sep 5 00:19:59 2012 +++ src/sys/arch/arm/omap/obio_wdt.c Sat Apr 23 17:05:30 2016 @@ -33,7 +33,7 @@ #include "opt_omap.h" #include -__KERNEL_RCSID(0, "$NetBSD: obio_wdt.c,v 1.6 2012/09/05 00:19:59 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obio_wdt.c,v 1.7 2016/04/23 17:05:30 jakllsch Exp $"); #include #include @@ -101,4 +101,17 @@ obiowdt32k_attach(device_t parent, devic (1 << WD_SYSCONFIG_AUTOIDLE); bus_space_write_4(omapwdt32k_sc->sc_iot, omapwdt32k_sc->sc_ioh, WD_SYSCONFIG, omapwdt_sysconfig); + + /* + * Put watchdog in known (disarmed) state. + * + * Some U-Boot versions on BeagleBone will leave the watchdog + * armed at boot. + * + * XXX Revisit this, perhaps we should just start tickling an + * armed watchdog. + */ + + sc->sc_armed = -1; + omapwdt32k_enable(0); }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Tue Dec 8 14:42:24 UTC 2015 Modified Files: src/sys/arch/arm/omap: am335x_gpio.c Log Message: Don't rely on uboot to enable am335x gpio clocks >From jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/am335x_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/am335x_gpio.c diff -u src/sys/arch/arm/omap/am335x_gpio.c:1.1 src/sys/arch/arm/omap/am335x_gpio.c:1.2 --- src/sys/arch/arm/omap/am335x_gpio.c:1.1 Mon Nov 2 00:48:45 2015 +++ src/sys/arch/arm/omap/am335x_gpio.c Tue Dec 8 14:42:24 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_gpio.c,v 1.1 2015/11/02 00:48:45 jmcneill Exp $ */ +/* $NetBSD: am335x_gpio.c,v 1.2 2015/12/08 14:42:24 skrll Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: am335x_gpio.c,v 1.1 2015/11/02 00:48:45 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: am335x_gpio.c,v 1.2 2015/12/08 14:42:24 skrll Exp $"); #define _INTR_PRIVATE @@ -54,11 +54,23 @@ __KERNEL_RCSID(0, "$NetBSD: am335x_gpio. #include #include +#include +#include +#include +#include + #if NGPIO > 0 #include #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 }, +}; + #define AM335X_GPIO_REVISION 0x000 #define AM335X_GPIO_SYSCONFIG 0x010 #define AM335X_GPIO_EIO 0x020 @@ -232,6 +244,22 @@ gpio_attach(device_t parent, device_t se aprint_normal("\n"); +#ifdef TI_AM335X + switch (oa->obio_addr) { + case GPIO0_BASE_TI_AM335X: + break; + case GPIO1_BASE_TI_AM335X: + prcm_module_enable(&gpio_module[1]); + break; + case GPIO2_BASE_TI_AM335X: + prcm_module_enable(&gpio_module[2]); + break; + case GPIO3_BASE_TI_AM335X: + prcm_module_enable(&gpio_module[3]); + break; + } +#endif + #if NGPIO > 0 gpio_attach1(self); #endif
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jmcneill Date: Mon Nov 2 22:21:01 UTC 2015 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: Support 8-bit eMMC for TI AM335x. On my BeagleBone Black, Before: 134217728 bytes transferred in 9.410 secs (14263307 bytes/sec) After: 134217728 bytes transferred in 7.518 secs (17852850 bytes/sec) To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 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.18 src/sys/arch/arm/omap/omap3_sdhc.c:1.19 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.18 Sun Nov 1 23:33:05 2015 +++ src/sys/arch/arm/omap/omap3_sdhc.c Mon Nov 2 22:21:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.18 2015/11/01 23:33:05 jmcneill Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.19 2015/11/02 22:21:01 jmcneill 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.18 2015/11/01 23:33:05 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.19 2015/11/02 22:21:01 jmcneill Exp $"); #include "opt_omap.h" #include "edma.h" @@ -51,6 +51,8 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c #ifdef TI_AM335X # include # include +# include +# include #endif #if NEDMA > 0 @@ -84,6 +86,7 @@ static int obiosdhc_match(device_t, cfda 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_bus_clock(struct sdhc_softc *, int); static int obiosdhc_rod(struct sdhc_softc *, int); static int obiosdhc_write_protect(struct sdhc_softc *); @@ -132,6 +135,24 @@ static const struct am335x_sdhc am335x_s { "MMC1", SDMMC2_BASE_TIAM335X, 28, { AM335X_PRCM_CM_PER, 0xf4 } }, { "MMCHS2", SDMMC3_BASE_TIAM335X, 29, { AM335X_PRCM_CM_WKUP, 0xf8 } }, }; + +struct am335x_padconf { + const char *padname; + const char *padmode; +}; +const struct am335x_padconf am335x_padconf_mmc1[] = { + { "GPMC_CSn1", "mmc1_clk" }, + { "GPMC_CSn2", "mmc1_cmd" }, + { "GPMC_AD0", "mmc1_dat0" }, + { "GPMC_AD1", "mmc1_dat1" }, + { "GPMC_AD2", "mmc1_dat2" }, + { "GPMC_AD3", "mmc1_dat3" }, + { "GPMC_AD4", "mmc1_dat4" }, + { "GPMC_AD5", "mmc1_dat5" }, + { "GPMC_AD6", "mmc1_dat6" }, + { "GPMC_AD7", "mmc1_dat7" }, + { NULL, NULL } +}; #endif CFATTACH_DECL_NEW(obiosdhc, sizeof(struct obiosdhc_softc), @@ -216,6 +237,7 @@ obiosdhc_attach(device_t parent, device_ sc->sc.sc_vendor_write_protect = obiosdhc_write_protect; sc->sc.sc_vendor_card_detect = obiosdhc_card_detect; sc->sc.sc_vendor_bus_clock = obiosdhc_bus_clock; + sc->sc.sc_vendor_bus_width = obiosdhc_bus_width; sc->sc_bst = oa->obio_iot; clksft = ffs(sc->sc.sc_clkmsk) - 1; @@ -261,6 +283,27 @@ no_dma: break; } KASSERT(i < __arraycount(am335x_sdhc)); + + if (oa->obio_addr == SDMMC2_BASE_TIAM335X) { + const char *mode; + u_int state; + + const struct am335x_padconf *padconf = am335x_padconf_mmc1; + for (i = 0; padconf[i].padname; i++) { + const char *padname = padconf[i].padname; + const char *padmode = padconf[i].padmode; + if (sitara_cm_padconf_get(padname, &mode, &state) == 0) { +aprint_debug_dev(self, "%s mode %s state %d\n", +padname, mode, state); + } + if (sitara_cm_padconf_set(padname, padmode, + (1 << 4) | (1 << 5)) != 0) { +aprint_error_dev(self, "can't switch %s pad from %s to %s\n", +padname, mode, padmode); +return; + } + } + } #endif /* XX: Turn-on regulator via I2C. */ @@ -422,6 +465,23 @@ obiosdhc_card_detect(struct sdhc_softc * } static int +obiosdhc_bus_width(struct sdhc_softc *sc, int width) +{ + struct obiosdhc_softc *osc = (struct obiosdhc_softc *)sc; + uint32_t con; + + con = bus_space_read_4(osc->sc_bst, osc->sc_bsh, MMCHS_CON); + if (width == 8) { + con |= CON_DW8; + } else { + con &= ~CON_DW8; + } + bus_space_write_4(osc->sc_bst, osc->sc_bsh, MMCHS_CON, con); + + return 0; +} + +static int obiosdhc_bus_clock(struct sdhc_softc *sc, int clk) { struct obiosdhc_softc *osc = (struct obiosdhc_softc *)sc;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jmcneill Date: Mon Nov 2 00:48:45 UTC 2015 Modified Files: src/sys/arch/arm/omap: files.omap2 Added Files: src/sys/arch/arm/omap: am335x_gpio.c Log Message: add basic AM335x GPIO support To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/omap/am335x_gpio.c cvs rdiff -u -r1.31 -r1.32 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.31 src/sys/arch/arm/omap/files.omap2:1.32 --- src/sys/arch/arm/omap/files.omap2:1.31 Sat Jun 6 14:00:32 2015 +++ src/sys/arch/arm/omap/files.omap2 Mon Nov 2 00:48:45 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.omap2,v 1.31 2015/06/06 14:00:32 jmcneill Exp $ +# $NetBSD: files.omap2,v 1.32 2015/11/02 00:48:45 jmcneill Exp $ # # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support # Based on xscale/files.pxa2x0 @@ -59,7 +59,8 @@ 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) & omapgpio +file arch/arm/omap/omap2_gpio.c (omap2 | omap3) & !ti_am335x & omapgpio +file arch/arm/omap/am335x_gpio.c ti_am335x & omapgpio # TI_AM335X (and maybe TI OMAP4) I2C controllers device tiiic: i2cbus, i2cexec Added files: Index: src/sys/arch/arm/omap/am335x_gpio.c diff -u /dev/null src/sys/arch/arm/omap/am335x_gpio.c:1.1 --- /dev/null Mon Nov 2 00:48:45 2015 +++ src/sys/arch/arm/omap/am335x_gpio.c Mon Nov 2 00:48:45 2015 @@ -0,0 +1,289 @@ +/* $NetBSD: am335x_gpio.c,v 1.1 2015/11/02 00:48:45 jmcneill Exp $ */ +/*- + * Copyright (c) 2007 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__KERNEL_RCSID(0, "$NetBSD: am335x_gpio.c,v 1.1 2015/11/02 00:48:45 jmcneill Exp $"); + +#define _INTR_PRIVATE + +#include "locators.h" +#include "gpio.h" +#include "opt_omap.h" + +#include +#include +#include + +#include + +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#if NGPIO > 0 +#include +#include +#endif + +#define AM335X_GPIO_REVISION 0x000 +#define AM335X_GPIO_SYSCONFIG 0x010 +#define AM335X_GPIO_EIO 0x020 +#define AM335X_GPIO_IRQSTATUS_RAW_0 0x024 +#define AM335X_GPIO_IRQSTATUS_RAW_1 0x028 +#define AM335X_GPIO_IRQSTATUS_0 0x02c +#define AM335X_GPIO_IRQSTATUS_1 0x030 +#define AM335X_GPIO_IRQSTATUS_SET_0 0x034 +#define AM335X_GPIO_IRQSTATUS_SET_1 0x038 +#define AM335X_GPIO_IRQSTATUS_CLR_0 0x03c +#define AM335X_GPIO_IRQSTATUS_CLR_1 0x040 +#define AM335X_GPIO_IRQWAKEN_0 0x044 +#define AM335X_GPIO_IRQWAKEN_1 0x048 +#define AM335X_GPIO_SYSSTATUS 0x114 +#define AM335X_GPIO_CTRL 0x130 +#define AM335X_GPIO_OE 0x134 +#define AM335X_GPIO_DATAIN 0x138 +#define AM335X_GPIO_DATAOUT 0x13c +#define AM335X_GPIO_LEVELDETECT0 0x140 +#define AM335X_GPIO_LEVELDETECT1 0x144 +#define AM335X_GPIO_RISINGDETECT 0x148 +#define AM335X_GPIO_FALLINGDETECT 0x14c +#define AM335X_GPIO_DEBOUNCEENABLE 0x150 +#define AM335X_GPIO_DEBOUNCINGTIME 0x154 +#define AM335X_GPIO_CLEARDATAOUT 0x190 +#define AM335X_GPIO_SETDATAOUT 0x194 + +struct gpio_softc { + device_t gpio_dev; + bus_space_tag_t gpio_memt; + bus_space_handle_t gpio_memh; +#if NGPIO > 0 + struct gpio_chipset_tag gpio_chipset; + gpio_pin_t gpio_pins[32]; +#endif +}; + +#define GPIO_READ(gpio, reg) \ + bus_space_read_4((gpio)->gpio_memt, (gpio)->gpio_memh, (r
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jmcneill Date: Sun Nov 1 23:33:05 UTC 2015 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: AM335x EDMA3 has an alignment restriction for both SAM and DAM in constant addressing mode. In these cases, the physical address must be aligned to 256-bits. To handle this, pre-allocate a MAXPHYS sized bounce buffer and use it for unaligned transfers. Fixes "edma errint!" problem mentioned in port-arm/50288. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 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.17 src/sys/arch/arm/omap/omap3_sdhc.c:1.18 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.17 Fri Jul 31 15:00:07 2015 +++ src/sys/arch/arm/omap/omap3_sdhc.c Sun Nov 1 23:33:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.17 2015/07/31 15:00:07 jmcneill Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.18 2015/11/01 23:33:05 jmcneill 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.17 2015/07/31 15:00:07 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.18 2015/11/01 23:33:05 jmcneill Exp $"); #include "opt_omap.h" #include "edma.h" @@ -105,13 +105,17 @@ struct obiosdhc_softc { kcondvar_t sc_edma_cv; bus_addr_t sc_edma_fifo; bool sc_edma_pending; + bus_dmamap_t sc_edma_dmamap; + bus_dma_segment_t sc_edma_segs[1]; + void *sc_edma_bbuf; #endif }; #if NEDMA > 0 -static void obiosdhc_edma_init(struct obiosdhc_softc *, unsigned int); +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 *); #endif #ifdef TI_AM335X @@ -229,10 +233,12 @@ obiosdhc_attach(device_t parent, device_ #if NEDMA > 0 if (oa->obio_edmabase != -1) { + if (obiosdhc_edma_init(sc, oa->obio_edmabase) != 0) + goto no_dma; + cv_init(&sc->sc_edma_cv, "sdhcedma"); sc->sc_edma_fifo = oa->obio_addr + OMAP3_SDMMC_SDHC_OFFSET + SDHC_DATA; - obiosdhc_edma_init(sc, oa->obio_edmabase); sc->sc.sc_flags |= SDHC_FLAG_USE_DMA; sc->sc.sc_flags |= SDHC_FLAG_EXTERNAL_DMA; sc->sc.sc_flags |= SDHC_FLAG_EXTDMA_DMAEN; @@ -240,6 +246,7 @@ obiosdhc_attach(device_t parent, device_ sc->sc.sc_vendor_transfer_data_dma = obiosdhc_edma_xfer_data; transfer_mode = "EDMA"; } +no_dma: #endif aprint_naive("\n"); @@ -432,10 +439,10 @@ obiosdhc_bus_clock(struct sdhc_softc *sc } #if NEDMA > 0 -static void +static int obiosdhc_edma_init(struct obiosdhc_softc *sc, unsigned int edmabase) { - int i; + int i, error, rseg; /* Request tx and rx DMA channels */ sc->sc_edma_tx = edma_channel_alloc(EDMA_TYPE_DMA, edmabase + 0, @@ -459,19 +466,99 @@ obiosdhc_edma_init(struct obiosdhc_softc KASSERT(sc->sc_edma_param_rx[i] != 0x); } - return; + /* Setup bounce buffer */ + error = bus_dmamem_alloc(sc->sc.sc_dmat, MAXPHYS, 32, MAXPHYS, + sc->sc_edma_segs, 1, &rseg, BUS_DMA_WAITOK); + if (error) { + aprint_error_dev(sc->sc.sc_dev, + "couldn't allocate dmamem: %d\n", error); + return error; + } + KASSERT(rseg == 1); + error = bus_dmamem_map(sc->sc.sc_dmat, sc->sc_edma_segs, rseg, MAXPHYS, + &sc->sc_edma_bbuf, BUS_DMA_WAITOK); + if (error) { + aprint_error_dev(sc->sc.sc_dev, "couldn't map dmamem: %d\n", + error); + return error; + } + error = bus_dmamap_create(sc->sc.sc_dmat, MAXPHYS, 1, MAXPHYS, 0, + BUS_DMA_WAITOK, &sc->sc_edma_dmamap); + if (error) { + aprint_error_dev(sc->sc.sc_dev, "couldn't create dmamap: %d\n", + error); + return error; + } + + return error; } static int obiosdhc_edma_xfer_data(struct sdhc_softc *sdhc_sc, struct sdmmc_command *cmd) { struct obiosdhc_softc *sc = device_private(sdhc_sc->sc_dev); + const bus_dmamap_t map = cmd->c_dmamap; + int seg, error; + bool bounce; + + for (bounce = false, seg = 0; seg < cmd->c_dmamap->dm_nsegs; seg++) { + if ((cmd->c_dmamap->dm_segs[seg].ds_addr & 0x1f) != 0) { + bounce = true; + break; + } + } + + if (bounce) { + error = bus_dmamap_load(sc->sc.sc_dmat, sc->sc_edma_dmamap, + sc->sc_edma_bbuf, MAXPHYS, NULL, BUS_DMA_WAITOK); + if (error) { + device_printf(sc->sc.sc_dev, + "[bounce] bus_dmamap_load failed: %d\n", error); + return error; + } + if (ISSET(cmd->c_flags, SCF_CMD_READ)) { + bus_dmamap_sync(sc->sc.sc_dmat, sc->sc_edma_dmamap, 0, + MAXPHYS, BUS_DMASYNC_PREREAD); + } else { + memcpy(sc->sc_edma_bbuf, cmd->c_data, cmd->c_datalen); + bus_dmamap_sync(sc->sc.sc_dmat, sc->sc_edma_dmamap, 0, + MAXPHYS, BUS_DMASYNC_PREWRITE); + } + + cmd->c_dmamap =
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Mon Sep 21 13:32:48 UTC 2015 Modified Files: src/sys/arch/arm/omap: omapl1x_emac.c Log Message: Deal with unused variables To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 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.1 src/sys/arch/arm/omap/omapl1x_emac.c:1.2 --- src/sys/arch/arm/omap/omapl1x_emac.c:1.1 Wed Oct 2 16:48:26 2013 +++ src/sys/arch/arm/omap/omapl1x_emac.c Mon Sep 21 13:32:48 2015 @@ -30,7 +30,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: omapl1x_emac.c,v 1.1 2013/10/02 16:48:26 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omapl1x_emac.c,v 1.2 2015/09/21 13:32:48 skrll Exp $"); #include "opt_omapl1x.h" @@ -621,7 +621,7 @@ emac_rx_desc_process (struct emac_softc bus_addr_t desc_offset; struct mbuf *mb; bus_addr_t desc_base; - u_int buf_len, off; + u_int buf_len; if ((entry = SIMPLEQ_FIRST(&chan->inuse_head)) == NULL) { return ENOENT; @@ -646,7 +646,7 @@ emac_rx_desc_process (struct emac_softc "Received packet spanning multiple buffers\n"); } - off = __SHIFTOUT(desc->len, (uint32_t)__BITS(26, 16)); + //off = __SHIFTOUT(desc->len, (uint32_t)__BITS(26, 16)); buf_len = __SHIFTOUT(desc->mode, (uint32_t)__BITS(10, 0)); if (desc->mode & PASSCRC) @@ -782,7 +782,6 @@ emac_soft_intr (void *arg) struct emac_softc * const sc = arg; struct ifnet * const ifp = &sc->sc_if; u_int soft_flags = atomic_swap_uint(&sc->sc_soft_flags, 0); - u_int tx_pkts_freed, rx_pkts_freed; if (soft_flags & SOFT_RESET) { int s = splnet(); @@ -797,15 +796,13 @@ emac_soft_intr (void *arg) /* We are working on channel 0 */ if (mask & TX0PEND) { - tx_pkts_freed = emac_free_descs(sc, &sc->tx_chan, - EMAC_TX_DESC_FREE); + emac_free_descs(sc, &sc->tx_chan, EMAC_TX_DESC_FREE); } EMAC_WRITE(sc, MACEOIVECTOR, C0TXDONE); if (mask & RX0PEND) { - rx_pkts_freed = emac_free_descs(sc, &sc->rx_chan, - EMAC_RX_DESC_FREE); + emac_free_descs(sc, &sc->rx_chan, EMAC_RX_DESC_FREE); } EMAC_WRITE(sc, MACEOIVECTOR, C0RXDONE);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jmcneill Date: Sat Jun 6 14:00:32 UTC 2015 Modified Files: src/sys/arch/arm/omap: am335x_prcm.h files.omap2 omap2_reg.h Added Files: src/sys/arch/arm/omap: am335x_trng.c am335x_trngreg.h Log Message: Add driver for AM335x TRNG module. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/am335x_prcm.h cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/omap/am335x_trng.c \ src/sys/arch/arm/omap/am335x_trngreg.h cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/omap/files.omap2 cvs rdiff -u -r1.29 -r1.30 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/am335x_prcm.h diff -u src/sys/arch/arm/omap/am335x_prcm.h:1.8 src/sys/arch/arm/omap/am335x_prcm.h:1.9 --- src/sys/arch/arm/omap/am335x_prcm.h:1.8 Sun Jul 20 23:08:43 2014 +++ src/sys/arch/arm/omap/am335x_prcm.h Sat Jun 6 14:00:32 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_prcm.h,v 1.8 2014/07/20 23:08:43 bouyer Exp $ */ +/* $NetBSD: am335x_prcm.h,v 1.9 2015/06/06 14:00:32 jmcneill Exp $ */ /* * TI OMAP Power, Reset, and Clock Management on the AM335x @@ -63,6 +63,7 @@ struct omap_module { #define CM_PER_TIMER2_CLKCTRL 0x080 #define CM_PER_TIMER3_CLKCTRL 0x084 #define CM_PER_TIMER4_CLKCTRL 0x088 +#define CM_PER_RNG_CLKCTRL 0x090 #define CM_PER_GPIO1_CLKCTRL 0x0AC #define CM_PER_GPIO2_CLKCTRL 0x0B0 #define CM_PER_GPIO3_CLKCTRL 0x0B4 Index: src/sys/arch/arm/omap/files.omap2 diff -u src/sys/arch/arm/omap/files.omap2:1.30 src/sys/arch/arm/omap/files.omap2:1.31 --- src/sys/arch/arm/omap/files.omap2:1.30 Tue Apr 14 18:37:43 2015 +++ src/sys/arch/arm/omap/files.omap2 Sat Jun 6 14:00:32 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.omap2,v 1.30 2015/04/14 18:37:43 bouyer Exp $ +# $NetBSD: files.omap2,v 1.31 2015/06/06 14:00:32 jmcneill Exp $ # # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support # Based on xscale/files.pxa2x0 @@ -174,6 +174,10 @@ device edma attach edma at obio file arch/arm/omap/omap_edma.c edma needs-flag +device trng +attach trng at obio +file arch/arm/omap/am335x_trng.c trng + # these bus space methods are not bus-specific ... # file arch/arm/omap/omap_nobyteacc_space.c emifs | gpmc Index: src/sys/arch/arm/omap/omap2_reg.h diff -u src/sys/arch/arm/omap/omap2_reg.h:1.29 src/sys/arch/arm/omap/omap2_reg.h:1.30 --- src/sys/arch/arm/omap/omap2_reg.h:1.29 Tue Apr 14 18:37:43 2015 +++ src/sys/arch/arm/omap/omap2_reg.h Sat Jun 6 14:00:32 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_reg.h,v 1.29 2015/04/14 18:37:43 bouyer Exp $ */ +/* $NetBSD: omap2_reg.h,v 1.30 2015/06/06 14:00:32 jmcneill Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -912,4 +912,10 @@ #define AM335X_INT_TCERRINT0 112 #define AM335X_INT_TCERRINT1 113 #define AM335X_INT_TCERRINT2 114 + +/* TRNG */ +#define AM335X_TRNG_BASE 0x4831 +#define AM335X_TRNG_SIZE 0x2000 +#define AM335X_INT_TRNG 111 + #endif /* _ARM_OMAP_OMAP2_REG_H_ */ Added files: Index: src/sys/arch/arm/omap/am335x_trng.c diff -u /dev/null src/sys/arch/arm/omap/am335x_trng.c:1.1 --- /dev/null Sat Jun 6 14:00:32 2015 +++ src/sys/arch/arm/omap/am335x_trng.c Sat Jun 6 14:00:32 2015 @@ -0,0 +1,184 @@ +/* $NetBSD: am335x_trng.c,v 1.1 2015/06/06 14:00:32 jmcneill Exp $ */ + +/*- + * Copyright (c) 2015 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + *derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: am335x_trng.c,v 1.1 2015/06/06 14:00:32 jmcneill Exp $"); + +#include "opt_omap.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +static const struct o
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jmcneill Date: Thu Apr 16 21:50:35 UTC 2015 Modified Files: src/sys/arch/arm/omap: if_cpsw.c if_cpswreg.h Log Message: Disable flow control with CPSW_SS FLOW_CONTROL register (cherry-picked from FreeBSD driver). Resolves device timeout / watchdog issues for me. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/omap/if_cpsw.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/if_cpswreg.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/if_cpsw.c diff -u src/sys/arch/arm/omap/if_cpsw.c:1.11 src/sys/arch/arm/omap/if_cpsw.c:1.12 --- src/sys/arch/arm/omap/if_cpsw.c:1.11 Thu Mar 26 22:00:45 2015 +++ src/sys/arch/arm/omap/if_cpsw.c Thu Apr 16 21:50:35 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.11 2015/03/26 22:00:45 skrll Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.12 2015/04/16 21:50:35 jmcneill Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.11 2015/03/26 22:00:45 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.12 2015/04/16 21:50:35 jmcneill Exp $"); #include #include @@ -954,6 +954,9 @@ cpsw_init(struct ifnet *ifp) } sc->sc_rxhead = 0; + /* turn off flow control */ + cpsw_write_4(sc, CPSW_SS_FLOW_CONTROL, 0); + /* align layer 3 header to 32-bit */ cpsw_write_4(sc, CPSW_CPDMA_RX_BUFFER_OFFSET, ETHER_ALIGN); Index: src/sys/arch/arm/omap/if_cpswreg.h diff -u src/sys/arch/arm/omap/if_cpswreg.h:1.4 src/sys/arch/arm/omap/if_cpswreg.h:1.5 --- src/sys/arch/arm/omap/if_cpswreg.h:1.4 Fri Mar 13 08:56:35 2015 +++ src/sys/arch/arm/omap/if_cpswreg.h Thu Apr 16 21:50:35 2015 @@ -37,6 +37,7 @@ #define CPSW_SS_SOFT_RESET (CPSW_SS_OFFSET + 0x08) #define CPSW_SS_STAT_PORT_EN (CPSW_SS_OFFSET + 0x0C) #define CPSW_SS_PTYPE (CPSW_SS_OFFSET + 0x10) +#define CPSW_SS_FLOW_CONTROL (CPSW_SS_OFFSET + 0x24) #define CPSW_SS_RGMII_CTL (CPSW_SS_OFFSET + 0x88) #define CPSW_PORT_OFFSET 0x0100
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: bouyer Date: Tue Apr 14 18:45:25 UTC 2015 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: Add support for DMA transfers. From Jared D. McNeill, with final debug by me. With this I can get nearly 20MB/s from my sdcard on the BB black at 1Ghz (not bad for a 50Mhz 4-bits bus), and still 15MB/s on the BB white at low speed (275Mhz). To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 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.15 src/sys/arch/arm/omap/omap3_sdhc.c:1.16 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.15 Mon Jan 12 01:02:35 2015 +++ src/sys/arch/arm/omap/omap3_sdhc.c Tue Apr 14 18:45:25 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.15 2015/01/12 01:02:35 jakllsch Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.16 2015/04/14 18:45:25 bouyer Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,9 +29,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.15 2015/01/12 01:02:35 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.16 2015/04/14 18:45:25 bouyer Exp $"); #include "opt_omap.h" +#include "edma.h" #include #include @@ -39,7 +40,8 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c #include #include #include - +#include +#include #include #include @@ -51,8 +53,25 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c # include #endif +#if NEDMA > 0 +# include +#endif + #include #include +#include + +#ifdef TI_AM335X +#define EDMA_MAX_PARAMS 32 +#endif + +#ifdef OM3SDHC_DEBUG +int om3sdhcdebug = 1; +#define DPRINTF(n,s)do { if ((n) <= om3sdhcdebug) device_printf s; } while (0) +#else +#define DPRINTF(n,s)do {} while (0) +#endif + #define CLKD(kz) (sc->sc.sc_clkbase / (kz)) @@ -77,8 +96,25 @@ struct obiosdhc_softc { bus_space_handle_t sc_sdhc_bsh; struct sdhc_host *sc_hosts[1]; void *sc_ih; /* interrupt vectoring */ + +#if NEDMA > 0 + struct edma_channel *sc_edma_tx; + struct edma_channel *sc_edma_rx; + uint16_t sc_edma_param_tx[EDMA_MAX_PARAMS]; + uint16_t sc_edma_param_rx[EDMA_MAX_PARAMS]; + kmutex_t sc_edma_lock; + kcondvar_t sc_edma_cv; + bus_addr_t sc_edma_fifo; + bool sc_edma_pending; +#endif }; +#if NEDMA > 0 +static void 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 *); +#endif + #ifdef TI_AM335X struct am335x_sdhc { const char *as_name; @@ -147,6 +183,7 @@ obiosdhc_attach(device_t parent, device_ uint32_t clkd, stat; int error, timo, clksft, n; bool support8bit = false; + const char *transfer_mode = "PIO"; #ifdef TI_AM335X size_t i; #endif @@ -155,7 +192,6 @@ obiosdhc_attach(device_t parent, device_ sc->sc.sc_dmat = oa->obio_dmat; sc->sc.sc_dev = self; - //sc->sc.sc_flags |= SDHC_FLAG_USE_DMA; 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; @@ -192,8 +228,24 @@ obiosdhc_attach(device_t parent, device_ bus_space_subregion(sc->sc_bst, sc->sc_bsh, OMAP3_SDMMC_SDHC_OFFSET, OMAP3_SDMMC_SDHC_SIZE, &sc->sc_sdhc_bsh); - aprint_naive(": SDHC controller\n"); - aprint_normal(": SDHC controller\n"); +#if NEDMA > 0 + if (oa->obio_edmabase != -1) { + mutex_init(&sc->sc_edma_lock, MUTEX_DEFAULT, IPL_SCHED); + cv_init(&sc->sc_edma_cv, "sdhcedma"); + sc->sc_edma_fifo = oa->obio_addr + + OMAP3_SDMMC_SDHC_OFFSET + SDHC_DATA; + obiosdhc_edma_init(sc, oa->obio_edmabase); + sc->sc.sc_flags |= SDHC_FLAG_USE_DMA; + sc->sc.sc_flags |= SDHC_FLAG_EXTERNAL_DMA; + sc->sc.sc_flags |= SDHC_FLAG_EXTDMA_DMAEN; + sc->sc.sc_flags &= ~SDHC_FLAG_SINGLE_ONLY; + sc->sc.sc_vendor_transfer_data_dma = obiosdhc_edma_xfer_data; + transfer_mode = "EDMA"; + } +#endif + + aprint_naive("\n"); + aprint_normal(": SDHC controller (%s)\n", transfer_mode); #ifdef TI_AM335X /* XXX Not really AM335X-specific. */ @@ -380,3 +432,145 @@ obiosdhc_bus_clock(struct sdhc_softc *sc return 0; } + +#if NEDMA > 0 +static void +obiosdhc_edma_init(struct obiosdhc_softc *sc, unsigned int edmabase) +{ + int i; + + /* Request tx and rx DMA channels */ + sc->sc_edma_tx = edma_channel_alloc(EDMA_TYPE_DMA, edmabase + 0, + obiosdhc_edma_done, sc); + KASSERT(sc->sc_edma_tx != NULL); + sc->sc_edma_rx = edma_channel_alloc(EDMA_TYPE_DMA, edmabase + 1, + obiosdhc_edma_done, sc); + KASSERT(sc->sc_edma_rx != NULL); + + device_printf(sc->sc.sc_dev, "EDMA tx channel %d, rx channel %d\n", + edma_channel_index(sc->sc_edma_tx), + edma_channel_index(sc->sc_edma_rx)); + + /* Allocate some PaRAM pages */ + for (i = 0; i < __arraycount(sc->sc_edma_param_tx); i++) { + sc->sc_edma_param_tx[i] = ed
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: bouyer Date: Tue Apr 14 18:38:27 UTC 2015 Removed Files: src/sys/arch/arm/omap: omap_edma.c.orig omap_edma.h.orig Log Message: Ops, remove empty files that should not be there. To generate a diff of this commit: cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/omap/omap_edma.c.orig \ src/sys/arch/arm/omap/omap_edma.h.orig 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: bouyer Date: Tue Apr 14 18:37:43 UTC 2015 Modified Files: src/sys/arch/arm/omap: files.omap2 omap2_obio.c omap2_obiovar.h omap2_reg.h Added Files: src/sys/arch/arm/omap: omap_edma.c omap_edma.c.orig omap_edma.h omap_edma.h.orig Log Message: Add a driver for the Enhanced Direct Memory Access controller found in the AM335x SoC. Written by Jared D. McNeill, with some final debug by me. Supports only DMA (not QDMA) yet, and there's no support for DMA event matrix yet (this means that only primary DMA events can be used) To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/omap/files.omap2 cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/omap/omap2_obio.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/omap2_obiovar.h cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/omap/omap2_reg.h cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/omap/omap_edma.c \ src/sys/arch/arm/omap/omap_edma.c.orig src/sys/arch/arm/omap/omap_edma.h \ src/sys/arch/arm/omap/omap_edma.h.orig 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.29 src/sys/arch/arm/omap/files.omap2:1.30 --- src/sys/arch/arm/omap/files.omap2:1.29 Fri Aug 22 19:44:04 2014 +++ src/sys/arch/arm/omap/files.omap2 Tue Apr 14 18:37:43 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.omap2,v 1.29 2014/08/22 19:44:04 jakllsch Exp $ +# $NetBSD: files.omap2,v 1.30 2015/04/14 18:37:43 bouyer Exp $ # # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support # Based on xscale/files.pxa2x0 @@ -32,7 +32,7 @@ defflag opt_omap.hTI_AM335X: OMAP3 defflag opt_omap.hTI_DM37XX: OMAP3 # OBIO just an attach point -device obio { [addr=-1], [size=0], [intr=-1], [mult=1], [intrbase=-1], [nobyteacc=0] +device obio { [addr=-1], [size=0], [intr=-1], [mult=1], [intrbase=-1], [nobyteacc=0], [edmabase=-1] } : bus_space_generic attach obio at mainbus file arch/arm/omap/omap2_obio.c obio needs-count @@ -170,6 +170,10 @@ device omapdma attach omapdma at obio file arch/arm/omap/omap3_sdma.c omapdma needs-flag +device edma +attach edma at obio +file arch/arm/omap/omap_edma.c edma needs-flag + # these bus space methods are not bus-specific ... # file arch/arm/omap/omap_nobyteacc_space.c emifs | gpmc Index: src/sys/arch/arm/omap/omap2_obio.c diff -u src/sys/arch/arm/omap/omap2_obio.c:1.21 src/sys/arch/arm/omap/omap2_obio.c:1.22 --- src/sys/arch/arm/omap/omap2_obio.c:1.21 Sat Jun 15 21:58:20 2013 +++ src/sys/arch/arm/omap/omap2_obio.c Tue Apr 14 18:37:43 2015 @@ -1,7 +1,7 @@ -/* $Id: omap2_obio.c,v 1.21 2013/06/15 21:58:20 matt Exp $ */ +/* $Id: omap2_obio.c,v 1.22 2015/04/14 18:37:43 bouyer Exp $ */ /* adapted from: */ -/* $NetBSD: omap2_obio.c,v 1.21 2013/06/15 21:58:20 matt Exp $ */ +/* $NetBSD: omap2_obio.c,v 1.22 2015/04/14 18:37:43 bouyer Exp $ */ /* @@ -103,7 +103,7 @@ #include "opt_omap.h" #include -__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.21 2013/06/15 21:58:20 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.22 2015/04/14 18:37:43 bouyer Exp $"); #include "locators.h" #include "obio.h" @@ -284,6 +284,7 @@ obio_search(device_t parent, cfdata_t cf oa.obio_size = cf->cf_loc[OBIOCF_SIZE]; oa.obio_intr = cf->cf_loc[OBIOCF_INTR]; oa.obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE]; + oa.obio_edmabase = cf->cf_loc[OBIOCF_EDMABASE]; #if defined(OMAP2) if ((oa.obio_addr >= sc->sc_base) @@ -351,6 +352,7 @@ obio_find(device_t parent, cfdata_t cf, oa->obio_size = cf->cf_loc[OBIOCF_SIZE]; oa->obio_intr = cf->cf_loc[OBIOCF_INTR]; oa->obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE]; + oa->obio_edmabase = cf->cf_loc[OBIOCF_EDMABASE]; return config_match(parent, cf, oa); } @@ -398,6 +400,7 @@ static const struct { { .name = "omapicu", .addr = 0x4820, .required = true }, { .name = "prcm", .addr = 0x44e0, .required = true }, { .name = "sitaracm", .addr = 0x44e1, .required = true }, + { .name = "edma", .addr = 0x4900, .required = false }, #endif #if defined(OMAP_3530) { .name = "omapdma", .addr = OMAP3530_SDMA_BASE, .required = true }, Index: src/sys/arch/arm/omap/omap2_obiovar.h diff -u src/sys/arch/arm/omap/omap2_obiovar.h:1.2 src/sys/arch/arm/omap/omap2_obiovar.h:1.3 --- src/sys/arch/arm/omap/omap2_obiovar.h:1.2 Wed Sep 5 00:19:59 2012 +++ src/sys/arch/arm/omap/omap2_obiovar.h Tue Apr 14 18:37:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_obiovar.h,v 1.2 2012/09/05 00:19:59 matt Exp $ */ +/* $NetBSD: omap2_obiovar.h,v 1.3 2015/04/14 18:37:43 bouyer Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -40,6 +40,7 @@ struct obio_attach_args { bus_dma_tag_t obio_dmat; unsigned int obio_mult; unsigned int obio_intrbase; + int obio_edmabase; }; struct obio_softc { Index: src/sys/arch/arm/omap/omap2_reg.h diff -u src/sys/arch/arm/omap/omap
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: bouyer Date: Sun Apr 12 20:00:42 UTC 2015 Modified Files: src/sys/arch/arm/omap: tifb.c Log Message: flushing the framebuffer from interrupt has several problems: - As pointed out by Jared McNeill, this doesn't work for cold or ddb. Some specific handing for these cases would be needed, but there's no easy way to know if we're in ddb or not. - periodic bus_dmamap_sync() of the whole framebuffer isn't cheap (about 3% CPU constant on the beaglebone back). instead map the framebuffer BUS_DMA_PREFETCHABLE (undocumented flag, but is MI and properly handled by arm). This allows write-combining, which, in addition with a shadow framebuffer for rasops(9) gives a good performance boost too (difference with the cached+sync from intr isn't noticeable on a boot sequence). For X11, the framebuffer was already mapped BUS_DMA_PREFETCHABLE. A few tests shows that mapping it fully cached doesn't make a noticeable difference either (with or without xorg's shadow framebuffer). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/arch/arm/omap/tifb.c:1.5 --- src/sys/arch/arm/omap/tifb.c:1.4 Sat Apr 11 13:44:14 2015 +++ src/sys/arch/arm/omap/tifb.c Sun Apr 12 20:00:42 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: tifb.c,v 1.4 2015/04/11 13:44:14 bouyer Exp $ */ +/* $NetBSD: tifb.c,v 1.5 2015/04/12 20:00:42 bouyer Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.4 2015/04/11 13:44:14 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.5 2015/04/12 20:00:42 bouyer Exp $"); #include "opt_omap.h" @@ -68,6 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.4 #include #include #include +#include #include @@ -155,6 +156,7 @@ struct tifb_softc { int sc_stride; int sc_locked; void *sc_fbaddr, *sc_vramaddr; + void *sc_shadowfb; bus_addr_t sc_fbhwaddr; uint16_t *sc_palette; @@ -395,6 +397,12 @@ tifb_attach(device_t parent, device_t se sc->sc_vramsize = sc->sc_palettesize + sc->sc_stride * sc->sc_panel->panel_height; + sc->sc_shadowfb = kmem_alloc(sc->sc_vramsize - sc->sc_palettesize, + KM_NOSLEEP); + if (sc->sc_shadowfb == NULL) { + aprint_error_dev(sc->sc_dev, + "warning: failed to allocate shadow framebuffer\n"); + } if (bus_dmamem_alloc(sc->sc_dmat, sc->sc_vramsize, 0, 0, sc->sc_dmamem, 1, &segs, BUS_DMA_NOWAIT) != 0) { aprint_error_dev(sc->sc_dev, @@ -403,7 +411,7 @@ tifb_attach(device_t parent, device_t se } if (bus_dmamem_map(sc->sc_dmat, sc->sc_dmamem, 1, sc->sc_vramsize, - &sc->sc_vramaddr, BUS_DMA_NOWAIT) != 0) { + &sc->sc_vramaddr, BUS_DMA_NOWAIT | BUS_DMA_PREFETCHABLE) != 0) { aprint_error_dev(sc->sc_dev, "failed to map video RAM\n"); return; } @@ -543,7 +551,7 @@ tifb_attach(device_t parent, device_t se timing0, timing1, timing2); /* DMA settings */ - reg = LCDDMA_CTRL_FB0_FB1; + reg = 0; /* Find power of 2 for current burst size */ switch (sc->sc_panel->dma_burst_sz) { case 1: @@ -597,9 +605,7 @@ tifb_attach(device_t parent, device_t se TIFB_WRITE(sc, LCD_CLKC_RESET, 0); aprint_debug_dev(self, ": LCD_CLKC_ENABLE 0x%x\n", TIFB_READ(sc, LCD_CLKC_ENABLE)); - reg = IRQ_EOF1 | IRQ_EOF0 | IRQ_FUF | IRQ_PL | - IRQ_ACB | IRQ_SYNC_LOST | IRQ_RASTER_DONE | - IRQ_FRAME_DONE; + reg = IRQ_FUF | IRQ_PL | IRQ_ACB | IRQ_SYNC_LOST; TIFB_WRITE(sc, LCD_IRQENABLE_SET, reg); reg = TIFB_READ(sc, LCD_RASTER_CTRL); @@ -653,6 +659,8 @@ tifb_attach(device_t parent, device_t se config_found(sc->sc_dev, &aa, wsemuldisplaydevprint); } +uint32_t tifb_intr_unh = 0; + static int tifb_intr(void *v) { @@ -686,12 +694,6 @@ tifb_intr(void *v) return 0; } - if (reg & (IRQ_FRAME_DONE|IRQ_EOF0|IRQ_EOF1)) { - /* flush the write-back cache */ - bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, - 0, sc->sc_vramsize, BUS_DMASYNC_PREWRITE); - } - if (reg & IRQ_FRAME_DONE) { ev_frame_done.ev_count ++; reg &= ~IRQ_FRAME_DONE; @@ -724,8 +726,10 @@ tifb_intr(void *v) /* TODO: Handle ACB */ reg =~ IRQ_ACB; } - if (reg) + if (reg) { ev_others.ev_count ++; + tifb_intr_unh = reg; + } return 0; } @@ -850,8 +854,14 @@ tifb_init_screen(void *cookie, struct vc ri->ri_height = sc->sc_panel->panel_height; ri->ri_stride = sc->sc_stride; ri->ri_flg = RI_CENTER | RI_FULLCLEAR; - - ri->ri_bits = (char *)sc->sc_fbaddr; + + if (sc->sc_shadowfb != NULL) { + ri->ri_bits = (char *)sc->sc_shadowfb; + ri->ri_hwbits = (char *)sc->sc_fbaddr; + } else { + ri->ri_bits = (char *)sc->sc_fbaddr; + ri->ri_hwbits = NULL; + } if (existing) { ri->ri_flg |= RI_CLEAR;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: bouyer Date: Sat Apr 11 13:44:14 UTC 2015 Modified Files: src/sys/arch/arm/omap: tifb.c Log Message: Don't make the frame buffer BUS_DMA_COHERENT, but instead do a bus_dmamap_sync() on end-of-frame interrupts. This effectively cause the frame buffer to be mapped cached, giving a very noticeable performance boost. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 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.3 src/sys/arch/arm/omap/tifb.c:1.4 --- src/sys/arch/arm/omap/tifb.c:1.3 Fri Aug 22 20:01:16 2014 +++ src/sys/arch/arm/omap/tifb.c Sat Apr 11 13:44:14 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: tifb.c,v 1.3 2014/08/22 20:01:16 jakllsch Exp $ */ +/* $NetBSD: tifb.c,v 1.4 2015/04/11 13:44:14 bouyer Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.3 2014/08/22 20:01:16 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.4 2015/04/11 13:44:14 bouyer Exp $"); #include "opt_omap.h" @@ -226,6 +226,7 @@ static struct evcnt ev_eof0; static struct evcnt ev_eof1; static struct evcnt ev_fifo_underflow; static struct evcnt ev_ac_bias; +static struct evcnt ev_frame_done; static struct evcnt ev_others; @@ -319,6 +320,8 @@ tifb_attach(device_t parent, device_t se "lcd", "fifo underflow"); evcnt_attach_dynamic(&ev_ac_bias, EVCNT_TYPE_MISC, NULL, "lcd", "ac bias"); + evcnt_attach_dynamic(&ev_frame_done, EVCNT_TYPE_MISC, NULL, + "lcd", "frame_done"); evcnt_attach_dynamic(&ev_others, EVCNT_TYPE_MISC, NULL, "lcd", "others"); @@ -400,7 +403,7 @@ tifb_attach(device_t parent, device_t se } if (bus_dmamem_map(sc->sc_dmat, sc->sc_dmamem, 1, sc->sc_vramsize, - &sc->sc_vramaddr, BUS_DMA_NOWAIT | BUS_DMA_COHERENT) != 0) { + &sc->sc_vramaddr, BUS_DMA_NOWAIT) != 0) { aprint_error_dev(sc->sc_dev, "failed to map video RAM\n"); return; } @@ -683,6 +686,17 @@ tifb_intr(void *v) return 0; } + if (reg & (IRQ_FRAME_DONE|IRQ_EOF0|IRQ_EOF1)) { + /* flush the write-back cache */ + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, + 0, sc->sc_vramsize, BUS_DMASYNC_PREWRITE); + } + + if (reg & IRQ_FRAME_DONE) { + ev_frame_done.ev_count ++; + reg &= ~IRQ_FRAME_DONE; + } + if (reg & IRQ_EOF0) { ev_eof0.ev_count ++; TIFB_WRITE(sc, LCD_LCDDMA_FB0_BASE, sc->sc_dmamem->ds_addr);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Thu Apr 9 21:33:54 UTC 2015 Modified Files: src/sys/arch/arm/omap: omap4430_intr.h omap5430_intr.h Log Message: Add #define __HAVE_PIC_PENDING_INTRS for the non-GIC PICs. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/omap4430_intr.h \ src/sys/arch/arm/omap/omap5430_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/omap4430_intr.h diff -u src/sys/arch/arm/omap/omap4430_intr.h:1.2 src/sys/arch/arm/omap/omap4430_intr.h:1.3 --- src/sys/arch/arm/omap/omap4430_intr.h:1.2 Sat Sep 1 00:05:36 2012 +++ src/sys/arch/arm/omap/omap4430_intr.h Thu Apr 9 21:33:54 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: omap4430_intr.h,v 1.2 2012/09/01 00:05:36 matt Exp $ */ +/* $NetBSD: omap4430_intr.h,v 1.3 2015/04/09 21:33:54 matt Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -44,8 +44,9 @@ #define PIC_MAXMAXSOURCES (PIC_MAXSOURCES+6*32) /* - * The BCM53xx uses a generic interrupt controller so pull that stuff. + * The OMAP4 uses a generic interrupt controller so pull in that stuff. */ +#define __HAVE_PIC_PENDING_INTRS #include #include /* A9 Timer PPIs */ Index: src/sys/arch/arm/omap/omap5430_intr.h diff -u src/sys/arch/arm/omap/omap5430_intr.h:1.2 src/sys/arch/arm/omap/omap5430_intr.h:1.3 --- src/sys/arch/arm/omap/omap5430_intr.h:1.2 Wed Apr 9 19:50:01 2014 +++ src/sys/arch/arm/omap/omap5430_intr.h Thu Apr 9 21:33:54 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: omap5430_intr.h,v 1.2 2014/04/09 19:50:01 matt Exp $ */ +/* $NetBSD: omap5430_intr.h,v 1.3 2015/04/09 21:33:54 matt Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -40,8 +40,9 @@ #define PIC_MAXMAXSOURCES (PIC_MAXSOURCES+8*32) /* - * The BCM53xx uses a generic interrupt controller so pull that stuff. + * The OMAP5 uses a generic interrupt controller so pull in that stuff. */ +#define __HAVE_PIC_PENDING_INTRS #include #include /* Generic Timer PPIs */
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Thu Mar 26 22:00:45 UTC 2015 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: Fixes from PR/49622 - Use bit definitions from the header instead of magic numbers - Remove the 'BYPASS' bit (4), otherwise all the careful setup of the ALE is futile - the BYPASS bit is described in the AM3358 datasheet as "When in bypass mode, all CPGMAC_SL received packets are forwarded only to the host port (port 0)" so effectively it's a promiscuous enable - During cpsw_stop the MISC interrupts were being left enabled - Remove unnecessary cpi assignment before loop. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 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.10 src/sys/arch/arm/omap/if_cpsw.c:1.11 --- src/sys/arch/arm/omap/if_cpsw.c:1.10 Fri Mar 13 08:56:35 2015 +++ src/sys/arch/arm/omap/if_cpsw.c Thu Mar 26 22:00:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.10 2015/03/13 08:56:35 skrll Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.11 2015/03/26 22:00:45 skrll Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.10 2015/03/13 08:56:35 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.11 2015/03/26 22:00:45 skrll Exp $"); #include #include @@ -881,8 +881,9 @@ cpsw_init(struct ifnet *ifp) cpsw_write_4(sc, CPSW_SS_SOFT_RESET, 1); while(cpsw_read_4(sc, CPSW_SS_SOFT_RESET) & 1); - /* Clear table (30) and enable ALE(31) and set passthrough (4) */ - cpsw_write_4(sc, CPSW_ALE_CONTROL, (3 << 30) | 0x10); + /* Clear table and enable ALE */ + cpsw_write_4(sc, CPSW_ALE_CONTROL, + ALECTL_ENABLE_ALE | ALECTL_CLEAR_TABLE); /* Reset and init Sliver port 1 and 2 */ for (i = 0; i < CPSW_ETH_PORTS; i++) { @@ -1023,7 +1024,7 @@ cpsw_stop(struct ifnet *ifp, int disable cpsw_write_4(sc, CPSW_CPDMA_RX_INTMASK_CLEAR, 1); cpsw_write_4(sc, CPSW_WR_C_TX_EN(0), 0x0); cpsw_write_4(sc, CPSW_WR_C_RX_EN(0), 0x0); - cpsw_write_4(sc, CPSW_WR_C_MISC_EN(0), 0x1F); + cpsw_write_4(sc, CPSW_WR_C_MISC_EN(0), 0x0); cpsw_write_4(sc, CPSW_CPDMA_TX_TEARDOWN, 0); cpsw_write_4(sc, CPSW_CPDMA_RX_TEARDOWN, 0); @@ -1213,14 +1214,13 @@ cpsw_txintr(void *arg) tx0_cp = cpsw_read_4(sc, CPSW_CPDMA_TX_CP(0)); if (tx0_cp == 0xfffc) { + /* Teardown, ack it */ cpsw_write_4(sc, CPSW_CPDMA_TX_CP(0), 0xfffc); cpsw_write_4(sc, CPSW_CPDMA_TX_HDP(0), 0); sc->sc_txrun = false; return 0; } - cpi = (tx0_cp - sc->sc_txdescs_pa) / sizeof(struct cpsw_cpdma_bd); - for (;;) { tx0_cp = cpsw_read_4(sc, CPSW_CPDMA_TX_CP(0)); cpi = (tx0_cp - sc->sc_txdescs_pa) / sizeof(struct cpsw_cpdma_bd);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Fri Mar 13 08:56:35 UTC 2015 Modified Files: src/sys/arch/arm/omap: if_cpsw.c if_cpswreg.h Log Message: Stylistic and non-functional changes from PR/49622 (Minor enhancements to if_cpsw) To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/if_cpsw.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/if_cpswreg.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/if_cpsw.c diff -u src/sys/arch/arm/omap/if_cpsw.c:1.9 src/sys/arch/arm/omap/if_cpsw.c:1.10 --- src/sys/arch/arm/omap/if_cpsw.c:1.9 Fri Mar 13 08:05:49 2015 +++ src/sys/arch/arm/omap/if_cpsw.c Fri Mar 13 08:56:35 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.9 2015/03/13 08:05:49 skrll Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.10 2015/03/13 08:56:35 skrll Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.9 2015/03/13 08:05:49 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.10 2015/03/13 08:56:35 skrll Exp $"); #include #include @@ -662,7 +662,7 @@ cpsw_start(struct ifnet *ifp) dw[3] |= CPDMA_BD_SOP | CPDMA_BD_OWNER | MAX(mlen, CPSW_PAD_LEN); - if (seg == dm->dm_nsegs - 1 && !pad) + if ((seg == dm->dm_nsegs - 1) && !pad) dw[3] |= CPDMA_BD_EOP; cpsw_set_txdesc(sc, sc->sc_txnext, &bd); @@ -885,7 +885,7 @@ cpsw_init(struct ifnet *ifp) cpsw_write_4(sc, CPSW_ALE_CONTROL, (3 << 30) | 0x10); /* Reset and init Sliver port 1 and 2 */ - for (i = 0; i < 2; i++) { + for (i = 0; i < CPSW_ETH_PORTS; i++) { uint32_t macctl; /* Reset */ @@ -982,9 +982,10 @@ cpsw_init(struct ifnet *ifp) cpsw_write_4(sc, CPSW_CPDMA_CPDMA_EOI_VECTOR, CPSW_INTROFF_TX); cpsw_write_4(sc, CPSW_CPDMA_CPDMA_EOI_VECTOR, CPSW_INTROFF_MISC); - /* Initialze MDIO - ENABLE, PREAMBLE=0, FAULTENB, CLKDIV=0xFF */ + /* Initialize MDIO - ENABLE, PREAMBLE=0, FAULTENB, CLKDIV=0xFF */ /* TODO Calculate MDCLK=CLK/(CLKDIV+1) */ - cpsw_write_4(sc, MDIOCONTROL, (1<<30) | (1<<18) | 0xFF); + cpsw_write_4(sc, MDIOCONTROL, + MDIOCTL_ENABLE | MDIOCTL_FAULTENB | MDIOCTL_CLKDIV(0xff)); mii_mediachg(mii); @@ -1045,7 +1046,7 @@ cpsw_stop(struct ifnet *ifp, int disable cpsw_write_4(sc, CPSW_SS_SOFT_RESET, 1); while(cpsw_read_4(sc, CPSW_SS_SOFT_RESET) & 1); - for (i = 0; i < 2; i++) { + for (i = 0; i < CPSW_ETH_PORTS; i++) { cpsw_write_4(sc, CPSW_SL_SOFT_RESET(i), 1); while(cpsw_read_4(sc, CPSW_SL_SOFT_RESET(i)) & 1); } @@ -1375,7 +1376,7 @@ cpsw_ale_entry_set_bcast_mac(uint32_t *a } static void -cpsw_ale_entry_set(uint32_t *ale_entry, ale_entry_filed_t field, uint32_t val) +cpsw_ale_entry_set(uint32_t *ale_entry, ale_entry_field_t field, uint32_t val) { /* Entry type[61:60] is addr entry(1), Mcast fwd state[63:62] is fw(3)*/ switch (field) { @@ -1432,7 +1433,8 @@ cpsw_ale_read_entry(struct cpsw_softc *s } static void -cpsw_ale_write_entry(struct cpsw_softc *sc, uint16_t idx, uint32_t *ale_entry) +cpsw_ale_write_entry(struct cpsw_softc *sc, uint16_t idx, +const uint32_t *ale_entry) { cpsw_write_4(sc, CPSW_ALE_TBLW0, ale_entry[0]); cpsw_write_4(sc, CPSW_ALE_TBLW1, ale_entry[1]); @@ -1515,7 +1517,7 @@ cpsw_ale_update_addresses(struct cpsw_so cpsw_ale_write_entry(sc, 0, ale_entry); /* Set outgoing MAC Address for Ports 1 and 2. */ - for (i = 1; i < 3; ++i) + for (i = CPSW_CPPI_PORTS; i < (CPSW_ETH_PORTS + CPSW_CPPI_PORTS); ++i) cpsw_ale_set_outgoing_mac(sc, i, mac); /* Keep the broadcast address at table entry 1. */ Index: src/sys/arch/arm/omap/if_cpswreg.h diff -u src/sys/arch/arm/omap/if_cpswreg.h:1.3 src/sys/arch/arm/omap/if_cpswreg.h:1.4 --- src/sys/arch/arm/omap/if_cpswreg.h:1.3 Fri Mar 13 07:57:08 2015 +++ src/sys/arch/arm/omap/if_cpswreg.h Fri Mar 13 08:56:35 2015 @@ -29,6 +29,9 @@ #ifndef _IF_CPSWREG_H #define _IF_CPSWREG_H +#define CPSW_ETH_PORTS 2 +#define CPSW_CPPI_PORTS 1 + #define CPSW_SS_OFFSET 0x #define CPSW_SS_IDVER (CPSW_SS_OFFSET + 0x00) #define CPSW_SS_SOFT_RESET (CPSW_SS_OFFSET + 0x08) @@ -88,10 +91,17 @@ #define CPSW_ALE_PORTCTL(p) (CPSW_ALE_OFFSET + 0x40 + ((p) * 0x04)) #define CPSW_SL_OFFSET 0x0D80 +#define CPSW_SL_IDVER(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x00) #define CPSW_SL_MACCONTROL(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x04) +#define CPSW_SL_MACSTATUS(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x08) #define CPSW_SL_SOFT_RESET(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x0C) #define CPSW_SL_RX_MAXLEN(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x10) +#define CPSW_SL_BOFFTEST(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x14) +#define CPSW_SL_RX_PAUSE(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x18) +#define CPSW_SL_TX_PAUSE(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x1C) +#define CPSW_SL_EMCONTROL(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x20) #define CPSW_SL_RX_PRI_MAP(p) (CPSW_SL_OFFSET + (0
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Fri Mar 13 08:05:49 UTC 2015 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: Wrap some long lines. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 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.8 src/sys/arch/arm/omap/if_cpsw.c:1.9 --- src/sys/arch/arm/omap/if_cpsw.c:1.8 Fri Mar 13 07:57:08 2015 +++ src/sys/arch/arm/omap/if_cpsw.c Fri Mar 13 08:05:49 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.8 2015/03/13 07:57:08 skrll Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.9 2015/03/13 08:05:49 skrll Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.8 2015/03/13 07:57:08 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.9 2015/03/13 08:05:49 skrll Exp $"); #include #include @@ -542,7 +542,8 @@ cpsw_attach(device_t parent, device_t se ether_mediastatus); /* Initialize MDIO */ - cpsw_write_4(sc, MDIOCONTROL, MDIOCTL_ENABLE | MDIOCTL_FAULTENB | MDIOCTL_CLKDIV(0xff)); + cpsw_write_4(sc, MDIOCONTROL, + MDIOCTL_ENABLE | MDIOCTL_FAULTENB | MDIOCTL_CLKDIV(0xff)); /* Clear ALE */ cpsw_write_4(sc, CPSW_ALE_CONTROL, ALECTL_CLEAR_TABLE); @@ -556,10 +557,15 @@ cpsw_attach(device_t parent, device_t se } else { sc->sc_phy_has_1000t = cpsw_phy_has_1000t(sc); if (sc->sc_phy_has_1000t) { - aprint_normal_dev(sc->sc_dev, "1000baseT PHY found. setting RGMII Mode\n"); - /* Select the Interface RGMII Mode in the Control Module */ + aprint_normal_dev(sc->sc_dev, "1000baseT PHY found. " + "Setting RGMII Mode\n"); + /* + * Select the Interface RGMII Mode in the Control + * Module + */ sitara_cm_reg_write_4(CPSW_GMII_SEL, - GMIISEL_GMII2_SEL(RGMII_MODE) | GMIISEL_GMII1_SEL(RGMII_MODE)); + GMIISEL_GMII2_SEL(RGMII_MODE) | + GMIISEL_GMII1_SEL(RGMII_MODE)); } ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); @@ -1113,7 +1119,8 @@ cpsw_rxintr(void *arg) KASSERT(sc->sc_rxhead < CPSW_NRXDESCS); i = sc->sc_rxhead; - KERNHIST_LOG(cpswhist, "rxhead %x CP %x\n", i, cpsw_read_4(sc, CPSW_CPDMA_RX_CP(0)), 0, 0); + KERNHIST_LOG(cpswhist, "rxhead %x CP %x\n", i, + cpsw_read_4(sc, CPSW_CPDMA_RX_CP(0)), 0, 0); dm = rdp->rx_dm[i]; m = rdp->rx_mb[i]; @@ -1231,7 +1238,8 @@ cpsw_txintr(void *arg) goto next; if (ISSET(dw[3], CPDMA_BD_OWNER)) { - printf("pwned %x %x %x\n", cpi, sc->sc_txhead, sc->sc_txnext); + printf("pwned %x %x %x\n", cpi, sc->sc_txhead, + sc->sc_txnext); break; }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Fri Mar 13 07:57:08 UTC 2015 Modified Files: src/sys/arch/arm/omap: if_cpsw.c if_cpswreg.h Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/omap/if_cpsw.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/if_cpswreg.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/if_cpsw.c diff -u src/sys/arch/arm/omap/if_cpsw.c:1.7 src/sys/arch/arm/omap/if_cpsw.c:1.8 --- src/sys/arch/arm/omap/if_cpsw.c:1.7 Sun Feb 1 19:32:59 2015 +++ src/sys/arch/arm/omap/if_cpsw.c Fri Mar 13 07:57:08 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.7 2015/02/01 19:32:59 christos Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.8 2015/03/13 07:57:08 skrll Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.7 2015/02/01 19:32:59 christos Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.8 2015/03/13 07:57:08 skrll Exp $"); #include #include @@ -1460,7 +1460,7 @@ cpsw_ale_mc_entry_set(struct cpsw_softc for (i = 0; i < CPSW_MAX_ALE_ENTRIES; i++) { cpsw_ale_read_entry(sc, i, ale_entry); - /* Entry Type[61:60] is 0 for free entry */ + /* Entry Type[61:60] is 0 for free entry */ if (free_index < 0 && ((ale_entry[1] >> 28) & 3) == 0) { free_index = i; } Index: src/sys/arch/arm/omap/if_cpswreg.h diff -u src/sys/arch/arm/omap/if_cpswreg.h:1.2 src/sys/arch/arm/omap/if_cpswreg.h:1.3 --- src/sys/arch/arm/omap/if_cpswreg.h:1.2 Wed Feb 26 03:58:33 2014 +++ src/sys/arch/arm/omap/if_cpswreg.h Fri Mar 13 07:57:08 2015 @@ -132,7 +132,7 @@ struct cpsw_cpdma_bd { /* Interrupt offsets */ #define CPSW_INTROFF_RXTH 0 -#define CPSW_INTROFF_RX 1 +#define CPSW_INTROFF_RX 1 #define CPSW_INTROFF_TX 2 #define CPSW_INTROFF_MISC 3 @@ -166,7 +166,7 @@ struct cpsw_cpdma_bd { #define GMIISEL_RGMII2_IDMODE __BIT32(5) #define GMIISEL_RGMII1_IDMODE __BIT32(4) #define GMIISEL_GMII2_SEL(val) ((0x3 & (val)) << 2) -#define GMIISEL_GMII1_SEL(val) ((0x3 & (val)) << 0) +#define GMIISEL_GMII1_SEL(val) ((0x3 & (val)) << 0) #define GMII_MODE 0 #define RMII_MODE 1 #define RGMII_MODE 2
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: christos Date: Sun Feb 1 19:32:59 UTC 2015 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: PR/49621: Robert Sprowson: Add detach function to if_cpsw To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/arch/arm/omap/if_cpsw.c:1.7 --- src/sys/arch/arm/omap/if_cpsw.c:1.6 Wed Apr 9 16:52:14 2014 +++ src/sys/arch/arm/omap/if_cpsw.c Sun Feb 1 14:32:59 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.6 2014/04/09 20:52:14 hans Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.7 2015/02/01 19:32:59 christos Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6 2014/04/09 20:52:14 hans Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.7 2015/02/01 19:32:59 christos Exp $"); #include #include @@ -115,6 +115,7 @@ struct cpsw_softc { device_t sc_dev; bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; + bus_size_t sc_bss; bus_dma_tag_t sc_bdt; bus_space_handle_t sc_bsh_txdescs; bus_space_handle_t sc_bsh_rxdescs; @@ -123,6 +124,7 @@ struct cpsw_softc { struct ethercom sc_ec; struct mii_data sc_mii; bool sc_phy_has_1000t; + bool sc_attached; callout_t sc_tick_ch; void *sc_ih; struct cpsw_ring_data *sc_rdp; @@ -145,6 +147,7 @@ struct cpsw_softc { static int cpsw_match(device_t, cfdata_t, void *); static void cpsw_attach(device_t, device_t, void *); +static int cpsw_detach(device_t, int); static void cpsw_start(struct ifnet *); static int cpsw_ioctl(struct ifnet *, u_long, void *); @@ -170,7 +173,7 @@ static int cpsw_miscintr(void *); static int cpsw_ale_update_addresses(struct cpsw_softc *, int purge); CFATTACH_DECL_NEW(cpsw, sizeof(struct cpsw_softc), -cpsw_match, cpsw_attach, NULL, NULL); +cpsw_match, cpsw_attach, cpsw_detach, NULL); #undef KERNHIST #include @@ -336,6 +339,55 @@ cpsw_phy_has_1000t(struct cpsw_softc * c return false; } +static int +cpsw_detach(device_t self, int flags) +{ + struct cpsw_softc * const sc = device_private(self); + struct ifnet *ifp = &sc->sc_ec.ec_if; + u_int i; + + /* Succeed now if there's no work to do. */ + if (!sc->sc_attached) + return 0; + + sc->sc_attached = false; + + /* Stop the interface. Callouts are stopped in it. */ + cpsw_stop(ifp, 1); + + /* Destroy our callout. */ + callout_destroy(&sc->sc_tick_ch); + + /* Let go of the interrupts */ + intr_disestablish(sc->sc_rxthih); + intr_disestablish(sc->sc_rxih); + intr_disestablish(sc->sc_txih); + intr_disestablish(sc->sc_miscih); + + /* Delete all media. */ + ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); + + ether_ifdetach(ifp); + if_detach(ifp); + + /* Free the packet padding buffer */ + kmem_free(sc->sc_txpad, ETHER_MIN_LEN); + bus_dmamap_destroy(sc->sc_bdt, sc->sc_txpad_dm); + + /* Destroy all the descriptors */ + for (i = 0; i < CPSW_NTXDESCS; i++) + bus_dmamap_destroy(sc->sc_bdt, sc->sc_rdp->tx_dm[i]); + for (i = 0; i < CPSW_NRXDESCS; i++) + bus_dmamap_destroy(sc->sc_bdt, sc->sc_rdp->rx_dm[i]); + kmem_free(sc->sc_rdp, sizeof(*sc->sc_rdp)); + + /* Unmap */ + bus_space_unmap(sc->sc_bst, sc->sc_bsh, sc->sc_bss); + + + return 0; +} + static void cpsw_attach(device_t parent, device_t self, void *aux) { @@ -398,6 +450,7 @@ cpsw_attach(device_t parent, device_t se IPL_VM, IST_LEVEL, cpsw_miscintr, sc); sc->sc_bst = oa->obio_iot; + sc->sc_bss = oa->obio_size; sc->sc_bdt = oa->obio_dmat; error = bus_space_map(sc->sc_bst, oa->obio_addr, oa->obio_size, 0, @@ -515,6 +568,9 @@ cpsw_attach(device_t parent, device_t se if_attach(ifp); ether_ifattach(ifp, sc->sc_enaddr); + /* The attach is successful. */ + sc->sc_attached = true; + return; }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jakllsch Date: Mon Jan 12 01:02:35 UTC 2015 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: spell "regulator" correctly To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 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.14 src/sys/arch/arm/omap/omap3_sdhc.c:1.15 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.14 Sat Mar 29 23:32:41 2014 +++ src/sys/arch/arm/omap/omap3_sdhc.c Mon Jan 12 01:02:35 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.14 2014/03/29 23:32:41 matt Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.15 2015/01/12 01:02:35 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.14 2014/03/29 23:32:41 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.15 2015/01/12 01:02:35 jakllsch Exp $"); #include "opt_omap.h" @@ -206,7 +206,7 @@ obiosdhc_attach(device_t parent, device_ KASSERT(i < __arraycount(am335x_sdhc)); #endif - /* XX: Turn-on regurator via I2C. */ + /* XX: Turn-on regulator via I2C. */ /* XX: And enable ICLOCK/FCLOCK. */ /* MMCHS Soft reset */
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: joerg Date: Sat Nov 22 19:50:28 UTC 2014 Modified Files: src/sys/arch/arm/omap: am335x_cm_padconf.c sitara_cm.h Log Message: Preserve const. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/am335x_cm_padconf.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/sitara_cm.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/am335x_cm_padconf.c diff -u src/sys/arch/arm/omap/am335x_cm_padconf.c:1.2 src/sys/arch/arm/omap/am335x_cm_padconf.c:1.3 --- src/sys/arch/arm/omap/am335x_cm_padconf.c:1.2 Mon May 6 18:53:40 2013 +++ src/sys/arch/arm/omap/am335x_cm_padconf.c Sat Nov 22 19:50:28 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_cm_padconf.c,v 1.2 2013/05/06 18:53:40 rkujawa Exp $ */ +/* $NetBSD: am335x_cm_padconf.c,v 1.3 2014/11/22 19:50:28 joerg Exp $ */ /*- * Copyright (c) 2012 Damjan Marion * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: am335x_cm_padconf.c,v 1.2 2013/05/06 18:53:40 rkujawa Exp $"); +__KERNEL_RCSID(0, "$NetBSD: am335x_cm_padconf.c,v 1.3 2014/11/22 19:50:28 joerg Exp $"); #include #include @@ -295,8 +295,8 @@ const struct sitara_cm_padconf ti_padcon const struct sitara_cm_device sitara_cm_dev = { .padconf_muxmode_mask = 0x7, .padconf_sate_mask = 0x78, - .padstate = (struct sitara_cm_padstate *) &ti_padstate_devmap, - .padconf = (struct sitara_cm_padconf *) &ti_padconf_devmap, + .padstate = ti_padstate_devmap, + .padconf = ti_padconf_devmap, }; int Index: src/sys/arch/arm/omap/sitara_cm.h diff -u src/sys/arch/arm/omap/sitara_cm.h:1.1 src/sys/arch/arm/omap/sitara_cm.h:1.2 --- src/sys/arch/arm/omap/sitara_cm.h:1.1 Wed Apr 17 14:31:02 2013 +++ src/sys/arch/arm/omap/sitara_cm.h Sat Nov 22 19:50:28 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sitara_cm.h,v 1.1 2013/04/17 14:31:02 bouyer Exp $ */ +/* $NetBSD: sitara_cm.h,v 1.2 2014/11/22 19:50:28 joerg Exp $ */ /* * Copyright (c) 2010 * Ben Gray . @@ -59,8 +59,8 @@ struct sitara_cm_padstate { struct sitara_cm_device { uint16_t padconf_muxmode_mask; uint16_t padconf_sate_mask; - struct sitara_cm_padstate *padstate; - struct sitara_cm_padconf *padconf; + const struct sitara_cm_padstate *padstate; + const struct sitara_cm_padconf *padconf; }; int sitara_cm_padconf_set(const char *padname, const char *muxmode,
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jmcneill Date: Tue Sep 30 11:34:07 UTC 2014 Modified Files: src/sys/arch/arm/omap: am335x_prcm.c Log Message: change freq change message to aprint_debug to prevent dmesg spam when running estd To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 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.7 src/sys/arch/arm/omap/am335x_prcm.c:1.8 --- src/sys/arch/arm/omap/am335x_prcm.c:1.7 Sun Jul 20 23:08:43 2014 +++ src/sys/arch/arm/omap/am335x_prcm.c Tue Sep 30 11:34:07 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_prcm.c,v 1.7 2014/07/20 23:08:43 bouyer Exp $ */ +/* $NetBSD: am335x_prcm.c,v 1.8 2014/09/30 11:34:07 jmcneill 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.7 2014/07/20 23:08:43 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.8 2014/09/30 11:34:07 jmcneill Exp $"); #include #include @@ -220,7 +220,7 @@ mpu_current_frequency_sysctl_helper(SYSC mpu_frequency.mvolt = old_mvolt; } } - aprint_normal_dev(curcpu()->ci_dev, + aprint_debug_dev(curcpu()->ci_dev, "frequency changed from %d MHz to %d MHz\n", old_freq, freq); pmf_event_inject(NULL, PMFE_SPEED_CHANGED);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jakllsch Date: Fri Aug 22 20:01:16 UTC 2014 Modified Files: src/sys/arch/arm/omap: tifb.c Log Message: Fix what is almost certianly an off-by-one error when configuring pads on AM335x for BPP greater than 16. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 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.2 src/sys/arch/arm/omap/tifb.c:1.3 --- src/sys/arch/arm/omap/tifb.c:1.2 Fri Aug 22 19:59:18 2014 +++ src/sys/arch/arm/omap/tifb.c Fri Aug 22 20:01:16 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tifb.c,v 1.2 2014/08/22 19:59:18 jakllsch Exp $ */ +/* $NetBSD: tifb.c,v 1.3 2014/08/22 20:01:16 jakllsch Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.2 2014/08/22 19:59:18 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.3 2014/08/22 20:01:16 jakllsch Exp $"); #include "opt_omap.h" @@ -443,7 +443,7 @@ tifb_attach(device_t parent, device_t se #ifdef TI_AM335X /* configure output pins */ - for (i = 0; i < ((sc->sc_panel->bpp == 16) ? 16 : 23); i++) { + for (i = 0; i < ((sc->sc_panel->bpp == 16) ? 16 : 24); i++) { if (sitara_cm_padconf_get(tifb_padconf_data[i].padname, &mode, &state) == 0) { aprint_debug(": %s mode %s state %d ",
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jakllsch Date: Fri Aug 22 19:59:18 UTC 2014 Modified Files: src/sys/arch/arm/omap: tifb.c Log Message: Support WSDISPLAYIO_GET_FBINFO ioctl in tifb(4). To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 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.1 src/sys/arch/arm/omap/tifb.c:1.2 --- src/sys/arch/arm/omap/tifb.c:1.1 Wed Jul 16 18:30:43 2014 +++ src/sys/arch/arm/omap/tifb.c Fri Aug 22 19:59:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tifb.c,v 1.1 2014/07/16 18:30:43 bouyer Exp $ */ +/* $NetBSD: tifb.c,v 1.2 2014/08/22 19:59:18 jakllsch Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.1 2014/07/16 18:30:43 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.2 2014/08/22 19:59:18 jakllsch Exp $"); #include "opt_omap.h" @@ -779,6 +779,17 @@ tifb_ioctl(void *v, void *vs, u_long cmd } return 0; + case WSDISPLAYIO_GET_FBINFO: + { +struct wsdisplayio_fbinfo *fbi = data; +int ret; + +ret = wsdisplayio_get_fbinfo(&ms->scr_ri, fbi); +fbi->fbi_flags |= WSFB_VRAM_IS_RAM; +fbi->fbi_fboffset = sc->sc_palettesize; +return ret; + } + case WSDISPLAYIO_GVIDEO: { int *on = data;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jakllsch Date: Fri Aug 22 19:44:04 UTC 2014 Modified Files: src/sys/arch/arm/omap: files.omap2 Log Message: tifb can support 32 and 24 BPP framebuffer modes; pull in corresponding raspos support. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 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.28 src/sys/arch/arm/omap/files.omap2:1.29 --- src/sys/arch/arm/omap/files.omap2:1.28 Wed Jul 16 18:31:17 2014 +++ src/sys/arch/arm/omap/files.omap2 Fri Aug 22 19:44:04 2014 @@ -1,4 +1,4 @@ -# $NetBSD: files.omap2,v 1.28 2014/07/16 18:31:17 bouyer Exp $ +# $NetBSD: files.omap2,v 1.29 2014/08/22 19:44:04 jakllsch Exp $ # # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support # Based on xscale/files.pxa2x0 @@ -158,7 +158,7 @@ attach omapfb at obio file arch/arm/omap/omapfb.c omapfb # TI AM335x framebuffer -device tifb: rasops16, rasops8, wsemuldisplaydev, vcons, edid +device tifb: rasops32, rasops24, rasops16, rasops8, wsemuldisplaydev, vcons, edid attach tifb at obio file arch/arm/omap/tifb.c tifb
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: macallan Date: Wed Aug 20 00:40:33 UTC 2014 Modified Files: src/sys/arch/arm/omap: omapfb.c Log Message: don't blindly assume that PAGE_SIZE == 4kB Now X works again. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/omap/omapfb.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/omapfb.c diff -u src/sys/arch/arm/omap/omapfb.c:1.26 src/sys/arch/arm/omap/omapfb.c:1.27 --- src/sys/arch/arm/omap/omapfb.c:1.26 Thu Aug 7 19:05:18 2014 +++ src/sys/arch/arm/omap/omapfb.c Wed Aug 20 00:40:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omapfb.c,v 1.26 2014/08/07 19:05:18 macallan Exp $ */ +/* $NetBSD: omapfb.c,v 1.27 2014/08/20 00:40:33 macallan Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.26 2014/08/07 19:05:18 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.27 2014/08/20 00:40:33 macallan Exp $"); #include #include @@ -256,7 +256,7 @@ omapfb_attach(device_t parent, device_t } /* setup video DMA */ - sc->sc_vramsize = (12 << 20) + 0x1000; /* 12MB + CLUT */ + sc->sc_vramsize = (12 << 20) + PAGE_SIZE; /* 12MB + CLUT */ if (bus_dmamem_alloc(sc->sc_dmat, sc->sc_vramsize, 0, 0, sc->sc_dmamem, 1, &segs, BUS_DMA_NOWAIT) != 0) { @@ -271,7 +271,7 @@ omapfb_attach(device_t parent, device_t aprint_error_dev(sc->sc_dev, "failed to map video RAM\n"); return; } - sc->sc_fbaddr = (uint8_t *)sc->sc_vramaddr + 0x1000; + sc->sc_fbaddr = (uint8_t *)sc->sc_vramaddr + PAGE_SIZE; sc->sc_clut = sc->sc_vramaddr; if (bus_dmamap_create(sc->sc_dmat, sc->sc_vramsize, 1, sc->sc_vramsize, @@ -321,7 +321,7 @@ omapfb_attach(device_t parent, device_t /* we use overlay 1 for the console and X */ bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_GLOBAL_ALPHA, 0x00ff00ff); - sc->sc_fbhwaddr = sc->sc_dmamem->ds_addr + 0x1000; + sc->sc_fbhwaddr = sc->sc_dmamem->ds_addr + PAGE_SIZE; bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_VID1_BASE_0, sc->sc_fbhwaddr); bus_space_write_4(sc->sc_iot, sc->sc_regh, @@ -626,7 +626,7 @@ omapfb_mmap(void *v, void *vs, off_t off /* 'regular' framebuffer mmap()ing */ if (offset < sc->sc_vramsize) { pa = bus_dmamem_mmap(sc->sc_dmat, sc->sc_dmamem, 1, - offset + 0x1000, prot, BUS_DMA_PREFETCHABLE); + offset + PAGE_SIZE, prot, BUS_DMA_PREFETCHABLE); return pa; } return pa;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: macallan Date: Thu Aug 7 19:05:18 UTC 2014 Modified Files: src/sys/arch/arm/omap: omapfb.c Log Message: remove obsolete comment To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/omap/omapfb.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/omapfb.c diff -u src/sys/arch/arm/omap/omapfb.c:1.25 src/sys/arch/arm/omap/omapfb.c:1.26 --- src/sys/arch/arm/omap/omapfb.c:1.25 Wed Dec 18 12:54:01 2013 +++ src/sys/arch/arm/omap/omapfb.c Thu Aug 7 19:05:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omapfb.c,v 1.25 2013/12/18 12:54:01 skrll Exp $ */ +/* $NetBSD: omapfb.c,v 1.26 2014/08/07 19:05:18 macallan Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.25 2013/12/18 12:54:01 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.26 2014/08/07 19:05:18 macallan Exp $"); #include #include @@ -915,10 +915,6 @@ omapfb_bitblt(struct omapfb_softc *sc, i int hstep, vstep; uint32_t saddr, daddr; - /* - * TODO: - * - use 32bit transfers if we're properly aligned - */ saddr = sc->sc_fbhwaddr + sc->sc_stride * ys + xs * bpp; daddr = sc->sc_fbhwaddr + sc->sc_stride * yd + xd * bpp;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: macallan Date: Wed Jul 30 12:45:44 UTC 2014 Modified Files: src/sys/arch/arm/omap: omap3_sdmareg.h Log Message: fix tpyo To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap3_sdmareg.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_sdmareg.h diff -u src/sys/arch/arm/omap/omap3_sdmareg.h:1.3 src/sys/arch/arm/omap/omap3_sdmareg.h:1.4 --- src/sys/arch/arm/omap/omap3_sdmareg.h:1.3 Wed Jan 16 20:32:24 2013 +++ src/sys/arch/arm/omap/omap3_sdmareg.h Wed Jul 30 12:45:44 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdmareg.h,v 1.3 2013/01/16 20:32:24 macallan Exp $ */ +/* $NetBSD: omap3_sdmareg.h,v 1.4 2014/07/30 12:45:44 macallan Exp $ */ /* * Copyright (c) 2012 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdmareg.h,v 1.3 2013/01/16 20:32:24 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdmareg.h,v 1.4 2014/07/30 12:45:44 macallan Exp $"); #ifndef OMAPDMA_REG_H #define OMAPDMA_REG_H @@ -99,7 +99,7 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_sdmare #define CCR_SEL_SRC_DST_SYNC 0x0100 #define CCR_PREFETCH 0x0080 #define CCR_SUPERVISOR 0x0040 - #define CCR_SUNC_CONTROL_UPPER_MASK 0x0018 + #define CCR_SYNC_CONTROL_UPPER_MASK 0x0018 #define CCR_BLOCK_SYNC 0x0004 #define CCR_TRANSPARENT_COPY_ENABLE 0x0002 #define CCR_CONST_FILL_ENABLE 0x0001
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: bouyer Date: Wed Jul 16 18:31:17 UTC 2014 Modified Files: src/sys/arch/arm/omap: files.omap2 Log Message: Glue in tifb and tiotg drivers. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 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.27 src/sys/arch/arm/omap/files.omap2:1.28 --- src/sys/arch/arm/omap/files.omap2:1.27 Tue Jun 18 15:22:37 2013 +++ src/sys/arch/arm/omap/files.omap2 Wed Jul 16 18:31:17 2014 @@ -1,4 +1,4 @@ -# $NetBSD: files.omap2,v 1.27 2013/06/18 15:22:37 matt Exp $ +# $NetBSD: files.omap2,v 1.28 2014/07/16 18:31:17 bouyer Exp $ # # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support # Based on xscale/files.pxa2x0 @@ -143,6 +143,13 @@ file arch/arm/omap/obio_ohci.c obioohci attach ehci at obio with omap3_ehci file arch/arm/omap/omap3_ehci.c omap3_ehci +# TI OTG controller +define tiotg_port {[port = -1], [mode = -1]} +device tiotg: tiotg_port +attach tiotg at obio +file arch/arm/omap/tiotg.c tiotg +attach motg at tiotg_port + attach ahcisata at obio with omap5_ahcisata file arch/arm/omap/omap5_ahcisata.c omap5_ahcisata @@ -150,6 +157,11 @@ device omapfb: rasops16, rasops8, wsemul attach omapfb at obio file arch/arm/omap/omapfb.c omapfb +# TI AM335x framebuffer +device tifb: rasops16, rasops8, wsemuldisplaydev, vcons, edid +attach tifb at obio +file arch/arm/omap/tifb.c tifb + device cpsw: ether, ifnet, arp, mii, mii_phy attach cpsw at obio file arch/arm/omap/if_cpsw.c cpsw
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: bouyer Date: Wed Jul 16 18:30:43 UTC 2014 Added Files: src/sys/arch/arm/omap: tifb.c tifbreg.h Log Message: Work in progress on a driver for the graphic controller found in TI am355x SoCs, based on the FreeBSD driver. Only dumb framebuffer mode supported. At this time, the video timings are hardcoded in the driver's source. The timings inclued here are for the 12" 1280x800 LCD+LVDS cape from Chalk Elec. A better way to define video modes is clearly needed. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/omap/tifb.c \ src/sys/arch/arm/omap/tifbreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/arm/omap/tifb.c diff -u /dev/null src/sys/arch/arm/omap/tifb.c:1.1 --- /dev/null Wed Jul 16 18:30:43 2014 +++ src/sys/arch/arm/omap/tifb.c Wed Jul 16 18:30:43 2014 @@ -0,0 +1,1068 @@ +/* $NetBSD: tifb.c,v 1.1 2014/07/16 18:30:43 bouyer Exp $ */ + +/* + * Copyright (c) 2010 Michael Lorenz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright 2013 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * A framebuffer driver for TI 35xx built-in video controller + * tested on beaglebone + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.1 2014/07/16 18:30:43 bouyer Exp $"); + +#include "opt_omap.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#ifdef TI_AM335X +# include +# include +# include +# include +#endif + +#include +#include +#include +#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, + .
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: bouyer Date: Wed Jul 16 18:27:19 UTC 2014 Added Files: src/sys/arch/arm/omap: tiotg.c tiotgreg.h Log Message: Add the bus front end for the Mentor Graphics USB OTG controllers found in the TI am355x SoCs. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/omap/tiotg.c \ src/sys/arch/arm/omap/tiotgreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/arm/omap/tiotg.c diff -u /dev/null src/sys/arch/arm/omap/tiotg.c:1.1 --- /dev/null Wed Jul 16 18:27:19 2014 +++ src/sys/arch/arm/omap/tiotg.c Wed Jul 16 18:27:19 2014 @@ -0,0 +1,421 @@ +/* $NetBSD: tiotg.c,v 1.1 2014/07/16 18:27:19 bouyer Exp $ */ +/* + * Copyright (c) 2013 Manuel Bouyer. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: tiotg.c,v 1.1 2014/07/16 18:27:19 bouyer Exp $"); + +#include "opt_omap.h" +#include "locators.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef TI_AM335X +# include +# include +# include +# include +#endif + +#include +#include +#include +#include +#include + +#define MOTG_DEBUG +#ifdef MOTG_DEBUG +extern int motgdebug; +#define DPRINTF(x) if (motgdebug) printf x +#else +#define DPRINTF(x) +#endif + +struct tiotg_softc { + device_t sc_dev; + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + bus_dma_tag_t sc_dmat; + int sc_intrbase; + void * sc_ih; + device_t sc_motgdev[TI_OTG_NPORTS]; +}; + +static int tiotg_match(device_t, cfdata_t, void *); +static void tiotg_attach(device_t, device_t, void *); +static int tiotg_rescan(device_t, const char *, const int *); +static void tiotg_childdet(device_t, device_t); + +static int tiotg_intr(void *); + +CFATTACH_DECL2_NEW(tiotg, sizeof(struct tiotg_softc), +tiotg_match, tiotg_attach, NULL, NULL, +tiotg_rescan, tiotg_childdet); + +/* + * motg device attachement and driver, + * for the per-port part of the controller: TI-specific part, phy and + * MI Mentor OTG. + */ + +struct motg_attach_args { + int aa_port; + int aa_intr; + bus_space_tag_t aa_iot; + bus_space_handle_t aa_ioh; + bus_dma_tag_t aa_dmat; +}; + +struct ti_motg_softc { + struct motg_softc sc_motg; + bus_space_tag_t sc_ctrliot; + bus_space_handle_t sc_ctrlioh; + void * sc_ctrlih; + int sc_ctrlport; +}; +static int ti_motg_match(device_t, cfdata_t, void *); +static void ti_motg_attach(device_t, device_t, void *); +static int ti_motg_rescan(device_t, const char *, const int *); +static void ti_motg_childdet(device_t, device_t); +static int ti_motg_print(void *, const char *); +static int ti_motg_intr(void *); +static void ti_motg_poll(void *); + +CFATTACH_DECL2_NEW(motg, sizeof(struct ti_motg_softc), +ti_motg_match, ti_motg_attach, NULL, NULL, +ti_motg_rescan, ti_motg_childdet); + +static int +tiotg_match(device_t parent, cfdata_t match, void *aux) +{ +struct obio_attach_args *obio = aux; + +if ((obio->obio_addr == -1) || (obio->obio_size == 0) || + (obio->obio_intrbase == -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 obio_attach_args *obio = aux; + uint32_t val; + + sc->sc_iot = obio->obio_iot; + sc->sc_dmat = obio->obio_dmat; + sc->sc_dev = self; + + if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size, 0, + &sc->sc_ioh)) { + aprint_error(": couldn't map register space\n"); + return; + } + + sc->sc_intrbase = obio->obio_intrbase; + sc->sc_ih = intr_establish
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: bouyer Date: Wed Jul 16 18:25:24 UTC 2014 Modified Files: src/sys/arch/arm/omap: sitara_cmreg.h Log Message: Add USB control registers. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 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/sitara_cmreg.h diff -u src/sys/arch/arm/omap/sitara_cmreg.h:1.1 src/sys/arch/arm/omap/sitara_cmreg.h:1.2 --- src/sys/arch/arm/omap/sitara_cmreg.h:1.1 Wed Apr 17 15:04:39 2013 +++ src/sys/arch/arm/omap/sitara_cmreg.h Wed Jul 16 18:25:24 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sitara_cmreg.h,v 1.1 2013/04/17 15:04:39 bouyer Exp $ */ +/* $NetBSD: sitara_cmreg.h,v 1.2 2014/07/16 18:25:24 bouyer Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. @@ -39,6 +39,12 @@ #define SCM_REVISION_CUSTOM(x) (((x) & 0x00c0) >> 6) #define SCM_REVISION_MINOR(x) (((x) & 0x001f) >> 0) +#define OMAP2SCM_USB_CTL0 0x620 +#define OMAP2SCM_USB_CTL1 0x628 +#define OMAP2SCM_USB_CTLx_SESSIONEND 0x10 +#define OMAP2SCM_USB_CTLx_VBUSDET 0x08 +#define OMAP2SCM_USB_CTLx_OTGPHY_PWD 0x02 +#define OMAP2SCM_USB_CTLx_CMPHY_PWD 0x01 #define OMAP2SCM_MAC_ID0_LO 0x630 #define OMAP2SCM_MAC_ID0_HI 0x634
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: bouyer Date: Wed Jul 16 18:24:35 UTC 2014 Modified Files: src/sys/arch/arm/omap: am335x_prcm.h Log Message: Add peripheral clock defines, from FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/am335x_prcm.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/am335x_prcm.h diff -u src/sys/arch/arm/omap/am335x_prcm.h:1.6 src/sys/arch/arm/omap/am335x_prcm.h:1.7 --- src/sys/arch/arm/omap/am335x_prcm.h:1.6 Thu Aug 29 15:50:41 2013 +++ src/sys/arch/arm/omap/am335x_prcm.h Wed Jul 16 18:24:35 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_prcm.h,v 1.6 2013/08/29 15:50:41 riz Exp $ */ +/* $NetBSD: am335x_prcm.h,v 1.7 2014/07/16 18:24:35 bouyer Exp $ */ /* * TI OMAP Power, Reset, and Clock Management on the AM335x @@ -44,8 +44,73 @@ struct omap_module { }; #define AM335X_PRCM_CM_PER 0x +#define CM_PER_L4LS_CLKSTCTRL 0x000 +#define CM_PER_L3S_CLKSTCTRL 0x004 +#define CM_PER_L3_CLKSTCTRL 0x00C +#define CM_PER_CPGMAC0_CLKCTRL 0x014 +#define CM_PER_LCDC_CLKCTRL 0x018 +#define CM_PER_USB0_CLKCTRL 0x01C +#define CM_PER_TPTC0_CLKCTRL 0x024 +#define CM_PER_UART5_CLKCTRL 0x038 +#define CM_PER_MMC0_CLKCTRL 0x03C +#define CM_PER_I2C2_CLKCTRL 0x044 +#define CM_PER_I2C1_CLKCTRL 0x048 +#define CM_PER_UART1_CLKCTRL 0x06C +#define CM_PER_UART2_CLKCTRL 0x070 +#define CM_PER_UART3_CLKCTRL 0x074 +#define CM_PER_UART4_CLKCTRL 0x078 +#define CM_PER_TIMER7_CLKCTRL 0x07C +#define CM_PER_TIMER2_CLKCTRL 0x080 +#define CM_PER_TIMER3_CLKCTRL 0x084 +#define CM_PER_TIMER4_CLKCTRL 0x088 +#define CM_PER_GPIO1_CLKCTRL 0x0AC +#define CM_PER_GPIO2_CLKCTRL 0x0B0 +#define CM_PER_GPIO3_CLKCTRL 0x0B4 +#define CM_PER_TPCC_CLKCTRL 0x0BC +#define CM_PER_EPWMSS1_CLKCTRL 0x0CC +#define CM_PER_EPWMSS0_CLKCTRL 0x0D4 +#define CM_PER_EPWMSS2_CLKCTRL 0x0D8 +#define CM_PER_L3_INSTR_CLKCTRL 0x0DC +#define CM_PER_L3_CLKCTRL 0x0E0 +#define CM_PER_PRUSS_CLKCTRL 0x0E8 +#define CM_PER_TIMER5_CLKCTRL 0x0EC +#define CM_PER_TIMER6_CLKCTRL 0x0F0 +#define CM_PER_MMC1_CLKCTRL 0x0F4 +#define CM_PER_MMC2_CLKCTRL 0x0F8 +#define CM_PER_TPTC1_CLKCTRL 0x0FC +#define CM_PER_TPTC2_CLKCTRL 0x100 +#define CM_PER_SPINLOCK0_CLKCTRL 0x10C +#define CM_PER_MAILBOX0_CLKCTRL 0x110 +#define CM_PER_OCPWP_L3_CLKSTCTRL 0x12C +#define CM_PER_OCPWP_CLKCTRL 0x130 +#define CM_PER_CPSW_CLKSTCTRL 0x144 +#define CM_PER_PRUSS_CLKSTCTRL 0x140 + #define AM335X_PRCM_CM_WKUP 0x0400 +#define CM_WKUP_CLKSTCTRL 0x000 +#define CM_WKUP_CONTROL_CLKCTRL 0x004 +#define CM_WKUP_GPIO0_CLKCTRL 0x008 +#define CM_WKUP_CM_L3_AON_CLKSTCTRL 0x01C +#define CM_WKUP_CM_CLKSEL_DPLL_MPU 0x02C +#define CM_WKUP_CM_IDLEST_DPLL_DISP 0x048 +#define CM_WKUP_CM_CLKSEL_DPLL_DISP 0x054 +#define CM_WKUP_CM_CLKDCOLDO_DPLL_PER 0x07C +#define CM_WKUP_CM_CLKDCOLDO_DPLL_PER_CLKDCOLDO_ST 0x200 +#define CM_WKUP_CM_CLKDCOLDO_DPLL_PER_CLKDCOLDO_GATE_CTRL 0x100 + +#define CM_WKUP_CM_CLKMODE_DPLL_DISP 0x098 +#define CM_WKUP_I2C0_CLKCTRL 0x0B8 +#define CM_WKUP_ADC_TSC_CLKCTRL 0x0BC + #define AM335X_PRCM_CM_DPLL 0x0500 +#define CLKSEL_TIMER7_CLK 0x004 +#define CLKSEL_TIMER2_CLK 0x008 +#define CLKSEL_TIMER3_CLK 0x00C +#define CLKSEL_TIMER4_CLK 0x010 +#define CLKSEL_TIMER5_CLK 0x018 +#define CLKSEL_TIMER6_CLK 0x01C +#define CLKSEL_PRUSS_OCP_CLK 0x030 + #define AM335X_PRCM_CM_MPU 0x0600 #define AM335X_PRCM_CM_DEVICE 0x0700 #define AM335X_PRCM_CM_RTC 0x0800
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: hans Date: Wed Apr 9 21:02:32 UTC 2014 Modified Files: src/sys/arch/arm/omap: obio_com.c Log Message: Fix build of non-debug kernels, mark err __diagused in uart_enable(). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/arch/arm/omap/obio_com.c:1.5 --- src/sys/arch/arm/omap/obio_com.c:1.4 Fri Jul 1 20:30:21 2011 +++ src/sys/arch/arm/omap/obio_com.c Wed Apr 9 21:02:31 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: obio_com.c,v 1.4 2011/07/01 20:30:21 dyoung Exp $ */ +/* $NetBSD: obio_com.c,v 1.5 2014/04/09 21:02:31 hans Exp $ */ /* * Based on arch/arm/omap/omap_com.c @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: obio_com.c,v 1.4 2011/07/01 20:30:21 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obio_com.c,v 1.5 2014/04/09 21:02:31 hans Exp $"); #include "opt_omap.h" #include "opt_com.h" @@ -171,7 +171,7 @@ uart_enable(struct obio_attach_args *obi #endif uint32_t fclken1; uint32_t iclken1; - int err; + int err __diagused; int n=-1; KASSERT(obio != NULL);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: hans Date: Wed Apr 9 20:52:14 UTC 2014 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: Fix build in non-debug kernels, mark eopi __diagused in cpsw_start(). To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/arch/arm/omap/if_cpsw.c:1.6 --- src/sys/arch/arm/omap/if_cpsw.c:1.5 Wed Feb 26 03:58:33 2014 +++ src/sys/arch/arm/omap/if_cpsw.c Wed Apr 9 20:52:14 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.5 2014/02/26 03:58:33 ozaki-r Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.6 2014/04/09 20:52:14 hans Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.5 2014/02/26 03:58:33 ozaki-r Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6 2014/04/09 20:52:14 hans Exp $"); #include #include @@ -527,7 +527,7 @@ cpsw_start(struct ifnet *ifp) uint32_t * const dw = bd.word; struct mbuf *m; bus_dmamap_t dm; - u_int eopi = ~0; + u_int eopi __diagused = ~0; u_int seg; u_int txfree; int txstart = -1;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Wed Apr 9 19:50:01 UTC 2014 Modified Files: src/sys/arch/arm/omap: omap5430_intr.h Log Message: Use new IRQ_SPI/GIC_MAXSOURCES macros. Fix comments. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/omap5430_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/omap5430_intr.h diff -u src/sys/arch/arm/omap/omap5430_intr.h:1.1 src/sys/arch/arm/omap/omap5430_intr.h:1.2 --- src/sys/arch/arm/omap/omap5430_intr.h:1.1 Sat Jun 15 21:55:09 2013 +++ src/sys/arch/arm/omap/omap5430_intr.h Wed Apr 9 19:50:01 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omap5430_intr.h,v 1.1 2013/06/15 21:55:09 matt Exp $ */ +/* $NetBSD: omap5430_intr.h,v 1.2 2014/04/09 19:50:01 matt Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -35,120 +35,116 @@ * 0-15 are used for SGIs (software generated interrupts). * 16-31 are used for PPIs (private peripheral interrupts). * 32... are used for SPIs (shared peripheral interrupts). - * - * To make things easier, SPIs will start at 0 and SGIs/PPIs - * will at the end of SPIs (these are internal and shouldn't - * be used by real devices). */ -#define PIC_MAXSOURCES (32+160) -#define PIC_MAXMAXSOURCES (PIC_MAXSOURCES+8*32) +#define PIC_MAXSOURCES GIC_MAXSOURCES(160) +#define PIC_MAXMAXSOURCES (PIC_MAXSOURCES+8*32) /* * The BCM53xx uses a generic interrupt controller so pull that stuff. */ #include -#include /* A9 Timer PPIs */ +#include /* Generic Timer PPIs */ #ifndef _LOCORE -#define IRQ_MPU_CLUSTER (32+0) // Illegal writes to interrupt controller memory map region -#define IRQ_CTI_0 (32+1) // Cross-trigger module 0 (CTI0) interrupt -#define IRQ_CTI_1 (32+2) // Cross-trigger module 1 (CTI1) interrupt -#define IRQ_ELM (32+4) // Error location process completion -#define IRQ_WD_TIMER_C0 (32+5) // WD_TIMER_MPU_C0 warning interrupt -#define IRQ_WD_TIMER_C1 (32+6) // WD_TIMER_MPU_C1 warning interrupt -#define IRQ_SYS_NIRQ1 (32+7) // External interrupt 1 (active low) -#define IRQ_L3_DBG (32+9) // L3 interconnect debug error -#define IRQ_L3_APP (32+10) // L3 interconnect application error -#define IRQ_PRCM_MPU (32+11) // PRCM interrupt -#define IRQ_SDMA_0 (32+12) // sDMA interrupt 0 -#define IRQ_SDMA_1 (32+13) // sDMA interrupt 1 -#define IRQ_SDMA_2 (32+14) // sDMA interrupt 2 -#define IRQ_SDMA_3 (32+15) // sDMA interrupt 3 -#define IRQ_L3_MAIN_STAT_ALARM (32+16) // L3 N0C statistic collector alarm -#define IRQ_MCBSP1 (32+17) // MCBSP1 interrupt -#define IRQ_SR_MPU (32+18) // SmartReflex MPU interrupt -#define IRQ_SR_CORE (32+19) // SmartReflex Core interrupt -#define IRQ_GPMC (32+20) // GPMC interrupt -#define IRQ_GPU (32+21) // 2D/3D graphics module interrupt -#define IRQ_MCBSP2 (32+22) // MCBSP2 interrupt -#define IRQ_MCBSP3 (32+23) // MCBSP3 interrupt -#define IRQ_ISS5 (32+24) // Imaging subsystem interrupt 5 -#define IRQ_DSS_DISPC (32+25) // Display controller interrupt -#define IRQ_MAIL_U0_MPU (32+26) // Mailbox user 0 interrupt -#define IRQ_27 (32+27) // Reserved -#define IRQ_DSP_MMU (32+28) // DSP MMU interrupt -#define IRQ_GPIO1_MPU (32+29) // GPIO1 MPU interrupt -#define IRQ_GPIO2_MPU (32+30) // GPIO2 MPU interrupt -#define IRQ_GPIO3_MPU (32+31) // GPIO3 MPU interrupt -#define IRQ_GPIO4_MPU (32+32) // GPIO4 MPU interrupt -#define IRQ_GPIO5_MPU (32+33) // GPIO5 MPU interrupt -#define IRQ_GPIO6_MPU (32+34) // GPIO6 MPU interrupt -#define IRQ_GPIO7_MPU (32+35) // GPIO7 MPU interrupt -#define IRQ_WDT3 (32+36) // WDTIMER3 overflow -#define IRQ_GPT1 (32+37) // GPTIMER1 interrupt -#define IRQ_GPT2 (32+38) // GPTIMER2 interrupt -#define IRQ_GPT3 (32+39) // GPTIMER3 interrupt -#define IRQ_GPT4 (32+40) // GPTIMER4 interrupt -#define IRQ_GPT5 (32+41) // GPTIMER5 interrupt -#define IRQ_GPT6 (32+42) // GPTIMER6 interrupt -#define IRQ_GPT7 (32+43) // GPTIMER7 interrupt -#define IRQ_GPT8 (32+44) // GPTIMER8 interrupt -#define IRQ_GPT9 (32+45) // GPTIMER9 interrupt -#define IRQ_GPT10 (32+46) // GPTIMER10 interrupt -#define IRQ_GPT11 (32+47) // GPTIMER11 interrupt -#define IRQ_MCSPI4 (32+48) // MCSPI4 interrupt -#define IRQ_DSS_DSI1_A (32+53) // Display Subsystem DSI1_A interrupt -#define IRQ_SATA (32+54) // SATA interrupt -#define IRQ_DSS_DSI1_C (32+55) // Display Subsystem DSI1_C interrupt -#define IRQ_I2C1 (32+56) // I2C1 interrupt -#define IRQ_I2C2 (32+57) // I2C2 interrupt -#define IRQ_HDQ (32+58) // HDQ/1wire interrupt -#define IRQ_MMC5 (32+59) // MMC5 interrupt -#define IRQ_I2C3 (32+61) // I2C3 interrupt -#define IRQ_I2C4 (32+62) // I2C4 interrupt -#define IRQ_MCSPI1 (32+65) // MCSPI1 interrupt -#define IRQ_MCSPI2 (32+66) // MCSPI2 interrupt -#define IRQ_HSI_P1_MPU (32+67) // HSI Port 1 interrupt -#define IRQ_HSI_P2_MPU (32+68) // HSI Port 2 interrupt -#define I
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Fri Apr 4 21:33:19 UTC 2014 Modified Files: src/sys/arch/arm/omap: omap2_reg.h omap5_ahcisata.c Log Message: Fix build break. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/omap/omap2_reg.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/omap5_ahcisata.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_reg.h diff -u src/sys/arch/arm/omap/omap2_reg.h:1.26 src/sys/arch/arm/omap/omap2_reg.h:1.27 --- src/sys/arch/arm/omap/omap2_reg.h:1.26 Thu Apr 3 17:11:10 2014 +++ src/sys/arch/arm/omap/omap2_reg.h Fri Apr 4 21:33:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_reg.h,v 1.26 2014/04/03 17:11:10 matt Exp $ */ +/* $NetBSD: omap2_reg.h,v 1.27 2014/04/04 21:33:19 matt Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -399,6 +399,8 @@ #define OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH0_CLK __BIT(8) #define OMAP5_CM_L3INIT_SATA_CLKCTRL 0x0088 #define OMAP5_CM_L3INIT_SATA_CLKCTRL_OPTFCLKEN_REF_CLK __BIT(8) +#define OMAP4_CM_L3INIT_SATA_CLKCTRL_MODULEMODE __BITS(1,0) +#define OMAP4_CM_L3INIT_SATA_CLKCTRL_MODULEMODE_HW 2 #define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL 0x00F0 #define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL_OPTFCLKEN_REFCLK960M __BIT(8) #define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL_MODULEMODE __BITS(1,0) @@ -878,15 +880,6 @@ #define OMAP5_CM_CTL_WKUP_MUXMODE1_GPIO_WK11 6 #define OMAP5_CM_CTL_WKUP_MUXMODE1_SAFE_MODE_WAKEUP12 7 -#define OMAP5_CM_L3INIT_MMC1_CLKCTRL 0x4a009628 -#define OMAP5_CM_L3INIT_MMC2_CLKCTRL 0x4a009630 -#define OMAP5_CM_L3INIT_HSI_CLKCTRL 0x4a009638 -#define OMAP5_CM_L3INIT_USB_HOST_HS_CLKCTRL 0x4a009658 -#define OMAP5_CM_L3INIT_SATA_CLKCTRL 0x4a009688 - -#define OMAP5_CM_L3INIT_MODE __BITS(0,1) -#define OMAP5_CM_L3INIT_ENABLE 2 - #ifdef TI_AM335X #define TI_AM335X_CTLMOD_BASE 0x44e1 #define CTLMOD_CONTROL_STATUS 0x40 Index: src/sys/arch/arm/omap/omap5_ahcisata.c diff -u src/sys/arch/arm/omap/omap5_ahcisata.c:1.2 src/sys/arch/arm/omap/omap5_ahcisata.c:1.3 --- src/sys/arch/arm/omap/omap5_ahcisata.c:1.2 Thu Apr 3 17:12:15 2014 +++ src/sys/arch/arm/omap/omap5_ahcisata.c Fri Apr 4 21:33:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omap5_ahcisata.c,v 1.2 2014/04/03 17:12:15 matt Exp $ */ +/* $NetBSD: omap5_ahcisata.c,v 1.3 2014/04/04 21:33:19 matt Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap5_ahcisata.c,v 1.2 2014/04/03 17:12:15 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap5_ahcisata.c,v 1.3 2014/04/04 21:33:19 matt Exp $"); #include "locators.h" @@ -86,12 +86,13 @@ omap5_ahcisata_attach(device_t parent, d #ifdef OMAP5 { bus_space_handle_t ioh; - rv = bus_space_map(obio->obio_iot, - OMAP5_CM_L3INIT_SATA_CLKCTRL, 4, 0, &ioh); + rv = bus_space_map(obio->obio_iot, OMAP2_CM_BASE + + OMAP5_CM_L3INIT_CORE + OMAP5_CM_L3INIT_SATA_CLKCTRL, + 4, 0, &ioh); KASSERT(rv == 0); uint32_t v = bus_space_read_4(obio->obio_iot, ioh, 0); - v &= ~OMAP5_CM_L3INIT_MODE; - v |= OMAP5_CM_L3INIT_ENABLE; + v &= ~OMAP4_CM_L3INIT_SATA_CLKCTRL_MODULEMODE; + v |= OMAP4_CM_L3INIT_SATA_CLKCTRL_MODULEMODE_HW; bus_space_write_4(obio->obio_iot, ioh, 0, v); bus_space_unmap(obio->obio_iot, ioh, 4); }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Thu Apr 3 17:12:15 UTC 2014 Modified Files: src/sys/arch/arm/omap: omap5_ahcisata.c Log Message: Enable sata port To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/omap5_ahcisata.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/omap5_ahcisata.c diff -u src/sys/arch/arm/omap/omap5_ahcisata.c:1.1 src/sys/arch/arm/omap/omap5_ahcisata.c:1.2 --- src/sys/arch/arm/omap/omap5_ahcisata.c:1.1 Sat Jun 15 21:55:09 2013 +++ src/sys/arch/arm/omap/omap5_ahcisata.c Thu Apr 3 17:12:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omap5_ahcisata.c,v 1.1 2013/06/15 21:55:09 matt Exp $ */ +/* $NetBSD: omap5_ahcisata.c,v 1.2 2014/04/03 17:12:15 matt Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap5_ahcisata.c,v 1.1 2013/06/15 21:55:09 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap5_ahcisata.c,v 1.2 2014/04/03 17:12:15 matt Exp $"); #include "locators.h" @@ -83,6 +83,21 @@ omap5_ahcisata_attach(device_t parent, d aprint_naive("\n"); aprint_normal(": OMAP AHCI controller\n"); +#ifdef OMAP5 + { + bus_space_handle_t ioh; + rv = bus_space_map(obio->obio_iot, + OMAP5_CM_L3INIT_SATA_CLKCTRL, 4, 0, &ioh); + KASSERT(rv == 0); + uint32_t v = bus_space_read_4(obio->obio_iot, ioh, 0); + v &= ~OMAP5_CM_L3INIT_MODE; + v |= OMAP5_CM_L3INIT_ENABLE; + bus_space_write_4(obio->obio_iot, ioh, 0, v); + bus_space_unmap(obio->obio_iot, ioh, 4); + } +#endif + + sc->sc_ahci_ports = 1; sc->sc_dmat = obio->obio_dmat; sc->sc_ahcit = obio->obio_iot; sc->sc_ahcis = obio->obio_size;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Thu Apr 3 17:11:10 UTC 2014 Modified Files: src/sys/arch/arm/omap: omap2_reg.h Log Message: Add some more OMAP5 stuff. Consistently use upper case hex. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 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.25 src/sys/arch/arm/omap/omap2_reg.h:1.26 --- src/sys/arch/arm/omap/omap2_reg.h:1.25 Thu Apr 3 17:09:48 2014 +++ src/sys/arch/arm/omap/omap2_reg.h Thu Apr 3 17:11:10 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_reg.h,v 1.25 2014/04/03 17:09:48 matt Exp $ */ +/* $NetBSD: omap2_reg.h,v 1.26 2014/04/03 17:11:10 matt Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -56,7 +56,7 @@ /* OMAP3 processors */ #define OMAP3430_L4_WAKEUP_BASE 0x4830 -#define OMAP3430_L4_WAKEUP_SIZE 0x0004 /* 256KB */ +#define OMAP3430_L4_WAKEUP_SIZE 0x0010 /* 256KB padded to 1M */ #define OMAP3430_L4_PERIPHERAL_BASE 0x4900 #define OMAP3430_L4_PERIPHERAL_SIZE 0x0010 /* 1MB */ @@ -65,7 +65,7 @@ #define OMAP3430_L4_EMULATION_SIZE 0x0080 /* 8MB */ #define OMAP3530_L4_WAKEUP_BASE 0x4830 -#define OMAP3530_L4_WAKEUP_SIZE 0x0004 /* 256KB */ +#define OMAP3530_L4_WAKEUP_SIZE 0x0010 /* 256KB padded to 1M */ #define OMAP3530_L4_PERIPHERAL_BASE 0x4900 #define OMAP3530_L4_PERIPHERAL_SIZE 0x0010 /* 1MB */ @@ -79,7 +79,7 @@ #define OMAP4430_L4_CORE_SIZE 0x0100 /* 16MB - CFG */ #define OMAP4430_L4_WAKEUP_BASE 0x4A30 -#define OMAP4430_L4_WAKEUP_SIZE 0x0004 /* 256KB */ +#define OMAP4430_L4_WAKEUP_SIZE 0x0010 /* 256KB padded to 1M */ #define OMAP4430_L4_PERIPHERAL_BASE 0x4800 #define OMAP4430_L4_PERIPHERAL_SIZE 0x0100 /* 16MB */ @@ -744,7 +744,7 @@ #define GPIO5_BASE_4430 0x4805b000 #define GPIO6_BASE_4430 0x4805d000 -#define GPIO1_BASE_5430 0x4ae1 +#define GPIO1_BASE_5430 0x4AE1 #define GPIO2_BASE_5430 0x48055000 #define GPIO3_BASE_5430 0x48057000 #define GPIO4_BASE_5430 0x48059000 @@ -753,10 +753,10 @@ #define GPIO7_BASE_5430 0x48051000 #define GPIO8_BASE_5430 0x48053000 -#define GPIO0_BASE_TI_AM335X 0x44e07000 -#define GPIO1_BASE_TI_AM335X 0x4804c000 -#define GPIO2_BASE_TI_AM335X 0x481ac000 -#define GPIO3_BASE_TI_AM335X 0x481ae000 +#define GPIO0_BASE_TI_AM335X 0x44E07000 +#define GPIO1_BASE_TI_AM335X 0x4804C000 +#define GPIO2_BASE_TI_AM335X 0x481AC000 +#define GPIO3_BASE_TI_AM335X 0x481AE000 #define GPIO1_BASE_TI_DM37XX 0x4831 #define GPIO2_BASE_TI_DM37XX 0x4905 @@ -844,6 +844,48 @@ #define PRM_FRAC_INCR_DENUM_RELOAD __BIT(16) #define PRM_FRAC_INCR_DENUM_DENOMINATOR __BITS(11,0) #define OMAP5_GTIMER_FREQ 6144000 /* 6.144Mhz */ +#define OMAP5_CM_CTL_WKUP_LLIA_WAKEREQIN_LLIBWAKEREQIN \ + 0x4AE0C840 +#define OMAP5_CM_CTL_WKUP_DRM_EMU0_DRM_EMU1 \ + 0x4AE0C844 +#define OMAP5_CM_CTL_WKUP_JTAG_NTRST_JTAG_TCK \ + 0x4AE0C848 +#define OMAP5_CM_CTL_WKUP_JTAG_TDI_JTAG_TMSC \ + 0x4AE0C84C +#define OMAP5_CM_CTL_WKUP_JTAG_TDI_JTAG_TDO \ + 0x4AE0C850 +#define OMAP5_CM_CTL_WKUP_SYS_32K_FREQ_CLK_IOREG \ + 0x4AE0C854 +#define OMAP5_CM_CTL_WKUP_REF_CLK0_OUT_REF_CLK1_OUT \ + 0x4AE0C858 +#define OMAP5_CM_CTL_WKUP_WAKEUPEVENT1 __BIT(31) +#define OMAP5_CM_CTL_WKUP_WAKEUPENABLE1 __BIT(30) +#define OMAP5_CM_CTL_WKUP_INPUT_ENABLE1 __BIT(24) +#define OMAP5_CM_CTL_WKUP_PWRDOWN1 __BIT(21) +#define OMAP5_CM_CTL_WKUP_PULLTYPEUP1 __BIT(20) +#define OMAP5_CM_CTL_WKUP_PULLUDENABLE1 __BIT(19) +#define OMAP5_CM_CTL_WKUP_MUXMODE1 __BITS(18,16) +#define OMAP5_CM_CTL_WKUP_WAKEUPEVENT0 __BIT(15) +#define OMAP5_CM_CTL_WKUP_WAKEUPENABLE0 __BIT(14) +#define OMAP5_CM_CTL_WKUP_INPUT_ENABLE0 __BIT(8) +#define OMAP5_CM_CTL_WKUP_PWRDOWN0 __BIT(5) +#define OMAP5_CM_CTL_WKUP_PULLTYPEUP0 __BIT(4) +#define OMAP5_CM_CTL_WKUP_PULLUDENABLE0 __BIT(3) +#define OMAP5_CM_CTL_WKUP_MUXMODE0 __BITS(2,0) + +#define OMAP5_CM_CTL_WKUP_MUXMODE1_REF_CLK1_OUT 0 +#define OMAP5_CM_CTL_WKUP_MUXMODE1_HW_WKDBG5 5 +#define OMAP5_CM_CTL_WKUP_MUXMODE1_GPIO_WK11 6 +#define OMAP5_CM_CTL_WKUP_MUXMODE1_SAFE_MODE_WAKEUP12 7 + +#define OMAP5_CM_L3INIT_MMC1_CLKCTRL 0x4a009628 +#define OMAP5_CM_L3INIT_MMC2_CLKCTRL 0x4a009630 +#define OMAP5_CM_L3INIT_HSI_CLKCTRL 0x4a009638 +#define OMAP5_CM_L3INIT_USB_HOST_HS_CLKCTRL 0x4a009658 +#define OMAP5_CM_L3INIT_SATA_CLKCTRL 0x4a009688 + +#define OMAP5_CM_L3INIT_MODE __BITS(0,1) +#define OMAP5_CM_L3INIT_ENABLE 2 #ifdef TI_AM335X #define TI_AM335X_CTLMOD_BASE 0x44e1
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Thu Apr 3 17:09:48 UTC 2014 Modified Files: src/sys/arch/arm/omap: omap2_reg.h Log Message: Consistently use #define To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 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.24 src/sys/arch/arm/omap/omap2_reg.h:1.25 --- src/sys/arch/arm/omap/omap2_reg.h:1.24 Sat Mar 29 23:32:41 2014 +++ src/sys/arch/arm/omap/omap2_reg.h Thu Apr 3 17:09:48 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_reg.h,v 1.24 2014/03/29 23:32:41 matt Exp $ */ +/* $NetBSD: omap2_reg.h,v 1.25 2014/04/03 17:09:48 matt Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -30,7 +30,7 @@ */ #ifndef _ARM_OMAP_OMAP2_REG_H_ -#define _ARM_OMAP_OMAP2_REG_H_ +#define _ARM_OMAP_OMAP2_REG_H_ #include "opt_omap.h" @@ -41,132 +41,132 @@ /* * L4 Interconnect WAKEUP address space */ -#define OMAP2430_L4_CORE_BASE 0x4800 -#define OMAP2430_L4_CORE_SIZE (16 << 20) /* 16 MB */ +#define OMAP2430_L4_CORE_BASE 0x4800 +#define OMAP2430_L4_CORE_SIZE (16 << 20) /* 16 MB */ -#define OMAP2430_L4_WAKEUP_BASE 0x4900 -#define OMAP2430_L4_WAKEUP_SIZE (8 << 20) /* 8 MB */ +#define OMAP2430_L4_WAKEUP_BASE 0x4900 +#define OMAP2430_L4_WAKEUP_SIZE (8 << 20) /* 8 MB */ -#define OMAP3430_L4_CORE_BASE 0x4800 -#define OMAP3430_L4_CORE_SIZE 0x0100 /* 16 MB */ +#define OMAP3430_L4_CORE_BASE 0x4800 +#define OMAP3430_L4_CORE_SIZE 0x0100 /* 16 MB */ -#define OMAP3530_L4_CORE_BASE 0x4800 -#define OMAP3530_L4_CORE_SIZE 0x0100 /* 16 MB */ +#define OMAP3530_L4_CORE_BASE 0x4800 +#define OMAP3530_L4_CORE_SIZE 0x0100 /* 16 MB */ /* OMAP3 processors */ -#define OMAP3430_L4_WAKEUP_BASE 0x4830 -#define OMAP3430_L4_WAKEUP_SIZE 0x0004 /* 256KB */ +#define OMAP3430_L4_WAKEUP_BASE 0x4830 +#define OMAP3430_L4_WAKEUP_SIZE 0x0004 /* 256KB */ -#define OMAP3430_L4_PERIPHERAL_BASE 0x4900 -#define OMAP3430_L4_PERIPHERAL_SIZE 0x0010 /* 1MB */ +#define OMAP3430_L4_PERIPHERAL_BASE 0x4900 +#define OMAP3430_L4_PERIPHERAL_SIZE 0x0010 /* 1MB */ -#define OMAP3430_L4_EMULATION_BASE 0x5400 -#define OMAP3430_L4_EMULATION_SIZE 0x0080 /* 8MB */ +#define OMAP3430_L4_EMULATION_BASE 0x5400 +#define OMAP3430_L4_EMULATION_SIZE 0x0080 /* 8MB */ -#define OMAP3530_L4_WAKEUP_BASE 0x4830 -#define OMAP3530_L4_WAKEUP_SIZE 0x0004 /* 256KB */ +#define OMAP3530_L4_WAKEUP_BASE 0x4830 +#define OMAP3530_L4_WAKEUP_SIZE 0x0004 /* 256KB */ -#define OMAP3530_L4_PERIPHERAL_BASE 0x4900 -#define OMAP3530_L4_PERIPHERAL_SIZE 0x0010 /* 1MB */ +#define OMAP3530_L4_PERIPHERAL_BASE 0x4900 +#define OMAP3530_L4_PERIPHERAL_SIZE 0x0010 /* 1MB */ -#define OMAP3530_L4_EMULATION_BASE 0x5400 -#define OMAP3530_L4_EMULATION_SIZE 0x0080 /* 8MB */ +#define OMAP3530_L4_EMULATION_BASE 0x5400 +#define OMAP3530_L4_EMULATION_SIZE 0x0080 /* 8MB */ /* OMAP4 processors */ -#define OMAP4430_L4_CORE_BASE 0x4A00 -#define OMAP4430_L4_CORE_SIZE 0x0100 /* 16MB - CFG */ +#define OMAP4430_L4_CORE_BASE 0x4A00 +#define OMAP4430_L4_CORE_SIZE 0x0100 /* 16MB - CFG */ -#define OMAP4430_L4_WAKEUP_BASE 0x4A30 -#define OMAP4430_L4_WAKEUP_SIZE 0x0004 /* 256KB */ +#define OMAP4430_L4_WAKEUP_BASE 0x4A30 +#define OMAP4430_L4_WAKEUP_SIZE 0x0004 /* 256KB */ -#define OMAP4430_L4_PERIPHERAL_BASE 0x4800 -#define OMAP4430_L4_PERIPHERAL_SIZE 0x0100 /* 16MB */ +#define OMAP4430_L4_PERIPHERAL_BASE 0x4800 +#define OMAP4430_L4_PERIPHERAL_SIZE 0x0100 /* 16MB */ -#define OMAP4430_L4_ABE_BASE 0x4900 /* Actually L3 */ -#define OMAP4430_L4_ABE_SIZE 0x0100 /* 16MB */ +#define OMAP4430_L4_ABE_BASE 0x4900 /* Actually L3 */ +#define OMAP4430_L4_ABE_SIZE 0x0100 /* 16MB */ -#define OMAP4430_EMIF1_BASE 0x4C00 /* MemCtrl 0 */ -#define OMAP4430_EMIF1_SIZE 0x0010 /* 4KB padded to 1M */ +#define OMAP4430_EMIF1_BASE 0x4C00 /* MemCtrl 0 */ +#define OMAP4430_EMIF1_SIZE 0x0010 /* 4KB padded to 1M */ -#define OMAP4430_EMIF2_BASE 0x4D00 /* MemCtrl 1 */ -#define OMAP4430_EMIF2_SIZE 0x0010 /* 4KB padded to 1M */ +#define OMAP4430_EMIF2_BASE 0x4D00 /* MemCtrl 1 */ +#define OMAP4430_EMIF2_SIZE 0x0010 /* 4KB padded to 1M */ /* OMAP5 processors */ -#define OMAP5430_L4_CORE_BASE 0x4A00 -#define OMAP5430_L4_CORE_SIZE 0x0100 /* 16MB - CFG */ +#define OMAP5430_L4_CORE_BASE 0x4A00 +#define OMAP5430_L4_CORE_SIZE 0x0100 /* 16MB - CFG */ -#define OMAP5430_L4_WAKEUP_BASE 0x4AE0 -#define OMAP5430_L4_WAKEUP_SIZE 0x0020 /* 2M */ +#define OMAP5430_L4_WAKEUP_BASE 0x4AE0 +#define OMAP5430_L4_WAKEUP_SIZE 0x0020 /* 2M */ -#define OMAP5430_L4_PERIPHERAL_B
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Sat Mar 29 23:32:41 UTC 2014 Modified Files: src/sys/arch/arm/omap: omap2_reg.h omap3_ehci.c omap3_sdhc.c omap3_uhhreg.h omap3_usbtllreg.h Log Message: OMAP4/OMAP5 changes. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/omap/omap2_reg.h cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap3_ehci.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/omap/omap3_sdhc.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/omap3_uhhreg.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/omap3_usbtllreg.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.23 src/sys/arch/arm/omap/omap2_reg.h:1.24 --- src/sys/arch/arm/omap/omap2_reg.h:1.23 Thu Jun 20 05:27:31 2013 +++ src/sys/arch/arm/omap/omap2_reg.h Sat Mar 29 23:32:41 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_reg.h,v 1.23 2013/06/20 05:27:31 matt Exp $ */ +/* $NetBSD: omap2_reg.h,v 1.24 2014/03/29 23:32:41 matt Exp $ */ /* * Copyright (c) 2007 Microsoft @@ -363,6 +363,47 @@ #define TI_AM335X_CM_DIV_M2_DPLL_MPU_DPLL_CLKOUT_DIVCHACK __BIT(5) #define TI_AM335X_CM_DIV_M2_DPLL_MPU_DPLL_CLKOUT_DIV __BITS(4,0) +#define OMAP4_CM_L3INIT_CORE 0x5300 /* OMAP2_CM_BASE */ +#define OMAP5_CM_L3INIT_CORE 0x5600 /* OMAP2_CM_BASE */ +#define OMAP4_CM_L3INIT_HSMMC1_CLKCTRL 0x0008 +#define OMAP4_CM_L3INIT_HSMMC2_CLKCTRL 0x0030 +#define OMAP5_CM_L3INIT_HSMMC_CLKCTRL_CLKSEL_DIV2 __BIT(25) +#define OMAP4_CM_L3INIT_HSMMC_CLKCTRL_CLKSEL __BIT(24) +#define OMAP5_CM_L3INIT_HSMMC_CLKCTRL_OPTFCLKEN_32KHZ_CLK __BIT(8) +#define OMAP4_CM_L3INIT_HSMMC_CLKCTRL_MODELMODE __BITS(1,0) +#define OMAP4_CM_L3INIT_HSMMC_CLKCTRL_MODELMODE_HW 2 +#define OMAP4_CM_L3INIT_HSI_CLKCTRL 0x0038 +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL 0x0058 +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_CLKSEL_UTMI_P2 __BIT(25) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_CLKSEL_UTMI_P1 __BIT(24) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_FUNC48M_CLK __BIT(15) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P2_CLK __BIT(14) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P1_CLK __BIT(13) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P2_CLK __BIT(12) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P1_CLK __BIT(11) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P3_CLK __BIT(10) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P2_CLK __BIT(9) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P1_CLK __BIT(8) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P3_CLK __BIT(7) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P3_CLK __BIT(6) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_MODULEMODE __BITS(1,0) +#define OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_MODULEMODE_HW 2 +#define OMAP4_CM_L3INIT_USB_OTG_HS_CLKCTRL 0x0060 +#define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL_CLKSEL_60M __BIT(24) +#define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL_OPTFCLKEN_XCLK __BIT(8) +#define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL_MODULEMODE __BITS(1,0) +#define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL_MODULEMODE_HW 1 +#define OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL 0x0068 +#define OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH2_CLK __BIT(10) +#define OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH1_CLK __BIT(9) +#define OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH0_CLK __BIT(8) +#define OMAP5_CM_L3INIT_SATA_CLKCTRL 0x0088 +#define OMAP5_CM_L3INIT_SATA_CLKCTRL_OPTFCLKEN_REF_CLK __BIT(8) +#define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL 0x00F0 +#define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL_OPTFCLKEN_REFCLK960M __BIT(8) +#define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL_MODULEMODE __BITS(1,0) +#define OMAP5_CM_L3INIT_USB_OTG_SS_CLKCTRL_MODULEMODE_HW 1 + /* * Power Management registers base, offsets, and size */ @@ -763,8 +804,8 @@ #define OHCI1_BASE_OMAP3 0x48064400 #define EHCI1_BASE_OMAP3 0x48064800 -#define OHCI1_BASE_OMAP4 0x4A064800 -#define EHCI1_BASE_OMAP4 0x4A064C00 +#define OHCI1_BASE_OMAP4 0x4A064800 /* also OMAP5 */ +#define EHCI1_BASE_OMAP4 0x4A064C00 /* also OMAP5 */ /* * SDRC @@ -781,6 +822,7 @@ /* * PL310 L2CC (44xx) */ +#define OMAP4_SCU_BASE 0x4824 #define OMAP4_L2CC_BASE 0x48242000 #define OMAP4_L2CC_SIZE 0x1000 /* 4KB */ @@ -788,6 +830,13 @@ #define AHCI1_BASE_OMAP5 0x4a14 +/* These also apply to OMAP5 */ +#define OMAP4_WUGEN_BASE 0x48281000 +#define OMAP4_WKG_CONTROL_0 0x +#define OMAP4_WKG_CONTROL_1 0x0400 +#define OMAP4_AUX_CORE_BOOT0 0x0800 +#define OMAP4_AUX_CORE_BOOT1 0x0804 + #define OMAP5_PRM_FRAC_INCREMENTER_NUMERATOR 0x48243210 #define PRM_FRAC_INCR_NUM_ABE_LP_MODE __BITS(27,16) #define PRM_FRAC_INCR_NUM_SYS_MODE __BITS(11,0) Index: src/sys/arch/ar
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: ozaki-r Date: Wed Mar 26 11:59:05 UTC 2014 Modified Files: src/sys/arch/arm/omap: ti_iic.c Log Message: Add missing 2nd argument to snprintf To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/arch/arm/omap/ti_iic.c:1.7 --- src/sys/arch/arm/omap/ti_iic.c:1.6 Wed Mar 26 08:52:00 2014 +++ src/sys/arch/arm/omap/ti_iic.c Wed Mar 26 11:59:05 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_iic.c,v 1.6 2014/03/26 08:52:00 christos Exp $ */ +/* $NetBSD: ti_iic.c,v 1.7 2014/03/26 11:59:05 ozaki-r Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.6 2014/03/26 08:52:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.7 2014/03/26 11:59:05 ozaki-r Exp $"); #include "opt_omap.h" #include "locators.h" @@ -238,7 +238,7 @@ ti_iic_attach(device_t parent, device_t } } KASSERT(i < __arraycount(am335x_iic)); - snprintf(buf, "%s_SDA", am335x_iic[i].as_name); + snprintf(buf, sizeof(buf), "%s_SDA", am335x_iic[i].as_name); if (sitara_cm_padconf_get(buf, &mode, &state) == 0) { aprint_debug(": SDA mode %s state %d ", mode, state); }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Sat Mar 15 17:14:56 UTC 2014 Modified Files: src/sys/arch/arm/omap: obio_ohci.c Log Message: OMAP5 support To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/obio_ohci.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_ohci.c diff -u src/sys/arch/arm/omap/obio_ohci.c:1.9 src/sys/arch/arm/omap/obio_ohci.c:1.10 --- src/sys/arch/arm/omap/obio_ohci.c:1.9 Sun Jun 16 17:47:54 2013 +++ src/sys/arch/arm/omap/obio_ohci.c Sat Mar 15 17:14:56 2014 @@ -1,7 +1,7 @@ -/* $Id: obio_ohci.c,v 1.9 2013/06/16 17:47:54 matt Exp $ */ +/* $Id: obio_ohci.c,v 1.10 2014/03/15 17:14:56 matt Exp $ */ /* adapted from: */ -/* $NetBSD: obio_ohci.c,v 1.9 2013/06/16 17:47:54 matt Exp $ */ +/* $NetBSD: obio_ohci.c,v 1.10 2014/03/15 17:14:56 matt Exp $ */ /* $OpenBSD: pxa2x0_ohci.c,v 1.19 2005/04/08 02:32:54 dlg Exp $ */ /* @@ -24,7 +24,7 @@ #include "locators.h" #include -__KERNEL_RCSID(0, "$NetBSD: obio_ohci.c,v 1.9 2013/06/16 17:47:54 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obio_ohci.c,v 1.10 2014/03/15 17:14:56 matt Exp $"); #include #include @@ -89,7 +89,7 @@ obioohci_match(device_t parent, cfdata_t if (obio->obio_addr != OHCI1_BASE_OMAP3) return 0; #endif -#if defined(OMAP4) +#if defined(OMAP4) || defined(OMAP5) if (obio->obio_addr != OHCI1_BASE_OMAP4) return 0; #endif
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: ozaki-r Date: Wed Feb 26 03:58:33 UTC 2014 Modified Files: src/sys/arch/arm/omap: if_cpsw.c if_cpswreg.h Log Message: Make cpsw driver work without uboot support On some eval boards such as BeagleBone, the cpsw device is initialized rightly by the uboot of the boards so that the cpsw driver doesn't need to do some initializations but works fine. The patch adds initializations to make the driver work solely. It also adds support for 1000BaseT (RGMII) PHY that is equipped on some boards, e.g., CKB-3352. Reviewed by christos@ To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/if_cpsw.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/if_cpswreg.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/if_cpsw.c diff -u src/sys/arch/arm/omap/if_cpsw.c:1.4 src/sys/arch/arm/omap/if_cpsw.c:1.5 --- src/sys/arch/arm/omap/if_cpsw.c:1.4 Wed Dec 18 12:53:26 2013 +++ src/sys/arch/arm/omap/if_cpsw.c Wed Feb 26 03:58:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.4 2013/12/18 12:53:26 skrll Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.5 2014/02/26 03:58:33 ozaki-r Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.4 2013/12/18 12:53:26 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.5 2014/02/26 03:58:33 ozaki-r Exp $"); #include #include @@ -122,6 +122,7 @@ struct cpsw_softc { bus_addr_t sc_rxdescs_pa; struct ethercom sc_ec; struct mii_data sc_mii; + bool sc_phy_has_1000t; callout_t sc_tick_ch; void *sc_ih; struct cpsw_ring_data *sc_rdp; @@ -163,6 +164,11 @@ static int cpsw_rxintr(void *); static int cpsw_txintr(void *); static int cpsw_miscintr(void *); +/* ALE support */ +#define CPSW_MAX_ALE_ENTRIES 1024 + +static int cpsw_ale_update_addresses(struct cpsw_softc *, int purge); + CFATTACH_DECL_NEW(cpsw, sizeof(struct cpsw_softc), cpsw_match, cpsw_attach, NULL, NULL); @@ -318,6 +324,18 @@ cpsw_match(device_t parent, cfdata_t cf, return 0; } +static bool +cpsw_phy_has_1000t(struct cpsw_softc * const sc) +{ + struct ifmedia_entry *ifm; + + TAILQ_FOREACH(ifm, &sc->sc_mii.mii_media.ifm_list, ifm_list) { + if (IFM_SUBTYPE(ifm->ifm_media) == IFM_1000_T) + return true; + } + return false; +} + static void cpsw_attach(device_t parent, device_t self, void *aux) { @@ -469,13 +487,28 @@ cpsw_attach(device_t parent, device_t se sc->sc_ec.ec_mii = &sc->sc_mii; ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange, ether_mediastatus); + + /* Initialize MDIO */ + cpsw_write_4(sc, MDIOCONTROL, MDIOCTL_ENABLE | MDIOCTL_FAULTENB | MDIOCTL_CLKDIV(0xff)); + /* Clear ALE */ + cpsw_write_4(sc, CPSW_ALE_CONTROL, ALECTL_CLEAR_TABLE); + mii_attach(self, &sc->sc_mii, 0x, MII_PHY_ANY, 0, 0); if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { aprint_error_dev(self, "no PHY found!\n"); + sc->sc_phy_has_1000t = false; ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_MANUAL, 0, NULL); ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_MANUAL); } else { + sc->sc_phy_has_1000t = cpsw_phy_has_1000t(sc); + if (sc->sc_phy_has_1000t) { + aprint_normal_dev(sc->sc_dev, "1000baseT PHY found. setting RGMII Mode\n"); + /* Select the Interface RGMII Mode in the Control Module */ + sitara_cm_reg_write_4(CPSW_GMII_SEL, + GMIISEL_GMII2_SEL(RGMII_MODE) | GMIISEL_GMII1_SEL(RGMII_MODE)); + } + ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); } @@ -791,6 +824,8 @@ cpsw_init(struct ifnet *ifp) /* Reset and init Sliver port 1 and 2 */ for (i = 0; i < 2; i++) { + uint32_t macctl; + /* Reset */ cpsw_write_4(sc, CPSW_SL_SOFT_RESET(i), 1); while(cpsw_read_4(sc, CPSW_SL_SOFT_RESET(i)) & 1); @@ -805,9 +840,12 @@ cpsw_init(struct ifnet *ifp) cpsw_write_4(sc, CPSW_PORT_P_SA_LO(i+1), sc->sc_enaddr[4] | (sc->sc_enaddr[5] << 8)); - /* Set MACCONTROL for ports 0,1: FULLDUPLEX(1), GMII_EN(5), - IFCTL_A(15), IFCTL_B(16) FIXME */ - cpsw_write_4(sc, CPSW_SL_MACCONTROL(i), 1 | (1<<5) | (1<<15)); + /* Set MACCONTROL for ports 0,1 */ + macctl = SLMACCTL_FULLDUPLEX | SLMACCTL_GMII_EN | + SLMACCTL_IFCTL_A; + if (sc->sc_phy_has_1000t) + macctl |= SLMACCTL_GIG; + cpsw_write_4(sc, CPSW_SL_MACCONTROL(i), macctl); /* Set ALE port to forwarding(3) */ cpsw_write_4(sc, CPSW_ALE_PORTCTL(i+1), 3); @@ -820,6 +858,9 @@ cpsw_init(struct ifnet *ifp) /* Set ALE port to forwarding(3) */ cpsw_write_4(sc, CPSW_ALE_PORTCTL(0), 3); + /* Initialize addrs */ + cpsw_ale_update_addresses(sc, 1); + cpsw_write_4(sc, CPSW_SS_PTYPE, 0); cpsw_write_4(sc, CPSW_SS_STAT_PORT_EN, 7); @@ -1242,3 +1283,194 @@ cpsw_miscintr(void *arg) return 1; } + +/* + * + * ALE support routines. + * + */ + +static void +cpsw_ale_entry_init(uint32_t *ale_entry) +{ + ale_entry[0] = ale_e
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Wed Dec 18 12:54:35 UTC 2013 Modified Files: src/sys/arch/arm/omap: ti_iic.c Log Message: Initialise len in ti_iic_do_{read,write}. Is this worth a pullups? To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/arch/arm/omap/ti_iic.c:1.5 --- src/sys/arch/arm/omap/ti_iic.c:1.4 Thu Apr 25 13:04:27 2013 +++ src/sys/arch/arm/omap/ti_iic.c Wed Dec 18 12:54:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ti_iic.c,v 1.4 2013/04/25 13:04:27 rkujawa Exp $ */ +/* $NetBSD: ti_iic.c,v 1.5 2013/12/18 12:54:35 skrll Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.4 2013/04/25 13:04:27 rkujawa Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.5 2013/12/18 12:54:35 skrll Exp $"); #include "opt_omap.h" #include "locators.h" @@ -559,7 +559,7 @@ ti_iic_handle_intr(struct ti_iic_softc * void ti_iic_do_read(struct ti_iic_softc *sc, uint32_t stat) { - int len; + int len = 0; KASSERT(mutex_owned(&sc->sc_mtx)); DPRINTF(("ti_iic_do_read stat %#x\n", stat)); @@ -586,7 +586,7 @@ ti_iic_do_read(struct ti_iic_softc *sc, void ti_iic_do_write(struct ti_iic_softc *sc, uint32_t stat) { - int len; + int len = 0; DPRINTF(("ti_iic_do_write stat %#x\n", stat)); KASSERT(mutex_owned(&sc->sc_mtx));
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Wed Dec 18 12:54:01 UTC 2013 Modified Files: src/sys/arch/arm/omap: omapfb.c Log Message: Deal with unused variables. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/omap/omapfb.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/omapfb.c diff -u src/sys/arch/arm/omap/omapfb.c:1.24 src/sys/arch/arm/omap/omapfb.c:1.25 --- src/sys/arch/arm/omap/omapfb.c:1.24 Sun Jun 9 05:52:04 2013 +++ src/sys/arch/arm/omap/omapfb.c Wed Dec 18 12:54:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: omapfb.c,v 1.24 2013/06/09 05:52:04 kiyohara Exp $ */ +/* $NetBSD: omapfb.c,v 1.25 2013/12/18 12:54:01 skrll Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.24 2013/06/09 05:52:04 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.25 2013/12/18 12:54:01 skrll Exp $"); #include #include @@ -189,7 +189,7 @@ omapfb_attach(device_t parent, device_t unsigned long defattr; bool is_console = false; uint32_t sz, reg; - int segs, i, j, adr; + int segs, i, j; sc->sc_iot = obio->obio_iot; sc->sc_dev = self; @@ -378,9 +378,9 @@ omapfb_attach(device_t parent, device_t OMAP_DSSCTRL_DAC_DEMEN); #endif - /* VENC to NTSC mode */ - adr = OMAPFB_VENC_F_CONTROL; #if 0 + /* VENC to NTSC mode */ + int adr = OMAPFB_VENC_F_CONTROL; for (i = 0; i < __arraycount(venc_mode_ntsc); i++) { bus_space_write_4(sc->sc_iot, sc->sc_regh, adr, venc_mode_ntsc[i]); @@ -981,10 +981,8 @@ omapfb_cursor(void *cookie, int on, int struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; struct omapfb_softc *sc = scr->scr_cookie; - int wi, he, pos; + int pos; - wi = ri->ri_font->fontwidth; - he = ri->ri_font->fontheight; pos = col + row * ri->ri_cols; #ifdef WSDISPLAY_SCROLLSUPPORT pos += scr->scr_offset_to_zero;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: skrll Date: Wed Dec 18 12:53:26 UTC 2013 Modified Files: src/sys/arch/arm/omap: if_cpsw.c Log Message: Remove unused variable. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 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.3 src/sys/arch/arm/omap/if_cpsw.c:1.4 --- src/sys/arch/arm/omap/if_cpsw.c:1.3 Wed Apr 17 14:36:34 2013 +++ src/sys/arch/arm/omap/if_cpsw.c Wed Dec 18 12:53:26 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.4 2013/12/18 12:53:26 skrll Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.4 2013/12/18 12:53:26 skrll Exp $"); #include #include @@ -494,7 +494,6 @@ cpsw_start(struct ifnet *ifp) uint32_t * const dw = bd.word; struct mbuf *m; bus_dmamap_t dm; - u_int sopi; /* Start of Packet Index */ u_int eopi = ~0; u_int seg; u_int txfree; @@ -556,7 +555,7 @@ cpsw_start(struct ifnet *ifp) if (txstart == -1) txstart = sc->sc_txnext; - sopi = eopi = sc->sc_txnext; + eopi = sc->sc_txnext; for (seg = 0; seg < dm->dm_nsegs; seg++) { dw[0] = cpsw_txdesc_paddr(sc, TXDESC_NEXT(sc->sc_txnext));
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: riz Date: Thu Aug 29 15:50:41 UTC 2013 Modified Files: src/sys/arch/arm/omap: am335x_prcm.h Log Message: Use __BIT(), not __BITS() to define a single-bit mask. >From Dennis Ferguson in PR#48162. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/am335x_prcm.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/am335x_prcm.h diff -u src/sys/arch/arm/omap/am335x_prcm.h:1.5 src/sys/arch/arm/omap/am335x_prcm.h:1.6 --- src/sys/arch/arm/omap/am335x_prcm.h:1.5 Sat Jun 29 20:43:33 2013 +++ src/sys/arch/arm/omap/am335x_prcm.h Thu Aug 29 15:50:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_prcm.h,v 1.5 2013/06/29 20:43:33 matt Exp $ */ +/* $NetBSD: am335x_prcm.h,v 1.6 2013/08/29 15:50:41 riz Exp $ */ /* * TI OMAP Power, Reset, and Clock Management on the AM335x @@ -66,7 +66,7 @@ struct omap_module { #define AM335X_PRCM_CM_IDLEST_DPLL_ST_DPLL_CLK_MN_BYPASS __BIT(8) #define AM335X_PRCM_CM_IDLEST_DPLL_ST_DPLL_CLK_LOCKED __BIT(0) #define AM335X_PRCM_CM_CLKSEL_DPLL_MPU 0x2c -#define AM335X_PRCM_CM_CLKSEL_DPLL_BYPASS __BITS(23) +#define AM335X_PRCM_CM_CLKSEL_DPLL_BYPASS __BIT(23) #define AM335X_PRCM_CM_CLKSEL_DPLL_MULT __BITS(18,8) #define AM335X_PRCM_CM_CLKSEL_DPLL_DIV __BITS(6,0) #define AM335X_PRCM_CM_CLKMODE_DPLL_MPU 0x88
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Sat Aug 17 00:40:10 UTC 2013 Modified Files: src/sys/arch/arm/omap: am335x_prcm.c Log Message: inject a PMFE_SPEED_CHANGED when changing the speed. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/arch/arm/omap/am335x_prcm.c:1.6 --- src/sys/arch/arm/omap/am335x_prcm.c:1.5 Thu Aug 1 00:24:43 2013 +++ src/sys/arch/arm/omap/am335x_prcm.c Sat Aug 17 00:40:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_prcm.c,v 1.5 2013/08/01 00:24:43 matt Exp $ */ +/* $NetBSD: am335x_prcm.c,v 1.6 2013/08/17 00:40:10 matt Exp $ */ /* * TI OMAP Power, Reset, and Clock Management on the AM335x @@ -34,11 +34,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.5 2013/08/01 00:24:43 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.6 2013/08/17 00:40:10 matt Exp $"); #include #include #include +#include #include #include @@ -178,6 +179,7 @@ mpu_current_frequency_sysctl_helper(SYSC aprint_normal_dev(curcpu()->ci_dev, "frequency changed from %d MHz to %d MHz\n", old_freq, freq); + pmf_event_inject(NULL, PMFE_SPEED_CHANGED); } return 0;
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jmcneill Date: Mon Aug 5 21:55:47 UTC 2013 Modified Files: src/sys/arch/arm/omap: omap3_sdhc.c Log Message: fix a bug in obiosdhc_bus_clock where SYSCTL_CEN bit wasnt being cleared or set properly, from Rui Paulo To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 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.12 src/sys/arch/arm/omap/omap3_sdhc.c:1.13 --- src/sys/arch/arm/omap/omap3_sdhc.c:1.12 Fri Jun 28 00:50:22 2013 +++ src/sys/arch/arm/omap/omap3_sdhc.c Mon Aug 5 21:55:47 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdhc.c,v 1.12 2013/06/28 00:50:22 matt Exp $ */ +/* $NetBSD: omap3_sdhc.c,v 1.13 2013/08/05 21:55:47 jmcneill 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.12 2013/06/28 00:50:22 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.13 2013/08/05 21:55:47 jmcneill Exp $"); #include "opt_omap.h" @@ -372,9 +372,9 @@ obiosdhc_bus_clock(struct sdhc_softc *sc ctl = bus_space_read_4(osc->sc_bst, osc->sc_bsh, MMCHS_SYSCTL); if (clk == 0) { - clk &= ~SYSCTL_CEN; + ctl &= ~SYSCTL_CEN; } else { - clk |= SYSCTL_CEN; + ctl |= SYSCTL_CEN; } bus_space_write_4(osc->sc_bst, osc->sc_bsh, MMCHS_SYSCTL, ctl);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Thu Aug 1 00:24:43 UTC 2013 Modified Files: src/sys/arch/arm/omap: am335x_prcm.c Log Message: Make frequency changing work on the beaglebone. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/arch/arm/omap/am335x_prcm.c:1.5 --- src/sys/arch/arm/omap/am335x_prcm.c:1.4 Sat Jun 29 20:43:33 2013 +++ src/sys/arch/arm/omap/am335x_prcm.c Thu Aug 1 00:24:43 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_prcm.c,v 1.4 2013/06/29 20:43:33 matt Exp $ */ +/* $NetBSD: am335x_prcm.c,v 1.5 2013/08/01 00:24:43 matt 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.4 2013/06/29 20:43:33 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.5 2013/08/01 00:24:43 matt Exp $"); #include #include @@ -146,7 +146,9 @@ mpu_current_frequency_sysctl_helper(SYSC int freq = mpu_frequency; int old_freq = freq; - KASSERT(curcpu()->ci_data.cpu_cc_freq == mpu_frequency * 1000); + KASSERTMSG(curcpu()->ci_data.cpu_cc_freq == mpu_frequency * 100, + "cc_freq %"PRIu64" mpu_freq %u00", + curcpu()->ci_data.cpu_cc_freq, mpu_frequency); node.sysctl_data = &freq; @@ -187,12 +189,13 @@ SYSCTL_SETUP(sysctl_am335x_machdep_setup static char mpu_available_frequencies[__arraycount(mpu_frequencies)*6]; - KASSERT(__arraycount(mpu_frequencies) == 8); + __CTASSERT(__arraycount(mpu_frequencies) == 8); snprintf(mpu_available_frequencies, sizeof(mpu_available_frequencies), "%u %u %u %u %u %u %u %u", mpu_frequencies[0], mpu_frequencies[1], mpu_frequencies[2], mpu_frequencies[3], mpu_frequencies[4], mpu_frequencies[5], mpu_frequencies[6], mpu_frequencies[7]); + mpu_frequency = curcpu()->ci_data.cpu_cc_freq / 100; sysctl_createv(clog, 0, NULL, &node, CTLFLAG_PERMANENT, @@ -215,7 +218,7 @@ SYSCTL_SETUP(sysctl_am335x_machdep_setup sysctl_createv(clog, 0, &freqnode, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, "current", NULL, - mpu_current_frequency_sysctl_helper, 0, NULL, 0 + mpu_current_frequency_sysctl_helper, 0, NULL, 0, CTL_CREATE, CTL_EOL); }
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jklos Date: Sat Jul 27 17:10:28 UTC 2013 Modified Files: src/sys/arch/arm/omap: omap3_sdmmcreg.h Log Message: Fix typo that kept SD card on BeagleBone from being configured. From Dennis Ferguson. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/arch/arm/omap/omap3_sdmmcreg.h:1.7 --- src/sys/arch/arm/omap/omap3_sdmmcreg.h:1.6 Fri Jun 28 00:50:23 2013 +++ src/sys/arch/arm/omap/omap3_sdmmcreg.h Sat Jul 27 17:10:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdmmcreg.h,v 1.6 2013/06/28 00:50:23 matt Exp $ */ +/* $NetBSD: omap3_sdmmcreg.h,v 1.7 2013/07/27 17:10:28 jklos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -45,7 +45,7 @@ #define SDMMC4_BASE_4430 0x480D1000 // same for omap5 #define SDMMC5_BASE_4430 0x480D5000 // same for omap5 -#define SDMMC1_BASE_TIAM335X 0x48006100 +#define SDMMC1_BASE_TIAM335X 0x48060100 #define SDMMC2_BASE_TIAM335X 0x481d8100 #define SDMMC3_BASE_TIAM335X 0x47810100
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: matt Date: Sat Jun 29 20:43:33 UTC 2013 Modified Files: src/sys/arch/arm/omap: am335x_prcm.c am335x_prcm.h Log Message: Move am335x_sys_clk() and am335x_cpu_clk() here. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/am335x_prcm.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/am335x_prcm.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/am335x_prcm.c diff -u src/sys/arch/arm/omap/am335x_prcm.c:1.3 src/sys/arch/arm/omap/am335x_prcm.c:1.4 --- src/sys/arch/arm/omap/am335x_prcm.c:1.3 Sat Jun 29 20:21:41 2013 +++ src/sys/arch/arm/omap/am335x_prcm.c Sat Jun 29 20:43:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_prcm.c,v 1.3 2013/06/29 20:21:41 matt Exp $ */ +/* $NetBSD: am335x_prcm.c,v 1.4 2013/06/29 20:43:33 matt Exp $ */ /* * TI OMAP Power, Reset, and Clock Management on the AM335x @@ -34,14 +34,16 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.3 2013/06/29 20:21:41 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.4 2013/06/29 20:43:33 matt Exp $"); #include #include #include #include +#include #include +#include #define AM335X_CLKCTRL_MODULEMODE_MASK __BITS(0, 1) #define AM335X_CLKCTRL_MODULEMODE_DISABLED 0 @@ -216,3 +218,31 @@ SYSCTL_SETUP(sysctl_am335x_machdep_setup mpu_current_frequency_sysctl_helper, 0, NULL, 0 CTL_CREATE, CTL_EOL); } + +void +am335x_sys_clk(bus_space_handle_t ctlmode_ioh) +{ + static const uint32_t sys_clks[4] = { + [0] = 1920, [1] = 2400, [2] = 2500, [3] = 2600 + }; + + const uint32_t control_status = bus_space_read_4(&omap_bs_tag, + ctlmode_ioh, CTLMOD_CONTROL_STATUS); + omap_sys_clk = sys_clks[__SHIFTOUT(control_status, CTLMOD_CONTROL_STATUS_SYSBOOT1)]; +} + +void +am335x_cpu_clk(void) +{ + const bus_size_t cm_wkup = AM335X_PRCM_CM_WKUP; + const uint32_t clksel = prcm_read_4(cm_wkup, AM335X_PRCM_CM_CLKSEL_DPLL_MPU); + const uint32_t div_m2 = prcm_read_4(cm_wkup, AM335X_PRCM_CM_DIV_M2_DPLL_MPU); + const uint32_t m = __SHIFTOUT(clksel, AM335X_PRCM_CM_CLKSEL_DPLL_MULT); + const uint32_t n = __SHIFTOUT(clksel, AM335X_PRCM_CM_CLKSEL_DPLL_DIV); + const uint32_t m2 = __SHIFTOUT(div_m2, AM335X_PRCM_CM_DIV_M2_DPLL_CLKOUT_DIV); + /* XXX This ignores CM_CLKSEL_DPLL_MPU[DPLL_REGM4XEN]. */ + curcpu()->ci_data.cpu_cc_freq = (m * ((uint64_t)omap_sys_clk / (n + 1))) / m2; + printf("%s: %"PRIu64": sys_clk=%u m=%u n=%u (%u) m2=%u\n", + __func__, curcpu()->ci_data.cpu_cc_freq, + omap_sys_clk, m, n, n+1, m2); +} Index: src/sys/arch/arm/omap/am335x_prcm.h diff -u src/sys/arch/arm/omap/am335x_prcm.h:1.4 src/sys/arch/arm/omap/am335x_prcm.h:1.5 --- src/sys/arch/arm/omap/am335x_prcm.h:1.4 Sat Jun 29 20:21:41 2013 +++ src/sys/arch/arm/omap/am335x_prcm.h Sat Jun 29 20:43:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: am335x_prcm.h,v 1.4 2013/06/29 20:21:41 matt Exp $ */ +/* $NetBSD: am335x_prcm.h,v 1.5 2013/06/29 20:43:33 matt Exp $ */ /* * TI OMAP Power, Reset, and Clock Management on the AM335x @@ -83,6 +83,10 @@ struct omap_module { #define RST_GLOBAL_WARM_SW __BIT(0) #define RST_GLOBAL_COLD_SW __BIT(1) +#ifdef _KERNEL void prcm_mpu_pll_config(u_int); +void am335x_sys_clk(bus_space_handle_t); +void am335x_cpu_clk(void); +#endif #endif /* _ARM_OMAP_AM335X_PRCM_H_ */