lkml.org 
[lkml]   [2023]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/2] gpio: dt-bindings: add parsing of loongson gpio offset
From
Date


在 2023/8/3 下午2:41, Krzysztof Kozlowski 写道:
> On 03/08/2023 08:30, Conor Dooley wrote:
>>>>> gpio0:gpio@0x1fe10430 {
>>>>> compatible = "loongson,ls2k-gpio";
>>>>> reg = <0 0x1fe10430 0 0x20>;
>>>>> gpio-controller;
>>>>> #gpio-cells = <2>;
>>>>> interrupt-parent = <&liointc1>;
>>>>> ngpios = <64>;
>>>>> loongson,gpio-conf-offset = <0>;
>>>>> loongson,gpio-out-offset = <0x10>;
>>>>> loongson,gpio-in-offset = <0x8>;
>>>>> loongson,gpio-inten-offset = <0xb0>;
>>>>> loongson,gpio-ctrl-mode = <0x0>;
>>>>> ...
>>>>> }
>>>>>
>>>>> gpio1:gpio@0x1fe10450 {
>>>>> compatible = "loongson,ls2k-gpio";
>>>>> reg = <0 0x1fe10450 0 0x20>;
>>>>> gpio-controller;
>>>>> #gpio-cells = <2>;
>>>>> interrupt-parent = <&liointc1>;
>>>>> ngpios = <64>;
>>>>> loongson,gpio-conf-offset = <0>;
>>>>> loongson,gpio-out-offset = <0x10>;
>>>>> loongson,gpio-in-offset = <0x8>;
>>>>
>>>> These 3 are the same for both controllers, no?
>>>> Is only the inten-offset a variable?
>>>>
>>>>> loongson,gpio-inten-offset = <0x98>;
>>>>
>>>> These offsets exceed the region that you've got in the reg property for
>>>> this controller, do they not?
>>>>
>>>> Is there some sort of "miscellaneous register area" at 0x1FE104E0, or
>>>> just those two interrupt registers and nothing else?
>>>
>>>
>>> 2k500 gpio dts is just an example, like 3a5000, or more other platform,
>>> above offset was different but the gpio controller was compatible.
>>>
>>> gpio: gpio@1fe00500 {
>>> compatible = "loongson,ls2k-gpio";
>>> reg = <0 0x1fe00500 0xc00>;
>>> gpio-controller;
>>> #gpio-cells = <2>;
>>> ngpios = <16>;
>>> loongson,gpio-conf-offset = <0x0>;
>>> loongson,gpio-out-offset = <0x8>;
>>> loongson,gpio-in-offset = <0xc>;
>>> ...
>>> }
>>
>> That is a different SoC and needs to have a different compatible string.
>> "loongson,ls2k-foo" compatible strings were a mistake that only got past
>> us because we were not aware it was a family, rather than a specific
>> SoC. They certainly should not be used in isolation on a 3a5000!
>>
>> Are there more than one GPIO controllers on the 3a5000? If so, what do
>> those nodes look like.
>
> Eh, even for the same SoC having different offsets suggest that
> programming model is a bit different. Anyway, who designed such
> hardware? Really?


Hi Krzysztof & Conor,

I'm sorry for the confusion caused to you, such as 2k2000, which has two
gpio controllers with different register offsets. The gpio node is
following:

pioA: gpio0@0x1fe00500 {
compatible = "loongson,ls2k-gpio";
reg = <0 0x1fe00500 0 0x20>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <32>;
loongson,gpio-ctrl-mode = <0>;
loongson,gpio-conf-offset = <0>;
loongson,gpio-in-offset = <0xc>;
loongson,gpio-out-offset = <0x8>;
};

pioB: gpio1@0x100e0000 {
compatible = "loongson,ls2k-gpio";
reg = <0 0x100e0000 0 0x20>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <64>;
loongson,gpio-ctrl-mode = <0>;
loongson,gpio-conf-offset = <0>;
loongson,gpio-in-offset = <0x20>;
loongson,gpio-out-offset = <0x10>;
};


In addition, the GPIO controllers between different SoCs are compatible
except for offset, previously, the examples of 3a5000 and 2k0500 gpio
were listed, Of course, it also includes 2k1000, which gpio chip was
compatible but offset was different.

About the "loongson,ls2k-foo" compatible strings were a mistake that I
got it and I will add a specific SoC "loongson,ls2k1000-foo" compatible
, but from previous community communication, it seems that if different
SoC peripherals are compatible, they can use the same compatible string.

Thanks,
Yinbo

\
 
 \ /
  Last update: 2023-08-03 11:44    [W:0.058 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site