Re: [PATCH v3 1/2] gpio: dt-bindings: add parsing of loongson gpio offset

From: Krzysztof Kozlowski
Date: Thu Aug 10 2023 - 02:08:40 EST


On 10/08/2023 05:35, Yinbo Zhu wrote:
>
>
> 在 2023/8/9 下午9:00, Krzysztof Kozlowski 写道:
>> On 09/08/2023 09:28, Yinbo Zhu wrote:
>>>>
>>>>> - gpio-ranges
>>>>> - interrupts
>>>>>
>>>>> @@ -49,11 +82,16 @@ examples:
>>>>> #include <dt-bindings/interrupt-controller/irq.h>
>>>>>
>>>>> gpio0: gpio@1fe00500 {
>>>>> - compatible = "loongson,ls2k-gpio";
>>>>> + compatible = "loongson,ls2k1000-gpio";
>>>>> reg = <0x1fe00500 0x38>;
>>>>> ngpios = <64>;
>>>>> #gpio-cells = <2>;
>>>>> gpio-controller;
>>>>> + loongson,gpio-conf-offset = <0>;
>>>>> + loongson,gpio-in-offset = <0x20>;
>>>>> + loongson,gpio-out-offset = <0x10>;
>>>>> + loongson,gpio-ctrl-mode = <0>;
>>>>> + loongson,gpio-inten-offset = <0x30>;
>>>>
>>>> I still think that you just embed the programming model into properties,
>>>> instead of using dedicated compatible for different blocks. It could be
>>>> fine, although I would prefer to check it with your DTS
>>>
>>> Okay, I got it, and if I understand correctly, you seem to agree with
>>> me adding attributes like this.
>>>
>>> And, if using this method that programming model into dts properites,
>>> then when adding a new platform's GPIO, there is no longer a need to
>>> modify the driver because gpio controller is compatible and different
>>> platform can use a same compatible.
>>
>> Uhu, so there we are. You use this method now to avoid new compatibles.
>> No, therefore I do not agree.
>
>
> I don't seem to got it, if the GPIO controllers of two platforms are
> compatible, shouldn't they use the same compatible?

They can use the same fallback compatible, but you should have specific
compatible anyway. However they are not compatible, because programming
model is different.-

>
>>
>>>
>>>>
>>>> Where is your DTS?
>>>
>>>
>>> Sorry, the dts containing gpio nodes are only available in the product
>>> code and have not been sent to the community yet.
>>
>> Does not help to convince us, but it is your right. With this and above
>> explanation, my answer is no - NAK.
>
>
> The community work for DTS on the 2K platform is still ongoing. Do I
> need to add a GPIO DTS node based on the following DTS to request your
> review? so that you can more conveniently review whether my patch is
> suitable.
>
> 2k1000
> https://lore.kernel.org/all/99bdbfc66604b4700e3e22e28c3d27ef7c9c9af7.1686882123.git.zhoubinbin@xxxxxxxxxxx/
>
> 2k500
> https://lore.kernel.org/all/c7087046a725e7a2cfde788185112c150e216f1b.1686882123.git.zhoubinbin@xxxxxxxxxxx/
>
> 2k2000
> https://lore.kernel.org/all/977009099c38177c384fca5a0ee77ebbe50e3ea2.1686882123.git.zhoubinbin@xxxxxxxxxxx/

If you want to convince us that your properties makes sense, adding GPIO
nodes there would be helpful.

Best regards,
Krzysztof