Add the machine definition for the Datong DTCOMMOD into mach-kirkwood. The dtcommod-setup.c file ensures the correct MPP configurations, configures and registers the devices used on the board. Signed-off-by: Ben Dooks Signed-off-by: Daniel Silverstone --- arch/arm/mach-kirkwood/Kconfig | 6 arch/arm/mach-kirkwood/Makefile | 1 arch/arm/mach-kirkwood/dtcommod-setup.c | 195 ++++++++++++++++++++++++++++++++ 3 files changed, 202 insertions(+) Index: b/arch/arm/mach-kirkwood/Kconfig =================================================================== --- a/arch/arm/mach-kirkwood/Kconfig 2010-04-06 12:20:58.000000000 +0100 +++ b/arch/arm/mach-kirkwood/Kconfig 2010-04-06 12:31:36.000000000 +0100 @@ -2,6 +2,12 @@ if ARCH_KIRKWOOD menu "Marvell Kirkwood Implementations" +config MACH_DTCOMMOD + bool "Datong communications module" + help + Say 'Y' here if you want your kernel to support the + Datong Communications Module system. + config MACH_DB88F6281_BP bool "Marvell DB-88F6281-BP Development Board" help Index: b/arch/arm/mach-kirkwood/Makefile =================================================================== --- a/arch/arm/mach-kirkwood/Makefile 2010-04-06 12:20:58.000000000 +0100 +++ b/arch/arm/mach-kirkwood/Makefile 2010-04-06 12:31:36.000000000 +0100 @@ -1,6 +1,7 @@ obj-y += common.o addr-map.o irq.o pcie.o mpp.o obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o +obj-$(CONFIG_MACH_DTCOMMOD) += dtcommod-setup.o obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o Index: b/arch/arm/mach-kirkwood/dtcommod-setup.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ b/arch/arm/mach-kirkwood/dtcommod-setup.c 2010-04-13 11:31:25.000000000 +0100 @@ -0,0 +1,195 @@ +/* dtcommod-setup.c + * + * Copyright 2010 Simtec Electronics + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include + +#include "common.h" +#include "mpp.h" + +/* ensure we have all the MPP pins setup correctly */ +static unsigned int dtcommod_mpp_config[] __initdata = { + MPP0_NF_IO2, + MPP1_NF_IO3, + MPP2_NF_IO4, + MPP3_NF_IO5, + MPP4_NF_IO6, + MPP5_NF_IO7, + MPP6_SYSRST_OUTn, + MPP7_PEX_RST_OUTn, + MPP8_TW_SDA, + MPP9_TW_SCK, + MPP10_UART0_TXD, + MPP11_UART0_RXD, + MPP12_SD_CLK, + MPP13_SD_CMD, + MPP14_SD_D0, + MPP15_SD_D1, + MPP16_SD_D2, + MPP17_SD_D3, + MPP18_NF_IO0, + MPP19_NF_IO1, + MPP20_GE1_0, + MPP21_GE1_1, + MPP22_GE1_2, + MPP23_GE1_3, + MPP24_GE1_4, + MPP25_GE1_5, + MPP26_GE1_6, + MPP27_GE1_7, + MPP28_GPIO, + MPP29_GPIO, + MPP30_GE1_10, + MPP31_GE1_11, + MPP32_GE1_12, + MPP33_GE1_13, + MPP34_GPIO, + MPP35_SATA0_ACTn, + MPP36_GPIO, /* SD power enable */ + MPP37_GPIO, /* GSM reset */ + MPP38_GPIO, /* GSM on/off */ + MPP39_GPIO, /* GSM power monitor */ + MPP40_GPIO, + MPP41_GPIO, + MPP41_GPIO, + MPP42_GPIO, + MPP43_GPIO, + MPP44_GPIO, + MPP45_GPIO, + MPP46_GPIO, + MPP47_GPIO, + MPP48_GPIO, + MPP49_GPIO, + 0 +}; + +static struct mtd_partition dtcommod_nand_parts[] = { + { + .name = "ipl", + .offset = 0, + .size = SZ_128K, + }, { + .name = "bootloader", + .offset = SZ_128K, + .size = SZ_4M - SZ_128K, + }, { + .name = "kernel", + .offset = SZ_4M, + .size = SZ_4M + SZ_8M, + }, { + .name = "config", + .offset = SZ_16M, + .size = SZ_16M, + }, { + .name = "pkgcache", + .offset = SZ_32M, + .size = SZ_512M - SZ_32M, + }, +}; + +static struct mv643xx_eth_platform_data dtcommod_ge0_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(8), +}; + +static struct mv643xx_eth_platform_data dtcommod_ge1_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(24), +}; + +static struct mv_sata_platform_data dtcommod_sata_data = { + .n_ports = 1, +}; + +static struct mvsdio_platform_data dtcommod_mvsdio_data = { + .gpio_card_detect = 29, /* MPP29 used as SD card detect */ +}; + +static struct i2c_board_info dtcommod_i2c_devs[] __initdata = { + { + I2C_BOARD_INFO("at24", 0x50), + }, { + I2C_BOARD_INFO("smb380", 0x38), + }, { + I2C_BOARD_INFO("LM95234", 0x18), + }, +}; + +#define GPIO_SDPWR (36) +#define GPIO_RNB (46) + +static int dtcommod_nand_rnb(struct mtd_info *mtd) +{ + return gpio_get_value(GPIO_RNB); +} + +static void __init dtcommod_init(void) +{ + kirkwood_init(); + kirkwood_mpp_conf(dtcommod_mpp_config); + + kirkwood_uart0_init(); + /* need to init nand, but we have RnB line */ + + kirkwood_ge00_init(&dtcommod_ge0_data); + kirkwood_ge01_init(&dtcommod_ge1_data); + kirkwood_sata_init(&dtcommod_sata_data); + kirkwood_sdio_init(&dtcommod_mvsdio_data); + + i2c_register_board_info(0, dtcommod_i2c_devs, + ARRAY_SIZE(dtcommod_i2c_devs)); + + gpio_request(GPIO_RNB, "NAND RnB"); + gpio_direction_input(GPIO_RNB); + + gpio_request(GPIO_SDPWR, "SD Power Enable"); + gpio_direction_output(GPIO_SDPWR, 0); + + kirkwood_nand_init_rnb(ARRAY_AND_SIZE(dtcommod_nand_parts), + dtcommod_nand_rnb); + + /* add the i2c bus info */ + + kirkwood_ehci_init(); + kirkwood_i2c_init(); +} + +static int __init dtcommod_pci_init(void) +{ + if (machine_is_dtcommod()) + kirkwood_pcie_init(); + + return 0; +} + +subsys_initcall(dtcommod_pci_init); + +MACHINE_START(DTCOMMOD, "Datong Communications Module") + /* Maintainers: Ben Dooks , + * Daniel Silverstone */ + .phys_io = KIRKWOOD_REGS_PHYS_BASE, + .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, + .boot_params = 0x00000100, + .init_machine = dtcommod_init, + .map_io = kirkwood_map_io, + .init_irq = kirkwood_init_irq, + .timer = &kirkwood_timer, +MACHINE_END