[LEDE-DEV] [PATCH 2/3] ramips-mt7621: add GPIO-config for Ubiquiti-EdgeRouterX(-SFP)

Gagan Sidhu broly at mac.com
Thu Mar 22 13:54:23 PDT 2018


hi guys,

sorry for bumping this thread, but i found Sven’s approach interesting.

in 4.x, it does not seem i can simply enable CONFIG_I2C_GPIO=y, add the i2c-gpio node:

>         i2c-gpio {
>         compatible = "i2c-gpio";
>         gpios = <&gpio0 3 0
>                  &gpio0 4 0>;
>                  #address-cells=<1>;
>                  #size-cells = <0>;
>             hwmon at 4b {
>                    compatible = "national, lm92";
>                    reg = <0x4b>;           
> 
>                 };
> 
>             rtc at 51 { 
>                    compatible = "nxp,pcf8563";
>                    reg = <0x51>;
>                    #clock-cells = <0>;
>                 };                                                                                                           
> 
> 
>         };


and modify the pinctrl node accordingly:

>         pinctrl {
>                 state_default: pinctrl0 {
>                         gpio {
>                                 ralink,group = "rgmii2", "uart2","uart3","wdt","i2c","jtag";
>                                 ralink,function = "gpio";
>                         };
>                 };
>         };
> 

in DIR882.dts (inherits from mt7621.dtsi), where i add “i2c-gpio” to the i2c entry in mt7621.dtsi as follows:

>   i2c: i2c at 900 {
>                         compatible = "i2c-gpio";
>                         reg = <0x900 0x100>;
> 
>                         clocks = <&sysclock>;
> 
>                         resets = <&rstctrl 16>;
>                         reset-names = "i2c";
> 
>                         #address-cells = <1>;
>                         #size-cells = <0>;
> 
>                         status = "disabled";
> 
>                         pinctrl-names = "default";
>                         pinctrl-0 = <&i2c_pins>;
> }

it does not work at all. 

i really want a functional rtc lol. 

my router is not connected to the internet so if the rtc can hold the time for a second after reset, that should be enough since resetting doesn’t cut power.

i spoke with Alexandre Belloni who has done a lot of work on the linux rtc, and he says we are missing the SDA/SDL PULLUP mechanism. this makes sense.

the question is: what needs work in order to have a fully functional rtc? as-is, i am only able to write to the clock but not able to read from it, which suggests i need to incorporate the SDA/SDL pins somehow.

any tips would be great.

Thanks,
Gagan







More information about the Lede-dev mailing list