You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openwrt/target/linux/generic
Koen Vandeputte 6835c13e5a cns3xxx: fix writing to wrong PCI registers
Originally, cns3xxx used it's own functions for mapping, reading and writing registers.

Upstream commit 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors")
removed the internal PCI config write function in favor of the generic one:

cns3xxx_pci_write_config() --> pci_generic_config_write()

cns3xxx_pci_write_config() expected aligned addresses, being produced by cns3xxx_pci_map_bus()
while the generic one pci_generic_config_write() actually expects the real address
as both the function and hardware are capable of byte-aligned writes.

This currently leads to pci_generic_config_write() writing
to the wrong registers on some ocasions.

First issue seen due to this:

- driver ath9k gets loaded
- The driver wants to write value 0xA8 to register PCI_LATENCY_TIMER, located at 0x0D
- cns3xxx_pci_map_bus() aligns the address to 0x0C
- pci_generic_config_write() effectively writes 0xA8 into register 0x0C (CACHE_LINE_SIZE)

This seems to cause some slight instability when certain PCI devices are used.

Another issue example caused by this this is the PCI bus numbering,
where the primary bus is higher than the secondary, which is impossible.

Before:

00:00.0 PCI bridge: Cavium, Inc. Device 3400 (rev 01) (prog-if 00 [Normal decode])
    Flags: bus master, fast devsel, latency 0, IRQ 255
    Bus: primary=02, secondary=01, subordinate=ff, sec-latency=0

After fix:

00:00.0 PCI bridge: Cavium, Inc. Device 3400 (rev 01) (prog-if 00 [Normal decode])
    Flags: bus master, fast devsel, latency 0, IRQ 255
    Bus: primary=00, secondary=01, subordinate=02, sec-latency=0

And very likely some more ..

Fix all by omitting the alignment being done in the mapping function.

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
..
backport-4.9 cns3xxx: fix writing to wrong PCI registers 6 years ago
backport-4.14 cns3xxx: fix writing to wrong PCI registers 6 years ago
backport-4.19 cns3xxx: fix writing to wrong PCI registers 6 years ago
files kernel: add DT binding support to the fit parser 6 years ago
hack-4.9 kernel: Move modifications of b53.h into patch 6 years ago
hack-4.14 kernel: Move modifications of b53.h into patch 6 years ago
hack-4.19 kernel: Make CONFIG_NVMEM tristate 6 years ago
image treewide: replace nbd@openwrt.org with nbd@nbd.name 8 years ago
other-files kernel: move initramfs's init script out of base-files 7 years ago
pending-3.18 kernel: bump 3.18 to 3.18.130 6 years ago
pending-4.9 kernel: Replace ledtrig-netdev with upstream backport 6 years ago
pending-4.14 kernel: bump 4.14 to 4.14.89 6 years ago
pending-4.19 jffs2: Fix use of uninitialized delayed_work, lockdep breakage 6 years ago
PATCHES kernel: update PATCHES with a stricter policy 11 years ago
config-3.18 kernel: enable memory compaction 6 years ago
config-4.9 kernel: Reorder configuration 6 years ago
config-4.14 netfilter: Add fib support for nftables 6 years ago
config-4.19 netfilter: Add fib support for nftables 6 years ago