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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  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 5041619..403897a 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 491a7aa..2bdc744 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. @@ -142,74 +142,9 @@
  572. ath79_uart_data[0].uartclk = uart_clk_rate;
  573. platform_device_register(&ath79_uart_device);
  574. } else if (soc_is_ar933x()) {
  575. ---- a/arch/mips/ath79/dev-eth.c
  576. -+++ b/arch/mips/ath79/dev-eth.c
  577. -@@ -198,6 +198,8 @@ void __init ath79_register_mdio(unsigned
  578. - case ATH79_SOC_AR9330:
  579. - case ATH79_SOC_AR9331:
  580. - case ATH79_SOC_QCA9533:
  581. -+ case ATH79_SOC_QCA9561:
  582. -+ case ATH79_SOC_TP9343:
  583. - mdio_dev = &ath79_mdio1_device;
  584. - mdio_data = &ath79_mdio1_data;
  585. - break;
  586. -@@ -256,6 +258,8 @@ void __init ath79_register_mdio(unsigned
  587. - break;
  588. -
  589. - case ATH79_SOC_QCA9533:
  590. -+ case ATH79_SOC_QCA9561:
  591. -+ case ATH79_SOC_TP9343:
  592. - mdio_data->builtin_switch = 1;
  593. - break;
  594. -
  595. -@@ -571,6 +575,8 @@ static void __init ath79_init_eth_pll_da
  596. - case ATH79_SOC_QCA9533:
  597. - case ATH79_SOC_QCA9556:
  598. - case ATH79_SOC_QCA9558:
  599. -+ case ATH79_SOC_QCA9561:
  600. -+ case ATH79_SOC_TP9343:
  601. - pll_10 = AR934X_PLL_VAL_10;
  602. - pll_100 = AR934X_PLL_VAL_100;
  603. - pll_1000 = AR934X_PLL_VAL_1000;
  604. -@@ -627,6 +633,8 @@ static int __init ath79_setup_phy_if_mod
  605. - case ATH79_SOC_AR9330:
  606. - case ATH79_SOC_AR9331:
  607. - case ATH79_SOC_QCA9533:
  608. -+ case ATH79_SOC_QCA9561:
  609. -+ case ATH79_SOC_TP9343:
  610. - pdata->phy_if_mode = PHY_INTERFACE_MODE_MII;
  611. - break;
  612. -
  613. -@@ -688,6 +696,8 @@ static int __init ath79_setup_phy_if_mod
  614. - case ATH79_SOC_AR9330:
  615. - case ATH79_SOC_AR9331:
  616. - case ATH79_SOC_QCA9533:
  617. -+ case ATH79_SOC_QCA9561:
  618. -+ case ATH79_SOC_TP9343:
  619. - pdata->phy_if_mode = PHY_INTERFACE_MODE_GMII;
  620. - break;
  621. -
  622. -@@ -1018,6 +1028,8 @@ void __init ath79_register_eth(unsigned
  623. - break;
  624. -
  625. - case ATH79_SOC_QCA9533:
  626. -+ case ATH79_SOC_QCA9561:
  627. -+ case ATH79_SOC_TP9343:
  628. - if (id == 0) {
  629. - pdata->reset_bit = AR933X_RESET_GE0_MAC |
  630. - AR933X_RESET_GE0_MDIO;
  631. -@@ -1123,6 +1135,8 @@ void __init ath79_register_eth(unsigned
  632. - case ATH79_SOC_AR9330:
  633. - case ATH79_SOC_AR9331:
  634. - case ATH79_SOC_QCA9533:
  635. -+ case ATH79_SOC_QCA9561:
  636. -+ case ATH79_SOC_TP9343:
  637. - pdata->mii_bus_dev = &ath79_mdio1_device.dev;
  638. - break;
  639. -
  640. --- a/arch/mips/ath79/dev-usb.c
  641. +++ b/arch/mips/ath79/dev-usb.c
  642. -@@ -272,6 +272,19 @@ static void __init qca955x_usb_setup(voi
  643. +@@ -296,6 +296,19 @@ static void __init qca955x_usb_setup(voi
  644. &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2));
  645. }
  646. @@ -229,8 +164,8 @@
  647. void __init ath79_register_usb(void)
  648. {
  649. if (soc_is_ar71xx())
  650. -@@ -288,6 +301,8 @@ void __init ath79_register_usb(void)
  651. - ar934x_usb_setup();
  652. +@@ -314,6 +327,8 @@ void __init ath79_register_usb(void)
  653. + qca953x_usb_setup();
  654. else if (soc_is_qca955x())
  655. qca955x_usb_setup();
  656. + else if (soc_is_qca9561())
  657. @@ -291,9 +226,9 @@
  658. soc_is_ar913x() ||
  659. soc_is_ar933x())
  660. reg = AR71XX_GPIO_REG_FUNC;
  661. -- else if (soc_is_ar934x())
  662. +- else if (soc_is_ar934x() || soc_is_qca953x())
  663. + else if (soc_is_ar934x() ||
  664. -+ soc_is_qca956x())
  665. ++ soc_is_qca953x() || soc_is_qca956x())
  666. reg = AR934X_GPIO_REG_FUNC;
  667. else
  668. BUG();
  669. @@ -326,7 +261,7 @@
  670. ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack;
  671. else
  672. BUG();
  673. -@@ -236,6 +237,99 @@ static void qca955x_irq_init(void)
  674. +@@ -268,6 +269,97 @@ static void qca955x_irq_init(void)
  675. irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch);
  676. }
  677. @@ -406,15 +341,13 @@
  678. +
  679. + for (i = ATH79_IP2_IRQ_BASE;
  680. + i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++)
  681. -+ irq_set_chip_and_handler(i, &dummy_irq_chip,
  682. -+ handle_level_irq);
  683. ++ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  684. +
  685. + irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch);
  686. +
  687. + for (i = ATH79_IP3_IRQ_BASE;
  688. + i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++)
  689. -+ irq_set_chip_and_handler(i, &dummy_irq_chip,
  690. -+ handle_level_irq);
  691. ++ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  692. +
  693. + irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch);
  694. +
  695. @@ -426,7 +359,7 @@
  696. asmlinkage void plat_irq_dispatch(void)
  697. {
  698. unsigned long pending;
  699. -@@ -359,6 +453,9 @@ void __init arch_init_irq(void)
  700. +@@ -397,6 +489,9 @@ void __init arch_init_irq(void)
  701. } else if (soc_is_qca955x()) {
  702. ath79_ip2_handler = ath79_default_ip2_handler;
  703. ath79_ip3_handler = ath79_default_ip3_handler;
  704. @@ -436,8 +369,8 @@
  705. } else {
  706. BUG();
  707. }
  708. -@@ -371,4 +468,6 @@ void __init arch_init_irq(void)
  709. - ar934x_ip2_irq_init();
  710. +@@ -411,4 +506,6 @@ void __init arch_init_irq(void)
  711. + qca953x_irq_init();
  712. else if (soc_is_qca955x())
  713. qca955x_irq_init();
  714. + else if (soc_is_qca956x())
  715. @@ -519,7 +452,7 @@
  716. return -ENODEV;
  717. --- a/arch/mips/ath79/setup.c
  718. +++ b/arch/mips/ath79/setup.c
  719. -@@ -175,15 +175,30 @@ static void __init ath79_detect_sys_type
  720. +@@ -175,14 +175,29 @@ static void __init ath79_detect_sys_type
  721. rev = id & QCA955X_REV_ID_REVISION_MASK;
  722. break;
  723. @@ -542,18 +475,18 @@
  724. ath79_soc_rev = rev;
  725. - if (soc_is_qca953x() || soc_is_qca955x())
  726. +- sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s rev %u",
  727. + if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca9561())
  728. - sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u",
  729. - chip, ver, rev);
  730. ++ sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u",
  731. ++ chip, ver, rev);
  732. + else if (soc_is_tp9343())
  733. + sprintf(ath79_sys_type, "Qualcomm Atheros TP%s rev %u",
  734. -+ chip, rev);
  735. + chip, rev);
  736. else
  737. sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev);
  738. - pr_info("SoC: %s\n", ath79_sys_type);
  739. --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  740. +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  741. -@@ -131,6 +131,23 @@
  742. +@@ -143,6 +143,23 @@
  743. #define QCA955X_NFC_BASE 0x1b800200
  744. #define QCA955X_NFC_SIZE 0xb8
  745. @@ -577,7 +510,7 @@
  746. #define AR9300_OTP_BASE 0x14000
  747. #define AR9300_OTP_STATUS 0x15f18
  748. #define AR9300_OTP_STATUS_TYPE 0x7
  749. -@@ -356,6 +373,49 @@
  750. +@@ -375,6 +392,49 @@
  751. #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
  752. #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
  753. @@ -627,7 +560,7 @@
  754. /*
  755. * USB_CONFIG block
  756. */
  757. -@@ -403,6 +463,11 @@
  758. +@@ -422,6 +482,11 @@
  759. #define QCA955X_RESET_REG_BOOTSTRAP 0xb0
  760. #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac
  761. @@ -639,7 +572,7 @@
  762. #define MISC_INT_ETHSW BIT(12)
  763. #define MISC_INT_TIMER4 BIT(10)
  764. #define MISC_INT_TIMER3 BIT(9)
  765. -@@ -551,6 +616,8 @@
  766. +@@ -596,6 +661,8 @@
  767. #define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4)
  768. @@ -648,7 +581,7 @@
  769. #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
  770. #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1)
  771. #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2)
  772. -@@ -600,6 +667,37 @@
  773. +@@ -663,6 +730,37 @@
  774. QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \
  775. QCA955X_EXT_INT_PCIE_RC2_INT3)
  776. @@ -686,7 +619,7 @@
  777. #define REV_ID_MAJOR_MASK 0xfff0
  778. #define REV_ID_MAJOR_AR71XX 0x00a0
  779. #define REV_ID_MAJOR_AR913X 0x00b0
  780. -@@ -615,6 +713,8 @@
  781. +@@ -678,6 +776,8 @@
  782. #define REV_ID_MAJOR_QCA9533_V2 0x0160
  783. #define REV_ID_MAJOR_QCA9556 0x0130
  784. #define REV_ID_MAJOR_QCA9558 0x1130
  785. @@ -695,7 +628,7 @@
  786. #define AR71XX_REV_ID_MINOR_MASK 0x3
  787. #define AR71XX_REV_ID_MINOR_AR7130 0x0
  788. -@@ -639,6 +739,8 @@
  789. +@@ -702,6 +802,8 @@
  790. #define QCA955X_REV_ID_REVISION_MASK 0xf
  791. @@ -704,9 +637,9 @@
  792. /*
  793. * SPI block
  794. */
  795. -@@ -684,6 +786,19 @@
  796. - #define AR934X_GPIO_REG_OUT_FUNC5 0x40
  797. - #define AR934X_GPIO_REG_FUNC 0x6c
  798. +@@ -766,6 +868,19 @@
  799. + #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44
  800. + #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45
  801. +#define QCA956X_GPIO_REG_OUT_FUNC0 0x2c
  802. +#define QCA956X_GPIO_REG_OUT_FUNC1 0x30
  803. @@ -724,9 +657,9 @@
  804. #define AR71XX_GPIO_COUNT 16
  805. #define AR7240_GPIO_COUNT 18
  806. #define AR7241_GPIO_COUNT 20
  807. -@@ -692,6 +807,7 @@
  808. +@@ -774,6 +889,7 @@
  809. #define AR934X_GPIO_COUNT 23
  810. - #define QCA953X_GPIO_COUNT 24
  811. + #define QCA953X_GPIO_COUNT 18
  812. #define QCA955X_GPIO_COUNT 24
  813. +#define QCA956X_GPIO_COUNT 23
  814. 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
  815. index 8cb38d3..8c0cc95 100644
  816. --- a/target/linux/ar71xx/patches-3.18/736-MIPS-ath79-fix-chained-irq-disable.patch
  817. +++ b/target/linux/ar71xx/patches-3.18/736-MIPS-ath79-fix-chained-irq-disable.patch
  818. @@ -19,7 +19,16 @@
  819. irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch);
  820. }
  821. -@@ -224,15 +225,13 @@ static void qca955x_irq_init(void)
  822. +@@ -182,7 +183,7 @@ static void qca953x_irq_init(void)
  823. +
  824. + for (i = ATH79_IP2_IRQ_BASE;
  825. + i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++)
  826. +- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  827. ++ irq_set_chip_and_handler(i, &ip2_chip, handle_level_irq);
  828. +
  829. + irq_set_chained_handler(ATH79_CPU_IRQ(2), qca953x_ip2_irq_dispatch);
  830. + }
  831. +@@ -256,15 +257,13 @@ static void qca955x_irq_init(void)
  832. for (i = ATH79_IP2_IRQ_BASE;
  833. i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++)
  834. @@ -37,25 +46,23 @@
  835. irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch);
  836. }
  837. -@@ -313,15 +312,13 @@ static void qca956x_irq_init(void)
  838. +@@ -345,13 +344,13 @@ static void qca956x_irq_init(void)
  839. for (i = ATH79_IP2_IRQ_BASE;
  840. i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++)
  841. -- irq_set_chip_and_handler(i, &dummy_irq_chip,
  842. -- handle_level_irq);
  843. +- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  844. + irq_set_chip_and_handler(i, &ip2_chip, handle_level_irq);
  845. irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch);
  846. for (i = ATH79_IP3_IRQ_BASE;
  847. i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++)
  848. -- irq_set_chip_and_handler(i, &dummy_irq_chip,
  849. -- handle_level_irq);
  850. +- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq);
  851. + irq_set_chip_and_handler(i, &ip3_chip, handle_level_irq);
  852. irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch);
  853. -@@ -430,8 +427,35 @@ static void ar934x_ip3_handler(void)
  854. +@@ -466,8 +465,35 @@ static void qca953x_ip3_handler(void)
  855. do_IRQ(ATH79_CPU_IRQ(3));
  856. }