nas100d-setup.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. .flags = IORESOURCE_MEM,
  26. };
  27. static struct platform_device nas100d_flash = {
  28. .name = "IXP4XX-Flash",
  29. .id = 0,
  30. .dev.platform_data = &nas100d_flash_data,
  31. .num_resources = 1,
  32. .resource = &nas100d_flash_resource,
  33. };
  34. static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = {
  35. .sda_pin = NAS100D_SDA_PIN,
  36. .scl_pin = NAS100D_SCL_PIN,
  37. };
  38. static struct platform_device nas100d_i2c_controller = {
  39. .name = "IXP4XX-I2C",
  40. .id = 0,
  41. .dev.platform_data = &nas100d_i2c_gpio_pins,
  42. .num_resources = 0,
  43. };
  44. static struct resource nas100d_uart_resources[] = {
  45. {
  46. .start = IXP4XX_UART1_BASE_PHYS,
  47. .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  48. .flags = IORESOURCE_MEM,
  49. },
  50. {
  51. .start = IXP4XX_UART2_BASE_PHYS,
  52. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  53. .flags = IORESOURCE_MEM,
  54. }
  55. };
  56. static struct plat_serial8250_port nas100d_uart_data[] = {
  57. {
  58. .mapbase = IXP4XX_UART1_BASE_PHYS,
  59. .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  60. .irq = IRQ_IXP4XX_UART1,
  61. .flags = UPF_BOOT_AUTOCONF,
  62. .iotype = UPIO_MEM,
  63. .regshift = 2,
  64. .uartclk = IXP4XX_UART_XTAL,
  65. },
  66. {
  67. .mapbase = IXP4XX_UART2_BASE_PHYS,
  68. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  69. .irq = IRQ_IXP4XX_UART2,
  70. .flags = UPF_BOOT_AUTOCONF,
  71. .iotype = UPIO_MEM,
  72. .regshift = 2,
  73. .uartclk = IXP4XX_UART_XTAL,
  74. },
  75. { }
  76. };
  77. static struct platform_device nas100d_uart = {
  78. .name = "serial8250",
  79. .id = PLAT8250_DEV_PLATFORM,
  80. .dev.platform_data = nas100d_uart_data,
  81. .num_resources = 2,
  82. .resource = nas100d_uart_resources,
  83. };
  84. static struct platform_device *nas100d_devices[] __initdata = {
  85. &nas100d_i2c_controller,
  86. &nas100d_flash,
  87. &nas100d_uart,
  88. };
  89. static void nas100d_power_off(void)
  90. {
  91. /* This causes the box to drop the power and go dead. */
  92. /* enable the pwr cntl gpio */
  93. gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
  94. /* do the deed */
  95. gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
  96. }
  97. static void __init nas100d_init(void)
  98. {
  99. ixp4xx_sys_init();
  100. nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  101. nas100d_flash_resource.end =
  102. IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
  103. pm_power_off = nas100d_power_off;
  104. platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
  105. }
  106. MACHINE_START(NAS100D, "Iomega NAS 100d")
  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 = nas100d_init,
  115. MACHINE_END