openwrt/target/linux/ramips
Ilya Katsnelson bb4d5006c0 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]: 05d6e92594/target/linux/ramips/patches-4.4/0009-PCI-MIPS-adds-mt7620a-pcie-driver.patch (L259)
[1]: 026d15f6b9/arch/mips/pci/pci-mt7620.c (L246)
[2]: http://www.anz.ru/files/mediatek/MT7620_ProgrammingGuide.pdf
[3]: 026d15f6b9/arch/mips/pci/pci-mt7620.c (L36)
[4]: 026d15f6b9/arch/mips/pci/pci-mt7620.c (L39)

Signed-off-by: Ilya Katsnelson <me@0upti.me>
2017-07-31 21:28:37 +02:00
..
base-files ramips: Archer C50v1: fix power led 2017-07-29 12:06:35 +02:00
dts ramips: Archer C50v1: fix power led 2017-07-29 12:06:35 +02:00
files-4.9/drivers/net/ethernet/mtk ramips: add jumbo frame support for v4.9 2017-06-01 12:30:17 +02:00
image ramips: fix Mercury MAC1200R v2.0 board name 2017-07-29 09:24:32 +02:00
mt7620 ramips: drop stray kernel 4.4 configs 2017-07-27 09:17:25 +02:00
mt7621 ramips: drop stray kernel 4.4 configs 2017-07-27 09:17:25 +02:00
mt7628 ramips: drop stray kernel 4.4 configs 2017-07-27 09:17:25 +02:00
mt7688 ramips: drop stray kernel 4.4 configs 2017-07-27 09:17:25 +02:00
patches-4.9 ramips: fix PCI init on MT7620 with Linux 4.9+ 2017-07-31 21:28:37 +02:00
rt288x ramips: drop stray kernel 4.4 configs 2017-07-27 09:17:25 +02:00
rt305x ramips: drop stray kernel 4.4 configs 2017-07-27 09:17:25 +02:00
rt3883 ramips: drop stray kernel 4.4 configs 2017-07-27 09:17:25 +02:00
Makefile ramips: bump to v4.9 2017-07-06 06:37:03 +02:00
modules.mk ramips: sound-mt7620: fix dependencies for kernel 4.9 2017-07-07 07:56:24 +02:00