[ARM] Kirkwood: SheevaPlug USB Power Enable setup
[pandora-kernel.git] / arch / arm / mach-kirkwood / sheevaplug-setup.c
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>
17 #include <linux/gpio.h>
18 #include <asm/mach-types.h>
19 #include <asm/mach/arch.h>
20 #include <mach/kirkwood.h>
21 #include <plat/mvsdio.h>
22 #include <plat/orion_nand.h>
23 #include "common.h"
24 #include "mpp.h"
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
42 static struct resource sheevaplug_nand_resource = {
43         .flags          = IORESOURCE_MEM,
44         .start          = KIRKWOOD_NAND_MEM_PHYS_BASE,
45         .end            = KIRKWOOD_NAND_MEM_PHYS_BASE +
46                           KIRKWOOD_NAND_MEM_SIZE - 1,
47 };
48
49 static struct orion_nand_data sheevaplug_nand_data = {
50         .parts          = sheevaplug_nand_parts,
51         .nr_parts       = ARRAY_SIZE(sheevaplug_nand_parts),
52         .cle            = 0,
53         .ale            = 1,
54         .width          = 8,
55         .chip_delay     = 25,
56 };
57
58 static struct platform_device sheevaplug_nand_flash = {
59         .name           = "orion_nand",
60         .id             = -1,
61         .dev            = {
62                 .platform_data  = &sheevaplug_nand_data,
63         },
64         .resource       = &sheevaplug_nand_resource,
65         .num_resources  = 1,
66 };
67
68 static struct mv643xx_eth_platform_data sheevaplug_ge00_data = {
69         .phy_addr       = MV643XX_ETH_PHY_ADDR(0),
70 };
71
72 static struct mvsdio_platform_data sheevaplug_mvsdio_data = {
73         // unfortunately the CD signal has not been connected */
74 };
75
76 static unsigned int sheevaplug_mpp_config[] __initdata = {
77         MPP29_GPIO,     /* USB Power Enable */
78         0
79 };
80
81 static void __init sheevaplug_init(void)
82 {
83         /*
84          * Basic setup. Needs to be called early.
85          */
86         kirkwood_init();
87         kirkwood_mpp_conf(sheevaplug_mpp_config);
88
89         kirkwood_uart0_init();
90
91         if (gpio_request(29, "USB Power Enable") != 0 ||
92             gpio_direction_output(29, 1) != 0)
93                 printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
94         kirkwood_ehci_init();
95
96         kirkwood_ge00_init(&sheevaplug_ge00_data);
97         kirkwood_sdio_init(&sheevaplug_mvsdio_data);
98
99         platform_device_register(&sheevaplug_nand_flash);
100 }
101
102 MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
103         /* Maintainer: shadi Ammouri <shadi@marvell.com> */
104         .phys_io        = KIRKWOOD_REGS_PHYS_BASE,
105         .io_pg_offst    = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
106         .boot_params    = 0x00000100,
107         .init_machine   = sheevaplug_init,
108         .map_io         = kirkwood_map_io,
109         .init_irq       = kirkwood_init_irq,
110         .timer          = &kirkwood_timer,
111 MACHINE_END