nas100d-setup.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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 <linux/leds.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 nas100d_flash_data = {
  22. .map_name = "cfi_probe",
  23. .width = 2,
  24. };
  25. static struct resource nas100d_flash_resource = {
  26. .flags = IORESOURCE_MEM,
  27. };
  28. static struct platform_device nas100d_flash = {
  29. .name = "IXP4XX-Flash",
  30. .id = 0,
  31. .dev.platform_data = &nas100d_flash_data,
  32. .num_resources = 1,
  33. .resource = &nas100d_flash_resource,
  34. };
  35. #ifdef CONFIG_LEDS_IXP4XX
  36. static struct resource nas100d_led_resources[] = {
  37. {
  38. .name = "wlan", /* green led */
  39. .start = 0,
  40. .end = 0,
  41. .flags = IXP4XX_GPIO_LOW,
  42. },
  43. {
  44. .name = "ready", /* blue power led (off is flashing!) */
  45. .start = 15,
  46. .end = 15,
  47. .flags = IXP4XX_GPIO_LOW,
  48. },
  49. {
  50. .name = "disk", /* yellow led */
  51. .start = 3,
  52. .end = 3,
  53. .flags = IXP4XX_GPIO_LOW,
  54. },
  55. };
  56. static struct platform_device nas100d_leds = {
  57. .name = "IXP4XX-GPIO-LED",
  58. .id = -1,
  59. .num_resources = ARRAY_SIZE(nas100d_led_resources),
  60. .resource = nas100d_led_resources,
  61. };
  62. #endif
  63. static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = {
  64. .sda_pin = NAS100D_SDA_PIN,
  65. .scl_pin = NAS100D_SCL_PIN,
  66. };
  67. static struct platform_device nas100d_i2c_controller = {
  68. .name = "IXP4XX-I2C",
  69. .id = 0,
  70. .dev.platform_data = &nas100d_i2c_gpio_pins,
  71. .num_resources = 0,
  72. };
  73. static struct resource nas100d_uart_resources[] = {
  74. {
  75. .start = IXP4XX_UART1_BASE_PHYS,
  76. .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  77. .flags = IORESOURCE_MEM,
  78. },
  79. {
  80. .start = IXP4XX_UART2_BASE_PHYS,
  81. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  82. .flags = IORESOURCE_MEM,
  83. }
  84. };
  85. static struct plat_serial8250_port nas100d_uart_data[] = {
  86. {
  87. .mapbase = IXP4XX_UART1_BASE_PHYS,
  88. .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  89. .irq = IRQ_IXP4XX_UART1,
  90. .flags = UPF_BOOT_AUTOCONF,
  91. .iotype = UPIO_MEM,
  92. .regshift = 2,
  93. .uartclk = IXP4XX_UART_XTAL,
  94. },
  95. {
  96. .mapbase = IXP4XX_UART2_BASE_PHYS,
  97. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  98. .irq = IRQ_IXP4XX_UART2,
  99. .flags = UPF_BOOT_AUTOCONF,
  100. .iotype = UPIO_MEM,
  101. .regshift = 2,
  102. .uartclk = IXP4XX_UART_XTAL,
  103. },
  104. { }
  105. };
  106. static struct platform_device nas100d_uart = {
  107. .name = "serial8250",
  108. .id = PLAT8250_DEV_PLATFORM,
  109. .dev.platform_data = nas100d_uart_data,
  110. .num_resources = 2,
  111. .resource = nas100d_uart_resources,
  112. };
  113. static struct platform_device *nas100d_devices[] __initdata = {
  114. &nas100d_i2c_controller,
  115. &nas100d_flash,
  116. #ifdef CONFIG_LEDS_IXP4XX
  117. &nas100d_leds,
  118. #endif
  119. };
  120. static void nas100d_power_off(void)
  121. {
  122. /* This causes the box to drop the power and go dead. */
  123. /* enable the pwr cntl gpio */
  124. gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
  125. /* do the deed */
  126. gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
  127. }
  128. static void __init nas100d_init(void)
  129. {
  130. ixp4xx_sys_init();
  131. /* gpio 14 and 15 are _not_ clocks */
  132. *IXP4XX_GPIO_GPCLKR = 0;
  133. nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  134. nas100d_flash_resource.end =
  135. IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
  136. pm_power_off = nas100d_power_off;
  137. /*
  138. * This is only useful on a modified machine, but it is valuable
  139. * to have it first in order to see debug messages, and so that
  140. * it does *not* get removed if platform_add_devices fails!
  141. */
  142. (void)platform_device_register(&nas100d_uart);
  143. platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
  144. }
  145. MACHINE_START(NAS100D, "Iomega NAS 100d")
  146. /* Maintainer: www.nslu2-linux.org */
  147. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  148. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
  149. .boot_params = 0x00000100,
  150. .map_io = ixp4xx_map_io,
  151. .init_irq = ixp4xx_init_irq,
  152. .timer = &ixp4xx_timer,
  153. .init_machine = nas100d_init,
  154. MACHINE_END