From: Michael Buesch <mb@bu3sch.de>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: netdev@vger.kernel.org, Felix Fietkau <nbd@openwrt.org>
Subject: Re: [PATCH 4/4][SSB] Implement ssb_cpu_clock()
Date: Mon, 6 Aug 2007 10:46:41 +0200 [thread overview]
Message-ID: <200708061046.41749.mb@bu3sch.de> (raw)
In-Reply-To: <20070805232129.GE13927@hall.aurel32.net>
On Monday 06 August 2007, Aurelien Jarno wrote:
> The patch below against 2.6.23-rc1-mm2 implements the ssb_cpu_clock()
> currently doing nothing, and export it. This function is needed to
> support the BCM947xx CPUs.
>
> It originally comes from the OpenWrt patches.
>
> Cc: Felix Fietkau <nbd@openwrt.org>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>
> --- a/drivers/ssb/driver_mipscore.c
> +++ b/drivers/ssb/driver_mipscore.c
> @@ -220,8 +220,37 @@
> extif_write32(extif, SSB_EXTIF_PROG_WAITCNT, tmp);
> }
>
> -static void ssb_cpu_clock(struct ssb_mipscore *mcore)
> +void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
> + u32 *pll_type, u32 *n, u32 *m)
> {
> + *pll_type = SSB_PLLTYPE_1;
> + *n = extif_read32(extif, SSB_EXTIF_CLOCK_N);
> + *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB);
> +}
The extif functions to driver_extif.c, please.
> +u32 ssb_cpu_clock(struct ssb_mipscore *mcore)
> +{
> + struct ssb_bus *bus = mcore->dev->bus;
> + u32 pll_type, n, m, rate = 0;
> +
> + if (bus->extif.dev) {
> + ssb_extif_get_clockcontrol(&bus->extif, &pll_type, &n, &m);
> + } else if (bus->chipco.dev) {
> + ssb_chipco_get_clockcpu(&bus->chipco, &pll_type, &n, &m);
> + } else
> + return 0;
> +
> + if ((pll_type == SSB_PLLTYPE_5) || (bus->chip_id == 0x5365)) {
> + rate = 200000000;
> + } else {
> + rate = ssb_calc_clock_rate(pll_type, n, m);
> + }
> +
> + if (pll_type == SSB_PLLTYPE_6) {
> + rate *= 2;
> + }
> +
> + return rate;
> }
>
> void ssb_mipscore_init(struct ssb_mipscore *mcore)
> --- a/drivers/ssb/main.c
> +++ b/drivers/ssb/main.c
> @@ -819,12 +819,12 @@
> u32 plltype;
> u32 clkctl_n, clkctl_m;
>
> - //TODO if EXTIF: PLLTYPE == 1, read n from clockcontrol_n, m from clockcontrol_sb
> -
> - if (bus->chipco.dev) {
> + if (bus->extif.dev)
> + ssb_extif_get_clockcontrol(&bus->extif, &plltype, &clkctl_n, &clkctl_m);
> + else if (bus->chipco.dev)
> ssb_chipco_get_clockcontrol(&bus->chipco, &plltype,
> &clkctl_n, &clkctl_m);
> - } else
> + else
> return 0;
>
> if (bus->chip_id == 0x5365) {
> --- a/include/linux/ssb/ssb_driver_extif.h
> +++ b/include/linux/ssb/ssb_driver_extif.h
> @@ -156,5 +156,6 @@
> /* watchdog */
> #define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */
>
> +extern void ssb_extif_get_clockcontrol(struct ssb_extif *, u32 *, u32 *, u32 *);
>
> #endif /* LINUX_SSB_EXTIFCORE_H_ */
> --- a/include/linux/ssb/ssb_driver_mips.h
> +++ b/include/linux/ssb/ssb_driver_mips.h
> @@ -26,6 +26,7 @@
> };
>
> extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
> +extern u32 ssb_cpu_clock(struct ssb_mipscore *mcore);
>
> extern unsigned int ssb_mips_irq(struct ssb_device *dev);
>
>
prev parent reply other threads:[~2007-08-06 8:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-05 23:21 [PATCH 4/4][SSB] Implement ssb_cpu_clock() Aurelien Jarno
2007-08-06 8:46 ` Michael Buesch [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=200708061046.41749.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=aurelien@aurel32.net \
--cc=nbd@openwrt.org \
--cc=netdev@vger.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).