sysctrl.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License version 2 as published
  4. * by the Free Software Foundation.
  5. *
  6. * Copyright (C) 2011-2012 John Crispin <john@phrozen.org>
  7. * Copyright (C) 2013-2015 Lantiq Beteiligungs-GmbH & Co.KG
  8. */
  9. #include <linux/ioport.h>
  10. #include <linux/export.h>
  11. #include <linux/clkdev.h>
  12. #include <linux/spinlock.h>
  13. #include <linux/of.h>
  14. #include <linux/of_platform.h>
  15. #include <linux/of_address.h>
  16. #include <lantiq_soc.h>
  17. #include "../clk.h"
  18. #include "../prom.h"
  19. /* clock control register for legacy */
  20. #define CGU_IFCCR 0x0018
  21. #define CGU_IFCCR_VR9 0x0024
  22. /* system clock register for legacy */
  23. #define CGU_SYS 0x0010
  24. /* pci control register */
  25. #define CGU_PCICR 0x0034
  26. #define CGU_PCICR_VR9 0x0038
  27. /* ephy configuration register */
  28. #define CGU_EPHY 0x10
  29. /* Legacy PMU register for ar9, ase, danube */
  30. /* power control register */
  31. #define PMU_PWDCR 0x1C
  32. /* power status register */
  33. #define PMU_PWDSR 0x20
  34. /* power control register */
  35. #define PMU_PWDCR1 0x24
  36. /* power status register */
  37. #define PMU_PWDSR1 0x28
  38. /* power control register */
  39. #define PWDCR(x) ((x) ? (PMU_PWDCR1) : (PMU_PWDCR))
  40. /* power status register */
  41. #define PWDSR(x) ((x) ? (PMU_PWDSR1) : (PMU_PWDSR))
  42. /* PMU register for ar10 and grx390 */
  43. /* First register set */
  44. #define PMU_CLK_SR 0x20 /* status */
  45. #define PMU_CLK_CR_A 0x24 /* Enable */
  46. #define PMU_CLK_CR_B 0x28 /* Disable */
  47. /* Second register set */
  48. #define PMU_CLK_SR1 0x30 /* status */
  49. #define PMU_CLK_CR1_A 0x34 /* Enable */
  50. #define PMU_CLK_CR1_B 0x38 /* Disable */
  51. /* Third register set */
  52. #define PMU_ANA_SR 0x40 /* status */
  53. #define PMU_ANA_CR_A 0x44 /* Enable */
  54. #define PMU_ANA_CR_B 0x48 /* Disable */
  55. /* Status */
  56. static u32 pmu_clk_sr[] = {
  57. PMU_CLK_SR,
  58. PMU_CLK_SR1,
  59. PMU_ANA_SR,
  60. };
  61. /* Enable */
  62. static u32 pmu_clk_cr_a[] = {
  63. PMU_CLK_CR_A,
  64. PMU_CLK_CR1_A,
  65. PMU_ANA_CR_A,
  66. };
  67. /* Disable */
  68. static u32 pmu_clk_cr_b[] = {
  69. PMU_CLK_CR_B,
  70. PMU_CLK_CR1_B,
  71. PMU_ANA_CR_B,
  72. };
  73. #define PWDCR_EN_XRX(x) (pmu_clk_cr_a[(x)])
  74. #define PWDCR_DIS_XRX(x) (pmu_clk_cr_b[(x)])
  75. #define PWDSR_XRX(x) (pmu_clk_sr[(x)])
  76. /* clock gates that we can en/disable */
  77. #define PMU_USB0_P BIT(0)
  78. #define PMU_ASE_SDIO BIT(2) /* ASE special */
  79. #define PMU_PCI BIT(4)
  80. #define PMU_DMA BIT(5)
  81. #define PMU_USB0 BIT(6)
  82. #define PMU_ASC0 BIT(7)
  83. #define PMU_EPHY BIT(7) /* ase */
  84. #define PMU_USIF BIT(7) /* from vr9 until grx390 */
  85. #define PMU_SPI BIT(8)
  86. #define PMU_DFE BIT(9)
  87. #define PMU_EBU BIT(10)
  88. #define PMU_STP BIT(11)
  89. #define PMU_GPT BIT(12)
  90. #define PMU_AHBS BIT(13) /* vr9 */
  91. #define PMU_FPI BIT(14)
  92. #define PMU_AHBM BIT(15)
  93. #define PMU_SDIO BIT(16) /* danube, ar9, vr9 */
  94. #define PMU_ASC1 BIT(17)
  95. #define PMU_PPE_QSB BIT(18)
  96. #define PMU_PPE_SLL01 BIT(19)
  97. #define PMU_DEU BIT(20)
  98. #define PMU_PPE_TC BIT(21)
  99. #define PMU_PPE_EMA BIT(22)
  100. #define PMU_PPE_DPLUM BIT(23)
  101. #define PMU_PPE_DP BIT(23)
  102. #define PMU_PPE_DPLUS BIT(24)
  103. #define PMU_USB1_P BIT(26)
  104. #define PMU_USB1 BIT(27)
  105. #define PMU_SWITCH BIT(28)
  106. #define PMU_PPE_TOP BIT(29)
  107. #define PMU_GPHY BIT(30)
  108. #define PMU_PCIE_CLK BIT(31)
  109. #define PMU1_PCIE_PHY BIT(0) /* vr9-specific,moved in ar10/grx390 */
  110. #define PMU1_PCIE_CTL BIT(1)
  111. #define PMU1_PCIE_PDI BIT(4)
  112. #define PMU1_PCIE_MSI BIT(5)
  113. #define PMU1_CKE BIT(6)
  114. #define PMU1_PCIE1_CTL BIT(17)
  115. #define PMU1_PCIE1_PDI BIT(20)
  116. #define PMU1_PCIE1_MSI BIT(21)
  117. #define PMU1_PCIE2_CTL BIT(25)
  118. #define PMU1_PCIE2_PDI BIT(26)
  119. #define PMU1_PCIE2_MSI BIT(27)
  120. #define PMU_ANALOG_USB0_P BIT(0)
  121. #define PMU_ANALOG_USB1_P BIT(1)
  122. #define PMU_ANALOG_PCIE0_P BIT(8)
  123. #define PMU_ANALOG_PCIE1_P BIT(9)
  124. #define PMU_ANALOG_PCIE2_P BIT(10)
  125. #define PMU_ANALOG_DSL_AFE BIT(16)
  126. #define PMU_ANALOG_DCDC_2V5 BIT(17)
  127. #define PMU_ANALOG_DCDC_1VX BIT(18)
  128. #define PMU_ANALOG_DCDC_1V0 BIT(19)
  129. #define pmu_w32(x, y) ltq_w32((x), pmu_membase + (y))
  130. #define pmu_r32(x) ltq_r32(pmu_membase + (x))
  131. #define XBAR_ALWAYS_LAST 0x430
  132. #define XBAR_FPI_BURST_EN BIT(1)
  133. #define XBAR_AHB_BURST_EN BIT(2)
  134. #define xbar_w32(x, y) ltq_w32((x), ltq_xbar_membase + (y))
  135. #define xbar_r32(x) ltq_r32(ltq_xbar_membase + (x))
  136. static void __iomem *pmu_membase;
  137. static void __iomem *ltq_xbar_membase;
  138. void __iomem *ltq_cgu_membase;
  139. void __iomem *ltq_ebu_membase;
  140. static u32 ifccr = CGU_IFCCR;
  141. static u32 pcicr = CGU_PCICR;
  142. static DEFINE_SPINLOCK(g_pmu_lock);
  143. /* legacy function kept alive to ease clkdev transition */
  144. void ltq_pmu_enable(unsigned int module)
  145. {
  146. int retry = 1000000;
  147. spin_lock(&g_pmu_lock);
  148. pmu_w32(pmu_r32(PMU_PWDCR) & ~module, PMU_PWDCR);
  149. do {} while (--retry && (pmu_r32(PMU_PWDSR) & module));
  150. spin_unlock(&g_pmu_lock);
  151. if (!retry)
  152. panic("activating PMU module failed!");
  153. }
  154. EXPORT_SYMBOL(ltq_pmu_enable);
  155. /* legacy function kept alive to ease clkdev transition */
  156. void ltq_pmu_disable(unsigned int module)
  157. {
  158. int retry = 1000000;
  159. spin_lock(&g_pmu_lock);
  160. pmu_w32(pmu_r32(PMU_PWDCR) | module, PMU_PWDCR);
  161. do {} while (--retry && (!(pmu_r32(PMU_PWDSR) & module)));
  162. spin_unlock(&g_pmu_lock);
  163. if (!retry)
  164. pr_warn("deactivating PMU module failed!");
  165. }
  166. EXPORT_SYMBOL(ltq_pmu_disable);
  167. /* enable a hw clock */
  168. static int cgu_enable(struct clk *clk)
  169. {
  170. ltq_cgu_w32(ltq_cgu_r32(ifccr) | clk->bits, ifccr);
  171. return 0;
  172. }
  173. /* disable a hw clock */
  174. static void cgu_disable(struct clk *clk)
  175. {
  176. ltq_cgu_w32(ltq_cgu_r32(ifccr) & ~clk->bits, ifccr);
  177. }
  178. /* enable a clock gate */
  179. static int pmu_enable(struct clk *clk)
  180. {
  181. int retry = 1000000;
  182. if (of_machine_is_compatible("lantiq,ar10")
  183. || of_machine_is_compatible("lantiq,grx390")) {
  184. pmu_w32(clk->bits, PWDCR_EN_XRX(clk->module));
  185. do {} while (--retry &&
  186. (!(pmu_r32(PWDSR_XRX(clk->module)) & clk->bits)));
  187. } else {
  188. spin_lock(&g_pmu_lock);
  189. pmu_w32(pmu_r32(PWDCR(clk->module)) & ~clk->bits,
  190. PWDCR(clk->module));
  191. do {} while (--retry &&
  192. (pmu_r32(PWDSR(clk->module)) & clk->bits));
  193. spin_unlock(&g_pmu_lock);
  194. }
  195. if (!retry)
  196. panic("activating PMU module failed!");
  197. return 0;
  198. }
  199. /* disable a clock gate */
  200. static void pmu_disable(struct clk *clk)
  201. {
  202. int retry = 1000000;
  203. if (of_machine_is_compatible("lantiq,ar10")
  204. || of_machine_is_compatible("lantiq,grx390")) {
  205. pmu_w32(clk->bits, PWDCR_DIS_XRX(clk->module));
  206. do {} while (--retry &&
  207. (pmu_r32(PWDSR_XRX(clk->module)) & clk->bits));
  208. } else {
  209. spin_lock(&g_pmu_lock);
  210. pmu_w32(pmu_r32(PWDCR(clk->module)) | clk->bits,
  211. PWDCR(clk->module));
  212. do {} while (--retry &&
  213. (!(pmu_r32(PWDSR(clk->module)) & clk->bits)));
  214. spin_unlock(&g_pmu_lock);
  215. }
  216. if (!retry)
  217. pr_warn("deactivating PMU module failed!");
  218. }
  219. /* the pci enable helper */
  220. static int pci_enable(struct clk *clk)
  221. {
  222. unsigned int val = ltq_cgu_r32(ifccr);
  223. /* set bus clock speed */
  224. if (of_machine_is_compatible("lantiq,ar9") ||
  225. of_machine_is_compatible("lantiq,vr9")) {
  226. val &= ~0x1f00000;
  227. if (clk->rate == CLOCK_33M)
  228. val |= 0xe00000;
  229. else
  230. val |= 0x700000; /* 62.5M */
  231. } else {
  232. val &= ~0xf00000;
  233. if (clk->rate == CLOCK_33M)
  234. val |= 0x800000;
  235. else
  236. val |= 0x400000; /* 62.5M */
  237. }
  238. ltq_cgu_w32(val, ifccr);
  239. pmu_enable(clk);
  240. return 0;
  241. }
  242. /* enable the external clock as a source */
  243. static int pci_ext_enable(struct clk *clk)
  244. {
  245. ltq_cgu_w32(ltq_cgu_r32(ifccr) & ~(1 << 16), ifccr);
  246. ltq_cgu_w32((1 << 30), pcicr);
  247. return 0;
  248. }
  249. /* disable the external clock as a source */
  250. static void pci_ext_disable(struct clk *clk)
  251. {
  252. ltq_cgu_w32(ltq_cgu_r32(ifccr) | (1 << 16), ifccr);
  253. ltq_cgu_w32((1 << 31) | (1 << 30), pcicr);
  254. }
  255. static void xbar_fpi_burst_disable(void)
  256. {
  257. u32 reg;
  258. /* bit 1 as 1 --burst; bit 1 as 0 -- single */
  259. reg = xbar_r32(XBAR_ALWAYS_LAST);
  260. reg &= ~XBAR_FPI_BURST_EN;
  261. xbar_w32(reg, XBAR_ALWAYS_LAST);
  262. }
  263. /* enable a clockout source */
  264. static int clkout_enable(struct clk *clk)
  265. {
  266. int i;
  267. /* get the correct rate */
  268. for (i = 0; i < 4; i++) {
  269. if (clk->rates[i] == clk->rate) {
  270. int shift = 14 - (2 * clk->module);
  271. int enable = 7 - clk->module;
  272. unsigned int val = ltq_cgu_r32(ifccr);
  273. val &= ~(3 << shift);
  274. val |= i << shift;
  275. val |= enable;
  276. ltq_cgu_w32(val, ifccr);
  277. return 0;
  278. }
  279. }
  280. return -1;
  281. }
  282. /* manage the clock gates via PMU */
  283. static void clkdev_add_pmu(const char *dev, const char *con, bool deactivate,
  284. unsigned int module, unsigned int bits)
  285. {
  286. struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
  287. clk->cl.dev_id = dev;
  288. clk->cl.con_id = con;
  289. clk->cl.clk = clk;
  290. clk->enable = pmu_enable;
  291. clk->disable = pmu_disable;
  292. clk->module = module;
  293. clk->bits = bits;
  294. if (deactivate) {
  295. /*
  296. * Disable it during the initialization. Module should enable
  297. * when used
  298. */
  299. pmu_disable(clk);
  300. }
  301. clkdev_add(&clk->cl);
  302. }
  303. /* manage the clock generator */
  304. static void clkdev_add_cgu(const char *dev, const char *con,
  305. unsigned int bits)
  306. {
  307. struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
  308. clk->cl.dev_id = dev;
  309. clk->cl.con_id = con;
  310. clk->cl.clk = clk;
  311. clk->enable = cgu_enable;
  312. clk->disable = cgu_disable;
  313. clk->bits = bits;
  314. clkdev_add(&clk->cl);
  315. }
  316. /* pci needs its own enable function as the setup is a bit more complex */
  317. static unsigned long valid_pci_rates[] = {CLOCK_33M, CLOCK_62_5M, 0};
  318. static void clkdev_add_pci(void)
  319. {
  320. struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
  321. struct clk *clk_ext = kzalloc(sizeof(struct clk), GFP_KERNEL);
  322. /* main pci clock */
  323. clk->cl.dev_id = "17000000.pci";
  324. clk->cl.con_id = NULL;
  325. clk->cl.clk = clk;
  326. clk->rate = CLOCK_33M;
  327. clk->rates = valid_pci_rates;
  328. clk->enable = pci_enable;
  329. clk->disable = pmu_disable;
  330. clk->module = 0;
  331. clk->bits = PMU_PCI;
  332. clkdev_add(&clk->cl);
  333. /* use internal/external bus clock */
  334. clk_ext->cl.dev_id = "17000000.pci";
  335. clk_ext->cl.con_id = "external";
  336. clk_ext->cl.clk = clk_ext;
  337. clk_ext->enable = pci_ext_enable;
  338. clk_ext->disable = pci_ext_disable;
  339. clkdev_add(&clk_ext->cl);
  340. }
  341. /* xway socs can generate clocks on gpio pins */
  342. static unsigned long valid_clkout_rates[4][5] = {
  343. {CLOCK_32_768K, CLOCK_1_536M, CLOCK_2_5M, CLOCK_12M, 0},
  344. {CLOCK_40M, CLOCK_12M, CLOCK_24M, CLOCK_48M, 0},
  345. {CLOCK_25M, CLOCK_40M, CLOCK_30M, CLOCK_60M, 0},
  346. {CLOCK_12M, CLOCK_50M, CLOCK_32_768K, CLOCK_25M, 0},
  347. };
  348. static void clkdev_add_clkout(void)
  349. {
  350. int i;
  351. for (i = 0; i < 4; i++) {
  352. struct clk *clk;
  353. char *name;
  354. name = kzalloc(sizeof("clkout0"), GFP_KERNEL);
  355. sprintf(name, "clkout%d", i);
  356. clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
  357. clk->cl.dev_id = "1f103000.cgu";
  358. clk->cl.con_id = name;
  359. clk->cl.clk = clk;
  360. clk->rate = 0;
  361. clk->rates = valid_clkout_rates[i];
  362. clk->enable = clkout_enable;
  363. clk->module = i;
  364. clkdev_add(&clk->cl);
  365. }
  366. }
  367. /* bring up all register ranges that we need for basic system control */
  368. void __init ltq_soc_init(void)
  369. {
  370. struct resource res_pmu, res_cgu, res_ebu;
  371. struct device_node *np_pmu =
  372. of_find_compatible_node(NULL, NULL, "lantiq,pmu-xway");
  373. struct device_node *np_cgu =
  374. of_find_compatible_node(NULL, NULL, "lantiq,cgu-xway");
  375. struct device_node *np_ebu =
  376. of_find_compatible_node(NULL, NULL, "lantiq,ebu-xway");
  377. /* check if all the core register ranges are available */
  378. if (!np_pmu || !np_cgu || !np_ebu)
  379. panic("Failed to load core nodes from devicetree");
  380. if (of_address_to_resource(np_pmu, 0, &res_pmu) ||
  381. of_address_to_resource(np_cgu, 0, &res_cgu) ||
  382. of_address_to_resource(np_ebu, 0, &res_ebu))
  383. panic("Failed to get core resources");
  384. if (!request_mem_region(res_pmu.start, resource_size(&res_pmu),
  385. res_pmu.name) ||
  386. !request_mem_region(res_cgu.start, resource_size(&res_cgu),
  387. res_cgu.name) ||
  388. !request_mem_region(res_ebu.start, resource_size(&res_ebu),
  389. res_ebu.name))
  390. pr_err("Failed to request core resources");
  391. pmu_membase = ioremap_nocache(res_pmu.start, resource_size(&res_pmu));
  392. ltq_cgu_membase = ioremap_nocache(res_cgu.start,
  393. resource_size(&res_cgu));
  394. ltq_ebu_membase = ioremap_nocache(res_ebu.start,
  395. resource_size(&res_ebu));
  396. if (!pmu_membase || !ltq_cgu_membase || !ltq_ebu_membase)
  397. panic("Failed to remap core resources");
  398. if (of_machine_is_compatible("lantiq,vr9")) {
  399. struct resource res_xbar;
  400. struct device_node *np_xbar =
  401. of_find_compatible_node(NULL, NULL,
  402. "lantiq,xbar-xway");
  403. if (!np_xbar)
  404. panic("Failed to load xbar nodes from devicetree");
  405. if (of_address_to_resource(np_xbar, 0, &res_xbar))
  406. panic("Failed to get xbar resources");
  407. if (!request_mem_region(res_xbar.start, resource_size(&res_xbar),
  408. res_xbar.name))
  409. panic("Failed to get xbar resources");
  410. ltq_xbar_membase = ioremap_nocache(res_xbar.start,
  411. resource_size(&res_xbar));
  412. if (!ltq_xbar_membase)
  413. panic("Failed to remap xbar resources");
  414. }
  415. /* make sure to unprotect the memory region where flash is located */
  416. ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_BUSCON0) & ~EBU_WRDIS, LTQ_EBU_BUSCON0);
  417. /* add our generic xway clocks */
  418. clkdev_add_pmu("10000000.fpi", NULL, 0, 0, PMU_FPI);
  419. clkdev_add_pmu("1e100400.serial", NULL, 0, 0, PMU_ASC0);
  420. clkdev_add_pmu("1e100a00.gptu", NULL, 1, 0, PMU_GPT);
  421. clkdev_add_pmu("1e100bb0.stp", NULL, 1, 0, PMU_STP);
  422. clkdev_add_pmu("1e104100.dma", NULL, 1, 0, PMU_DMA);
  423. clkdev_add_pmu("1e100800.spi", NULL, 1, 0, PMU_SPI);
  424. clkdev_add_pmu("1e105300.ebu", NULL, 0, 0, PMU_EBU);
  425. clkdev_add_clkout();
  426. /* add the soc dependent clocks */
  427. if (of_machine_is_compatible("lantiq,vr9")) {
  428. ifccr = CGU_IFCCR_VR9;
  429. pcicr = CGU_PCICR_VR9;
  430. } else {
  431. clkdev_add_pmu("1e180000.etop", NULL, 1, 0, PMU_PPE);
  432. }
  433. if (!of_machine_is_compatible("lantiq,ase")) {
  434. clkdev_add_pmu("1e100c00.serial", NULL, 0, 0, PMU_ASC1);
  435. clkdev_add_pci();
  436. }
  437. if (of_machine_is_compatible("lantiq,grx390") ||
  438. of_machine_is_compatible("lantiq,ar10")) {
  439. clkdev_add_pmu("1e101000.usb", "phy", 1, 2, PMU_ANALOG_USB0_P);
  440. clkdev_add_pmu("1e106000.usb", "phy", 1, 2, PMU_ANALOG_USB1_P);
  441. /* rc 0 */
  442. clkdev_add_pmu("1d900000.pcie", "phy", 1, 2, PMU_ANALOG_PCIE0_P);
  443. clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI);
  444. clkdev_add_pmu("1d900000.pcie", "pdi", 1, 1, PMU1_PCIE_PDI);
  445. clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL);
  446. /* rc 1 */
  447. clkdev_add_pmu("19000000.pcie", "phy", 1, 2, PMU_ANALOG_PCIE1_P);
  448. clkdev_add_pmu("19000000.pcie", "msi", 1, 1, PMU1_PCIE1_MSI);
  449. clkdev_add_pmu("19000000.pcie", "pdi", 1, 1, PMU1_PCIE1_PDI);
  450. clkdev_add_pmu("19000000.pcie", "ctl", 1, 1, PMU1_PCIE1_CTL);
  451. }
  452. if (of_machine_is_compatible("lantiq,ase")) {
  453. if (ltq_cgu_r32(CGU_SYS) & (1 << 5))
  454. clkdev_add_static(CLOCK_266M, CLOCK_133M,
  455. CLOCK_133M, CLOCK_266M);
  456. else
  457. clkdev_add_static(CLOCK_133M, CLOCK_133M,
  458. CLOCK_133M, CLOCK_133M);
  459. clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
  460. clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
  461. clkdev_add_pmu("1e180000.etop", "ppe", 1, 0, PMU_PPE);
  462. clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY);
  463. clkdev_add_pmu("1e180000.etop", "ephy", 1, 0, PMU_EPHY);
  464. clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_ASE_SDIO);
  465. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  466. } else if (of_machine_is_compatible("lantiq,grx390")) {
  467. clkdev_add_static(ltq_grx390_cpu_hz(), ltq_grx390_fpi_hz(),
  468. ltq_grx390_fpi_hz(), ltq_grx390_pp32_hz());
  469. clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
  470. clkdev_add_pmu("1e106000.usb", "ctl", 1, 0, PMU_USB1);
  471. /* rc 2 */
  472. clkdev_add_pmu("1a800000.pcie", "phy", 1, 2, PMU_ANALOG_PCIE2_P);
  473. clkdev_add_pmu("1a800000.pcie", "msi", 1, 1, PMU1_PCIE2_MSI);
  474. clkdev_add_pmu("1a800000.pcie", "pdi", 1, 1, PMU1_PCIE2_PDI);
  475. clkdev_add_pmu("1a800000.pcie", "ctl", 1, 1, PMU1_PCIE2_CTL);
  476. clkdev_add_pmu("1e108000.eth", NULL, 0, 0, PMU_SWITCH | PMU_PPE_DP);
  477. clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
  478. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  479. } else if (of_machine_is_compatible("lantiq,ar10")) {
  480. clkdev_add_static(ltq_ar10_cpu_hz(), ltq_ar10_fpi_hz(),
  481. ltq_ar10_fpi_hz(), ltq_ar10_pp32_hz());
  482. clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
  483. clkdev_add_pmu("1e106000.usb", "ctl", 1, 0, PMU_USB1);
  484. clkdev_add_pmu("1e108000.eth", NULL, 0, 0, PMU_SWITCH |
  485. PMU_PPE_DP | PMU_PPE_TC);
  486. clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
  487. clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
  488. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  489. clkdev_add_pmu("1e116000.mei", "afe", 1, 2, PMU_ANALOG_DSL_AFE);
  490. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  491. } else if (of_machine_is_compatible("lantiq,vr9")) {
  492. clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(),
  493. ltq_vr9_fpi_hz(), ltq_vr9_pp32_hz());
  494. clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
  495. clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0 | PMU_AHBM);
  496. clkdev_add_pmu("1e106000.usb", "phy", 1, 0, PMU_USB1_P);
  497. clkdev_add_pmu("1e106000.usb", "ctl", 1, 0, PMU_USB1 | PMU_AHBM);
  498. clkdev_add_pmu("1d900000.pcie", "phy", 1, 1, PMU1_PCIE_PHY);
  499. clkdev_add_pmu("1d900000.pcie", "bus", 1, 0, PMU_PCIE_CLK);
  500. clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI);
  501. clkdev_add_pmu("1d900000.pcie", "pdi", 1, 1, PMU1_PCIE_PDI);
  502. clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL);
  503. clkdev_add_pmu(NULL, "ahb", 1, 0, PMU_AHBM | PMU_AHBS);
  504. clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
  505. clkdev_add_pmu("1e108000.eth", NULL, 0, 0,
  506. PMU_SWITCH | PMU_PPE_DPLUS | PMU_PPE_DPLUM |
  507. PMU_PPE_EMA | PMU_PPE_TC | PMU_PPE_SLL01 |
  508. PMU_PPE_QSB | PMU_PPE_TOP);
  509. clkdev_add_pmu("1f203000.rcu", "gphy", 0, 0, PMU_GPHY);
  510. clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
  511. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  512. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  513. } else if (of_machine_is_compatible("lantiq,ar9")) {
  514. clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(),
  515. ltq_ar9_fpi_hz(), CLOCK_250M);
  516. clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
  517. clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
  518. clkdev_add_pmu("1e106000.usb", "ctl", 1, 0, PMU_USB1);
  519. clkdev_add_pmu("1e106000.usb", "phy", 1, 0, PMU_USB1_P);
  520. clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH);
  521. clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
  522. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  523. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  524. clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0);
  525. } else {
  526. clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),
  527. ltq_danube_fpi_hz(), ltq_danube_pp32_hz());
  528. clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
  529. clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
  530. clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
  531. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  532. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  533. clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0);
  534. }
  535. if (of_machine_is_compatible("lantiq,vr9"))
  536. xbar_fpi_burst_disable();
  537. }