Question re DeviceTree addressing

Caleb James DeLisle cjd at cjdns.fr
Mon Apr 3 07:00:10 PDT 2023


Hello folks,

I've been working on trying to port an en7526 and in doing so I'm trying to learn how to at least 
partially write a DTS file from an old style header full of #defines.

I ran into a bit of a quandry, I'm comparing the mt7621.dtsi file to an older MT7621 memory map header:

https://github.com/openwrt/openwrt/blob/master/target/linux/ramips/dts/mt7621.dtsi#L100

https://github.com/keenetic/kernel-49/blob/master/arch/mips/include/asm/rt2880/rt_mmap.h#L48

```
	palmbus: palmbus at 1e000000 {
		compatible = "palmbus";
		reg = <0x1e000000 0x100000>;
		ranges = <0x0 0x1e000000 0x0fffff>;

[...]

		i2c: i2c at 900 {
			compatible = "mediatek,mt7621-i2c";
			reg = <0x900 0x100>;
```

For me, means there should be an I2C controller mapped at address 0x1e000900.

But looking at rt_mmap.h I see:

```
#define RALINK_I2C_BASE			0xBE000900
```

And in fact almost everything is based on 0xBE000000, except UART and USB addresses which are 
"correct". And I see these 0xBE000000 addresses being passed through KSEG1ADDR() so it seems they 
are physical memory addresses, not virtual.

I was wondering if anybody has seen something like this and/or could shed some light on it.

Thanks,
Caleb



More information about the openwrt-devel mailing list