From patchwork Wed Jun 11 08:56:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 31728 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7328F21134 for ; Wed, 11 Jun 2014 08:59:27 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rq2sf17782652pbb.1 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=aUcuwYM+7wYWVYtKv/oc+tidYmuW+lo35Gwf9Z2JzHg=; b=mbbTmi1CbBeXqEGihMctGUxm8ulzgjExwUJQDcyJ+Vf7gBbSqOGQzLjWRBXa2Hog5J gtwYliSL3zLqgwx7YRWx3jafJH5BXRV11wcEot/qqiv8DjKS9knyuOLKF96PawzVYX+5 xmAJ8W175pPV9a2hCvkPAwmMwKzObGPI6/RKXe4/2oD326bS/XIMlYRBSUbxc7iS9+YM CaBy6YiRBalaN9OnAqheC2aEjjOnP/A5GqNH8ke6sfUc5w4yp7nW82pG6EsDsUJ5z6qs q+fIX4T332wOFify52VTClKD1gJ371amkyLoxiHKBz29g+jFxzfsE2CSv38rR6zzI8Hu 1u8g== X-Gm-Message-State: ALoCoQkscgTPATIskIHqaAylPqVHShfvyeSYtdzTnj40398fe8XrJE8mWe4p+PzYtKlHcPjbIjX1 X-Received: by 10.68.230.193 with SMTP id ta1mr15107189pbc.6.1402477166811; Wed, 11 Jun 2014 01:59:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.46.53 with SMTP id j50ls2434970qga.67.gmail; Wed, 11 Jun 2014 01:59:26 -0700 (PDT) X-Received: by 10.221.27.8 with SMTP id ro8mr1748418vcb.30.1402477166645; Wed, 11 Jun 2014 01:59:26 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id e7si5404702vey.73.2014.06.11.01.59.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 01:59:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id jz11so6239988veb.30 for ; Wed, 11 Jun 2014 01:59:26 -0700 (PDT) X-Received: by 10.58.29.198 with SMTP id m6mr37525420veh.15.1402477166552; Wed, 11 Jun 2014 01:59:26 -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 vs6csp286505vcb; Wed, 11 Jun 2014 01:59:26 -0700 (PDT) X-Received: by 10.66.153.80 with SMTP id ve16mr11823466pab.143.1402477165621; Wed, 11 Jun 2014 01:59:25 -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 S932568AbaFKI7K (ORCPT + 27 others); Wed, 11 Jun 2014 04:59:10 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:33137 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755782AbaFKI7G (ORCPT ); Wed, 11 Jun 2014 04:59:06 -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 s5B8wdwK003641; Wed, 11 Jun 2014 03:58:39 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5B8wdKG009968; Wed, 11 Jun 2014 03:58:39 -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:39 -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 s5B8uiT5020510; Wed, 11 Jun 2014 03:58:36 -0500 From: Roger Quadros To: , , CC: , , , , , , , , , Roger Quadros , Felipe Balbi Subject: [PATCH 31/36] ARM: OMAP2: usb-tusb6010: Use gpmc_generic_init() Date: Wed, 11 Jun 2014 11:56:36 +0300 Message-ID: <1402477001-31132-32-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.171 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. CC: Felipe Balbi Signed-off-by: Roger Quadros --- arch/arm/mach-omap2/usb-tusb6010.c | 78 +++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c index 71e6246..d28f5cd 100644 --- a/arch/arm/mach-omap2/usb-tusb6010.c +++ b/arch/arm/mach-omap2/usb-tusb6010.c @@ -125,13 +125,17 @@ EXPORT_SYMBOL_GPL(tusb6010_platform_retime); static struct resource tusb_resources[] = { /* Order is significant! The start/end fields - * are updated during setup.. + * are updated by GPMC driver, see gpmc_probe_legacy() */ - { /* Asynchronous access */ - .flags = IORESOURCE_MEM, + { /* Asynchronous access, for PIO */ + .flags = IORESOURCE_MEM, + .start = 0, + .end = 0x9ff, }, - { /* Synchronous access */ - .flags = IORESOURCE_MEM, + { /* Synchronous access, for DMA */ + .flags = IORESOURCE_MEM, + .start = 0, + .end = 0x9ff, }, { /* IRQ */ .name = "mc", @@ -163,37 +167,16 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, int status; static char error[] __initdata = KERN_ERR "tusb6010 init error %d, %d\n"; + struct gpmc_device_timings dev_async_t; + struct gpmc_device_timings dev_sync_t; - /* ASYNC region, primarily for PIO */ - status = gpmc_cs_request(async, SZ_16M, (unsigned long *) - &tusb_resources[0].start); - if (status < 0) { - printk(error, 1, status); - return status; - } - tusb_resources[0].end = tusb_resources[0].start + 0x9ff; + /* GPMC settings */ tusb_async.wait_pin = waitpin; async_cs = async; - status = gpmc_cs_program_settings(async_cs, &tusb_async); - if (status < 0) - return status; - - /* SYNC region, primarily for DMA */ - status = gpmc_cs_request(sync, SZ_16M, (unsigned long *) - &tusb_resources[1].start); - if (status < 0) { - printk(error, 2, status); - return status; - } - tusb_resources[1].end = tusb_resources[1].start + 0x9ff; tusb_sync.wait_pin = waitpin; sync_cs = sync; - status = gpmc_cs_program_settings(sync_cs, &tusb_sync); - if (status < 0) - return status; - /* IRQ */ status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq"); if (status < 0) { @@ -208,11 +191,10 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, return -ENODEV; } refclk_psec = ps_refclk; - status = tusb6010_platform_retime(1); - if (status < 0) { - printk(error, 5, status); - return status; - } + + /* device timings */ + tusb_get_async_timings(ps_refclk, &dev_async_t); + tusb_get_sync_timings(ps_refclk, &dev_sync_t); /* finish device setup ... */ if (!data) { @@ -240,11 +222,29 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, omap_mux_init_signal("sys_ndmareq5", 0); } - /* so far so good ... register the device */ - status = platform_device_register(&tusb_device); - if (status < 0) { - printk(error, 7, status); - return status; + /* Register ASYNC region */ + status = gpmc_generic_init(async_cs, false, + &tusb_async, &dev_async_t, NULL, + &tusb_device, sizeof(*data)); + + if (status) { + pr_err("%s: failed to register ASYNC region\n", __func__); + goto fail; } + + /* Register SYNC region */ + status = gpmc_generic_init(sync_cs, false, + &tusb_sync, &dev_sync_t, NULL, + &tusb_device, sizeof(*data)); + if (status) { + pr_err("%s: failed to register SYNC region\n", __func__); + goto fail; + } + return 0; + +fail: + gpio_free(irq); + return status; + }