CVS commit: src/sys/arch/arm/altera
Module Name:src Committed By: skrll Date: Fri Oct 18 06:50:08 UTC 2019 Modified Files: src/sys/arch/arm/altera: cycv_clkmgr.c cycv_dwcmmc.c cycv_rstmgr.c Log Message: Use PRIxBUSADDR To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/altera/cycv_clkmgr.c \ src/sys/arch/arm/altera/cycv_dwcmmc.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/altera/cycv_rstmgr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/altera
Module Name:src Committed By: skrll Date: Fri Oct 18 06:50:08 UTC 2019 Modified Files: src/sys/arch/arm/altera: cycv_clkmgr.c cycv_dwcmmc.c cycv_rstmgr.c Log Message: Use PRIxBUSADDR To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/altera/cycv_clkmgr.c \ src/sys/arch/arm/altera/cycv_dwcmmc.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/altera/cycv_rstmgr.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/altera/cycv_clkmgr.c diff -u src/sys/arch/arm/altera/cycv_clkmgr.c:1.3 src/sys/arch/arm/altera/cycv_clkmgr.c:1.4 --- src/sys/arch/arm/altera/cycv_clkmgr.c:1.3 Tue Oct 1 18:00:07 2019 +++ src/sys/arch/arm/altera/cycv_clkmgr.c Fri Oct 18 06:50:08 2019 @@ -1,9 +1,9 @@ -/* $NetBSD: cycv_clkmgr.c,v 1.3 2019/10/01 18:00:07 chs Exp $ */ +/* $NetBSD: cycv_clkmgr.c,v 1.4 2019/10/18 06:50:08 skrll Exp $ */ /* This file is in the public domain. */ #include -__KERNEL_RCSID(0, "$NetBSD: cycv_clkmgr.c,v 1.3 2019/10/01 18:00:07 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cycv_clkmgr.c,v 1.4 2019/10/18 06:50:08 skrll Exp $"); #include #include @@ -138,8 +138,8 @@ cycv_clkmgr_attach(device_t parent, devi sc->sc_bst = faa->faa_bst; error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); if (error) { - aprint_error(": couldn't map %#llx: %d", - (uint64_t) addr, error); + aprint_error(": couldn't map %#" PRIxBUSADDR ": %d", + addr, error); return; } Index: src/sys/arch/arm/altera/cycv_dwcmmc.c diff -u src/sys/arch/arm/altera/cycv_dwcmmc.c:1.3 src/sys/arch/arm/altera/cycv_dwcmmc.c:1.4 --- src/sys/arch/arm/altera/cycv_dwcmmc.c:1.3 Fri May 24 10:37:39 2019 +++ src/sys/arch/arm/altera/cycv_dwcmmc.c Fri Oct 18 06:50:08 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cycv_dwcmmc.c,v 1.3 2019/05/24 10:37:39 jmcneill Exp $ */ +/* $NetBSD: cycv_dwcmmc.c,v 1.4 2019/10/18 06:50:08 skrll Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.3 2019/05/24 10:37:39 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.4 2019/10/18 06:50:08 skrll Exp $"); #include #include @@ -125,8 +125,8 @@ cycv_dwcmmc_attach(device_t parent, devi sc->sc_dmat = faa->faa_dmat; error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); if (error) { - aprint_error(": couldn't map %#llx: %d\n", - (uint64_t)addr, error); + aprint_error(": couldn't map %#" PRIxBUSADDR ": %d\n", + addr, error); return; } Index: src/sys/arch/arm/altera/cycv_rstmgr.c diff -u src/sys/arch/arm/altera/cycv_rstmgr.c:1.2 src/sys/arch/arm/altera/cycv_rstmgr.c:1.3 --- src/sys/arch/arm/altera/cycv_rstmgr.c:1.2 Sun Oct 14 18:53:01 2018 +++ src/sys/arch/arm/altera/cycv_rstmgr.c Fri Oct 18 06:50:08 2019 @@ -1,9 +1,9 @@ -/* $NetBSD: cycv_rstmgr.c,v 1.2 2018/10/14 18:53:01 aymeric Exp $ */ +/* $NetBSD: cycv_rstmgr.c,v 1.3 2019/10/18 06:50:08 skrll Exp $ */ /* This file is in the public domain. */ #include -__KERNEL_RCSID(0, "$NetBSD: cycv_rstmgr.c,v 1.2 2018/10/14 18:53:01 aymeric Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cycv_rstmgr.c,v 1.3 2019/10/18 06:50:08 skrll Exp $"); #include #include @@ -77,8 +77,8 @@ cycv_rstmgr_attach(device_t parent, devi sc->sc_bst = faa->faa_bst; error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); if (error) { - aprint_error(": couldn't map %#llx: %d", - (uint64_t) addr, error); + aprint_error(": couldn't map %#" PRIxBUSADDR ": %d", + addr, error); return; }
CVS commit: src/sys/arch/arm/altera
Module Name:src Committed By: jmcneill Date: Fri May 24 10:37:39 UTC 2019 Modified Files: src/sys/arch/arm/altera: cycv_dwcmmc.c Log Message: Use standard DT bindings for card detect To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/altera/cycv_dwcmmc.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/altera/cycv_dwcmmc.c diff -u src/sys/arch/arm/altera/cycv_dwcmmc.c:1.2 src/sys/arch/arm/altera/cycv_dwcmmc.c:1.3 --- src/sys/arch/arm/altera/cycv_dwcmmc.c:1.2 Mon May 20 20:14:08 2019 +++ src/sys/arch/arm/altera/cycv_dwcmmc.c Fri May 24 10:37:39 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cycv_dwcmmc.c,v 1.2 2019/05/20 20:14:08 aymeric Exp $ */ +/* $NetBSD: cycv_dwcmmc.c,v 1.3 2019/05/24 10:37:39 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.2 2019/05/20 20:14:08 aymeric Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.3 2019/05/24 10:37:39 jmcneill Exp $"); #include #include @@ -47,8 +47,15 @@ __KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc. static int cycv_dwcmmc_match(device_t, cfdata_t, void *); static void cycv_dwcmmc_attach(device_t, device_t, void *); +static int cycv_dwcmmc_card_detect(struct dwc_mmc_softc *); + struct cycv_dwcmmc_softc { struct dwc_mmc_softc sc; + int sc_phandle; + bool sc_non_removable; + bool sc_broken_cd; + struct fdtbus_gpio_pin *sc_gpio_cd; + bool sc_gpio_cd_inverted; struct clk *sc_clk_biu; struct clk *sc_clk_ciu; }; @@ -128,9 +135,16 @@ cycv_dwcmmc_attach(device_t parent, devi sc->sc_fifo_reg = FIFO_REG; sc->sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA; - sc->sc_card_detect = NULL; + sc->sc_card_detect = cycv_dwcmmc_card_detect; sc->sc_write_protect = NULL; + esc->sc_phandle = phandle; + esc->sc_gpio_cd = fdtbus_gpio_acquire(phandle, "cd-gpios", GPIO_PIN_INPUT); + esc->sc_gpio_cd_inverted = of_hasprop(phandle, "cd-inverted") ? 0 : 1; + + esc->sc_non_removable = of_hasprop(phandle, "non-removable"); + esc->sc_broken_cd = of_hasprop(phandle, "broken-cd"); + aprint_naive("\n"); aprint_normal(": MHS (%u Hz)\n", sc->sc_clock_freq); @@ -151,3 +165,21 @@ cycv_dwcmmc_attach(device_t parent, devi } aprint_normal_dev(self, "interrupting on %s\n", intrstr); } + +static int +cycv_dwcmmc_card_detect(struct dwc_mmc_softc *sc) +{ + struct cycv_dwcmmc_softc *esc = device_private(sc->sc_dev); + int val; + + if (esc->sc_non_removable || esc->sc_broken_cd) { + return 1; + } else if (esc->sc_gpio_cd != NULL) { + val = fdtbus_gpio_read(esc->sc_gpio_cd); + if (esc->sc_gpio_cd_inverted) + val = !val; + return val; + } else { + return 1; + } +}
CVS commit: src/sys/arch/arm/altera
Module Name:src Committed By: aymeric Date: Mon May 20 20:17:25 UTC 2019 Modified Files: src/sys/arch/arm/altera: cycv_platform.c Log Message: make CPU 1 bootstrapping work even if the kernel is not loaded close to PA 0. More precisely, we used "B cpu_mpstart", which worked for small addresses and thus does not work in the EFI case. It is now replaced by a "LDR PC, =cpu_mpstart", which works for arbitrary addresses. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/altera/cycv_platform.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/altera
Module Name:src Committed By: aymeric Date: Mon May 20 20:17:25 UTC 2019 Modified Files: src/sys/arch/arm/altera: cycv_platform.c Log Message: make CPU 1 bootstrapping work even if the kernel is not loaded close to PA 0. More precisely, we used "B cpu_mpstart", which worked for small addresses and thus does not work in the EFI case. It is now replaced by a "LDR PC, =cpu_mpstart", which works for arbitrary addresses. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/altera/cycv_platform.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/altera/cycv_platform.c diff -u src/sys/arch/arm/altera/cycv_platform.c:1.10 src/sys/arch/arm/altera/cycv_platform.c:1.11 --- src/sys/arch/arm/altera/cycv_platform.c:1.10 Thu Jan 31 13:06:10 2019 +++ src/sys/arch/arm/altera/cycv_platform.c Mon May 20 20:17:25 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cycv_platform.c,v 1.10 2019/01/31 13:06:10 skrll Exp $ */ +/* $NetBSD: cycv_platform.c,v 1.11 2019/05/20 20:17:25 aymeric Exp $ */ /* This file is in the public domain. */ @@ -7,7 +7,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.10 2019/01/31 13:06:10 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.11 2019/05/20 20:17:25 aymeric Exp $"); #define _ARM32_BUS_DMA_PRIVATE #include @@ -92,18 +92,21 @@ cycv_mpstart(void) bus_space_write_4(bst, bsh_scu, SCU_CTL, bus_space_read_4(bst, bsh_scu, SCU_CTL) | SCU_CTL_SCU_ENA); - const uint32_t startfunc = (uint32_t) KERN_VTOPHYS((vaddr_t)cpu_mpstart); + const uint32_t startfunc = + (uint32_t) KERN_VTOPHYS((vaddr_t) cpu_mpstart); /* - * We place a "B cortex_mpstart" at address 0 in order to bootstrap + * We place a "LDR PC, =cpu_mpstart" at address 0 in order to bootstrap * CPU 1. We can't use the similar feature of the Boot ROM because - * it was unmapped by u-boot in favor of the SDRAM. Plus the dtb is - * stored very low in RAM so we can't re-map the Boot ROM easily. + * it was unmapped by u-boot in favor of the SDRAM. */ pmap_map_chunk(kernel_l1pt.pv_va, CYCV_SDRAM_VBASE, CYCV_SDRAM_BASE, L1_S_SIZE, VM_PROT_READ|VM_PROT_WRITE, PMAP_NOCACHE); - *(volatile uint32_t *) CYCV_SDRAM_VBASE = - htole32(0xea00 | ((startfunc - 8 - 0x0) >> 2)); + + /* 0: LDR PC, [PC, #0x18] -> loads address at 0x20 into PC */ + *(volatile uint32_t *) CYCV_SDRAM_VBASE = htole32(0xe59ff018); + *(volatile uint32_t *) (CYCV_SDRAM_VBASE + 0x20) = startfunc; + pmap_unmap_chunk(kernel_l1pt.pv_va, CYCV_SDRAM_VBASE, L1_S_SIZE); bus_space_write_4(bst, bsh_rst, CYCV_RSTMGR_MPUMODRST,
CVS commit: src/sys/arch/arm/altera
Module Name:src Committed By: aymeric Date: Mon May 20 20:14:08 UTC 2019 Modified Files: src/sys/arch/arm/altera: cycv_dwcmmc.c Log Message: use NULL instead of cycv_dwcmmc_card_detect() for sc_card_detect. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/altera/cycv_dwcmmc.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/altera/cycv_dwcmmc.c diff -u src/sys/arch/arm/altera/cycv_dwcmmc.c:1.1 src/sys/arch/arm/altera/cycv_dwcmmc.c:1.2 --- src/sys/arch/arm/altera/cycv_dwcmmc.c:1.1 Wed Sep 19 17:31:38 2018 +++ src/sys/arch/arm/altera/cycv_dwcmmc.c Mon May 20 20:14:08 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cycv_dwcmmc.c,v 1.1 2018/09/19 17:31:38 aymeric Exp $ */ +/* $NetBSD: cycv_dwcmmc.c,v 1.2 2019/05/20 20:14:08 aymeric Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.1 2018/09/19 17:31:38 aymeric Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.2 2019/05/20 20:14:08 aymeric Exp $"); #include #include @@ -47,8 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc. static int cycv_dwcmmc_match(device_t, cfdata_t, void *); static void cycv_dwcmmc_attach(device_t, device_t, void *); -static int cycv_dwcmmc_card_detect(struct dwc_mmc_softc *); - struct cycv_dwcmmc_softc { struct dwc_mmc_softc sc; struct clk *sc_clk_biu; @@ -130,7 +128,7 @@ cycv_dwcmmc_attach(device_t parent, devi sc->sc_fifo_reg = FIFO_REG; sc->sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA; - sc->sc_card_detect = cycv_dwcmmc_card_detect; + sc->sc_card_detect = NULL; sc->sc_write_protect = NULL; aprint_naive("\n"); @@ -153,11 +151,3 @@ cycv_dwcmmc_attach(device_t parent, devi } aprint_normal_dev(self, "interrupting on %s\n", intrstr); } - -static int -cycv_dwcmmc_card_detect(struct dwc_mmc_softc *sc) -{ - /* Card detection is broken on the nanosoc. Pretend it's present. */ - - return 0; -}
CVS commit: src/sys/arch/arm/altera
Module Name:src Committed By: aymeric Date: Mon May 20 20:14:08 UTC 2019 Modified Files: src/sys/arch/arm/altera: cycv_dwcmmc.c Log Message: use NULL instead of cycv_dwcmmc_card_detect() for sc_card_detect. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/altera/cycv_dwcmmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/arm/altera
Nick Hudson writes: > Does it work now? Yes, it does. Regards, Aymeric