setup.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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/hardware/iop3xx.h>
  31. #define IOP331_UART_XTAL 33334000
  32. static struct resource iop33x_uart0_resources[] = {
  33. [0] = {
  34. .start = IOP331_UART0_PHYS,
  35. .end = IOP331_UART0_PHYS + 0x3f,
  36. .flags = IORESOURCE_MEM,
  37. },
  38. [1] = {
  39. .start = IRQ_IOP331_UART0,
  40. .end = IRQ_IOP331_UART0,
  41. .flags = IORESOURCE_IRQ
  42. }
  43. };
  44. static struct resource iop33x_uart1_resources[] = {
  45. [0] = {
  46. .start = IOP331_UART1_PHYS,
  47. .end = IOP331_UART1_PHYS + 0x3f,
  48. .flags = IORESOURCE_MEM,
  49. },
  50. [1] = {
  51. .start = IRQ_IOP331_UART1,
  52. .end = IRQ_IOP331_UART1,
  53. .flags = IORESOURCE_IRQ
  54. }
  55. };
  56. static struct plat_serial8250_port iop33x_uart0_data[] = {
  57. {
  58. .membase = (char*)(IOP331_UART0_VIRT),
  59. .mapbase = (IOP331_UART0_PHYS),
  60. .irq = IRQ_IOP331_UART0,
  61. .uartclk = IOP331_UART_XTAL,
  62. .regshift = 2,
  63. .iotype = UPIO_MEM,
  64. .flags = UPF_SKIP_TEST,
  65. },
  66. { },
  67. };
  68. static struct plat_serial8250_port iop33x_uart1_data[] = {
  69. {
  70. .membase = (char*)(IOP331_UART1_VIRT),
  71. .mapbase = (IOP331_UART1_PHYS),
  72. .irq = IRQ_IOP331_UART1,
  73. .uartclk = IOP331_UART_XTAL,
  74. .regshift = 2,
  75. .iotype = UPIO_MEM,
  76. .flags = UPF_SKIP_TEST,
  77. },
  78. { },
  79. };
  80. static struct platform_device iop33x_uart0 = {
  81. .name = "serial8250",
  82. .id = PLAT8250_DEV_PLATFORM,
  83. .dev.platform_data = iop33x_uart0_data,
  84. .num_resources = 2,
  85. .resource = iop33x_uart0_resources,
  86. };
  87. static struct platform_device iop33x_uart1 = {
  88. .name = "serial8250",
  89. .id = PLAT8250_DEV_PLATFORM1,
  90. .dev.platform_data = iop33x_uart1_data,
  91. .num_resources = 2,
  92. .resource = iop33x_uart1_resources,
  93. };
  94. static struct platform_device *iop33x_devices[] __initdata = {
  95. &iop33x_uart0,
  96. &iop33x_uart1,
  97. };
  98. void __init iop33x_init(void)
  99. {
  100. if(iop_is_331())
  101. {
  102. platform_add_devices(iop33x_devices,
  103. ARRAY_SIZE(iop33x_devices));
  104. }
  105. platform_device_register(&iop3xx_i2c0_device);
  106. platform_device_register(&iop3xx_i2c1_device);
  107. }
  108. #ifdef CONFIG_ARCH_IOP33X
  109. extern void iop331_init_irq(void);
  110. extern struct sys_timer iop331_timer;
  111. #endif
  112. #if defined(CONFIG_ARCH_IQ80331)
  113. MACHINE_START(IQ80331, "Intel IQ80331")
  114. /* Maintainer: Intel Corp. */
  115. .phys_io = 0xfefff000,
  116. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  117. .map_io = iop3xx_map_io,
  118. .init_irq = iop331_init_irq,
  119. .timer = &iop331_timer,
  120. .boot_params = 0x0100,
  121. .init_machine = iop33x_init,
  122. MACHINE_END
  123. #elif defined(CONFIG_MACH_IQ80332)
  124. MACHINE_START(IQ80332, "Intel IQ80332")
  125. /* Maintainer: Intel Corp. */
  126. .phys_io = 0xfefff000,
  127. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  128. .map_io = iop3xx_map_io,
  129. .init_irq = iop331_init_irq,
  130. .timer = &iop331_timer,
  131. .boot_params = 0x0100,
  132. .init_machine = iop33x_init,
  133. MACHINE_END
  134. #else
  135. #error No machine descriptor defined for this IOP3XX implementation
  136. #endif