From: Florian Fainelli <florian@openwrt.org>
To: Jonas Gorski <jonas.gorski@gmail.com>
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
John Crispin <blogic@openwrt.org>,
Maxime Bizon <mbizon@freebox.fr>,
Kevin Cernekee <cernekee@gmail.com>
Subject: Re: [PATCH] MIPS: BCM63XX: add and use a clock for PCIe
Date: Mon, 29 Oct 2012 12:10:09 +0100 [thread overview]
Message-ID: <1396016.7LyuGEyaiC@flexo> (raw)
In-Reply-To: <1351428593-13355-1-git-send-email-jonas.gorski@gmail.com>
On Sunday 28 October 2012 13:49:53 Jonas Gorski wrote:
> Add a PCIe clock and use that instead of directly touching the clock
> control register. While at it, fail if there is no such clock.
Looks good, thanks Jonas.
Acked-by: Florian Fainelli <florian@openwrt.org>
>
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> ---
> arch/mips/bcm63xx/clk.c | 15 +++++++++++++++
> arch/mips/pci/pci-bcm63xx.c | 15 ++++++++++-----
> 2 files changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
> index dff79ab..89a5fb0 100644
> --- a/arch/mips/bcm63xx/clk.c
> +++ b/arch/mips/bcm63xx/clk.c
> @@ -253,6 +253,19 @@ static struct clk clk_ipsec = {
> };
>
> /*
> + * PCIe clock
> + */
> +
> +static void pcie_set(struct clk *clk, int enable)
> +{
> + bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable);
> +}
> +
> +static struct clk clk_pcie = {
> + .set = pcie_set,
> +};
> +
> +/*
> * Internal peripheral clock
> */
> static struct clk clk_periph = {
> @@ -313,6 +326,8 @@ struct clk *clk_get(struct device *dev, const char *id)
> return &clk_pcm;
> if (BCMCPU_IS_6368() && !strcmp(id, "ipsec"))
> return &clk_ipsec;
> + if (BCMCPU_IS_6328() && !strcmp(id, "pcie"))
> + return &clk_pcie;
> return ERR_PTR(-ENOENT);
> }
>
> diff --git a/arch/mips/pci/pci-bcm63xx.c b/arch/mips/pci/pci-bcm63xx.c
> index 8a48139..fa8c320 100644
> --- a/arch/mips/pci/pci-bcm63xx.c
> +++ b/arch/mips/pci/pci-bcm63xx.c
> @@ -11,6 +11,7 @@
> #include <linux/kernel.h>
> #include <linux/init.h>
> #include <linux/delay.h>
> +#include <linux/clk.h>
> #include <asm/bootinfo.h>
>
> #include "pci-bcm63xx.h"
> @@ -119,11 +120,6 @@ static void __init bcm63xx_reset_pcie(void)
> {
> u32 val;
>
> - /* enable clock */
> - val = bcm_perf_readl(PERF_CKCTL_REG);
> - val |= CKCTL_6328_PCIE_EN;
> - bcm_perf_writel(val, PERF_CKCTL_REG);
> -
> /* enable SERDES */
> val = bcm_misc_readl(MISC_SERDES_CTRL_REG);
> val |= SERDES_PCIE_EN | SERDES_PCIE_EXD_EN;
> @@ -150,10 +146,19 @@ static void __init bcm63xx_reset_pcie(void)
> mdelay(200);
> }
>
> +static struct clk *pcie_clk;
> +
> static int __init bcm63xx_register_pcie(void)
> {
> u32 val;
>
> + /* enable clock */
> + pcie_clk = clk_get(NULL, "pcie");
> + if (IS_ERR_OR_NULL(pcie_clk))
> + return -ENODEV;
> +
> + clk_prepare_enable(pcie_clk);
> +
> bcm63xx_reset_pcie();
>
> /* configure the PCIe bridge */
> --
> 1.7.2.5
>
prev parent reply other threads:[~2012-10-29 11:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-28 12:49 [PATCH] MIPS: BCM63XX: add and use a clock for PCIe Jonas Gorski
2012-10-29 11:10 ` Florian Fainelli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1396016.7LyuGEyaiC@flexo \
--to=florian@openwrt.org \
--cc=blogic@openwrt.org \
--cc=cernekee@gmail.com \
--cc=jonas.gorski@gmail.com \
--cc=linux-mips@linux-mips.org \
--cc=mbizon@freebox.fr \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.