/kern_oII/arch/arm/mach-w90x900/w90p910.c

http://omnia2droid.googlecode.com/ · C · 136 lines · 95 code · 19 blank · 22 comment · 2 complexity · 0fc4fb749be00d43a54cf0571f66cd42 MD5 · raw file

  1. /*
  2. * linux/arch/arm/mach-w90x900/w90p910.c
  3. *
  4. * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks
  5. *
  6. * Copyright (c) 2008 Nuvoton technology corporation.
  7. *
  8. * Wan ZongShun <mcuos.com@gmail.com>
  9. *
  10. * W90P910 cpu support
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation;version 2 of the License.
  15. *
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/types.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/list.h>
  21. #include <linux/timer.h>
  22. #include <linux/init.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/io.h>
  25. #include <linux/serial_8250.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <asm/mach/irq.h>
  29. #include <asm/irq.h>
  30. #include <mach/hardware.h>
  31. #include <mach/regs-serial.h>
  32. #include "cpu.h"
  33. #include "clock.h"
  34. /* Initial IO mappings */
  35. static struct map_desc w90p910_iodesc[] __initdata = {
  36. IODESC_ENT(IRQ),
  37. IODESC_ENT(GCR),
  38. IODESC_ENT(UART),
  39. IODESC_ENT(TIMER),
  40. IODESC_ENT(EBI),
  41. IODESC_ENT(USBEHCIHOST),
  42. IODESC_ENT(USBOHCIHOST),
  43. IODESC_ENT(ADC),
  44. IODESC_ENT(RTC),
  45. IODESC_ENT(KPI),
  46. IODESC_ENT(USBDEV),
  47. /*IODESC_ENT(LCD),*/
  48. };
  49. /* Initial clock declarations. */
  50. static DEFINE_CLK(lcd, 0);
  51. static DEFINE_CLK(audio, 1);
  52. static DEFINE_CLK(fmi, 4);
  53. static DEFINE_CLK(dmac, 5);
  54. static DEFINE_CLK(atapi, 6);
  55. static DEFINE_CLK(emc, 7);
  56. static DEFINE_CLK(usbd, 8);
  57. static DEFINE_CLK(usbh, 9);
  58. static DEFINE_CLK(g2d, 10);;
  59. static DEFINE_CLK(pwm, 18);
  60. static DEFINE_CLK(ps2, 24);
  61. static DEFINE_CLK(kpi, 25);
  62. static DEFINE_CLK(wdt, 26);
  63. static DEFINE_CLK(gdma, 27);
  64. static DEFINE_CLK(adc, 28);
  65. static DEFINE_CLK(usi, 29);
  66. static struct clk_lookup w90p910_clkregs[] = {
  67. DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL),
  68. DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL),
  69. DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL),
  70. DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL),
  71. DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL),
  72. DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL),
  73. DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL),
  74. DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL),
  75. DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL),
  76. DEF_CLKLOOK(&clk_pwm, "w90p910-pwm", NULL),
  77. DEF_CLKLOOK(&clk_ps2, "w90p910-ps2", NULL),
  78. DEF_CLKLOOK(&clk_kpi, "w90p910-kpi", NULL),
  79. DEF_CLKLOOK(&clk_wdt, "w90p910-wdt", NULL),
  80. DEF_CLKLOOK(&clk_gdma, "w90p910-gdma", NULL),
  81. DEF_CLKLOOK(&clk_adc, "w90p910-adc", NULL),
  82. DEF_CLKLOOK(&clk_usi, "w90p910-usi", NULL),
  83. };
  84. /* Initial serial platform data */
  85. struct plat_serial8250_port w90p910_uart_data[] = {
  86. W90X900_8250PORT(UART0),
  87. };
  88. struct platform_device w90p910_serial_device = {
  89. .name = "serial8250",
  90. .id = PLAT8250_DEV_PLATFORM,
  91. .dev = {
  92. .platform_data = w90p910_uart_data,
  93. },
  94. };
  95. /*Init W90P910 evb io*/
  96. void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size)
  97. {
  98. unsigned long idcode = 0x0;
  99. iotable_init(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
  100. idcode = __raw_readl(W90X900PDID);
  101. if (idcode != W90P910_CPUID)
  102. printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode);
  103. }
  104. /*Init W90P910 clock*/
  105. void __init w90p910_init_clocks(void)
  106. {
  107. clks_register(w90p910_clkregs, ARRAY_SIZE(w90p910_clkregs));
  108. }
  109. static int __init w90p910_init_cpu(void)
  110. {
  111. return 0;
  112. }
  113. static int __init w90x900_arch_init(void)
  114. {
  115. return w90p910_init_cpu();
  116. }
  117. arch_initcall(w90x900_arch_init);