From: Michael Buesch <mb@bu3sch.de>
To: Andrew Morton <akpm@linux-foundation.org>,
John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org,
Aurelien Jarno <aurelien@aurel32.net>,
Felix Fietkau <nbd@openwrt.org>
Subject: [PATCH] ssb-chipcommon: Add function to get processor clock
Date: Wed, 1 Aug 2007 00:11:56 +0200 [thread overview]
Message-ID: <200708010011.56753.mb@bu3sch.de> (raw)
From: Aurelien Jarno <aurelien@aurel32.net>
The patch below (against 2.6.23-rc1-mm1) adds a new function to get the
processor clock. It originally comes from the OpenWrt patches.
Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
--- a/drivers/ssb/driver_chipcommon.c 2007-07-14 21:05:44.000000000 +0200
+++ b/drivers/ssb/driver_chipcommon.c 2007-07-14 21:22:04.000000000 +0200
@@ -264,6 +264,30 @@
ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST);
}
+/* Get the processor clock */
+void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc,
+ u32 *plltype, u32 *n, u32 *m)
+{
+ *n = chipco_read32(cc, SSB_CHIPCO_CLOCK_N);
+ *plltype = (cc->capabilities & SSB_CHIPCO_CAP_PLLT);
+ switch (*plltype) {
+ case SSB_PLLTYPE_2:
+ case SSB_PLLTYPE_4:
+ case SSB_PLLTYPE_6:
+ case SSB_PLLTYPE_7:
+ *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_MIPS);
+ break;
+ case SSB_PLLTYPE_3:
+ /* 5350 uses m2 to control mips */
+ *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_M2);
+ break;
+ default:
+ *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_SB);
+ break;
+ }
+}
+
+/* Get the bus clock */
void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc,
u32 *plltype, u32 *n, u32 *m)
{
--- a/include/linux/ssb/ssb_driver_chipcommon.h 2007-07-14 21:05:44.000000000 +0200
+++ b/include/linux/ssb/ssb_driver_chipcommon.h 2007-07-14 21:17:28.000000000 +0200
@@ -364,6 +364,8 @@
extern void ssb_chipco_suspend(struct ssb_chipcommon *cc, pm_message_t state);
extern void ssb_chipco_resume(struct ssb_chipcommon *cc);
+extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc,
+ u32 *plltype, u32 *n, u32 *m);
extern void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc,
u32 *plltype, u32 *n, u32 *m);
extern void ssb_chipco_timing_init(struct ssb_chipcommon *cc,
--
Greetings Michael.
next reply other threads:[~2007-07-31 22:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-31 22:11 Michael Buesch [this message]
2007-08-01 22:06 ` [PATCH] ssb-chipcommon: Add function to get processor clock Andrew Morton
2007-08-01 22:09 ` Michael Buesch
2007-08-02 9:12 ` Aurelien Jarno
2007-08-02 9:40 ` Michael Buesch
2007-08-02 10:24 ` Aurelien Jarno
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=200708010011.56753.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=akpm@linux-foundation.org \
--cc=aurelien@aurel32.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=nbd@openwrt.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).