From patchwork Mon Jun 12 14:25:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Elwell X-Patchwork-Id: 9781217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D799060212 for ; Mon, 12 Jun 2017 14:25:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1AC8228C9 for ; Mon, 12 Jun 2017 14:25:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C61C8283FF; Mon, 12 Jun 2017 14:25:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FEDB228C9 for ; Mon, 12 Jun 2017 14:25:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752047AbdFLOZP (ORCPT ); Mon, 12 Jun 2017 10:25:15 -0400 Received: from mx07-00252a01.pphosted.com ([62.209.51.214]:48813 "EHLO mx07-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752351AbdFLOZO (ORCPT ); Mon, 12 Jun 2017 10:25:14 -0400 Received: from pps.filterd (m0102628.ppops.net [127.0.0.1]) by mx07-00252a01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v5CELKFw002968 for ; Mon, 12 Jun 2017 15:25:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=from : subject : to : message-id : date : mime-version : content-type : content-transfer-encoding; s=pp; bh=SNerNyrloS4lpvVMJmixKYn/I4OYDhe7WkM5d0etcGw=; b=EteRhPr038pBlMfTnEXNLAkcWVMhEInptfHfNy6Gu4HTs7Fc+N8k651nYQrw8FE7Svz3 x3W1gKNlASER+ykhvNRvBHrQP7fTfiSGTYf+F2dz5Z/7TNjliQTckZGInpD1ndEdowz6 sKBhShWI3q1eTutNRyEY+kylywlQ1qzzjI86ah95xmNwmiLGxbGkx9tefmnuq9A7YscP wFuY58yybipecXadTDL15aKOCwtH1TnqMWkgzGprXBqA70txlpIKbX0xsMeAc/FMiXyu MCKGugyqVwppD2/nnW6O60jFe7sz+DUEmJIzumUYV38fvEAUv2VPevN7aPdRu6bdFa2J SA== Received: from mail-wr0-f197.google.com (mail-wr0-f197.google.com [209.85.128.197]) by mx07-00252a01.pphosted.com with ESMTP id 2b065ys48j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Mon, 12 Jun 2017 15:25:11 +0100 Received: by mail-wr0-f197.google.com with SMTP id g36so23190359wrg.4 for ; Mon, 12 Jun 2017 07:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi-org.20150623.gappssmtp.com; s=20150623; h=from:subject:to:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=SNerNyrloS4lpvVMJmixKYn/I4OYDhe7WkM5d0etcGw=; b=xEWy0xLZGCjQvd/DAr7FuQv1h0rrJ432hzvTPBiI+W1gG/hre4dkn3Gg04RCCkpg+2 7PCJKJASzN3RmuStlyo/Omxy4QBIteTpj0eIBqJiRI98DI+Zt03c3UoMPjHkDb06Bxkw 0X6ALvezcJGyjWTwDuG1NOAzJoiSiJoA66dmMnrDhddmQHl1laRSAqIuvzxUbzeI14Qv aZy+gcUlL0ON86mIaYxlqvFmEKxMINiynbSCN1tI41/+XBfu2twmaDPiLuS0QcgPBNAm t3qigrjb73WJs/3N8WqoMrJrWi8oGLEU008Z6KbumXCyu8yYiBMKN+cMeGZw44hDCDzu H6yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=SNerNyrloS4lpvVMJmixKYn/I4OYDhe7WkM5d0etcGw=; b=NeG2+zQWhXpf9NwfpSdiS4aOxwtgOuspBaGs4IhKn/L3hQTeuMU5w2vFVCAFV52gbP /DFtqa2ibgBqGo2RJJErao7IIpcWRueuIYVqsDILqjSbkqO1nrmRHp7urqHhdQrGqaNl uInW+e4PIgYOcwUILAyQYSOBTJ/2Z3oCywEqUt83pa8moB5wd38bqstd5MMzjEZilBtO sSo2VQg4AY00f+eGR8HEky3YmowNXE6nYctmfgsmV7vOrUGqgI+3RJuub5gV3IC4NOUD SiQ7e+y6d8SQ2UG6r7K857zdmFqlZ4FXTRZPket6zC8ukeal/73+M3w5GEfnBtz3iCQD nS2Q== X-Gm-Message-State: AODbwcDiYcAYYj6sf5BUX1HwLlr1BmyS6pUA2QyKE1uJvOS24e032LWc TdaH8rtndDikYkNC7AM6ConboF46KFaVdYRtluzg/ZB3+4NsgyOHFNDbIDyDr4yhND1a/V+l4le T52k1zPzqlQY= X-Received: by 10.223.136.216 with SMTP id g24mr8517764wrg.162.1497277510934; Mon, 12 Jun 2017 07:25:10 -0700 (PDT) X-Received: by 10.223.136.216 with SMTP id g24mr8517746wrg.162.1497277510761; Mon, 12 Jun 2017 07:25:10 -0700 (PDT) Received: from ?IPv6:2a00:2381:fdf7:14:f582:83ae:5a04:a029? ([2a00:2381:fdf7:14:f582:83ae:5a04:a029]) by smtp.gmail.com with ESMTPSA id n2sm20317225wrn.30.2017.06.12.07.25.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2017 07:25:10 -0700 (PDT) From: Phil Elwell Subject: [PATCH v2 1/4] clk: bcm2835: More flexible IO register remapping To: Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Mark Rutland , Florian Fainelli , Stefan Wahren , Eric Anholt , Russell King , Michael Turquette , Stephen Boyd , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-clk@vger.kernel.org Message-ID: <28279803-78d2-4231-939b-89a8c895aba9@raspberrypi.org> Date: Mon, 12 Jun 2017 15:25:09 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 Content-Language: en-GB X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-12_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706120249 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The BCM2835 AUX block contains two registers - AUXIRQ and AUXENB. The addition of an irqchip driver using AUXIRQ is hampered by the current DT node reserving both registers with a compatible string claimed by this bcm2835-aux-clk driver. Ease the transition to separate DT nodes by detecting and handling the case where this driver's MEM resource has been reduced to include only the AUXENB register. Otherwise, use devm_ioremap to remap the region without reserving it. Signed-off-by: Phil Elwell --- drivers/clk/bcm/clk-bcm2835-aux.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c index bd750cf..70d389e 100644 --- a/drivers/clk/bcm/clk-bcm2835-aux.c +++ b/drivers/clk/bcm/clk-bcm2835-aux.c @@ -37,9 +37,22 @@ static int bcm2835_aux_clk_probe(struct platform_device *pdev) parent = __clk_get_name(parent_clk); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - reg = devm_ioremap_resource(dev, res); - if (IS_ERR(reg)) - return PTR_ERR(reg); + /* + * If the MEM resource is only 4 bytes long it covers just the + * AUXENB register, otherwise it is the entire AUX block. + */ + if (resource_size(res) == 4) { + reg = devm_ioremap_resource(dev, res); + if (IS_ERR(reg)) + return PTR_ERR(reg); + gate = reg; + } else { + reg = devm_ioremap(dev, res->start, resource_size(res)); + if (IS_ERR(reg)) + return PTR_ERR(reg); + gate = reg + BCM2835_AUXENB; + } + onecell = devm_kmalloc(dev, sizeof(*onecell) + sizeof(*onecell->hws) * BCM2835_AUX_CLOCK_COUNT, GFP_KERNEL); @@ -47,7 +60,6 @@ static int bcm2835_aux_clk_probe(struct platform_device *pdev) return -ENOMEM; onecell->num = BCM2835_AUX_CLOCK_COUNT; - gate = reg + BCM2835_AUXENB; onecell->hws[BCM2835_AUX_CLOCK_UART] = clk_hw_register_gate(dev, "aux_uart", parent, 0, gate, 0, 0, NULL);