From a0dd005d1d9f4c3beab52086f3844ef9342d1e67 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 17 Feb 2008 10:35:15 +0000 Subject: [ARM] pxa: fix clock lookup to find specific device clocks Ensure that the clock lookup always finds an entry for a specific device and ID before it falls back to finding just by ID. This fixes a problem reported by Holger Schurig where the BTUART was assigned the wrong clock. Tested-by: Holger Schurig Signed-off-by: Russell King --- arch/arm/mach-pxa/clock.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c index 83ef5ecaf43..df5ae2710ab 100644 --- a/arch/arm/mach-pxa/clock.c +++ b/arch/arm/mach-pxa/clock.c @@ -23,18 +23,27 @@ static LIST_HEAD(clocks); static DEFINE_MUTEX(clocks_mutex); static DEFINE_SPINLOCK(clocks_lock); +static struct clk *clk_lookup(struct device *dev, const char *id) +{ + struct clk *p; + + list_for_each_entry(p, &clocks, node) + if (strcmp(id, p->name) == 0 && p->dev == dev) + return p; + + return NULL; +} + struct clk *clk_get(struct device *dev, const char *id) { struct clk *p, *clk = ERR_PTR(-ENOENT); mutex_lock(&clocks_mutex); - list_for_each_entry(p, &clocks, node) { - if (strcmp(id, p->name) == 0 && - (p->dev == NULL || p->dev == dev)) { - clk = p; - break; - } - } + p = clk_lookup(dev, id); + if (!p) + p = clk_lookup(NULL, id); + if (p) + clk = p; mutex_unlock(&clocks_mutex); return clk; -- cgit v1.2.3 From 59e8ce574445c5e7a65ec36f47a54803de704e96 Mon Sep 17 00:00:00 2001 From: Byron Bradley Date: Sun, 10 Feb 2008 22:31:09 +0100 Subject: [ARM] 4826/1: Orion: Register the RTC interrupt on the TS-209 The QNAP TS-209 has its RTC interrupt on GPIO 3. Setup this as an interrupt and pass it to the i2c_board_info. Signed-off-by: Byron Bradley Acked-by: Nicolas Pitre Signed-off-by: Russell King --- arch/arm/mach-orion/ts209-setup.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'arch') diff --git a/arch/arm/mach-orion/ts209-setup.c b/arch/arm/mach-orion/ts209-setup.c index 306dbcd1e37..b8cfe6813e9 100644 --- a/arch/arm/mach-orion/ts209-setup.c +++ b/arch/arm/mach-orion/ts209-setup.c @@ -192,9 +192,13 @@ static struct mv643xx_eth_platform_data qnap_ts209_eth_data = { /***************************************************************************** * RTC S35390A on I2C bus ****************************************************************************/ + +#define TS209_RTC_GPIO 3 + static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = { .driver_name = "rtc-s35390a", .addr = 0x30, + .irq = 0, }; /**************************************************************************** @@ -328,7 +332,18 @@ static void __init qnap_ts209_init(void) platform_add_devices(qnap_ts209_devices, ARRAY_SIZE(qnap_ts209_devices)); + + /* Get RTC IRQ and register the chip */ + if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) { + if (gpio_direction_input(TS209_RTC_GPIO) == 0) + qnap_ts209_i2c_rtc.irq = gpio_to_irq(TS209_RTC_GPIO); + else + gpio_free(TS209_RTC_GPIO); + } + if (qnap_ts209_i2c_rtc.irq == 0) + pr_warning("qnap_ts209_init: failed to get RTC IRQ\n"); i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1); + orion_eth_init(&qnap_ts209_eth_data); orion_sata_init(&qnap_ts209_sata_data); } -- cgit v1.2.3 From ea833f0b5a8afcc698c5ccb06237902c0e21e032 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Mon, 11 Feb 2008 16:53:15 +0100 Subject: [ARM] 4829/1: add .get method to pxa-cpufreq to silence a warning The .get method is needed for suspend/resume. Otherwise you get this in dmesg: cpufreq: suspend failed to assert current frequency is what timing core thinks it is. cpufreq: resume failed to assert current frequency is what timing core thinks it is. Signed-off-by: Holger Schurig Signed-off-by: Russell King --- arch/arm/mach-pxa/cpu-pxa.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/arm/mach-pxa/cpu-pxa.c b/arch/arm/mach-pxa/cpu-pxa.c index cbc583beedc..939a3867f77 100644 --- a/arch/arm/mach-pxa/cpu-pxa.c +++ b/arch/arm/mach-pxa/cpu-pxa.c @@ -134,7 +134,7 @@ static int pxa_set_target(struct cpufreq_policy *policy, struct cpufreq_frequency_table *pxa_freqs_table; pxa_freqs_t *pxa_freq_settings; struct cpufreq_freqs freqs; - int idx; + unsigned int idx; unsigned long flags; unsigned int unused, preset_mdrefr, postset_mdrefr; void *ramstart = phys_to_virt(0xa0000000); @@ -233,6 +233,11 @@ static int pxa_set_target(struct cpufreq_policy *policy, return 0; } +static unsigned int pxa_cpufreq_get(unsigned int cpu) +{ + return get_clk_frequency_khz(0); +} + static int pxa_cpufreq_init(struct cpufreq_policy *policy) { int i; @@ -269,6 +274,7 @@ static struct cpufreq_driver pxa_cpufreq_driver = { .verify = pxa_verify_policy, .target = pxa_set_target, .init = pxa_cpufreq_init, + .get = pxa_cpufreq_get, .name = "PXA25x", }; -- cgit v1.2.3