clock.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. /*
  2. * Copyright (c) 2011 The Chromium OS Authors.
  3. * See file CREDITS for list of people who contributed to this
  4. * project.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  19. * MA 02111-1307 USA
  20. */
  21. /* Tegra20 Clock control functions */
  22. #include <common.h>
  23. #include <asm/io.h>
  24. #include <asm/arch/clock.h>
  25. #include <asm/arch/tegra.h>
  26. #include <asm/arch-tegra/clk_rst.h>
  27. #include <asm/arch-tegra/timer.h>
  28. #include <div64.h>
  29. #include <fdtdec.h>
  30. /*
  31. * Clock types that we can use as a source. The Tegra20 has muxes for the
  32. * peripheral clocks, and in most cases there are four options for the clock
  33. * source. This gives us a clock 'type' and exploits what commonality exists
  34. * in the device.
  35. *
  36. * Letters are obvious, except for T which means CLK_M, and S which means the
  37. * clock derived from 32KHz. Beware that CLK_M (also called OSC in the
  38. * datasheet) and PLL_M are different things. The former is the basic
  39. * clock supplied to the SOC from an external oscillator. The latter is the
  40. * memory clock PLL.
  41. *
  42. * See definitions in clock_id in the header file.
  43. */
  44. enum clock_type_id {
  45. CLOCK_TYPE_AXPT, /* PLL_A, PLL_X, PLL_P, CLK_M */
  46. CLOCK_TYPE_MCPA, /* and so on */
  47. CLOCK_TYPE_MCPT,
  48. CLOCK_TYPE_PCM,
  49. CLOCK_TYPE_PCMT,
  50. CLOCK_TYPE_PCMT16, /* CLOCK_TYPE_PCMT with 16-bit divider */
  51. CLOCK_TYPE_PCXTS,
  52. CLOCK_TYPE_PDCT,
  53. CLOCK_TYPE_COUNT,
  54. CLOCK_TYPE_NONE = -1, /* invalid clock type */
  55. };
  56. enum {
  57. CLOCK_MAX_MUX = 4 /* number of source options for each clock */
  58. };
  59. /*
  60. * Clock source mux for each clock type. This just converts our enum into
  61. * a list of mux sources for use by the code. Note that CLOCK_TYPE_PCXTS
  62. * is special as it has 5 sources. Since it also has a different number of
  63. * bits in its register for the source, we just handle it with a special
  64. * case in the code.
  65. */
  66. #define CLK(x) CLOCK_ID_ ## x
  67. static enum clock_id clock_source[CLOCK_TYPE_COUNT][CLOCK_MAX_MUX] = {
  68. { CLK(AUDIO), CLK(XCPU), CLK(PERIPH), CLK(OSC) },
  69. { CLK(MEMORY), CLK(CGENERAL), CLK(PERIPH), CLK(AUDIO) },
  70. { CLK(MEMORY), CLK(CGENERAL), CLK(PERIPH), CLK(OSC) },
  71. { CLK(PERIPH), CLK(CGENERAL), CLK(MEMORY), CLK(NONE) },
  72. { CLK(PERIPH), CLK(CGENERAL), CLK(MEMORY), CLK(OSC) },
  73. { CLK(PERIPH), CLK(CGENERAL), CLK(MEMORY), CLK(OSC) },
  74. { CLK(PERIPH), CLK(CGENERAL), CLK(XCPU), CLK(OSC) },
  75. { CLK(PERIPH), CLK(DISPLAY), CLK(CGENERAL), CLK(OSC) },
  76. };
  77. /*
  78. * Clock peripheral IDs which sadly don't match up with PERIPH_ID. This is
  79. * not in the header file since it is for purely internal use - we want
  80. * callers to use the PERIPH_ID for all access to peripheral clocks to avoid
  81. * confusion bewteen PERIPH_ID_... and PERIPHC_...
  82. *
  83. * We don't call this CLOCK_PERIPH_ID or PERIPH_CLOCK_ID as it would just be
  84. * confusing.
  85. *
  86. * Note to SOC vendors: perhaps define a unified numbering for peripherals and
  87. * use it for reset, clock enable, clock source/divider and even pinmuxing
  88. * if you can.
  89. */
  90. enum periphc_internal_id {
  91. /* 0x00 */
  92. PERIPHC_I2S1,
  93. PERIPHC_I2S2,
  94. PERIPHC_SPDIF_OUT,
  95. PERIPHC_SPDIF_IN,
  96. PERIPHC_PWM,
  97. PERIPHC_SPI1,
  98. PERIPHC_SPI2,
  99. PERIPHC_SPI3,
  100. /* 0x08 */
  101. PERIPHC_XIO,
  102. PERIPHC_I2C1,
  103. PERIPHC_DVC_I2C,
  104. PERIPHC_TWC,
  105. PERIPHC_0c,
  106. PERIPHC_10, /* PERIPHC_SPI1, what is this really? */
  107. PERIPHC_DISP1,
  108. PERIPHC_DISP2,
  109. /* 0x10 */
  110. PERIPHC_CVE,
  111. PERIPHC_IDE0,
  112. PERIPHC_VI,
  113. PERIPHC_1c,
  114. PERIPHC_SDMMC1,
  115. PERIPHC_SDMMC2,
  116. PERIPHC_G3D,
  117. PERIPHC_G2D,
  118. /* 0x18 */
  119. PERIPHC_NDFLASH,
  120. PERIPHC_SDMMC4,
  121. PERIPHC_VFIR,
  122. PERIPHC_EPP,
  123. PERIPHC_MPE,
  124. PERIPHC_MIPI,
  125. PERIPHC_UART1,
  126. PERIPHC_UART2,
  127. /* 0x20 */
  128. PERIPHC_HOST1X,
  129. PERIPHC_21,
  130. PERIPHC_TVO,
  131. PERIPHC_HDMI,
  132. PERIPHC_24,
  133. PERIPHC_TVDAC,
  134. PERIPHC_I2C2,
  135. PERIPHC_EMC,
  136. /* 0x28 */
  137. PERIPHC_UART3,
  138. PERIPHC_29,
  139. PERIPHC_VI_SENSOR,
  140. PERIPHC_2b,
  141. PERIPHC_2c,
  142. PERIPHC_SPI4,
  143. PERIPHC_I2C3,
  144. PERIPHC_SDMMC3,
  145. /* 0x30 */
  146. PERIPHC_UART4,
  147. PERIPHC_UART5,
  148. PERIPHC_VDE,
  149. PERIPHC_OWR,
  150. PERIPHC_NOR,
  151. PERIPHC_CSITE,
  152. PERIPHC_COUNT,
  153. PERIPHC_NONE = -1,
  154. };
  155. /*
  156. * Clock type for each peripheral clock source. We put the name in each
  157. * record just so it is easy to match things up
  158. */
  159. #define TYPE(name, type) type
  160. static enum clock_type_id clock_periph_type[PERIPHC_COUNT] = {
  161. /* 0x00 */
  162. TYPE(PERIPHC_I2S1, CLOCK_TYPE_AXPT),
  163. TYPE(PERIPHC_I2S2, CLOCK_TYPE_AXPT),
  164. TYPE(PERIPHC_SPDIF_OUT, CLOCK_TYPE_AXPT),
  165. TYPE(PERIPHC_SPDIF_IN, CLOCK_TYPE_PCM),
  166. TYPE(PERIPHC_PWM, CLOCK_TYPE_PCXTS),
  167. TYPE(PERIPHC_SPI1, CLOCK_TYPE_PCMT),
  168. TYPE(PERIPHC_SPI22, CLOCK_TYPE_PCMT),
  169. TYPE(PERIPHC_SPI3, CLOCK_TYPE_PCMT),
  170. /* 0x08 */
  171. TYPE(PERIPHC_XIO, CLOCK_TYPE_PCMT),
  172. TYPE(PERIPHC_I2C1, CLOCK_TYPE_PCMT16),
  173. TYPE(PERIPHC_DVC_I2C, CLOCK_TYPE_PCMT16),
  174. TYPE(PERIPHC_TWC, CLOCK_TYPE_PCMT),
  175. TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
  176. TYPE(PERIPHC_SPI1, CLOCK_TYPE_PCMT),
  177. TYPE(PERIPHC_DISP1, CLOCK_TYPE_PDCT),
  178. TYPE(PERIPHC_DISP2, CLOCK_TYPE_PDCT),
  179. /* 0x10 */
  180. TYPE(PERIPHC_CVE, CLOCK_TYPE_PDCT),
  181. TYPE(PERIPHC_IDE0, CLOCK_TYPE_PCMT),
  182. TYPE(PERIPHC_VI, CLOCK_TYPE_MCPA),
  183. TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
  184. TYPE(PERIPHC_SDMMC1, CLOCK_TYPE_PCMT),
  185. TYPE(PERIPHC_SDMMC2, CLOCK_TYPE_PCMT),
  186. TYPE(PERIPHC_G3D, CLOCK_TYPE_MCPA),
  187. TYPE(PERIPHC_G2D, CLOCK_TYPE_MCPA),
  188. /* 0x18 */
  189. TYPE(PERIPHC_NDFLASH, CLOCK_TYPE_PCMT),
  190. TYPE(PERIPHC_SDMMC4, CLOCK_TYPE_PCMT),
  191. TYPE(PERIPHC_VFIR, CLOCK_TYPE_PCMT),
  192. TYPE(PERIPHC_EPP, CLOCK_TYPE_MCPA),
  193. TYPE(PERIPHC_MPE, CLOCK_TYPE_MCPA),
  194. TYPE(PERIPHC_MIPI, CLOCK_TYPE_PCMT),
  195. TYPE(PERIPHC_UART1, CLOCK_TYPE_PCMT),
  196. TYPE(PERIPHC_UART2, CLOCK_TYPE_PCMT),
  197. /* 0x20 */
  198. TYPE(PERIPHC_HOST1X, CLOCK_TYPE_MCPA),
  199. TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
  200. TYPE(PERIPHC_TVO, CLOCK_TYPE_PDCT),
  201. TYPE(PERIPHC_HDMI, CLOCK_TYPE_PDCT),
  202. TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
  203. TYPE(PERIPHC_TVDAC, CLOCK_TYPE_PDCT),
  204. TYPE(PERIPHC_I2C2, CLOCK_TYPE_PCMT16),
  205. TYPE(PERIPHC_EMC, CLOCK_TYPE_MCPT),
  206. /* 0x28 */
  207. TYPE(PERIPHC_UART3, CLOCK_TYPE_PCMT),
  208. TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
  209. TYPE(PERIPHC_VI, CLOCK_TYPE_MCPA),
  210. TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
  211. TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
  212. TYPE(PERIPHC_SPI4, CLOCK_TYPE_PCMT),
  213. TYPE(PERIPHC_I2C3, CLOCK_TYPE_PCMT16),
  214. TYPE(PERIPHC_SDMMC3, CLOCK_TYPE_PCMT),
  215. /* 0x30 */
  216. TYPE(PERIPHC_UART4, CLOCK_TYPE_PCMT),
  217. TYPE(PERIPHC_UART5, CLOCK_TYPE_PCMT),
  218. TYPE(PERIPHC_VDE, CLOCK_TYPE_PCMT),
  219. TYPE(PERIPHC_OWR, CLOCK_TYPE_PCMT),
  220. TYPE(PERIPHC_NOR, CLOCK_TYPE_PCMT),
  221. TYPE(PERIPHC_CSITE, CLOCK_TYPE_PCMT),
  222. };
  223. /*
  224. * This array translates a periph_id to a periphc_internal_id
  225. *
  226. * Not present/matched up:
  227. * uint vi_sensor; _VI_SENSOR_0, 0x1A8
  228. * SPDIF - which is both 0x08 and 0x0c
  229. *
  230. */
  231. #define NONE(name) (-1)
  232. #define OFFSET(name, value) PERIPHC_ ## name
  233. static s8 periph_id_to_internal_id[PERIPH_ID_COUNT] = {
  234. /* Low word: 31:0 */
  235. NONE(CPU),
  236. NONE(RESERVED1),
  237. NONE(RESERVED2),
  238. NONE(AC97),
  239. NONE(RTC),
  240. NONE(TMR),
  241. PERIPHC_UART1,
  242. PERIPHC_UART2, /* and vfir 0x68 */
  243. /* 0x08 */
  244. NONE(GPIO),
  245. PERIPHC_SDMMC2,
  246. NONE(SPDIF), /* 0x08 and 0x0c, unclear which to use */
  247. PERIPHC_I2S1,
  248. PERIPHC_I2C1,
  249. PERIPHC_NDFLASH,
  250. PERIPHC_SDMMC1,
  251. PERIPHC_SDMMC4,
  252. /* 0x10 */
  253. PERIPHC_TWC,
  254. PERIPHC_PWM,
  255. PERIPHC_I2S2,
  256. PERIPHC_EPP,
  257. PERIPHC_VI,
  258. PERIPHC_G2D,
  259. NONE(USBD),
  260. NONE(ISP),
  261. /* 0x18 */
  262. PERIPHC_G3D,
  263. PERIPHC_IDE0,
  264. PERIPHC_DISP2,
  265. PERIPHC_DISP1,
  266. PERIPHC_HOST1X,
  267. NONE(VCP),
  268. NONE(RESERVED30),
  269. NONE(CACHE2),
  270. /* Middle word: 63:32 */
  271. NONE(MEM),
  272. NONE(AHBDMA),
  273. NONE(APBDMA),
  274. NONE(RESERVED35),
  275. NONE(KBC),
  276. NONE(STAT_MON),
  277. NONE(PMC),
  278. NONE(FUSE),
  279. /* 0x28 */
  280. NONE(KFUSE),
  281. NONE(SBC1), /* SBC1, 0x34, is this SPI1? */
  282. PERIPHC_NOR,
  283. PERIPHC_SPI1,
  284. PERIPHC_SPI2,
  285. PERIPHC_XIO,
  286. PERIPHC_SPI3,
  287. PERIPHC_DVC_I2C,
  288. /* 0x30 */
  289. NONE(DSI),
  290. PERIPHC_TVO, /* also CVE 0x40 */
  291. PERIPHC_MIPI,
  292. PERIPHC_HDMI,
  293. PERIPHC_CSITE,
  294. PERIPHC_TVDAC,
  295. PERIPHC_I2C2,
  296. PERIPHC_UART3,
  297. /* 0x38 */
  298. NONE(RESERVED56),
  299. PERIPHC_EMC,
  300. NONE(USB2),
  301. NONE(USB3),
  302. PERIPHC_MPE,
  303. PERIPHC_VDE,
  304. NONE(BSEA),
  305. NONE(BSEV),
  306. /* Upper word 95:64 */
  307. NONE(SPEEDO),
  308. PERIPHC_UART4,
  309. PERIPHC_UART5,
  310. PERIPHC_I2C3,
  311. PERIPHC_SPI4,
  312. PERIPHC_SDMMC3,
  313. NONE(PCIE),
  314. PERIPHC_OWR,
  315. /* 0x48 */
  316. NONE(AFI),
  317. NONE(CORESIGHT),
  318. NONE(RESERVED74),
  319. NONE(AVPUCQ),
  320. NONE(RESERVED76),
  321. NONE(RESERVED77),
  322. NONE(RESERVED78),
  323. NONE(RESERVED79),
  324. /* 0x50 */
  325. NONE(RESERVED80),
  326. NONE(RESERVED81),
  327. NONE(RESERVED82),
  328. NONE(RESERVED83),
  329. NONE(IRAMA),
  330. NONE(IRAMB),
  331. NONE(IRAMC),
  332. NONE(IRAMD),
  333. /* 0x58 */
  334. NONE(CRAM2),
  335. };
  336. /*
  337. * Get the oscillator frequency, from the corresponding hardware configuration
  338. * field. T20 has 4 frequencies that it supports.
  339. */
  340. enum clock_osc_freq clock_get_osc_freq(void)
  341. {
  342. struct clk_rst_ctlr *clkrst =
  343. (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
  344. u32 reg;
  345. reg = readl(&clkrst->crc_osc_ctrl);
  346. return (reg & OSC_FREQ_MASK) >> OSC_FREQ_SHIFT;
  347. }
  348. /* Returns a pointer to the clock source register for a peripheral */
  349. u32 *get_periph_source_reg(enum periph_id periph_id)
  350. {
  351. struct clk_rst_ctlr *clkrst =
  352. (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
  353. enum periphc_internal_id internal_id;
  354. assert(clock_periph_id_isvalid(periph_id));
  355. internal_id = periph_id_to_internal_id[periph_id];
  356. assert(internal_id != -1);
  357. return &clkrst->crc_clk_src[internal_id];
  358. }
  359. /**
  360. * Given a peripheral ID and the required source clock, this returns which
  361. * value should be programmed into the source mux for that peripheral.
  362. *
  363. * There is special code here to handle the one source type with 5 sources.
  364. *
  365. * @param periph_id peripheral to start
  366. * @param source PLL id of required parent clock
  367. * @param mux_bits Set to number of bits in mux register: 2 or 4
  368. * @param divider_bits Set to number of divider bits (8 or 16)
  369. * @return mux value (0-4, or -1 if not found)
  370. */
  371. int get_periph_clock_source(enum periph_id periph_id,
  372. enum clock_id parent, int *mux_bits, int *divider_bits)
  373. {
  374. enum clock_type_id type;
  375. enum periphc_internal_id internal_id;
  376. int mux;
  377. assert(clock_periph_id_isvalid(periph_id));
  378. internal_id = periph_id_to_internal_id[periph_id];
  379. assert(periphc_internal_id_isvalid(internal_id));
  380. type = clock_periph_type[internal_id];
  381. assert(clock_type_id_isvalid(type));
  382. /*
  383. * Special cases here for the clock with a 4-bit source mux and I2C
  384. * with its 16-bit divisor
  385. */
  386. if (type == CLOCK_TYPE_PCXTS)
  387. *mux_bits = 4;
  388. else
  389. *mux_bits = 2;
  390. if (type == CLOCK_TYPE_PCMT16)
  391. *divider_bits = 16;
  392. else
  393. *divider_bits = 8;
  394. for (mux = 0; mux < CLOCK_MAX_MUX; mux++)
  395. if (clock_source[type][mux] == parent)
  396. return mux;
  397. /*
  398. * Not found: it might be looking for the 'S' in CLOCK_TYPE_PCXTS
  399. * which is not in our table. If not, then they are asking for a
  400. * source which this peripheral can't access through its mux.
  401. */
  402. assert(type == CLOCK_TYPE_PCXTS);
  403. assert(parent == CLOCK_ID_SFROM32KHZ);
  404. if (type == CLOCK_TYPE_PCXTS && parent == CLOCK_ID_SFROM32KHZ)
  405. return 4; /* mux value for this clock */
  406. /* if we get here, either us or the caller has made a mistake */
  407. printf("Caller requested bad clock: periph=%d, parent=%d\n", periph_id,
  408. parent);
  409. return -1;
  410. }
  411. void clock_set_enable(enum periph_id periph_id, int enable)
  412. {
  413. struct clk_rst_ctlr *clkrst =
  414. (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
  415. u32 *clk = &clkrst->crc_clk_out_enb[PERIPH_REG(periph_id)];
  416. u32 reg;
  417. /* Enable/disable the clock to this peripheral */
  418. assert(clock_periph_id_isvalid(periph_id));
  419. reg = readl(clk);
  420. if (enable)
  421. reg |= PERIPH_MASK(periph_id);
  422. else
  423. reg &= ~PERIPH_MASK(periph_id);
  424. writel(reg, clk);
  425. }
  426. void reset_set_enable(enum periph_id periph_id, int enable)
  427. {
  428. struct clk_rst_ctlr *clkrst =
  429. (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
  430. u32 *reset = &clkrst->crc_rst_dev[PERIPH_REG(periph_id)];
  431. u32 reg;
  432. /* Enable/disable reset to the peripheral */
  433. assert(clock_periph_id_isvalid(periph_id));
  434. reg = readl(reset);
  435. if (enable)
  436. reg |= PERIPH_MASK(periph_id);
  437. else
  438. reg &= ~PERIPH_MASK(periph_id);
  439. writel(reg, reset);
  440. }
  441. #ifdef CONFIG_OF_CONTROL
  442. /*
  443. * Convert a device tree clock ID to our peripheral ID. They are mostly
  444. * the same but we are very cautious so we check that a valid clock ID is
  445. * provided.
  446. *
  447. * @param clk_id Clock ID according to tegra20 device tree binding
  448. * @return peripheral ID, or PERIPH_ID_NONE if the clock ID is invalid
  449. */
  450. enum periph_id clk_id_to_periph_id(int clk_id)
  451. {
  452. if (clk_id > PERIPH_ID_COUNT)
  453. return PERIPH_ID_NONE;
  454. switch (clk_id) {
  455. case PERIPH_ID_RESERVED1:
  456. case PERIPH_ID_RESERVED2:
  457. case PERIPH_ID_RESERVED30:
  458. case PERIPH_ID_RESERVED35:
  459. case PERIPH_ID_RESERVED56:
  460. case PERIPH_ID_RESERVED74:
  461. case PERIPH_ID_RESERVED76:
  462. case PERIPH_ID_RESERVED77:
  463. case PERIPH_ID_RESERVED78:
  464. case PERIPH_ID_RESERVED79:
  465. case PERIPH_ID_RESERVED80:
  466. case PERIPH_ID_RESERVED81:
  467. case PERIPH_ID_RESERVED82:
  468. case PERIPH_ID_RESERVED83:
  469. case PERIPH_ID_RESERVED91:
  470. return PERIPH_ID_NONE;
  471. default:
  472. return clk_id;
  473. }
  474. }
  475. #endif /* CONFIG_OF_CONTROL */
  476. void clock_early_init(void)
  477. {
  478. /*
  479. * PLLP output frequency set to 216MHz
  480. * PLLC output frequency set to 600Mhz
  481. *
  482. * TODO: Can we calculate these values instead of hard-coding?
  483. */
  484. switch (clock_get_osc_freq()) {
  485. case CLOCK_OSC_FREQ_12_0: /* OSC is 12Mhz */
  486. clock_set_rate(CLOCK_ID_PERIPH, 432, 12, 1, 8);
  487. clock_set_rate(CLOCK_ID_CGENERAL, 600, 12, 0, 8);
  488. break;
  489. case CLOCK_OSC_FREQ_26_0: /* OSC is 26Mhz */
  490. clock_set_rate(CLOCK_ID_PERIPH, 432, 26, 1, 8);
  491. clock_set_rate(CLOCK_ID_CGENERAL, 600, 26, 0, 8);
  492. break;
  493. case CLOCK_OSC_FREQ_13_0: /* OSC is 13Mhz */
  494. clock_set_rate(CLOCK_ID_PERIPH, 432, 13, 1, 8);
  495. clock_set_rate(CLOCK_ID_CGENERAL, 600, 13, 0, 8);
  496. break;
  497. case CLOCK_OSC_FREQ_19_2:
  498. default:
  499. /*
  500. * These are not supported. It is too early to print a
  501. * message and the UART likely won't work anyway due to the
  502. * oscillator being wrong.
  503. */
  504. break;
  505. }
  506. }