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";
 };
 };
This commit is contained in:
cinap_lenrek 2021-11-07 17:51:12 +00:00
parent 80268af29e
commit 9eb192f586

View file

@ -12,6 +12,7 @@ static char *confname[MAXCONF];
static char *confval[MAXCONF]; static char *confval[MAXCONF];
static int nconf; static int nconf;
static char maxmem[256]; static char maxmem[256];
static char emmc2bus[38];
static char pciwin[38], pcidmawin[38]; static char pciwin[38], pcidmawin[38];
static int static int
@ -114,6 +115,16 @@ devtreeprop(char *path, char *key, void *val, int len)
} }
return; 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(strncmp(path, "/scb/pcie@", 10) == 0 && len == (3*4 + 4*4)){
if((beget4(p) & 0x3000000) == 0x2000000){ if((beget4(p) & 0x3000000) == 0x2000000){
size = (uvlong)beget4(p+5*4)<<32 | beget4(p+5*4+4); size = (uvlong)beget4(p+5*4)<<32 | beget4(p+5*4+4);