nas100d-setup.c 4.1 KB

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