From patchwork Tue May 1 12:20:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Afzal X-Patchwork-Id: 156100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2B611B6FB4 for ; Tue, 1 May 2012 23:05:20 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SPCjk-0002XO-MU; Tue, 01 May 2012 13:03:26 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SPCKs-0007fj-Bg; Tue, 01 May 2012 12:37:44 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id q41CbVHC019968; Tue, 1 May 2012 07:37:31 -0500 Received: from DFLE70.ent.ti.com (dfle70.ent.ti.com [128.247.5.40]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q41CbVId026158; Tue, 1 May 2012 07:37:31 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle70.ent.ti.com (128.247.5.40) with Microsoft SMTP Server id 14.1.323.3; Tue, 1 May 2012 07:37:31 -0500 Received: from ucmsshproxy.india.ext.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with SMTP id q41CbPrj011597; Tue, 1 May 2012 07:37:26 -0500 Received: from symphony.india.ext.ti.com (unknown [192.168.247.13]) by ucmsshproxy.india.ext.ti.com (Postfix) with ESMTP id BEFC3158002; Tue, 1 May 2012 18:07:24 +0530 (IST) Received: from linux-psp-server.india.ext.ti.com (linux-psp-server [192.168.247.76]) by symphony.india.ext.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id q41CbOI18607; Tue, 1 May 2012 18:07:24 +0530 (IST) From: Afzal Mohammed To: , , , , , , , , , , , , , , , , Subject: [PATCH v4 09/39] ARM: OMAP2+: flash: Adapt to gpmc driver Date: Tue, 1 May 2012 17:50:41 +0530 Message-ID: <4ced8b708a263c7f50f6f684b47ab130bb773ba0.1335874494.git.afzal@ti.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Afzal Mohammed X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org gpmc driver has been converted to driver. Modify board_flash_init so that it can setup gpmc driver platform details for boards Signed-off-by: Afzal Mohammed --- arch/arm/mach-omap2/board-3430sdp.c | 2 +- arch/arm/mach-omap2/board-3630sdp.c | 3 +- arch/arm/mach-omap2/board-flash.c | 89 +++++++++++++++++++---------------- arch/arm/mach-omap2/board-flash.h | 11 +++-- 4 files changed, 58 insertions(+), 47 deletions(-) diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index da75f23..ac2e398 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -620,7 +620,7 @@ static void __init omap_3430sdp_init(void) omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL); usb_musb_init(NULL); board_smc91x_init(); - board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); + board_flash_init(sdp_flash_partitions, chip_sel_3430, 0, NULL); sdp3430_display_init(); enable_board_wakeup_source(); usbhs_init(&usbhs_bdata); diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c index 6ef350d..74195b7 100644 --- a/arch/arm/mach-omap2/board-3630sdp.c +++ b/arch/arm/mach-omap2/board-3630sdp.c @@ -204,7 +204,8 @@ static void __init omap_sdp_init(void) h8mbx00u0mer0em_sdrc_params); zoom_display_init(); board_smc91x_init(); - board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16); + board_flash_init(sdp_flash_partitions, chip_sel_sdp, + NAND_BUSWIDTH_16, NULL); enable_board_wakeup_source(); usbhs_init(&usbhs_bdata); } diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c index 8727c05..8deead9 100644 --- a/arch/arm/mach-omap2/board-flash.c +++ b/arch/arm/mach-omap2/board-flash.c @@ -39,46 +39,33 @@ static struct physmap_flash_data board_nor_data = { .width = 2, }; -static struct resource board_nor_resource = { - .flags = IORESOURCE_MEM, +static struct gpmc_cs_data gpmc_nor_cs_data = { }; -static struct platform_device board_nor_device = { +static struct gpmc_device_pdata gpmc_nor_data = { .name = "physmap-flash", .id = 0, - .dev = { - .platform_data = &board_nor_data, - }, - .num_resources = 1, - .resource = &board_nor_resource, + .cs_data = &gpmc_nor_cs_data, + .num_cs = 1, }; -static void -__init board_nor_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs) +static __init struct gpmc_device_pdata * +gpmc_nor_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs) { - int err; - board_nor_data.parts = nor_parts; board_nor_data.nr_parts = nr_parts; - /* Configure start address and size of NOR device */ - if (omap_rev() >= OMAP3430_REV_ES1_0) { - err = gpmc_cs_request(cs, FLASH_SIZE_SDPV2 - 1, - (unsigned long *)&board_nor_resource.start); - board_nor_resource.end = board_nor_resource.start - + FLASH_SIZE_SDPV2 - 1; - } else { - err = gpmc_cs_request(cs, FLASH_SIZE_SDPV1 - 1, - (unsigned long *)&board_nor_resource.start); - board_nor_resource.end = board_nor_resource.start - + FLASH_SIZE_SDPV1 - 1; - } - if (err < 0) { - pr_err("NOR: Can't request GPMC CS\n"); - return; - } - if (platform_device_register(&board_nor_device) < 0) - pr_err("Unable to register NOR device\n"); + gpmc_nor_cs_data.cs = cs; + + if (omap_rev() >= OMAP3430_REV_ES1_0) + gpmc_nor_cs_data.mem_size = FLASH_SIZE_SDPV2; + else + gpmc_nor_cs_data.mem_size = FLASH_SIZE_SDPV1; + + gpmc_nor_data.pdata = &board_nor_data; + gpmc_nor_data.pdata_size = sizeof(board_nor_data); + + return &gpmc_nor_data; } #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ @@ -183,8 +170,11 @@ unmap: * * @return - void. */ -void __init board_flash_init(struct flash_partitions partition_info[], - char chip_sel_board[][GPMC_CS_NUM], int nand_type) +__init struct gpmc_device_pdata **board_flash_init( + struct flash_partitions partition_info[], + char chip_sel_board[][GPMC_CS_NUM], + int nand_type, + struct gpmc_device_pdata **gpmc_data) { u8 cs = 0; u8 norcs = GPMC_CS_NUM + 1; @@ -193,13 +183,18 @@ void __init board_flash_init(struct flash_partitions partition_info[], u8 idx; unsigned char *config_sel = NULL; + if (gpmc_data == NULL) { + pr_err("%s: NULL arguement passed\n", __func__); + return NULL; + } + /* REVISIT: Is this return correct idx for 2430 SDP? * for which cs configuration matches for 2430 SDP? */ idx = get_gpmc0_type(); if (idx >= MAX_SUPPORTED_GPMC_CONFIG) { pr_err("%s: Invalid chip select: %d\n", __func__, cs); - return; + return gpmc_data; } config_sel = (unsigned char *)(chip_sel_board[idx]); @@ -224,19 +219,31 @@ void __init board_flash_init(struct flash_partitions partition_info[], if (norcs > GPMC_CS_NUM) pr_err("NOR: Unable to find configuration in GPMC\n"); else - board_nor_init(partition_info[0].parts, + *gpmc_data++ = gpmc_nor_init(partition_info[0].parts, partition_info[0].nr_parts, norcs); if (onenandcs > GPMC_CS_NUM) pr_err("OneNAND: Unable to find configuration in GPMC\n"); - else - board_onenand_init(partition_info[1].parts, - partition_info[1].nr_parts, onenandcs); + else { + struct omap_onenand_platform_data *onenand_data; + + onenand_data = board_onenand_init(partition_info[1].parts, + partition_info[1].nr_parts, onenandcs); + if (onenand_data != NULL) + *gpmc_data++ = gpmc_onenand_init(onenand_data); + } if (nandcs > GPMC_CS_NUM) pr_err("NAND: Unable to find configuration in GPMC\n"); - else - board_nand_init(partition_info[2].parts, - partition_info[2].nr_parts, nandcs, - nand_type, nand_default_timings); + else { + struct omap_nand_platform_data *nand_data; + + nand_data = board_nand_init(partition_info[2].parts, + partition_info[2].nr_parts, nandcs, + nand_type, nand_default_timings); + if (nand_data != NULL) + *gpmc_data++ = gpmc_nand_init(nand_data); + } + + return gpmc_data; } diff --git a/arch/arm/mach-omap2/board-flash.h b/arch/arm/mach-omap2/board-flash.h index 75ba49f..4dd733d 100644 --- a/arch/arm/mach-omap2/board-flash.h +++ b/arch/arm/mach-omap2/board-flash.h @@ -28,12 +28,15 @@ struct flash_partitions { defined(CONFIG_MTD_NAND_OMAP2_MODULE) || \ defined(CONFIG_MTD_ONENAND_OMAP2) || \ defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) -extern void board_flash_init(struct flash_partitions [], - char chip_sel[][GPMC_CS_NUM], int nand_type); +extern struct gpmc_device_pdata **board_flash_init( + struct flash_partitions [], char chip_sel[][GPMC_CS_NUM], + int nand_type, struct gpmc_device_pdata **gpmc_data); #else -static inline void board_flash_init(struct flash_partitions part[], - char chip_sel[][GPMC_CS_NUM], int nand_type) +static inline struct gpmc_device_pdata **board_flash_init( + struct flash_partitions part[], char chip_sel[][GPMC_CS_NUM], + int nand_type, struct gpmc_device_pdata **gpmc_data) { + return NULL; } #endif