From b4ae2f3c5583dfa756be50a71650a892bf0250b2 Mon Sep 17 00:00:00 2001 From: Luiz Otavio O Souza Date: Mon, 16 Feb 2015 19:06:31 +0000 Subject: [PATCH] Add a mask to match only the relative base address of BSC controllers. This should fix the attach of BSC on RPI2 (based on andrew@ dmesg). --- sys/arm/broadcom/bcm2835/bcm2835_bsc.c | 2 +- sys/arm/broadcom/bcm2835/bcm2835_bscvar.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c index 3e1afcd0238f..debbf82cb2f1 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c @@ -247,7 +247,7 @@ bcm_bsc_attach(device_t dev) /* Check the unit we are attaching by its base address. */ start = rman_get_start(sc->sc_mem_res); for (i = 0; i < nitems(bcm_bsc_pins); i++) { - if (bcm_bsc_pins[i].start == start) + if (bcm_bsc_pins[i].start == (start & BCM_BSC_BASE_MASK)) break; } if (i == nitems(bcm_bsc_pins)) { diff --git a/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h b/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h index 5068356489f3..6b31dc3cc7a0 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h +++ b/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h @@ -35,9 +35,10 @@ struct { uint32_t scl; unsigned long start; } bcm_bsc_pins[] = { - { 0, 1, 0x20205000 }, /* BSC0 GPIO pins and base address. */ - { 2, 3, 0x20804000 } /* BSC1 GPIO pins and base address. */ + { 0, 1, 0x205000 }, /* BSC0 GPIO pins and base address. */ + { 2, 3, 0x804000 } /* BSC1 GPIO pins and base address. */ }; +#define BCM_BSC_BASE_MASK 0x00ffffff struct bcm_bsc_softc { device_t sc_dev;