From patchwork Wed Feb 2 17:53:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 527331 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p12K7cXj007463 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Feb 2011 20:07:59 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id p12HrR06008103 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 2 Feb 2011 11:53:27 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id p12HrQdO025937; Wed, 2 Feb 2011 11:53:27 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 5AACB80627; Wed, 2 Feb 2011 11:53:26 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 73E9080626 for ; Wed, 2 Feb 2011 11:53:24 -0600 (CST) Received: from red.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id p12HrODA018182 for ; Wed, 2 Feb 2011 11:53:24 -0600 (CST) Received: from psmtp.com (na3sys009amx225.postini.com [74.125.149.65]) by red.ext.ti.com (8.13.7/8.13.7) with SMTP id p12HrMlx008685 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 2 Feb 2011 11:53:23 -0600 Received: from source ([209.85.212.173]) (using TLSv1) by na3sys009amx225.postini.com ([74.125.148.10]) with SMTP; Wed, 02 Feb 2011 09:53:23 PST Received: by pxi16 with SMTP id 16so47048pxi.4 for ; Wed, 02 Feb 2011 09:53:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=8TQ2LQ2kG0cEN1xVOdOsdr7yzS9j8qrxeBd3ln/fDSA=; b=NvRTxIeahnXB3jqyCyeUI1OOXZ6CHkAkZyD3EwXpoO/QX9nLZmqK1XGIQq2zWuNZAc d9NNgXhcd+jV8KuKH7agdJpiU1/TGBMDfLkKg3v5NulMOFT6MyMA3yZqeancZr150bi6 7n8V3NypPPyMZM39YBX1mq3C/cd+4ORb29Vmc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=rUqx+R/U/FnNu+KGlcPg6vTzyYkrVcvofG0CoaKNY9tR/eoGGDKoCv5WhJbbzWLXiI 2aiOkULIa03xlJ+0R0OaKW1VvhSvozdiLzRiQLcVb3cjXyffOxY0Hq73gquQbpGxzGud wiM3lXRpN0Mugy3wD+DGWDXovTdPuqtq55O5s= Received: by 10.142.157.2 with SMTP id f2mr9031980wfe.302.1296669201728; Wed, 02 Feb 2011 09:53:21 -0800 (PST) Received: from localhost.localdomain ([122.167.173.128]) by mx.google.com with ESMTPS id y42sm31703072wfd.22.2011.02.02.09.53.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 02 Feb 2011 09:53:17 -0800 (PST) From: Sughosh Ganu To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 1/1] Add support for Nand flash on Hawkboard. Date: Wed, 2 Feb 2011 23:23:14 +0530 Message-Id: <1296669194-11926-1-git-send-email-urwithsughosh@gmail.com> X-Mailer: git-send-email 1.7.0.4 X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:25.18265/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: sm.khasim@gmail.com X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 02 Feb 2011 20:07:59 +0000 (UTC) diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig index 32f1479..e13b7e0 100644 --- a/arch/arm/mach-davinci/Kconfig +++ b/arch/arm/mach-davinci/Kconfig @@ -213,6 +213,16 @@ config MACH_MITYOMAPL138 config MACH_OMAPL138_HAWKBOARD bool "TI AM1808 / OMAPL-138 Hawkboard platform" depends on ARCH_DAVINCI_DA850 + select MTD + select MTD_PARTITIONS + select MTD_CHAR + select MTD_BLKDEVS + select MTD_BLOCK + select MTD_PHYSMAP + select MTD_CFI + select MTD_NAND + select MTD_NAND_IDS + select MTD_NAND_DAVINCI help Say Y here to select the TI AM1808 / OMAPL-138 Hawkboard platform . Information of this board may be found at diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index 67c38d0..eac2d69 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -13,6 +13,10 @@ #include #include #include +#include +#include +#include +#include #include #include @@ -20,6 +24,7 @@ #include #include #include +#include #define HAWKBOARD_PHY_ID "0:07" #define DA850_HAWK_MMCSD_CD_PIN GPIO_TO_PIN(3, 12) @@ -28,6 +33,81 @@ #define DA850_USB1_VBUS_PIN GPIO_TO_PIN(2, 4) #define DA850_USB1_OC_PIN GPIO_TO_PIN(6, 13) +static struct mtd_partition omapl_hawk_nandflash_partition[] = { + { + .name = "u-boot env", + .offset = 0, + .size = SZ_128K, + .mask_flags = MTD_WRITEABLE, + }, + { + .name = "nand_spl", + .offset = MTDPART_OFS_APPEND, + .size = SZ_128K, + .mask_flags = MTD_WRITEABLE, + }, + { + .name = "u-boot", + .offset = 0xe0000, + .size = 2 * SZ_128K, + .mask_flags = MTD_WRITEABLE, + }, + { + .name = "kernel", + .offset = 0x200000, + .size = SZ_2M, + .mask_flags = 0, + }, + { + .name = "filesystem", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + .mask_flags = 0, + }, +}; + +static struct davinci_nand_pdata omapl_hawk_nandflash_data = { + .parts = omapl_hawk_nandflash_partition, + .nr_parts = ARRAY_SIZE(omapl_hawk_nandflash_partition), + .ecc_mode = NAND_ECC_HW, + .ecc_bits = 4, + .options = NAND_USE_FLASH_BBT, +}; + +static struct resource omapl_hawk_nandflash_resource[] = { + { + .start = DA8XX_AEMIF_CS3_BASE, + .end = DA8XX_AEMIF_CS3_BASE + PAGE_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = DA8XX_AEMIF_CTL_BASE, + .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device omapl_hawk_nandflash_device = { + .name = "davinci_nand", + .id = 1, + .dev = { + .platform_data = &omapl_hawk_nandflash_data, + }, + .num_resources = ARRAY_SIZE(omapl_hawk_nandflash_resource), + .resource = omapl_hawk_nandflash_resource, +}; + +static struct platform_device *omapl_hawk_devices[] __initdata = { + &omapl_hawk_nandflash_device, +}; + +static const short omapl_hawk_nand_pins[] = { + DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, + DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7, + DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_WE, + DA850_NEMA_OE, -1 +}; + static short omapl138_hawk_mii_pins[] __initdata = { DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3, DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER, @@ -37,6 +117,19 @@ static short omapl138_hawk_mii_pins[] __initdata = { -1 }; +static void omapl_hawk_nand_setup(void) +{ + int ret = 0; + + ret = davinci_cfg_reg_list(omapl_hawk_nand_pins); + if (ret) + pr_warning("da850_evm_init: nand mux setup failed: " + "%d\n", ret); + + platform_add_devices(omapl_hawk_devices, + ARRAY_SIZE(omapl_hawk_devices)); +} + static __init void omapl138_hawk_config_emac(void) { void __iomem *cfgchip3 = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG); @@ -314,6 +407,8 @@ static __init void omapl138_hawk_init(void) omapl138_hawk_usb_init(); + omapl_hawk_nand_setup(); + ret = da8xx_register_watchdog(); if (ret) pr_warning("omapl138_hawk_init: "