0030-MIPS-ath79-drop-platform-device-registration-code.patch 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. From dce930fba8ad3a90ccd164f199e57c2d61937ccd Mon Sep 17 00:00:00 2001
  2. From: John Crispin <john@phrozen.org>
  3. Date: Sat, 23 Jun 2018 15:12:38 +0200
  4. Subject: [PATCH 30/33] MIPS: ath79: drop platform device registration code
  5. With the target now being fully OF based, we can drop the legacy platform
  6. device registration code. All devices and their drivers are now probed
  7. via OF.
  8. Signed-off-by: John Crispin <john@phrozen.org>
  9. ---
  10. arch/mips/ath79/Makefile | 10 --
  11. arch/mips/ath79/common.h | 2 -
  12. arch/mips/ath79/dev-common.c | 159 ------------------------
  13. arch/mips/ath79/dev-common.h | 18 ---
  14. arch/mips/ath79/dev-gpio-buttons.c | 56 ---------
  15. arch/mips/ath79/dev-gpio-buttons.h | 23 ----
  16. arch/mips/ath79/dev-leds-gpio.c | 54 ---------
  17. arch/mips/ath79/dev-leds-gpio.h | 21 ----
  18. arch/mips/ath79/dev-spi.c | 38 ------
  19. arch/mips/ath79/dev-spi.h | 22 ----
  20. arch/mips/ath79/dev-usb.c | 242 -------------------------------------
  21. arch/mips/ath79/dev-usb.h | 17 ---
  22. arch/mips/ath79/dev-wmac.c | 155 ------------------------
  23. arch/mips/ath79/dev-wmac.h | 17 ---
  24. arch/mips/ath79/setup.c | 1 -
  25. 15 files changed, 835 deletions(-)
  26. delete mode 100644 arch/mips/ath79/dev-common.c
  27. delete mode 100644 arch/mips/ath79/dev-common.h
  28. delete mode 100644 arch/mips/ath79/dev-gpio-buttons.c
  29. delete mode 100644 arch/mips/ath79/dev-gpio-buttons.h
  30. delete mode 100644 arch/mips/ath79/dev-leds-gpio.c
  31. delete mode 100644 arch/mips/ath79/dev-leds-gpio.h
  32. delete mode 100644 arch/mips/ath79/dev-spi.c
  33. delete mode 100644 arch/mips/ath79/dev-spi.h
  34. delete mode 100644 arch/mips/ath79/dev-usb.c
  35. delete mode 100644 arch/mips/ath79/dev-usb.h
  36. delete mode 100644 arch/mips/ath79/dev-wmac.c
  37. delete mode 100644 arch/mips/ath79/dev-wmac.h
  38. --- a/arch/mips/ath79/Makefile
  39. +++ b/arch/mips/ath79/Makefile
  40. @@ -11,13 +11,3 @@
  41. obj-y := prom.o setup.o common.o clock.o
  42. obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
  43. -
  44. -#
  45. -# Devices
  46. -#
  47. -obj-y += dev-common.o
  48. -obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o
  49. -obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev-leds-gpio.o
  50. -obj-$(CONFIG_ATH79_DEV_SPI) += dev-spi.o
  51. -obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.o
  52. -obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wmac.o
  53. --- a/arch/mips/ath79/common.h
  54. +++ b/arch/mips/ath79/common.h
  55. @@ -24,6 +24,4 @@ unsigned long ath79_get_sys_clk_rate(con
  56. void ath79_ddr_ctrl_init(void);
  57. -void ath79_gpio_init(void);
  58. -
  59. #endif /* __ATH79_COMMON_H */
  60. --- a/arch/mips/ath79/dev-common.c
  61. +++ /dev/null
  62. @@ -1,159 +0,0 @@
  63. -/*
  64. - * Atheros AR71XX/AR724X/AR913X common devices
  65. - *
  66. - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
  67. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  68. - *
  69. - * Parts of this file are based on Atheros' 2.6.15 BSP
  70. - *
  71. - * This program is free software; you can redistribute it and/or modify it
  72. - * under the terms of the GNU General Public License version 2 as published
  73. - * by the Free Software Foundation.
  74. - */
  75. -
  76. -#include <linux/kernel.h>
  77. -#include <linux/init.h>
  78. -#include <linux/platform_device.h>
  79. -#include <linux/platform_data/gpio-ath79.h>
  80. -#include <linux/serial_8250.h>
  81. -#include <linux/clk.h>
  82. -#include <linux/err.h>
  83. -
  84. -#include <asm/mach-ath79/ath79.h>
  85. -#include <asm/mach-ath79/ar71xx_regs.h>
  86. -#include "common.h"
  87. -#include "dev-common.h"
  88. -
  89. -static struct resource ath79_uart_resources[] = {
  90. - {
  91. - .start = AR71XX_UART_BASE,
  92. - .end = AR71XX_UART_BASE + AR71XX_UART_SIZE - 1,
  93. - .flags = IORESOURCE_MEM,
  94. - },
  95. -};
  96. -
  97. -#define AR71XX_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
  98. -static struct plat_serial8250_port ath79_uart_data[] = {
  99. - {
  100. - .mapbase = AR71XX_UART_BASE,
  101. - .irq = ATH79_MISC_IRQ(3),
  102. - .flags = AR71XX_UART_FLAGS,
  103. - .iotype = UPIO_MEM32,
  104. - .regshift = 2,
  105. - }, {
  106. - /* terminating entry */
  107. - }
  108. -};
  109. -
  110. -static struct platform_device ath79_uart_device = {
  111. - .name = "serial8250",
  112. - .id = PLAT8250_DEV_PLATFORM,
  113. - .resource = ath79_uart_resources,
  114. - .num_resources = ARRAY_SIZE(ath79_uart_resources),
  115. - .dev = {
  116. - .platform_data = ath79_uart_data
  117. - },
  118. -};
  119. -
  120. -static struct resource ar933x_uart_resources[] = {
  121. - {
  122. - .start = AR933X_UART_BASE,
  123. - .end = AR933X_UART_BASE + AR71XX_UART_SIZE - 1,
  124. - .flags = IORESOURCE_MEM,
  125. - },
  126. - {
  127. - .start = ATH79_MISC_IRQ(3),
  128. - .end = ATH79_MISC_IRQ(3),
  129. - .flags = IORESOURCE_IRQ,
  130. - },
  131. -};
  132. -
  133. -static struct platform_device ar933x_uart_device = {
  134. - .name = "ar933x-uart",
  135. - .id = -1,
  136. - .resource = ar933x_uart_resources,
  137. - .num_resources = ARRAY_SIZE(ar933x_uart_resources),
  138. -};
  139. -
  140. -void __init ath79_register_uart(void)
  141. -{
  142. - unsigned long uart_clk_rate;
  143. -
  144. - uart_clk_rate = ath79_get_sys_clk_rate("uart");
  145. -
  146. - if (soc_is_ar71xx() ||
  147. - soc_is_ar724x() ||
  148. - soc_is_ar913x() ||
  149. - soc_is_ar934x() ||
  150. - soc_is_qca955x()) {
  151. - ath79_uart_data[0].uartclk = uart_clk_rate;
  152. - platform_device_register(&ath79_uart_device);
  153. - } else if (soc_is_ar933x()) {
  154. - platform_device_register(&ar933x_uart_device);
  155. - } else {
  156. - BUG();
  157. - }
  158. -}
  159. -
  160. -void __init ath79_register_wdt(void)
  161. -{
  162. - struct resource res;
  163. -
  164. - memset(&res, 0, sizeof(res));
  165. -
  166. - res.flags = IORESOURCE_MEM;
  167. - res.start = AR71XX_RESET_BASE + AR71XX_RESET_REG_WDOG_CTRL;
  168. - res.end = res.start + 0x8 - 1;
  169. -
  170. - platform_device_register_simple("ath79-wdt", -1, &res, 1);
  171. -}
  172. -
  173. -static struct ath79_gpio_platform_data ath79_gpio_pdata;
  174. -
  175. -static struct resource ath79_gpio_resources[] = {
  176. - {
  177. - .flags = IORESOURCE_MEM,
  178. - .start = AR71XX_GPIO_BASE,
  179. - .end = AR71XX_GPIO_BASE + AR71XX_GPIO_SIZE - 1,
  180. - },
  181. - {
  182. - .start = ATH79_MISC_IRQ(2),
  183. - .end = ATH79_MISC_IRQ(2),
  184. - .flags = IORESOURCE_IRQ,
  185. - },
  186. -};
  187. -
  188. -static struct platform_device ath79_gpio_device = {
  189. - .name = "ath79-gpio",
  190. - .id = -1,
  191. - .resource = ath79_gpio_resources,
  192. - .num_resources = ARRAY_SIZE(ath79_gpio_resources),
  193. - .dev = {
  194. - .platform_data = &ath79_gpio_pdata
  195. - },
  196. -};
  197. -
  198. -void __init ath79_gpio_init(void)
  199. -{
  200. - if (soc_is_ar71xx()) {
  201. - ath79_gpio_pdata.ngpios = AR71XX_GPIO_COUNT;
  202. - } else if (soc_is_ar7240()) {
  203. - ath79_gpio_pdata.ngpios = AR7240_GPIO_COUNT;
  204. - } else if (soc_is_ar7241() || soc_is_ar7242()) {
  205. - ath79_gpio_pdata.ngpios = AR7241_GPIO_COUNT;
  206. - } else if (soc_is_ar913x()) {
  207. - ath79_gpio_pdata.ngpios = AR913X_GPIO_COUNT;
  208. - } else if (soc_is_ar933x()) {
  209. - ath79_gpio_pdata.ngpios = AR933X_GPIO_COUNT;
  210. - } else if (soc_is_ar934x()) {
  211. - ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT;
  212. - ath79_gpio_pdata.oe_inverted = 1;
  213. - } else if (soc_is_qca955x()) {
  214. - ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT;
  215. - ath79_gpio_pdata.oe_inverted = 1;
  216. - } else {
  217. - BUG();
  218. - }
  219. -
  220. - platform_device_register(&ath79_gpio_device);
  221. -}
  222. --- a/arch/mips/ath79/dev-common.h
  223. +++ /dev/null
  224. @@ -1,18 +0,0 @@
  225. -/*
  226. - * Atheros AR71XX/AR724X/AR913X common devices
  227. - *
  228. - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  229. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  230. - *
  231. - * This program is free software; you can redistribute it and/or modify it
  232. - * under the terms of the GNU General Public License version 2 as published
  233. - * by the Free Software Foundation.
  234. - */
  235. -
  236. -#ifndef _ATH79_DEV_COMMON_H
  237. -#define _ATH79_DEV_COMMON_H
  238. -
  239. -void ath79_register_uart(void);
  240. -void ath79_register_wdt(void);
  241. -
  242. -#endif /* _ATH79_DEV_COMMON_H */
  243. --- a/arch/mips/ath79/dev-gpio-buttons.c
  244. +++ /dev/null
  245. @@ -1,56 +0,0 @@
  246. -/*
  247. - * Atheros AR71XX/AR724X/AR913X GPIO button support
  248. - *
  249. - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  250. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  251. - *
  252. - * This program is free software; you can redistribute it and/or modify it
  253. - * under the terms of the GNU General Public License version 2 as published
  254. - * by the Free Software Foundation.
  255. - */
  256. -
  257. -#include "linux/init.h"
  258. -#include "linux/slab.h"
  259. -#include <linux/platform_device.h>
  260. -
  261. -#include "dev-gpio-buttons.h"
  262. -
  263. -void __init ath79_register_gpio_keys_polled(int id,
  264. - unsigned poll_interval,
  265. - unsigned nbuttons,
  266. - struct gpio_keys_button *buttons)
  267. -{
  268. - struct platform_device *pdev;
  269. - struct gpio_keys_platform_data pdata;
  270. - struct gpio_keys_button *p;
  271. - int err;
  272. -
  273. - p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL);
  274. - if (!p)
  275. - return;
  276. -
  277. - pdev = platform_device_alloc("gpio-keys-polled", id);
  278. - if (!pdev)
  279. - goto err_free_buttons;
  280. -
  281. - memset(&pdata, 0, sizeof(pdata));
  282. - pdata.poll_interval = poll_interval;
  283. - pdata.nbuttons = nbuttons;
  284. - pdata.buttons = p;
  285. -
  286. - err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
  287. - if (err)
  288. - goto err_put_pdev;
  289. -
  290. - err = platform_device_add(pdev);
  291. - if (err)
  292. - goto err_put_pdev;
  293. -
  294. - return;
  295. -
  296. -err_put_pdev:
  297. - platform_device_put(pdev);
  298. -
  299. -err_free_buttons:
  300. - kfree(p);
  301. -}
  302. --- a/arch/mips/ath79/dev-gpio-buttons.h
  303. +++ /dev/null
  304. @@ -1,23 +0,0 @@
  305. -/*
  306. - * Atheros AR71XX/AR724X/AR913X GPIO button support
  307. - *
  308. - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  309. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  310. - *
  311. - * This program is free software; you can redistribute it and/or modify it
  312. - * under the terms of the GNU General Public License version 2 as published
  313. - * by the Free Software Foundation.
  314. - */
  315. -
  316. -#ifndef _ATH79_DEV_GPIO_BUTTONS_H
  317. -#define _ATH79_DEV_GPIO_BUTTONS_H
  318. -
  319. -#include <linux/input.h>
  320. -#include <linux/gpio_keys.h>
  321. -
  322. -void ath79_register_gpio_keys_polled(int id,
  323. - unsigned poll_interval,
  324. - unsigned nbuttons,
  325. - struct gpio_keys_button *buttons);
  326. -
  327. -#endif /* _ATH79_DEV_GPIO_BUTTONS_H */
  328. --- a/arch/mips/ath79/dev-leds-gpio.c
  329. +++ /dev/null
  330. @@ -1,54 +0,0 @@
  331. -/*
  332. - * Atheros AR71XX/AR724X/AR913X common GPIO LEDs support
  333. - *
  334. - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  335. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  336. - *
  337. - * This program is free software; you can redistribute it and/or modify it
  338. - * under the terms of the GNU General Public License version 2 as published
  339. - * by the Free Software Foundation.
  340. - */
  341. -
  342. -#include <linux/init.h>
  343. -#include <linux/slab.h>
  344. -#include <linux/platform_device.h>
  345. -
  346. -#include "dev-leds-gpio.h"
  347. -
  348. -void __init ath79_register_leds_gpio(int id,
  349. - unsigned num_leds,
  350. - struct gpio_led *leds)
  351. -{
  352. - struct platform_device *pdev;
  353. - struct gpio_led_platform_data pdata;
  354. - struct gpio_led *p;
  355. - int err;
  356. -
  357. - p = kmemdup(leds, num_leds * sizeof(*p), GFP_KERNEL);
  358. - if (!p)
  359. - return;
  360. -
  361. - pdev = platform_device_alloc("leds-gpio", id);
  362. - if (!pdev)
  363. - goto err_free_leds;
  364. -
  365. - memset(&pdata, 0, sizeof(pdata));
  366. - pdata.num_leds = num_leds;
  367. - pdata.leds = p;
  368. -
  369. - err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
  370. - if (err)
  371. - goto err_put_pdev;
  372. -
  373. - err = platform_device_add(pdev);
  374. - if (err)
  375. - goto err_put_pdev;
  376. -
  377. - return;
  378. -
  379. -err_put_pdev:
  380. - platform_device_put(pdev);
  381. -
  382. -err_free_leds:
  383. - kfree(p);
  384. -}
  385. --- a/arch/mips/ath79/dev-leds-gpio.h
  386. +++ /dev/null
  387. @@ -1,21 +0,0 @@
  388. -/*
  389. - * Atheros AR71XX/AR724X/AR913X common GPIO LEDs support
  390. - *
  391. - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  392. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  393. - *
  394. - * This program is free software; you can redistribute it and/or modify it
  395. - * under the terms of the GNU General Public License version 2 as published
  396. - * by the Free Software Foundation.
  397. - */
  398. -
  399. -#ifndef _ATH79_DEV_LEDS_GPIO_H
  400. -#define _ATH79_DEV_LEDS_GPIO_H
  401. -
  402. -#include <linux/leds.h>
  403. -
  404. -void ath79_register_leds_gpio(int id,
  405. - unsigned num_leds,
  406. - struct gpio_led *leds);
  407. -
  408. -#endif /* _ATH79_DEV_LEDS_GPIO_H */
  409. --- a/arch/mips/ath79/dev-spi.c
  410. +++ /dev/null
  411. @@ -1,38 +0,0 @@
  412. -/*
  413. - * Atheros AR71XX/AR724X/AR913X SPI controller device
  414. - *
  415. - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  416. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  417. - *
  418. - * This program is free software; you can redistribute it and/or modify it
  419. - * under the terms of the GNU General Public License version 2 as published
  420. - * by the Free Software Foundation.
  421. - */
  422. -
  423. -#include <linux/platform_device.h>
  424. -#include <asm/mach-ath79/ar71xx_regs.h>
  425. -#include "dev-spi.h"
  426. -
  427. -static struct resource ath79_spi_resources[] = {
  428. - {
  429. - .start = AR71XX_SPI_BASE,
  430. - .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
  431. - .flags = IORESOURCE_MEM,
  432. - },
  433. -};
  434. -
  435. -static struct platform_device ath79_spi_device = {
  436. - .name = "ath79-spi",
  437. - .id = -1,
  438. - .resource = ath79_spi_resources,
  439. - .num_resources = ARRAY_SIZE(ath79_spi_resources),
  440. -};
  441. -
  442. -void __init ath79_register_spi(struct ath79_spi_platform_data *pdata,
  443. - struct spi_board_info const *info,
  444. - unsigned n)
  445. -{
  446. - spi_register_board_info(info, n);
  447. - ath79_spi_device.dev.platform_data = pdata;
  448. - platform_device_register(&ath79_spi_device);
  449. -}
  450. --- a/arch/mips/ath79/dev-spi.h
  451. +++ /dev/null
  452. @@ -1,22 +0,0 @@
  453. -/*
  454. - * Atheros AR71XX/AR724X/AR913X SPI controller device
  455. - *
  456. - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  457. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  458. - *
  459. - * This program is free software; you can redistribute it and/or modify it
  460. - * under the terms of the GNU General Public License version 2 as published
  461. - * by the Free Software Foundation.
  462. - */
  463. -
  464. -#ifndef _ATH79_DEV_SPI_H
  465. -#define _ATH79_DEV_SPI_H
  466. -
  467. -#include <linux/spi/spi.h>
  468. -#include <asm/mach-ath79/ath79_spi_platform.h>
  469. -
  470. -void ath79_register_spi(struct ath79_spi_platform_data *pdata,
  471. - struct spi_board_info const *info,
  472. - unsigned n);
  473. -
  474. -#endif /* _ATH79_DEV_SPI_H */
  475. --- a/arch/mips/ath79/dev-usb.c
  476. +++ /dev/null
  477. @@ -1,242 +0,0 @@
  478. -/*
  479. - * Atheros AR7XXX/AR9XXX USB Host Controller device
  480. - *
  481. - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
  482. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  483. - *
  484. - * Parts of this file are based on Atheros' 2.6.15 BSP
  485. - *
  486. - * This program is free software; you can redistribute it and/or modify it
  487. - * under the terms of the GNU General Public License version 2 as published
  488. - * by the Free Software Foundation.
  489. - */
  490. -
  491. -#include <linux/kernel.h>
  492. -#include <linux/init.h>
  493. -#include <linux/delay.h>
  494. -#include <linux/irq.h>
  495. -#include <linux/dma-mapping.h>
  496. -#include <linux/platform_device.h>
  497. -#include <linux/usb/ehci_pdriver.h>
  498. -#include <linux/usb/ohci_pdriver.h>
  499. -
  500. -#include <asm/mach-ath79/ath79.h>
  501. -#include <asm/mach-ath79/ar71xx_regs.h>
  502. -#include "common.h"
  503. -#include "dev-usb.h"
  504. -
  505. -static u64 ath79_usb_dmamask = DMA_BIT_MASK(32);
  506. -
  507. -static struct usb_ohci_pdata ath79_ohci_pdata = {
  508. -};
  509. -
  510. -static struct usb_ehci_pdata ath79_ehci_pdata_v1 = {
  511. - .has_synopsys_hc_bug = 1,
  512. -};
  513. -
  514. -static struct usb_ehci_pdata ath79_ehci_pdata_v2 = {
  515. - .caps_offset = 0x100,
  516. - .has_tt = 1,
  517. -};
  518. -
  519. -static void __init ath79_usb_register(const char *name, int id,
  520. - unsigned long base, unsigned long size,
  521. - int irq, const void *data,
  522. - size_t data_size)
  523. -{
  524. - struct resource res[2];
  525. - struct platform_device *pdev;
  526. -
  527. - memset(res, 0, sizeof(res));
  528. -
  529. - res[0].flags = IORESOURCE_MEM;
  530. - res[0].start = base;
  531. - res[0].end = base + size - 1;
  532. -
  533. - res[1].flags = IORESOURCE_IRQ;
  534. - res[1].start = irq;
  535. - res[1].end = irq;
  536. -
  537. - pdev = platform_device_register_resndata(NULL, name, id,
  538. - res, ARRAY_SIZE(res),
  539. - data, data_size);
  540. -
  541. - if (IS_ERR(pdev)) {
  542. - pr_err("ath79: unable to register USB at %08lx, err=%d\n",
  543. - base, (int) PTR_ERR(pdev));
  544. - return;
  545. - }
  546. -
  547. - pdev->dev.dma_mask = &ath79_usb_dmamask;
  548. - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
  549. -}
  550. -
  551. -#define AR71XX_USB_RESET_MASK (AR71XX_RESET_USB_HOST | \
  552. - AR71XX_RESET_USB_PHY | \
  553. - AR71XX_RESET_USB_OHCI_DLL)
  554. -
  555. -static void __init ath79_usb_setup(void)
  556. -{
  557. - void __iomem *usb_ctrl_base;
  558. -
  559. - ath79_device_reset_set(AR71XX_USB_RESET_MASK);
  560. - mdelay(1000);
  561. - ath79_device_reset_clear(AR71XX_USB_RESET_MASK);
  562. -
  563. - usb_ctrl_base = ioremap(AR71XX_USB_CTRL_BASE, AR71XX_USB_CTRL_SIZE);
  564. -
  565. - /* Turning on the Buff and Desc swap bits */
  566. - __raw_writel(0xf0000, usb_ctrl_base + AR71XX_USB_CTRL_REG_CONFIG);
  567. -
  568. - /* WAR for HW bug. Here it adjusts the duration between two SOFS */
  569. - __raw_writel(0x20c00, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ);
  570. -
  571. - iounmap(usb_ctrl_base);
  572. -
  573. - mdelay(900);
  574. -
  575. - ath79_usb_register("ohci-platform", -1,
  576. - AR71XX_OHCI_BASE, AR71XX_OHCI_SIZE,
  577. - ATH79_MISC_IRQ(6),
  578. - &ath79_ohci_pdata, sizeof(ath79_ohci_pdata));
  579. -
  580. - ath79_usb_register("ehci-platform", -1,
  581. - AR71XX_EHCI_BASE, AR71XX_EHCI_SIZE,
  582. - ATH79_CPU_IRQ(3),
  583. - &ath79_ehci_pdata_v1, sizeof(ath79_ehci_pdata_v1));
  584. -}
  585. -
  586. -static void __init ar7240_usb_setup(void)
  587. -{
  588. - void __iomem *usb_ctrl_base;
  589. -
  590. - ath79_device_reset_clear(AR7240_RESET_OHCI_DLL);
  591. - ath79_device_reset_set(AR7240_RESET_USB_HOST);
  592. -
  593. - mdelay(1000);
  594. -
  595. - ath79_device_reset_set(AR7240_RESET_OHCI_DLL);
  596. - ath79_device_reset_clear(AR7240_RESET_USB_HOST);
  597. -
  598. - usb_ctrl_base = ioremap(AR7240_USB_CTRL_BASE, AR7240_USB_CTRL_SIZE);
  599. -
  600. - /* WAR for HW bug. Here it adjusts the duration between two SOFS */
  601. - __raw_writel(0x3, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ);
  602. -
  603. - iounmap(usb_ctrl_base);
  604. -
  605. - ath79_usb_register("ohci-platform", -1,
  606. - AR7240_OHCI_BASE, AR7240_OHCI_SIZE,
  607. - ATH79_CPU_IRQ(3),
  608. - &ath79_ohci_pdata, sizeof(ath79_ohci_pdata));
  609. -}
  610. -
  611. -static void __init ar724x_usb_setup(void)
  612. -{
  613. - ath79_device_reset_set(AR724X_RESET_USBSUS_OVERRIDE);
  614. - mdelay(10);
  615. -
  616. - ath79_device_reset_clear(AR724X_RESET_USB_HOST);
  617. - mdelay(10);
  618. -
  619. - ath79_device_reset_clear(AR724X_RESET_USB_PHY);
  620. - mdelay(10);
  621. -
  622. - ath79_usb_register("ehci-platform", -1,
  623. - AR724X_EHCI_BASE, AR724X_EHCI_SIZE,
  624. - ATH79_CPU_IRQ(3),
  625. - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  626. -}
  627. -
  628. -static void __init ar913x_usb_setup(void)
  629. -{
  630. - ath79_device_reset_set(AR913X_RESET_USBSUS_OVERRIDE);
  631. - mdelay(10);
  632. -
  633. - ath79_device_reset_clear(AR913X_RESET_USB_HOST);
  634. - mdelay(10);
  635. -
  636. - ath79_device_reset_clear(AR913X_RESET_USB_PHY);
  637. - mdelay(10);
  638. -
  639. - ath79_usb_register("ehci-platform", -1,
  640. - AR913X_EHCI_BASE, AR913X_EHCI_SIZE,
  641. - ATH79_CPU_IRQ(3),
  642. - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  643. -}
  644. -
  645. -static void __init ar933x_usb_setup(void)
  646. -{
  647. - ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE);
  648. - mdelay(10);
  649. -
  650. - ath79_device_reset_clear(AR933X_RESET_USB_HOST);
  651. - mdelay(10);
  652. -
  653. - ath79_device_reset_clear(AR933X_RESET_USB_PHY);
  654. - mdelay(10);
  655. -
  656. - ath79_usb_register("ehci-platform", -1,
  657. - AR933X_EHCI_BASE, AR933X_EHCI_SIZE,
  658. - ATH79_CPU_IRQ(3),
  659. - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  660. -}
  661. -
  662. -static void __init ar934x_usb_setup(void)
  663. -{
  664. - u32 bootstrap;
  665. -
  666. - bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
  667. - if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
  668. - return;
  669. -
  670. - ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
  671. - udelay(1000);
  672. -
  673. - ath79_device_reset_clear(AR934X_RESET_USB_PHY);
  674. - udelay(1000);
  675. -
  676. - ath79_device_reset_clear(AR934X_RESET_USB_PHY_ANALOG);
  677. - udelay(1000);
  678. -
  679. - ath79_device_reset_clear(AR934X_RESET_USB_HOST);
  680. - udelay(1000);
  681. -
  682. - ath79_usb_register("ehci-platform", -1,
  683. - AR934X_EHCI_BASE, AR934X_EHCI_SIZE,
  684. - ATH79_CPU_IRQ(3),
  685. - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  686. -}
  687. -
  688. -static void __init qca955x_usb_setup(void)
  689. -{
  690. - ath79_usb_register("ehci-platform", 0,
  691. - QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE,
  692. - ATH79_IP3_IRQ(0),
  693. - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  694. -
  695. - ath79_usb_register("ehci-platform", 1,
  696. - QCA955X_EHCI1_BASE, QCA955X_EHCI_SIZE,
  697. - ATH79_IP3_IRQ(1),
  698. - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  699. -}
  700. -
  701. -void __init ath79_register_usb(void)
  702. -{
  703. - if (soc_is_ar71xx())
  704. - ath79_usb_setup();
  705. - else if (soc_is_ar7240())
  706. - ar7240_usb_setup();
  707. - else if (soc_is_ar7241() || soc_is_ar7242())
  708. - ar724x_usb_setup();
  709. - else if (soc_is_ar913x())
  710. - ar913x_usb_setup();
  711. - else if (soc_is_ar933x())
  712. - ar933x_usb_setup();
  713. - else if (soc_is_ar934x())
  714. - ar934x_usb_setup();
  715. - else if (soc_is_qca955x())
  716. - qca955x_usb_setup();
  717. - else
  718. - BUG();
  719. -}
  720. --- a/arch/mips/ath79/dev-usb.h
  721. +++ /dev/null
  722. @@ -1,17 +0,0 @@
  723. -/*
  724. - * Atheros AR71XX/AR724X/AR913X USB Host Controller support
  725. - *
  726. - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  727. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  728. - *
  729. - * This program is free software; you can redistribute it and/or modify it
  730. - * under the terms of the GNU General Public License version 2 as published
  731. - * by the Free Software Foundation.
  732. - */
  733. -
  734. -#ifndef _ATH79_DEV_USB_H
  735. -#define _ATH79_DEV_USB_H
  736. -
  737. -void ath79_register_usb(void);
  738. -
  739. -#endif /* _ATH79_DEV_USB_H */
  740. --- a/arch/mips/ath79/dev-wmac.c
  741. +++ /dev/null
  742. @@ -1,155 +0,0 @@
  743. -/*
  744. - * Atheros AR913X/AR933X SoC built-in WMAC device support
  745. - *
  746. - * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
  747. - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
  748. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  749. - *
  750. - * Parts of this file are based on Atheros 2.6.15/2.6.31 BSP
  751. - *
  752. - * This program is free software; you can redistribute it and/or modify it
  753. - * under the terms of the GNU General Public License version 2 as published
  754. - * by the Free Software Foundation.
  755. - */
  756. -
  757. -#include <linux/init.h>
  758. -#include <linux/delay.h>
  759. -#include <linux/irq.h>
  760. -#include <linux/platform_device.h>
  761. -#include <linux/ath9k_platform.h>
  762. -
  763. -#include <asm/mach-ath79/ath79.h>
  764. -#include <asm/mach-ath79/ar71xx_regs.h>
  765. -#include "dev-wmac.h"
  766. -
  767. -static struct ath9k_platform_data ath79_wmac_data;
  768. -
  769. -static struct resource ath79_wmac_resources[] = {
  770. - {
  771. - /* .start and .end fields are filled dynamically */
  772. - .flags = IORESOURCE_MEM,
  773. - }, {
  774. - /* .start and .end fields are filled dynamically */
  775. - .flags = IORESOURCE_IRQ,
  776. - },
  777. -};
  778. -
  779. -static struct platform_device ath79_wmac_device = {
  780. - .name = "ath9k",
  781. - .id = -1,
  782. - .resource = ath79_wmac_resources,
  783. - .num_resources = ARRAY_SIZE(ath79_wmac_resources),
  784. - .dev = {
  785. - .platform_data = &ath79_wmac_data,
  786. - },
  787. -};
  788. -
  789. -static void __init ar913x_wmac_setup(void)
  790. -{
  791. - /* reset the WMAC */
  792. - ath79_device_reset_set(AR913X_RESET_AMBA2WMAC);
  793. - mdelay(10);
  794. -
  795. - ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC);
  796. - mdelay(10);
  797. -
  798. - ath79_wmac_resources[0].start = AR913X_WMAC_BASE;
  799. - ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1;
  800. - ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2);
  801. - ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2);
  802. -}
  803. -
  804. -
  805. -static int ar933x_wmac_reset(void)
  806. -{
  807. - ath79_device_reset_set(AR933X_RESET_WMAC);
  808. - ath79_device_reset_clear(AR933X_RESET_WMAC);
  809. -
  810. - return 0;
  811. -}
  812. -
  813. -static int ar933x_r1_get_wmac_revision(void)
  814. -{
  815. - return ath79_soc_rev;
  816. -}
  817. -
  818. -static void __init ar933x_wmac_setup(void)
  819. -{
  820. - u32 t;
  821. -
  822. - ar933x_wmac_reset();
  823. -
  824. - ath79_wmac_device.name = "ar933x_wmac";
  825. -
  826. - ath79_wmac_resources[0].start = AR933X_WMAC_BASE;
  827. - ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1;
  828. - ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2);
  829. - ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2);
  830. -
  831. - t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
  832. - if (t & AR933X_BOOTSTRAP_REF_CLK_40)
  833. - ath79_wmac_data.is_clk_25mhz = false;
  834. - else
  835. - ath79_wmac_data.is_clk_25mhz = true;
  836. -
  837. - if (ath79_soc_rev == 1)
  838. - ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision;
  839. -
  840. - ath79_wmac_data.external_reset = ar933x_wmac_reset;
  841. -}
  842. -
  843. -static void ar934x_wmac_setup(void)
  844. -{
  845. - u32 t;
  846. -
  847. - ath79_wmac_device.name = "ar934x_wmac";
  848. -
  849. - ath79_wmac_resources[0].start = AR934X_WMAC_BASE;
  850. - ath79_wmac_resources[0].end = AR934X_WMAC_BASE + AR934X_WMAC_SIZE - 1;
  851. - ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1);
  852. - ath79_wmac_resources[1].end = ATH79_IP2_IRQ(1);
  853. -
  854. - t = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
  855. - if (t & AR934X_BOOTSTRAP_REF_CLK_40)
  856. - ath79_wmac_data.is_clk_25mhz = false;
  857. - else
  858. - ath79_wmac_data.is_clk_25mhz = true;
  859. -}
  860. -
  861. -static void qca955x_wmac_setup(void)
  862. -{
  863. - u32 t;
  864. -
  865. - ath79_wmac_device.name = "qca955x_wmac";
  866. -
  867. - ath79_wmac_resources[0].start = QCA955X_WMAC_BASE;
  868. - ath79_wmac_resources[0].end = QCA955X_WMAC_BASE + QCA955X_WMAC_SIZE - 1;
  869. - ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1);
  870. - ath79_wmac_resources[1].end = ATH79_IP2_IRQ(1);
  871. -
  872. - t = ath79_reset_rr(QCA955X_RESET_REG_BOOTSTRAP);
  873. - if (t & QCA955X_BOOTSTRAP_REF_CLK_40)
  874. - ath79_wmac_data.is_clk_25mhz = false;
  875. - else
  876. - ath79_wmac_data.is_clk_25mhz = true;
  877. -}
  878. -
  879. -void __init ath79_register_wmac(u8 *cal_data)
  880. -{
  881. - if (soc_is_ar913x())
  882. - ar913x_wmac_setup();
  883. - else if (soc_is_ar933x())
  884. - ar933x_wmac_setup();
  885. - else if (soc_is_ar934x())
  886. - ar934x_wmac_setup();
  887. - else if (soc_is_qca955x())
  888. - qca955x_wmac_setup();
  889. - else
  890. - BUG();
  891. -
  892. - if (cal_data)
  893. - memcpy(ath79_wmac_data.eeprom_data, cal_data,
  894. - sizeof(ath79_wmac_data.eeprom_data));
  895. -
  896. - platform_device_register(&ath79_wmac_device);
  897. -}
  898. --- a/arch/mips/ath79/dev-wmac.h
  899. +++ /dev/null
  900. @@ -1,17 +0,0 @@
  901. -/*
  902. - * Atheros AR913X/AR933X SoC built-in WMAC device support
  903. - *
  904. - * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
  905. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  906. - *
  907. - * This program is free software; you can redistribute it and/or modify it
  908. - * under the terms of the GNU General Public License version 2 as published
  909. - * by the Free Software Foundation.
  910. - */
  911. -
  912. -#ifndef _ATH79_DEV_WMAC_H
  913. -#define _ATH79_DEV_WMAC_H
  914. -
  915. -void ath79_register_wmac(u8 *cal_data);
  916. -
  917. -#endif /* _ATH79_DEV_WMAC_H */
  918. --- a/arch/mips/ath79/setup.c
  919. +++ b/arch/mips/ath79/setup.c
  920. @@ -32,7 +32,6 @@
  921. #include <asm/mach-ath79/ath79.h>
  922. #include <asm/mach-ath79/ar71xx_regs.h>
  923. #include "common.h"
  924. -#include "dev-common.h"
  925. #define ATH79_SYS_TYPE_LEN 64