sysctrl.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  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. static void __iomem *pmu_membase;
  132. void __iomem *ltq_cgu_membase;
  133. void __iomem *ltq_ebu_membase;
  134. static u32 ifccr = CGU_IFCCR;
  135. static u32 pcicr = CGU_PCICR;
  136. static DEFINE_SPINLOCK(g_pmu_lock);
  137. /* legacy function kept alive to ease clkdev transition */
  138. void ltq_pmu_enable(unsigned int module)
  139. {
  140. int retry = 1000000;
  141. spin_lock(&g_pmu_lock);
  142. pmu_w32(pmu_r32(PMU_PWDCR) & ~module, PMU_PWDCR);
  143. do {} while (--retry && (pmu_r32(PMU_PWDSR) & module));
  144. spin_unlock(&g_pmu_lock);
  145. if (!retry)
  146. panic("activating PMU module failed!");
  147. }
  148. EXPORT_SYMBOL(ltq_pmu_enable);
  149. /* legacy function kept alive to ease clkdev transition */
  150. void ltq_pmu_disable(unsigned int module)
  151. {
  152. int retry = 1000000;
  153. spin_lock(&g_pmu_lock);
  154. pmu_w32(pmu_r32(PMU_PWDCR) | module, PMU_PWDCR);
  155. do {} while (--retry && (!(pmu_r32(PMU_PWDSR) & module)));
  156. spin_unlock(&g_pmu_lock);
  157. if (!retry)
  158. pr_warn("deactivating PMU module failed!");
  159. }
  160. EXPORT_SYMBOL(ltq_pmu_disable);
  161. /* enable a hw clock */
  162. static int cgu_enable(struct clk *clk)
  163. {
  164. ltq_cgu_w32(ltq_cgu_r32(ifccr) | clk->bits, ifccr);
  165. return 0;
  166. }
  167. /* disable a hw clock */
  168. static void cgu_disable(struct clk *clk)
  169. {
  170. ltq_cgu_w32(ltq_cgu_r32(ifccr) & ~clk->bits, ifccr);
  171. }
  172. /* enable a clock gate */
  173. static int pmu_enable(struct clk *clk)
  174. {
  175. int retry = 1000000;
  176. if (of_machine_is_compatible("lantiq,ar10")
  177. || of_machine_is_compatible("lantiq,grx390")) {
  178. pmu_w32(clk->bits, PWDCR_EN_XRX(clk->module));
  179. do {} while (--retry &&
  180. (!(pmu_r32(PWDSR_XRX(clk->module)) & clk->bits)));
  181. } else {
  182. spin_lock(&g_pmu_lock);
  183. pmu_w32(pmu_r32(PWDCR(clk->module)) & ~clk->bits,
  184. PWDCR(clk->module));
  185. do {} while (--retry &&
  186. (pmu_r32(PWDSR(clk->module)) & clk->bits));
  187. spin_unlock(&g_pmu_lock);
  188. }
  189. if (!retry)
  190. panic("activating PMU module failed!");
  191. return 0;
  192. }
  193. /* disable a clock gate */
  194. static void pmu_disable(struct clk *clk)
  195. {
  196. int retry = 1000000;
  197. if (of_machine_is_compatible("lantiq,ar10")
  198. || of_machine_is_compatible("lantiq,grx390")) {
  199. pmu_w32(clk->bits, PWDCR_DIS_XRX(clk->module));
  200. do {} while (--retry &&
  201. (pmu_r32(PWDSR_XRX(clk->module)) & clk->bits));
  202. } else {
  203. spin_lock(&g_pmu_lock);
  204. pmu_w32(pmu_r32(PWDCR(clk->module)) | clk->bits,
  205. PWDCR(clk->module));
  206. do {} while (--retry &&
  207. (!(pmu_r32(PWDSR(clk->module)) & clk->bits)));
  208. spin_unlock(&g_pmu_lock);
  209. }
  210. if (!retry)
  211. pr_warn("deactivating PMU module failed!");
  212. }
  213. /* the pci enable helper */
  214. static int pci_enable(struct clk *clk)
  215. {
  216. unsigned int val = ltq_cgu_r32(ifccr);
  217. /* set bus clock speed */
  218. if (of_machine_is_compatible("lantiq,ar9") ||
  219. of_machine_is_compatible("lantiq,vr9")) {
  220. val &= ~0x1f00000;
  221. if (clk->rate == CLOCK_33M)
  222. val |= 0xe00000;
  223. else
  224. val |= 0x700000; /* 62.5M */
  225. } else {
  226. val &= ~0xf00000;
  227. if (clk->rate == CLOCK_33M)
  228. val |= 0x800000;
  229. else
  230. val |= 0x400000; /* 62.5M */
  231. }
  232. ltq_cgu_w32(val, ifccr);
  233. pmu_enable(clk);
  234. return 0;
  235. }
  236. /* enable the external clock as a source */
  237. static int pci_ext_enable(struct clk *clk)
  238. {
  239. ltq_cgu_w32(ltq_cgu_r32(ifccr) & ~(1 << 16), ifccr);
  240. ltq_cgu_w32((1 << 30), pcicr);
  241. return 0;
  242. }
  243. /* disable the external clock as a source */
  244. static void pci_ext_disable(struct clk *clk)
  245. {
  246. ltq_cgu_w32(ltq_cgu_r32(ifccr) | (1 << 16), ifccr);
  247. ltq_cgu_w32((1 << 31) | (1 << 30), pcicr);
  248. }
  249. /* enable a clockout source */
  250. static int clkout_enable(struct clk *clk)
  251. {
  252. int i;
  253. /* get the correct rate */
  254. for (i = 0; i < 4; i++) {
  255. if (clk->rates[i] == clk->rate) {
  256. int shift = 14 - (2 * clk->module);
  257. int enable = 7 - clk->module;
  258. unsigned int val = ltq_cgu_r32(ifccr);
  259. val &= ~(3 << shift);
  260. val |= i << shift;
  261. val |= enable;
  262. ltq_cgu_w32(val, ifccr);
  263. return 0;
  264. }
  265. }
  266. return -1;
  267. }
  268. /* manage the clock gates via PMU */
  269. static void clkdev_add_pmu(const char *dev, const char *con, bool deactivate,
  270. unsigned int module, unsigned int bits)
  271. {
  272. struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
  273. clk->cl.dev_id = dev;
  274. clk->cl.con_id = con;
  275. clk->cl.clk = clk;
  276. clk->enable = pmu_enable;
  277. clk->disable = pmu_disable;
  278. clk->module = module;
  279. clk->bits = bits;
  280. if (deactivate) {
  281. /*
  282. * Disable it during the initialization. Module should enable
  283. * when used
  284. */
  285. pmu_disable(clk);
  286. }
  287. clkdev_add(&clk->cl);
  288. }
  289. /* manage the clock generator */
  290. static void clkdev_add_cgu(const char *dev, const char *con,
  291. unsigned int bits)
  292. {
  293. struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
  294. clk->cl.dev_id = dev;
  295. clk->cl.con_id = con;
  296. clk->cl.clk = clk;
  297. clk->enable = cgu_enable;
  298. clk->disable = cgu_disable;
  299. clk->bits = bits;
  300. clkdev_add(&clk->cl);
  301. }
  302. /* pci needs its own enable function as the setup is a bit more complex */
  303. static unsigned long valid_pci_rates[] = {CLOCK_33M, CLOCK_62_5M, 0};
  304. static void clkdev_add_pci(void)
  305. {
  306. struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
  307. struct clk *clk_ext = kzalloc(sizeof(struct clk), GFP_KERNEL);
  308. /* main pci clock */
  309. clk->cl.dev_id = "17000000.pci";
  310. clk->cl.con_id = NULL;
  311. clk->cl.clk = clk;
  312. clk->rate = CLOCK_33M;
  313. clk->rates = valid_pci_rates;
  314. clk->enable = pci_enable;
  315. clk->disable = pmu_disable;
  316. clk->module = 0;
  317. clk->bits = PMU_PCI;
  318. clkdev_add(&clk->cl);
  319. /* use internal/external bus clock */
  320. clk_ext->cl.dev_id = "17000000.pci";
  321. clk_ext->cl.con_id = "external";
  322. clk_ext->cl.clk = clk_ext;
  323. clk_ext->enable = pci_ext_enable;
  324. clk_ext->disable = pci_ext_disable;
  325. clkdev_add(&clk_ext->cl);
  326. }
  327. /* xway socs can generate clocks on gpio pins */
  328. static unsigned long valid_clkout_rates[4][5] = {
  329. {CLOCK_32_768K, CLOCK_1_536M, CLOCK_2_5M, CLOCK_12M, 0},
  330. {CLOCK_40M, CLOCK_12M, CLOCK_24M, CLOCK_48M, 0},
  331. {CLOCK_25M, CLOCK_40M, CLOCK_30M, CLOCK_60M, 0},
  332. {CLOCK_12M, CLOCK_50M, CLOCK_32_768K, CLOCK_25M, 0},
  333. };
  334. static void clkdev_add_clkout(void)
  335. {
  336. int i;
  337. for (i = 0; i < 4; i++) {
  338. struct clk *clk;
  339. char *name;
  340. name = kzalloc(sizeof("clkout0"), GFP_KERNEL);
  341. sprintf(name, "clkout%d", i);
  342. clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
  343. clk->cl.dev_id = "1f103000.cgu";
  344. clk->cl.con_id = name;
  345. clk->cl.clk = clk;
  346. clk->rate = 0;
  347. clk->rates = valid_clkout_rates[i];
  348. clk->enable = clkout_enable;
  349. clk->module = i;
  350. clkdev_add(&clk->cl);
  351. }
  352. }
  353. /* bring up all register ranges that we need for basic system control */
  354. void __init ltq_soc_init(void)
  355. {
  356. struct resource res_pmu, res_cgu, res_ebu;
  357. struct device_node *np_pmu =
  358. of_find_compatible_node(NULL, NULL, "lantiq,pmu-xway");
  359. struct device_node *np_cgu =
  360. of_find_compatible_node(NULL, NULL, "lantiq,cgu-xway");
  361. struct device_node *np_ebu =
  362. of_find_compatible_node(NULL, NULL, "lantiq,ebu-xway");
  363. /* check if all the core register ranges are available */
  364. if (!np_pmu || !np_cgu || !np_ebu)
  365. panic("Failed to load core nodes from devicetree");
  366. if (of_address_to_resource(np_pmu, 0, &res_pmu) ||
  367. of_address_to_resource(np_cgu, 0, &res_cgu) ||
  368. of_address_to_resource(np_ebu, 0, &res_ebu))
  369. panic("Failed to get core resources");
  370. if (!request_mem_region(res_pmu.start, resource_size(&res_pmu),
  371. res_pmu.name) ||
  372. !request_mem_region(res_cgu.start, resource_size(&res_cgu),
  373. res_cgu.name) ||
  374. !request_mem_region(res_ebu.start, resource_size(&res_ebu),
  375. res_ebu.name))
  376. pr_err("Failed to request core resources");
  377. pmu_membase = ioremap_nocache(res_pmu.start, resource_size(&res_pmu));
  378. ltq_cgu_membase = ioremap_nocache(res_cgu.start,
  379. resource_size(&res_cgu));
  380. ltq_ebu_membase = ioremap_nocache(res_ebu.start,
  381. resource_size(&res_ebu));
  382. if (!pmu_membase || !ltq_cgu_membase || !ltq_ebu_membase)
  383. panic("Failed to remap core resources");
  384. /* make sure to unprotect the memory region where flash is located */
  385. ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_BUSCON0) & ~EBU_WRDIS, LTQ_EBU_BUSCON0);
  386. /* add our generic xway clocks */
  387. clkdev_add_pmu("10000000.fpi", NULL, 0, 0, PMU_FPI);
  388. clkdev_add_pmu("1e100a00.gptu", NULL, 1, 0, PMU_GPT);
  389. clkdev_add_pmu("1e100bb0.stp", NULL, 1, 0, PMU_STP);
  390. clkdev_add_pmu("1e100c00.serial", NULL, 0, 0, PMU_ASC1);
  391. clkdev_add_pmu("1e104100.dma", NULL, 1, 0, PMU_DMA);
  392. clkdev_add_pmu("1e100800.spi", NULL, 1, 0, PMU_SPI);
  393. clkdev_add_pmu("1e105300.ebu", NULL, 0, 0, PMU_EBU);
  394. clkdev_add_clkout();
  395. /* add the soc dependent clocks */
  396. if (of_machine_is_compatible("lantiq,vr9")) {
  397. ifccr = CGU_IFCCR_VR9;
  398. pcicr = CGU_PCICR_VR9;
  399. } else {
  400. clkdev_add_pmu("1e180000.etop", NULL, 1, 0, PMU_PPE);
  401. }
  402. if (!of_machine_is_compatible("lantiq,ase"))
  403. clkdev_add_pci();
  404. if (of_machine_is_compatible("lantiq,grx390") ||
  405. of_machine_is_compatible("lantiq,ar10")) {
  406. clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 2, PMU_ANALOG_USB0_P);
  407. clkdev_add_pmu("1f203034.usb2-phy", "phy", 1, 2, PMU_ANALOG_USB1_P);
  408. /* rc 0 */
  409. clkdev_add_pmu("1d900000.pcie", "phy", 1, 2, PMU_ANALOG_PCIE0_P);
  410. clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI);
  411. clkdev_add_pmu("1d900000.pcie", "pdi", 1, 1, PMU1_PCIE_PDI);
  412. clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL);
  413. /* rc 1 */
  414. clkdev_add_pmu("19000000.pcie", "phy", 1, 2, PMU_ANALOG_PCIE1_P);
  415. clkdev_add_pmu("19000000.pcie", "msi", 1, 1, PMU1_PCIE1_MSI);
  416. clkdev_add_pmu("19000000.pcie", "pdi", 1, 1, PMU1_PCIE1_PDI);
  417. clkdev_add_pmu("19000000.pcie", "ctl", 1, 1, PMU1_PCIE1_CTL);
  418. }
  419. if (of_machine_is_compatible("lantiq,ase")) {
  420. if (ltq_cgu_r32(CGU_SYS) & (1 << 5))
  421. clkdev_add_static(CLOCK_266M, CLOCK_133M,
  422. CLOCK_133M, CLOCK_266M);
  423. else
  424. clkdev_add_static(CLOCK_133M, CLOCK_133M,
  425. CLOCK_133M, CLOCK_133M);
  426. clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0);
  427. clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P);
  428. clkdev_add_pmu("1e180000.etop", "ppe", 1, 0, PMU_PPE);
  429. clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY);
  430. clkdev_add_pmu("1e180000.etop", "ephy", 1, 0, PMU_EPHY);
  431. clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_ASE_SDIO);
  432. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  433. } else if (of_machine_is_compatible("lantiq,grx390")) {
  434. clkdev_add_static(ltq_grx390_cpu_hz(), ltq_grx390_fpi_hz(),
  435. ltq_grx390_fpi_hz(), ltq_grx390_pp32_hz());
  436. clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0);
  437. clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1);
  438. /* rc 2 */
  439. clkdev_add_pmu("1a800000.pcie", "phy", 1, 2, PMU_ANALOG_PCIE2_P);
  440. clkdev_add_pmu("1a800000.pcie", "msi", 1, 1, PMU1_PCIE2_MSI);
  441. clkdev_add_pmu("1a800000.pcie", "pdi", 1, 1, PMU1_PCIE2_PDI);
  442. clkdev_add_pmu("1a800000.pcie", "ctl", 1, 1, PMU1_PCIE2_CTL);
  443. clkdev_add_pmu("1e108000.eth", NULL, 0, 0, PMU_SWITCH | PMU_PPE_DP);
  444. clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
  445. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  446. } else if (of_machine_is_compatible("lantiq,ar10")) {
  447. clkdev_add_static(ltq_ar10_cpu_hz(), ltq_ar10_fpi_hz(),
  448. ltq_ar10_fpi_hz(), ltq_ar10_pp32_hz());
  449. clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0);
  450. clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1);
  451. clkdev_add_pmu("1e108000.eth", NULL, 0, 0, PMU_SWITCH |
  452. PMU_PPE_DP | PMU_PPE_TC);
  453. clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
  454. clkdev_add_pmu("1f203020.gphy", NULL, 1, 0, PMU_GPHY);
  455. clkdev_add_pmu("1f203068.gphy", NULL, 1, 0, PMU_GPHY);
  456. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  457. clkdev_add_pmu("1e116000.mei", "afe", 1, 2, PMU_ANALOG_DSL_AFE);
  458. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  459. } else if (of_machine_is_compatible("lantiq,vr9")) {
  460. clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(),
  461. ltq_vr9_fpi_hz(), ltq_vr9_pp32_hz());
  462. clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P);
  463. clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM);
  464. clkdev_add_pmu("1f203034.usb2-phy", "phy", 1, 0, PMU_USB1_P);
  465. clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1 | PMU_AHBM);
  466. clkdev_add_pmu("1d900000.pcie", "phy", 1, 1, PMU1_PCIE_PHY);
  467. clkdev_add_pmu("1d900000.pcie", "bus", 1, 0, PMU_PCIE_CLK);
  468. clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI);
  469. clkdev_add_pmu("1d900000.pcie", "pdi", 1, 1, PMU1_PCIE_PDI);
  470. clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL);
  471. clkdev_add_pmu(NULL, "ahb", 1, 0, PMU_AHBM | PMU_AHBS);
  472. clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
  473. clkdev_add_pmu("1e108000.eth", NULL, 0, 0,
  474. PMU_SWITCH | PMU_PPE_DPLUS | PMU_PPE_DPLUM |
  475. PMU_PPE_EMA | PMU_PPE_TC | PMU_PPE_SLL01 |
  476. PMU_PPE_QSB | PMU_PPE_TOP);
  477. clkdev_add_pmu("1f203020.gphy", NULL, 0, 0, PMU_GPHY);
  478. clkdev_add_pmu("1f203068.gphy", NULL, 0, 0, PMU_GPHY);
  479. clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
  480. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  481. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  482. } else if (of_machine_is_compatible("lantiq,ar9")) {
  483. clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(),
  484. ltq_ar9_fpi_hz(), CLOCK_250M);
  485. clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P);
  486. clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM);
  487. clkdev_add_pmu("1f203034.usb2-phy", "phy", 1, 0, PMU_USB1_P);
  488. clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1 | PMU_AHBM);
  489. clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH);
  490. clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
  491. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  492. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  493. clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0);
  494. } else {
  495. clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),
  496. ltq_danube_fpi_hz(), ltq_danube_pp32_hz());
  497. clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM);
  498. clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P);
  499. clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
  500. clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
  501. clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
  502. clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0);
  503. }
  504. }