Switch to mainstream DTS for Raspberry Pi-B and Pi-2.

This is first step in attempt to make FreeBSD compatible with all variants of
RPi boards.

Reviewed by:	gonzo
MFC after:	3 weeks
This commit is contained in:
Michal Meloun 2018-02-27 15:01:17 +00:00
parent f3b7b054dd
commit 81cb170fea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330072
6 changed files with 111 additions and 720 deletions

View file

@ -133,6 +133,13 @@ struct bcm_intc_softc {
struct bcm_intc_irqsrc intc_isrcs[BCM_INTC_NIRQS];
};
static struct ofw_compat_data compat_data[] = {
{"broadcom,bcm2835-armctrl-ic", 1},
{"brcm,bcm2835-armctrl-ic", 1},
{"brcm,bcm2836-armctrl-ic", 1},
{NULL, 0}
};
static struct bcm_intc_softc *bcm_intc_sc = NULL;
#define intc_read_4(_sc, reg) \
@ -366,9 +373,9 @@ bcm_intc_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-armctrl-ic") &&
!ofw_bus_is_compatible(dev, "brcm,bcm2836-armctrl-ic"))
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
device_set_desc(dev, "BCM2835 Interrupt Controller");
return (BUS_PROBE_DEFAULT);
}

View file

@ -77,6 +77,7 @@ static int bcm2835_sdhci_pio_mode = 0;
static struct ofw_compat_data compat_data[] = {
{"broadcom,bcm2835-sdhci", 1},
{"brcm,bcm2835-sdhci", 1},
{"brcm,bcm2835-mmc", 1},
{NULL, 0}
};

View file

@ -90,6 +90,12 @@ static struct resource_spec bcm_systimer_irq_spec[] = {
{ -1, 0, 0 }
};
static struct ofw_compat_data compat_data[] = {
{"broadcom,bcm2835-system-timer", 1},
{"brcm,bcm2835-system-timer", 1},
{NULL, 0}
};
static struct bcm_systimer_softc *bcm_systimer_sc = NULL;
/* Read/Write macros for Timer used as timecounter */
@ -196,12 +202,10 @@ bcm_systimer_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (ofw_bus_is_compatible(dev, "broadcom,bcm2835-system-timer")) {
device_set_desc(dev, "BCM2835 System Timer");
return (BUS_PROBE_DEFAULT);
}
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
return (ENXIO);
return (BUS_PROBE_DEFAULT);
}
static int

View file

@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
static struct ofw_compat_data compat_data[] = {
{"broadcom,bcm2835-usb", 1},
{"brcm,bcm2835-usb", 1},
{"brcm,bcm2708-usb", 1},
{NULL, 0}
};

View file

@ -24,378 +24,73 @@
*
* $FreeBSD$
*/
/dts-v1/;
/include/ "bcm2835.dtsi"
#include "bcm2835-rpi-b.dts"
/ {
model = "Raspberry Pi (BCM2835)";
compatible = "raspberrypi,model-a", "raspberrypi,model-b",
"broadcom,bcm2835-vc", "broadcom,bcm2708-vc";
memreserve = <0x08000000 0x08000000>; /* Set by VideoCore */
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
compatible = "arm,1176jzf-s";
device_type = "cpu";
reg = <0>; /* CPU ID=0 */
clock-frequency = <700000000>; /* 700MHz */
};
};
/* This is only necessary for FDT_DTB_STATIC */
memory {
device_type = "memory";
reg = <0 0x8000000>; /* 128MB, Set by VideoCore */
};
system {
revision = <0>; /* Set by VideoCore */
serial = <0 0>; /* Set by VideoCore */
};
axi {
gpio: gpio {
/* BSC0 */
pins_bsc0_a: bsc0_a {
broadcom,function = "ALT0";
};
pins_bsc0_b: bsc0_b {
broadcom,function = "ALT0";
};
pins_bsc0_c: bsc0_c {
broadcom,function = "ALT1";
};
/* BSC1 */
pins_bsc1_a: bsc1_a {
broadcom,function = "ALT0";
};
pins_bsc1_b: bsc1_b {
broadcom,function = "ALT2";
};
/* GPCLK0 */
pins_gpclk0_a: gpclk0_a {
broadcom,function = "ALT0";
};
pins_gpclk0_b: gpclk0_b {
broadcom,function = "ALT5";
};
pins_gpclk0_c: gpclk0_c {
broadcom,function = "ALT0";
};
pins_gpclk0_d: gpclk0_d {
broadcom,function = "ALT0";
};
/* GPCLK1 */
pins_gpclk1_a: gpclk1_a {
broadcom,function = "ALT0";
};
pins_gpclk1_b: gpclk1_b {
broadcom,function = "ALT5";
};
pins_gpclk1_c: gpclk1_c {
broadcom,function = "ALT0";
};
pins_gpclk1_d: gpclk1_d {
broadcom,function = "ALT0";
};
/* GPCLK2 */
pins_gpclk2_a: gpclk2_a {
broadcom,function = "ALT0";
};
pins_gpclk2_b: gpclk2_b {
broadcom,function = "ALT0";
};
/* SPI0 */
pins_spi0_a: spi0_a {
broadcom,function = "ALT0";
};
pins_spi0_b: spi0_b {
broadcom,function = "ALT0";
};
/* PWM */
pins_pwm0_a: pwm0_a {
broadcom,function = "ALT0";
};
pins_pwm0_b: pwm0_b {
broadcom,function = "ALT5";
};
pins_pwm0_c: pwm0_c {
broadcom,function = "ALT0";
};
pins_pwm1_a: pwm1_a {
broadcom,function = "ALT0";
};
pins_pwm1_b: pwm1_b {
broadcom,function = "ALT5";
};
pins_pwm1_c: pwm1_c {
broadcom,function = "ALT0";
};
pins_pwm1_d: pwm1_d {
broadcom,function = "ALT0";
};
/* UART0 */
pins_uart0_a: uart0_a {
broadcom,function = "ALT0";
};
pins_uart0_b: uart0_b {
broadcom,function = "ALT3";
};
pins_uart0_c: uart0_c {
broadcom,function = "ALT2";
};
pins_uart0_fc_a: uart0_fc_a {
broadcom,function = "ALT3";
};
pins_uart0_fc_b: uart0_fc_b {
broadcom,function = "ALT3";
};
pins_uart0_fc_c: uart0_fc_c {
broadcom,function = "ALT2";
};
/* PCM */
pins_pcm_a: pcm_a {
broadcom,function = "ALT0";
};
pins_pcm_b: pcm_b {
broadcom,function = "ALT2";
};
/* Secondary Address Bus */
pins_sm_addr_a: sm_addr_a {
broadcom,function = "ALT1";
};
pins_sm_addr_b: sm_addr_b {
broadcom,function = "ALT1";
};
pins_sm_ctl_a: sm_ctl_a {
broadcom,function = "ALT1";
};
pins_sm_ctl_b: sm_ctl_b {
broadcom,function = "ALT1";
};
pins_sm_data_8bit_a: sm_data_8bit_a {
broadcom,function = "ALT1";
};
pins_sm_data_8bit_b: sm_data_8bit_b {
broadcom,function = "ALT1";
};
pins_sm_data_16bit: sm_data_16bit {
broadcom,function = "ALT1";
};
pins_sm_data_18bit: sm_data_18bit {
broadcom,function = "ALT1";
};
/* BSCSL */
pins_bscsl: bscsl {
broadcom,function = "ALT3";
};
/* SPISL */
pins_spisl: spisl {
broadcom,function = "ALT3";
};
/* SPI1 */
pins_spi1: spi1 {
broadcom,function = "ALT4";
};
/* UART1 */
pins_uart1_a: uart1_a {
broadcom,function = "ALT5";
};
pins_uart1_b: uart1_b {
broadcom,function = "ALT5";
};
pins_uart1_c: uart1_c {
broadcom,function = "ALT5";
};
pins_uart1_fc_a: uart1_fc_a {
broadcom,function = "ALT5";
};
pins_uart1_fc_b: uart1_fc_b {
broadcom,function = "ALT5";
};
pins_uart1_fc_c: uart1_fc_c {
broadcom,function = "ALT5";
};
/* SPI2 */
pins_spi2: spi2 {
broadcom,function = "ALT4";
};
/* ARM JTAG */
pins_arm_jtag_trst: arm_jtag_trst {
broadcom,function = "ALT4";
};
pins_arm_jtag_a: arm_jtag_a {
broadcom,function = "ALT5";
};
pins_arm_jtag_b: arm_jtag_b {
broadcom,function = "ALT4";
};
/* Reserved */
pins_reserved: reserved {
broadcom,function = "ALT3";
};
};
usb {
hub {
compatible = "usb,hub", "usb,device";
reg = <0x00000001>;
#address-cells = <1>;
#size-cells = <0>;
ethernet: ethernet {
compatible = "net,ethernet",
"usb,device";
reg = <0x00000001>;
mac-address = [00 00 00 00 00 00];
};
};
};
};
display {
compatible = "broadcom,bcm2835-fb", "broadcom,bcm2708-fb";
broadcom,vc-mailbox = <&vc_mbox>;
broadcom,vc-channel = <1>;
broadcom,width = <0>; /* Set by VideoCore */
broadcom,height = <0>; /* Set by VideoCore */
broadcom,depth = <0>; /* Set by VideoCore */
};
rpi_ft5406 {
compatible = "rpi,rpi-ft5406";
status = "okay";
};
leds {
compatible = "gpio-leds";
ok {
label = "ok";
gpios = <&gpio 16 1>;
/* Temporary patches */
soc {
sdhost: mmc@7e202000 {
status = "disabled";
}
/* Don't change this - it configures
* how the led driver determines if
* the led is on or off when it loads.
sdhci@7e300000 {
status = "okay";
};
rng@7e104000 {
interrupts = <2 29>;
}
spi@7e204000 {
status = "okay";
};
gpio@7e200000 {
/* Pins that can short 3.3V to GND in output mode: 46-47
* Pins used by VideoCore: 48-53
*/
default-state = "keep";
/* This is the real default state. */
linux,default-trigger = "default-on";
};
};
power: regulator {
compatible = "broadcom,bcm2835-power-mgr",
"broadcom,bcm2708-power-mgr",
"simple-bus";
#address-cells = <1>;
#size-cells = <0>;
broadcom,vc-mailbox = <&vc_mbox>;
broadcom,vc-channel = <0>;
regulator-name = "VideoCore";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on = <1>;
sd_card_power: regulator@0 {
compatible = "broadcom,bcm2835-power-dev",
"broadcom,bcm2708-power-dev";
reg = <0>;
vin-supply = <&power>;
regulator-name = "SD Card";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
broadcom,read-only = <46>, <47>, <48>, <49>, <50>,
<51>, <52>, <53>;
/* Reserved */
pins_reserved: reserved {
broadcom,pins = <48>, <49>, <50>, <51>, <52>,
<53>;
};
}
vchiq {
compatible = "brcm,bcm2835-vchiq";
reg = <0x7e00b840 0xf>;
interrupts = <0 2>;
cache-line-size = <32>;
};
/* This is for the controller itself, not the root port */
usb_hcd_power: regulator@3 {
compatible = "broadcom,bcm2835-power-dev",
"broadcom,bcm2708-power-dev";
reg = <3>;
display {
compatible = "broadcom,bcm2835-fb", "broadcom,bcm2708-fb";
vin-supply = <&power>;
regulator-name = "USB HCD";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
broadcom,vc-mailbox = <&mailbox>;
broadcom,vc-channel = <1>;
broadcom,width = <0>; /* Set by VideoCore */
broadcom,height = <0>; /* Set by VideoCore */
broadcom,depth = <0>; /* Set by VideoCore */
};
};
aliases {
uart0 = &uart0;
ethernet0 = &ethernet;
};
chosen {
bootargs = ""; /* Set by VideoCore */
stdin = "uart0";
stdout = "uart0";
};
__overrides__ {
cache_line_size = <&vchiq>, "cache-line-size:0";
};
};

View file

@ -24,389 +24,72 @@
*
* $FreeBSD$
*/
/dts-v1/;
/include/ "bcm2836.dtsi"
#include "bcm2836-rpi-2-b.dts"
/ {
model = "Raspberry Pi 2 Model B";
compatible = "brcm,bcm2836";
memreserve = <0x08000000 0x08000000>; /* Set by VideoCore */
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <0xf00>; /* CPU ID=0xf00 */
clock-frequency = <800000000>; /* 800MHz */
};
cpu@1 {
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <0xf01>; /* CPU ID=0xf01 */
clock-frequency = <800000000>; /* 800MHz */
};
cpu@2 {
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <0xf02>; /* CPU ID=0xf02 */
clock-frequency = <800000000>; /* 800MHz */
};
cpu@3 {
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <0xf03>; /* CPU ID=0xf03 */
clock-frequency = <800000000>; /* 800MHz */
};
};
/* This is only necessary for FDT_DTB_STATIC */
memory {
device_type = "memory";
reg = <0 0x8000000>; /* 128MB, Set by VideoCore */
};
system {
revision = <0>; /* Set by VideoCore */
serial = <0 0>; /* Set by VideoCore */
};
axi {
gpio: gpio {
/* BSC0 */
pins_bsc0_a: bsc0_a {
broadcom,function = "ALT0";
};
pins_bsc0_b: bsc0_b {
broadcom,function = "ALT0";
};
pins_bsc0_c: bsc0_c {
broadcom,function = "ALT1";
};
/* BSC1 */
pins_bsc1_a: bsc1_a {
broadcom,function = "ALT0";
};
pins_bsc1_b: bsc1_b {
broadcom,function = "ALT2";
};
/* GPCLK0 */
pins_gpclk0_a: gpclk0_a {
broadcom,function = "ALT0";
};
pins_gpclk0_b: gpclk0_b {
broadcom,function = "ALT5";
};
pins_gpclk0_c: gpclk0_c {
broadcom,function = "ALT0";
};
pins_gpclk0_d: gpclk0_d {
broadcom,function = "ALT0";
};
/* GPCLK1 */
pins_gpclk1_a: gpclk1_a {
broadcom,function = "ALT0";
};
pins_gpclk1_b: gpclk1_b {
broadcom,function = "ALT5";
};
pins_gpclk1_c: gpclk1_c {
broadcom,function = "ALT0";
};
pins_gpclk1_d: gpclk1_d {
broadcom,function = "ALT0";
};
/* GPCLK2 */
pins_gpclk2_a: gpclk2_a {
broadcom,function = "ALT0";
};
pins_gpclk2_b: gpclk2_b {
broadcom,function = "ALT0";
};
/* SPI0 */
pins_spi0_a: spi0_a {
broadcom,function = "ALT0";
};
pins_spi0_b: spi0_b {
broadcom,function = "ALT0";
};
/* PWM */
pins_pwm0_a: pwm0_a {
broadcom,function = "ALT0";
};
pins_pwm0_b: pwm0_b {
broadcom,function = "ALT5";
};
pins_pwm0_c: pwm0_c {
broadcom,function = "ALT0";
};
pins_pwm1_a: pwm1_a {
broadcom,function = "ALT0";
};
pins_pwm1_b: pwm1_b {
broadcom,function = "ALT5";
};
pins_pwm1_c: pwm1_c {
broadcom,function = "ALT0";
};
pins_pwm1_d: pwm1_d {
broadcom,function = "ALT0";
};
/* UART0 */
pins_uart0_a: uart0_a {
broadcom,function = "ALT0";
};
pins_uart0_b: uart0_b {
broadcom,function = "ALT3";
};
pins_uart0_c: uart0_c {
broadcom,function = "ALT2";
};
pins_uart0_fc_a: uart0_fc_a {
broadcom,function = "ALT3";
};
pins_uart0_fc_b: uart0_fc_b {
broadcom,function = "ALT3";
};
pins_uart0_fc_c: uart0_fc_c {
broadcom,function = "ALT2";
};
/* PCM */
pins_pcm_a: pcm_a {
broadcom,function = "ALT0";
};
pins_pcm_b: pcm_b {
broadcom,function = "ALT2";
};
/* Secondary Address Bus */
pins_sm_addr_a: sm_addr_a {
broadcom,function = "ALT1";
};
pins_sm_addr_b: sm_addr_b {
broadcom,function = "ALT1";
};
pins_sm_ctl_a: sm_ctl_a {
broadcom,function = "ALT1";
};
pins_sm_ctl_b: sm_ctl_b {
broadcom,function = "ALT1";
};
pins_sm_data_8bit_a: sm_data_8bit_a {
broadcom,function = "ALT1";
};
pins_sm_data_8bit_b: sm_data_8bit_b {
broadcom,function = "ALT1";
};
pins_sm_data_16bit: sm_data_16bit {
broadcom,function = "ALT1";
};
pins_sm_data_18bit: sm_data_18bit {
broadcom,function = "ALT1";
};
/* BSCSL */
pins_bscsl: bscsl {
broadcom,function = "ALT3";
};
/* SPISL */
pins_spisl: spisl {
broadcom,function = "ALT3";
};
/* SPI1 */
pins_spi1: spi1 {
broadcom,function = "ALT4";
};
/* UART1 */
pins_uart1_a: uart1_a {
broadcom,function = "ALT5";
};
pins_uart1_b: uart1_b {
broadcom,function = "ALT5";
};
pins_uart1_c: uart1_c {
broadcom,function = "ALT5";
};
pins_uart1_fc_a: uart1_fc_a {
broadcom,function = "ALT5";
};
pins_uart1_fc_b: uart1_fc_b {
broadcom,function = "ALT5";
};
pins_uart1_fc_c: uart1_fc_c {
broadcom,function = "ALT5";
};
/* SPI2 */
pins_spi2: spi2 {
broadcom,function = "ALT4";
};
/* ARM JTAG */
pins_arm_jtag_trst: arm_jtag_trst {
broadcom,function = "ALT4";
};
pins_arm_jtag_a: arm_jtag_a {
broadcom,function = "ALT5";
};
pins_arm_jtag_b: arm_jtag_b {
broadcom,function = "ALT4";
};
/* Reserved */
pins_reserved: reserved {
broadcom,function = "ALT3";
};
};
usb {
hub {
compatible = "usb,hub", "usb,device";
reg = <0x00000001>;
#address-cells = <1>;
#size-cells = <0>;
ethernet: ethernet {
compatible = "net,ethernet",
"usb,device";
reg = <0x00000001>;
mac-address = [00 00 00 00 00 00];
};
};
};
};
display {
compatible = "broadcom,bcm2835-fb", "broadcom,bcm2708-fb";
broadcom,vc-mailbox = <&vc_mbox>;
broadcom,vc-channel = <1>;
broadcom,width = <0>; /* Set by VideoCore */
broadcom,height = <0>; /* Set by VideoCore */
broadcom,depth = <0>; /* Set by VideoCore */
};
rpi_ft5406 {
compatible = "rpi,rpi-ft5406";
status = "okay";
};
leds {
compatible = "gpio-leds";
pwr {
label = "pwr";
gpios = <&gpio 35 0>;
/* Temporary patches */
soc {
sdhost: mmc@7e202000 {
status = "disabled";
}
sdhci@7e300000 {
status = "okay";
};
act {
label = "act";
gpios = <&gpio 47 0>;
};
};
rng@7e104000 {
interrupts = <2 29>;
}
power: regulator {
compatible = "broadcom,bcm2835-power-mgr",
"broadcom,bcm2708-power-mgr",
"simple-bus";
#address-cells = <1>;
#size-cells = <0>;
broadcom,vc-mailbox = <&vc_mbox>;
broadcom,vc-channel = <0>;
regulator-name = "VideoCore";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on = <1>;
sd_card_power: regulator@0 {
compatible = "broadcom,bcm2835-power-dev",
"broadcom,bcm2708-power-dev";
reg = <0>;
vin-supply = <&power>;
regulator-name = "SD Card";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
spi@7e204000 {
status = "okay";
};
/* This is for the controller itself, not the root port */
usb_hcd_power: regulator@3 {
compatible = "broadcom,bcm2835-power-dev",
"broadcom,bcm2708-power-dev";
reg = <3>;
gpio@7e200000 {
/* Pins that can short 3.3V to GND in output mode: 46-47
* Pins used by VideoCore: 48-53
*/
broadcom,read-only = <46>, <47>, <48>, <49>, <50>,
<51>, <52>, <53>;
/* Reserved */
pins_reserved: reserved {
broadcom,pins = <48>, <49>, <50>, <51>, <52>,
<53>;
};
}
vin-supply = <&power>;
regulator-name = "USB HCD";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
vchiq {
compatible = "brcm,bcm2835-vchiq";
reg = <0x7e00b840 0xf>;
interrupts = <0 2>;
cache-line-size = <32>;
};
display {
compatible = "broadcom,bcm2835-fb", "broadcom,bcm2708-fb";
broadcom,vc-mailbox = <&mailbox>;
broadcom,vc-channel = <1>;
broadcom,width = <0>; /* Set by VideoCore */
broadcom,height = <0>; /* Set by VideoCore */
broadcom,depth = <0>; /* Set by VideoCore */
};
};
aliases {
uart0 = &uart0;
ethernet0 = &ethernet;
};
chosen {
bootargs = ""; /* Set by VideoCore */
stdin = "uart0";
stdout = "uart0";
};
__overrides__ {
cache_line_size = <&vchiq>, "cache-line-size:0";
};
};