devices-rsk7203.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Renesas Technology Europe RSK+ 7203 Support.
  3. *
  4. * Copyright (C) 2008 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/types.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/mtd/mtd.h>
  15. #include <linux/mtd/partitions.h>
  16. #include <linux/mtd/physmap.h>
  17. #include <linux/mtd/map.h>
  18. #include <linux/smsc911x.h>
  19. #include <linux/gpio.h>
  20. #include <linux/leds.h>
  21. #include <asm/machvec.h>
  22. #include <asm/io.h>
  23. #include <cpu/sh7203.h>
  24. static struct smsc911x_platform_config smsc911x_config = {
  25. .phy_interface = PHY_INTERFACE_MODE_MII,
  26. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  27. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  28. .flags = SMSC911X_USE_16BIT,
  29. };
  30. static struct resource smsc911x_resources[] = {
  31. [0] = {
  32. .start = 0x24000000,
  33. .end = 0x24000000 + 0x100,
  34. .flags = IORESOURCE_MEM,
  35. },
  36. [1] = {
  37. .start = 64,
  38. .end = 64,
  39. .flags = IORESOURCE_IRQ,
  40. },
  41. };
  42. static struct platform_device smsc911x_device = {
  43. .name = "smsc911x",
  44. .id = -1,
  45. .num_resources = ARRAY_SIZE(smsc911x_resources),
  46. .resource = smsc911x_resources,
  47. .dev = {
  48. .platform_data = &smsc911x_config,
  49. },
  50. };
  51. static struct gpio_led rsk7203_gpio_leds[] = {
  52. {
  53. .name = "green",
  54. .gpio = GPIO_PE10,
  55. .active_low = 1,
  56. }, {
  57. .name = "orange",
  58. .default_trigger = "nand-disk",
  59. .gpio = GPIO_PE12,
  60. .active_low = 1,
  61. }, {
  62. .name = "red:timer",
  63. .default_trigger = "timer",
  64. .gpio = GPIO_PC14,
  65. .active_low = 1,
  66. }, {
  67. .name = "red:heartbeat",
  68. .default_trigger = "heartbeat",
  69. .gpio = GPIO_PE11,
  70. .active_low = 1,
  71. },
  72. };
  73. static struct gpio_led_platform_data rsk7203_gpio_leds_info = {
  74. .leds = rsk7203_gpio_leds,
  75. .num_leds = ARRAY_SIZE(rsk7203_gpio_leds),
  76. };
  77. static struct platform_device led_device = {
  78. .name = "leds-gpio",
  79. .id = -1,
  80. .dev = {
  81. .platform_data = &rsk7203_gpio_leds_info,
  82. },
  83. };
  84. static struct platform_device *rsk7203_devices[] __initdata = {
  85. &smsc911x_device,
  86. &led_device,
  87. };
  88. static int __init rsk7203_devices_setup(void)
  89. {
  90. /* Select pins for SCIF0 */
  91. gpio_request(GPIO_FN_TXD0, NULL);
  92. gpio_request(GPIO_FN_RXD0, NULL);
  93. return platform_add_devices(rsk7203_devices,
  94. ARRAY_SIZE(rsk7203_devices));
  95. }
  96. device_initcall(rsk7203_devices_setup);