linux/arch/mips
Rafał Miłecki 321c46b915
MIPS: BCM47XX: Setup struct device for the SoC
So far we never had any device registered for the SoC. This resulted in
some small issues that we kept ignoring like:
1) Not working GPIOLIB_IRQCHIP (gpiochip_irqchip_add_key() failing)
2) Lack of proper tree in the /sys/devices/
3) mips_dma_alloc_coherent() silently handling empty coherent_dma_mask

Kernel 4.19 came with a lot of DMA changes and caused a regression on
bcm47xx. Starting with the commit f8c55dc6e8 ("MIPS: use generic dma
noncoherent ops for simple noncoherent platforms") DMA coherent
allocations just fail. Example:
[    1.114914] bgmac_bcma bcma0:2: Allocation of TX ring 0x200 failed
[    1.121215] bgmac_bcma bcma0:2: Unable to alloc memory for DMA
[    1.127626] bgmac_bcma: probe of bcma0:2 failed with error -12
[    1.133838] bgmac_bcma: Broadcom 47xx GBit MAC driver loaded

The bgmac driver also triggers a WARNING:
[    0.959486] ------------[ cut here ]------------
[    0.964387] WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 bgmac_enet_probe+0x1b4/0x5c4
[    0.973751] Modules linked in:
[    0.976913] CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.9 #0
[    0.982750] Stack : 804a0000 804597c4 00000000 00000000 80458fd8 8381bc2c 838282d4 80481a47
[    0.991367]         8042e3ec 00000001 804d38f0 00000204 83980000 00000065 8381bbe0 6f55b24f
[    0.999975]         00000000 00000000 80520000 00002018 00000000 00000075 00000007 00000000
[    1.008583]         00000000 80480000 000ee811 00000000 00000000 00000000 80432c00 80248db8
[    1.017196]         00000009 00000204 83980000 803ad7b0 00000000 801feeec 00000000 804d0000
[    1.025804]         ...
[    1.028325] Call Trace:
[    1.030875] [<8000aef8>] show_stack+0x58/0x100
[    1.035513] [<8001f8b4>] __warn+0xe4/0x118
[    1.039708] [<8001f9a4>] warn_slowpath_null+0x48/0x64
[    1.044935] [<80248db8>] bgmac_enet_probe+0x1b4/0x5c4
[    1.050101] [<802498e0>] bgmac_probe+0x558/0x590
[    1.054906] [<80252fd0>] bcma_device_probe+0x38/0x70
[    1.060017] [<8020e1e8>] really_probe+0x170/0x2e8
[    1.064891] [<8020e714>] __driver_attach+0xa4/0xec
[    1.069784] [<8020c1e0>] bus_for_each_dev+0x58/0xb0
[    1.074833] [<8020d590>] bus_add_driver+0xf8/0x218
[    1.079731] [<8020ef24>] driver_register+0xcc/0x11c
[    1.084804] [<804b54cc>] bgmac_init+0x1c/0x44
[    1.089258] [<8000121c>] do_one_initcall+0x7c/0x1a0
[    1.094343] [<804a1d34>] kernel_init_freeable+0x150/0x218
[    1.099886] [<803a082c>] kernel_init+0x10/0x104
[    1.104583] [<80005878>] ret_from_kernel_thread+0x14/0x1c
[    1.110107] ---[ end trace f441c0d873d1fb5b ]---

This patch setups a "struct device" (and passes it to the bcma) which
allows fixing all the mentioned problems. It'll also require a tiny bcma
patch which will follow through the wireless tree & its maintainer.

Fixes: f8c55dc6e8 ("MIPS: use generic dma noncoherent ops for simple noncoherent platforms")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-wireless@vger.kernel.org
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org # v4.19+
2019-01-09 13:21:02 -08:00
..
alchemy A few early MIPS fixes for 4.21: 2019-01-05 12:48:25 -08:00
ar7 mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
ath25 PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
ath79 PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
bcm47xx MIPS: BCM47XX: Setup struct device for the SoC 2019-01-09 13:21:02 -08:00
bcm63xx A few early MIPS fixes for 4.21: 2019-01-05 12:48:25 -08:00
bmips mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
boot MIPS: malta: Use img-ascii-lcd driver for LCD display 2018-11-20 21:05:39 -08:00
cavium-octeon A few early MIPS fixes for 4.21: 2019-01-05 12:48:25 -08:00
cobalt
configs MIPS: ath79: Enable OF serial ports in the default config 2019-01-07 13:39:06 -08:00
crypto
dec mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
emma mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
fw mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
generic MIPS: mscc: add PCB120 to the ocelot fitImage 2018-10-09 10:38:29 -07:00
include MIPS: lantiq: Use CP0_LEGACY_COMPARE_IRQ 2019-01-07 13:38:35 -08:00
jazz MIPS: jazz: fix 64bit build 2019-01-09 13:14:34 -08:00
jz4740 mmc: jz4740: Use GPIO descriptor for power 2018-12-17 08:26:24 +01:00
kernel jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00
kvm Kconfig updates for v4.21 2018-12-29 13:03:29 -08:00
lantiq MIPS: lantiq: Use CP0_LEGACY_COMPARE_IRQ 2019-01-07 13:38:35 -08:00
lasat mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
lib MIPS: lib: Use kernel_pref & user_pref in memcpy() 2018-10-15 23:11:14 -07:00
loongson32 MIPS: Loongson: Merge load addresses 2018-07-30 18:59:01 -07:00
loongson64 Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
math-emu Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
mm Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
mti-malta MIPS: malta: Use img-ascii-lcd driver for LCD display 2018-11-20 21:05:39 -08:00
net mips: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_X 2018-12-07 13:30:48 -08:00
netlogic mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
oprofile Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
paravirt mips: unify prom_putchar() declarations 2018-07-17 09:40:17 -07:00
pci MIPS: Use device_type helpers to access the node type 2018-11-19 11:04:38 -08:00
pic32 mips: unify prom_putchar() declarations 2018-07-17 09:40:17 -07:00
pistachio
pmcs-msp71xx PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
pnx833x mtd: rawnand: Move platform_nand_xxx definitions out of rawnand.h 2018-10-03 11:12:25 +02:00
power
ralink A few early MIPS fixes for 4.21: 2019-01-05 12:48:25 -08:00
rb532 ata: rb532_cf: Convert to use GPIO descriptors 2018-12-04 17:15:25 -07:00
sgi-ip22 MIPS: Remove no-op/identity casts 2018-08-31 11:49:20 -07:00
sgi-ip27 MIPS: Loongson3,SGI-IP27: Simplify max_low_pfn calculation 2018-11-15 15:42:15 -08:00
sgi-ip32 MIPS: IP32: use generic dma noncoherent ops 2018-06-24 09:27:27 -07:00
sibyte Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
sni
tools MIPS: Use a custom elf-entry program to find kernel entry point 2018-08-30 09:39:22 -07:00
txx9 PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
vdso MIPS: Enable Undefined Behavior Sanitizer UBSAN 2018-11-20 12:23:06 -08:00
vr41xx PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
Kbuild
Kbuild.platforms
Kconfig Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Makefile mips: generate uapi header and system call table files 2018-12-14 11:19:02 -08:00
Makefile.postlink