16a22e1fa62c2f7cb9561c94b2fb9d0d0ecedbc9
[openwrt/staging/ynezz.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,7 +1,7 @@
39 obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
40 - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
41 - dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \
42 - dev-wdt.o dev-usb-usbd.o
43 + setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \
44 + dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \
45 + dev-usb-usbd.o
46 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
47
48 obj-y += boards/
49 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
50 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
51 @@ -23,7 +23,6 @@
52 #include <bcm63xx_nvram.h>
53 #include <bcm63xx_dev_pci.h>
54 #include <bcm63xx_dev_enet.h>
55 -#include <bcm63xx_dev_dsp.h>
56 #include <bcm63xx_dev_flash.h>
57 #include <bcm63xx_dev_hsspi.h>
58 #include <bcm63xx_dev_pcmcia.h>
59 @@ -289,14 +288,6 @@ static struct board_info __initdata boar
60 .has_pccard = 1,
61 .has_ehci0 = 1,
62
63 - .has_dsp = 1,
64 - .dsp = {
65 - .gpio_rst = 6,
66 - .gpio_int = 34,
67 - .cs = 2,
68 - .ext_irq = 2,
69 - },
70 -
71 .leds = {
72 {
73 .name = "adsl-fail",
74 @@ -401,14 +392,6 @@ static struct board_info __initdata boar
75
76 .has_ohci0 = 1,
77
78 - .has_dsp = 1,
79 - .dsp = {
80 - .gpio_rst = 6,
81 - .gpio_int = 34,
82 - .ext_irq = 2,
83 - .cs = 2,
84 - },
85 -
86 .leds = {
87 {
88 .name = "adsl-fail",
89 @@ -898,9 +881,6 @@ int __init board_register_devices(void)
90 if (board.has_usbd)
91 bcm63xx_usbd_register(&board.usbd);
92
93 - if (board.has_dsp)
94 - bcm63xx_dsp_register(&board.dsp);
95 -
96 /* Generate MAC address for WLAN and register our SPROM,
97 * do this after registering enet devices
98 */
99 --- a/arch/mips/bcm63xx/dev-dsp.c
100 +++ /dev/null
101 @@ -1,56 +0,0 @@
102 -/*
103 - * Broadcom BCM63xx VoIP DSP registration
104 - *
105 - * This file is subject to the terms and conditions of the GNU General Public
106 - * License. See the file "COPYING" in the main directory of this archive
107 - * for more details.
108 - *
109 - * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
110 - */
111 -
112 -#include <linux/init.h>
113 -#include <linux/kernel.h>
114 -#include <linux/platform_device.h>
115 -
116 -#include <bcm63xx_cpu.h>
117 -#include <bcm63xx_dev_dsp.h>
118 -#include <bcm63xx_regs.h>
119 -#include <bcm63xx_io.h>
120 -
121 -static struct resource voip_dsp_resources[] = {
122 - {
123 - .start = -1, /* filled at runtime */
124 - .end = -1, /* filled at runtime */
125 - .flags = IORESOURCE_MEM,
126 - },
127 - {
128 - .start = -1, /* filled at runtime */
129 - .flags = IORESOURCE_IRQ,
130 - },
131 -};
132 -
133 -static struct platform_device bcm63xx_voip_dsp_device = {
134 - .name = "bcm63xx-voip-dsp",
135 - .id = -1,
136 - .num_resources = ARRAY_SIZE(voip_dsp_resources),
137 - .resource = voip_dsp_resources,
138 -};
139 -
140 -int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd)
141 -{
142 - struct bcm63xx_dsp_platform_data *dpd;
143 - u32 val;
144 -
145 - /* Get the memory window */
146 - val = bcm_mpi_readl(MPI_CSBASE_REG(pd->cs - 1));
147 - val &= MPI_CSBASE_BASE_MASK;
148 - voip_dsp_resources[0].start = val;
149 - voip_dsp_resources[0].end = val + 0xFFFFFFF;
150 - voip_dsp_resources[1].start = pd->ext_irq;
151 -
152 - /* copy given platform data */
153 - dpd = bcm63xx_voip_dsp_device.dev.platform_data;
154 - memcpy(dpd, pd, sizeof (*pd));
155 -
156 - return platform_device_register(&bcm63xx_voip_dsp_device);
157 -}
158 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_dsp.h
159 +++ /dev/null
160 @@ -1,13 +0,0 @@
161 -#ifndef __BCM63XX_DSP_H
162 -#define __BCM63XX_DSP_H
163 -
164 -struct bcm63xx_dsp_platform_data {
165 - unsigned gpio_rst;
166 - unsigned gpio_int;
167 - unsigned cs;
168 - unsigned ext_irq;
169 -};
170 -
171 -int __init bcm63xx_dsp_register(const struct bcm63xx_dsp_platform_data *pd);
172 -
173 -#endif /* __BCM63XX_DSP_H */
174 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
175 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
176 @@ -6,7 +6,6 @@
177 #include <linux/leds.h>
178 #include <bcm63xx_dev_enet.h>
179 #include <bcm63xx_dev_usb_usbd.h>
180 -#include <bcm63xx_dev_dsp.h>
181
182 /*
183 * flash mapping
184 @@ -30,7 +29,6 @@ struct board_info {
185 unsigned int has_ohci0:1;
186 unsigned int has_ehci0:1;
187 unsigned int has_usbd:1;
188 - unsigned int has_dsp:1;
189 unsigned int has_uart0:1;
190 unsigned int has_uart1:1;
191
192 @@ -42,9 +40,6 @@ struct board_info {
193 /* USB config */
194 struct bcm63xx_usbd_platform_data usbd;
195
196 - /* DSP config */
197 - struct bcm63xx_dsp_platform_data dsp;
198 -
199 /* GPIO LEDs */
200 struct gpio_led leds[5];
201