blob: 4af3a771c058d76733016c0d148c1af5d32a0b76 [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>
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/map.h>
Steve Glendinning8ed35922009-01-07 17:22:24 +090018#include <linux/smsc911x.h>
Paul Mundtea0aac12008-12-08 14:32:03 +090019#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
Steve Glendinning8ed35922009-01-07 17:22:24 +090025static struct smsc911x_platform_config smsc911x_config = {
26 .phy_interface = PHY_INTERFACE_MODE_MII,
27 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
28 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
Magnus Damm724cfb92009-04-28 08:02:13 +000029 .flags = SMSC911X_USE_32BIT | SMSC911X_SWAP_FIFO,
Paul Mundtea0aac12008-12-08 14:32:03 +090030};
31
Steve Glendinning8ed35922009-01-07 17:22:24 +090032static struct resource smsc911x_resources[] = {
Paul Mundtea0aac12008-12-08 14:32:03 +090033 [0] = {
34 .start = 0x24000000,
Magnus Damm724cfb92009-04-28 08:02:13 +000035 .end = 0x240000ff,
Paul Mundtea0aac12008-12-08 14:32:03 +090036 .flags = IORESOURCE_MEM,
37 },
38 [1] = {
39 .start = 64,
40 .end = 64,
41 .flags = IORESOURCE_IRQ,
42 },
43};
44
Steve Glendinning8ed35922009-01-07 17:22:24 +090045static struct platform_device smsc911x_device = {
46 .name = "smsc911x",
Paul Mundtea0aac12008-12-08 14:32:03 +090047 .id = -1,
Steve Glendinning8ed35922009-01-07 17:22:24 +090048 .num_resources = ARRAY_SIZE(smsc911x_resources),
49 .resource = smsc911x_resources,
Paul Mundtea0aac12008-12-08 14:32:03 +090050 .dev = {
Steve Glendinning8ed35922009-01-07 17:22:24 +090051 .platform_data = &smsc911x_config,
Paul Mundtea0aac12008-12-08 14:32:03 +090052 },
53};
54
55static struct gpio_led rsk7203_gpio_leds[] = {
56 {
57 .name = "green",
58 .gpio = GPIO_PE10,
59 .active_low = 1,
60 }, {
61 .name = "orange",
62 .default_trigger = "nand-disk",
63 .gpio = GPIO_PE12,
64 .active_low = 1,
65 }, {
66 .name = "red:timer",
67 .default_trigger = "timer",
68 .gpio = GPIO_PC14,
69 .active_low = 1,
70 }, {
71 .name = "red:heartbeat",
72 .default_trigger = "heartbeat",
73 .gpio = GPIO_PE11,
74 .active_low = 1,
75 },
76};
77
78static struct gpio_led_platform_data rsk7203_gpio_leds_info = {
79 .leds = rsk7203_gpio_leds,
80 .num_leds = ARRAY_SIZE(rsk7203_gpio_leds),
81};
82
83static struct platform_device led_device = {
84 .name = "leds-gpio",
85 .id = -1,
86 .dev = {
87 .platform_data = &rsk7203_gpio_leds_info,
88 },
89};
90
91static struct platform_device *rsk7203_devices[] __initdata = {
Steve Glendinning8ed35922009-01-07 17:22:24 +090092 &smsc911x_device,
Paul Mundtea0aac12008-12-08 14:32:03 +090093 &led_device,
94};
95
96static int __init rsk7203_devices_setup(void)
97{
98 /* Select pins for SCIF0 */
99 gpio_request(GPIO_FN_TXD0, NULL);
100 gpio_request(GPIO_FN_RXD0, NULL);
101
Magnus Damm724cfb92009-04-28 08:02:13 +0000102 /* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */
103 ctrl_outl(0x36db0400, 0xfffc0008); /* CS1BCR */
104 gpio_request(GPIO_FN_IRQ0_PB, NULL);
105
Paul Mundtea0aac12008-12-08 14:32:03 +0900106 return platform_add_devices(rsk7203_devices,
107 ARRAY_SIZE(rsk7203_devices));
108}
109device_initcall(rsk7203_devices_setup);