setup.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * linux/arch/arm/mach-iop33x/setup.c
  3. *
  4. * Author: Dave Jiang (dave.jiang@intel.com)
  5. * Copyright (C) 2004 Intel Corporation.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. */
  12. #include <linux/mm.h>
  13. #include <linux/init.h>
  14. #include <linux/major.h>
  15. #include <linux/fs.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/serial.h>
  18. #include <linux/tty.h>
  19. #include <linux/serial_8250.h>
  20. #include <asm/io.h>
  21. #include <asm/pgtable.h>
  22. #include <asm/page.h>
  23. #include <asm/mach/map.h>
  24. #include <asm/setup.h>
  25. #include <asm/system.h>
  26. #include <asm/memory.h>
  27. #include <asm/hardware.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/time.h>
  31. #include <asm/hardware/iop3xx.h>
  32. #define IOP331_UART_XTAL 33334000
  33. static struct resource iop33x_uart0_resources[] = {
  34. [0] = {
  35. .start = IOP331_UART0_PHYS,
  36. .end = IOP331_UART0_PHYS + 0x3f,
  37. .flags = IORESOURCE_MEM,
  38. },
  39. [1] = {
  40. .start = IRQ_IOP331_UART0,
  41. .end = IRQ_IOP331_UART0,
  42. .flags = IORESOURCE_IRQ
  43. }
  44. };
  45. static struct resource iop33x_uart1_resources[] = {
  46. [0] = {
  47. .start = IOP331_UART1_PHYS,
  48. .end = IOP331_UART1_PHYS + 0x3f,
  49. .flags = IORESOURCE_MEM,
  50. },
  51. [1] = {
  52. .start = IRQ_IOP331_UART1,
  53. .end = IRQ_IOP331_UART1,
  54. .flags = IORESOURCE_IRQ
  55. }
  56. };
  57. static struct plat_serial8250_port iop33x_uart0_data[] = {
  58. {
  59. .membase = (char*)(IOP331_UART0_VIRT),
  60. .mapbase = (IOP331_UART0_PHYS),
  61. .irq = IRQ_IOP331_UART0,
  62. .uartclk = IOP331_UART_XTAL,
  63. .regshift = 2,
  64. .iotype = UPIO_MEM,
  65. .flags = UPF_SKIP_TEST,
  66. },
  67. { },
  68. };
  69. static struct plat_serial8250_port iop33x_uart1_data[] = {
  70. {
  71. .membase = (char*)(IOP331_UART1_VIRT),
  72. .mapbase = (IOP331_UART1_PHYS),
  73. .irq = IRQ_IOP331_UART1,
  74. .uartclk = IOP331_UART_XTAL,
  75. .regshift = 2,
  76. .iotype = UPIO_MEM,
  77. .flags = UPF_SKIP_TEST,
  78. },
  79. { },
  80. };
  81. static struct platform_device iop33x_uart0 = {
  82. .name = "serial8250",
  83. .id = PLAT8250_DEV_PLATFORM,
  84. .dev.platform_data = iop33x_uart0_data,
  85. .num_resources = 2,
  86. .resource = iop33x_uart0_resources,
  87. };
  88. static struct platform_device iop33x_uart1 = {
  89. .name = "serial8250",
  90. .id = PLAT8250_DEV_PLATFORM1,
  91. .dev.platform_data = iop33x_uart1_data,
  92. .num_resources = 2,
  93. .resource = iop33x_uart1_resources,
  94. };
  95. static struct platform_device *iop33x_devices[] __initdata = {
  96. &iop33x_uart0,
  97. &iop33x_uart1,
  98. };
  99. void __init iop33x_init(void)
  100. {
  101. if(iop_is_331())
  102. {
  103. platform_add_devices(iop33x_devices,
  104. ARRAY_SIZE(iop33x_devices));
  105. }
  106. platform_device_register(&iop3xx_i2c0_device);
  107. platform_device_register(&iop3xx_i2c1_device);
  108. }
  109. #ifdef CONFIG_ARCH_IOP33X
  110. extern void iop331_init_irq(void);
  111. #endif
  112. static void __init iop3xx_timer_init(void)
  113. {
  114. iop3xx_init_time(IOP331_TICK_RATE);
  115. }
  116. struct sys_timer iop331_timer = {
  117. .init = iop3xx_timer_init,
  118. .offset = iop3xx_gettimeoffset,
  119. };
  120. #if defined(CONFIG_ARCH_IQ80331)
  121. MACHINE_START(IQ80331, "Intel IQ80331")
  122. /* Maintainer: Intel Corp. */
  123. .phys_io = 0xfefff000,
  124. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  125. .map_io = iop3xx_map_io,
  126. .init_irq = iop331_init_irq,
  127. .timer = &iop331_timer,
  128. .boot_params = 0x0100,
  129. .init_machine = iop33x_init,
  130. MACHINE_END
  131. #elif defined(CONFIG_MACH_IQ80332)
  132. MACHINE_START(IQ80332, "Intel IQ80332")
  133. /* Maintainer: Intel Corp. */
  134. .phys_io = 0xfefff000,
  135. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  136. .map_io = iop3xx_map_io,
  137. .init_irq = iop331_init_irq,
  138. .timer = &iop331_timer,
  139. .boot_params = 0x0100,
  140. .init_machine = iop33x_init,
  141. MACHINE_END
  142. #else
  143. #error No machine descriptor defined for this IOP3XX implementation
  144. #endif