[PATCH v1] arm: dts: rockchip: sync rk3066/rk3188 DT files from linux-next v6.2-rc4

Johan Jonker jbx6244 at gmail.com
Tue Jan 17 15:44:07 CET 2023



On 1/17/23 10:46, Quentin Schulz wrote:
> Hi Johan,
> 
> On 1/16/23 20:45, Johan Jonker wrote:
>> Sync rk3066/rk3188 DT files from Linux.
>> This is the state as of linux-next v6.2-rc4.
>> New nfc node for MK808 rk3066a.
>> CRU nodes now have a clock property.
>> To prefend dtoc errors a fixed clock must also be
>> included for tpl/spl in the rk3xxx-u-boot.dtsi file.
>>
>> Signed-off-by: Johan Jonker <jbx6244 at gmail.com>
>> ---

[..]

>> @@ -223,7 +224,7 @@
>>           #size-cells = <1>;
>>           ranges;
>>
>> -        gpio0: gpio0 at 2000a000 {
>> +        gpio0: gpio at 2000a000 {
>>               compatible = "rockchip,rk3188-gpio-bank0";
>>               reg = <0x2000a000 0x100>;
>>               interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
>> @@ -236,7 +237,7 @@
>>               #interrupt-cells = <2>;
>>           };
>>
>> -        gpio1: gpio1 at 2003c000 {

>> +        gpio1: gpio at 2003c000 {

Hi,

LOL: I made that binding change on request from Linux DT maintainers.
Node names should generic.

===

My full u-boot is able to boot a Linux kernel for rk3066a.
Only when I give the command below it crashes:

gpio status -a

Could you confirm what other parts are effected?

If it's boots then it's good enough for me and move forward, so please merge.(Kever)

Driver fixes for u-boot depending on Linux DT changes is already very time consuming enough!

===

Using DT path or node name is wrong.

Comment by robh+dt:
/sys/bus/platform/devices/ paths are not an ABI. I'll consider
nodenames an ABI if a change is noticed, but not for sysfs path.

https://lore.kernel.org/linux-rockchip/CAL_JsqJGx_MwX9ynMiCUm_xP3t6xWbrtiUi-F+2ceXqZ2Su5tA@mail.gmail.com/

Make use of the properties and a compatible in a node instead.

===
A little test.
From: rockchip_gpio_probe():

int main() {
	//char dev_name[] = "gpio1 at 2003c000";
	char dev_name[] = "gpio at 2003c000";
	char priv_name[2];
	int priv_bank;
	char *end;

	end = strrchr(dev_name, '@');
	priv_bank = trailing_strtoln(dev_name, end);

	priv_name[0] = 'A' + priv_bank;
	priv_name[1] = 0;

	printf("priv_bank: %d\n", priv_bank);
	printf("priv_name: %s\n", priv_name);
	return 0;
}

// priv_bank: 1
// priv_name: B

A change of node name gives:

// priv_bank: -1
// priv_name: @

===

Linux driver gpio-rockchip.c has an alias or else an increment id.

id = of_alias_get_id(np, "gpio");
	if (id < 0)
		id = gpio++;

Problem:
Probe order is not guarantied.
Aliases should go to board files and not in dtsi files anymore. 

===

The current compatible string is generic, but these strings should normally be SoC orientated.

Proposal:

replace:
compatible = "rockchip,gpio-bank";

by:
compatible = "rockchip,rk3188-gpio-bank";

With that known we can lookup the reg address in a lookup table and it's name for u-boot.

struct lookup_table rk_gpio_rk3188_data[] = {
	{0x2000a000, "A"},
	{0x2003c000, "B"},
	{0x2003e000, "C"},
	{0x20080000, "D"},
};


	{ .compatible = "rockchip,rk3188-gpio-bank", .data = &rk_gpio_rk3188_data },

===

If needed I can help with changes to rockchip,gpio-bank.yaml

Let me know if it's useful or that you have an other solution as long as we get forward here.

Johan

> 

> I believe this is the same issue as on RK3399 and PX30: this breaks our GPIO controller driver.

> 
> c.f. https://lore.kernel.org/u-boot/0ab9a600-b517-0ce5-d189-99fc8eddfa60@theobroma-systems.com/ and its answers.
> 
> Cheers,
> Quentin


More information about the U-Boot mailing list