[ARM] tegra: add platform devices to harmony board file
authorErik Gilling <konkers@android.com>
Tue, 16 Mar 2010 03:40:51 +0000 (20:40 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:26:38 +0000 (16:26 -0700)
Signed-off-by: Erik Gilling <konkers@android.com>
arch/arm/mach-tegra/board-harmony-sdhci.c
arch/arm/mach-tegra/board-harmony.c

index 66907a605361d7ae12cd9a3db458edebed21cb0f..7ad3715b551fd4afcefdf493107f8c43e2c5ca73 100644 (file)
 #include <linux/resource.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
+#include <linux/gpio.h>
+
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <mach/irqs.h>
 #include <mach/iomap.h>
 #include <mach/sdhci.h>
-#include <mach/gpio-names.h>
 #include <mach/pinmux.h>
 
+#include "gpio-names.h"
+
 /*static struct resource sdhci_resource1[] = {
        [0] = {
                .start  = INT_SDMMC1,
index 9e305de56be9ac28ab023dbfc4f748c5f260bec1..116b42fd169c588bc85d46ee101b27cebac09d69 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/serial_8250.h>
 #include <linux/clk.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 #include <linux/dma-mapping.h>
+#include <linux/fsl_devices.h>
 #include <linux/pda_power.h>
 #include <linux/io.h>
 
@@ -30,6 +33,9 @@
 
 #include <mach/iomap.h>
 #include <mach/irqs.h>
+#include <mach/nand.h>
+
+#include <linux/usb/android_composite.h>
 
 #include "board.h"
 #include "board-harmony.h"
@@ -60,6 +66,120 @@ static int __init parse_tag_nvidia(const struct tag *tag)
 }
 __tagtable(ATAG_NVIDIA, parse_tag_nvidia);
 
+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) -- <available>
+ *
+ * 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),
@@ -82,8 +202,96 @@ static struct platform_device debug_uart = {
        },
 };
 
+/* 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_nand_device,
+       &tegra_otg,
+       &androidusb_device,
+       &pda_power_device,
 };
 
 static void __init tegra_harmony_fixup(struct machine_desc *desc,