ac03e643b37a856923fa40dc54b67b852df16b45
[openwrt/staging/thess.git] /
1 From 51559154375fff4a94bbbc249fdd9248a80827b3 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Tue, 18 Dec 2018 10:19:02 +0100
4 Subject: [PATCH] MIPS: BCM63XX: drop unused and broken DSP platform device
5
6 Trying to register the DSP platform device results in a null pointer
7 access:
8
9 [ 0.124184] CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == 804e305c, ra == 804e6f20
10 [ 0.135208] Oops[#1]:
11 [ 0.137514] CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.87
12 ...
13 [ 0.197117] epc : 804e305c bcm63xx_dsp_register+0x80/0xa4
14 [ 0.202838] ra : 804e6f20 board_register_devices+0x258/0x390
15 ...
16
17 This happens because it tries to copy the passed platform data over the
18 platform_device's unpopulated platform_data.
19
20 Since this code has been broken since its submission, no driver was ever
21 submitted for it, and apparently nobody was using it, just remove it
22 instead of trying to fix it.
23
24 Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
25 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
26 ---
27 arch/mips/bcm63xx/Makefile | 6 +--
28 arch/mips/bcm63xx/boards/board_bcm963xx.c | 20 --------
29 arch/mips/bcm63xx/dev-dsp.c | 56 ----------------------
30 .../include/asm/mach-bcm63xx/bcm63xx_dev_dsp.h | 14 ------
31 .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 5 --
32 5 files changed, 3 insertions(+), 98 deletions(-)
33 delete mode 100644 arch/mips/bcm63xx/dev-dsp.c
34 delete mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_dsp.h
35
36 --- a/arch/mips/bcm63xx/Makefile
37 +++ b/arch/mips/bcm63xx/Makefile
38 @@ -1,8 +1,8 @@
39 # SPDX-License-Identifier: GPL-2.0
40 obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
41 - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
42 - dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \
43 - dev-wdt.o dev-usb-usbd.o
44 + setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \
45 + dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \
46 + dev-usb-usbd.o
47 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
48
49 obj-y += boards/
50 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
51 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
52 @@ -23,7 +23,6 @@
53 #include <bcm63xx_nvram.h>
54 #include <bcm63xx_dev_pci.h>
55 #include <bcm63xx_dev_enet.h>
56 -#include <bcm63xx_dev_dsp.h>
57 #include <bcm63xx_dev_flash.h>
58 #include <bcm63xx_dev_hsspi.h>
59 #include <bcm63xx_dev_pcmcia.h>
60 @@ -289,14 +288,6 @@ static struct board_info __initdata boar
61 .has_pccard = 1,
62 .has_ehci0 = 1,
63
64 - .has_dsp = 1,
65 - .dsp = {
66 - .gpio_rst = 6,
67 - .gpio_int = 34,
68 - .cs = 2,
69 - .ext_irq = 2,
70 - },
71 -
72 .leds = {
73 {
74 .name = "adsl-fail",
75 @@ -401,14 +392,6 @@ static struct board_info __initdata boar
76
77 .has_ohci0 = 1,
78
79 - .has_dsp = 1,
80 - .dsp = {
81 - .gpio_rst = 6,
82 - .gpio_int = 34,
83 - .ext_irq = 2,
84 - .cs = 2,
85 - },
86 -
87 .leds = {
88 {
89 .name = "adsl-fail",
90 @@ -898,9 +881,6 @@ int __init board_register_devices(void)
91 if (board.has_usbd)
92 bcm63xx_usbd_register(&board.usbd);
93
94 - if (board.has_dsp)
95 - bcm63xx_dsp_register(&board.dsp);
96 -
97 /* Generate MAC address for WLAN and register our SPROM,
98 * do this after registering enet devices
99 */
100 --- a/arch/mips/bcm63xx/dev-dsp.c
101 +++ /dev/null
102 @@ -1,56 +0,0 @@
103 -/*
104 - * Broadcom BCM63xx VoIP DSP registration
105 - *
106 - * This file is subject to the terms and conditions of the GNU General Public
107 - * License. See the file "COPYING" in the main directory of this archive
108 - * for more details.
109 - *
110 - * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
111 - */
112 -
113 -#include <linux/init.h>
114 -#include <linux/kernel.h>
115 -#include <linux/platform_device.h>
116 -
117 -#include <bcm63xx_cpu.h>
118 -#include <bcm63xx_dev_dsp.h>
119 -#include <bcm63xx_regs.h>
120 -#include <bcm63xx_io.h>
121 -
122 -static struct resource voip_dsp_resources[] = {
123 - {
124 - .start = -1, /* filled at runtime */
125 - .end = -1, /* filled at runtime */
126 - .flags = IORESOURCE_MEM,
127 - },
128 - {
129 - .start = -1, /* filled at runtime */
130 - .flags = IORESOURCE_IRQ,
131 - },
132 -};
133 -
134 -static struct platform_device bcm63xx_voip_dsp_device = {
135 - .name = "bcm63xx-voip-dsp",
136 - .id = -1,
137 - .num_resources = ARRAY_SIZE(voip_dsp_resources),
138 - .resource = voip_dsp_resources,
139 -};
140 -
141 -int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd)
142 -{
143 - struct bcm63xx_dsp_platform_data *dpd;
144 - u32 val;
145 -
146 - /* Get the memory window */
147 - val = bcm_mpi_readl(MPI_CSBASE_REG(pd->cs - 1));
148 - val &= MPI_CSBASE_BASE_MASK;
149 - voip_dsp_resources[0].start = val;
150 - voip_dsp_resources[0].end = val + 0xFFFFFFF;
151 - voip_dsp_resources[1].start = pd->ext_irq;
152 -
153 - /* copy given platform data */
154 - dpd = bcm63xx_voip_dsp_device.dev.platform_data;
155 - memcpy(dpd, pd, sizeof (*pd));
156 -
157 - return platform_device_register(&bcm63xx_voip_dsp_device);
158 -}
159 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_dsp.h
160 +++ /dev/null
161 @@ -1,14 +0,0 @@
162 -/* SPDX-License-Identifier: GPL-2.0 */
163 -#ifndef __BCM63XX_DSP_H
164 -#define __BCM63XX_DSP_H
165 -
166 -struct bcm63xx_dsp_platform_data {
167 - unsigned gpio_rst;
168 - unsigned gpio_int;
169 - unsigned cs;
170 - unsigned ext_irq;
171 -};
172 -
173 -int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd);
174 -
175 -#endif /* __BCM63XX_DSP_H */
176 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
177 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
178 @@ -7,7 +7,6 @@
179 #include <linux/leds.h>
180 #include <bcm63xx_dev_enet.h>
181 #include <bcm63xx_dev_usb_usbd.h>
182 -#include <bcm63xx_dev_dsp.h>
183
184 /*
185 * flash mapping
186 @@ -31,7 +30,6 @@ struct board_info {
187 unsigned int has_ohci0:1;
188 unsigned int has_ehci0:1;
189 unsigned int has_usbd:1;
190 - unsigned int has_dsp:1;
191 unsigned int has_uart0:1;
192 unsigned int has_uart1:1;
193
194 @@ -43,9 +41,6 @@ struct board_info {
195 /* USB config */
196 struct bcm63xx_usbd_platform_data usbd;
197
198 - /* DSP config */
199 - struct bcm63xx_dsp_platform_data dsp;
200 -
201 /* GPIO LEDs */
202 struct gpio_led leds[5];
203