From patchwork Wed Jun 11 08:56:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 31729 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 18061203C2 for ; Wed, 11 Jun 2014 08:59:28 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id m1sf5654189oag.9 for ; Wed, 11 Jun 2014 01:59:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=b+8ogTXHkLKP9hwOuIQ6NV1J6peA2eRSwmKH8hDERhI=; b=g0d94JYu1dEmThNHZXnmiv3A4ETq1H8izB70U5rJDsA612zUtKUnhx6+eZrQe04dtB o4NR38FCVnga/fm6w62r4tYuNeerD5kSKpiNBkOggul3ys7r+i40mMLnLegjdT2jUDWE pYeWFzUOt/RR6P7DGx6Y4n71kmMiU0HNO68Zz0/aQHjCt6oYPpNhlmeD347ik+L9ZPJ+ MhqoCudNBg/hgtIYGQB6vPfutk8Fb7mFyoOCaozzPe8F8MGdQL+kiczztjEjgFomadNq bnKgx0bE0cl294TlozSfhoM7NYCbiy5lpDxv6XuiG576xRR5hQmhVJ55YzYjO2610JNF VqDA== X-Gm-Message-State: ALoCoQlN1LGA5cl/dPVH8GSji2PsoRai1r+SMUGWZKIBZ6/+krLm/OvO5zUER5PMPwkyT8k4fTuR X-Received: by 10.182.68.16 with SMTP id r16mr3315799obt.26.1402477167706; Wed, 11 Jun 2014 01:59:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.138 with SMTP id 10ls2522751qgx.9.gmail; Wed, 11 Jun 2014 01:59:27 -0700 (PDT) X-Received: by 10.58.123.71 with SMTP id ly7mr37856099veb.11.1402477167605; Wed, 11 Jun 2014 01:59:27 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id pa17si14029497veb.51.2014.06.11.01.59.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 01:59:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.179 as permitted sender) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id oy12so10161610veb.24 for ; Wed, 11 Jun 2014 01:59:27 -0700 (PDT) X-Received: by 10.58.152.234 with SMTP id vb10mr15476604veb.21.1402477167539; Wed, 11 Jun 2014 01:59:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp286508vcb; Wed, 11 Jun 2014 01:59:27 -0700 (PDT) X-Received: by 10.66.119.136 with SMTP id ku8mr11754014pab.121.1402477166326; Wed, 11 Jun 2014 01:59:26 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dq2si37299702pbb.118.2014.06.11.01.59.25; Wed, 11 Jun 2014 01:59:25 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932605AbaFKI7P (ORCPT + 27 others); Wed, 11 Jun 2014 04:59:15 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:56391 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752169AbaFKI7L (ORCPT ); Wed, 11 Jun 2014 04:59:11 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5B8wh3W028075; Wed, 11 Jun 2014 03:58:43 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5B8whXD022360; Wed, 11 Jun 2014 03:58:43 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Wed, 11 Jun 2014 03:58:42 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5B8uiT6020510; Wed, 11 Jun 2014 03:58:39 -0500 From: Roger Quadros To: , , CC: , , , , , , , , , Roger Quadros Subject: [PATCH 32/36] ARM: OMAP2+: onenand: Use gpmc_generic_init() Date: Wed, 11 Jun 2014 11:56:37 +0300 Message-ID: <1402477001-31132-33-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1402477001-31132-1-git-send-email-rogerq@ti.com> References: <1402477001-31132-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rogerq@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Don't access any GPMC registers here. Use gpmc_generic_init() to pass GPMC Chip Select settings, platform device and platform data to the GPMC driver. Signed-off-by: Roger Quadros --- arch/arm/mach-omap2/gpmc-onenand.c | 53 ++++++++------------------------------ 1 file changed, 11 insertions(+), 42 deletions(-) diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index 37ed4f1..139b3dd 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c @@ -27,7 +27,10 @@ #define ONENAND_IO_SIZE SZ_128K static struct resource gpmc_onenand_resource = { +/* GPMC driver will fixup the memory resource, see gpmc_probe_legacy() */ .flags = IORESOURCE_MEM, + .start = 0, + .end = ONENAND_IO_SIZE - 1, }; static struct platform_device gpmc_onenand_device = { @@ -68,29 +71,11 @@ static void omap2_onenand_get_async_timings(struct gpmc_device_timings *dev_t) dev_t->t_wph = t_wph * 1000; } -static int omap2_onenand_setup_async(struct omap_onenand_platform_data - *gpmc_onenand_data) -{ - struct gpmc_timings gpmc_t; - struct gpmc_device_timings dev_t; - int ret; - - ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async); - if (ret < 0) - return ret; - - omap2_onenand_get_async_timings(&dev_t); - gpmc_calc_timings(&gpmc_t, &onenand_async, &dev_t); - if (gpmc_cs_set_timings(gpmc_onenand_data->cs, &gpmc_t)) - return -EINVAL; - - return 0; -} - void gpmc_onenand_init(struct omap_onenand_platform_data *gpmc_onenand_data) { int err; struct device *dev = &gpmc_onenand_device.dev; + struct gpmc_device_timings dev_t; gpmc_onenand_device.dev.platform_data = gpmc_onenand_data; @@ -106,29 +91,13 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *gpmc_onenand_data) else gpmc_onenand_data->flags &= ~ONENAND_IN_OMAP34XX; - err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, - (unsigned long *)&gpmc_onenand_resource.start); - if (err < 0) { - dev_err(dev, "Cannot request GPMC CS %d, error %d\n", - gpmc_onenand_data->cs, err); - return; - } - - gpmc_onenand_resource.end = gpmc_onenand_resource.start + - ONENAND_IO_SIZE - 1; - - if (omap2_onenand_setup_async(gpmc_onenand_data)) { - pr_err("%s: Failed to setup ASYNC timings\n", __func__); - goto fail; - } - - if (platform_device_register(&gpmc_onenand_device) < 0) { - dev_err(dev, "Unable to register OneNAND device\n"); - goto fail; - } - return; + omap2_onenand_get_async_timings(&dev_t); -fail: - gpmc_cs_free(gpmc_onenand_data->cs); + err = gpmc_generic_init(gpmc_onenand_data->cs, false, + &onenand_async, &dev_t, NULL, + &gpmc_onenand_device, + sizeof(*gpmc_onenand_data)); + if (err) + pr_err("%s: gpmc_generic_init() failed %d\n", __func__, err); }