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> |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 14 | #include <linux/mtd/partitions.h> |
| 15 | #include <linux/mv643xx_eth.h> |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 16 | #include <linux/gpio.h> |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 17 | #include <linux/leds.h> |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 18 | #include <asm/mach-types.h> |
| 19 | #include <asm/mach/arch.h> |
| 20 | #include <mach/kirkwood.h> |
| 21 | #include <plat/mvsdio.h> |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 22 | #include "common.h" |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 23 | #include "mpp.h" |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 24 | |
| 25 | static struct mtd_partition sheevaplug_nand_parts[] = { |
| 26 | { |
| 27 | .name = "u-boot", |
| 28 | .offset = 0, |
| 29 | .size = SZ_1M |
| 30 | }, { |
| 31 | .name = "uImage", |
| 32 | .offset = MTDPART_OFS_NXTBLK, |
| 33 | .size = SZ_4M |
| 34 | }, { |
| 35 | .name = "root", |
| 36 | .offset = MTDPART_OFS_NXTBLK, |
| 37 | .size = MTDPART_SIZ_FULL |
| 38 | }, |
| 39 | }; |
| 40 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 41 | static struct mv643xx_eth_platform_data sheevaplug_ge00_data = { |
| 42 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), |
| 43 | }; |
| 44 | |
| 45 | static struct mvsdio_platform_data sheevaplug_mvsdio_data = { |
Nicolas Pitre | f14081e | 2009-05-29 22:29:01 -0400 | [diff] [blame] | 46 | /* unfortunately the CD signal has not been connected */ |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 47 | }; |
| 48 | |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 49 | static struct gpio_led sheevaplug_led_pins[] = { |
| 50 | { |
| 51 | .name = "plug:green:health", |
| 52 | .default_trigger = "default-on", |
| 53 | .gpio = 49, |
| 54 | .active_low = 1, |
| 55 | }, |
| 56 | }; |
| 57 | |
| 58 | static struct gpio_led_platform_data sheevaplug_led_data = { |
| 59 | .leds = sheevaplug_led_pins, |
| 60 | .num_leds = ARRAY_SIZE(sheevaplug_led_pins), |
| 61 | }; |
| 62 | |
| 63 | static struct platform_device sheevaplug_leds = { |
| 64 | .name = "leds-gpio", |
| 65 | .id = -1, |
| 66 | .dev = { |
| 67 | .platform_data = &sheevaplug_led_data, |
| 68 | } |
| 69 | }; |
| 70 | |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 71 | static unsigned int sheevaplug_mpp_config[] __initdata = { |
| 72 | MPP29_GPIO, /* USB Power Enable */ |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 73 | MPP49_GPIO, /* LED */ |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 74 | 0 |
| 75 | }; |
| 76 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 77 | static void __init sheevaplug_init(void) |
| 78 | { |
| 79 | /* |
| 80 | * Basic setup. Needs to be called early. |
| 81 | */ |
| 82 | kirkwood_init(); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 83 | kirkwood_mpp_conf(sheevaplug_mpp_config); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 84 | |
| 85 | kirkwood_uart0_init(); |
Nicolas Pitre | fb7b2d3 | 2009-06-01 15:36:36 -0400 | [diff] [blame^] | 86 | kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 87 | |
| 88 | if (gpio_request(29, "USB Power Enable") != 0 || |
| 89 | gpio_direction_output(29, 1) != 0) |
| 90 | 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] | 91 | kirkwood_ehci_init(); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 92 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 93 | kirkwood_ge00_init(&sheevaplug_ge00_data); |
| 94 | kirkwood_sdio_init(&sheevaplug_mvsdio_data); |
| 95 | |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 96 | platform_device_register(&sheevaplug_leds); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board") |
| 100 | /* Maintainer: shadi Ammouri <shadi@marvell.com> */ |
| 101 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, |
| 102 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, |
| 103 | .boot_params = 0x00000100, |
| 104 | .init_machine = sheevaplug_init, |
| 105 | .map_io = kirkwood_map_io, |
| 106 | .init_irq = kirkwood_init_irq, |
| 107 | .timer = &kirkwood_timer, |
| 108 | MACHINE_END |