From patchwork Wed Jun 11 08:56:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 31727 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E23CB203C2 for ; Wed, 11 Jun 2014 08:59:26 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id up15sf2132440pbc.4 for ; Wed, 11 Jun 2014 01:59:26 -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=C4X9gEKoIvnGZPu6hJ1OZbLYD/KN4ca6a3Zpq40iVzc=; b=JPLO5Mpb73TlfLwsQQM8uOG7oGtQYwNMXMbZSeXyiD2a7mNaXDq7zWJL9uv3TWBqar 17M1vzzL/aqW6tlAdl2/yBUkaVAm09Fik4sIO4C7youQATueHU8vPSUar0kAc5OIqKL6 18HuS9+xBrGmHKdFvDyDcOTGzesYyIMHY195qDG4I9IdDDrypwQAVHhiDN7vEeWWkhcT ZlxB3p+8n+IvRwAtNjxQ1OKpiZ3hzXfhGFxjAkhvXDGDeI7ljHFm4cBIaG3hqqhVjD7C 9CYqQcJgjmUthD0cpkNyFjMDUZfDRdE4Ucdxa8enIdi9Kx4+QBAeKCqpvW1w11yIzt6r 4O2w== X-Gm-Message-State: ALoCoQlBhoR/UPt8WDlCT+g2mvWiIY6xWo0xrKgRizmckrFicTRFmv8CSMt4RNxOOMx9fqV/FMAA X-Received: by 10.66.162.38 with SMTP id xx6mr5052104pab.46.1402477166132; Wed, 11 Jun 2014 01:59:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.16 with SMTP id r16ls2661275qga.71.gmail; Wed, 11 Jun 2014 01:59:25 -0700 (PDT) X-Received: by 10.220.249.6 with SMTP id mi6mr1758915vcb.33.1402477165927; Wed, 11 Jun 2014 01:59:25 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id um1si14038755veb.11.2014.06.11.01.59.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 01:59:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jw12so7300965veb.39 for ; Wed, 11 Jun 2014 01:59:25 -0700 (PDT) X-Received: by 10.58.29.106 with SMTP id j10mr1835622veh.31.1402477165769; Wed, 11 Jun 2014 01:59:25 -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 vs6csp286504vcb; Wed, 11 Jun 2014 01:59:25 -0700 (PDT) X-Received: by 10.69.19.140 with SMTP id gu12mr3396399pbd.111.1402477164902; Wed, 11 Jun 2014 01:59:24 -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.24; Wed, 11 Jun 2014 01:59:24 -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 S1755818AbaFKI7F (ORCPT + 27 others); Wed, 11 Jun 2014 04:59:05 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:33120 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755775AbaFKI7A (ORCPT ); Wed, 11 Jun 2014 04:59:00 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5B8wWM5003616; Wed, 11 Jun 2014 03:58:32 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5B8wWw0009840; Wed, 11 Jun 2014 03:58:32 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Wed, 11 Jun 2014 03:58:32 -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 s5B8uiT3020510; Wed, 11 Jun 2014 03:58:28 -0500 From: Roger Quadros To: , , CC: , , , , , , , , , Roger Quadros Subject: [PATCH 29/36] ARM: OMAP2+: gpmc-smc91x: Use gpmc_generic_init() Date: Wed, 11 Jun 2014 11:56:34 +0300 Message-ID: <1402477001-31132-30-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.180 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-smc91x.c | 50 +++++++++++++++------------------------ 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c index 7f5d84a..4ac0d4d 100644 --- a/arch/arm/mach-omap2/gpmc-smc91x.c +++ b/arch/arm/mach-omap2/gpmc-smc91x.c @@ -25,8 +25,11 @@ static struct omap_smc91x_platform_data *gpmc_cfg; static struct resource gpmc_smc91x_resources[] = { +/* GPMC driver will fixup the 1st memory resource, see gpmc_probe_legacy () */ [0] = { .flags = IORESOURCE_MEM, + .start = 0, + .end = 0xf, }, [1] = { .flags = IORESOURCE_IRQ, @@ -92,21 +95,11 @@ static void smc91c96_get_device_timing(struct gpmc_device_timings *dev_t) */ void __init gpmc_smc91x_init(struct omap_smc91x_platform_data *board_data) { - unsigned long cs_mem_base; int ret; struct gpmc_device_timings dev_t; gpmc_cfg = board_data; - if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { - printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); - return; - } - - gpmc_smc91x_resources[0].start = cs_mem_base + 0x300; - gpmc_smc91x_resources[0].end = cs_mem_base + 0x30f; - gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK); - if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA) smc91x_settings.mux_add_data = GPMC_MUX_AD; if (gpmc_cfg->flags & GPMC_READ_MON) @@ -115,34 +108,24 @@ void __init gpmc_smc91x_init(struct omap_smc91x_platform_data *board_data) smc91x_settings.wait_on_write = true; if (gpmc_cfg->wait_pin) smc91x_settings.wait_pin = gpmc_cfg->wait_pin; - ret = gpmc_cs_program_settings(gpmc_cfg->cs, &smc91x_settings); - if (ret < 0) - goto free1; - - if (gpmc_cfg->flags & GPMC_TIMINGS_SMC91C96) { - struct gpmc_timings gpmc_t; + if (gpmc_cfg->flags & GPMC_TIMINGS_SMC91C96) smc91c96_get_device_timing(&dev_t); - gpmc_calc_timings(&gpmc_t, &smc91x_settings, &dev_t); - if (gpmc_cs_set_timings(gpmc_cfg->cs, &gpmc_t)) { - pr_err("%s: failed to set GPMC timings\n", __func__); - goto free1; - } - } if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "SMC91X irq") < 0) goto free1; gpmc_smc91x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); + gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK); - if (gpmc_cfg->gpio_pwrdwn) { + if (gpio_is_valid(gpmc_cfg->gpio_pwrdwn)) { ret = gpio_request_one(gpmc_cfg->gpio_pwrdwn, GPIOF_OUT_INIT_LOW, "SMC91X powerdown"); if (ret) goto free2; } - if (gpmc_cfg->gpio_reset) { + if (gpio_is_valid(gpmc_cfg->gpio_reset)) { ret = gpio_request_one(gpmc_cfg->gpio_reset, GPIOF_OUT_INIT_LOW, "SMC91X reset"); if (ret) @@ -153,21 +136,26 @@ void __init gpmc_smc91x_init(struct omap_smc91x_platform_data *board_data) gpio_set_value(gpmc_cfg->gpio_reset, 0); } - if (platform_device_register(&gpmc_smc91x_device) < 0) { - printk(KERN_ERR "Unable to register smc91x device\n"); - gpio_free(gpmc_cfg->gpio_reset); - goto free3; + ret = gpmc_generic_init(gpmc_cfg->cs, false, + &smc91x_settings, + gpmc_cfg->flags & GPMC_TIMINGS_SMC91C96 ? + &dev_t : NULL, NULL, + &gpmc_smc91x_device, sizeof(gpmc_smc91x_info)); + if (ret) { + pr_err("%s: gpmc_generic_init() failed %d\n", __func__, ret); + goto free4; } return; +free4: + if (gpio_is_valid(gpmc_cfg->gpio_reset)) + gpio_free(gpmc_cfg->gpio_reset); free3: - if (gpmc_cfg->gpio_pwrdwn) + if (gpio_is_valid(gpmc_cfg->gpio_pwrdwn)) gpio_free(gpmc_cfg->gpio_pwrdwn); free2: gpio_free(gpmc_cfg->gpio_irq); free1: - gpmc_cs_free(gpmc_cfg->cs); - printk(KERN_ERR "Could not initialize smc91x\n"); }