From patchwork Fri May 23 10:31:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 30754 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 437042066E for ; Fri, 23 May 2014 10:46:01 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id uo5sf17355481pbc.4 for ; Fri, 23 May 2014 03:46:00 -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:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=aeGLpVeDTS19nNdgdUsLxf/LzMLg/phxXyRVv1Zhh1Y=; b=Rawx2W+x/0D24O04kzkSihJHoWPWIsoFLqGWEU6zo6W4zqSzgMRlb5JsZqCY5r6+pb 3EUGMfXEt2jPfOFKrhx9q1Yw8D5TVuFU7ed8+jb659dPUTd1p8EqUuk78BCkD4Dr4ZCa hkqdLTXxMGVDOTqBs9T54nk0H2052Yr9bhDHz9xNiynbsY8IVMbjqKIeC1Qv9ORe+E9a j125PoVoPu1aCKEtwpKLowkI9Pg+DoM3QRV1wo50VI/jDKE9iRZ6tgo+fRC3E0b2mxhA IRVfmowTEJg3D3AcA4Y+FlBFPjKZ41naavywDwYnUXzdftlRmAR44Schc2q/jYjLr6NS H0MA== X-Gm-Message-State: ALoCoQkSu/tN6sP+yYdUENOYNd49HLSicuUf7z6MRQecpouf5iH21QSPxgTdSOFaG5TyTnInM22F X-Received: by 10.66.232.229 with SMTP id tr5mr2005012pac.16.1400841960410; Fri, 23 May 2014 03:46:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.130 with SMTP id q2ls1066778qga.91.gmail; Fri, 23 May 2014 03:46:00 -0700 (PDT) X-Received: by 10.52.164.237 with SMTP id yt13mr2951783vdb.18.1400841960297; Fri, 23 May 2014 03:46:00 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id be4si1386543vec.89.2014.05.23.03.46.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:46:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hq11so246298vcb.5 for ; Fri, 23 May 2014 03:46:00 -0700 (PDT) X-Received: by 10.52.14.130 with SMTP id p2mr1159185vdc.39.1400841960114; Fri, 23 May 2014 03:46:00 -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.220.221.72 with SMTP id ib8csp20621vcb; Fri, 23 May 2014 03:45:59 -0700 (PDT) X-Received: by 10.224.55.6 with SMTP id s6mr5005337qag.7.1400841959719; Fri, 23 May 2014 03:45:59 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id w10si3054988qad.80.2014.05.23.03.45.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 May 2014 03:45:59 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WnmxW-0004P7-EN; Fri, 23 May 2014 10:44:18 +0000 Received: from mail-wi0-f175.google.com ([209.85.212.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnmm8-0001Tp-Pu for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 10:32:33 +0000 Received: by mail-wi0-f175.google.com with SMTP id f8so598932wiw.14 for ; Fri, 23 May 2014 03:32:11 -0700 (PDT) X-Received: by 10.194.82.9 with SMTP id e9mr3218916wjy.45.1400841131763; Fri, 23 May 2014 03:32:11 -0700 (PDT) Received: from localhost.localdomain (AToulouse-654-1-404-187.w82-125.abo.wanadoo.fr. [82.125.3.187]) by mx.google.com with ESMTPSA id s9sm2200908wix.13.2014.05.23.03.32.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:32:11 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, mingo@kernel.org Subject: [PATCH 29/71] clocksource: sh_tmu: Allocate channels dynamically Date: Fri, 23 May 2014 12:31:09 +0200 Message-Id: <1400841111-6683-29-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400841111-6683-1-git-send-email-daniel.lezcano@linaro.org> References: <537F214C.8000700@linaro.org> <1400841111-6683-1-git-send-email-daniel.lezcano@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140523_033233_041131_AEC0C3A0 X-CRM114-Status: GOOD ( 14.69 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.175 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 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 From: Laurent Pinchart This prepares the driver for multi-channel support. Signed-off-by: Laurent Pinchart --- drivers/clocksource/sh_tmu.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 26a9f7d..55b7a37 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c @@ -58,7 +58,8 @@ struct sh_tmu_device { void __iomem *mapbase; struct clk *clk; - struct sh_tmu_channel channel; + struct sh_tmu_channel *channels; + unsigned int num_channels; }; static DEFINE_RAW_SPINLOCK(sh_tmu_lock); @@ -469,6 +470,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) { struct sh_timer_config *cfg = pdev->dev.platform_data; struct resource *res; + void __iomem *base; int ret; ret = -ENXIO; @@ -488,16 +490,16 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) } /* - * Map memory, let channel.base point to our channel and mapbase to the + * Map memory, let base point to our channel and mapbase to the * start/stop shared register. */ - tmu->channel.base = ioremap_nocache(res->start, resource_size(res)); - if (tmu->channel.base == NULL) { + base = ioremap_nocache(res->start, resource_size(res)); + if (base == NULL) { dev_err(&tmu->pdev->dev, "failed to remap I/O memory\n"); goto err0; } - tmu->mapbase = tmu->channel.base - cfg->channel_offset; + tmu->mapbase = base - cfg->channel_offset; /* get hold of clock */ tmu->clk = clk_get(&tmu->pdev->dev, "tmu_fck"); @@ -511,18 +513,29 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) if (ret < 0) goto err2; - ret = sh_tmu_channel_setup(&tmu->channel, tmu); + tmu->channels = kzalloc(sizeof(*tmu->channels), GFP_KERNEL); + if (tmu->channels == NULL) { + ret = -ENOMEM; + goto err3; + } + + tmu->num_channels = 1; + + tmu->channels[0].base = base; + + ret = sh_tmu_channel_setup(&tmu->channels[0], tmu); if (ret < 0) goto err3; return 0; err3: + kfree(tmu->channels); clk_unprepare(tmu->clk); err2: clk_put(tmu->clk); err1: - iounmap(tmu->channel.base); + iounmap(base); err0: return ret; }