Alexander Clouter | b2fdb56 | 2010-01-18 23:38:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-kirkwood/openrd-setup.c |
| 3 | * |
| 4 | * Marvell OpenRD (Base|Client) 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/ata_platform.h> |
| 17 | #include <linux/mv643xx_eth.h> |
apatard@mandriva.com | 492e2bf | 2010-05-31 13:49:13 +0200 | [diff] [blame^] | 18 | #include <linux/i2c.h> |
Alexander Clouter | b2fdb56 | 2010-01-18 23:38:19 +0000 | [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 "common.h" |
| 24 | #include "mpp.h" |
| 25 | |
| 26 | static struct mtd_partition openrd_nand_parts[] = { |
| 27 | { |
| 28 | .name = "u-boot", |
| 29 | .offset = 0, |
| 30 | .size = SZ_1M, |
| 31 | .mask_flags = MTD_WRITEABLE |
| 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 mv643xx_eth_platform_data openrd_ge00_data = { |
| 44 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), |
| 45 | }; |
| 46 | |
| 47 | static struct mv643xx_eth_platform_data openrd_ge01_data = { |
| 48 | .phy_addr = MV643XX_ETH_PHY_ADDR(24), |
| 49 | }; |
| 50 | |
| 51 | static struct mv_sata_platform_data openrd_sata_data = { |
| 52 | .n_ports = 2, |
| 53 | }; |
| 54 | |
| 55 | static struct mvsdio_platform_data openrd_mvsdio_data = { |
| 56 | .gpio_card_detect = 29, /* MPP29 used as SD card detect */ |
| 57 | }; |
| 58 | |
| 59 | static unsigned int openrd_mpp_config[] __initdata = { |
| 60 | MPP29_GPIO, |
| 61 | 0 |
| 62 | }; |
| 63 | |
apatard@mandriva.com | 492e2bf | 2010-05-31 13:49:13 +0200 | [diff] [blame^] | 64 | static struct i2c_board_info i2c_board_info[] __initdata = { |
| 65 | { |
| 66 | I2C_BOARD_INFO("cs42l51", 0x4a), |
| 67 | }, |
| 68 | }; |
| 69 | |
Alexander Clouter | b2fdb56 | 2010-01-18 23:38:19 +0000 | [diff] [blame] | 70 | static void __init openrd_init(void) |
| 71 | { |
| 72 | /* |
| 73 | * Basic setup. Needs to be called early. |
| 74 | */ |
| 75 | kirkwood_init(); |
| 76 | kirkwood_mpp_conf(openrd_mpp_config); |
| 77 | |
| 78 | kirkwood_uart0_init(); |
| 79 | kirkwood_nand_init(ARRAY_AND_SIZE(openrd_nand_parts), 25); |
| 80 | |
| 81 | kirkwood_ehci_init(); |
| 82 | |
| 83 | kirkwood_ge00_init(&openrd_ge00_data); |
| 84 | if (machine_is_openrd_client()) |
| 85 | kirkwood_ge01_init(&openrd_ge01_data); |
| 86 | kirkwood_sata_init(&openrd_sata_data); |
| 87 | kirkwood_sdio_init(&openrd_mvsdio_data); |
| 88 | |
| 89 | kirkwood_i2c_init(); |
apatard@mandriva.com | 492e2bf | 2010-05-31 13:49:13 +0200 | [diff] [blame^] | 90 | |
| 91 | if (machine_is_openrd_client()) { |
| 92 | i2c_register_board_info(0, i2c_board_info, |
| 93 | ARRAY_SIZE(i2c_board_info)); |
| 94 | kirkwood_audio_init(); |
| 95 | } |
Alexander Clouter | b2fdb56 | 2010-01-18 23:38:19 +0000 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | static int __init openrd_pci_init(void) |
| 99 | { |
| 100 | if (machine_is_openrd_base() || machine_is_openrd_client()) |
| 101 | kirkwood_pcie_init(); |
| 102 | |
| 103 | return 0; |
| 104 | } |
| 105 | subsys_initcall(openrd_pci_init); |
| 106 | |
| 107 | #ifdef CONFIG_MACH_OPENRD_BASE |
| 108 | MACHINE_START(OPENRD_BASE, "Marvell OpenRD Base Board") |
| 109 | /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */ |
| 110 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, |
| 111 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, |
| 112 | .boot_params = 0x00000100, |
| 113 | .init_machine = openrd_init, |
| 114 | .map_io = kirkwood_map_io, |
| 115 | .init_irq = kirkwood_init_irq, |
| 116 | .timer = &kirkwood_timer, |
| 117 | MACHINE_END |
| 118 | #endif |
| 119 | |
| 120 | #ifdef CONFIG_MACH_OPENRD_CLIENT |
| 121 | MACHINE_START(OPENRD_CLIENT, "Marvell OpenRD Client Board") |
| 122 | /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */ |
| 123 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, |
| 124 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, |
| 125 | .boot_params = 0x00000100, |
| 126 | .init_machine = openrd_init, |
| 127 | .map_io = kirkwood_map_io, |
| 128 | .init_irq = kirkwood_init_irq, |
| 129 | .timer = &kirkwood_timer, |
| 130 | MACHINE_END |
| 131 | #endif |