From: Florian Fainelli <f.fainelli@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>, Kevin Cernekee <cernekee@gmail.com>
Cc: gregkh@linuxfoundation.org, jslaby@suse.cz, robh@kernel.org,
grant.likely@linaro.org, geert@linux-m68k.org, mbizon@freebox.fr,
jogo@openwrt.org, linux-mips@linux-mips.org,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH V2 4/9] Documentation: DT: Add entries for bcm63xx UART
Date: Mon, 20 Oct 2014 15:53:53 -0700 [thread overview]
Message-ID: <54459281.7050004@gmail.com> (raw)
In-Reply-To: <2100909.UrHPDWWSai@wuerfel>
On 10/20/2014 02:25 PM, Arnd Bergmann wrote:
> On Monday 20 October 2014 23:20:08 Arnd Bergmann wrote:
>>
>> In this example, the clock output name of the clock provider is
>> the same as the clock input of the consumer, that is almost always
>> a bug and would not be a good example at all.
>>
>>
>
> Ah, found the bug: the MIPS code is written to ignore the device
> and just look up a global clock name:
>
> struct clk *clk_get(struct device *dev, const char *id)
> {
> if (!strcmp(id, "enet0"))
> return &clk_enet0;
> if (!strcmp(id, "enet1"))
> return &clk_enet1;
> if (!strcmp(id, "enetsw"))
> return &clk_enetsw;
> if (!strcmp(id, "ephy"))
> return &clk_ephy;
> if (!strcmp(id, "usbh"))
> return &clk_usbh;
> if (!strcmp(id, "usbd"))
> return &clk_usbd;
> if (!strcmp(id, "spi"))
> return &clk_spi;
> if (!strcmp(id, "hsspi"))
> return &clk_hsspi;
> if (!strcmp(id, "xtm"))
> return &clk_xtm;
> if (!strcmp(id, "periph"))
> return &clk_periph;
> if ((BCMCPU_IS_3368() || BCMCPU_IS_6358()) && !strcmp(id, "pcm"))
> return &clk_pcm;
> if ((BCMCPU_IS_6362() || BCMCPU_IS_6368()) && !strcmp(id, "ipsec"))
> return &clk_ipsec;
> if ((BCMCPU_IS_6328() || BCMCPU_IS_6362()) && !strcmp(id, "pcie"))
> return &clk_pcie;
> return ERR_PTR(-ENOENT);
> }
>
> This should be changed to use the drivers/clk/clkdev.c lookup code if
> you want to share drivers between architectures.
For now, I suppose that s simple fix could be to use an anonymous clock
request when probed via DT. This code you quote dates from 2008 when
there was no clkdev in the kernel at all. So something like this would
probably do it for now:
diff --git a/drivers/tty/serial/bcm63xx_uart.c
b/drivers/tty/serial/bcm63xx_uart.c
index e0b87d507670..1b914b85dd31 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -819,7 +819,7 @@ static int bcm_uart_probe(struct platform_device *pdev)
if (!res_irq)
return -ENODEV;
- clk = clk_get(&pdev->dev, "periph");
+ clk = clk_get(&pdev->dev, pdev->dev.of_node ? NULL : "periph");
if (IS_ERR(clk))
return -ENODEV;
>
> In particular, the "enet0"/"enet1" clock name makes no sense -- the
> clock input name should be independent of the instance, aside from
> the question of which output of the provider it is wired up to.
>
> Arnd
>
next prev parent reply other threads:[~2014-10-20 22:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 20:53 [PATCH V2 0/9] bcm63xx_uart and of-serial updates Kevin Cernekee
2014-10-20 20:54 ` [PATCH V2 1/9] tty: serial: bcm63xx: Allow bcm63xx_uart to be built on other platforms Kevin Cernekee
2014-10-20 20:54 ` [PATCH V2 2/9] tty: serial: bcm63xx: Update the Kconfig help text Kevin Cernekee
2014-10-20 20:54 ` [PATCH V2 3/9] tty: serial: bcm63xx: Fix typo in MODULE_DESCRIPTION Kevin Cernekee
2014-10-20 20:54 ` [PATCH V2 4/9] Documentation: DT: Add entries for bcm63xx UART Kevin Cernekee
2014-10-20 21:20 ` Arnd Bergmann
2014-10-20 21:25 ` Arnd Bergmann
2014-10-20 22:53 ` Florian Fainelli [this message]
2014-10-21 5:49 ` Arnd Bergmann
2014-10-20 20:54 ` [PATCH V2 5/9] tty: serial: bcm63xx: Enable DT earlycon support Kevin Cernekee
2014-10-20 20:54 ` [PATCH V2 6/9] tty: serial: bcm63xx: Eliminate unnecessary request/release functions Kevin Cernekee
2014-10-20 20:54 ` [PATCH V2 7/9] tty: serial: of-serial: Suppress warnings if OF earlycon is invoked twice Kevin Cernekee
2014-10-20 20:54 ` [PATCH V2 8/9] tty: serial: of-serial: Allow OF earlycon to default to "on" Kevin Cernekee
2014-10-20 20:54 ` [PATCH V2 9/9] MAINTAINERS: Add entry for rp2 (Rocketport Express/Infinity) driver Kevin Cernekee
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=54459281.7050004@gmail.com \
--to=f.fainelli@gmail.com \
--cc=arnd@arndb.de \
--cc=cernekee@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jogo@openwrt.org \
--cc=jslaby@suse.cz \
--cc=linux-mips@linux-mips.org \
--cc=linux-serial@vger.kernel.org \
--cc=mbizon@freebox.fr \
--cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).