devices-rsk7203.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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/smc911x.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 smc911x_platdata smc911x_info = {
  25. .flags = SMC911X_USE_16BIT,
  26. .irq_flags = IRQF_TRIGGER_LOW,
  27. };
  28. static struct resource smc911x_resources[] = {
  29. [0] = {
  30. .start = 0x24000000,
  31. .end = 0x24000000 + 0x100,
  32. .flags = IORESOURCE_MEM,
  33. },
  34. [1] = {
  35. .start = 64,
  36. .end = 64,
  37. .flags = IORESOURCE_IRQ,
  38. },
  39. };
  40. static struct platform_device smc911x_device = {
  41. .name = "smc911x",
  42. .id = -1,
  43. .num_resources = ARRAY_SIZE(smc911x_resources),
  44. .resource = smc911x_resources,
  45. .dev = {
  46. .platform_data = &smc911x_info,
  47. },
  48. };
  49. static struct gpio_led rsk7203_gpio_leds[] = {
  50. {
  51. .name = "green",
  52. .gpio = GPIO_PE10,
  53. .active_low = 1,
  54. }, {
  55. .name = "orange",
  56. .default_trigger = "nand-disk",
  57. .gpio = GPIO_PE12,
  58. .active_low = 1,
  59. }, {
  60. .name = "red:timer",
  61. .default_trigger = "timer",
  62. .gpio = GPIO_PC14,
  63. .active_low = 1,
  64. }, {
  65. .name = "red:heartbeat",
  66. .default_trigger = "heartbeat",
  67. .gpio = GPIO_PE11,
  68. .active_low = 1,
  69. },
  70. };
  71. static struct gpio_led_platform_data rsk7203_gpio_leds_info = {
  72. .leds = rsk7203_gpio_leds,
  73. .num_leds = ARRAY_SIZE(rsk7203_gpio_leds),
  74. };
  75. static struct platform_device led_device = {
  76. .name = "leds-gpio",
  77. .id = -1,
  78. .dev = {
  79. .platform_data = &rsk7203_gpio_leds_info,
  80. },
  81. };
  82. static struct platform_device *rsk7203_devices[] __initdata = {
  83. &smc911x_device,
  84. &led_device,
  85. };
  86. static int __init rsk7203_devices_setup(void)
  87. {
  88. /* Select pins for SCIF0 */
  89. gpio_request(GPIO_FN_TXD0, NULL);
  90. gpio_request(GPIO_FN_RXD0, NULL);
  91. return platform_add_devices(rsk7203_devices,
  92. ARRAY_SIZE(rsk7203_devices));
  93. }
  94. device_initcall(rsk7203_devices_setup);