001-4.22-01-MIPS-BCM63XX-drop-unused-and-broken-DSP-platform-dev.patch 5.8 KB

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