diff options
author | Ilya Katsnelson <me@0upti.me> | 2017-07-09 11:24:58 +0300 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2017-07-31 21:28:37 +0200 |
commit | bb4d5006c0111bd49c0870f6d668ef295bf68681 (patch) | |
tree | 3c73db2b889dc3d7c3f76e0519aa14158c5ba233 /target/linux/pistachio | |
parent | d0fb048b0e978a6081e146a7360910a98f1baec6 (diff) | |
download | upstream-bb4d5006c0111bd49c0870f6d668ef295bf68681.tar.gz upstream-bb4d5006c0111bd49c0870f6d668ef295bf68681.tar.bz2 upstream-bb4d5006c0111bd49c0870f6d668ef295bf68681.zip |
ramips: fix PCI init on MT7620 with Linux 4.9+
So, this is kind of complicated. This has been upstream for a while,
imported from OpenWRT/LEDE with some cleanups. LEDE ramips has stayed
on linux-4.4 this whole time, with the old(er) version of the patch
that had correct behavior[0], while upstream got changed[1].
When LEDE updated to kernel 4.9, the older version of the code from
the patch got replaced with the upstream version containing the bug.
The original behavior, however, seems to be correct here, as the
official programming guide[2] indicates that bit 31 (PDRV_SW_SET)
in register PPLL_CFG1 is reserved, but bit 23 (added as PPLL_LD)
is the PPLL lock state (which also happens to line up with the
error message).
The original confusion probably comes from the double definition
of PDRV_SW_SET[3, 4] in the upstream code, with one correct definition
(31) and one incorrect one (23).
I've also used the opportunity to clean up the error message a bit -
it's still not really helpful to anyone who doesn't already know what
the PPLL is, but at least it's slightly more readable now.
This will probably need to be upstreamed as well, since with the way
it's currently set up, it's unlikely PCI ever worked for anyone who's
running an upstream kernel on that SoC.
[0]: https://github.com/lede-project/source/blob/05d6e92594c507dcd1f4be6c1bcb2282fe1abe1f/target/linux/ramips/patches-4.4/0009-PCI-MIPS-adds-mt7620a-pcie-driver.patch#L259
[1]: https://github.com/torvalds/linux/blob/026d15f6b9878794fae1f794cae881ccd65052e5/arch/mips/pci/pci-mt7620.c#L246
[2]: http://www.anz.ru/files/mediatek/MT7620_ProgrammingGuide.pdf
[3]: https://github.com/torvalds/linux/blob/026d15f6b9878794fae1f794cae881ccd65052e5/arch/mips/pci/pci-mt7620.c#L36
[4]: https://github.com/torvalds/linux/blob/026d15f6b9878794fae1f794cae881ccd65052e5/arch/mips/pci/pci-mt7620.c#L39
Signed-off-by: Ilya Katsnelson <me@0upti.me>
Diffstat (limited to 'target/linux/pistachio')
0 files changed, 0 insertions, 0 deletions