From 835d2328809644eaedc05e9fb01bc68a3ff17ebb Mon Sep 17 00:00:00 2001 From: Erik Gilling Date: Mon, 15 Mar 2010 20:40:51 -0700 Subject: [ARM] tegra: add platform devices to harmony board file Signed-off-by: Erik Gilling --- arch/arm/mach-tegra/board-harmony-sdhci.c | 6 +- arch/arm/mach-tegra/board-harmony.c | 208 ++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-tegra/board-harmony-sdhci.c b/arch/arm/mach-tegra/board-harmony-sdhci.c index 66907a605361..7ad3715b551f 100644 --- a/arch/arm/mach-tegra/board-harmony-sdhci.c +++ b/arch/arm/mach-tegra/board-harmony-sdhci.c @@ -17,14 +17,16 @@ #include #include #include +#include + #include -#include #include #include #include -#include #include +#include "gpio-names.h" + /*static struct resource sdhci_resource1[] = { [0] = { .start = INT_SDMMC1, diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c index 846cd7d69e3e..47878bbd499f 100644 --- a/arch/arm/mach-tegra/board-harmony.c +++ b/arch/arm/mach-tegra/board-harmony.c @@ -20,7 +20,10 @@ #include #include #include +#include +#include #include +#include #include #include #include @@ -37,6 +40,9 @@ #include #include #include +#include + +#include #include "board.h" #include "board-harmony.h" @@ -44,6 +50,120 @@ #include "devices.h" #include "gpio-names.h" +static struct tegra_nand_chip_parms nand_chip_parms[] = { + /* Samsung K5E2G1GACM */ + [0] = { + .vendor_id = 0xEC, + .device_id = 0xAA, + .capacity = 256, + .timing = { + .trp = 21, + .trh = 15, + .twp = 21, + .twh = 15, + .tcs = 31, + .twhr = 60, + .tcr_tar_trr = 20, + .twb = 100, + .trp_resp = 30, + .tadl = 100, + }, + }, + /* Hynix H5PS1GB3EFR */ + [1] = { + .vendor_id = 0xAD, + .device_id = 0xDC, + .capacity = 512, + .timing = { + .trp = 12, + .trh = 10, + .twp = 12, + .twh = 10, + .tcs = 20, + .twhr = 80, + .tcr_tar_trr = 20, + .twb = 100, + .trp_resp = 20, + .tadl = 70, + }, + }, +}; + +/* Current layout is: + * + * BCT @ 0 (0x300000) -- boot config table + * PT @ 0x300000 (0x1000) -- partition table + * EBT @ 0x301000 (0x100000) -- bootloader + * BMP @ 0x401000 (0x148c) -- rgb565 bitmap + * WAV @ 0x40248c (0x2a000) -- wav audio clip + * ARG @ 0x42c48c (0x800) -- ?? + * DRM @ 0x42cc8c (0x19000) -- bleh? + * UIP @ 0x445c8c (0x800) -- update information partition + * USP @ 0x44648c (0x600000) -- update staging partition + * USR @ 0xa4648c (THE REST) -- + * + * What we will do is we will actually just skip the first 16MB, and just + * mark it as vendor, and then layout our partitions. + * + * so: + * + * + */ +static struct mtd_partition harmony_nand_partitions[] = { + [0] = { + .name = "recovery", + .offset = 0x1b80*0x800, + .size = 0xa00*0x800, + .mask_flags = MTD_WRITEABLE, /* r/o */ + }, + [1] = { + .name = "boot", + .offset = 0x2680*0x800, + .size = 0x1000*0x800, + }, + [2] = { + .name = "system", + .offset = 0x3780*0x800, + .size = 0xef40*0x800, + }, + [3] = { + .name = "cache", + .offset = 0x127c0*0x800, + .size = 0x4000*0x800, + }, + [4] = { + .name = "userdata", + .offset = 0x168c0*0x800, + .size = 0x29640*0x800, + }, +}; + +struct tegra_nand_platform harmony_nand_data = { + .max_chips = 8, + .chip_parms = nand_chip_parms, + .nr_chip_parms = ARRAY_SIZE(nand_chip_parms), + .parts = harmony_nand_partitions, + .nr_parts = ARRAY_SIZE(harmony_nand_partitions), +}; + +static struct resource resources_nand[] = { + [0] = { + .start = INT_NANDFLASH, + .end = INT_NANDFLASH, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device tegra_nand_device = { + .name = "tegra_nand", + .id = -1, + .num_resources = ARRAY_SIZE(resources_nand), + .resource = resources_nand, + .dev = { + .platform_data = &harmony_nand_data, + }, +}; + static struct plat_serial8250_port debug_uart_platform_data[] = { { .membase = IO_ADDRESS(TEGRA_UARTD_BASE), @@ -112,6 +232,90 @@ static void __init harmony_i2c_init(void) i2c_register_board_info(0, &wm8903_board_info, 1); } +/* OTG gadget device */ +static u64 tegra_otg_dmamask = DMA_BIT_MASK(32); + + +static struct resource tegra_otg_resources[] = { + [0] = { + .start = TEGRA_USB_BASE, + .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = INT_USB, + .end = INT_USB, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct fsl_usb2_platform_data tegra_otg_pdata = { + .operating_mode = FSL_USB2_DR_DEVICE, + .phy_mode = FSL_USB2_PHY_UTMI, +}; + +struct platform_device tegra_otg = { + .name = "fsl-tegra-udc", + .id = -1, + .dev = { + .dma_mask = &tegra_otg_dmamask, + .coherent_dma_mask = 0xffffffff, + .platform_data = &tegra_otg_pdata, + }, + .resource = tegra_otg_resources, + .num_resources = ARRAY_SIZE(tegra_otg_resources), +}; + +static char *usb_functions[] = { "usb_mass_storage" }; +static char *usb_functions_adb[] = { "usb_mass_storage", "adb" }; + +static struct android_usb_product usb_products[] = { + { + .product_id = 0xDEAD, + .num_functions = ARRAY_SIZE(usb_functions), + .functions = usb_functions, + }, + { + .product_id = 0xBEEF, + .num_functions = ARRAY_SIZE(usb_functions_adb), + .functions = usb_functions_adb, + }, +}; + +/* standard android USB platform data */ +static struct android_usb_platform_data andusb_plat = { + .vendor_id = 0x18d1, + .product_id = 0x0002, + .manufacturer_name = "Google", + .product_name = "Harmony!", + .serial_number = "0000", + .num_products = ARRAY_SIZE(usb_products), + .products = usb_products, + .num_functions = ARRAY_SIZE(usb_functions_adb), + .functions = usb_functions_adb, +}; + + +static struct platform_device androidusb_device = { + .name = "android_usb", + .id = -1, + .dev = { + .platform_data = &andusb_plat, + }, +}; + +/* PDA power */ +static struct pda_power_pdata pda_power_pdata = { +}; + +static struct platform_device pda_power_device = { + .name = "pda_power", + .id = -1, + .dev = { + .platform_data = &pda_power_pdata, + }, +}; + static struct platform_device *harmony_devices[] __initdata = { &debug_uart, &tegra_sdhci_device1, @@ -121,6 +325,10 @@ static struct platform_device *harmony_devices[] __initdata = { &tegra_das_device, &tegra_pcm_device, &harmony_audio_device, + &tegra_nand_device, + &tegra_otg, + &androidusb_device, + &pda_power_device, }; static void __init tegra_harmony_fixup(struct machine_desc *desc, -- cgit v1.2.3