core.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. /*
  2. * arch/arm/mach-pnx4008/core.c
  3. *
  4. * PNX4008 core startup code
  5. *
  6. * Authors: Vitaly Wool, Dmitry Chigirev,
  7. * Grigory Tolstolytkin, Dmitry Pervushin <source@mvista.com>
  8. *
  9. * Based on reference code received from Philips:
  10. * Copyright (C) 2003 Philips Semiconductors
  11. *
  12. * 2005 (c) MontaVista Software, Inc. This file is licensed under
  13. * the terms of the GNU General Public License version 2. This program
  14. * is licensed "as is" without any warranty of any kind, whether express
  15. * or implied.
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/types.h>
  19. #include <linux/mm.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/list.h>
  22. #include <linux/init.h>
  23. #include <linux/ioport.h>
  24. #include <linux/serial_8250.h>
  25. #include <linux/device.h>
  26. #include <linux/spi/spi.h>
  27. #include <asm/hardware.h>
  28. #include <asm/io.h>
  29. #include <asm/setup.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/pgtable.h>
  32. #include <asm/page.h>
  33. #include <asm/system.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/map.h>
  36. #include <asm/mach/time.h>
  37. #include <asm/arch/irq.h>
  38. #include <asm/arch/clock.h>
  39. #include <asm/arch/dma.h>
  40. struct resource spipnx_0_resources[] = {
  41. {
  42. .start = PNX4008_SPI1_BASE,
  43. .end = PNX4008_SPI1_BASE + SZ_4K,
  44. .flags = IORESOURCE_MEM,
  45. }, {
  46. .start = PER_SPI1_REC_XMIT,
  47. .flags = IORESOURCE_DMA,
  48. }, {
  49. .start = SPI1_INT,
  50. .flags = IORESOURCE_IRQ,
  51. }, {
  52. .flags = 0,
  53. },
  54. };
  55. struct resource spipnx_1_resources[] = {
  56. {
  57. .start = PNX4008_SPI2_BASE,
  58. .end = PNX4008_SPI2_BASE + SZ_4K,
  59. .flags = IORESOURCE_MEM,
  60. }, {
  61. .start = PER_SPI2_REC_XMIT,
  62. .flags = IORESOURCE_DMA,
  63. }, {
  64. .start = SPI2_INT,
  65. .flags = IORESOURCE_IRQ,
  66. }, {
  67. .flags = 0,
  68. }
  69. };
  70. static struct spi_board_info spi_board_info[] __initdata = {
  71. {
  72. .modalias = "m25p80",
  73. .max_speed_hz = 1000000,
  74. .bus_num = 1,
  75. .chip_select = 0,
  76. },
  77. };
  78. static struct platform_device spipnx_1 = {
  79. .name = "spipnx",
  80. .id = 1,
  81. .num_resources = ARRAY_SIZE(spipnx_0_resources),
  82. .resource = spipnx_0_resources,
  83. .dev = {
  84. .coherent_dma_mask = 0xFFFFFFFF,
  85. },
  86. };
  87. static struct platform_device spipnx_2 = {
  88. .name = "spipnx",
  89. .id = 2,
  90. .num_resources = ARRAY_SIZE(spipnx_1_resources),
  91. .resource = spipnx_1_resources,
  92. .dev = {
  93. .coherent_dma_mask = 0xFFFFFFFF,
  94. },
  95. };
  96. static struct plat_serial8250_port platform_serial_ports[] = {
  97. {
  98. .membase = (void *)__iomem(IO_ADDRESS(PNX4008_UART5_BASE)),
  99. .mapbase = (unsigned long)PNX4008_UART5_BASE,
  100. .irq = IIR5_INT,
  101. .uartclk = PNX4008_UART_CLK,
  102. .regshift = 2,
  103. .iotype = UPIO_MEM,
  104. .flags = UPF_BOOT_AUTOCONF | UPF_BUGGY_UART | UPF_SKIP_TEST,
  105. },
  106. {
  107. .membase = (void *)__iomem(IO_ADDRESS(PNX4008_UART3_BASE)),
  108. .mapbase = (unsigned long)PNX4008_UART3_BASE,
  109. .irq = IIR3_INT,
  110. .uartclk = PNX4008_UART_CLK,
  111. .regshift = 2,
  112. .iotype = UPIO_MEM,
  113. .flags = UPF_BOOT_AUTOCONF | UPF_BUGGY_UART | UPF_SKIP_TEST,
  114. },
  115. {}
  116. };
  117. static struct platform_device serial_device = {
  118. .name = "serial8250",
  119. .id = PLAT8250_DEV_PLATFORM,
  120. .dev = {
  121. .platform_data = &platform_serial_ports,
  122. },
  123. };
  124. static struct platform_device *devices[] __initdata = {
  125. &spipnx_1,
  126. &spipnx_2,
  127. &serial_device,
  128. };
  129. extern void pnx4008_uart_init(void);
  130. static void __init pnx4008_init(void)
  131. {
  132. /*disable all START interrupt sources,
  133. and clear all START interrupt flags */
  134. __raw_writel(0, START_INT_ER_REG(SE_PIN_BASE_INT));
  135. __raw_writel(0, START_INT_ER_REG(SE_INT_BASE_INT));
  136. __raw_writel(0xffffffff, START_INT_RSR_REG(SE_PIN_BASE_INT));
  137. __raw_writel(0xffffffff, START_INT_RSR_REG(SE_INT_BASE_INT));
  138. platform_add_devices(devices, ARRAY_SIZE(devices));
  139. spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
  140. /* Switch on the UART clocks */
  141. pnx4008_uart_init();
  142. }
  143. static struct map_desc pnx4008_io_desc[] __initdata = {
  144. {
  145. .virtual = IO_ADDRESS(PNX4008_IRAM_BASE),
  146. .pfn = __phys_to_pfn(PNX4008_IRAM_BASE),
  147. .length = SZ_64K,
  148. .type = MT_DEVICE,
  149. }, {
  150. .virtual = IO_ADDRESS(PNX4008_NDF_FLASH_BASE),
  151. .pfn = __phys_to_pfn(PNX4008_NDF_FLASH_BASE),
  152. .length = SZ_1M - SZ_128K,
  153. .type = MT_DEVICE,
  154. }, {
  155. .virtual = IO_ADDRESS(PNX4008_JPEG_CONFIG_BASE),
  156. .pfn = __phys_to_pfn(PNX4008_JPEG_CONFIG_BASE),
  157. .length = SZ_128K * 3,
  158. .type = MT_DEVICE,
  159. }, {
  160. .virtual = IO_ADDRESS(PNX4008_DMA_CONFIG_BASE),
  161. .pfn = __phys_to_pfn(PNX4008_DMA_CONFIG_BASE),
  162. .length = SZ_1M,
  163. .type = MT_DEVICE,
  164. }, {
  165. .virtual = IO_ADDRESS(PNX4008_AHB2FAB_BASE),
  166. .pfn = __phys_to_pfn(PNX4008_AHB2FAB_BASE),
  167. .length = SZ_1M,
  168. .type = MT_DEVICE,
  169. },
  170. };
  171. void __init pnx4008_map_io(void)
  172. {
  173. iotable_init(pnx4008_io_desc, ARRAY_SIZE(pnx4008_io_desc));
  174. }
  175. extern struct sys_timer pnx4008_timer;
  176. MACHINE_START(PNX4008, "Philips PNX4008")
  177. /* Maintainer: MontaVista Software Inc. */
  178. .phys_io = 0x40090000,
  179. .io_pg_offst = (0xf4090000 >> 18) & 0xfffc,
  180. .boot_params = 0x80000100,
  181. .map_io = pnx4008_map_io,
  182. .init_irq = pnx4008_init_irq,
  183. .init_machine = pnx4008_init,
  184. .timer = &pnx4008_timer,
  185. MACHINE_END