summaryrefslogtreecommitdiff
path: root/sys/src/9/bcm
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2021-11-07 17:51:12 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2021-11-07 17:51:12 +0000
commit9eb192f586316361a78cf399b410716ee20ed132 (patch)
tree1488706d903e0591c97c32bfb12d0f8282f73735 /sys/src/9/bcm
parent80268af29eb1dfc1ca4fc528f70c5af17286dd2c (diff)
bcm64: parse the emmc2bus/dma-ranges device-tree property and provide *emmc2bus kernel parameter
/* * emmc2 has different DMA constraints based on SoC revisions. It was * moved into its own bus, so as for RPi4's firmware to update them. * The firmware will find whether the emmc2bus alias is defined, and if * so, it'll edit the dma-ranges property below accordingly. */ emmc2bus: emmc2bus { compatible = "simple-bus"; ranges = <0x0 0x7e000000 0x0 0xfe000000 0x01800000>; dma-ranges = <0x0 0xc0000000 0x0 0x00000000 0x40000000>; emmc2: mmc@7e340000 { compatible = "brcm,bcm2711-emmc2"; reg = <0x0 0x7e340000 0x100>; interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clocks BCM2711_CLOCK_EMMC2>; status = "disabled"; }; };
Diffstat (limited to 'sys/src/9/bcm')
-rw-r--r--sys/src/9/bcm/bootargs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/src/9/bcm/bootargs.c b/sys/src/9/bcm/bootargs.c
index 445e0baef..9b6c13a83 100644
--- a/sys/src/9/bcm/bootargs.c
+++ b/sys/src/9/bcm/bootargs.c
@@ -12,6 +12,7 @@ static char *confname[MAXCONF];
static char *confval[MAXCONF];
static int nconf;
static char maxmem[256];
+static char emmc2bus[38];
static char pciwin[38], pcidmawin[38];
static int
@@ -114,6 +115,16 @@ devtreeprop(char *path, char *key, void *val, int len)
}
return;
}
+ if(strcmp(path, "/emmc2bus") == 0 && strcmp(key, "dma-ranges") == 0 && len == (2*4 + 2*4 + 1*4)){
+ if(findconf("*emmc2bus") < 0){
+ addr = (uvlong)beget4(p+0*4)<<32 | beget4(p+1*4);
+ addr -= (uvlong)beget4(p+2*4)<<32 | beget4(p+3*4);
+ size = beget4(p+4*4);
+ snprint(emmc2bus, sizeof(emmc2bus), "%#llux %#llux", addr, addr+size);
+ addconf("*emmc2bus", emmc2bus);
+ }
+ return;
+ }
if(strncmp(path, "/scb/pcie@", 10) == 0 && len == (3*4 + 4*4)){
if((beget4(p) & 0x3000000) == 0x2000000){
size = (uvlong)beget4(p+5*4)<<32 | beget4(p+5*4+4);