nas100d-setup.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * arch/arm/mach-ixp4xx/nas100d-setup.c
  3. *
  4. * NAS 100d board-setup
  5. *
  6. * based ixdp425-setup.c:
  7. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  8. *
  9. * Author: Alessandro Zummo <a.zummo@towertech.it>
  10. * Author: Rod Whitby <rod@whitby.id.au>
  11. * Maintainers: http://www.nslu2-linux.org/
  12. *
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/serial.h>
  16. #include <linux/serial_8250.h>
  17. #include <asm/mach-types.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach/flash.h>
  20. static struct flash_platform_data nas100d_flash_data = {
  21. .map_name = "cfi_probe",
  22. .width = 2,
  23. };
  24. static struct resource nas100d_flash_resource = {
  25. .start = NAS100D_FLASH_BASE,
  26. .end = NAS100D_FLASH_BASE + NAS100D_FLASH_SIZE,
  27. .flags = IORESOURCE_MEM,
  28. };
  29. static struct platform_device nas100d_flash = {
  30. .name = "IXP4XX-Flash",
  31. .id = 0,
  32. .dev.platform_data = &nas100d_flash_data,
  33. .num_resources = 1,
  34. .resource = &nas100d_flash_resource,
  35. };
  36. static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = {
  37. .sda_pin = NAS100D_SDA_PIN,
  38. .scl_pin = NAS100D_SCL_PIN,
  39. };
  40. static struct platform_device nas100d_i2c_controller = {
  41. .name = "IXP4XX-I2C",
  42. .id = 0,
  43. .dev.platform_data = &nas100d_i2c_gpio_pins,
  44. .num_resources = 0,
  45. };
  46. static struct resource nas100d_uart_resources[] = {
  47. {
  48. .start = IXP4XX_UART1_BASE_PHYS,
  49. .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  50. .flags = IORESOURCE_MEM,
  51. },
  52. {
  53. .start = IXP4XX_UART2_BASE_PHYS,
  54. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  55. .flags = IORESOURCE_MEM,
  56. }
  57. };
  58. static struct plat_serial8250_port nas100d_uart_data[] = {
  59. {
  60. .mapbase = IXP4XX_UART1_BASE_PHYS,
  61. .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  62. .irq = IRQ_IXP4XX_UART1,
  63. .flags = UPF_BOOT_AUTOCONF,
  64. .iotype = UPIO_MEM,
  65. .regshift = 2,
  66. .uartclk = IXP4XX_UART_XTAL,
  67. },
  68. {
  69. .mapbase = IXP4XX_UART2_BASE_PHYS,
  70. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  71. .irq = IRQ_IXP4XX_UART2,
  72. .flags = UPF_BOOT_AUTOCONF,
  73. .iotype = UPIO_MEM,
  74. .regshift = 2,
  75. .uartclk = IXP4XX_UART_XTAL,
  76. },
  77. { }
  78. };
  79. static struct platform_device nas100d_uart = {
  80. .name = "serial8250",
  81. .id = PLAT8250_DEV_PLATFORM,
  82. .dev.platform_data = nas100d_uart_data,
  83. .num_resources = 2,
  84. .resource = nas100d_uart_resources,
  85. };
  86. static struct platform_device *nas100d_devices[] __initdata = {
  87. &nas100d_i2c_controller,
  88. &nas100d_flash,
  89. &nas100d_uart,
  90. };
  91. static void nas100d_power_off(void)
  92. {
  93. /* This causes the box to drop the power and go dead. */
  94. /* enable the pwr cntl gpio */
  95. gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
  96. /* do the deed */
  97. gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
  98. }
  99. static void __init nas100d_init(void)
  100. {
  101. ixp4xx_sys_init();
  102. pm_power_off = nas100d_power_off;
  103. platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
  104. }
  105. MACHINE_START(NAS100D, "Iomega NAS 100d")
  106. /* Maintainer: www.nslu2-linux.org */
  107. .phys_ram = PHYS_OFFSET,
  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 = nas100d_init,
  115. MACHINE_END