SUPERH platform development
 help / color / mirror / Atom feed
* Re: SH2a Write-back cache issue
From: Fabio Giovagnini @ 2011-11-22 14:21 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <201111221415.22367.andrea.baldini@spesonline.com>

Hi Federico, I think you could help Andrea about this issue.
Regard

Il giorno mar, 22/11/2011 alle 14.15 +0100, Andrea Baldini ha scritto:
> Hi,
> 
> I'm working on a sh7203 board and I'm currently using a 2.6.28 kernel with a 
> write-back cache mode configuration.
> When this configuration is set I got some issues when the flush_icache_range is 
> involved.
> 
> /* O-Cache writeback */
> for (way = 0; way < 4; way++) {
> unsigned long data =  ctrl_inl(CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
> 	if ((data & CACHE_PHYSADDR_MASK) = (v & CACHE_PHYSADDR_MASK)) {
> 		data &= ~SH_CACHE_UPDATED;
> 		ctrl_outl(data, CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
> 	}
> }
> 
> When the O-cache writeback is performed all system interrupts are missed, 
> including the timer one.
> This occurs, for instance, when a flat binary is loaded in memory ( 
> load_flat_file() ) or when a signal is handled ( when setting up a frame ).
> 
> This is an unacceptable behaviour for the system. 
> A workaround is setting a write-through configuration to the kernel and flushing 
> just the instruction cache entries.
> 
> I've seen the recent kernel releases but it seems this part hasn't been 
> modified yet.
> Anyway i tried a 2.6.35 kernel version some time ago and i got the same 
> problems.
> 
> Is anybody here working on this issue?
> Is it possible to use the write-back configuration?
> 
> Regards
> 
> Andrea
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Fabio Giovagnini

Aurion s.r.l.
P.iva 00885711200
cell. +39.335.8350919
Tel. +39 051.082.69.65
Fax. +39 051.082.14.49
skype: aurion.giovagnini



^ permalink raw reply

* Re: [PATCH] ARM: mach-shmobile: AG5EVM GIC Sparse IRQ fix
From: Rob Herring @ 2011-11-22 14:12 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <20111122063140.31045.57736.sendpatchset@w520>

On 11/22/2011 12:31 AM, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> Fix IRQ support on the AG5EVM board. The sh73a0 and the AG5EVM
> board make use of the ARM GIC hardware block as main interrupt
> controller. The following commit changed the default behaviour
> for non-device tree platforms and broke AG5EVM irq support:
> 
> f37a53c ARM: gic: fix irq_alloc_descs handling for sparse irq
> 
> Without this fix the following warning triggers at boot:
> 
> NR_IRQS:1024 nr_irqs:1024 1024
> ------------[ cut here ]------------
> WARNING: at arch/arm/common/gic.c:607 gic_init+0x90/0x2e4()
> Cannot allocate irq_descs @ IRQ16, assuming pre-allocated
> [<c000c868>] (unwind_backtrace+0x0/0xe0) from [<c001857c>] (warn_slowpath_commo)
> [<c001857c>] (warn_slowpath_common+0x48/0x60) from [<c00185d8>] (warn_slowpath_)
> [<c00185d8>] (warn_slowpath_fmt+0x2c/0x3c) from [<c029ee08>] (gic_init+0x90/0x2)
> [<c029ee08>] (gic_init+0x90/0x2e4) from [<c029f278>] (sh73a0_init_irq+0x30/0x18)
> [<c029f278>] (sh73a0_init_irq+0x30/0x184) from [<c029c0b4>] (init_IRQ+0x14/0x1c)
> [<c029c0b4>] (init_IRQ+0x14/0x1c) from [<c029a5cc>] (start_kernel+0x15c/0x2b8)
> [<c029a5cc>] (start_kernel+0x15c/0x2b8) from [<4000803c>] (0x4000803c)
> ---[ end trace 1b75b31a2719ed1c ]---
> 
> With this fix applied interrupts work as expected.
> 

They work without the fix as well, right?

> Signed-off-by: Magnus Damm <damm@opensource.se>
> ---

For both patches:

Acked-by: Rob Herring <rob.herring@calxeda.com>

> 
>  arch/arm/mach-shmobile/board-ag5evm.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- 0001/arch/arm/mach-shmobile/board-ag5evm.c
> +++ work/arch/arm/mach-shmobile/board-ag5evm.c	2011-11-17 18:35:51.000000000 +0900
> @@ -607,6 +607,7 @@ struct sys_timer ag5evm_timer = {
>  
>  MACHINE_START(AG5EVM, "ag5evm")
>  	.map_io		= ag5evm_map_io,
> +	.nr_irqs	= NR_IRQS_LEGACY,
>  	.init_irq	= sh73a0_init_irq,
>  	.handle_irq	= shmobile_handle_irq_gic,
>  	.init_machine	= ag5evm_init,


^ permalink raw reply

* SH2a Write-back cache issue
From: Andrea Baldini @ 2011-11-22 13:15 UTC (permalink / raw)
  To: linux-sh

Hi,

I'm working on a sh7203 board and I'm currently using a 2.6.28 kernel with a 
write-back cache mode configuration.
When this configuration is set I got some issues when the flush_icache_range is 
involved.

/* O-Cache writeback */
for (way = 0; way < 4; way++) {
unsigned long data =  ctrl_inl(CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
	if ((data & CACHE_PHYSADDR_MASK) = (v & CACHE_PHYSADDR_MASK)) {
		data &= ~SH_CACHE_UPDATED;
		ctrl_outl(data, CACHE_OC_ADDRESS_ARRAY | addr | (way << 11));
	}
}

When the O-cache writeback is performed all system interrupts are missed, 
including the timer one.
This occurs, for instance, when a flat binary is loaded in memory ( 
load_flat_file() ) or when a signal is handled ( when setting up a frame ).

This is an unacceptable behaviour for the system. 
A workaround is setting a write-through configuration to the kernel and flushing 
just the instruction cache entries.

I've seen the recent kernel releases but it seems this part hasn't been 
modified yet.
Anyway i tried a 2.6.35 kernel version some time ago and i got the same 
problems.

Is anybody here working on this issue?
Is it possible to use the write-back configuration?

Regards

Andrea

^ permalink raw reply

* Re: Dreamcast build broken
From: Paul Cercueil @ 2011-11-22 12:02 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <4EC81660.3010109@gmail.com>

Hi,

The commit which breaks the dreamcast build is the commit 
37b7a97884ba64bf7d403351ac2a9476ab4f1bba :
sh: machvec IO death.

Regards,
Paul

^ permalink raw reply

* Re: [PATCH] ARM: Kota2 mach-type update fix
From: Magnus Damm @ 2011-11-22 11:41 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111122092615.GA26411@linux-sh.org>

On Tue, Nov 22, 2011 at 6:26 PM, Paul Mundt <lethal@linux-sh.org> wrote:
> On Tue, Nov 22, 2011 at 03:08:57PM +0900, Magnus Damm wrote:
>> From: Magnus Damm <damm@opensource.se>
>>
>> This patch adds kota2 to the in-kernel ARM mach-type file.
>>
>> Basic board support is included in 3.2-rc and the mach-type
>> has been registered in the ARM machine repository as
>>
>> 3616 Renesas SH-Mobile kota2.x Board kota2 Yusuke Goda mainlined
>>
>> The file arch/arm/tools/mach-types is however missing Kota2
>> which makes build of sh73a0 based boards fail with:
>>
>> arch/arm/mach-shmobile/platsmp.c: In function 'shmobile_smp_get_core_count':
>> arch/arm/mach-shmobile/platsmp.c:28:2: error: implicit declaration of function 'machine_is_kota2'
>> make[1]: *** [arch/arm/mach-shmobile/platsmp.o] Error 1
>>
>> arch/arm/mach-shmobile/board-kota2.c:448:136: error: 'MACH_TYPE_KOTA2' undeclared here (not in a function)
>> make[1]: *** [arch/arm/mach-shmobile/board-kota2.o] Error 1
>> make: *** [arch/arm/mach-shmobile] Error 2
>>
>> Signed-off-by: Magnus Damm <damm@opensource.se>
>> ---
>>
>>  I propose that Paul Mundt merges this patch together with other
>>  SH-Mobile ARM related fixes.
>>
> Err, no. I'm not patching machine-generated files which precisely say not
> to patch them at the top of the file. If there is a missing definition
> for an upstream board then the file needs to be regenerated with the new
> definitions, plain and simple.

Following the comment sure sounds like a good idea, but according to
the git logs people seem to update the file:

1d08fd9 Update Nook Color machine 3284 to common Encore name

Russell, do you mind if we update the mach-type file to include Kota2?
It's already registered via the web interface.

Cheers,

/ magnus

^ permalink raw reply

* sh-sci CTS problem
From: phil.edworthy @ 2011-11-22 10:32 UTC (permalink / raw)
  To: linux-sh

Hi Yoshii-san, Paul,

Commit 4480a688 is a problem for some devices. For example, on the SH7203 
some serial ports have RTS/CTS, but others don't.

I guess the right thing to do is add an extra field to struct 
plat_sci_port to indicate support for RTS/CTS?

Phil

^ permalink raw reply

* Re: [PATCH] ARM: Kota2 mach-type update fix
From: Paul Mundt @ 2011-11-22  9:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111122060857.23951.50598.sendpatchset@w520>

On Tue, Nov 22, 2011 at 03:08:57PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> This patch adds kota2 to the in-kernel ARM mach-type file.
> 
> Basic board support is included in 3.2-rc and the mach-type
> has been registered in the ARM machine repository as
> 
> 3616 Renesas SH-Mobile kota2.x Board kota2 Yusuke Goda mainlined
> 
> The file arch/arm/tools/mach-types is however missing Kota2
> which makes build of sh73a0 based boards fail with:
> 
> arch/arm/mach-shmobile/platsmp.c: In function 'shmobile_smp_get_core_count':
> arch/arm/mach-shmobile/platsmp.c:28:2: error: implicit declaration of function 'machine_is_kota2'
> make[1]: *** [arch/arm/mach-shmobile/platsmp.o] Error 1
> 
> arch/arm/mach-shmobile/board-kota2.c:448:136: error: 'MACH_TYPE_KOTA2' undeclared here (not in a function)
> make[1]: *** [arch/arm/mach-shmobile/board-kota2.o] Error 1
> make: *** [arch/arm/mach-shmobile] Error 2
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>
> ---
> 
>  I propose that Paul Mundt merges this patch together with other
>  SH-Mobile ARM related fixes.
> 
Err, no. I'm not patching machine-generated files which precisely say not
to patch them at the top of the file. If there is a missing definition
for an upstream board then the file needs to be regenerated with the new
definitions, plain and simple.

^ permalink raw reply

* Re: [PATCH 0/2] sh: bugfix: sh7724/sh7723 boot on paul/hwblk
From: kuninori.morimoto.gx @ 2011-11-22  9:04 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <87zkfoyi9l.wl%kuninori.morimoto.gx@renesas.com>

[-- Attachment #1: Type: text/plain, Size: 2073 bytes --]


Hi Guennadi

Thank you for your reply

> > Kuninori Morimoto (2):
> >       sh: sh7724.h: bugfix: remove unused clock index
> >       sh: sh7723.h: bugfix: remove unused clock index
> > 
> > Now it doesn't use hwblk, but it still have un-needed HWBLK_xxx index
> > which are not set by SH_CLK_MSTP32() macro.
> > So, sh7724/sh7723 boot will be crash, because clk.enable_reg == NULL on such clocks.
> 
> Thanks for the patches! It is certainly good to remove unused code / data, 
> but could you please explain a bit what exactly crashes you observed and 
> how you triggered them? I tested my patches on ecovec and migor without 
> any problems.
> 
> As for sh7722 - if you tell me, how to reproduce the problem, I can either 
> test your patch, removing those unused HWBLK_* indices, I could prepare 
> one myself.

Hmm... strange.
my kernel will deadlock on clk->disable() from clk_late_init().
The reason was above.

# clk->disable() run NULL pointer, but it was under spin lock.
# I guess Oops print will locked by scif spinlock (?), not sure

I can re-produce this issue by below with attached ecovec .config.

---- 8< -------------------
my branch is

# git checkout paul/sh-latest  (19d7ca2998e095086869318dd2ad966952f5ac82)
# git merge paul/sh/hwblk      (cfc806a7ee38e68a9363584dd2b00421fda6dfed)

sh-latest has some bugfix patches.

--- 8< --------------------
This is my kernel log.
deadlock will happen on clk_late_init().

...
sh_mobile_sdhi sh_mobile_sdhi.1: mmc1 base at 0x04cf0000 clock rate 83 MHz      
sh_tmu sh_tmu.0: kept as earlytimer                                             
sh_tmu sh_tmu.1: kept as earlytimer                                             
heartbeat: version 0.1.2 loaded                                                 
TCP cubic registered                                                            
NET: Registered protocol family 17                                              
rtc-rs5c372 1-0032: setting system clock to 2062-08-02 15:35:09 UTC (2921758509)

--- 8< --------------------

Best regards
---
Kuninori Morimoto

[-- Attachment #2: ecovec-3.2.config.gz --]
[-- Type: application/zip, Size: 10898 bytes --]

^ permalink raw reply

* Re: [PATCH 0/2] sh: bugfix: sh7724/sh7723 boot on paul/hwblk
From: Guennadi Liakhovetski @ 2011-11-22  8:26 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <87zkfoyi9l.wl%kuninori.morimoto.gx@renesas.com>

Hi Morimoto-san

On Mon, 21 Nov 2011, Kuninori Morimoto wrote:

> 
> Hi Paul
> Cc Guennadi
> 
> These are bugfix patches for sh7724/sh7723 boot on paul/hwblk branch
> 
> Kuninori Morimoto (2):
>       sh: sh7724.h: bugfix: remove unused clock index
>       sh: sh7723.h: bugfix: remove unused clock index
> 
> Now it doesn't use hwblk, but it still have un-needed HWBLK_xxx index
> which are not set by SH_CLK_MSTP32() macro.
> So, sh7724/sh7723 boot will be crash, because clk.enable_reg = NULL on such clocks.

Thanks for the patches! It is certainly good to remove unused code / data, 
but could you please explain a bit what exactly crashes you observed and 
how you triggered them? I tested my patches on ecovec and migor without 
any problems.

As for sh7722 - if you tell me, how to reproduce the problem, I can either 
test your patch, removing those unused HWBLK_* indices, I could prepare 
one myself.

Thanks
Guennadi

> I tested it on Ecovec (sh7724) and ALGO (sh7723) board.
> I don't have sh7722 board now.
> 
> Best regards
> ---
> Kuninori Morimoto

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply

* [PATCH] ARM: mach-shmobile: Kota2 TPU LED platform data
From: Magnus Damm @ 2011-11-22  6:44 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <20110829035011.28202.37748.sendpatchset@rxone.opensource.se>

From: Magnus Damm <damm@opensource.se>

This patch updates the Kota2 board support code to
use the recently merged TPU LED driver whenever
possible.

The sh73a0 SoC has 5 TPU hardware blocks each with
4 timer channels which in theory allows a total of
20 LEDs to be controlled by "leds-renesas-tpu"
driver instances. The Kota2 board has 4 LEDs connected
to GPIO pins that also come with TPU pin functions, so
this patch ties up these 4 LEDS and leaves the remaining
3 LEDS for the GPIO based LED driver.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Based on earlier submitted patch
 "[PATCH] ARM: mach-shmobile: Kota2 TPU LED support V2"

 arch/arm/mach-shmobile/board-kota2.c  |  122 +++++++++++++++++++++++++++++++--
 arch/arm/mach-shmobile/clock-sh73a0.c |   16 ++++
 2 files changed, 134 insertions(+), 4 deletions(-)

--- 0005/arch/arm/mach-shmobile/board-kota2.c
+++ work/arch/arm/mach-shmobile/board-kota2.c	2011-11-22 15:42:09.000000000 +0900
@@ -33,6 +33,7 @@
 #include <linux/input/sh_keysc.h>
 #include <linux/gpio_keys.h>
 #include <linux/leds.h>
+#include <linux/platform_data/leds-renesas-tpu.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/sh_mmcif.h>
 #include <linux/mfd/tmio.h>
@@ -157,10 +158,6 @@ static struct platform_device gpio_keys_
 #define GPIO_LED(n, g) { .name = n, .gpio = g }
 
 static struct gpio_led gpio_leds[] = {
-	GPIO_LED("V2513", GPIO_PORT153), /* PORT153 [TPU1T02] -> V2513 */
-	GPIO_LED("V2514", GPIO_PORT199), /* PORT199 [TPU4TO1] -> V2514 */
-	GPIO_LED("V2515", GPIO_PORT197), /* PORT197 [TPU2TO1] -> V2515 */
-	GPIO_LED("KEYLED", GPIO_PORT163), /* PORT163 [TPU3TO0] -> KEYLED */
 	GPIO_LED("G", GPIO_PORT20), /* PORT20 [GPO0] -> LED7 -> "G" */
 	GPIO_LED("H", GPIO_PORT21), /* PORT21 [GPO1] -> LED8 -> "H" */
 	GPIO_LED("J", GPIO_PORT22), /* PORT22 [GPO2] -> LED9 -> "J" */
@@ -179,6 +176,119 @@ static struct platform_device gpio_leds_
 	},
 };
 
+/* TPU LED */
+static struct led_renesas_tpu_config led_renesas_tpu12_pdata = {
+	.name		= "V2513",
+	.pin_gpio_fn	= GPIO_FN_TPU1TO2,
+	.pin_gpio	= GPIO_PORT153,
+	.channel_offset = 0x90,
+	.timer_bit = 2,
+	.max_brightness = 1000,
+};
+
+static struct resource tpu12_resources[] = {
+	[0] = {
+		.name	= "TPU12",
+		.start	= 0xe6610090,
+		.end	= 0xe66100b5,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device leds_tpu12_device = {
+	.name = "leds-renesas-tpu",
+	.id = 12,
+	.dev = {
+		.platform_data  = &led_renesas_tpu12_pdata,
+	},
+	.num_resources	= ARRAY_SIZE(tpu12_resources),
+	.resource	= tpu12_resources,
+};
+
+static struct led_renesas_tpu_config led_renesas_tpu41_pdata = {
+	.name		= "V2514",
+	.pin_gpio_fn	= GPIO_FN_TPU4TO1,
+	.pin_gpio	= GPIO_PORT199,
+	.channel_offset = 0x50,
+	.timer_bit = 1,
+	.max_brightness = 1000,
+};
+
+static struct resource tpu41_resources[] = {
+	[0] = {
+		.name	= "TPU41",
+		.start	= 0xe6640050,
+		.end	= 0xe6640075,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device leds_tpu41_device = {
+	.name = "leds-renesas-tpu",
+	.id = 41,
+	.dev = {
+		.platform_data  = &led_renesas_tpu41_pdata,
+	},
+	.num_resources	= ARRAY_SIZE(tpu41_resources),
+	.resource	= tpu41_resources,
+};
+
+static struct led_renesas_tpu_config led_renesas_tpu21_pdata = {
+	.name		= "V2515",
+	.pin_gpio_fn	= GPIO_FN_TPU2TO1,
+	.pin_gpio	= GPIO_PORT197,
+	.channel_offset = 0x50,
+	.timer_bit = 1,
+	.max_brightness = 1000,
+};
+
+static struct resource tpu21_resources[] = {
+	[0] = {
+		.name	= "TPU21",
+		.start	= 0xe6620050,
+		.end	= 0xe6620075,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device leds_tpu21_device = {
+	.name = "leds-renesas-tpu",
+	.id = 21,
+	.dev = {
+		.platform_data  = &led_renesas_tpu21_pdata,
+	},
+	.num_resources	= ARRAY_SIZE(tpu21_resources),
+	.resource	= tpu21_resources,
+};
+
+static struct led_renesas_tpu_config led_renesas_tpu30_pdata = {
+	.name		= "KEYLED",
+	.pin_gpio_fn	= GPIO_FN_TPU3TO0,
+	.pin_gpio	= GPIO_PORT163,
+	.channel_offset = 0x10,
+	.timer_bit = 0,
+	.max_brightness = 1000,
+};
+
+static struct resource tpu30_resources[] = {
+	[0] = {
+		.name	= "TPU30",
+		.start	= 0xe6630010,
+		.end	= 0xe6630035,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device leds_tpu30_device = {
+	.name = "leds-renesas-tpu",
+	.id = 30,
+	.dev = {
+		.platform_data  = &led_renesas_tpu30_pdata,
+	},
+	.num_resources	= ARRAY_SIZE(tpu30_resources),
+	.resource	= tpu30_resources,
+};
+
 /* MMCIF */
 static struct resource mmcif_resources[] = {
 	[0] = {
@@ -291,6 +401,10 @@ static struct platform_device *kota2_dev
 	&keysc_device,
 	&gpio_keys_device,
 	&gpio_leds_device,
+	&leds_tpu12_device,
+	&leds_tpu41_device,
+	&leds_tpu21_device,
+	&leds_tpu30_device,
 	&mmcif_device,
 	&sdhi0_device,
 	&sdhi1_device,
--- 0004/arch/arm/mach-shmobile/clock-sh73a0.c
+++ work/arch/arm/mach-shmobile/clock-sh73a0.c	2011-11-22 15:38:14.000000000 +0900
@@ -113,6 +113,12 @@ static struct clk main_clk = {
 	.ops		= &main_clk_ops,
 };
 
+/* Divide Main clock by two */
+static struct clk main_div2_clk = {
+	.ops		= &div2_clk_ops,
+	.parent		= &main_clk,
+};
+
 /* PLL0, PLL1, PLL2, PLL3 */
 static unsigned long pll_recalc(struct clk *clk)
 {
@@ -181,6 +187,7 @@ static struct clk *main_clks[] = {
 	&extal1_div2_clk,
 	&extal2_div2_clk,
 	&main_clk,
+	&main_div2_clk,
 	&pll0_clk,
 	&pll1_clk,
 	&pll2_clk,
@@ -268,6 +275,7 @@ enum { MSTP001,
 	MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
 	MSTP331, MSTP329, MSTP325, MSTP323, MSTP318,
 	MSTP314, MSTP313, MSTP312, MSTP311,
+	MSTP303, MSTP302, MSTP301, MSTP300,
 	MSTP411, MSTP410, MSTP403,
 	MSTP_NR };
 
@@ -301,6 +309,10 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */
 	[MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */
 	[MSTP311] = MSTP(&div6_clks[DIV6_SDHI2], SMSTPCR3, 11, 0), /* SDHI2 */
+	[MSTP303] = MSTP(&main_div2_clk, SMSTPCR3, 3, 0), /* TPU1 */
+	[MSTP302] = MSTP(&main_div2_clk, SMSTPCR3, 2, 0), /* TPU2 */
+	[MSTP301] = MSTP(&main_div2_clk, SMSTPCR3, 1, 0), /* TPU3 */
+	[MSTP300] = MSTP(&main_div2_clk, SMSTPCR3, 0, 0), /* TPU4 */
 	[MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */
 	[MSTP410] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 10, 0), /* IIC4 */
 	[MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
@@ -350,6 +362,10 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
 	CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */
 	CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */
+	CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */
+	CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */
+	CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */
+	CLKDEV_DEV_ID("leds-renesas-tpu.41", &mstp_clks[MSTP300]), /* TPU4 */
 	CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */
 	CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */
 	CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */

^ permalink raw reply

* [PATCH] ARM: mach-shmobile: AG5EVM GIC Sparse IRQ fix
From: Magnus Damm @ 2011-11-22  6:31 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

Fix IRQ support on the AG5EVM board. The sh73a0 and the AG5EVM
board make use of the ARM GIC hardware block as main interrupt
controller. The following commit changed the default behaviour
for non-device tree platforms and broke AG5EVM irq support:

f37a53c ARM: gic: fix irq_alloc_descs handling for sparse irq

Without this fix the following warning triggers at boot:

NR_IRQS:1024 nr_irqs:1024 1024
------------[ cut here ]------------
WARNING: at arch/arm/common/gic.c:607 gic_init+0x90/0x2e4()
Cannot allocate irq_descs @ IRQ16, assuming pre-allocated
[<c000c868>] (unwind_backtrace+0x0/0xe0) from [<c001857c>] (warn_slowpath_commo)
[<c001857c>] (warn_slowpath_common+0x48/0x60) from [<c00185d8>] (warn_slowpath_)
[<c00185d8>] (warn_slowpath_fmt+0x2c/0x3c) from [<c029ee08>] (gic_init+0x90/0x2)
[<c029ee08>] (gic_init+0x90/0x2e4) from [<c029f278>] (sh73a0_init_irq+0x30/0x18)
[<c029f278>] (sh73a0_init_irq+0x30/0x184) from [<c029c0b4>] (init_IRQ+0x14/0x1c)
[<c029c0b4>] (init_IRQ+0x14/0x1c) from [<c029a5cc>] (start_kernel+0x15c/0x2b8)
[<c029a5cc>] (start_kernel+0x15c/0x2b8) from [<4000803c>] (0x4000803c)
---[ end trace 1b75b31a2719ed1c ]---

With this fix applied interrupts work as expected.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 arch/arm/mach-shmobile/board-ag5evm.c |    1 +
 1 file changed, 1 insertion(+)

--- 0001/arch/arm/mach-shmobile/board-ag5evm.c
+++ work/arch/arm/mach-shmobile/board-ag5evm.c	2011-11-17 18:35:51.000000000 +0900
@@ -607,6 +607,7 @@ struct sys_timer ag5evm_timer = {
 
 MACHINE_START(AG5EVM, "ag5evm")
 	.map_io		= ag5evm_map_io,
+	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= sh73a0_init_irq,
 	.handle_irq	= shmobile_handle_irq_gic,
 	.init_machine	= ag5evm_init,

^ permalink raw reply

* [PATCH] ARM: mach-shmobile: Kota2 GIC Sparse IRQ fix
From: Magnus Damm @ 2011-11-22  6:29 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

Fix IRQ support on the Kota2 board. The sh73a0 and the Kota2
board make use of the ARM GIC hardware block as main interrupt
controller. The following commit changed the default behaviour
for non-device tree platforms and broke Kota2 irq support:

f37a53c ARM: gic: fix irq_alloc_descs handling for sparse irq

Without this fix the following warning triggers at boot:

NR_IRQS:1024 nr_irqs:1024 1024
------------[ cut here ]------------
WARNING: at arch/arm/common/gic.c:607 gic_init+0x90/0x2e4()
Cannot allocate irq_descs @ IRQ16, assuming pre-allocated
[<c000c868>] (unwind_backtrace+0x0/0xe0) from [<c001857c>] (warn_slowpath_commo)
[<c001857c>] (warn_slowpath_common+0x48/0x60) from [<c00185d8>] (warn_slowpath_)
[<c00185d8>] (warn_slowpath_fmt+0x2c/0x3c) from [<c029ee08>] (gic_init+0x90/0x2)
[<c029ee08>] (gic_init+0x90/0x2e4) from [<c029f278>] (sh73a0_init_irq+0x30/0x18)
[<c029f278>] (sh73a0_init_irq+0x30/0x184) from [<c029c0b4>] (init_IRQ+0x14/0x1c)
[<c029c0b4>] (init_IRQ+0x14/0x1c) from [<c029a5cc>] (start_kernel+0x15c/0x2b8)
[<c029a5cc>] (start_kernel+0x15c/0x2b8) from [<4000803c>] (0x4000803c)
---[ end trace 1b75b31a2719ed1c ]---

With this fix applied interrupts work as expected.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 arch/arm/mach-shmobile/board-kota2.c |    1 +
 1 file changed, 1 insertion(+)

--- 0003/arch/arm/mach-shmobile/board-kota2.c
+++ work/arch/arm/mach-shmobile/board-kota2.c	2011-11-17 18:34:21.000000000 +0900
@@ -435,6 +435,7 @@ struct sys_timer kota2_timer = {
 
 MACHINE_START(KOTA2, "kota2")
 	.map_io		= kota2_map_io,
+	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= sh73a0_init_irq,
 	.handle_irq	= shmobile_handle_irq_gic,
 	.init_machine	= kota2_init,

^ permalink raw reply

* [PATCH] ARM: mach-shmobile: AG5EVM/Kota2 external Ethernet fix
From: Magnus Damm @ 2011-11-22  6:23 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

Keep the ZB clock enabled on sh73a0 to allow the BSC
to access external peripherals hooked up to CS signals.

This is needed to unbreak Ethernet support on sh73a0 boards
such as AG5EVM and Kota2 together with the following patch:

 794d78f drivers: sh: late disabling of clocks V2

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 arch/arm/mach-shmobile/clock-sh73a0.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 0001/arch/arm/mach-shmobile/clock-sh73a0.c
+++ work/arch/arm/mach-shmobile/clock-sh73a0.c	2011-08-22 14:31:42.000000000 +0900
@@ -243,7 +243,7 @@ static struct clk div6_clks[DIV6_NR] = {
 	[DIV6_VCK1] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR1, 0),
 	[DIV6_VCK2] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR2, 0),
 	[DIV6_VCK3] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR3, 0),
-	[DIV6_ZB1] = SH_CLK_DIV6(&pll1_div2_clk, ZBCKCR, 0),
+	[DIV6_ZB1] = SH_CLK_DIV6(&pll1_div2_clk, ZBCKCR, CLK_ENABLE_ON_INIT),
 	[DIV6_FLCTL] = SH_CLK_DIV6(&pll1_div2_clk, FLCKCR, 0),
 	[DIV6_SDHI0] = SH_CLK_DIV6(&pll1_div2_clk, SD0CKCR, 0),
 	[DIV6_SDHI1] = SH_CLK_DIV6(&pll1_div2_clk, SD1CKCR, 0),

^ permalink raw reply

* [PATCH] ARM: mach-shmobile: Kota2 PINT fix
From: Magnus Damm @ 2011-11-22  6:15 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

Support PINT on sh73a0 and Kota2 using INTC PINT macros.

With this patch applied the Kota2 ethernet is handled
through one of the chained sh73a0 PINT interrupt controllers.

sh73a0 PINT support is included in 3.2-rc but the Kota2 board
code does not make use of this shared code base without this
patch. Without this patch kota2 on-board ethernet is broken.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 arch/arm/mach-shmobile/board-kota2.c |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

--- 0001/arch/arm/mach-shmobile/board-kota2.c
+++ work/arch/arm/mach-shmobile/board-kota2.c	2011-11-14 17:08:42.000000000 +0900
@@ -55,7 +55,7 @@ static struct resource smsc9220_resource
 		.flags		= IORESOURCE_MEM,
 	},
 	[1] = {
-		.start		= gic_spi(33), /* PINTA2 @ PORT144 */
+		.start		= SH73A0_PINT0_IRQ(2), /* PINTA2 */
 		.flags		= IORESOURCE_IRQ,
 	},
 };
@@ -310,18 +310,6 @@ static void __init kota2_map_io(void)
 	shmobile_setup_console();
 }
 
-#define PINTER0A	0xe69000a0
-#define PINTCR0A	0xe69000b0
-
-void __init kota2_init_irq(void)
-{
-	sh73a0_init_irq();
-
-	/* setup PINT: enable PINTA2 as active low */
-	__raw_writel(1 << 29, PINTER0A);
-	__raw_writew(2 << 10, PINTCR0A);
-}
-
 static void __init kota2_init(void)
 {
 	sh73a0_pinmux_init();
@@ -440,7 +428,7 @@ struct sys_timer kota2_timer = {
 
 MACHINE_START(KOTA2, "kota2")
 	.map_io		= kota2_map_io,
-	.init_irq	= kota2_init_irq,
+	.init_irq	= sh73a0_init_irq,
 	.handle_irq	= shmobile_handle_irq_gic,
 	.init_machine	= kota2_init,
 	.timer		= &kota2_timer,

^ permalink raw reply

* [PATCH] ARM: Kota2 mach-type update fix
From: Magnus Damm @ 2011-11-22  6:08 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

This patch adds kota2 to the in-kernel ARM mach-type file.

Basic board support is included in 3.2-rc and the mach-type
has been registered in the ARM machine repository as

3616 Renesas SH-Mobile kota2.x Board kota2 Yusuke Goda mainlined

The file arch/arm/tools/mach-types is however missing Kota2
which makes build of sh73a0 based boards fail with:

arch/arm/mach-shmobile/platsmp.c: In function 'shmobile_smp_get_core_count':
arch/arm/mach-shmobile/platsmp.c:28:2: error: implicit declaration of function 'machine_is_kota2'
make[1]: *** [arch/arm/mach-shmobile/platsmp.o] Error 1

arch/arm/mach-shmobile/board-kota2.c:448:136: error: 'MACH_TYPE_KOTA2' undeclared here (not in a function)
make[1]: *** [arch/arm/mach-shmobile/board-kota2.o] Error 1
make: *** [arch/arm/mach-shmobile] Error 2

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 I propose that Paul Mundt merges this patch together with other
 SH-Mobile ARM related fixes.

 arch/arm/tools/mach-types |    1 +
 1 file changed, 1 insertion(+)

--- 0001/arch/arm/tools/mach-types
+++ work/arch/arm/tools/mach-types	2011-11-14 16:55:38.000000000 +0900
@@ -1123,5 +1123,6 @@ blissc			MACH_BLISSC		BLISSC			3491
 thales_adc		MACH_THALES_ADC		THALES_ADC		3492
 ubisys_p9d_evp		MACH_UBISYS_P9D_EVP	UBISYS_P9D_EVP		3493
 atdgp318		MACH_ATDGP318		ATDGP318		3494
+kota2			MACH_KOTA2		KOTA2			3616
 smdk4212		MACH_SMDK4212		SMDK4212		3638
 smdk4412		MACH_SMDK4412		SMDK4412		3765

^ permalink raw reply

* [RFC][PATCH] sh: setup clock parent from current register value
From: Kuninori Morimoto @ 2011-11-22  5:33 UTC (permalink / raw)
  To: linux-sh

Some clocks can select its parent clock by CPG register.
But it might have been modified by boot-loader or something.
This patch removed fixed initial parent clock,
and setup it from their current register settings.
It works on div6 reparent clocks for now.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/clock-sh7372.c  |    6 ++--
 arch/sh/kernel/cpu/sh4a/clock-sh7724.c |    4 +-
 drivers/sh/clk/cpg.c                   |   35 ++++++++++++++++++++++++++++++++
 include/linux/sh_clk.h                 |    9 +++++--
 4 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 6697592..6bdfabf 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -411,11 +411,11 @@ static struct clk *fsibckcr_parent[] = {
 };
 
 static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
-	[DIV6_HDMI] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, HDMICKCR, 0,
+	[DIV6_HDMI] = SH_CLK_DIV6_EXT(HDMICKCR, 0,
 				      hdmi_parent, ARRAY_SIZE(hdmi_parent), 6, 2),
-	[DIV6_FSIA] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, FSIACKCR, 0,
+	[DIV6_FSIA] = SH_CLK_DIV6_EXT(FSIACKCR, 0,
 				      fsiackcr_parent, ARRAY_SIZE(fsiackcr_parent), 6, 2),
-	[DIV6_FSIB] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, FSIBCKCR, 0,
+	[DIV6_FSIB] = SH_CLK_DIV6_EXT(FSIBCKCR, 0,
 				      fsibckcr_parent, ARRAY_SIZE(fsibckcr_parent), 6, 2),
 };
 
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 8668f55..7711838 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -189,9 +189,9 @@ static struct clk *fclkbcr_parent[] = {
 };
 
 static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
-	[DIV6_FA] = SH_CLK_DIV6_EXT(&div3_clk, FCLKACR, 0,
+	[DIV6_FA] = SH_CLK_DIV6_EXT(FCLKACR, 0,
 				      fclkacr_parent, ARRAY_SIZE(fclkacr_parent), 6, 2),
-	[DIV6_FB] = SH_CLK_DIV6_EXT(&div3_clk, FCLKBCR, 0,
+	[DIV6_FB] = SH_CLK_DIV6_EXT(FCLKBCR, 0,
 				      fclkbcr_parent, ARRAY_SIZE(fclkbcr_parent), 6, 2),
 };
 
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index 82dd6fb..5e4301b 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -167,6 +167,38 @@ static struct clk_ops sh_clk_div6_reparent_clk_ops = {
 	.set_parent	= sh_clk_div6_set_parent,
 };
 
+static int __init sh_clk_init_parent(struct clk *clk)
+{
+	u32 val;
+
+	if (clk->parent)
+		return 0;
+
+	if (!clk->parent_table || !clk->parent_num)
+		return 0;
+
+	if (!clk->src_width) {
+		pr_err("sh_clk_init_parent: cannot select parent clock\n");
+		return -EINVAL;
+	}
+
+	val  = (__raw_readl(clk->enable_reg) >> clk->src_shift);
+	val &= (1 << clk->src_width) - 1;
+
+	if (val >= clk->parent_num) {
+		pr_err("sh_clk_init_parent: parent table size failed\n");
+		return -EINVAL;
+	}
+
+	clk->parent = clk->parent_table[val];
+	if (!clk->parent) {
+		pr_err("sh_clk_init_parent: unable to set parent");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static int __init sh_clk_div6_register_ops(struct clk *clks, int nr,
 					   struct clk_ops *ops)
 {
@@ -190,6 +222,9 @@ static int __init sh_clk_div6_register_ops(struct clk *clks, int nr,
 		clkp->ops = ops;
 		clkp->freq_table = freq_table + (k * freq_table_size);
 		clkp->freq_table[nr_divs].frequency = CPUFREQ_TABLE_END;
+		ret = sh_clk_init_parent(clkp);
+		if (ret < 0)
+			break;
 
 		ret = clk_register(clkp);
 	}
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 3ccf186..7ea10fd 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -129,10 +129,9 @@ int sh_clk_div4_enable_register(struct clk *clks, int nr,
 int sh_clk_div4_reparent_register(struct clk *clks, int nr,
 			 struct clk_div4_table *table);
 
-#define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents,	\
+#define SH_CLK_DIV6_EXT(_reg, _flags, _parents,			\
 			_num_parents, _src_shift, _src_width)	\
 {								\
-	.parent = _parent,					\
 	.enable_reg = (void __iomem *)_reg,			\
 	.flags = _flags,					\
 	.parent_table = _parents,				\
@@ -142,7 +141,11 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
 }
 
 #define SH_CLK_DIV6(_parent, _reg, _flags)			\
-	SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0)
+{								\
+	.parent		= _parent,				\
+	.enable_reg	= (void __iomem *)_reg,			\
+	.flags		= _flags,				\
+}
 
 int sh_clk_div6_register(struct clk *clks, int nr);
 int sh_clk_div6_reparent_register(struct clk *clks, int nr);
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 2/2] sh: sh7723.h: bugfix: remove unused clock index
From: Kuninori Morimoto @ 2011-11-22  3:00 UTC (permalink / raw)
  To: linux-sh

Current sh clocks are using pm_runtime frame work instead of old hwblk.
So, HWBLK_UNKNOWN, HWBLK_DBG and HWBLK_SUBC are not needed for now.

Now mstp32 clocks are registered by sh_clk_mstp32_register(),
but the clock which isn't defined by SH_CLK_MSTP32() macro
will be crash. because it doesn't have enable_reg.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/sh/include/cpu-sh4/cpu/sh7723.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/sh/include/cpu-sh4/cpu/sh7723.h b/arch/sh/include/cpu-sh4/cpu/sh7723.h
index 9b36fae..6fae50c 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7723.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7723.h
@@ -266,10 +266,9 @@ enum {
 };
 
 enum {
-	HWBLK_UNKNOWN = 0,
 	HWBLK_TLB, HWBLK_IC, HWBLK_OC, HWBLK_L2C, HWBLK_ILMEM, HWBLK_FPU,
 	HWBLK_INTC, HWBLK_DMAC0, HWBLK_SHYWAY,
-	HWBLK_HUDI, HWBLK_DBG, HWBLK_UBC, HWBLK_SUBC,
+	HWBLK_HUDI, HWBLK_UBC,
 	HWBLK_TMU0, HWBLK_CMT, HWBLK_RWDT, HWBLK_DMAC1, HWBLK_TMU1,
 	HWBLK_FLCTL,
 	HWBLK_SCIF0, HWBLK_SCIF1, HWBLK_SCIF2,
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 1/2] sh: sh7724.h: bugfix: remove unused clock index
From: Kuninori Morimoto @ 2011-11-22  2:59 UTC (permalink / raw)
  To: linux-sh

Current sh clocks are using pm_runtime frame work instead of old hwblk.
So, HWBLK_UNKNOWN and HWBLK_DBG are not needed for now.

Now mstp32 clocks are registered by sh_clk_mstp32_register(),
but the clock which isn't defined by SH_CLK_MSTP32() macro
will be crash. because it doesn't have enable_reg.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/sh/include/cpu-sh4/cpu/sh7724.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/sh/include/cpu-sh4/cpu/sh7724.h b/arch/sh/include/cpu-sh4/cpu/sh7724.h
index cbc47e6..ea9ada3 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7724.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7724.h
@@ -268,10 +268,9 @@ enum {
 };
 
 enum {
-	HWBLK_UNKNOWN = 0,
 	HWBLK_TLB, HWBLK_IC, HWBLK_OC, HWBLK_RSMEM, HWBLK_ILMEM, HWBLK_L2C,
 	HWBLK_FPU, HWBLK_INTC, HWBLK_DMAC0, HWBLK_SHYWAY,
-	HWBLK_HUDI, HWBLK_DBG, HWBLK_UBC,
+	HWBLK_HUDI, HWBLK_UBC,
 	HWBLK_TMU0, HWBLK_CMT, HWBLK_RWDT, HWBLK_DMAC1, HWBLK_TMU1,
 	HWBLK_SCIF0, HWBLK_SCIF1, HWBLK_SCIF2, HWBLK_SCIF3,
 	HWBLK_SCIF4, HWBLK_SCIF5, HWBLK_MSIOF0, HWBLK_MSIOF1,
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 0/2] sh: bugfix: sh7724/sh7723 boot on paul/hwblk
From: Kuninori Morimoto @ 2011-11-22  2:59 UTC (permalink / raw)
  To: linux-sh


Hi Paul
Cc Guennadi

These are bugfix patches for sh7724/sh7723 boot on paul/hwblk branch

Kuninori Morimoto (2):
      sh: sh7724.h: bugfix: remove unused clock index
      sh: sh7723.h: bugfix: remove unused clock index

Now it doesn't use hwblk, but it still have un-needed HWBLK_xxx index
which are not set by SH_CLK_MSTP32() macro.
So, sh7724/sh7723 boot will be crash, because clk.enable_reg = NULL on such clocks.

I tested it on Ecovec (sh7724) and ALGO (sh7723) board.
I don't have sh7722 board now.

Best regards
---
Kuninori Morimoto

^ permalink raw reply

* Re: [PATCH] PM: fix compile breakage on sh #ifndef CONFIG_PM_RUNTIME
From: Guennadi Liakhovetski @ 2011-11-21 23:32 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <Pine.LNX.4.64.1111211642200.10414@axis700.grange>

Hi Rafael

On Mon, 21 Nov 2011, Rafael J. Wysocki wrote:

> On Monday, November 21, 2011, Guennadi Liakhovetski wrote:
> > Fix the following compalitaion breakage:
> > 
> > In file included from linux/drivers/sh/pm_runtime.c:15:
> > linux/include/linux/pm_domain.h: In function 'dev_to_genpd':
> > linux/include/linux/pm_domain.h:142: error: implicit declaration of function 'ERR_PTR'
> > linux/include/linux/pm_domain.h:142: warning: return makes pointer from integer without a cast
> > In file included from linux/include/linux/sh_clk.h:10,
> >                  from linux/drivers/sh/pm_runtime.c:19:
> > linux/include/linux/err.h: At top level:
> > linux/include/linux/err.h:22: error: conflicting types for 'ERR_PTR'
> > linux/include/linux/pm_domain.h:142: note: previous implicit declaration of 'ERR_PTR' was here
> > make[3]: *** [drivers/sh/pm_runtime.o] Error 1
> > 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> 
> This bug only happens if CONFIG_PM_GENERIC_DOMAINS is unset, which doesn't
> correspond to the subject.  I'm not sure how you reproduced it.

I'll send you both .config's off-list.

Thanks
Guennadi

> Thanks,
> Rafael
>  
> 
> > ---
> > diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> > index 765083ad..b931682 100644
> > --- a/include/linux/pm_domain.h
> > +++ b/include/linux/pm_domain.h
> > @@ -10,6 +10,7 @@
> >  #define _LINUX_PM_DOMAIN_H
> >  
> >  #include <linux/device.h>
> > +#include <linux/err.h>
> >  
> >  enum gpd_status {
> >  	GPD_STATE_ACTIVE = 0,	/* PM domain is active */
> > 
> > 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply

* Re: [PATCH] PM: fix compile breakage on sh #ifndef CONFIG_PM_RUNTIME
From: Rafael J. Wysocki @ 2011-11-21 19:53 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <Pine.LNX.4.64.1111211642200.10414@axis700.grange>

On Monday, November 21, 2011, Guennadi Liakhovetski wrote:
> Fix the following compalitaion breakage:
> 
> In file included from linux/drivers/sh/pm_runtime.c:15:
> linux/include/linux/pm_domain.h: In function 'dev_to_genpd':
> linux/include/linux/pm_domain.h:142: error: implicit declaration of function 'ERR_PTR'
> linux/include/linux/pm_domain.h:142: warning: return makes pointer from integer without a cast
> In file included from linux/include/linux/sh_clk.h:10,
>                  from linux/drivers/sh/pm_runtime.c:19:
> linux/include/linux/err.h: At top level:
> linux/include/linux/err.h:22: error: conflicting types for 'ERR_PTR'
> linux/include/linux/pm_domain.h:142: note: previous implicit declaration of 'ERR_PTR' was here
> make[3]: *** [drivers/sh/pm_runtime.o] Error 1
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

This bug only happens if CONFIG_PM_GENERIC_DOMAINS is unset, which doesn't
correspond to the subject.  I'm not sure how you reproduced it.

Thanks,
Rafael
 

> ---
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 765083ad..b931682 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -10,6 +10,7 @@
>  #define _LINUX_PM_DOMAIN_H
>  
>  #include <linux/device.h>
> +#include <linux/err.h>
>  
>  enum gpd_status {
>  	GPD_STATE_ACTIVE = 0,	/* PM domain is active */
> 
> 


^ permalink raw reply

* [PATCH] PM: fix compile breakage on sh #ifndef CONFIG_PM_RUNTIME
From: Guennadi Liakhovetski @ 2011-11-21 15:56 UTC (permalink / raw)
  To: linux-sh

Fix the following compalitaion breakage:

In file included from linux/drivers/sh/pm_runtime.c:15:
linux/include/linux/pm_domain.h: In function 'dev_to_genpd':
linux/include/linux/pm_domain.h:142: error: implicit declaration of function 'ERR_PTR'
linux/include/linux/pm_domain.h:142: warning: return makes pointer from integer without a cast
In file included from linux/include/linux/sh_clk.h:10,
                 from linux/drivers/sh/pm_runtime.c:19:
linux/include/linux/err.h: At top level:
linux/include/linux/err.h:22: error: conflicting types for 'ERR_PTR'
linux/include/linux/pm_domain.h:142: note: previous implicit declaration of 'ERR_PTR' was here
make[3]: *** [drivers/sh/pm_runtime.o] Error 1

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 765083ad..b931682 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -10,6 +10,7 @@
 #define _LINUX_PM_DOMAIN_H
 
 #include <linux/device.h>
+#include <linux/err.h>
 
 enum gpd_status {
 	GPD_STATE_ACTIVE = 0,	/* PM domain is active */

^ permalink raw reply related

* [GIT PULL] More power management fixes for 3.2
From: Rafael J. Wysocki @ 2011-11-19 22:15 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: LKML, Linux-sh list, Linux PM list

Hi Linus,

Please pull additional power management fixes (on top of commit
19e0bafc36abd84a5b4d7c7745b78a6f4626e944) for 3.2 from:

git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git pm-fixes

with top-most commit 501a708f18ef911328ffd39f39738b8a7862aa8e
(PM / Suspend: Fix bug in suspend statistics update).

They include:

* PM QoS and shmobile PM cleanups from Guennadi Liakhovetski.

* PM clocks management and shmobile PM fixes from Magnus Damm.

* devfreq fixes from MyungJoo Ham and Axel Lin.

* shmobile PM fix to avoid restoring INTCS state from random data
  during initialization.

* Driver core fix to disable device runtime PM during shutdown from Peter Chen.

* PM core fix to prevent devices with ignore_children set from blocking power
  removal from their power domains unnecessarily (which is a power regression
  with respect to 3.1 on some systems).

* Hibernation test modes and suspend statistics fixes from Srivatsa S. Bhat.

Thanks!


 arch/arm/mach-shmobile/pm-sh7372.c |   33 ++++++++++++++++++++++------
 drivers/base/core.c                |    3 ++
 drivers/base/power/clock_ops.c     |    3 +-
 drivers/base/power/main.c          |    3 +-
 drivers/base/power/qos.c           |   18 +++++----------
 drivers/devfreq/Kconfig            |   41 +++++++++++++++---------------------
 drivers/devfreq/devfreq.c          |   10 +++++++-
 include/linux/device.h             |    5 ++++
 include/linux/pm.h                 |    2 +-
 include/linux/pm_runtime.h         |    6 -----
 kernel/power/hibernate.c           |   23 +++++++++++++++-----
 kernel/power/main.c                |    3 +-
 12 files changed, 89 insertions(+), 61 deletions(-)

---------------

Axel Lin (1):
      PM / devfreq: fix use after free in devfreq_remove_device

Guennadi Liakhovetski (2):
      PM / shmobile: Don't skip debugging output in pd_power_up()
      PM / QoS: Properly use the WARN() macro in dev_pm_qos_add_request()

Magnus Damm (2):
      ARM: mach-shmobile: sh7372 A3SP no_suspend_console fix
      PM / Clocks: Only disable enabled clocks in pm_clk_suspend()

MyungJoo Ham (2):
      PM / devfreq: Remove compiler error after irq.h update
      PM / devfreq: correct Kconfig dependency

Peter Chen (1):
      PM / driver core: disable device's runtime PM during shutdown

Rafael J. Wysocki (3):
      PM / shmobile: Avoid restoring the INTCS state during initialization
      PM Sleep: Do not extend wakeup paths to devices with ignore_children set
      PM / shmobile: Fix build of sh7372_pm_init() for CONFIG_PM unset

Srivatsa S. Bhat (2):
      PM / Hibernate: Fix the early termination of test modes
      PM / Suspend: Fix bug in suspend statistics update


^ permalink raw reply

* Dreamcast build broken
From: Paul Cercueil @ 2011-11-19 20:49 UTC (permalink / raw)
  To: linux-sh

Hi,

I've been trying to compile a Linux 3.1 vanilla kernel for my dreamcast, 
but the final binary fails to load on emulators and on the real hardware.
The config I'm using is the default one created with "make 
dreamcast_defconfig".

Is the dreamcast build broken or am I doing something wrong?
I tried to git-bisect the commit(s) which introduced the error, but not 
all kernels will build with GCC 4.5.2, I'll need a good number of 
different toolchains...

Regards,
Paul

^ permalink raw reply

* [Update 2x][PATCH 7/7] PM / Domains: Automatically update overoptimistic latency information
From: Rafael J. Wysocki @ 2011-11-19 14:02 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski,
	Kevin Hilman, jean.pihet
In-Reply-To: <201111191456.40453.rjw@sisk.pl>

From: Rafael J. Wysocki <rjw@sisk.pl>

Measure the time of execution of the .stop(), .start(), .save_state()
and .restore_state() PM domain device callbacks and if the result
is greater than the corresponding latency value stored in the
device's struct generic_pm_domain_data object, replace the inaccurate
value with the measured time.

Do analogously for the PM domains' .power_off() and .power_off()
callbacks.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/base/power/domain.c |   43 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 4 deletions(-)

Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -33,6 +33,20 @@
 	__ret;							\
 })
 
+#define GENPD_DEV_TIMED_CALLBACK(genpd, type, callback, dev, field, name)	\
+({										\
+	ktime_t __start = ktime_get();						\
+	type __retval = GENPD_DEV_CALLBACK(genpd, type, callback, dev);		\
+	s64 __elapsed = ktime_to_ns(ktime_sub(ktime_get(), __start));		\
+	struct generic_pm_domain_data *__gpd_data = dev_gpd_data(dev);		\
+	if (__elapsed > __gpd_data->td.field) {					\
+		__gpd_data->td.field = __elapsed;				\
+		dev_warn(dev, name " latency exceeded, new value %lld ns\n",	\
+			__elapsed);						\
+	}									\
+	__retval;								\
+})
+
 static LIST_HEAD(gpd_list);
 static DEFINE_MUTEX(gpd_list_lock);
 
@@ -48,22 +62,27 @@ struct generic_pm_domain *dev_to_genpd(s
 
 static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
 {
-	return GENPD_DEV_CALLBACK(genpd, int, stop, dev);
+	return GENPD_DEV_TIMED_CALLBACK(genpd, int, stop, dev,
+					stop_latency_ns, "stop");
 }
 
 static int genpd_start_dev(struct generic_pm_domain *genpd, struct device *dev)
 {
-	return GENPD_DEV_CALLBACK(genpd, int, start, dev);
+	return GENPD_DEV_TIMED_CALLBACK(genpd, int, start, dev,
+					start_latency_ns, "start");
 }
 
 static int genpd_save_dev(struct generic_pm_domain *genpd, struct device *dev)
 {
-	return GENPD_DEV_CALLBACK(genpd, int, save_state, dev);
+	return GENPD_DEV_TIMED_CALLBACK(genpd, int, save_state, dev,
+					save_state_latency_ns, "state save");
 }
 
 static int genpd_restore_dev(struct generic_pm_domain *genpd, struct device *dev)
 {
-	return GENPD_DEV_CALLBACK(genpd, int, restore_state, dev);
+	return GENPD_DEV_TIMED_CALLBACK(genpd, int, restore_state, dev,
+					restore_state_latency_ns,
+					"state restore");
 }
 
 static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd)
@@ -182,9 +201,16 @@ int __pm_genpd_poweron(struct generic_pm
 	}
 
 	if (genpd->power_on) {
+		ktime_t time_start = ktime_get();
+		s64 elapsed_ns;
+
 		ret = genpd->power_on(genpd);
 		if (ret)
 			goto err;
+
+		elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
+		if (elapsed_ns > genpd->power_on_latency_ns)
+			genpd->power_on_latency_ns = elapsed_ns;
 	}
 
 	genpd_set_active(genpd);
@@ -377,11 +403,16 @@ static int pm_genpd_poweroff(struct gene
 	}
 
 	if (genpd->power_off) {
+		ktime_t time_start;
+		s64 elapsed_ns;
+
 		if (atomic_read(&genpd->sd_count) > 0) {
 			ret = -EBUSY;
 			goto out;
 		}
 
+		time_start = ktime_get();
+
 		/*
 		 * If sd_count > 0 at this point, one of the subdomains hasn't
 		 * managed to call pm_genpd_poweron() for the master yet after
@@ -395,6 +426,10 @@ static int pm_genpd_poweroff(struct gene
 			genpd_set_active(genpd);
 			goto out;
 		}
+
+		elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
+		if (elapsed_ns > genpd->power_off_latency_ns)
+			genpd->power_off_latency_ns = elapsed_ns;
 	}
 
 	genpd->status = GPD_STATE_POWER_OFF;


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox