Paul Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 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> |
Steve Glendinning | 8ed3592 | 2009-01-07 17:22:24 +0900 | [diff] [blame] | 14 | #include <linux/smsc911x.h> |
Paul Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 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 | |
Steve Glendinning | 8ed3592 | 2009-01-07 17:22:24 +0900 | [diff] [blame] | 21 | static 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 Damm | 724cfb9 | 2009-04-28 08:02:13 +0000 | [diff] [blame] | 25 | .flags = SMSC911X_USE_32BIT | SMSC911X_SWAP_FIFO, |
Paul Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 26 | }; |
| 27 | |
Steve Glendinning | 8ed3592 | 2009-01-07 17:22:24 +0900 | [diff] [blame] | 28 | static struct resource smsc911x_resources[] = { |
Paul Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 29 | [0] = { |
| 30 | .start = 0x24000000, |
Magnus Damm | 724cfb9 | 2009-04-28 08:02:13 +0000 | [diff] [blame] | 31 | .end = 0x240000ff, |
Paul Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 32 | .flags = IORESOURCE_MEM, |
| 33 | }, |
| 34 | [1] = { |
| 35 | .start = 64, |
| 36 | .end = 64, |
| 37 | .flags = IORESOURCE_IRQ, |
| 38 | }, |
| 39 | }; |
| 40 | |
Steve Glendinning | 8ed3592 | 2009-01-07 17:22:24 +0900 | [diff] [blame] | 41 | static struct platform_device smsc911x_device = { |
| 42 | .name = "smsc911x", |
Paul Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 43 | .id = -1, |
Steve Glendinning | 8ed3592 | 2009-01-07 17:22:24 +0900 | [diff] [blame] | 44 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 45 | .resource = smsc911x_resources, |
Paul Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 46 | .dev = { |
Steve Glendinning | 8ed3592 | 2009-01-07 17:22:24 +0900 | [diff] [blame] | 47 | .platform_data = &smsc911x_config, |
Paul Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 48 | }, |
| 49 | }; |
| 50 | |
| 51 | static 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 | |
| 74 | static struct gpio_led_platform_data rsk7203_gpio_leds_info = { |
| 75 | .leds = rsk7203_gpio_leds, |
| 76 | .num_leds = ARRAY_SIZE(rsk7203_gpio_leds), |
| 77 | }; |
| 78 | |
| 79 | static struct platform_device led_device = { |
| 80 | .name = "leds-gpio", |
| 81 | .id = -1, |
| 82 | .dev = { |
| 83 | .platform_data = &rsk7203_gpio_leds_info, |
| 84 | }, |
| 85 | }; |
| 86 | |
| 87 | static struct platform_device *rsk7203_devices[] __initdata = { |
Steve Glendinning | 8ed3592 | 2009-01-07 17:22:24 +0900 | [diff] [blame] | 88 | &smsc911x_device, |
Paul Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 89 | &led_device, |
| 90 | }; |
| 91 | |
| 92 | static 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 Damm | 724cfb9 | 2009-04-28 08:02:13 +0000 | [diff] [blame] | 98 | /* 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 Mundt | ea0aac1 | 2008-12-08 14:32:03 +0900 | [diff] [blame] | 102 | return platform_add_devices(rsk7203_devices, |
| 103 | ARRAY_SIZE(rsk7203_devices)); |
| 104 | } |
| 105 | device_initcall(rsk7203_devices_setup); |