On Wed, Nov 13, 2019 at 9:54 PM René van Dorst <opensource@xxxxxxxxxx> wrote: > mt7621 used bgpio_set_with_clear() because we have `set` and `clear` > registers. (...) > It seems that writing to the 'clear' register doesn't do anything. > I noticed that register address is 0x1e000000 in the DTS but in the > code it is 0xbe000000. Do you mean physical memory 0x1e000000 gets remapped at virtual memory 0xbe000000? > [ 3.158002] bgpio_write32: 0xbe000600 <= 0x80 > [ 3.165258] GPIO line 487 (sfp_i2c_clk_gate) hogged as output/high > [ 3.177532] gpiochip_add_data_with_key: gpiochip0 gpio7: 0x843 > > When using program 'io' writing to the `clear` register 0x1e000640 > does have effect. > > root@OpenWrt:/# io -4 0x1e000620 > 1e000620: 0b75f7de > root@OpenWrt:/# io -4 -w 0x1e000640 0x80 > root@OpenWrt:/# io -4 0x1e000620 > 1e000620: 0b75f74e (...) > If I change the bgpio_init() values so that we don't have the `set` > and `clear` registers. > With the patch below I do get right results. That's weird! > Any idea what this can be? Try to pass the flag BGPIOF_UNREADABLE_REG_SET, it seems the code is using the set register to read back the value. In this case it is actually working you just don't see it in debugfs. Cc:ed Sergio maybe he has some ideas. It seems to be hardware related then, hm. Yours, Linus Walleij