Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-kirkwood/sheevaplug-setup.c |
| 3 | * |
| 4 | * Marvell SheevaPlug Reference Board Setup |
| 5 | * |
| 6 | * This file is licensed under the terms of the GNU General Public |
| 7 | * License version 2. This program is licensed "as is" without any |
| 8 | * warranty of any kind, whether express or implied. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> |
John Holland | d7b222d | 2010-02-19 23:11:01 +0100 | [diff] [blame] | 14 | #include <linux/ata_platform.h> |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 15 | #include <linux/mtd/partitions.h> |
| 16 | #include <linux/mv643xx_eth.h> |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 17 | #include <linux/gpio.h> |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 18 | #include <linux/leds.h> |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 19 | #include <asm/mach-types.h> |
| 20 | #include <asm/mach/arch.h> |
| 21 | #include <mach/kirkwood.h> |
| 22 | #include <plat/mvsdio.h> |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 23 | #include "common.h" |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 24 | #include "mpp.h" |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 25 | |
| 26 | static struct mtd_partition sheevaplug_nand_parts[] = { |
| 27 | { |
| 28 | .name = "u-boot", |
| 29 | .offset = 0, |
| 30 | .size = SZ_1M |
| 31 | }, { |
| 32 | .name = "uImage", |
| 33 | .offset = MTDPART_OFS_NXTBLK, |
| 34 | .size = SZ_4M |
| 35 | }, { |
| 36 | .name = "root", |
| 37 | .offset = MTDPART_OFS_NXTBLK, |
| 38 | .size = MTDPART_SIZ_FULL |
| 39 | }, |
| 40 | }; |
| 41 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 42 | static struct mv643xx_eth_platform_data sheevaplug_ge00_data = { |
| 43 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), |
| 44 | }; |
| 45 | |
John Holland | d7b222d | 2010-02-19 23:11:01 +0100 | [diff] [blame] | 46 | static struct mv_sata_platform_data sheeva_esata_sata_data = { |
| 47 | .n_ports = 2, |
| 48 | }; |
| 49 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 50 | static struct mvsdio_platform_data sheevaplug_mvsdio_data = { |
Nicolas Pitre | f14081e | 2009-05-29 22:29:01 -0400 | [diff] [blame] | 51 | /* unfortunately the CD signal has not been connected */ |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 52 | }; |
| 53 | |
John Holland | d5b5746 | 2010-02-19 23:11:04 +0100 | [diff] [blame] | 54 | static struct mvsdio_platform_data sheeva_esata_mvsdio_data = { |
| 55 | .gpio_write_protect = 44, /* MPP44 used as SD write protect */ |
| 56 | .gpio_card_detect = 47, /* MPP47 used as SD card detect */ |
| 57 | }; |
| 58 | |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 59 | static struct gpio_led sheevaplug_led_pins[] = { |
| 60 | { |
Robin Becker | 7780c80 | 2011-03-12 15:32:45 +0000 | [diff] [blame] | 61 | .name = "plug:red:misc", |
| 62 | .default_trigger = "none", |
| 63 | .gpio = 46, |
| 64 | .active_low = 1, |
| 65 | }, |
| 66 | { |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 67 | .name = "plug:green:health", |
| 68 | .default_trigger = "default-on", |
| 69 | .gpio = 49, |
| 70 | .active_low = 1, |
| 71 | }, |
| 72 | }; |
| 73 | |
| 74 | static struct gpio_led_platform_data sheevaplug_led_data = { |
| 75 | .leds = sheevaplug_led_pins, |
| 76 | .num_leds = ARRAY_SIZE(sheevaplug_led_pins), |
| 77 | }; |
| 78 | |
| 79 | static struct platform_device sheevaplug_leds = { |
| 80 | .name = "leds-gpio", |
| 81 | .id = -1, |
| 82 | .dev = { |
| 83 | .platform_data = &sheevaplug_led_data, |
| 84 | } |
| 85 | }; |
| 86 | |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 87 | static unsigned int sheevaplug_mpp_config[] __initdata = { |
| 88 | MPP29_GPIO, /* USB Power Enable */ |
Robin Becker | 7780c80 | 2011-03-12 15:32:45 +0000 | [diff] [blame] | 89 | MPP46_GPIO, /* LED Red */ |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 90 | MPP49_GPIO, /* LED */ |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 91 | 0 |
| 92 | }; |
| 93 | |
John Holland | d5b5746 | 2010-02-19 23:11:04 +0100 | [diff] [blame] | 94 | static unsigned int sheeva_esata_mpp_config[] __initdata = { |
| 95 | MPP29_GPIO, /* USB Power Enable */ |
| 96 | MPP44_GPIO, /* SD Write Protect */ |
| 97 | MPP47_GPIO, /* SD Card Detect */ |
| 98 | MPP49_GPIO, /* LED Green */ |
| 99 | 0 |
| 100 | }; |
| 101 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 102 | static void __init sheevaplug_init(void) |
| 103 | { |
| 104 | /* |
| 105 | * Basic setup. Needs to be called early. |
| 106 | */ |
| 107 | kirkwood_init(); |
John Holland | d5b5746 | 2010-02-19 23:11:04 +0100 | [diff] [blame] | 108 | |
| 109 | /* setup gpio pin select */ |
| 110 | if (machine_is_sheeva_esata()) |
| 111 | kirkwood_mpp_conf(sheeva_esata_mpp_config); |
| 112 | else |
| 113 | kirkwood_mpp_conf(sheevaplug_mpp_config); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 114 | |
| 115 | kirkwood_uart0_init(); |
Nicolas Pitre | fb7b2d3 | 2009-06-01 15:36:36 -0400 | [diff] [blame] | 116 | kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 117 | |
| 118 | if (gpio_request(29, "USB Power Enable") != 0 || |
| 119 | gpio_direction_output(29, 1) != 0) |
| 120 | printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n"); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 121 | kirkwood_ehci_init(); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 122 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 123 | kirkwood_ge00_init(&sheevaplug_ge00_data); |
John Holland | d7b222d | 2010-02-19 23:11:01 +0100 | [diff] [blame] | 124 | |
| 125 | /* honor lower power consumption for plugs with out eSATA */ |
| 126 | if (machine_is_sheeva_esata()) |
| 127 | kirkwood_sata_init(&sheeva_esata_sata_data); |
| 128 | |
John Holland | d5b5746 | 2010-02-19 23:11:04 +0100 | [diff] [blame] | 129 | /* enable sd wp and sd cd on plugs with esata */ |
| 130 | if (machine_is_sheeva_esata()) |
| 131 | kirkwood_sdio_init(&sheeva_esata_mvsdio_data); |
| 132 | else |
| 133 | kirkwood_sdio_init(&sheevaplug_mvsdio_data); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 134 | |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 135 | platform_device_register(&sheevaplug_leds); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 136 | } |
| 137 | |
John Holland | d8ecb34 | 2010-02-19 23:10:58 +0100 | [diff] [blame] | 138 | #ifdef CONFIG_MACH_SHEEVAPLUG |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 139 | MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board") |
| 140 | /* Maintainer: shadi Ammouri <shadi@marvell.com> */ |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 141 | .boot_params = 0x00000100, |
| 142 | .init_machine = sheevaplug_init, |
| 143 | .map_io = kirkwood_map_io, |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 144 | .init_early = kirkwood_init_early, |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 145 | .init_irq = kirkwood_init_irq, |
| 146 | .timer = &kirkwood_timer, |
| 147 | MACHINE_END |
John Holland | d8ecb34 | 2010-02-19 23:10:58 +0100 | [diff] [blame] | 148 | #endif |
| 149 | |
| 150 | #ifdef CONFIG_MACH_ESATA_SHEEVAPLUG |
| 151 | MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board") |
John Holland | d8ecb34 | 2010-02-19 23:10:58 +0100 | [diff] [blame] | 152 | .boot_params = 0x00000100, |
| 153 | .init_machine = sheevaplug_init, |
| 154 | .map_io = kirkwood_map_io, |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 155 | .init_early = kirkwood_init_early, |
John Holland | d8ecb34 | 2010-02-19 23:10:58 +0100 | [diff] [blame] | 156 | .init_irq = kirkwood_init_irq, |
| 157 | .timer = &kirkwood_timer, |
| 158 | MACHINE_END |
| 159 | #endif |