Disable BSC0 on Raspberry Pi 3 and Zero W boards.

This commit is contained in:
jmcneill 2017-06-17 17:03:40 +00:00
parent 72acc73554
commit db54ab3515
3 changed files with 51 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bcm2835_bsc.c,v 1.5 2015/01/24 00:27:31 jakllsch Exp $ */
/* $NetBSD: bcm2835_bsc.c,v 1.6 2017/06/17 17:03:40 jmcneill Exp $ */
/*
* Copyright (c) 2012 Jonathan A. Kollasch
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.5 2015/01/24 00:27:31 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.6 2017/06/17 17:03:40 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -99,8 +99,10 @@ bsciic_attach(device_t parent, device_t self, void *aux)
{
struct bsciic_softc * const sc = device_private(self);
struct amba_attach_args * const aaa = aux;
prop_dictionary_t prop = device_properties(self);
struct i2cbus_attach_args iba;
u_int bscunit = ~0;
bool disable = false;
static ONCE_DECL(control);
switch (aaa->aaa_addr) {
@ -112,6 +114,13 @@ bsciic_attach(device_t parent, device_t self, void *aux)
break;
}
prop_dictionary_get_bool(prop, "disable", &disable);
if (disable) {
aprint_naive(": disabled\n");
aprint_normal(": disabled\n");
return;
}
aprint_naive("\n");
aprint_normal(": BSC%u\n", bscunit);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpi_machdep.c,v 1.70 2017/01/06 14:55:37 skrll Exp $ */
/* $NetBSD: rpi_machdep.c,v 1.71 2017/06/17 17:03:40 jmcneill Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.70 2017/01/06 14:55:37 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.71 2017/06/17 17:03:40 jmcneill Exp $");
#include "opt_arm_debug.h"
#include "opt_bcm283x.h"
@ -1201,6 +1201,21 @@ rpi_device_register(device_t dev, void *aux)
}
}
#endif
/* BSC0 is used internally on some boards */
if (device_is_a(dev, "bsciic") &&
((struct amba_attach_args *)aux)->aaa_addr == BCM2835_BSC0_BASE) {
const uint32_t rev = vb.vbt_boardrev.rev;
if ((rev & VCPROP_REV_ENCFLAG) != 0) {
switch (__SHIFTOUT(rev, VCPROP_REV_MODEL)) {
case RPI_MODEL_B_PI3:
case RPI_MODEL_ZERO_W:
prop_dictionary_set_bool(dict, "disable", true);
break;
}
}
}
}
SYSCTL_SETUP(sysctl_machdep_rpi, "sysctl machdep subtree setup (rpi)")

View File

@ -1,4 +1,4 @@
/* $NetBSD: vcprop.h,v 1.15 2016/04/03 11:02:17 mlelstv Exp $ */
/* $NetBSD: vcprop.h,v 1.16 2017/06/17 17:03:40 jmcneill Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@ -137,6 +137,28 @@ struct vcprop_tag_boardrev {
uint32_t rev;
} ;
#define VCPROP_REV_PCBREV __BITS(3,0)
#define VCPROP_REV_MODEL __BITS(11,4)
#define RPI_MODEL_A 0
#define RPI_MODEL_B 1
#define RPI_MODEL_A_PLUS 2
#define RPI_MODEL_B_PLUS 3
#define RPI_MODEL_B_PI2 4
#define RPI_MODEL_ALPHA 5
#define RPI_MODEL_COMPUTE 6
#define RPI_MODEL_ZERO 7
#define RPI_MODEL_B_PI3 8
#define RPI_MODEL_COMPUTE_PI3 9
#define RPI_MODEL_ZERO_W 10
#define VCPROP_REV_PROCESSOR __BITS(15,12)
#define RPI_PROCESSOR_BCM2835 0
#define RPI_PROCESSOR_BCM2836 1
#define RPI_PROCESSOR_BCM2837 2
#define VCPROP_REV_MANUF __BITS(19,16)
#define VCPROP_REV_MEMSIZE __BITS(22,20)
#define VCPROP_REV_ENCFLAG __BIT(23)
#define VCPROP_REV_WARRANTY __BITS(25,24)
struct vcprop_tag_macaddr {
struct vcprop_tag tag;
uint64_t addr;