iop331-setup.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. * linux/arch/arm/mach-iop3xx/iop331-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/config.h>
  15. #include <linux/init.h>
  16. #include <linux/major.h>
  17. #include <linux/fs.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/serial.h>
  20. #include <linux/tty.h>
  21. #include <linux/serial_core.h>
  22. #include <asm/io.h>
  23. #include <asm/pgtable.h>
  24. #include <asm/page.h>
  25. #include <asm/mach/map.h>
  26. #include <asm/setup.h>
  27. #include <asm/system.h>
  28. #include <asm/memory.h>
  29. #include <asm/hardware.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/mach/arch.h>
  32. #define IOP331_UART_XTAL 33334000
  33. /*
  34. * Standard IO mapping for all IOP331 based systems
  35. */
  36. static struct map_desc iop331_std_desc[] __initdata = {
  37. { /* mem mapped registers */
  38. .virtual = IOP331_VIRT_MEM_BASE,
  39. .pfn = __phys_to_pfn(IOP331_PHYS_MEM_BASE),
  40. .length = 0x00002000,
  41. .type = MT_DEVICE
  42. }, { /* PCI IO space */
  43. .virtual = IOP331_PCI_LOWER_IO_VA,
  44. .pfn = __phys_to_pfn(IOP331_PCI_LOWER_IO_PA),
  45. .length = IOP331_PCI_IO_WINDOW_SIZE,
  46. .type = MT_DEVICE
  47. }
  48. };
  49. static struct uart_port iop331_serial_ports[] = {
  50. {
  51. .membase = (char*)(IOP331_UART0_VIRT),
  52. .mapbase = (IOP331_UART0_PHYS),
  53. .irq = IRQ_IOP331_UART0,
  54. .flags = UPF_SKIP_TEST,
  55. .iotype = UPIO_MEM,
  56. .regshift = 2,
  57. .uartclk = IOP331_UART_XTAL,
  58. .line = 0,
  59. .type = PORT_XSCALE,
  60. .fifosize = 32
  61. } , {
  62. .membase = (char*)(IOP331_UART1_VIRT),
  63. .mapbase = (IOP331_UART1_PHYS),
  64. .irq = IRQ_IOP331_UART1,
  65. .flags = UPF_SKIP_TEST,
  66. .iotype = UPIO_MEM,
  67. .regshift = 2,
  68. .uartclk = IOP331_UART_XTAL,
  69. .line = 1,
  70. .type = PORT_XSCALE,
  71. .fifosize = 32
  72. }
  73. };
  74. static struct resource iop33x_i2c_0_resources[] = {
  75. [0] = {
  76. .start = 0xfffff680,
  77. .end = 0xfffff698,
  78. .flags = IORESOURCE_MEM,
  79. },
  80. [1] = {
  81. .start = IRQ_IOP331_I2C_0,
  82. .end = IRQ_IOP331_I2C_0,
  83. .flags = IORESOURCE_IRQ
  84. }
  85. };
  86. static struct resource iop33x_i2c_1_resources[] = {
  87. [0] = {
  88. .start = 0xfffff6a0,
  89. .end = 0xfffff6b8,
  90. .flags = IORESOURCE_MEM,
  91. },
  92. [1] = {
  93. .start = IRQ_IOP331_I2C_1,
  94. .end = IRQ_IOP331_I2C_1,
  95. .flags = IORESOURCE_IRQ
  96. }
  97. };
  98. static struct platform_device iop33x_i2c_0_controller = {
  99. .name = "IOP3xx-I2C",
  100. .id = 0,
  101. .num_resources = 2,
  102. .resource = iop33x_i2c_0_resources
  103. };
  104. static struct platform_device iop33x_i2c_1_controller = {
  105. .name = "IOP3xx-I2C",
  106. .id = 1,
  107. .num_resources = 2,
  108. .resource = iop33x_i2c_1_resources
  109. };
  110. static struct platform_device *iop33x_devices[] __initdata = {
  111. &iop33x_i2c_0_controller,
  112. &iop33x_i2c_1_controller
  113. };
  114. void __init iop33x_init(void)
  115. {
  116. if(iop_is_331())
  117. {
  118. platform_add_devices(iop33x_devices,
  119. ARRAY_SIZE(iop33x_devices));
  120. }
  121. }
  122. void __init iop331_map_io(void)
  123. {
  124. iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
  125. early_serial_setup(&iop331_serial_ports[0]);
  126. early_serial_setup(&iop331_serial_ports[1]);
  127. }
  128. #ifdef CONFIG_ARCH_IOP331
  129. extern void iop331_init_irq(void);
  130. extern struct sys_timer iop331_timer;
  131. #endif
  132. #ifdef CONFIG_ARCH_IQ80331
  133. extern void iq80331_map_io(void);
  134. #endif
  135. #ifdef CONFIG_MACH_IQ80332
  136. extern void iq80332_map_io(void);
  137. #endif
  138. #if defined(CONFIG_ARCH_IQ80331)
  139. MACHINE_START(IQ80331, "Intel IQ80331")
  140. /* Maintainer: Intel Corp. */
  141. .phys_ram = PHYS_OFFSET,
  142. .phys_io = 0xfefff000,
  143. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  144. .map_io = iq80331_map_io,
  145. .init_irq = iop331_init_irq,
  146. .timer = &iop331_timer,
  147. .boot_params = 0x0100,
  148. .init_machine = iop33x_init,
  149. MACHINE_END
  150. #elif defined(CONFIG_MACH_IQ80332)
  151. MACHINE_START(IQ80332, "Intel IQ80332")
  152. /* Maintainer: Intel Corp. */
  153. .phys_ram = PHYS_OFFSET,
  154. .phys_io = 0xfefff000,
  155. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  156. .map_io = iq80332_map_io,
  157. .init_irq = iop331_init_irq,
  158. .timer = &iop331_timer,
  159. .boot_params = 0x0100,
  160. .init_machine = iop33x_init,
  161. MACHINE_END
  162. #else
  163. #error No machine descriptor defined for this IOP3XX implementation
  164. #endif