cpu.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * linux/arch/arm/mach-nuc93x/cpu.c
  3. *
  4. * Copyright (c) 2009 Nuvoton corporation.
  5. *
  6. * Wan ZongShun <mcuos.com@gmail.com>
  7. *
  8. * NUC93x series cpu common support
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation;version 2 of the License.
  13. *
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/types.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/list.h>
  19. #include <linux/timer.h>
  20. #include <linux/init.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/io.h>
  23. #include <linux/serial_8250.h>
  24. #include <linux/delay.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/mach/irq.h>
  28. #include <asm/irq.h>
  29. #include <mach/hardware.h>
  30. #include <mach/regs-serial.h>
  31. #include <mach/regs-clock.h>
  32. #include <mach/regs-ebi.h>
  33. #include "cpu.h"
  34. #include "clock.h"
  35. /* Initial IO mappings */
  36. static struct map_desc nuc93x_iodesc[] __initdata = {
  37. IODESC_ENT(IRQ),
  38. IODESC_ENT(GCR),
  39. IODESC_ENT(UART),
  40. IODESC_ENT(TIMER),
  41. IODESC_ENT(EBI),
  42. };
  43. /* Initial nuc932 clock declarations. */
  44. static DEFINE_CLK(audio, 2);
  45. static DEFINE_CLK(sd, 3);
  46. static DEFINE_CLK(jpg, 4);
  47. static DEFINE_CLK(video, 5);
  48. static DEFINE_CLK(vpost, 6);
  49. static DEFINE_CLK(2d, 7);
  50. static DEFINE_CLK(gpu, 8);
  51. static DEFINE_CLK(gdma, 9);
  52. static DEFINE_CLK(adc, 10);
  53. static DEFINE_CLK(uart, 11);
  54. static DEFINE_CLK(spi, 12);
  55. static DEFINE_CLK(pwm, 13);
  56. static DEFINE_CLK(timer, 14);
  57. static DEFINE_CLK(wdt, 15);
  58. static DEFINE_CLK(ac97, 16);
  59. static DEFINE_CLK(i2s, 16);
  60. static DEFINE_CLK(usbck, 17);
  61. static DEFINE_CLK(usb48, 18);
  62. static DEFINE_CLK(usbh, 19);
  63. static DEFINE_CLK(i2c, 20);
  64. static DEFINE_CLK(ext, 0);
  65. static struct clk_lookup nuc932_clkregs[] = {
  66. DEF_CLKLOOK(&clk_audio, "nuc932-audio", NULL),
  67. DEF_CLKLOOK(&clk_sd, "nuc932-sd", NULL),
  68. DEF_CLKLOOK(&clk_jpg, "nuc932-jpg", "NULL"),
  69. DEF_CLKLOOK(&clk_video, "nuc932-video", "NULL"),
  70. DEF_CLKLOOK(&clk_vpost, "nuc932-vpost", NULL),
  71. DEF_CLKLOOK(&clk_2d, "nuc932-2d", NULL),
  72. DEF_CLKLOOK(&clk_gpu, "nuc932-gpu", NULL),
  73. DEF_CLKLOOK(&clk_gdma, "nuc932-gdma", "NULL"),
  74. DEF_CLKLOOK(&clk_adc, "nuc932-adc", NULL),
  75. DEF_CLKLOOK(&clk_uart, NULL, "uart"),
  76. DEF_CLKLOOK(&clk_spi, "nuc932-spi", NULL),
  77. DEF_CLKLOOK(&clk_pwm, "nuc932-pwm", NULL),
  78. DEF_CLKLOOK(&clk_timer, NULL, "timer"),
  79. DEF_CLKLOOK(&clk_wdt, "nuc932-wdt", NULL),
  80. DEF_CLKLOOK(&clk_ac97, "nuc932-ac97", NULL),
  81. DEF_CLKLOOK(&clk_i2s, "nuc932-i2s", NULL),
  82. DEF_CLKLOOK(&clk_usbck, "nuc932-usbck", NULL),
  83. DEF_CLKLOOK(&clk_usb48, "nuc932-usb48", NULL),
  84. DEF_CLKLOOK(&clk_usbh, "nuc932-usbh", NULL),
  85. DEF_CLKLOOK(&clk_i2c, "nuc932-i2c", NULL),
  86. DEF_CLKLOOK(&clk_ext, NULL, "ext"),
  87. };
  88. /* Initial serial platform data */
  89. struct plat_serial8250_port nuc93x_uart_data[] = {
  90. NUC93X_8250PORT(UART0),
  91. {},
  92. };
  93. struct platform_device nuc93x_serial_device = {
  94. .name = "serial8250",
  95. .id = PLAT8250_DEV_PLATFORM,
  96. .dev = {
  97. .platform_data = nuc93x_uart_data,
  98. },
  99. };
  100. /*Init NUC93x evb io*/
  101. void __init nuc93x_map_io(struct map_desc *mach_desc, int mach_size)
  102. {
  103. unsigned long idcode = 0x0;
  104. iotable_init(mach_desc, mach_size);
  105. iotable_init(nuc93x_iodesc, ARRAY_SIZE(nuc93x_iodesc));
  106. idcode = __raw_readl(NUC93XPDID);
  107. if (idcode == NUC932_CPUID)
  108. printk(KERN_INFO "CPU type 0x%08lx is NUC910\n", idcode);
  109. else
  110. printk(KERN_ERR "CPU type detect error!\n");
  111. }
  112. /*Init NUC93x clock*/
  113. void __init nuc93x_init_clocks(void)
  114. {
  115. clks_register(nuc932_clkregs, ARRAY_SIZE(nuc932_clkregs));
  116. }