nslu2-setup.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * arch/arm/mach-ixp4xx/nslu2-setup.c
  3. *
  4. * NSLU2 board-setup
  5. *
  6. * based ixdp425-setup.c:
  7. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  8. *
  9. * Author: Mark Rakes <mrakes at mac.com>
  10. * Maintainers: http://www.nslu2-linux.org/
  11. *
  12. * Fixed missing init_time in MACHINE_START kas11 10/22/04
  13. * Changed to conform to new style __init ixdp425 kas11 10/22/04
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/serial.h>
  17. #include <linux/serial_8250.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach/flash.h>
  21. static struct flash_platform_data nslu2_flash_data = {
  22. .map_name = "cfi_probe",
  23. .width = 2,
  24. };
  25. static struct resource nslu2_flash_resource = {
  26. .flags = IORESOURCE_MEM,
  27. };
  28. static struct platform_device nslu2_flash = {
  29. .name = "IXP4XX-Flash",
  30. .id = 0,
  31. .dev.platform_data = &nslu2_flash_data,
  32. .num_resources = 1,
  33. .resource = &nslu2_flash_resource,
  34. };
  35. static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = {
  36. .sda_pin = NSLU2_SDA_PIN,
  37. .scl_pin = NSLU2_SCL_PIN,
  38. };
  39. static struct platform_device nslu2_i2c_controller = {
  40. .name = "IXP4XX-I2C",
  41. .id = 0,
  42. .dev.platform_data = &nslu2_i2c_gpio_pins,
  43. .num_resources = 0,
  44. };
  45. static struct platform_device nslu2_beeper = {
  46. .name = "ixp4xx-beeper",
  47. .id = NSLU2_GPIO_BUZZ,
  48. .num_resources = 0,
  49. };
  50. static struct resource nslu2_uart_resources[] = {
  51. {
  52. .start = IXP4XX_UART1_BASE_PHYS,
  53. .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  54. .flags = IORESOURCE_MEM,
  55. },
  56. {
  57. .start = IXP4XX_UART2_BASE_PHYS,
  58. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  59. .flags = IORESOURCE_MEM,
  60. }
  61. };
  62. static struct plat_serial8250_port nslu2_uart_data[] = {
  63. {
  64. .mapbase = IXP4XX_UART1_BASE_PHYS,
  65. .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  66. .irq = IRQ_IXP4XX_UART1,
  67. .flags = UPF_BOOT_AUTOCONF,
  68. .iotype = UPIO_MEM,
  69. .regshift = 2,
  70. .uartclk = IXP4XX_UART_XTAL,
  71. },
  72. {
  73. .mapbase = IXP4XX_UART2_BASE_PHYS,
  74. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  75. .irq = IRQ_IXP4XX_UART2,
  76. .flags = UPF_BOOT_AUTOCONF,
  77. .iotype = UPIO_MEM,
  78. .regshift = 2,
  79. .uartclk = IXP4XX_UART_XTAL,
  80. },
  81. { }
  82. };
  83. static struct platform_device nslu2_uart = {
  84. .name = "serial8250",
  85. .id = PLAT8250_DEV_PLATFORM,
  86. .dev.platform_data = nslu2_uart_data,
  87. .num_resources = 2,
  88. .resource = nslu2_uart_resources,
  89. };
  90. static struct platform_device *nslu2_devices[] __initdata = {
  91. &nslu2_i2c_controller,
  92. &nslu2_flash,
  93. &nslu2_uart,
  94. &nslu2_beeper,
  95. };
  96. static void nslu2_power_off(void)
  97. {
  98. /* This causes the box to drop the power and go dead. */
  99. /* enable the pwr cntl gpio */
  100. gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT);
  101. /* do the deed */
  102. gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
  103. }
  104. static void __init nslu2_init(void)
  105. {
  106. ixp4xx_sys_init();
  107. nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  108. nslu2_flash_resource.end =
  109. IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
  110. pm_power_off = nslu2_power_off;
  111. platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
  112. }
  113. MACHINE_START(NSLU2, "Linksys NSLU2")
  114. /* Maintainer: www.nslu2-linux.org */
  115. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  116. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
  117. .boot_params = 0x00000100,
  118. .map_io = ixp4xx_map_io,
  119. .init_irq = ixp4xx_init_irq,
  120. .timer = &ixp4xx_timer,
  121. .init_machine = nslu2_init,
  122. MACHINE_END