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/smsc911x.h>
  15. #include <linux/gpio.h>
  16. #include <linux/leds.h>
  17. #include <asm/machvec.h>
  18. #include <asm/io.h>
  19. #include <cpu/sh7203.h>
  20. static struct smsc911x_platform_config smsc911x_config = {
  21. .phy_interface = PHY_INTERFACE_MODE_MII,
  22. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  23. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  24. .flags = SMSC911X_USE_32BIT | SMSC911X_SWAP_FIFO,
  25. };
  26. static struct resource smsc911x_resources[] = {
  27. [0] = {
  28. .start = 0x24000000,
  29. .end = 0x240000ff,
  30. .flags = IORESOURCE_MEM,
  31. },
  32. [1] = {
  33. .start = 64,
  34. .end = 64,
  35. .flags = IORESOURCE_IRQ,
  36. },
  37. };
  38. static struct platform_device smsc911x_device = {
  39. .name = "smsc911x",
  40. .id = -1,
  41. .num_resources = ARRAY_SIZE(smsc911x_resources),
  42. .resource = smsc911x_resources,
  43. .dev = {
  44. .platform_data = &smsc911x_config,
  45. },
  46. };
  47. static struct gpio_led rsk7203_gpio_leds[] = {
  48. {
  49. .name = "green",
  50. .gpio = GPIO_PE10,
  51. .active_low = 1,
  52. }, {
  53. .name = "orange",
  54. .default_trigger = "nand-disk",
  55. .gpio = GPIO_PE12,
  56. .active_low = 1,
  57. }, {
  58. .name = "red:timer",
  59. .default_trigger = "timer",
  60. .gpio = GPIO_PC14,
  61. .active_low = 1,
  62. }, {
  63. .name = "red:heartbeat",
  64. .default_trigger = "heartbeat",
  65. .gpio = GPIO_PE11,
  66. .active_low = 1,
  67. },
  68. };
  69. static struct gpio_led_platform_data rsk7203_gpio_leds_info = {
  70. .leds = rsk7203_gpio_leds,
  71. .num_leds = ARRAY_SIZE(rsk7203_gpio_leds),
  72. };
  73. static struct platform_device led_device = {
  74. .name = "leds-gpio",
  75. .id = -1,
  76. .dev = {
  77. .platform_data = &rsk7203_gpio_leds_info,
  78. },
  79. };
  80. static struct platform_device *rsk7203_devices[] __initdata = {
  81. &smsc911x_device,
  82. &led_device,
  83. };
  84. static int __init rsk7203_devices_setup(void)
  85. {
  86. /* Select pins for SCIF0 */
  87. gpio_request(GPIO_FN_TXD0, NULL);
  88. gpio_request(GPIO_FN_RXD0, NULL);
  89. /* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */
  90. ctrl_outl(0x36db0400, 0xfffc0008); /* CS1BCR */
  91. gpio_request(GPIO_FN_IRQ0_PB, NULL);
  92. return platform_add_devices(rsk7203_devices,
  93. ARRAY_SIZE(rsk7203_devices));
  94. }
  95. device_initcall(rsk7203_devices_setup);