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> |
| 14 | #include <linux/mtd/nand.h> |
| 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> |
| 23 | #include <plat/orion_nand.h> |
| 24 | #include "common.h" |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 25 | #include "mpp.h" |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 26 | |
| 27 | static struct mtd_partition sheevaplug_nand_parts[] = { |
| 28 | { |
| 29 | .name = "u-boot", |
| 30 | .offset = 0, |
| 31 | .size = SZ_1M |
| 32 | }, { |
| 33 | .name = "uImage", |
| 34 | .offset = MTDPART_OFS_NXTBLK, |
| 35 | .size = SZ_4M |
| 36 | }, { |
| 37 | .name = "root", |
| 38 | .offset = MTDPART_OFS_NXTBLK, |
| 39 | .size = MTDPART_SIZ_FULL |
| 40 | }, |
| 41 | }; |
| 42 | |
| 43 | static struct resource sheevaplug_nand_resource = { |
| 44 | .flags = IORESOURCE_MEM, |
| 45 | .start = KIRKWOOD_NAND_MEM_PHYS_BASE, |
| 46 | .end = KIRKWOOD_NAND_MEM_PHYS_BASE + |
| 47 | KIRKWOOD_NAND_MEM_SIZE - 1, |
| 48 | }; |
| 49 | |
| 50 | static struct orion_nand_data sheevaplug_nand_data = { |
| 51 | .parts = sheevaplug_nand_parts, |
| 52 | .nr_parts = ARRAY_SIZE(sheevaplug_nand_parts), |
| 53 | .cle = 0, |
| 54 | .ale = 1, |
| 55 | .width = 8, |
| 56 | .chip_delay = 25, |
| 57 | }; |
| 58 | |
| 59 | static struct platform_device sheevaplug_nand_flash = { |
| 60 | .name = "orion_nand", |
| 61 | .id = -1, |
| 62 | .dev = { |
| 63 | .platform_data = &sheevaplug_nand_data, |
| 64 | }, |
| 65 | .resource = &sheevaplug_nand_resource, |
| 66 | .num_resources = 1, |
| 67 | }; |
| 68 | |
| 69 | static struct mv643xx_eth_platform_data sheevaplug_ge00_data = { |
| 70 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), |
| 71 | }; |
| 72 | |
| 73 | static struct mvsdio_platform_data sheevaplug_mvsdio_data = { |
| 74 | // unfortunately the CD signal has not been connected */ |
| 75 | }; |
| 76 | |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 77 | static struct gpio_led sheevaplug_led_pins[] = { |
| 78 | { |
| 79 | .name = "plug:green:health", |
| 80 | .default_trigger = "default-on", |
| 81 | .gpio = 49, |
| 82 | .active_low = 1, |
| 83 | }, |
| 84 | }; |
| 85 | |
| 86 | static struct gpio_led_platform_data sheevaplug_led_data = { |
| 87 | .leds = sheevaplug_led_pins, |
| 88 | .num_leds = ARRAY_SIZE(sheevaplug_led_pins), |
| 89 | }; |
| 90 | |
| 91 | static struct platform_device sheevaplug_leds = { |
| 92 | .name = "leds-gpio", |
| 93 | .id = -1, |
| 94 | .dev = { |
| 95 | .platform_data = &sheevaplug_led_data, |
| 96 | } |
| 97 | }; |
| 98 | |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 99 | static unsigned int sheevaplug_mpp_config[] __initdata = { |
| 100 | MPP29_GPIO, /* USB Power Enable */ |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 101 | MPP49_GPIO, /* LED */ |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 102 | 0 |
| 103 | }; |
| 104 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 105 | static void __init sheevaplug_init(void) |
| 106 | { |
| 107 | /* |
| 108 | * Basic setup. Needs to be called early. |
| 109 | */ |
| 110 | kirkwood_init(); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 111 | kirkwood_mpp_conf(sheevaplug_mpp_config); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 112 | |
| 113 | kirkwood_uart0_init(); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 114 | |
| 115 | if (gpio_request(29, "USB Power Enable") != 0 || |
| 116 | gpio_direction_output(29, 1) != 0) |
| 117 | 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] | 118 | kirkwood_ehci_init(); |
Nicolas Pitre | 3ec0d47 | 2009-03-02 23:44:41 -0500 | [diff] [blame] | 119 | |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 120 | kirkwood_ge00_init(&sheevaplug_ge00_data); |
| 121 | kirkwood_sdio_init(&sheevaplug_mvsdio_data); |
| 122 | |
| 123 | platform_device_register(&sheevaplug_nand_flash); |
Nicolas Pitre | e96c33d | 2009-03-03 01:16:07 -0500 | [diff] [blame] | 124 | platform_device_register(&sheevaplug_leds); |
Shadi Ammouri | 4640fa6 | 2009-02-24 15:26:23 -0500 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board") |
| 128 | /* Maintainer: shadi Ammouri <shadi@marvell.com> */ |
| 129 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, |
| 130 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, |
| 131 | .boot_params = 0x00000100, |
| 132 | .init_machine = sheevaplug_init, |
| 133 | .map_io = kirkwood_map_io, |
| 134 | .init_irq = kirkwood_init_irq, |
| 135 | .timer = &kirkwood_timer, |
| 136 | MACHINE_END |