From patchwork Wed Jul 17 19:50:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 11048219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAB3A13A4 for ; Wed, 17 Jul 2019 19:55:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA5922873D for ; Wed, 17 Jul 2019 19:55:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DD4E28685; Wed, 17 Jul 2019 19:55:24 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 332E42873D for ; Wed, 17 Jul 2019 19:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=alaLxJ++DbKUVYJx0gNwpImGZhdhPEtFviW6wkgmu0o=; b=D5oh6U3zY7/J5EGeB537on1J6c y73z1QVpPyNhg+O4I6E06aBXWboAA+X8tpoSne3l5F+BI9euY8uUrnAQVwJvcNnoV860l13dk5j7Z +slAWmMRljk9e+ksa7tRu/TGOdFKqiB9QBN5H1w3nA3CyYcosaNMLB7l8ILo61dKKV5K7LKc/FkFh 5Dv5BB716b46PNirGp98VwUMON3f8bAZTfZE0YqoJuYZdC4LkfDeVBTCRJfN01Rp764DazmYkYpRo EYgCxhd89beuKiDU5ed7picAhGV0MazAxfvJZYYqYEVFN9TUhbpDgbTmJFM72OUL8o5EaIIO/6yXu qo5IxVWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hnq1K-0007VI-NN; Wed, 17 Jul 2019 19:55:22 +0000 Received: from mout.gmx.net ([212.227.17.20]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hnpx3-0002tL-90; Wed, 17 Jul 2019 19:51:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1563393044; bh=R9brMAk7TYtzYQPh2zNgNq7URsVol2j16aDqED3oRj8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=fOG4rbRjsAk1NsQ2JoRn48422d5imwY/rZvgEetewYNI6hV/wMGFgXlnQ5OYRFgVW wZ3of7YWTleKShERN9JY9HmYqJ6hNywEjhjzn4sUs8uGdSB6gPz2egCyIxrIUwX+Ad deEaEuF3GqKwYpNbr9tXGkwyTkRFXDKADJA4/Tvg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([37.4.249.103]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LlqNY-1iNAlY06Ua-00ZRHT; Wed, 17 Jul 2019 21:50:44 +0200 From: Stefan Wahren To: Eric Anholt , Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne , Rob Herring , Mark Rutland , Linus Walleij , Michael Turquette , Stephen Boyd , Ulf Hansson , Adrian Hunter , Mark Brown Subject: [PATCH RFC 07/18] clk: bcm2835: Add BCM2838_CLOCK_EMMC2 support Date: Wed, 17 Jul 2019 21:50:15 +0200 Message-Id: <1563393026-17118-8-git-send-email-wahrenst@gmx.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1563393026-17118-1-git-send-email-wahrenst@gmx.net> References: <1563393026-17118-1-git-send-email-wahrenst@gmx.net> X-Provags-ID: V03:K1:wBXTrd+q4tE1UkS/4oFb93izCQy8kYwkLZTmkyTdzGs+hz+TH3d Fxc4MBR1loExiXjomd0ZMTEo31jMJl/FmkYLZAuyX/Doj4aCey4Eg7Iph/g61a0Ak23O/R6 uuK/uhecjgHHdQPuKN74wIGMhKxQ8S/4enIst2HhrOmEyH6Nn3tRX0cpTqlVDvxp5d9+KKw uSCl7mIVBwe+mD4AQwBLQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:vGIp4TJST88=:arugvaM5LrSwYEzsFAx5Py l+1DaLQ659uZ3kSs8VqOS4U3S/CJW24xpb+Qa3wa+N5TRSTSpBc4eZcq3PCIAsRubuUFO6BbV 3kFNTNHH3ZjqyuirWjBsBhOGn4bg4JcPDRs+DkUMCsO79LtOCerUq6wRiK3G/g+y9u4C6Nlhn +YsS6aIo4V1t0gfcuHrpiw27kU+3Kf3pFff2k+TYXANJ9vBR0QfW+UaWOBUNBwoTyqNrn8qxH YiDZUYquwFUKldus8pENQSlgvyMKi+/YLAlkHpqXujS5khhx5xN5Y90+poF0tuNPQzP1VMbqL k8LWue7g3+1kG3wna1n4C5Chpbn9DyjgUSf79aQ22pmFxejXTMKDXj3gdFbAWhND5SIgipM+D UI6Mi/nd0UgR9LQcCNmhVaMAZ3T5/OCYX9NEmv+5LxELOIrGxzCBJ0lXTgtqLwKaDnmqbwY4F XoU9DdUjfnKHN2xXeAtCGJyJUF/FrHG2O4kh6MFvr3nx4lLVkVj01fgn6uAEfaYWQoTlXWinH 3eGBvoDmMQ6fBO9vIrpiVQjFsw97H36uX0qXwTHJ2hX1nGQ0DOM0n/HHewrsbWmrjNdLFaFA9 Tk4zXnSgJNVIJP1C+BqYUkSaU54cPfqoFrSY5PgXZ17Mu7B6ILhIInU18cKNv1vNBnCc14QOB Q64FIHYa3poZrxMBUAf5sWX9I6zs3BR3lo371gT/Z4pBhPsiuvFqR51Irc0aRb1TzZygcb+BQ YF/G+10rRmA1bgDcJLvafd6+GCAIAb32DD421mM3Rd4aW6Co3ByoLJe5dXud124qyucChSRVE GFmSJrZP1mtpev9frmwORxON2jqkj0CEYUArnrxUS8Z3PscIXhxb35do6fMeyb9JTTgvGcv0a 4EtZwwjarNhuPxcUHbZJJPHBQn8fTbwoOBQBcc7TmfWKSgGDbLlRktYrkb1YLrBk9Exr+4SMy j0JWeKYjE2qUbacyA14CpYcSPMx35Ns+umWnt0k5eBRrWk+l4haUwTIekSNyNueZFOFL0Yf3n lBHGZD6TWSoaM2LDHp4CSvDsYZMiGEFsNmvxvfAcoV4d+NjsL6MRp1RVFE6TXx6Z+SJptKn5z pa1N4N61rU1pZg= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190717_125057_639901_5D178524 X-CRM114-Status: GOOD ( 16.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The new BCM2838 supports an additional clock for the emmc2 block. So add a new compatible to register this clock only for BCM2838. Signed-off-by: Stefan Wahren --- drivers/clk/bcm/clk-bcm2835.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index 867ae3c..5fe4695 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -31,7 +31,8 @@ #include #include #include -#include +#include + #include #include #include @@ -114,6 +115,8 @@ #define CM_AVEODIV 0x1bc #define CM_EMMCCTL 0x1c0 #define CM_EMMCDIV 0x1c4 +#define CM_EMMC2CTL 0x1d0 +#define CM_EMMC2DIV 0x1d4 /* General bits for the CM_*CTL regs */ # define CM_ENABLE BIT(4) @@ -1950,6 +1953,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .frac_bits = 8, .tcnt_mux = 39), + /* EMMC2 clock (only available for BCM2838) */ + [BCM2838_CLOCK_EMMC2] = REGISTER_PER_CLK( + .name = "emmc2", + .ctl_reg = CM_EMMC2CTL, + .div_reg = CM_EMMC2DIV, + .int_bits = 4, + .frac_bits = 8, + .tcnt_mux = 42), + /* General purpose (GPIO) clocks */ [BCM2835_CLOCK_GP0] = REGISTER_PER_CLK( .name = "gp0", @@ -2101,6 +2113,14 @@ static int bcm2835_mark_sdc_parent_critical(struct clk *sdc) return clk_prepare_enable(parent); } +bool bcm2835_has_clk(size_t index) { + return index != BCM2838_CLOCK_EMMC2; +} + +bool bcm2838_has_clk(size_t index) { + return true; +} + static int bcm2835_clk_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -2109,9 +2129,14 @@ static int bcm2835_clk_probe(struct platform_device *pdev) struct resource *res; const struct bcm2835_clk_desc *desc; const size_t asize = ARRAY_SIZE(clk_desc_array); + bool (*has_clk_func)(size_t); size_t i; int ret; + has_clk_func = of_device_get_match_data(&pdev->dev); + if (!has_clk_func) + return -ENODEV; + cprman = devm_kzalloc(dev, struct_size(cprman, onecell.hws, asize), GFP_KERNEL); @@ -2146,6 +2171,9 @@ static int bcm2835_clk_probe(struct platform_device *pdev) hws = cprman->onecell.hws; for (i = 0; i < asize; i++) { + if (!has_clk_func(i)) + continue; + desc = &clk_desc_array[i]; if (desc->clk_register && desc->data) hws[i] = desc->clk_register(cprman, desc->data); @@ -2160,7 +2188,8 @@ static int bcm2835_clk_probe(struct platform_device *pdev) } static const struct of_device_id bcm2835_clk_of_match[] = { - { .compatible = "brcm,bcm2835-cprman", }, + { .compatible = "brcm,bcm2835-cprman", .data = bcm2835_has_clk }, + { .compatible = "brcm,bcm2838-cprman", .data = bcm2838_has_clk }, {} }; MODULE_DEVICE_TABLE(of, bcm2835_clk_of_match);