nslu2-setup.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. .start = NSLU2_FLASH_BASE,
  27. .end = NSLU2_FLASH_BASE + NSLU2_FLASH_SIZE,
  28. .flags = IORESOURCE_MEM,
  29. };
  30. static struct platform_device nslu2_flash = {
  31. .name = "IXP4XX-Flash",
  32. .id = 0,
  33. .dev.platform_data = &nslu2_flash_data,
  34. .num_resources = 1,
  35. .resource = &nslu2_flash_resource,
  36. };
  37. static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = {
  38. .sda_pin = NSLU2_SDA_PIN,
  39. .scl_pin = NSLU2_SCL_PIN,
  40. };
  41. static struct platform_device nslu2_i2c_controller = {
  42. .name = "IXP4XX-I2C",
  43. .id = 0,
  44. .dev.platform_data = &nslu2_i2c_gpio_pins,
  45. .num_resources = 0,
  46. };
  47. static struct resource nslu2_uart_resources[] = {
  48. {
  49. .start = IXP4XX_UART1_BASE_PHYS,
  50. .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  51. .flags = IORESOURCE_MEM,
  52. },
  53. {
  54. .start = IXP4XX_UART2_BASE_PHYS,
  55. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  56. .flags = IORESOURCE_MEM,
  57. }
  58. };
  59. static struct plat_serial8250_port nslu2_uart_data[] = {
  60. {
  61. .mapbase = IXP4XX_UART1_BASE_PHYS,
  62. .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  63. .irq = IRQ_IXP4XX_UART1,
  64. .flags = UPF_BOOT_AUTOCONF,
  65. .iotype = UPIO_MEM,
  66. .regshift = 2,
  67. .uartclk = IXP4XX_UART_XTAL,
  68. },
  69. {
  70. .mapbase = IXP4XX_UART2_BASE_PHYS,
  71. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  72. .irq = IRQ_IXP4XX_UART2,
  73. .flags = UPF_BOOT_AUTOCONF,
  74. .iotype = UPIO_MEM,
  75. .regshift = 2,
  76. .uartclk = IXP4XX_UART_XTAL,
  77. },
  78. { }
  79. };
  80. static struct platform_device nslu2_uart = {
  81. .name = "serial8250",
  82. .id = PLAT8250_DEV_PLATFORM,
  83. .dev.platform_data = nslu2_uart_data,
  84. .num_resources = 2,
  85. .resource = nslu2_uart_resources,
  86. };
  87. static struct platform_device *nslu2_devices[] __initdata = {
  88. &nslu2_i2c_controller,
  89. &nslu2_flash,
  90. &nslu2_uart,
  91. };
  92. static void nslu2_power_off(void)
  93. {
  94. /* This causes the box to drop the power and go dead. */
  95. /* enable the pwr cntl gpio */
  96. gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT);
  97. /* do the deed */
  98. gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
  99. }
  100. static void __init nslu2_init(void)
  101. {
  102. ixp4xx_sys_init();
  103. pm_power_off = nslu2_power_off;
  104. platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
  105. }
  106. MACHINE_START(NSLU2, "Linksys NSLU2")
  107. /* Maintainer: www.nslu2-linux.org */
  108. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  109. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
  110. .boot_params = 0x00000100,
  111. .map_io = ixp4xx_map_io,
  112. .init_irq = ixp4xx_init_irq,
  113. .timer = &ixp4xx_timer,
  114. .init_machine = nslu2_init,
  115. MACHINE_END