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 | { |
| 61 | .name = "plug:green:health", |
| 62 | .default_trigger = "default-on", |
| 63 | .gpio = 49, |
| 64 | .active_low = 1, |
| 65 | }, |
| 66 | }; |
| 67 | |
| 68 | static struct gpio_led_platform_data sheevaplug_led_data = { |
| 69 | .leds = sheevaplug_led_pins, |
| 70 | .num_leds = ARRAY_SIZE(sheevaplug_led_pins), |
| 71 | }; |
| 72 | |
| 73 | static struct platform_device sheevaplug_leds = { |
| 74 | .name = "leds-gpio", |
| 75 | .id = -1, |
| 76 | .dev = { |
| 77 | .platform_data = &sheevaplug_led_data, |
| 78 | } |
| 79 | }; |
| 80 | |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 81 | static unsigned int sheevaplug_mpp_config[] __initdata = { |
| 82 | MPP29_GPIO, /* USB Power Enable */ |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 83 | MPP49_GPIO, /* LED */ |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 84 | 0 |
| 85 | }; |
| 86 | |
John Holland | d5b5746 | 2010-02-19 23:11:04 +0100 | [diff] [blame] | 87 | static unsigned int sheeva_esata_mpp_config[] __initdata = { |
| 88 | MPP29_GPIO, /* USB Power Enable */ |
| 89 | MPP44_GPIO, /* SD Write Protect */ |
| 90 | MPP47_GPIO, /* SD Card Detect */ |
| 91 | MPP49_GPIO, /* LED Green */ |
| 92 | 0 |
| 93 | }; |
| 94 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 95 | static void __init sheevaplug_init(void) |
| 96 | { |
| 97 | /* |
| 98 | * Basic setup. Needs to be called early. |
| 99 | */ |
| 100 | kirkwood_init(); |
John Holland | d5b5746 | 2010-02-19 23:11:04 +0100 | [diff] [blame] | 101 | |
| 102 | /* setup gpio pin select */ |
| 103 | if (machine_is_sheeva_esata()) |
| 104 | kirkwood_mpp_conf(sheeva_esata_mpp_config); |
| 105 | else |
| 106 | kirkwood_mpp_conf(sheevaplug_mpp_config); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 107 | |
| 108 | kirkwood_uart0_init(); |
Nicolas Pitre | fb7b2d3 | 2009-06-01 15:36:36 -0400 | [diff] [blame] | 109 | kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 110 | |
| 111 | if (gpio_request(29, "USB Power Enable") != 0 || |
| 112 | gpio_direction_output(29, 1) != 0) |
| 113 | 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] | 114 | kirkwood_ehci_init(); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 115 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 116 | kirkwood_ge00_init(&sheevaplug_ge00_data); |
John Holland | d7b222d | 2010-02-19 23:11:01 +0100 | [diff] [blame] | 117 | |
| 118 | /* honor lower power consumption for plugs with out eSATA */ |
| 119 | if (machine_is_sheeva_esata()) |
| 120 | kirkwood_sata_init(&sheeva_esata_sata_data); |
| 121 | |
John Holland | d5b5746 | 2010-02-19 23:11:04 +0100 | [diff] [blame] | 122 | /* enable sd wp and sd cd on plugs with esata */ |
| 123 | if (machine_is_sheeva_esata()) |
| 124 | kirkwood_sdio_init(&sheeva_esata_mvsdio_data); |
| 125 | else |
| 126 | kirkwood_sdio_init(&sheevaplug_mvsdio_data); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 127 | |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 128 | platform_device_register(&sheevaplug_leds); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 129 | } |
| 130 | |
John Holland | d8ecb34 | 2010-02-19 23:10:58 +0100 | [diff] [blame] | 131 | #ifdef CONFIG_MACH_SHEEVAPLUG |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 132 | MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board") |
| 133 | /* Maintainer: shadi Ammouri <shadi@marvell.com> */ |
| 134 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, |
| 135 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, |
| 136 | .boot_params = 0x00000100, |
| 137 | .init_machine = sheevaplug_init, |
| 138 | .map_io = kirkwood_map_io, |
| 139 | .init_irq = kirkwood_init_irq, |
| 140 | .timer = &kirkwood_timer, |
| 141 | MACHINE_END |
John Holland | d8ecb34 | 2010-02-19 23:10:58 +0100 | [diff] [blame] | 142 | #endif |
| 143 | |
| 144 | #ifdef CONFIG_MACH_ESATA_SHEEVAPLUG |
| 145 | MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board") |
| 146 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, |
| 147 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, |
| 148 | .boot_params = 0x00000100, |
| 149 | .init_machine = sheevaplug_init, |
| 150 | .map_io = kirkwood_map_io, |
| 151 | .init_irq = kirkwood_init_irq, |
| 152 | .timer = &kirkwood_timer, |
| 153 | MACHINE_END |
| 154 | #endif |