[OpenWrt-Devel] [PATCH] ath79: use gpio_hog instead of gpio-export

Birger Koblitz mail at birger-koblitz.de
Sun Aug 11 07:11:28 EDT 2019


Dear Adrian,

I'll resubmit a patch taking your comments into account. I am using a
script that parses the DTS and I will use more of the original line-name
to name the node, i.e.

"tp-link:power:usb" -> power-usb
"tp-link:reset:sr"  -> reset-sr

This should also prevent the double naming of the nodes. I am actually
surprised the DTS compiler did not complain... Things like

-    compatible = "yuncore,a770", "qca,qca9531";
+    compatible = "yuncore,a770", "qca,qca9533";

are probably due to trailing white-space in the original, I'll stop the
script from touching that.

Cheers,

  Birger


On 10.08.19 22:20, mail at adrianschmutzler.de wrote:
> Hi,
>
>> +    usb {
>> +        gpio-hog;
>> +        line-name = "tp-link:power:usb";
>> +        gpios = <6 GPIO_ACTIVE_HIGH>;
>> +        output-high;
>>      };
>>  };
> As stated earlier, I would prefer calling those blocks usb-power, usb1-power, etc..
>
>> diff --git a/target/linux/ath79/dts/qca9531_yuncore_a770.dts
>> b/target/linux/ath79/dts/qca9531_yuncore_a770.dts
>> index da5b6dc7db..18ad6307a1 100644
>> --- a/target/linux/ath79/dts/qca9531_yuncore_a770.dts
>> +++ b/target/linux/ath79/dts/qca9531_yuncore_a770.dts
>> @@ -8,7 +8,7 @@
>>
>>  / {
>>      model = "YunCore A770";
>> -    compatible = "yuncore,a770", "qca,qca9531";
>> +    compatible = "yuncore,a770", "qca,qca9533";
> This should be removed.
>
>> diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
>> b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
>> index 6d32fa3fc4..378c87c9ee 100644
>> --- a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
>> +++ b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi
>> @@ -54,22 +54,23 @@
>>              gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
>>          };
>>      };
>> +};
>>
>> -    gpio-export {
>> -        compatible = "gpio-export";
>> -
>> -        gpio_shift_register_oe {
>> -            gpio-export,name = "tp-link:oe:sr";
>> -            gpio-export,output = <0>;
>> -            gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
>> -        };
>> +&gpio {
>> +    status = "okay";
>>
>> -        gpio_shift_register_reset {
>> -            gpio-export,name = "tp-link:reset:sr";
>> -            gpio-export,output = <1>;
>> -            gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
>> -        };
>> +    sr {
>> +        gpio-hog;
>> +        line-name = "tp-link:oe:sr";
>> +        gpios = <16 GPIO_ACTIVE_HIGH>;
>> +        output-low;
>> +    };
>>
>> +    sr {
>> +        gpio-hog;
>> +        line-name = "tp-link:reset:sr";
>> +        gpios = <19 GPIO_ACTIVE_HIGH>;
>> +        output-high;
>>      };
> Those two should have different node names.
>
>> diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
>> b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
>> index f4add2fe31..d892d0e960 100644
>> --- a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
>> +++ b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts
>> @@ -41,22 +41,6 @@
>>          };
>>      };
>>
>> -    gpio-export {
>> -        compatible = "gpio-export";
>> -
>> -        gpio_shift_register_oe {
>> -            gpio-export,name = "tp-link:oe:sr";
>> -            gpio-export,output = <0>;
>> -            gpios = <&gpio 1 GPIO_ACTIVE_LOW>;    // 74HC595 /OE (Output
>> Enable)
>> -        };
>> -
>> -        gpio_shift_register_reset {
>> -            gpio-export,name = "tp-link:reset:sr";
>> -            gpio-export,output = <1>;
>> -            gpios = <&gpio 21 GPIO_ACTIVE_LOW>;    // 74HC595 /SRCLR (Serial
>> Clear)
>> -        };
>> -    };
>> -
>>      leds {
>>          compatible = "gpio-leds";
>>
>> @@ -148,15 +132,29 @@
>>
>>  };
>>
>> -&pcie {
>> +&gpio {
>>      status = "okay";
>> +
>> +    sr {
>> +        gpio-hog;
>> +        line-name = "tp-link:oe:sr";
>> +        gpios = <1 GPIO_ACTIVE_LOW>;
>> +        output-low;
>> +    };
>> +
>> +    sr {
>> +        gpio-hog;
>> +        line-name = "tp-link:reset:sr";
>> +        gpios = <21 GPIO_ACTIVE_LOW>;
>> +        output-high;
>> +    };
>>  };
> Same here.
>
> Rest looks good, I haven't checked for duplicate &gpio definitions (you seem to have addressed some).
>
> Best
>
> Adrian
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list