1
2
3
4
5
6
7
8
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
21static struct smsc911x_platform_config smsc911x_config = {
22 .phy_interface = PHY_INTERFACE_MODE_MII,
23 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
24 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
25 .flags = SMSC911X_USE_32BIT | SMSC911X_SWAP_FIFO,
26};
27
28static struct resource smsc911x_resources[] = {
29 [0] = {
30 .start = 0x24000000,
31 .end = 0x240000ff,
32 .flags = IORESOURCE_MEM,
33 },
34 [1] = {
35 .start = 64,
36 .end = 64,
37 .flags = IORESOURCE_IRQ,
38 },
39};
40
41static struct platform_device smsc911x_device = {
42 .name = "smsc911x",
43 .id = -1,
44 .num_resources = ARRAY_SIZE(smsc911x_resources),
45 .resource = smsc911x_resources,
46 .dev = {
47 .platform_data = &smsc911x_config,
48 },
49};
50
51static 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
74static struct gpio_led_platform_data rsk7203_gpio_leds_info = {
75 .leds = rsk7203_gpio_leds,
76 .num_leds = ARRAY_SIZE(rsk7203_gpio_leds),
77};
78
79static struct platform_device led_device = {
80 .name = "leds-gpio",
81 .id = -1,
82 .dev = {
83 .platform_data = &rsk7203_gpio_leds_info,
84 },
85};
86
87static struct platform_device *rsk7203_devices[] __initdata = {
88 &smsc911x_device,
89 &led_device,
90};
91
92static int __init rsk7203_devices_setup(void)
93{
94
95 gpio_request(GPIO_FN_TXD0, NULL);
96 gpio_request(GPIO_FN_RXD0, NULL);
97
98
99 ctrl_outl(0x36db0400, 0xfffc0008);
100 gpio_request(GPIO_FN_IRQ0_PB, NULL);
101
102 return platform_add_devices(rsk7203_devices,
103 ARRAY_SIZE(rsk7203_devices));
104}
105device_initcall(rsk7203_devices_setup);
106