Page MenuHomeFreeBSD

mvebu_gpio: fix interrupt cause register configuration
ClosedPublic

Authored by mw on Mar 2 2021, 4:10 PM.

Details

Summary

According to Armada 7k/8k/CN913x documentation, the interrupt cause register
(at offset 0x14) is RW0C. Update the configuration in attach and
the mvebu_gpio_isrc_eoi() to follow the description.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Oops. Thanks for fixing my bugs ...

This revision is now accepted and ready to land.Mar 2 2021, 7:24 PM

Noooo, Im stupid :( The root of the problem is trivial -> gpio_write() doesn't modify only the required bit, but the whole 32-bit register. HW init should use new gpio_modify() (implemented with SYSCON_MODIFY_4() not SYSCON_WRITE_4()). Big big sorry for troubles. I'll fix it tomorrow.

In D29013#649762, @mmel wrote:

Noooo, Im stupid :( The root of the problem is trivial -> gpio_write() doesn't modify only the required bit, but the whole 32-bit register. HW init should use new gpio_modify() (implemented with SYSCON_MODIFY_4() not SYSCON_WRITE_4()). Big big sorry for troubles. I'll fix it tomorrow.

@mmel Did you do anything with that? Locally I have a local fix that I can merge upstream. Not only was the SYSCON_WRITE vs MODIFY issue, but also in gpio write the mask configuration is wrong. If you're ok, I can push it - please let know.

I have initial part of this fixup. It should allow board to boot, at minimum. Unfortunately , the interrupt handling have still locking problem -> the solution needs change in syscon provided by simple_mfd driver -> so i need more time for this (one or two days).
But it would be nice if you can test this in your environment. It should fix hang-up issue in pcie driver.
What an ignominy...

https://github.com/strejda/freebsd/commit/b7756af37ddbb45c9c0ac421ac896c16d36b9eac

In D29013#650253, @mmel wrote:

I have initial part of this fixup. It should allow board to boot, at minimum. Unfortunately , the interrupt handling have still locking problem -> the solution needs change in syscon provided by simple_mfd driver -> so i need more time for this (one or two days).
But it would be nice if you can test this in your environment. It should fix hang-up issue in pcie driver.
What an ignominy...

https://github.com/strejda/freebsd/commit/b7756af37ddbb45c9c0ac421ac896c16d36b9eac

How about splitting the gpio_write fix and the irq repair?
I have almost the same code for gpio_modify (however my name was gpio_update - I can align to yours). IMO we should replace all occurences of gpio_write. You left gpio_write as-is in many places, which is IMO wrong.

I tested my patch on MacchiatoBin, Armada-7040-DB, Armada-8040-DB and CN9132-DB - all strange boot hangs with DT disappeared.
Frankly I'd commit the update part asap (you'd be able to rebase on top with the irq stuff) and hope re@ accepts MFC to 13, as in current shape all boards will remain broken with the new release for this kind of boot.