Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src Pull up following revision(s) (requested by skrll in tick...



details:   https://anonhg.NetBSD.org/src/rev/0e7f21cbc0bf
branches:  netbsd-7
changeset: 799815:0e7f21cbc0bf
user:      snj <snj%NetBSD.org@localhost>
date:      Fri Feb 26 22:52:52 2016 +0000

description:
Pull up following revision(s) (requested by skrll in ticket #1107):
        external/broadcom/rpi-firmware/dist/LICENCE.broadcom: revision 1.2
        external/broadcom/rpi-firmware/dist/bootcode.bin: revision 1.8
        external/broadcom/rpi-firmware/dist/fixup.dat: revision 1.8
        external/broadcom/rpi-firmware/dist/fixup_cd.dat: revision 1.8
        external/broadcom/rpi-firmware/dist/start.elf: revision 1.8
        external/broadcom/rpi-firmware/dist/start_cd.elf: revision 1.8
        sys/arch/arm/broadcom/bcm2835_emmc.c: revision 1.29
        sys/arch/arm/broadcom/bcm2835_gpio.c: revision 1.3
        sys/arch/arm/broadcom/bcm2835_gpio_subr.c: revision 1.4
        sys/arch/arm/broadcom/bcm2835_space.c: revision 1.9, 1.10
        sys/arch/arm/broadcom/bcm2835reg.h: patch
        sys/arch/arm/cortex/a9_mpsubr.S: revisions 1.45, 1.46
        sys/arch/evbarm/conf/CUBIEBOARD: revision 1.45
        sys/arch/evbarm/conf/std.awin: revision 1.9
        sys/arch/evbarm/rpi/rpi2_start.S: revision 1.3
        sys/arch/evbarm/rpi/rpi_machdep.c: revision 1.68
Check for hypervisor mode in cortex_init and exit if the cpu started
there.
Needed by latest RPI firmware.
--
Fix up bus_space_map for latest RPI firmware which now passes the FB
address in the mailbox properties as a bus address.
--
Update RPI firmware to version after the following commit
commit 224c75602b8bae1a9e942b4f1c7ed3aa8e0f0ec8
Author: popcornmix<popcornmix%gmail.com@localhost>
Date:   Tue Dec 8 14:48:57 2015 +0000
--
Deal with kernel builds where virtualisation isn't available
--
Tweak CPUFLAGS to cover all CPUs
--
Fix up bcm283[56] bus_space(4) to really use bus addresses for
peripherals, etc
Simplifies the code in various places and uses the abstraction in
more places. (bcm2835_gpio_subr.c still doesn't)

diffstat:

 external/broadcom/rpi-firmware/dist/LICENCE.broadcom |    1 +
 external/broadcom/rpi-firmware/dist/bootcode.bin     |  Bin 
 external/broadcom/rpi-firmware/dist/fixup.dat        |  Bin 
 external/broadcom/rpi-firmware/dist/fixup_cd.dat     |  Bin 
 external/broadcom/rpi-firmware/dist/start.elf        |  Bin 
 external/broadcom/rpi-firmware/dist/start_cd.elf     |  Bin 
 sys/arch/arm/broadcom/bcm2835_emmc.c                 |   15 ++---
 sys/arch/arm/broadcom/bcm2835_gpio.c                 |   21 ++++--
 sys/arch/arm/broadcom/bcm2835_gpio_subr.c            |   10 ++-
 sys/arch/arm/broadcom/bcm2835_space.c                |   30 +++++++---
 sys/arch/arm/broadcom/bcm2835reg.h                   |   56 ++++++++++--------
 sys/arch/arm/cortex/a9_mpsubr.S                      |   28 ++++++++-
 sys/arch/evbarm/conf/CUBIEBOARD                      |    4 +-
 sys/arch/evbarm/conf/std.awin                        |    4 +-
 sys/arch/evbarm/rpi/rpi2_start.S                     |    9 +--
 sys/arch/evbarm/rpi/rpi_machdep.c                    |   17 +----
 16 files changed, 115 insertions(+), 80 deletions(-)

diffs (truncated from 505 to 300 lines):

diff -r f7dafe140896 -r 0e7f21cbc0bf external/broadcom/rpi-firmware/dist/LICENCE.broadcom
--- a/external/broadcom/rpi-firmware/dist/LICENCE.broadcom      Fri Feb 26 22:33:51 2016 +0000
+++ b/external/broadcom/rpi-firmware/dist/LICENCE.broadcom      Fri Feb 26 22:52:52 2016 +0000
@@ -1,4 +1,5 @@
 Copyright (c) 2006, Broadcom Corporation.
+Copyright (c) 2015, Raspberry Pi (Trading) Ltd
 All rights reserved.
 
 Redistribution.  Redistribution and use in binary form, without
diff -r f7dafe140896 -r 0e7f21cbc0bf external/broadcom/rpi-firmware/dist/bootcode.bin
Binary file external/broadcom/rpi-firmware/dist/bootcode.bin has changed
diff -r f7dafe140896 -r 0e7f21cbc0bf external/broadcom/rpi-firmware/dist/fixup.dat
Binary file external/broadcom/rpi-firmware/dist/fixup.dat has changed
diff -r f7dafe140896 -r 0e7f21cbc0bf external/broadcom/rpi-firmware/dist/fixup_cd.dat
Binary file external/broadcom/rpi-firmware/dist/fixup_cd.dat has changed
diff -r f7dafe140896 -r 0e7f21cbc0bf external/broadcom/rpi-firmware/dist/start.elf
Binary file external/broadcom/rpi-firmware/dist/start.elf has changed
diff -r f7dafe140896 -r 0e7f21cbc0bf external/broadcom/rpi-firmware/dist/start_cd.elf
Binary file external/broadcom/rpi-firmware/dist/start_cd.elf has changed
diff -r f7dafe140896 -r 0e7f21cbc0bf sys/arch/arm/broadcom/bcm2835_emmc.c
--- a/sys/arch/arm/broadcom/bcm2835_emmc.c      Fri Feb 26 22:33:51 2016 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_emmc.c      Fri Feb 26 22:52:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_emmc.c,v 1.9.4.4 2014/12/15 11:53:58 martin Exp $      */
+/*     $NetBSD: bcm2835_emmc.c,v 1.9.4.5 2016/02/26 22:52:53 snj Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.9.4.4 2014/12/15 11:53:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.9.4.5 2016/02/26 22:52:53 snj Exp $");
 
 #include "bcmdmac.h"
 
@@ -60,6 +60,7 @@
 
        bus_space_tag_t         sc_iot;
        bus_space_handle_t      sc_ioh;
+       bus_addr_t              sc_iob;
        bus_size_t              sc_ios;
        struct sdhc_host        *sc_hosts[1];
        void                    *sc_ih;
@@ -74,8 +75,6 @@
        bus_dmamap_t            sc_dmamap;
        bus_dma_segment_t       sc_segs[1];     /* XXX assumes enough descriptors fit in one page */
        struct bcm_dmac_conblk  *sc_cblk;
-
-       uint32_t                sc_physaddr;
 };
 
 static int bcmemmc_match(device_t, struct cfdata *, void *);
@@ -137,8 +136,8 @@
                    "can't map registers for %s: %d\n", aaa->aaa_name, error);
                return;
        }
+       sc->sc_iob = aaa->aaa_addr;
        sc->sc_ios = aaa->aaa_size;
-       sc->sc_physaddr = aaa->aaa_addr;
 
        aprint_naive(": SDHC controller\n");
        aprint_normal(": SDHC controller\n");
@@ -265,8 +264,7 @@
                                sc->sc_cblk[seg].cb_ti |= DMAC_TI_DEST_WIDTH;
                        sc->sc_cblk[seg].cb_ti |= DMAC_TI_SRC_DREQ;
                        sc->sc_cblk[seg].cb_source_ad =
-                           BCM2835_PERIPHERALS_TO_BUS(sc->sc_physaddr +
-                           SDHC_DATA);
+                           sc->sc_iob + SDHC_DATA;
                        sc->sc_cblk[seg].cb_dest_ad =
                            cmd->c_dmamap->dm_segs[seg].ds_addr;
                } else {
@@ -282,8 +280,7 @@
                        sc->sc_cblk[seg].cb_source_ad =
                            cmd->c_dmamap->dm_segs[seg].ds_addr;
                        sc->sc_cblk[seg].cb_dest_ad =
-                           BCM2835_PERIPHERALS_TO_BUS(sc->sc_physaddr +
-                           SDHC_DATA);
+                           sc->sc_iob + SDHC_DATA;
                }
                sc->sc_cblk[seg].cb_stride = 0;
                if (seg == cmd->c_dmamap->dm_nsegs - 1) {
diff -r f7dafe140896 -r 0e7f21cbc0bf sys/arch/arm/broadcom/bcm2835_gpio.c
--- a/sys/arch/arm/broadcom/bcm2835_gpio.c      Fri Feb 26 22:33:51 2016 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_gpio.c      Fri Feb 26 22:52:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_gpio.c,v 1.2 2014/05/19 08:33:41 skrll Exp $   */
+/*     $NetBSD: bcm2835_gpio.c,v 1.2.6.1 2016/02/26 22:52:53 snj Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.2 2014/05/19 08:33:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.2.6.1 2016/02/26 22:52:53 snj Exp $");
 
 /*
  * Driver for BCM2835 GPIO
@@ -101,9 +101,11 @@
 {
        struct bcmgpio_softc * const sc = device_private(self);
 #if NGPIO > 0
+       struct amba_attach_args *aaa = aux;
+       struct gpiobus_attach_args gba;
        int pin, minpin, maxpin;
        u_int func;
-       struct gpiobus_attach_args gba;
+       int error;
 #endif
        
        sc->sc_dev = self;
@@ -124,10 +126,15 @@
        aprint_naive("\n");     
        aprint_normal(": GPIO [%d...%d]\n", minpin, maxpin);
 
-       /* already mapped - nothing to gain from struct amba_attach_args */
-       sc->sc_iot = &bcm2835_bs_tag;
-       sc->sc_ioh = BCM2835_IOPHYSTOVIRT(BCM2835_GPIO_BASE);
-       
+       sc->sc_iot = aaa->aaa_iot;
+       error = bus_space_map(sc->sc_iot, aaa->aaa_addr, aaa->aaa_size, 0,
+           &sc->sc_ioh);
+       if (error) {
+               aprint_error_dev(self,
+                   "can't map registers for %s: %d\n", aaa->aaa_name, error);
+               return;
+       }
+
        for (pin = minpin; pin <= maxpin; pin++) {
                int epin = pin - minpin;
        
diff -r f7dafe140896 -r 0e7f21cbc0bf sys/arch/arm/broadcom/bcm2835_gpio_subr.c
--- a/sys/arch/arm/broadcom/bcm2835_gpio_subr.c Fri Feb 26 22:33:51 2016 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_gpio_subr.c Fri Feb 26 22:52:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_gpio_subr.c,v 1.3 2014/04/22 18:51:35 kardel Exp $     */
+/*     $NetBSD: bcm2835_gpio_subr.c,v 1.3.2.1 2016/02/26 22:52:53 snj Exp $    */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio_subr.c,v 1.3 2014/04/22 18:51:35 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio_subr.c,v 1.3.2.1 2016/02/26 22:52:53 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -43,8 +43,9 @@
 void
 bcm2835gpio_function_select(u_int pin, u_int func)
 {
+       const paddr_t iop = BCM2835_PERIPHERALS_BUS_TO_PHYS(BCM2835_GPIO_BASE);
        const bus_space_tag_t iot = &bcm2835_bs_tag;
-       const bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(BCM2835_GPIO_BASE);
+       const bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(iop);
        const u_int mask = (1 << BCM2835_GPIO_GPFSEL_BITS_PER_PIN) - 1;
        const u_int regid = (pin / BCM2835_GPIO_GPFSEL_PINS_PER_REGISTER);
        const u_int shift = (pin % BCM2835_GPIO_GPFSEL_PINS_PER_REGISTER) *
@@ -70,8 +71,9 @@
 u_int
 bcm2835gpio_function_read(u_int pin)
 {
+       const paddr_t iop = BCM2835_PERIPHERALS_BUS_TO_PHYS(BCM2835_GPIO_BASE);
        const bus_space_tag_t iot = &bcm2835_bs_tag;
-       const bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(BCM2835_GPIO_BASE);
+       const bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(iop);
        const u_int mask = (1 << BCM2835_GPIO_GPFSEL_BITS_PER_PIN) - 1;
        const u_int regid = (pin / BCM2835_GPIO_GPFSEL_PINS_PER_REGISTER);
        const u_int shift = (pin % BCM2835_GPIO_GPFSEL_PINS_PER_REGISTER) *
diff -r f7dafe140896 -r 0e7f21cbc0bf sys/arch/arm/broadcom/bcm2835_space.c
--- a/sys/arch/arm/broadcom/bcm2835_space.c     Fri Feb 26 22:33:51 2016 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_space.c     Fri Feb 26 22:52:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_space.c,v 1.6.10.2 2015/05/27 05:33:29 msaitoh Exp $   */
+/*     $NetBSD: bcm2835_space.c,v 1.6.10.3 2016/02/26 22:52:53 snj Exp $       */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.6.10.2 2015/05/27 05:33:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.6.10.3 2016/02/26 22:52:53 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -290,20 +290,32 @@
        vaddr_t va;
        const struct pmap_devmap *pd;
        int pmap_flags;
-
+       bool match = false;
 
-#if defined(BCM2836)
-       pa = ba;
-#else
-       pa = ba & ~BCM2835_BUSADDR_CACHE_MASK;
+       /* Attempt to find the PA device mapping */
+       if (ba >= BCM2835_PERIPHERALS_BASE_BUS &&
+           ba < BCM2835_PERIPHERALS_BASE_BUS + BCM2835_PERIPHERALS_SIZE) {
+               match = true;
+               pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(ba);
+               
+       }
+#ifdef BCM2836
+       if (ba >= BCM2836_ARM_LOCAL_BASE &&
+           ba < BCM2836_ARM_LOCAL_BASE + BCM2836_ARM_LOCAL_SIZE) {
+               match = true;
+               pa = ba;
+       }
 #endif
-       /* this does device addresses */
-       if ((pd = pmap_devmap_find_pa(pa, size)) != NULL) {
+
+       if (match && (pd = pmap_devmap_find_pa(pa, size)) != NULL) {
                /* Device was statically mapped. */
                *bshp = pd->pd_va + (pa - pd->pd_pa);
                return 0;
        }
 
+       /* Now assume bus address so convert to PA */
+       pa = ba & ~BCM2835_BUSADDR_CACHE_MASK;
+
        startpa = trunc_page(pa);
        endpa = round_page(pa + size);
 
diff -r f7dafe140896 -r 0e7f21cbc0bf sys/arch/arm/broadcom/bcm2835reg.h
--- a/sys/arch/arm/broadcom/bcm2835reg.h        Fri Feb 26 22:33:51 2016 +0000
+++ b/sys/arch/arm/broadcom/bcm2835reg.h        Fri Feb 26 22:52:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835reg.h,v 1.10.12.4 2015/07/30 09:37:37 martin Exp $      */
+/*     $NetBSD: bcm2835reg.h,v 1.10.12.5 2016/02/26 22:52:53 snj Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /*
  * Reference: BCM2835 ARM Periperhals
  *
- *     http://dmkenr5gtnd8f.cloudfront.net/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
+ *     http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
  */
 
 #ifndef        _BCM2835REG_H_
@@ -46,38 +46,45 @@
 #define        BCM2835_PERIPHERALS_BASE        0x20000000
 #endif
 #define        BCM2835_PERIPHERALS_SIZE        0x01000000      /* 16MBytes */
+
 #define        BCM2835_PERIPHERALS_BASE_BUS    0x7e000000
-#define        BCM2835_PERIPHERALS_TO_BUS(a) \
+#define        BCM2835_PERIPHERALS_PHYS_TO_BUS(a) \
     ((a) - BCM2835_PERIPHERALS_BASE + BCM2835_PERIPHERALS_BASE_BUS)
+#define        BCM2835_PERIPHERALS_BUS_TO_PHYS(a) \
+    ((a) - BCM2835_PERIPHERALS_BASE_BUS + BCM2835_PERIPHERALS_BASE)
 
-#define        BCM2835_STIMER_BASE     (BCM2835_PERIPHERALS_BASE + 0x00003000)
-#define        BCM2835_DMA0_BASE       (BCM2835_PERIPHERALS_BASE + 0x00007000)
-#define        BCM2835_ARM_BASE        (BCM2835_PERIPHERALS_BASE + 0x0000B000)
-#define        BCM2835_PM_BASE         (BCM2835_PERIPHERALS_BASE + 0x00100000)
-#define        BCM2835_RNG_BASE        (BCM2835_PERIPHERALS_BASE + 0x00104000)
-#define        BCM2835_GPIO_BASE       (BCM2835_PERIPHERALS_BASE + 0x00200000)
-#define        BCM2835_UART0_BASE      (BCM2835_PERIPHERALS_BASE + 0x00201000)
-#define        BCM2835_PCM_BASE        (BCM2835_PERIPHERALS_BASE + 0x00203000)
-#define        BCM2835_SPI0_BASE       (BCM2835_PERIPHERALS_BASE + 0x00204000)
-#define        BCM2835_BSC0_BASE       (BCM2835_PERIPHERALS_BASE + 0x00205000)
-#define        BCM2835_BSCSPISLV_BASE  (BCM2835_PERIPHERALS_BASE + 0x00214000)
-#define        BCM2835_AUX_BASE        (BCM2835_PERIPHERALS_BASE + 0x00215000)
-#define        BCM2835_EMMC_BASE       (BCM2835_PERIPHERALS_BASE + 0x00300000)
-#define        BCM2835_BSC1_BASE       (BCM2835_PERIPHERALS_BASE + 0x00804000)
-#define        BCM2835_BSC2_BASE       (BCM2835_PERIPHERALS_BASE + 0x00805000)
-#define        BCM2835_USB_BASE        (BCM2835_PERIPHERALS_BASE + 0x00980000)
-#define        BCM2835_DMA15_BASE      (BCM2835_PERIPHERALS_BASE + 0x00E05000)
+#define        BCM2835_STIMER_BASE     (BCM2835_PERIPHERALS_BASE_BUS + 0x00003000)
+#define        BCM2835_DMA0_BASE       (BCM2835_PERIPHERALS_BASE_BUS + 0x00007000)
+#define        BCM2835_ARM_BASE        (BCM2835_PERIPHERALS_BASE_BUS + 0x0000B000)
+#define        BCM2835_PM_BASE         (BCM2835_PERIPHERALS_BASE_BUS + 0x00100000)
+#define        BCM2835_CM_BASE         (BCM2835_PERIPHERALS_BASE_BUS + 0x00101000)
+#define        BCM2835_RNG_BASE        (BCM2835_PERIPHERALS_BASE_BUS + 0x00104000)
+#define        BCM2835_GPIO_BASE       (BCM2835_PERIPHERALS_BASE_BUS + 0x00200000)
+#define        BCM2835_UART0_BASE      (BCM2835_PERIPHERALS_BASE_BUS + 0x00201000)
+#define        BCM2835_PCM_BASE        (BCM2835_PERIPHERALS_BASE_BUS + 0x00203000)
+#define        BCM2835_SPI0_BASE       (BCM2835_PERIPHERALS_BASE_BUS + 0x00204000)
+#define        BCM2835_BSC0_BASE       (BCM2835_PERIPHERALS_BASE_BUS + 0x00205000)
+#define        BCM2835_PWM_BASE        (BCM2835_PERIPHERALS_BASE_BUS + 0x0020C000)
+#define        BCM2835_BSCSPISLV_BASE  (BCM2835_PERIPHERALS_BASE_BUS + 0x00214000)
+#define        BCM2835_AUX_BASE        (BCM2835_PERIPHERALS_BASE_BUS + 0x00215000)
+#define        BCM2835_EMMC_BASE       (BCM2835_PERIPHERALS_BASE_BUS + 0x00300000)
+#define        BCM2835_BSC1_BASE       (BCM2835_PERIPHERALS_BASE_BUS + 0x00804000)
+#define        BCM2835_BSC2_BASE       (BCM2835_PERIPHERALS_BASE_BUS + 0x00805000)
+#define        BCM2835_USB_BASE        (BCM2835_PERIPHERALS_BASE_BUS + 0x00980000)
+#define        BCM2835_DMA15_BASE      (BCM2835_PERIPHERALS_BASE_BUS + 0x00E05000)
 



Home | Main Index | Thread Index | Old Index