blob: c37617e6322031d892d33ed3b4266fdc62e4f9ca [file] [log] [blame]
Paul Mundtea0aac12008-12-08 14:32:03 +09001/*
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>
Steve Glendinning8ed35922009-01-07 17:22:24 +090014#include <linux/smsc911x.h>
Paul Mundtea0aac12008-12-08 14:32:03 +090015#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
Steve Glendinning8ed35922009-01-07 17:22:24 +090021static 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,
Magnus Damm724cfb92009-04-28 08:02:13 +000025 .flags = SMSC911X_USE_32BIT | SMSC911X_SWAP_FIFO,
Paul Mundtea0aac12008-12-08 14:32:03 +090026};
27
Steve Glendinning8ed35922009-01-07 17:22:24 +090028static struct resource smsc911x_resources[] = {
Paul Mundtea0aac12008-12-08 14:32:03 +090029 [0] = {
30 .start = 0x24000000,
Magnus Damm724cfb92009-04-28 08:02:13 +000031 .end = 0x240000ff,
Paul Mundtea0aac12008-12-08 14:32:03 +090032 .flags = IORESOURCE_MEM,
33 },
34 [1] = {
35 .start = 64,
36 .end = 64,
37 .flags = IORESOURCE_IRQ,
38 },
39};
40
Steve Glendinning8ed35922009-01-07 17:22:24 +090041static struct platform_device smsc911x_device = {
42 .name = "smsc911x",
Paul Mundtea0aac12008-12-08 14:32:03 +090043 .id = -1,
Steve Glendinning8ed35922009-01-07 17:22:24 +090044 .num_resources = ARRAY_SIZE(smsc911x_resources),
45 .resource = smsc911x_resources,
Paul Mundtea0aac12008-12-08 14:32:03 +090046 .dev = {
Steve Glendinning8ed35922009-01-07 17:22:24 +090047 .platform_data = &smsc911x_config,
Paul Mundtea0aac12008-12-08 14:32:03 +090048 },
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 = {
Steve Glendinning8ed35922009-01-07 17:22:24 +090088 &smsc911x_device,
Paul Mundtea0aac12008-12-08 14:32:03 +090089 &led_device,
90};
91
92static int __init rsk7203_devices_setup(void)
93{
94 /* Select pins for SCIF0 */
95 gpio_request(GPIO_FN_TXD0, NULL);
96 gpio_request(GPIO_FN_RXD0, NULL);
97
Magnus Damm724cfb92009-04-28 08:02:13 +000098 /* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */
99 ctrl_outl(0x36db0400, 0xfffc0008); /* CS1BCR */
100 gpio_request(GPIO_FN_IRQ0_PB, NULL);
101
Paul Mundtea0aac12008-12-08 14:32:03 +0900102 return platform_add_devices(rsk7203_devices,
103 ARRAY_SIZE(rsk7203_devices));
104}
105device_initcall(rsk7203_devices_setup);