0019-ar71xx-rework-patch-for-qca953x-956x.patch 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Thu, 6 Aug 2015 03:01:47 +0200
  3. Subject: ar71xx: rework patch for qca953x/956x
  4. Patch cherry-picked from the following location:
  5. https://www.codeaurora.org/cgit/quic/qsdk/oss/system/openwrt/commit/?h=release/coconut_ioe4531_2.0&id=5c357bf6c763e4140dddcc9a3bc5f005525a9c0e
  6. Changelist,
  7. - add more register defines
  8. - add EHCI support
  9. - fix GPIO pin count to 18
  10. - fix chained irq disabled
  11. - fix GMAC0/GMAC1 initial
  12. - fix WMAC irq number to 47
  13. - merge the changes of dev-eth.c from the patch to file.
  14. Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  15. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
  16. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
  17. index ae3db4c..ff94e2e 100644
  18. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
  19. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
  20. @@ -198,6 +198,8 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
  21. case ATH79_SOC_AR9330:
  22. case ATH79_SOC_AR9331:
  23. case ATH79_SOC_QCA9533:
  24. + case ATH79_SOC_QCA9561:
  25. + case ATH79_SOC_TP9343:
  26. mdio_dev = &ath79_mdio1_device;
  27. mdio_data = &ath79_mdio1_data;
  28. break;
  29. @@ -256,6 +258,8 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
  30. break;
  31. case ATH79_SOC_QCA9533:
  32. + case ATH79_SOC_QCA9561:
  33. + case ATH79_SOC_TP9343:
  34. mdio_data->builtin_switch = 1;
  35. break;
  36. @@ -571,6 +575,8 @@ static void __init ath79_init_eth_pll_data(unsigned int id)
  37. case ATH79_SOC_QCA9533:
  38. case ATH79_SOC_QCA9556:
  39. case ATH79_SOC_QCA9558:
  40. + case ATH79_SOC_QCA9561:
  41. + case ATH79_SOC_TP9343:
  42. pll_10 = AR934X_PLL_VAL_10;
  43. pll_100 = AR934X_PLL_VAL_100;
  44. pll_1000 = AR934X_PLL_VAL_1000;
  45. @@ -627,6 +633,8 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
  46. case ATH79_SOC_AR9330:
  47. case ATH79_SOC_AR9331:
  48. case ATH79_SOC_QCA9533:
  49. + case ATH79_SOC_QCA9561:
  50. + case ATH79_SOC_TP9343:
  51. pdata->phy_if_mode = PHY_INTERFACE_MODE_MII;
  52. break;
  53. @@ -687,7 +695,8 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
  54. case ATH79_SOC_AR7241:
  55. case ATH79_SOC_AR9330:
  56. case ATH79_SOC_AR9331:
  57. - case ATH79_SOC_QCA9533:
  58. + case ATH79_SOC_QCA9561:
  59. + case ATH79_SOC_TP9343:
  60. pdata->phy_if_mode = PHY_INTERFACE_MODE_GMII;
  61. break;
  62. @@ -697,6 +706,7 @@ static int __init ath79_setup_phy_if_mode(unsigned int id,
  63. case ATH79_SOC_AR9341:
  64. case ATH79_SOC_AR9342:
  65. case ATH79_SOC_AR9344:
  66. + case ATH79_SOC_QCA9533:
  67. switch (pdata->phy_if_mode) {
  68. case PHY_INTERFACE_MODE_MII:
  69. case PHY_INTERFACE_MODE_GMII:
  70. @@ -986,6 +996,7 @@ void __init ath79_register_eth(unsigned int id)
  71. case ATH79_SOC_AR9341:
  72. case ATH79_SOC_AR9342:
  73. case ATH79_SOC_AR9344:
  74. + case ATH79_SOC_QCA9533:
  75. if (id == 0) {
  76. pdata->reset_bit = AR934X_RESET_GE0_MAC |
  77. AR934X_RESET_GE0_MDIO;
  78. @@ -1017,7 +1028,8 @@ void __init ath79_register_eth(unsigned int id)
  79. pdata->fifo_cfg3 = 0x01f00140;
  80. break;
  81. - case ATH79_SOC_QCA9533:
  82. + case ATH79_SOC_QCA9561:
  83. + case ATH79_SOC_TP9343:
  84. if (id == 0) {
  85. pdata->reset_bit = AR933X_RESET_GE0_MAC |
  86. AR933X_RESET_GE0_MDIO;
  87. @@ -1123,6 +1135,8 @@ void __init ath79_register_eth(unsigned int id)
  88. case ATH79_SOC_AR9330:
  89. case ATH79_SOC_AR9331:
  90. case ATH79_SOC_QCA9533:
  91. + case ATH79_SOC_QCA9561:
  92. + case ATH79_SOC_TP9343:
  93. pdata->mii_bus_dev = &ath79_mdio1_device.dev;
  94. break;
  95. diff --git a/target/linux/ar71xx/patches-3.18/707-MIPS-ath79-add-support-for-QCA953x-SoC.patch b/target/linux/ar71xx/patches-3.18/707-MIPS-ath79-add-support-for-QCA953x-SoC.patch
  96. index b44e884..d541939 100644
  97. --- a/target/linux/ar71xx/patches-3.18/707-MIPS-ath79-add-support-for-QCA953x-SoC.patch
  98. +++ b/target/linux/ar71xx/patches-3.18/707-MIPS-ath79-add-support-for-QCA953x-SoC.patch
  99. @@ -44,7 +44,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  100. config ATH79_NVRAM
  101. --- a/arch/mips/ath79/clock.c
  102. +++ b/arch/mips/ath79/clock.c
  103. -@@ -350,6 +350,91 @@ static void __init ar934x_clocks_init(vo
  104. +@@ -350,6 +350,91 @@ static void __init ar934x_clocks_init(void)
  105. iounmap(dpll_base);
  106. }
  107. @@ -175,6 +175,48 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  108. soc_is_qca955x()) {
  109. ath79_uart_data[0].uartclk = uart_clk_rate;
  110. platform_device_register(&ath79_uart_device);
  111. +--- a/arch/mips/ath79/dev-usb.c
  112. ++++ b/arch/mips/ath79/dev-usb.c
  113. +@@ -236,6 +236,30 @@ static void __init ar934x_usb_setup(void)
  114. + &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  115. + }
  116. +
  117. ++static void __init qca953x_usb_setup(void)
  118. ++{
  119. ++ u32 bootstrap;
  120. ++
  121. ++ bootstrap = ath79_reset_rr(QCA953X_RESET_REG_BOOTSTRAP);
  122. ++
  123. ++ ath79_device_reset_set(QCA953X_RESET_USBSUS_OVERRIDE);
  124. ++ udelay(1000);
  125. ++
  126. ++ ath79_device_reset_clear(QCA953X_RESET_USB_PHY);
  127. ++ udelay(1000);
  128. ++
  129. ++ ath79_device_reset_clear(QCA953X_RESET_USB_PHY_ANALOG);
  130. ++ udelay(1000);
  131. ++
  132. ++ ath79_device_reset_clear(QCA953X_RESET_USB_HOST);
  133. ++ udelay(1000);
  134. ++
  135. ++ ath79_usb_register("ehci-platform", -1,
  136. ++ QCA953X_EHCI_BASE, QCA953X_EHCI_SIZE,
  137. ++ ATH79_CPU_IRQ(3),
  138. ++ &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  139. ++}
  140. ++
  141. + static void qca955x_usb_reset_notifier(struct platform_device *pdev)
  142. + {
  143. + u32 base;
  144. +@@ -286,6 +310,8 @@ void __init ath79_register_usb(void)
  145. + ar933x_usb_setup();
  146. + else if (soc_is_ar934x())
  147. + ar934x_usb_setup();
  148. ++ else if (soc_is_qca953x())
  149. ++ qca953x_usb_setup();
  150. + else if (soc_is_qca955x())
  151. + qca955x_usb_setup();
  152. + else
  153. --- a/arch/mips/ath79/dev-wmac.c
  154. +++ b/arch/mips/ath79/dev-wmac.c
  155. @@ -101,7 +101,7 @@ static int ar933x_wmac_reset(void)
  156. @@ -186,7 +228,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  157. {
  158. return ath79_soc_rev;
  159. }
  160. -@@ -126,7 +126,7 @@ static void __init ar933x_wmac_setup(voi
  161. +@@ -126,7 +126,7 @@ static void __init ar933x_wmac_setup(void)
  162. ath79_wmac_data.is_clk_25mhz = true;
  163. if (ath79_soc_rev == 1)
  164. @@ -195,8 +237,8 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  165. ath79_wmac_data.external_reset = ar933x_wmac_reset;
  166. }
  167. -@@ -149,6 +149,26 @@ static void ar934x_wmac_setup(void)
  168. - ath79_wmac_data.is_clk_25mhz = true;
  169. +@@ -151,6 +151,26 @@ static void ar934x_wmac_setup(void)
  170. + ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision;
  171. }
  172. +static void qca953x_wmac_setup(void)
  173. @@ -207,8 +249,8 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  174. +
  175. + ath79_wmac_resources[0].start = QCA953X_WMAC_BASE;
  176. + ath79_wmac_resources[0].end = QCA953X_WMAC_BASE + QCA953X_WMAC_SIZE - 1;
  177. -+ ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2);
  178. -+ ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2);
  179. ++ ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1);
  180. ++ ath79_wmac_resources[1].end = ATH79_IP2_IRQ(1);
  181. +
  182. + t = ath79_reset_rr(QCA953X_RESET_REG_BOOTSTRAP);
  183. + if (t & QCA953X_BOOTSTRAP_REF_CLK_40)
  184. @@ -222,7 +264,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  185. static void qca955x_wmac_setup(void)
  186. {
  187. u32 t;
  188. -@@ -366,6 +386,8 @@ void __init ath79_register_wmac(u8 *cal_
  189. +@@ -368,6 +388,8 @@ void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr)
  190. ar933x_wmac_setup();
  191. else if (soc_is_ar934x())
  192. ar934x_wmac_setup();
  193. @@ -244,6 +286,24 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  194. _prom_putchar = prom_putchar_ar71xx;
  195. --- a/arch/mips/ath79/gpio.c
  196. +++ b/arch/mips/ath79/gpio.c
  197. +@@ -148,7 +148,7 @@ static void __iomem *ath79_gpio_get_function_reg(void)
  198. + soc_is_ar913x() ||
  199. + soc_is_ar933x())
  200. + reg = AR71XX_GPIO_REG_FUNC;
  201. +- else if (soc_is_ar934x())
  202. ++ else if (soc_is_ar934x() || soc_is_qca953x())
  203. + reg = AR934X_GPIO_REG_FUNC;
  204. + else
  205. + BUG();
  206. +@@ -187,7 +187,7 @@ void __init ath79_gpio_output_select(unsigned gpio, u8 val)
  207. + unsigned int reg;
  208. + u32 t, s;
  209. +
  210. +- BUG_ON(!soc_is_ar934x());
  211. ++ BUG_ON(!soc_is_ar934x() && !soc_is_qca953x());
  212. +
  213. + if (gpio >= AR934X_GPIO_COUNT)
  214. + return;
  215. @@ -224,6 +224,8 @@ void __init ath79_gpio_init(void)
  216. ath79_gpio_count = AR933X_GPIO_COUNT;
  217. else if (soc_is_ar934x())
  218. @@ -264,7 +324,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  219. }
  220. --- a/arch/mips/ath79/irq.c
  221. +++ b/arch/mips/ath79/irq.c
  222. -@@ -106,6 +106,7 @@ static void __init ath79_misc_irq_init(v
  223. +@@ -106,6 +106,7 @@ static void __init ath79_misc_irq_init(void)
  224. else if (soc_is_ar724x() ||
  225. soc_is_ar933x() ||
  226. soc_is_ar934x() ||
  227. @@ -272,19 +332,80 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  228. soc_is_qca955x())
  229. ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack;
  230. else
  231. -@@ -352,6 +353,9 @@ void __init arch_init_irq(void)
  232. +@@ -153,6 +154,38 @@ static void ar934x_ip2_irq_init(void)
  233. + irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch);
  234. + }
  235. +
  236. ++static void qca953x_ip2_irq_dispatch(unsigned int irq, struct irq_desc *desc)
  237. ++{
  238. ++ u32 status;
  239. ++
  240. ++ disable_irq_nosync(irq);
  241. ++
  242. ++ status = ath79_reset_rr(QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS);
  243. ++
  244. ++ if (status & QCA953X_PCIE_WMAC_INT_PCIE_ALL) {
  245. ++ ath79_ddr_wb_flush(QCA953X_DDR_REG_FLUSH_PCIE);
  246. ++ generic_handle_irq(ATH79_IP2_IRQ(0));
  247. ++ } else if (status & QCA953X_PCIE_WMAC_INT_WMAC_ALL) {
  248. ++ ath79_ddr_wb_flush(QCA953X_DDR_REG_FLUSH_WMAC);
  249. ++ generic_handle_irq(ATH79_IP2_IRQ(1));
  250. ++ } else {
  251. ++ spurious_interrupt();
  252. ++ }
  253. ++
  254. ++ enable_irq(irq);
  255. ++}
  256. ++
  257. ++static void qca953x_irq_init(void)
  258. ++{
  259. ++ int i;
  260. ++
  261. ++ for (i = ATH79_IP2_IRQ_BASE;
  262. ++ i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++)
  263. ++ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  264. ++
  265. ++ irq_set_chained_handler(ATH79_CPU_IRQ(2), qca953x_ip2_irq_dispatch);
  266. ++}
  267. ++
  268. + static void qca955x_ip2_irq_dispatch(unsigned int irq, struct irq_desc *desc)
  269. + {
  270. + u32 status;
  271. +@@ -335,6 +368,12 @@ static void ar934x_ip3_handler(void)
  272. + do_IRQ(ATH79_CPU_IRQ(3));
  273. + }
  274. +
  275. ++static void qca953x_ip3_handler(void)
  276. ++{
  277. ++ ath79_ddr_wb_flush(QCA953X_DDR_REG_FLUSH_USB);
  278. ++ do_IRQ(ATH79_CPU_IRQ(3));
  279. ++}
  280. ++
  281. + void __init arch_init_irq(void)
  282. + {
  283. + if (soc_is_ar71xx()) {
  284. +@@ -352,6 +391,9 @@ void __init arch_init_irq(void)
  285. } else if (soc_is_ar934x()) {
  286. ath79_ip2_handler = ath79_default_ip2_handler;
  287. ath79_ip3_handler = ar934x_ip3_handler;
  288. + } else if (soc_is_qca953x()) {
  289. + ath79_ip2_handler = ath79_default_ip2_handler;
  290. -+ ath79_ip3_handler = ath79_default_ip3_handler;
  291. ++ ath79_ip3_handler = qca953x_ip3_handler;
  292. } else if (soc_is_qca955x()) {
  293. ath79_ip2_handler = ath79_default_ip2_handler;
  294. ath79_ip3_handler = ath79_default_ip3_handler;
  295. +@@ -365,6 +407,8 @@ void __init arch_init_irq(void)
  296. +
  297. + if (soc_is_ar934x())
  298. + ar934x_ip2_irq_init();
  299. ++ else if (soc_is_qca953x())
  300. ++ qca953x_irq_init();
  301. + else if (soc_is_qca955x())
  302. + qca955x_irq_init();
  303. + }
  304. --- a/arch/mips/ath79/setup.c
  305. +++ b/arch/mips/ath79/setup.c
  306. -@@ -59,6 +59,7 @@ static void __init ath79_detect_sys_type
  307. +@@ -60,6 +60,7 @@ static void __init ath79_detect_sys_type(void)
  308. u32 major;
  309. u32 minor;
  310. u32 rev = 0;
  311. @@ -292,7 +413,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  312. id = ath79_reset_rr(AR71XX_RESET_REG_REV_ID);
  313. major = id & REV_ID_MAJOR_MASK;
  314. -@@ -151,6 +152,16 @@ static void __init ath79_detect_sys_type
  315. +@@ -152,6 +153,16 @@ static void __init ath79_detect_sys_type(void)
  316. rev = id & AR934X_REV_ID_REVISION_MASK;
  317. break;
  318. @@ -309,38 +430,60 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  319. case REV_ID_MAJOR_QCA9556:
  320. ath79_soc = ATH79_SOC_QCA9556;
  321. chip = "9556";
  322. -@@ -169,9 +180,9 @@ static void __init ath79_detect_sys_type
  323. +@@ -170,7 +181,7 @@ static void __init ath79_detect_sys_type(void)
  324. ath79_soc_rev = rev;
  325. - if (soc_is_qca955x())
  326. -- sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s rev %u",
  327. -- chip, rev);
  328. + if (soc_is_qca953x() || soc_is_qca955x())
  329. -+ sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u",
  330. -+ chip, ver, rev);
  331. + sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s rev %u",
  332. + chip, rev);
  333. else
  334. - sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev);
  335. - pr_info("SoC: %s\n", ath79_sys_type);
  336. --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  337. +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  338. -@@ -105,6 +105,9 @@
  339. +@@ -105,6 +105,21 @@
  340. #define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000)
  341. #define AR934X_SRIF_SIZE 0x1000
  342. ++#define QCA953X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
  343. ++#define QCA953X_GMAC_SIZE 0x14
  344. +#define QCA953X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
  345. +#define QCA953X_WMAC_SIZE 0x20000
  346. ++#define QCA953X_EHCI_BASE 0x1b000000
  347. ++#define QCA953X_EHCI_SIZE 0x200
  348. ++#define QCA953X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000)
  349. ++#define QCA953X_SRIF_SIZE 0x1000
  350. ++
  351. ++#define QCA953X_PCI_CFG_BASE0 0x14000000
  352. ++#define QCA953X_PCI_CTRL_BASE0 (AR71XX_APB_BASE + 0x000f0000)
  353. ++#define QCA953X_PCI_CRP_BASE0 (AR71XX_APB_BASE + 0x000c0000)
  354. ++#define QCA953X_PCI_MEM_BASE0 0x10000000
  355. ++#define QCA953X_PCI_MEM_SIZE 0x02000000
  356. +
  357. #define QCA955X_PCI_MEM_BASE0 0x10000000
  358. #define QCA955X_PCI_MEM_BASE1 0x12000000
  359. #define QCA955X_PCI_MEM_SIZE 0x02000000
  360. -@@ -279,6 +282,43 @@
  361. +@@ -173,6 +188,12 @@
  362. + #define AR934X_DDR_REG_FLUSH_PCIE 0xa8
  363. + #define AR934X_DDR_REG_FLUSH_WMAC 0xac
  364. +
  365. ++#define QCA953X_DDR_REG_FLUSH_GE0 0x9c
  366. ++#define QCA953X_DDR_REG_FLUSH_GE1 0xa0
  367. ++#define QCA953X_DDR_REG_FLUSH_USB 0xa4
  368. ++#define QCA953X_DDR_REG_FLUSH_PCIE 0xa8
  369. ++#define QCA953X_DDR_REG_FLUSH_WMAC 0xac
  370. ++
  371. + /*
  372. + * PLL block
  373. + */
  374. +@@ -279,6 +300,44 @@
  375. #define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6)
  376. +#define QCA953X_PLL_CPU_CONFIG_REG 0x00
  377. +#define QCA953X_PLL_DDR_CONFIG_REG 0x04
  378. +#define QCA953X_PLL_CLK_CTRL_REG 0x08
  379. ++#define QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24
  380. +#define QCA953X_PLL_ETH_XMII_CONTROL_REG 0x2c
  381. +#define QCA953X_PLL_ETH_SGMII_CONTROL_REG 0x48
  382. +
  383. @@ -351,7 +494,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  384. +#define QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
  385. +#define QCA953X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
  386. +#define QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19
  387. -+#define QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK 0x3
  388. ++#define QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7
  389. +
  390. +#define QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT 0
  391. +#define QCA953X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff
  392. @@ -378,27 +521,85 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  393. #define QCA955X_PLL_CPU_CONFIG_REG 0x00
  394. #define QCA955X_PLL_DDR_CONFIG_REG 0x04
  395. #define QCA955X_PLL_CLK_CTRL_REG 0x08
  396. -@@ -355,6 +395,10 @@
  397. +@@ -355,6 +414,10 @@
  398. #define AR934X_RESET_REG_BOOTSTRAP 0xb0
  399. #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac
  400. +#define QCA953X_RESET_REG_RESET_MODULE 0x1c
  401. +#define QCA953X_RESET_REG_BOOTSTRAP 0xb0
  402. -+#define QCA953X_RESET_REG_EXT_INT_STATUS 0xac
  403. ++#define QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac
  404. +
  405. #define QCA955X_RESET_REG_RESET_MODULE 0x1c
  406. #define QCA955X_RESET_REG_BOOTSTRAP 0xb0
  407. #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac
  408. -@@ -503,6 +547,8 @@
  409. +@@ -450,6 +513,27 @@
  410. + #define AR934X_RESET_MBOX BIT(1)
  411. + #define AR934X_RESET_I2S BIT(0)
  412. +
  413. ++#define QCA953X_RESET_USB_EXT_PWR BIT(29)
  414. ++#define QCA953X_RESET_EXTERNAL BIT(28)
  415. ++#define QCA953X_RESET_RTC BIT(27)
  416. ++#define QCA953X_RESET_FULL_CHIP BIT(24)
  417. ++#define QCA953X_RESET_GE1_MDIO BIT(23)
  418. ++#define QCA953X_RESET_GE0_MDIO BIT(22)
  419. ++#define QCA953X_RESET_CPU_NMI BIT(21)
  420. ++#define QCA953X_RESET_CPU_COLD BIT(20)
  421. ++#define QCA953X_RESET_DDR BIT(16)
  422. ++#define QCA953X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
  423. ++#define QCA953X_RESET_GE1_MAC BIT(13)
  424. ++#define QCA953X_RESET_ETH_SWITCH_ANALOG BIT(12)
  425. ++#define QCA953X_RESET_USB_PHY_ANALOG BIT(11)
  426. ++#define QCA953X_RESET_GE0_MAC BIT(9)
  427. ++#define QCA953X_RESET_ETH_SWITCH BIT(8)
  428. ++#define QCA953X_RESET_PCIE_PHY BIT(7)
  429. ++#define QCA953X_RESET_PCIE BIT(6)
  430. ++#define QCA953X_RESET_USB_HOST BIT(5)
  431. ++#define QCA953X_RESET_USB_PHY BIT(4)
  432. ++#define QCA953X_RESET_USBSUS_OVERRIDE BIT(3)
  433. ++
  434. + #define QCA955X_RESET_HOST BIT(31)
  435. + #define QCA955X_RESET_SLIC BIT(30)
  436. + #define QCA955X_RESET_HDMA BIT(29)
  437. +@@ -503,6 +587,13 @@
  438. #define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1)
  439. #define AR934X_BOOTSTRAP_DDR1 BIT(0)
  440. ++#define QCA953X_BOOTSTRAP_SW_OPTION2 BIT(12)
  441. ++#define QCA953X_BOOTSTRAP_SW_OPTION1 BIT(11)
  442. ++#define QCA953X_BOOTSTRAP_EJTAG_MODE BIT(5)
  443. +#define QCA953X_BOOTSTRAP_REF_CLK_40 BIT(4)
  444. ++#define QCA953X_BOOTSTRAP_SDRAM_DISABLED BIT(1)
  445. ++#define QCA953X_BOOTSTRAP_DDR1 BIT(0)
  446. +
  447. #define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4)
  448. #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
  449. -@@ -565,6 +611,8 @@
  450. +@@ -523,6 +614,24 @@
  451. + AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \
  452. + AR934X_PCIE_WMAC_INT_PCIE_RC3)
  453. +
  454. ++#define QCA953X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
  455. ++#define QCA953X_PCIE_WMAC_INT_WMAC_TX BIT(1)
  456. ++#define QCA953X_PCIE_WMAC_INT_WMAC_RXLP BIT(2)
  457. ++#define QCA953X_PCIE_WMAC_INT_WMAC_RXHP BIT(3)
  458. ++#define QCA953X_PCIE_WMAC_INT_PCIE_RC BIT(4)
  459. ++#define QCA953X_PCIE_WMAC_INT_PCIE_RC0 BIT(5)
  460. ++#define QCA953X_PCIE_WMAC_INT_PCIE_RC1 BIT(6)
  461. ++#define QCA953X_PCIE_WMAC_INT_PCIE_RC2 BIT(7)
  462. ++#define QCA953X_PCIE_WMAC_INT_PCIE_RC3 BIT(8)
  463. ++#define QCA953X_PCIE_WMAC_INT_WMAC_ALL \
  464. ++ (QCA953X_PCIE_WMAC_INT_WMAC_MISC | QCA953X_PCIE_WMAC_INT_WMAC_TX | \
  465. ++ QCA953X_PCIE_WMAC_INT_WMAC_RXLP | QCA953X_PCIE_WMAC_INT_WMAC_RXHP)
  466. ++
  467. ++#define QCA953X_PCIE_WMAC_INT_PCIE_ALL \
  468. ++ (QCA953X_PCIE_WMAC_INT_PCIE_RC | QCA953X_PCIE_WMAC_INT_PCIE_RC0 | \
  469. ++ QCA953X_PCIE_WMAC_INT_PCIE_RC1 | QCA953X_PCIE_WMAC_INT_PCIE_RC2 | \
  470. ++ QCA953X_PCIE_WMAC_INT_PCIE_RC3)
  471. ++
  472. + #define QCA955X_EXT_INT_WMAC_MISC BIT(0)
  473. + #define QCA955X_EXT_INT_WMAC_TX BIT(1)
  474. + #define QCA955X_EXT_INT_WMAC_RXLP BIT(2)
  475. +@@ -565,6 +674,8 @@
  476. #define REV_ID_MAJOR_AR9341 0x0120
  477. #define REV_ID_MAJOR_AR9342 0x1120
  478. #define REV_ID_MAJOR_AR9344 0x2120
  479. @@ -407,7 +608,7 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  480. #define REV_ID_MAJOR_QCA9556 0x0130
  481. #define REV_ID_MAJOR_QCA9558 0x1130
  482. -@@ -587,6 +635,8 @@
  483. +@@ -587,6 +698,8 @@
  484. #define AR934X_REV_ID_REVISION_MASK 0xf
  485. @@ -416,14 +617,81 @@ meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed.
  486. #define QCA955X_REV_ID_REVISION_MASK 0xf
  487. /*
  488. -@@ -640,6 +690,7 @@
  489. +@@ -634,12 +747,32 @@
  490. + #define AR934X_GPIO_REG_OUT_FUNC5 0x40
  491. + #define AR934X_GPIO_REG_FUNC 0x6c
  492. +
  493. ++#define QCA953X_GPIO_REG_OUT_FUNC0 0x2c
  494. ++#define QCA953X_GPIO_REG_OUT_FUNC1 0x30
  495. ++#define QCA953X_GPIO_REG_OUT_FUNC2 0x34
  496. ++#define QCA953X_GPIO_REG_OUT_FUNC3 0x38
  497. ++#define QCA953X_GPIO_REG_OUT_FUNC4 0x3c
  498. ++#define QCA953X_GPIO_REG_IN_ENABLE0 0x44
  499. ++#define QCA953X_GPIO_REG_FUNC 0x6c
  500. ++
  501. ++#define QCA953X_GPIO_OUT_MUX_SPI_CS1 10
  502. ++#define QCA953X_GPIO_OUT_MUX_SPI_CS2 11
  503. ++#define QCA953X_GPIO_OUT_MUX_SPI_CS0 9
  504. ++#define QCA953X_GPIO_OUT_MUX_SPI_CLK 8
  505. ++#define QCA953X_GPIO_OUT_MUX_SPI_MOSI 12
  506. ++#define QCA953X_GPIO_OUT_MUX_LED_LINK1 41
  507. ++#define QCA953X_GPIO_OUT_MUX_LED_LINK2 42
  508. ++#define QCA953X_GPIO_OUT_MUX_LED_LINK3 43
  509. ++#define QCA953X_GPIO_OUT_MUX_LED_LINK4 44
  510. ++#define QCA953X_GPIO_OUT_MUX_LED_LINK5 45
  511. ++
  512. + #define AR71XX_GPIO_COUNT 16
  513. + #define AR7240_GPIO_COUNT 18
  514. + #define AR7241_GPIO_COUNT 20
  515. #define AR913X_GPIO_COUNT 22
  516. #define AR933X_GPIO_COUNT 30
  517. #define AR934X_GPIO_COUNT 23
  518. -+#define QCA953X_GPIO_COUNT 24
  519. ++#define QCA953X_GPIO_COUNT 18
  520. #define QCA955X_GPIO_COUNT 24
  521. /*
  522. +@@ -663,6 +796,24 @@
  523. + #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13
  524. + #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7
  525. +
  526. ++#define QCA953X_SRIF_CPU_DPLL1_REG 0x1c0
  527. ++#define QCA953X_SRIF_CPU_DPLL2_REG 0x1c4
  528. ++#define QCA953X_SRIF_CPU_DPLL3_REG 0x1c8
  529. ++
  530. ++#define QCA953X_SRIF_DDR_DPLL1_REG 0x240
  531. ++#define QCA953X_SRIF_DDR_DPLL2_REG 0x244
  532. ++#define QCA953X_SRIF_DDR_DPLL3_REG 0x248
  533. ++
  534. ++#define QCA953X_SRIF_DPLL1_REFDIV_SHIFT 27
  535. ++#define QCA953X_SRIF_DPLL1_REFDIV_MASK 0x1f
  536. ++#define QCA953X_SRIF_DPLL1_NINT_SHIFT 18
  537. ++#define QCA953X_SRIF_DPLL1_NINT_MASK 0x1ff
  538. ++#define QCA953X_SRIF_DPLL1_NFRAC_MASK 0x0003ffff
  539. ++
  540. ++#define QCA953X_SRIF_DPLL2_LOCAL_PLL BIT(30)
  541. ++#define QCA953X_SRIF_DPLL2_OUTDIV_SHIFT 13
  542. ++#define QCA953X_SRIF_DPLL2_OUTDIV_MASK 0x7
  543. ++
  544. + #define AR71XX_GPIO_FUNC_STEREO_EN BIT(17)
  545. + #define AR71XX_GPIO_FUNC_SLIC_EN BIT(16)
  546. + #define AR71XX_GPIO_FUNC_SPI_CS2_EN BIT(13)
  547. +@@ -804,6 +955,16 @@
  548. + #define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16
  549. +
  550. + /*
  551. ++ * QCA953X GMAC Interface
  552. ++ */
  553. ++#define QCA953X_GMAC_REG_ETH_CFG 0x00
  554. ++
  555. ++#define QCA953X_ETH_CFG_SW_ONLY_MODE BIT(6)
  556. ++#define QCA953X_ETH_CFG_SW_PHY_SWAP BIT(7)
  557. ++#define QCA953X_ETH_CFG_SW_APB_ACCESS BIT(9)
  558. ++#define QCA953X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13)
  559. ++
  560. ++/*
  561. + * QCA955X GMAC Interface
  562. + */
  563. +
  564. --- a/arch/mips/include/asm/mach-ath79/ath79.h
  565. +++ b/arch/mips/include/asm/mach-ath79/ath79.h
  566. @@ -32,6 +32,7 @@ enum ath79_soc_type {
  567. diff --git a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
  568. index 8f15790..027163f 100644
  569. --- a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
  570. +++ b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
  571. @@ -1,3 +1,27 @@
  572. +--- a/arch/mips/ath79/Kconfig
  573. ++++ b/arch/mips/ath79/Kconfig
  574. +@@ -1213,6 +1213,12 @@ config SOC_QCA955X
  575. + select PCI_AR724X if PCI
  576. + def_bool n
  577. +
  578. ++config SOC_QCA956X
  579. ++ select USB_ARCH_HAS_EHCI
  580. ++ select HW_HAS_PCI
  581. ++ select PCI_AR724X if PCI
  582. ++ def_bool n
  583. ++
  584. + config ATH79_DEV_M25P80
  585. + select ATH79_DEV_SPI
  586. + def_bool n
  587. +@@ -1250,7 +1256,7 @@ config ATH79_DEV_USB
  588. + def_bool n
  589. +
  590. + config ATH79_DEV_WMAC
  591. +- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X)
  592. ++ depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X || SOC_QCA956X)
  593. + def_bool n
  594. +
  595. + config ATH79_NVRAM
  596. --- a/arch/mips/ath79/clock.c
  597. +++ b/arch/mips/ath79/clock.c
  598. @@ -520,6 +520,100 @@ static void __init qca955x_clocks_init(v
  599. @@ -142,74 +166,9 @@
  600. ath79_uart_data[0].uartclk = uart_clk_rate;
  601. platform_device_register(&ath79_uart_device);
  602. } else if (soc_is_ar933x()) {
  603. ---- a/arch/mips/ath79/dev-eth.c
  604. -+++ b/arch/mips/ath79/dev-eth.c
  605. -@@ -198,6 +198,8 @@ void __init ath79_register_mdio(unsigned
  606. - case ATH79_SOC_AR9330:
  607. - case ATH79_SOC_AR9331:
  608. - case ATH79_SOC_QCA9533:
  609. -+ case ATH79_SOC_QCA9561:
  610. -+ case ATH79_SOC_TP9343:
  611. - mdio_dev = &ath79_mdio1_device;
  612. - mdio_data = &ath79_mdio1_data;
  613. - break;
  614. -@@ -256,6 +258,8 @@ void __init ath79_register_mdio(unsigned
  615. - break;
  616. -
  617. - case ATH79_SOC_QCA9533:
  618. -+ case ATH79_SOC_QCA9561:
  619. -+ case ATH79_SOC_TP9343:
  620. - mdio_data->builtin_switch = 1;
  621. - break;
  622. -
  623. -@@ -571,6 +575,8 @@ static void __init ath79_init_eth_pll_da
  624. - case ATH79_SOC_QCA9533:
  625. - case ATH79_SOC_QCA9556:
  626. - case ATH79_SOC_QCA9558:
  627. -+ case ATH79_SOC_QCA9561:
  628. -+ case ATH79_SOC_TP9343:
  629. - pll_10 = AR934X_PLL_VAL_10;
  630. - pll_100 = AR934X_PLL_VAL_100;
  631. - pll_1000 = AR934X_PLL_VAL_1000;
  632. -@@ -627,6 +633,8 @@ static int __init ath79_setup_phy_if_mod
  633. - case ATH79_SOC_AR9330:
  634. - case ATH79_SOC_AR9331:
  635. - case ATH79_SOC_QCA9533:
  636. -+ case ATH79_SOC_QCA9561:
  637. -+ case ATH79_SOC_TP9343:
  638. - pdata->phy_if_mode = PHY_INTERFACE_MODE_MII;
  639. - break;
  640. -
  641. -@@ -688,6 +696,8 @@ static int __init ath79_setup_phy_if_mod
  642. - case ATH79_SOC_AR9330:
  643. - case ATH79_SOC_AR9331:
  644. - case ATH79_SOC_QCA9533:
  645. -+ case ATH79_SOC_QCA9561:
  646. -+ case ATH79_SOC_TP9343:
  647. - pdata->phy_if_mode = PHY_INTERFACE_MODE_GMII;
  648. - break;
  649. -
  650. -@@ -1018,6 +1028,8 @@ void __init ath79_register_eth(unsigned
  651. - break;
  652. -
  653. - case ATH79_SOC_QCA9533:
  654. -+ case ATH79_SOC_QCA9561:
  655. -+ case ATH79_SOC_TP9343:
  656. - if (id == 0) {
  657. - pdata->reset_bit = AR933X_RESET_GE0_MAC |
  658. - AR933X_RESET_GE0_MDIO;
  659. -@@ -1123,6 +1135,8 @@ void __init ath79_register_eth(unsigned
  660. - case ATH79_SOC_AR9330:
  661. - case ATH79_SOC_AR9331:
  662. - case ATH79_SOC_QCA9533:
  663. -+ case ATH79_SOC_QCA9561:
  664. -+ case ATH79_SOC_TP9343:
  665. - pdata->mii_bus_dev = &ath79_mdio1_device.dev;
  666. - break;
  667. -
  668. --- a/arch/mips/ath79/dev-usb.c
  669. +++ b/arch/mips/ath79/dev-usb.c
  670. -@@ -272,6 +272,19 @@ static void __init qca955x_usb_setup(voi
  671. +@@ -296,6 +296,19 @@ static void __init qca955x_usb_setup(voi
  672. &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  673. }
  674. @@ -229,8 +188,8 @@
  675. void __init ath79_register_usb(void)
  676. {
  677. if (soc_is_ar71xx())
  678. -@@ -288,6 +301,8 @@ void __init ath79_register_usb(void)
  679. - ar934x_usb_setup();
  680. +@@ -314,6 +327,8 @@ void __init ath79_register_usb(void)
  681. + qca953x_usb_setup();
  682. else if (soc_is_qca955x())
  683. qca955x_usb_setup();
  684. + else if (soc_is_qca9561())
  685. @@ -291,9 +250,9 @@
  686. soc_is_ar913x() ||
  687. soc_is_ar933x())
  688. reg = AR71XX_GPIO_REG_FUNC;
  689. -- else if (soc_is_ar934x())
  690. +- else if (soc_is_ar934x() || soc_is_qca953x())
  691. + else if (soc_is_ar934x() ||
  692. -+ soc_is_qca956x())
  693. ++ soc_is_qca953x() || soc_is_qca956x())
  694. reg = AR934X_GPIO_REG_FUNC;
  695. else
  696. BUG();
  697. @@ -326,7 +285,7 @@
  698. ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack;
  699. else
  700. BUG();
  701. -@@ -236,6 +237,99 @@ static void qca955x_irq_init(void)
  702. +@@ -268,6 +269,97 @@ static void qca955x_irq_init(void)
  703. irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch);
  704. }
  705. @@ -406,15 +365,13 @@
  706. +
  707. + for (i = ATH79_IP2_IRQ_BASE;
  708. + i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++)
  709. -+ irq_set_chip_and_handler(i, &dummy_irq_chip,
  710. -+ handle_level_irq);
  711. ++ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  712. +
  713. + irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch);
  714. +
  715. + for (i = ATH79_IP3_IRQ_BASE;
  716. + i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++)
  717. -+ irq_set_chip_and_handler(i, &dummy_irq_chip,
  718. -+ handle_level_irq);
  719. ++ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  720. +
  721. + irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch);
  722. +
  723. @@ -426,7 +383,7 @@
  724. asmlinkage void plat_irq_dispatch(void)
  725. {
  726. unsigned long pending;
  727. -@@ -359,6 +453,9 @@ void __init arch_init_irq(void)
  728. +@@ -397,6 +489,9 @@ void __init arch_init_irq(void)
  729. } else if (soc_is_qca955x()) {
  730. ath79_ip2_handler = ath79_default_ip2_handler;
  731. ath79_ip3_handler = ath79_default_ip3_handler;
  732. @@ -436,37 +393,13 @@
  733. } else {
  734. BUG();
  735. }
  736. -@@ -371,4 +468,6 @@ void __init arch_init_irq(void)
  737. - ar934x_ip2_irq_init();
  738. +@@ -411,4 +506,6 @@ void __init arch_init_irq(void)
  739. + qca953x_irq_init();
  740. else if (soc_is_qca955x())
  741. qca955x_irq_init();
  742. + else if (soc_is_qca956x())
  743. + qca956x_irq_init();
  744. }
  745. ---- a/arch/mips/ath79/Kconfig
  746. -+++ b/arch/mips/ath79/Kconfig
  747. -@@ -1248,6 +1248,12 @@ config SOC_QCA955X
  748. - select PCI_AR724X if PCI
  749. - def_bool n
  750. -
  751. -+config SOC_QCA956X
  752. -+ select USB_ARCH_HAS_EHCI
  753. -+ select HW_HAS_PCI
  754. -+ select PCI_AR724X if PCI
  755. -+ def_bool n
  756. -+
  757. - config ATH79_DEV_M25P80
  758. - select ATH79_DEV_SPI
  759. - def_bool n
  760. -@@ -1285,7 +1291,7 @@ config ATH79_DEV_USB
  761. - def_bool n
  762. -
  763. - config ATH79_DEV_WMAC
  764. -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X)
  765. -+ depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X || SOC_QCA956X)
  766. - def_bool n
  767. -
  768. - config ATH79_NVRAM
  769. --- a/arch/mips/ath79/pci.c
  770. +++ b/arch/mips/ath79/pci.c
  771. @@ -68,6 +68,21 @@ static const struct ath79_pci_irq qca955
  772. @@ -519,7 +452,7 @@
  773. return -ENODEV;
  774. --- a/arch/mips/ath79/setup.c
  775. +++ b/arch/mips/ath79/setup.c
  776. -@@ -175,15 +175,30 @@ static void __init ath79_detect_sys_type
  777. +@@ -175,14 +175,29 @@ static void __init ath79_detect_sys_type
  778. rev = id & QCA955X_REV_ID_REVISION_MASK;
  779. break;
  780. @@ -542,18 +475,18 @@
  781. ath79_soc_rev = rev;
  782. - if (soc_is_qca953x() || soc_is_qca955x())
  783. +- sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s rev %u",
  784. + if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca9561())
  785. - sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u",
  786. - chip, ver, rev);
  787. ++ sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u",
  788. ++ chip, ver, rev);
  789. + else if (soc_is_tp9343())
  790. + sprintf(ath79_sys_type, "Qualcomm Atheros TP%s rev %u",
  791. -+ chip, rev);
  792. + chip, rev);
  793. else
  794. sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev);
  795. - pr_info("SoC: %s\n", ath79_sys_type);
  796. --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  797. +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  798. -@@ -131,6 +131,23 @@
  799. +@@ -143,6 +143,23 @@
  800. #define QCA955X_NFC_BASE 0x1b800200
  801. #define QCA955X_NFC_SIZE 0xb8
  802. @@ -577,7 +510,7 @@
  803. #define AR9300_OTP_BASE 0x14000
  804. #define AR9300_OTP_STATUS 0x15f18
  805. #define AR9300_OTP_STATUS_TYPE 0x7
  806. -@@ -356,6 +373,49 @@
  807. +@@ -375,6 +392,49 @@
  808. #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
  809. #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
  810. @@ -627,7 +560,7 @@
  811. /*
  812. * USB_CONFIG block
  813. */
  814. -@@ -403,6 +463,11 @@
  815. +@@ -422,6 +482,11 @@
  816. #define QCA955X_RESET_REG_BOOTSTRAP 0xb0
  817. #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac
  818. @@ -639,7 +572,7 @@
  819. #define MISC_INT_ETHSW BIT(12)
  820. #define MISC_INT_TIMER4 BIT(10)
  821. #define MISC_INT_TIMER3 BIT(9)
  822. -@@ -551,6 +616,8 @@
  823. +@@ -596,6 +661,8 @@
  824. #define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4)
  825. @@ -648,7 +581,7 @@
  826. #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
  827. #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1)
  828. #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2)
  829. -@@ -600,6 +667,37 @@
  830. +@@ -663,6 +730,37 @@
  831. QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \
  832. QCA955X_EXT_INT_PCIE_RC2_INT3)
  833. @@ -686,7 +619,7 @@
  834. #define REV_ID_MAJOR_MASK 0xfff0
  835. #define REV_ID_MAJOR_AR71XX 0x00a0
  836. #define REV_ID_MAJOR_AR913X 0x00b0
  837. -@@ -615,6 +713,8 @@
  838. +@@ -678,6 +776,8 @@
  839. #define REV_ID_MAJOR_QCA9533_V2 0x0160
  840. #define REV_ID_MAJOR_QCA9556 0x0130
  841. #define REV_ID_MAJOR_QCA9558 0x1130
  842. @@ -695,7 +628,7 @@
  843. #define AR71XX_REV_ID_MINOR_MASK 0x3
  844. #define AR71XX_REV_ID_MINOR_AR7130 0x0
  845. -@@ -639,6 +739,8 @@
  846. +@@ -702,6 +802,8 @@
  847. #define QCA955X_REV_ID_REVISION_MASK 0xf
  848. @@ -704,9 +637,9 @@
  849. /*
  850. * SPI block
  851. */
  852. -@@ -684,6 +786,19 @@
  853. - #define AR934X_GPIO_REG_OUT_FUNC5 0x40
  854. - #define AR934X_GPIO_REG_FUNC 0x6c
  855. +@@ -766,6 +868,19 @@
  856. + #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44
  857. + #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45
  858. +#define QCA956X_GPIO_REG_OUT_FUNC0 0x2c
  859. +#define QCA956X_GPIO_REG_OUT_FUNC1 0x30
  860. @@ -724,9 +657,9 @@
  861. #define AR71XX_GPIO_COUNT 16
  862. #define AR7240_GPIO_COUNT 18
  863. #define AR7241_GPIO_COUNT 20
  864. -@@ -692,6 +807,7 @@
  865. +@@ -774,6 +889,7 @@
  866. #define AR934X_GPIO_COUNT 23
  867. - #define QCA953X_GPIO_COUNT 24
  868. + #define QCA953X_GPIO_COUNT 18
  869. #define QCA955X_GPIO_COUNT 24
  870. +#define QCA956X_GPIO_COUNT 23
  871. diff --git a/target/linux/ar71xx/patches-3.18/736-MIPS-ath79-fix-chained-irq-disable.patch b/target/linux/ar71xx/patches-3.18/736-MIPS-ath79-fix-chained-irq-disable.patch
  872. index 8cb38d3..8c0cc95 100644
  873. --- a/target/linux/ar71xx/patches-3.18/736-MIPS-ath79-fix-chained-irq-disable.patch
  874. +++ b/target/linux/ar71xx/patches-3.18/736-MIPS-ath79-fix-chained-irq-disable.patch
  875. @@ -19,7 +19,16 @@
  876. irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch);
  877. }
  878. -@@ -224,15 +225,13 @@ static void qca955x_irq_init(void)
  879. +@@ -182,7 +183,7 @@ static void qca953x_irq_init(void)
  880. +
  881. + for (i = ATH79_IP2_IRQ_BASE;
  882. + i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++)
  883. +- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  884. ++ irq_set_chip_and_handler(i, &ip2_chip, handle_level_irq);
  885. +
  886. + irq_set_chained_handler(ATH79_CPU_IRQ(2), qca953x_ip2_irq_dispatch);
  887. + }
  888. +@@ -256,15 +257,13 @@ static void qca955x_irq_init(void)
  889. for (i = ATH79_IP2_IRQ_BASE;
  890. i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++)
  891. @@ -37,25 +46,23 @@
  892. irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch);
  893. }
  894. -@@ -313,15 +312,13 @@ static void qca956x_irq_init(void)
  895. +@@ -345,13 +344,13 @@ static void qca956x_irq_init(void)
  896. for (i = ATH79_IP2_IRQ_BASE;
  897. i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++)
  898. -- irq_set_chip_and_handler(i, &dummy_irq_chip,
  899. -- handle_level_irq);
  900. +- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  901. + irq_set_chip_and_handler(i, &ip2_chip, handle_level_irq);
  902. irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch);
  903. for (i = ATH79_IP3_IRQ_BASE;
  904. i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++)
  905. -- irq_set_chip_and_handler(i, &dummy_irq_chip,
  906. -- handle_level_irq);
  907. +- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  908. + irq_set_chip_and_handler(i, &ip3_chip, handle_level_irq);
  909. irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch);
  910. -@@ -430,8 +427,35 @@ static void ar934x_ip3_handler(void)
  911. +@@ -466,8 +465,35 @@ static void qca953x_ip3_handler(void)
  912. do_IRQ(ATH79_CPU_IRQ(3));
  913. }