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