Device-tree improvements

This is for any ARMv7 device that we do not officially support.

Re: Device-tree improvements

Postby TheSaint » Mon Oct 29, 2018 1:11 am

$this->bbcode_second_pass_quote('summers', 'T')hing is the devnum is I think only used in uboot.

Alright, but this will mess up the partition definition, I think.
I'm unsure, I'll try to inspect when drop me to the busybox shell.
EDIT

Ok, trying rk3288-tinker.dtb from stock kernel
Manual commands to the u-boot shell$this->bbcode_second_pass_code('', '=> setenv rootcmd "LABEL=TB-MM-root"
=> setenv fdtfile rk3288-tinker.dtb
=> setenv bootargs "console=ttyS2,115200n8 root=${rootcmd} quiet rw rootwait"
=> ls mmc 0:1 /boot
<DIR> 4096 .
<DIR> 4096 ..
<DIR> 4096 dtb
735 boot.scr
5656876 initramfs-linux.img
6355984 zImage
8693760 vmlinuz-4.14.67-rockchip
5016719 initramfs-linux.img.gz
3741218 uInitrd-4.14.67-rockchip
<DIR> 4096 dtbs
<SYM> 22 uInitrd
239 mkscr
153 armbianEnv.txt
663 boot.txt
153 boot.env
=> setenv devtype mmc
=> setenv devnum 0
=> setenv bootpart 1
=> load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage
6355984 bytes read in 149 ms (40.7 MiB/s)
=> load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}
51883 bytes read in 4 ms (12.4 MiB/s)
=> fdt addr ${fdt_addr_r}
=> fdt resize 4096
=> fdt set /dwmmc@ff0c0000 broken-cd
=> load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img
5656876 bytes read in 133 ms (40.6 MiB/s)
=> bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}')
Result
$this->bbcode_second_pass_code('', '# ls /proc/device-tree/
#address-cells power-management@ff730000
#size-cells pwm@ff680000
__symbols__ pwm@ff680010
aliases pwm@ff680020
amba pwm@ff680030
arm-pmu qos@ffaa0000
bus_intmem@ff700000 qos@ffaa0080
chosen qos@ffad0000
clock-controller@ff760000 qos@ffad0100
compatible qos@ffad0180
cpu-opp-table qos@ffad0400
cpus qos@ffad0480
cypto-controller@ff8a0000 qos@ffad0500
display-subsystem qos@ffad0800
dp@ff970000 qos@ffad0880
dwmmc@ff0c0000 qos@ffad0900
dwmmc@ff0d0000 qos@ffae0000
dwmmc@ff0e0000 qos@ffaf0000
dwmmc@ff0f0000 qos@ffaf0080
efuse@ffb40000 reserved-memory
ethernet@ff290000 rga@ff920000
external-gmac-clock saradc@ff100000
gpio-keys sdmmc-regulator
gpio-leds serial@ff180000
gpu-opp-table serial@ff190000
gpu@ffa30000 serial@ff1b0000
hdmi@ff980000 serial@ff1c0000
i2c@ff140000 serial@ff690000
i2c@ff150000 sound
i2c@ff160000 sound@ff88b0000
i2c@ff170000 spi@ff110000
i2c@ff650000 spi@ff120000
i2c@ff660000 spi@ff130000
i2s@ff890000 sram@ff720000
interrupt-controller@ffc01000 syscon@ff740000
interrupt-parent syscon@ff770000
iommu@ff900800 thermal-zones
iommu@ff914000 timer
iommu@ff930300 timer@ff810000
iommu@ff940300 tsadc@ff280000
iommu@ff9a0800 usb@ff500000
iommu@ff9c0440 usb@ff540000
lvds@ff96c000 usb@ff580000
memory usb@ff5c0000
mipi@ff960000 vop@ff930000
model vop@ff940000
name vsys-regulator
oscillator watchdog@ff800000
pinctrl

dmseg listing>>>
[ 2.477556] mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[ 2.477619] mmc0: new high speed SDHC card at address 0007
[ 2.478329] mmcblk0: mmc0:0007 SD16G 14.4 GiB
[ 2.483489] mmcblk0: p1 p2 p3

# ls /dev/mmc* ## without SD card
ls: /dev/mmc*: No such file or directory

# ls /dev/mm* ## with inserted SD card
/dev/mmcblk0 /dev/mmcblk0p1 /dev/mmcblk0p2 /dev/mmcblk0p3')
So the addressing is wrong, because the partitions are from the SD card. I loaded the parameter manually and they were pointing to eMMC for u-boot to start.
After a normal start up with rk3288-tinkerS.dtb$this->bbcode_second_pass_code('', '$ s /dev/mm*
/dev/mmcblk0 /dev/mmcblk0p3 /dev/mmcblk2boot1 /dev/mmcblk2rpmb
/dev/mmcblk0p1 /dev/mmcblk2 /dev/mmcblk2p1
/dev/mmcblk0p2 /dev/mmcblk2boot0 /dev/mmcblk2p2')

I'm thinking that the additional commands
fdt addr ${fdt_addr_r}
fdt resize 4096
fdt set /dwmmc@ff0c0000 broken-cd

may upset the eMMC recognition.
One more round, without that, NO differences.
TheSaint
 
Posts: 346
Joined: Mon Jul 23, 2018 7:57 am

Re: Device-tree improvements

Postby summers » Mon Oct 29, 2018 7:55 pm

Looks to me like uboot sees the eMMC, but linux only sees the sd card anot not the eMMC. This is what you would expect with a tinker board dtb, as the tinker board doesn't have an eMMC, whereas the S does. Its probably the device trees catching up with where they should be ...

You should be able to check inn the device tree that the relevant device isn't enabled ....
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: Device-tree improvements

Postby TheSaint » Tue Oct 30, 2018 2:25 am

Just for tinkering. Results with rk3288-tinkerS.dtb$this->bbcode_second_pass_code('', '$ ls /proc/device-tree/dwmm*
/proc/device-tree/dwmmc@ff0c0000:
broken-cd card-detect-delay disable-wp name reset-names vqmmc-supply
bus-width clock-names fifo-depth pinctrl-0 resets
cap-mmc-highspeed clocks interrupts pinctrl-names status
cap-sd-highspeed compatible max-frequency reg vmmc-supply

/proc/device-tree/dwmmc@ff0d0000:
bus-width clock-names interrupts non-removable reset-names
cap-sd-highspeed clocks keep-power-in-suspend num-slots resets
cap-sdio-irq compatible max-frequency pinctrl-0 sd-uhs-sdr104
clock-freq-min-max disable-wp mmc-pwrseq pinctrl-names status
clock-frequency fifo-depth name reg supports-sdio

/proc/device-tree/dwmmc@ff0e0000:
clock-names compatible interrupts name reset-names status
clocks fifo-depth max-frequency reg resets

/proc/device-tree/dwmmc@ff0f0000:
bus-width compatible max-frequency non-removable reg
cap-mmc-highspeed disable-wp mmc-ddr-1_8v num-slots reset-names
clock-names fifo-depth mmc-hs200-1_8v pinctrl-0 resets
clocks interrupts name pinctrl-names status

$ cat /proc/device-tree/dwmmc\@ff0d0000/status
okay
$ cat /proc/device-tree/dwmmc\@ff0c0000/status
okay')
With rk3288-tinker.dtb stock$this->bbcode_second_pass_code('', '# ls /proc/device-tree/dwmm*
/proc/device-tree/dwmmc@ff0c0000:
broken-cd clocks name resets
bus-width compatible phandle status
cap-mmc-highspeed disable-wp pinctrl-0 vmmc-supply
cap-sd-highspeed fifo-depth pinctrl-names vqmmc-supply
card-detect-delay interrupts reg
clock-names max-frequency reset-names

/proc/device-tree/dwmmc@ff0d0000:
clock-names fifo-depth name reset-names
clocks interrupts phandle resets
compatible max-frequency reg status

/proc/device-tree/dwmmc@ff0e0000:
clock-names fifo-depth name reset-names
clocks interrupts phandle resets
compatible max-frequency reg status

/proc/device-tree/dwmmc@ff0f0000:
clock-names fifo-depth name reset-names
clocks interrupts phandle resets
compatible max-frequency reg status

# cat /proc/device-tree/dwmmc\@ff0d0000/status
disabled
# cat /proc/device-tree/dwmmc\@ff0c0000/status
okay')
As you wrote, the second one is disabled. So the relevant part in the dtf is missing ;)

My curiosity asks how to automatically detect the difference between the two boards ? Will it be possible ?
For example there is a u-boot command which makes a test$this->bbcode_second_pass_code('', 'itest.b ${devnum} == 0 && echo "U-boot loaded from SD"
itest.b ${devnum} == 1 && echo "U-boot loaded from eMMC"')
Extracted from Armbian 5.50
So if that results applicable, there could be a chance to set which statement to make eMMC available.

Anyway, it's obvious to think that the Asus engineers added the hardware without giving any input to the kernel.org regarding the variation.
TheSaint
 
Posts: 346
Joined: Mon Jul 23, 2018 7:57 am

Re: Device-tree improvements

Postby summers » Tue Oct 30, 2018 6:20 am

Well I'd say the dtb is correct - as designed for the tinker board which doesn't have eMMC. Suspect its just the community catching up with the tinker family.

It would be technically possible to detect the difference between tinker board and tinker board s in uboot, one of the patches on a previous thread showed where the difference is in flash. This is what is done in the beagle familly - so uboot automatically selects the right dtb on beagle boards.

Now is it worth doing the same on tinker boards? Needs someone to write the code, and send a patch into uboot.

Oh yes, in the bit of the device tree for the relevent device, you can check the status file to see if that device is enabled.

I think it would be hard to get a patch into mainline uboot to print that sd or eMMC card is used - problem is that uboot doesn't see any difference between the two devices, they are just sdio devices - so both the same ...

I think the ASUS engineers did the patches just for their debian distribution. As it was their own patches were automatically accepted. With the mainline kernel you can't do that, e.g. I'm on to something like the 5th version of the wifi patch, and for good reason. The ASUS engineers didn't want that hassle ....

With the devnum, am not sure - but are they predictable, or does it depend on thing like how and if the interface comes up? {e.g. it would be possible for the sd card to be devnum 0 on the TB, but the eMMC to be devnum 0 on the TBS ...)
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: Device-tree improvements

Postby TheSaint » Wed Oct 31, 2018 4:45 am

$this->bbcode_second_pass_quote('summers', 'd')oes it depend on thing like how and if the interface comes up? {e.g. it would be possible for the sd card to be devnum 0 on the TB, but the eMMC to be devnum 0 on the TBS ...)


Oh yes, there is a little probability that the devnum will be assigned the same. It's likely that remains zero for the block chosen to boot. So to have the certainty which device is booting it must be check whether the device contains an unique signature. Then it might select whether load one dtb or another, Otherwise what can make the dtb suitable for both selection ?
TheSaint
 
Posts: 346
Joined: Mon Jul 23, 2018 7:57 am

Re: Device-tree improvements

Postby summers » Wed Oct 31, 2018 8:48 am

One of the debian patches from ASUS showed that the TB and TBS can be distinguished through a setting in flash. So if uboot need to make a distinction between the two, then reading the flash would be the way to do it.

Practically though the way that the distro part of uboot is configured, is that the board definition in uboot specifies which partitions/devices to scan, its usually MMC + USB + a few others. Distro scans the first (maybe few) partitions of each device looking for boot.scr /boot/bot.scr and a few other things - where this is found IIRC it takes that location (by default - you can override) as containing the kernel/dtb/initrd etc.

After that the kernel makes all decisions.

Now should TB and TBS have the same dtb. To my mind the simple answer is that the DTB is 90% describing hardware, and how boards are wired up. Now the TB and TBS are different, the TBS has an eMMC chip wired into the SDIO emmc connection of the CPU. That difference needs to be described, so to my mind yes its necessary for there to be separate dtb - and thats how the kernel plays it as well. This said though its recognised these two are 95% the same, its why both are based on an rk3288-tinker.dtsi file.

dtb selection to my mind should be 100% dependent on the board you are using, in conjunction with what other boards you have plugged in. Plug in boards I think ideally should be done with overlays. In the context of your board, I'd say your TBS should use a TBS dtb, possibly with your own hand designed overlays - as I know you want to use the IO pins for specific purposes.

Then again I'm an opinionated old goat, and what are my thoughts worth ...
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: Device-tree improvements

Postby TheSaint » Thu Nov 01, 2018 6:21 am

As per your descriptions I do convene that you're entirely right.
Then I hope that upstream will whip up some good solution.
TheSaint
 
Posts: 346
Joined: Mon Jul 23, 2018 7:57 am

Re: Device-tree improvements

Postby TheSaint » Sat Nov 17, 2018 3:51 am

Today I tried the newest kernel, but the dtb is not changed. I get dropped on the initrd.
I'm looking to set up an RTC, see this. Just consider that I switched to Alarm instead fo Armbian.
Can I input the data by the u-boot variable environment ?
Or should I add something like that, on the device-tree file ?
TheSaint
 
Posts: 346
Joined: Mon Jul 23, 2018 7:57 am

Re: Device-tree improvements

Postby summers » Sat Nov 17, 2018 6:27 am

The tinker-s.dtb is due to arrive in 4.20 so we have to wait. It should support the emmc, but its known it won't do the WiFi. I need to get back to the WiFi - its quite a bit to mainline.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: Device-tree improvements

Postby summers » Sat Nov 17, 2018 6:30 am

Oh yes, the rtc needs a change to the device tree. Best to either write an overlay or in uboot create the new node ...
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

PreviousNext

Return to Community Supported

Who is online

Users browsing this forum: No registered users and 11 guests