SUPERH platform development
 help / color / mirror / Atom feed
* Re: [PATCH] ARM: Kota2 mach-type update fix
From: Rafael J. Wysocki @ 2011-12-01  9:50 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111122060857.23951.50598.sendpatchset@w520>

On Tuesday, November 22, 2011, 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>

This patch is necessary to fix build of the Linus' tree for me with both
CONFIG_ARCH_SH73A0 and CONFIG_SMP set.

Tested-by: Rafael J. Wysocki <rjw@sisk.pl>

Thanks,
Rafael


> ---
> 
>  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
> --
> 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
> 
> 


^ permalink raw reply

* Re: [PATCH] mmc: sh_mmcif: simplify clock divisor calculation
From: Chris Ball @ 2011-12-01 18:24 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Andrew Morton, Andrei Warkentin, linux-mmc, linux-sh
In-Reply-To: <Pine.LNX.4.64.1111231551100.5635@axis700.grange>

Hi,

On Wed, Nov 23 2011, Guennadi Liakhovetski wrote:
> Replace ilog2(__rounddown_pow_of_two(x)) with the equivalent but much
> simpler fls(x) - 1.
>
> Reported-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>  drivers/mmc/host/sh_mmcif.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index c021482..824fee5 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -16,6 +16,7 @@
>   *
>   */
>  
> +#include <linux/bitops.h>
>  #include <linux/clk.h>
>  #include <linux/completion.h>
>  #include <linux/delay.h>
> @@ -386,7 +387,7 @@ static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk)
>  		sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_SUP_PCLK);
>  	else
>  		sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_CLEAR &
> -			(ilog2(__rounddown_pow_of_two(host->clk / clk)) << 16));
> +				((fls(host->clk / clk) - 1) << 16));
>  
>  	sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_ENABLE);
>  }

Thanks, pushed to mmc-next for 3.3.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply

* Re: [PATCH] sh: sh2a: Optimise cache flush for writethrough mode.
From: Paul Mundt @ 2011-12-02  6:03 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <1322637713-15227-1-git-send-email-phil.edworthy@renesas.com>

On Wed, Nov 30, 2011 at 09:56:35AM +0000, phil.edworthy@renesas.com wrote:
> It's worth mentioning that this patch is essentially a work around for an 
> issue with write-back mode. sh2a_flush_icache_range is passed a large 
> address range which takes ages to flush/invalidate. For write-back mode, 
> instead of indexing on the address, perhaps we can walk through all the 
> cache entries and check for an address match. That's for another day...
> 
That's a common pitfall for anything using the address array for clearing
the entries. We have some simple heuristics in the cache-sh4.c code:

..
        /* If there are too many pages then just blow away the caches */
        if (((end - start) >> PAGE_SHIFT) >= MAX_ICACHE_PAGES) {
                local_flush_cache_all(NULL);
                return;
        }
..

A similar thing should probably be done for the SH-2/2A cases simply utilizing
CCR-based global invalidation.

> I agree that the other functions can be improved. I ignored them as the 
> main performance issue is with sh2a_flush_icache_range. I wasn't entirely 
> sure when some of the other functions are used. Are 
> sh2a__flush_wback_region and sh2a__flush_purge_region purely OC related? 
> And sh2a__flush_invalidate_region and sh2a_flush_icache_range work on both 
> the IC and OC?
> 
All of __flush_wback/purge/invalidate_region() are region based routines for OC
management. You get an idea of the abstraction from arch/sh/mm/flush-sh4.c. In general:

	__flush_wback_region - OC writeback
	__flush_invalidate_region - OC invalidate
	__flush_purge_region - OC writeback & invalidate

You can see a trivial usage example through the consistent DMA's
dma_cache_sync() and so on, relative to DMA direction.

flush_icache_range() handles I-cache invalidation for non-snoopable stores, and also
contends with things like I-cache aliases and the like. While semantically it's
not terribly complex, it's a bit of a sledgehammer given the different cases in
which it gets used. Whether the D-cache handling needs to be implemented or not
is likewise CPU dependent. In cases where the I-cache is not able to snoop
D-cache accesses we also need to deal with the D-cache explicitly. On the SMP
parts it's also further complicated by the fact that the bulk of the parts do
not broadcast I-cache block invalidates, and the snoop controller only handles
the D-cache (though the same I/D race exists given that the I-cache doesn't
have any connection to the snoop controller).

You can get a bit of an overview in Documentation/cachetlb.txt if you're
interested in some of the requirements.

^ permalink raw reply

* Re: [PATCH] mmc: sh_mmcif: process requests asynchronously
From: Magnus Damm @ 2011-12-02 15:24 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-mmc, linux-sh, Chris Ball
In-Reply-To: <Pine.LNX.4.64.1111301553330.22197@axis700.grange>

Hi Guennadi,

On Thu, Dec 1, 2011 at 12:07 AM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> This patch converts the sh_mmcif MMC host driver to process requests
> asynchronously instead of waiting in its .request() method for completion.
> This is achieved by using threaded IRQs.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Thanks for your work on this! Interesting with threaded IRQ support.

Would it be possible to split this up into smaller chunks somehow?
This rather big patch is more or less a rewrite of the driver - so it
somehow looks to me like you're implementing multiple functional
changes in a single commit. Maybe you're not doing that, but if so
then at least the new code flow needs some documentation.

How about including some ascii-art style charts of the different
states involved in reads and writes both for PIO and DMA? I'm thinking
of something similar to the comments that describe the bus transaction
and interrupts in drivers/i2c/busses/i2c-sh_mobile.c.

Cheers,

/ magnus

^ permalink raw reply

* Re: [PATCH] mmc: sh_mmcif: process requests asynchronously
From: Guennadi Liakhovetski @ 2011-12-02 15:54 UTC (permalink / raw)
  To: Magnus Damm; +Cc: linux-mmc, linux-sh, Chris Ball
In-Reply-To: <CANqRtoRvqZCuVQF0zeh9kyCnanfjA6k6ttWLOcf1y+-b4OcM_Q@mail.gmail.com>

Hi Magnus

On Sat, 3 Dec 2011, Magnus Damm wrote:

> Hi Guennadi,
> 
> On Thu, Dec 1, 2011 at 12:07 AM, Guennadi Liakhovetski
> <g.liakhovetski@gmx.de> wrote:
> > This patch converts the sh_mmcif MMC host driver to process requests
> > asynchronously instead of waiting in its .request() method for completion.
> > This is achieved by using threaded IRQs.
> >
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> 
> Thanks for your work on this! Interesting with threaded IRQ support.
> 
> Would it be possible to split this up into smaller chunks somehow?
> This rather big patch is more or less a rewrite of the driver - so it
> somehow looks to me like you're implementing multiple functional
> changes in a single commit. Maybe you're not doing that, but if so
> then at least the new code flow needs some documentation.

Yes, the diff is, unfortunately, pretty large. But so far I don't see a 
good way to split it. Essentially this patch introduces two changes:

1. asynchronous request processing
2. threaded IRQ

but, I don't think, splitting these changes would make sense. You don't 
want to implement (1) by another means, other than (2), because that'd be 
a double work. And if you already do (2) - you practically arrive at (1) 
too.

I'm not that much rewriting the driver either - most low-level functions 
are preserved, but many of them have to be rearranged. E.g., functions to 
process specific requests - single block read / write, multiple block r/w, 
etc., are split into to - the part before going to sleep, and the part 
after the hardware interrupt, which is now called from the IRQ thread. But 
the diff cannot show that as moved code, so, it looks huge.

But I'll spend some more time, thinking about possibilities to split or 
reduce the diff, maybe I get an idea...

> How about including some ascii-art style charts of the different
> states involved in reads and writes both for PIO and DMA? I'm thinking
> of something similar to the comments that describe the bus transaction
> and interrupts in drivers/i2c/busses/i2c-sh_mobile.c.

Ok, I'll try to add some documentation to the next version of the patch.

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

^ permalink raw reply

* Hello
From: grace bugiba @ 2011-12-03  1:33 UTC (permalink / raw)
  To: linux-sh

Hello
My name is GRACE. i am a young girl from west Africa. I saw your email when i was browsing in internet and found out that we can make a good match and i will like you to contact me through my email address so that i can tell you more about myself. please my dear i will like you to contact me at my mail box Waiting for your mail, Your GRACE.

^ permalink raw reply

* RE: [PATCH 6/7] ARM: restart: only perform setup for restart when
From: Kukjin Kim @ 2011-12-03  9:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111117174247.GF9581@n2100.arm.linux.org.uk>

Russell King - ARM Linux wrote:
> 
> Ack?
> 
> (If you're in the To: list I'm expecting a reply because this patch is
> touching something you're responsible for.  Thanks.)
> 
> On Sun, Nov 06, 2011 at 05:33:35PM +0000, Russell King - ARM Linux wrote:
> > We only need to set the system up for a soft-restart if we're going to
> > be doing a soft-restart.  Provide a new function (soft_restart()) which
> > does the setup and final call for this, and make platforms use it.
> > Eliminate the call to setup_restart() from the default handler.
> >
> > This means that platforms arch_reset() function is no longer called with
> > the page tables prepared for a soft-restart, and caches will still be
> > enabled.
> >
> > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Sorry for late response...

For Samsung stuff:
Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

> > ---
> >  arch/arm/include/asm/system.h                     |    1 +
> >  arch/arm/kernel/process.c                         |   13 +++++++++++--
> >  arch/arm/mach-clps711x/include/mach/system.h      |    2 +-
> >  arch/arm/mach-ebsa110/include/mach/system.h       |    2 +-
> >  arch/arm/mach-footbridge/include/mach/system.h    |    2 +-
> >  arch/arm/mach-iop32x/include/mach/system.h        |    2 +-
> >  arch/arm/mach-iop33x/include/mach/system.h        |    2 +-
> >  arch/arm/mach-ixp4xx/include/mach/system.h        |    2 +-
> >  arch/arm/mach-ks8695/include/mach/system.h        |    2 +-
> >  arch/arm/mach-mmp/include/mach/system.h           |    4 ++--
> >  arch/arm/mach-mxs/system.c                        |    2 +-
> >  arch/arm/mach-pnx4008/include/mach/system.h       |    2 +-
> >  arch/arm/mach-pxa/reset.c                         |    2 +-
> >  arch/arm/mach-rpc/include/mach/system.h           |    2 +-
> >  arch/arm/mach-s3c2410/include/mach/system-reset.h |    4 ++--
> >  arch/arm/mach-s3c64xx/include/mach/system.h       |    2 +-
> >  arch/arm/mach-sa1100/include/mach/system.h        |    2 +-
> >  arch/arm/mach-shmobile/include/mach/system.h      |    2 +-
> >  arch/arm/mach-w90x900/include/mach/system.h       |    2 +-
> >  arch/arm/plat-mxc/system.c                        |    2 +-
> >  arch/arm/plat-spear/include/plat/system.h         |    2 +-
> >  21 files changed, 33 insertions(+), 23 deletions(-)
> >
> > diff --git a/arch/arm/include/asm/system.h
> b/arch/arm/include/asm/system.h
> > index 984014b..fe7de75 100644
> > --- a/arch/arm/include/asm/system.h
> > +++ b/arch/arm/include/asm/system.h
> > @@ -101,6 +101,7 @@ extern int __pure cpu_architecture(void);
> >  extern void cpu_init(void);
> >
> >  void arm_machine_restart(char mode, const char *cmd);
> > +void soft_restart(unsigned long);
> >  extern void (*arm_pm_restart)(char str, const char *cmd);
> >
> >  #define UDBG_UNDEFINED	(1 << 0)
> > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> > index dca7971..52b4306 100644
> > --- a/arch/arm/kernel/process.c
> > +++ b/arch/arm/kernel/process.c
> > @@ -92,7 +92,7 @@ static int __init hlt_setup(char *__unused)
> >  __setup("nohlt", nohlt_setup);
> >  __setup("hlt", hlt_setup);
> >
> > -void arm_machine_restart(char mode, const char *cmd)
> > +void soft_restart(unsigned long addr)
> >  {
> >  	/* Disable interrupts first */
> >  	local_irq_disable();
> > @@ -114,7 +114,16 @@ void arm_machine_restart(char mode, const char
*cmd)
> >  	/* Push out any further dirty data, and ensure cache is empty */
> >  	flush_cache_all();
> >
> > -	/* Now call the architecture specific reboot code. */
> > +	cpu_reset(addr);
> > +}
> > +
> > +void arm_machine_restart(char mode, const char *cmd)
> > +{
> > +	/* Disable interrupts first */
> > +	local_irq_disable();
> > +	local_fiq_disable();
> > +
> > +	/* Call the architecture specific reboot code. */
> >  	arch_reset(mode, cmd);
> >  }
> >
> > diff --git a/arch/arm/mach-clps711x/include/mach/system.h
> b/arch/arm/mach-clps711x/include/mach/system.h
> > index f916cd7..6c11993 100644
> > --- a/arch/arm/mach-clps711x/include/mach/system.h
> > +++ b/arch/arm/mach-clps711x/include/mach/system.h
> > @@ -34,7 +34,7 @@ static inline void arch_idle(void)
> >
> >  static inline void arch_reset(char mode, const char *cmd)
> >  {
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> >
> >  #endif
> > diff --git a/arch/arm/mach-ebsa110/include/mach/system.h
> b/arch/arm/mach-ebsa110/include/mach/system.h
> > index 9a26245..0d5df72 100644
> > --- a/arch/arm/mach-ebsa110/include/mach/system.h
> > +++ b/arch/arm/mach-ebsa110/include/mach/system.h
> > @@ -34,6 +34,6 @@ static inline void arch_idle(void)
> >  	asm volatile ("mcr p15, 0, ip, c15, c1, 2" : : : "cc");
> >  }
> >
> > -#define arch_reset(mode, cmd)	cpu_reset(0x80000000)
> > +#define arch_reset(mode, cmd)	soft_restart(0x80000000)
> >
> >  #endif
> > diff --git a/arch/arm/mach-footbridge/include/mach/system.h
> b/arch/arm/mach-footbridge/include/mach/system.h
> > index 0b29315..249f895 100644
> > --- a/arch/arm/mach-footbridge/include/mach/system.h
> > +++ b/arch/arm/mach-footbridge/include/mach/system.h
> > @@ -24,7 +24,7 @@ static inline void arch_reset(char mode, const char
> *cmd)
> >  		/*
> >  		 * Jump into the ROM
> >  		 */
> > -		cpu_reset(0x41000000);
> > +		soft_restart(0x41000000);
> >  	} else {
> >  		if (machine_is_netwinder()) {
> >  			/* open up the SuperIO chip
> > diff --git a/arch/arm/mach-iop32x/include/mach/system.h b/arch/arm/mach-
> iop32x/include/mach/system.h
> > index a4b808f..4865a9b 100644
> > --- a/arch/arm/mach-iop32x/include/mach/system.h
> > +++ b/arch/arm/mach-iop32x/include/mach/system.h
> > @@ -30,5 +30,5 @@ static inline void arch_reset(char mode, const char
> *cmd)
> >  	*IOP3XX_PCSR = 0x30;
> >
> >  	/* Jump into ROM at address 0 */
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> > diff --git a/arch/arm/mach-iop33x/include/mach/system.h b/arch/arm/mach-
> iop33x/include/mach/system.h
> > index f192a34..86d1b20 100644
> > --- a/arch/arm/mach-iop33x/include/mach/system.h
> > +++ b/arch/arm/mach-iop33x/include/mach/system.h
> > @@ -19,5 +19,5 @@ static inline void arch_reset(char mode, const char
> *cmd)
> >  	*IOP3XX_PCSR = 0x30;
> >
> >  	/* Jump into ROM at address 0 */
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> > diff --git a/arch/arm/mach-ixp4xx/include/mach/system.h b/arch/arm/mach-
> ixp4xx/include/mach/system.h
> > index 54c0af7..24337d9 100644
> > --- a/arch/arm/mach-ixp4xx/include/mach/system.h
> > +++ b/arch/arm/mach-ixp4xx/include/mach/system.h
> > @@ -26,7 +26,7 @@ static inline void arch_reset(char mode, const char
> *cmd)
> >  {
> >  	if ( 1 && mode = 's') {
> >  		/* Jump into ROM at address 0 */
> > -		cpu_reset(0);
> > +		soft_restart(0);
> >  	} else {
> >  		/* Use on-chip reset capability */
> >
> > diff --git a/arch/arm/mach-ks8695/include/mach/system.h b/arch/arm/mach-
> ks8695/include/mach/system.h
> > index fb1dda9..ceb19c9 100644
> > --- a/arch/arm/mach-ks8695/include/mach/system.h
> > +++ b/arch/arm/mach-ks8695/include/mach/system.h
> > @@ -32,7 +32,7 @@ static void arch_reset(char mode, const char *cmd)
> >  	unsigned int reg;
> >
> >  	if (mode = 's')
> > -		cpu_reset(0);
> > +		soft_restart(0);
> >
> >  	/* disable timer0 */
> >  	reg = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
> > diff --git a/arch/arm/mach-mmp/include/mach/system.h b/arch/arm/mach-
> mmp/include/mach/system.h
> > index 1a8a25e..cb06379 100644
> > --- a/arch/arm/mach-mmp/include/mach/system.h
> > +++ b/arch/arm/mach-mmp/include/mach/system.h
> > @@ -19,8 +19,8 @@ static inline void arch_idle(void)
> >  static inline void arch_reset(char mode, const char *cmd)
> >  {
> >  	if (cpu_is_pxa168())
> > -		cpu_reset(0xffff0000);
> > +		soft_restart(0xffff0000);
> >  	else
> > -		cpu_reset(0);
> > +		soft_restart(0);
> >  }
> >  #endif /* __ASM_MACH_SYSTEM_H */
> > diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
> > index 20ec3bd..cab8836 100644
> > --- a/arch/arm/mach-mxs/system.c
> > +++ b/arch/arm/mach-mxs/system.c
> > @@ -53,7 +53,7 @@ void arch_reset(char mode, const char *cmd)
> >  	mdelay(50);
> >
> >  	/* We'll take a jump through zero as a poor second */
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> >
> >  static int __init mxs_arch_reset_init(void)
> > diff --git a/arch/arm/mach-pnx4008/include/mach/system.h
> b/arch/arm/mach-pnx4008/include/mach/system.h
> > index 5dda2bb..5d6384a 100644
> > --- a/arch/arm/mach-pnx4008/include/mach/system.h
> > +++ b/arch/arm/mach-pnx4008/include/mach/system.h
> > @@ -32,7 +32,7 @@ static void arch_idle(void)
> >
> >  static inline void arch_reset(char mode, const char *cmd)
> >  {
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> >
> >  #endif
> > diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c
> > index 01e9d64..b8bcda1 100644
> > --- a/arch/arm/mach-pxa/reset.c
> > +++ b/arch/arm/mach-pxa/reset.c
> > @@ -88,7 +88,7 @@ void arch_reset(char mode, const char *cmd)
> >  	switch (mode) {
> >  	case 's':
> >  		/* Jump into ROM at address 0 */
> > -		cpu_reset(0);
> > +		soft_restart(0);
> >  		break;
> >  	case 'g':
> >  		do_gpio_reset();
> > diff --git a/arch/arm/mach-rpc/include/mach/system.h b/arch/arm/mach-
> rpc/include/mach/system.h
> > index 45c7b93..a354f4d 100644
> > --- a/arch/arm/mach-rpc/include/mach/system.h
> > +++ b/arch/arm/mach-rpc/include/mach/system.h
> > @@ -23,5 +23,5 @@ static inline void arch_reset(char mode, const char
> *cmd)
> >  	/*
> >  	 * Jump into the ROM
> >  	 */
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> > diff --git a/arch/arm/mach-s3c2410/include/mach/system-reset.h
> b/arch/arm/mach-s3c2410/include/mach/system-reset.h
> > index 6faadce..913893d 100644
> > --- a/arch/arm/mach-s3c2410/include/mach/system-reset.h
> > +++ b/arch/arm/mach-s3c2410/include/mach/system-reset.h
> > @@ -19,7 +19,7 @@ static void
> >  arch_reset(char mode, const char *cmd)
> >  {
> >  	if (mode = 's') {
> > -		cpu_reset(0);
> > +		soft_restart(0);
> >  	}
> >
> >  	if (s3c24xx_reset_hook)
> > @@ -28,5 +28,5 @@ arch_reset(char mode, const char *cmd)
> >  	arch_wdt_reset();
> >
> >  	/* we'll take a jump through zero as a poor second */
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> > diff --git a/arch/arm/mach-s3c64xx/include/mach/system.h
> b/arch/arm/mach-s3c64xx/include/mach/system.h
> > index 2e58cb7..d8ca578 100644
> > --- a/arch/arm/mach-s3c64xx/include/mach/system.h
> > +++ b/arch/arm/mach-s3c64xx/include/mach/system.h
> > @@ -24,7 +24,7 @@ static void arch_reset(char mode, const char *cmd)
> >  		arch_wdt_reset();
> >
> >  	/* if all else fails, or mode was for soft, jump to 0 */
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> >
> >  #endif /* __ASM_ARCH_IRQ_H */
> > diff --git a/arch/arm/mach-sa1100/include/mach/system.h b/arch/arm/mach-
> sa1100/include/mach/system.h
> > index ba9da9f..345d35b 100644
> > --- a/arch/arm/mach-sa1100/include/mach/system.h
> > +++ b/arch/arm/mach-sa1100/include/mach/system.h
> > @@ -14,7 +14,7 @@ static inline void arch_reset(char mode, const char
> *cmd)
> >  {
> >  	if (mode = 's') {
> >  		/* Jump into ROM at address 0 */
> > -		cpu_reset(0);
> > +		soft_restart(0);
> >  	} else {
> >  		/* Use on-chip reset capability */
> >  		RSRR = RSRR_SWR;
> > diff --git a/arch/arm/mach-shmobile/include/mach/system.h
> b/arch/arm/mach-shmobile/include/mach/system.h
> > index 76a687e..956ac18 100644
> > --- a/arch/arm/mach-shmobile/include/mach/system.h
> > +++ b/arch/arm/mach-shmobile/include/mach/system.h
> > @@ -8,7 +8,7 @@ static inline void arch_idle(void)
> >
> >  static inline void arch_reset(char mode, const char *cmd)
> >  {
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> >
> >  #endif
> > diff --git a/arch/arm/mach-w90x900/include/mach/system.h
> b/arch/arm/mach-w90x900/include/mach/system.h
> > index ce228bd..68875a1 100644
> > --- a/arch/arm/mach-w90x900/include/mach/system.h
> > +++ b/arch/arm/mach-w90x900/include/mach/system.h
> > @@ -33,7 +33,7 @@ static void arch_reset(char mode, const char *cmd)
> >  {
> >  	if (mode = 's') {
> >  		/* Jump into ROM at address 0 */
> > -		cpu_reset(0);
> > +		soft_restart(0);
> >  	} else {
> >  		__raw_writel(WTE | WTRE | WTCLK, WTCR);
> >  	}
> > diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
> > index 9dad8dc..b1cfc6a 100644
> > --- a/arch/arm/plat-mxc/system.c
> > +++ b/arch/arm/plat-mxc/system.c
> > @@ -70,7 +70,7 @@ void arch_reset(char mode, const char *cmd)
> >  	mdelay(50);
> >
> >  	/* we'll take a jump through zero as a poor second */
> > -	cpu_reset(0);
> > +	soft_restart(0);
> >  }
> >
> >  void mxc_arch_reset_init(void __iomem *base)
> > diff --git a/arch/arm/plat-spear/include/plat/system.h b/arch/arm/plat-
> spear/include/plat/system.h
> > index a235fa0..1171f22 100644
> > --- a/arch/arm/plat-spear/include/plat/system.h
> > +++ b/arch/arm/plat-spear/include/plat/system.h
> > @@ -31,7 +31,7 @@ static inline void arch_reset(char mode, const char
> *cmd)
> >  {
> >  	if (mode = 's') {
> >  		/* software reset, Jump into ROM at address 0 */
> > -		cpu_reset(0);
> > +		soft_restart(0);
> >  	} else {
> >  		/* hardware reset, Use on-chip reset capability */
> >  		sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE);
> > --
> > 1.7.4.4
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


^ permalink raw reply

* Re: [PATCH 6/7] ARM: restart: only perform setup for restart when
From: Russell King - ARM Linux @ 2011-12-03  9:30 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <000001ccb19d$2f9c5c60$8ed51520$%kim@samsung.com>

On Sat, Dec 03, 2011 at 06:23:09PM +0900, Kukjin Kim wrote:
> Russell King - ARM Linux wrote:
> > 
> > Ack?
> > 
> > (If you're in the To: list I'm expecting a reply because this patch is
> > touching something you're responsible for.  Thanks.)
> > 
> > On Sun, Nov 06, 2011 at 05:33:35PM +0000, Russell King - ARM Linux wrote:
> > > We only need to set the system up for a soft-restart if we're going to
> > > be doing a soft-restart.  Provide a new function (soft_restart()) which
> > > does the setup and final call for this, and make platforms use it.
> > > Eliminate the call to setup_restart() from the default handler.
> > >
> > > This means that platforms arch_reset() function is no longer called with
> > > the page tables prepared for a soft-restart, and caches will still be
> > > enabled.
> > >
> > > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> 
> Sorry for late response...
> 
> For Samsung stuff:
> Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Too late, it's now part of devel-stable so I can't accept any more acks
for this.  Sorry.

^ permalink raw reply

* RE: [PATCH 6/7] ARM: restart: only perform setup for restart when
From: Kukjin Kim @ 2011-12-03  9:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111203093012.GM9581@n2100.arm.linux.org.uk>

Russell King - ARM Linux wrote:
> 
> On Sat, Dec 03, 2011 at 06:23:09PM +0900, Kukjin Kim wrote:
> > Russell King - ARM Linux wrote:
> > >
> > > Ack?
> > >
> > > (If you're in the To: list I'm expecting a reply because this patch is
> > > touching something you're responsible for.  Thanks.)
> > >
> > > On Sun, Nov 06, 2011 at 05:33:35PM +0000, Russell King - ARM Linux
> wrote:
> > > > We only need to set the system up for a soft-restart if we're going
> to
> > > > be doing a soft-restart.  Provide a new function (soft_restart())
> which
> > > > does the setup and final call for this, and make platforms use it.
> > > > Eliminate the call to setup_restart() from the default handler.
> > > >
> > > > This means that platforms arch_reset() function is no longer called
> with
> > > > the page tables prepared for a soft-restart, and caches will still
> be
> > > > enabled.
> > > >
> > > > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> >
> > Sorry for late response...
> >
> > For Samsung stuff:
> > Acked-by: Kukjin Kim <kgene.kim@samsung.com>
> 
> Too late, it's now part of devel-stable so I can't accept any more acks
> for this.  Sorry.

OK, I see.

But I did send my ack in the beginning of Nov on cover [0/7] like
following...
http://lists.infradead.org/pipermail/linux-arm-kernel/2011-November/071800.h
tml

So I didn't send my ack on this...

As a note, I'm sorting out header files, local headers in Samsung stuff as
per your suggestion and you can see them in the next week.

Anyway, thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.


^ permalink raw reply

* Re: [PATCH-RFC 09/10] sh: switch to GENERIC_PCI_IOMAP
From: Michael S. Tsirkin @ 2011-12-04 10:48 UTC (permalink / raw)
  To: linux-sh

On Thu, Nov 24, 2011 at 10:20:37PM +0200, Michael S. Tsirkin wrote:
> sh copied pci_iomap from generic code, probably to avoid
> pulling the rest of iomap.c in.  Since that's in
> a separate file now, we can reuse the common implementation.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Sorry to nag, any ACKs/NACKs on the sh changes?
I intend to send this to Linus if there are no
objections. Thanks!

> ---
>  arch/sh/Kconfig           |    1 +
>  arch/sh/drivers/pci/pci.c |   23 -----------------------
>  2 files changed, 1 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 5aeab58..ead1640 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -857,6 +857,7 @@ config PCI
>  	bool "PCI support"
>  	depends on SYS_SUPPORTS_PCI
>  	select PCI_DOMAINS
> +	select GENERIC_PCI_IOMAP
>  	help
>  	  Find out whether you have a PCI motherboard. PCI is the name of a
>  	  bus system, i.e. the way the CPU talks to the other stuff inside
> diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
> index c2691af..11aaf2f 100644
> --- a/arch/sh/drivers/pci/pci.c
> +++ b/arch/sh/drivers/pci/pci.c
> @@ -393,29 +393,6 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
>  	return (void __iomem *)(chan->io_map_base + port);
>  }
>  
> -void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
> -{
> -	resource_size_t start = pci_resource_start(dev, bar);
> -	resource_size_t len = pci_resource_len(dev, bar);
> -	unsigned long flags = pci_resource_flags(dev, bar);
> -
> -	if (unlikely(!len || !start))
> -		return NULL;
> -	if (maxlen && len > maxlen)
> -		len = maxlen;
> -
> -	if (flags & IORESOURCE_IO)
> -		return ioport_map_pci(dev, start, len);
> -	if (flags & IORESOURCE_MEM) {
> -		if (flags & IORESOURCE_CACHEABLE)
> -			return ioremap(start, len);
> -		return ioremap_nocache(start, len);
> -	}
> -
> -	return NULL;
> -}
> -EXPORT_SYMBOL(pci_iomap);
> -
>  void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
>  {
>  	iounmap(addr);
> -- 
> 1.7.5.53.gc233e

^ permalink raw reply

* [PATCH] PM / Domains: Fix default system suspend/resume operations
From: Rafael J. Wysocki @ 2011-12-04 20:59 UTC (permalink / raw)
  To: Linux PM list; +Cc: LKML, Linux-sh list, Magnus Damm

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

Commit d23b9b00cdde5c93b914a172cecd57d5625fcd04 (PM / Domains: Rework
system suspend callback routines (v2)) broke the system suspend and
resume handling by devices belonging to generic PM domains, because
it used freeze/thaw callbacks instead of suspend/resume ones and
didn't initialize device callbacks for system suspend/resume
properly at all.  Fix those problems.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

This patch is on top of linux-pm/pm-domains.

Thanks,
Rafael

---
 drivers/base/power/domain.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -1360,7 +1360,7 @@ static int pm_genpd_default_restore_stat
  */
 static int pm_genpd_default_suspend(struct device *dev)
 {
-	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.freeze;
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.suspend;
 
 	return cb ? cb(dev) : pm_generic_suspend(dev);
 }
@@ -1371,7 +1371,7 @@ static int pm_genpd_default_suspend(stru
  */
 static int pm_genpd_default_suspend_late(struct device *dev)
 {
-	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.freeze_late;
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.suspend_late;
 
 	return cb ? cb(dev) : pm_generic_suspend_noirq(dev);
 }
@@ -1382,7 +1382,7 @@ static int pm_genpd_default_suspend_late
  */
 static int pm_genpd_default_resume_early(struct device *dev)
 {
-	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.thaw_early;
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.resume_early;
 
 	return cb ? cb(dev) : pm_generic_resume_noirq(dev);
 }
@@ -1393,7 +1393,7 @@ static int pm_genpd_default_resume_early
  */
 static int pm_genpd_default_resume(struct device *dev)
 {
-	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.thaw;
+	int (*cb)(struct device *__dev) = dev_gpd_data(dev)->ops.resume;
 
 	return cb ? cb(dev) : pm_generic_resume(dev);
 }
@@ -1487,10 +1487,10 @@ void pm_genpd_init(struct generic_pm_dom
 	genpd->domain.ops.complete = pm_genpd_complete;
 	genpd->dev_ops.save_state = pm_genpd_default_save_state;
 	genpd->dev_ops.restore_state = pm_genpd_default_restore_state;
-	genpd->dev_ops.freeze = pm_genpd_default_suspend;
-	genpd->dev_ops.freeze_late = pm_genpd_default_suspend_late;
-	genpd->dev_ops.thaw_early = pm_genpd_default_resume_early;
-	genpd->dev_ops.thaw = pm_genpd_default_resume;
+	genpd->dev_ops.suspend = pm_genpd_default_suspend;
+	genpd->dev_ops.suspend_late = pm_genpd_default_suspend_late;
+	genpd->dev_ops.resume_early = pm_genpd_default_resume_early;
+	genpd->dev_ops.resume = pm_genpd_default_resume;
 	genpd->dev_ops.freeze = pm_genpd_default_freeze;
 	genpd->dev_ops.freeze_late = pm_genpd_default_freeze_late;
 	genpd->dev_ops.thaw_early = pm_genpd_default_thaw_early;

^ permalink raw reply

* [PATCH] PM / sh7372: Make domain stay_on bit only affect system suspend
From: Rafael J. Wysocki @ 2011-12-04 22:08 UTC (permalink / raw)
  To: Linux PM list; +Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski

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

SH7372 uses two independent mechanisms for ensuring that power
domains will never be turned off: the stay_on flag and the "always
on" domain governor.  However, the "always on" governor is only taken
into accout by runtime PM code paths, while the stay_on flag affects
all attempts to turn the given domain off.  This is a problem for
domains that only need to stay in the "power on" state during system
sleep, but may be turned off by runtime PM if specific conditions are
satisfied.  For this reason, make SH7372 register a PM notifier that
will enable the checking of the domain stay_on flag on during system
suspend and disable it during system resume.  This way, the stay_on
flag will only affect system sleep states, while the "always on"
governor will only affect runtime PM.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

This patch is on top of linux-pm/pm-domains.

Thanks,
Rafael

---
 arch/arm/mach-shmobile/pm-sh7372.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -77,6 +77,8 @@
 
 #ifdef CONFIG_PM
 
+static bool system_pm_transition;
+
 static int pd_power_down(struct generic_pm_domain *genpd)
 {
 	struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
@@ -85,7 +87,7 @@ static int pd_power_down(struct generic_
 	if (sh7372_pd->suspend)
 		sh7372_pd->suspend();
 
-	if (sh7372_pd->stay_on)
+	if (system_pm_transition && sh7372_pd->stay_on)
 		return 0;
 
 	if (__raw_readl(PSTR) & mask) {
@@ -286,6 +288,21 @@ struct sh7372_pm_domain sh7372_a3sg = {
 	.bit_shift = 13,
 };
 
+static int sh7372_pm_notifier_fn(struct notifier_block *notifier,
+				 unsigned long pm_event, void *unused)
+{
+	switch (pm_event) {
+	case PM_SUSPEND_PREPARE:
+		system_pm_transition = true;
+		break;
+	case PM_POST_SUSPEND:
+		system_pm_transition = false;
+		break;
+	}
+
+	return NOTIFY_DONE;
+}
+
 #else /* !CONFIG_PM */
 
 static inline void sh7372_a3sp_init(void) {}
@@ -509,6 +526,7 @@ static int sh7372_enter_suspend(suspend_
 static void sh7372_suspend_init(void)
 {
 	shmobile_suspend_ops.enter = sh7372_enter_suspend;
+	pm_notifier(sh7372_pm_notifier_fn, 0);
 }
 #else
 static void sh7372_suspend_init(void) {}

^ permalink raw reply

* cpuidle broken on sh7724 since 2.6.33-rc1 - bisected
From: Guennadi Liakhovetski @ 2011-12-04 23:42 UTC (permalink / raw)
  To: linux-sh

Hi

cpuidle was introduced on sh7724 with 2.6.32-rc1, with 2.6.33-rc1 it got 
broken and it still remains that way, at least I'm unaware of a way to 
boot a current cpuidle-enabled kernel on sh7724 (ecovec). git bisect 
(after multiple manual adjustments) pointed out at this commit:

commit f533c3d340536198a4889a42a68d6c0d79a504e7
Author: Paul Mundt <lethal@linux-sh.org>
Date:   Fri Oct 16 17:20:58 2009 +0900

    sh: Idle loop chainsawing for SMP-based light sleep.

A manual verification confirmed, that it is exactly the breakage point. 
I'm afraid, at 00:30 Monday "morning" I'm not very much inclined to look 
for a fix;-)

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

^ permalink raw reply

* Re: [PATCH] PM / sh7372: Make domain stay_on bit only affect system suspend
From: Rafael J. Wysocki @ 2011-12-05  0:17 UTC (permalink / raw)
  To: Linux PM list; +Cc: LKML, Linux-sh list, Magnus Damm, Guennadi Liakhovetski
In-Reply-To: <201112042308.14255.rjw@sisk.pl>

On Sunday, December 04, 2011, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> SH7372 uses two independent mechanisms for ensuring that power
> domains will never be turned off: the stay_on flag and the "always
> on" domain governor.  However, the "always on" governor is only taken
> into accout by runtime PM code paths, while the stay_on flag affects
> all attempts to turn the given domain off.  This is a problem for
> domains that only need to stay in the "power on" state during system
> sleep, but may be turned off by runtime PM if specific conditions are
> satisfied.  For this reason, make SH7372 register a PM notifier that
> will enable the checking of the domain stay_on flag on during system
> suspend and disable it during system resume.  This way, the stay_on
> flag will only affect system sleep states, while the "always on"
> governor will only affect runtime PM.

Well, it's not that simple, because we need to make the domains that
should stay "on" during system suspend be powered on beforehand.

I'll send an updated patch in a while.

Thanks,
Rafael

^ permalink raw reply

* [Update][PATCH] PM / sh7372: Make domain stay_on bit only affect system suspend
From: Rafael J. Wysocki @ 2011-12-05  0:21 UTC (permalink / raw)
  To: Linux-sh list; +Cc: Linux PM list, LKML, Magnus Damm, Guennadi Liakhovetski
In-Reply-To: <201112050117.05214.rjw@sisk.pl>

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

SH7372 uses two independent mechanisms for ensuring that power
domains will never be turned off: the stay_on flag and the "always
on" domain governor.  However, the "always on" governor is only taken
into accout by runtime PM code paths, while the stay_on flag affects
all attempts to turn the given domain off.  This is a problem for
domains that only need to stay in the "power on" state during system
sleep, but may be turned off by runtime PM if specific conditions are
satisfied.

For this reason, make SH7372 register a PM notifier that will enable
the checking of the domain stay_on flag on during system suspend and
disable it during system resume.  This way, the stay_on flag will
only affect system sleep states, while the "always on" governor will
only affect runtime PM.

In addition to that, make sure that all domains which should be in
the "power on" state during system sleep are turned on beforehand, by
executing pm_genpd_poweron() for all of them.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/pm-sh7372.c |   34 +++++++++++++++++++++++++++++++---
 drivers/base/power/domain.c        |   28 ++++++++++++++++++++--------
 include/linux/pm_domain.h          |    4 ++++
 3 files changed, 55 insertions(+), 11 deletions(-)

Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -77,6 +77,8 @@
 
 #ifdef CONFIG_PM
 
+static bool system_pm_transition;
+
 static int pd_power_down(struct generic_pm_domain *genpd)
 {
 	struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
@@ -85,8 +87,8 @@ static int pd_power_down(struct generic_
 	if (sh7372_pd->suspend)
 		sh7372_pd->suspend();
 
-	if (sh7372_pd->stay_on)
-		return 0;
+	if (system_pm_transition && sh7372_pd->stay_on)
+		return -EBUSY;
 
 	if (__raw_readl(PSTR) & mask) {
 		unsigned int retry_count;
@@ -113,7 +115,7 @@ static int __pd_power_up(struct sh7372_p
 	unsigned int retry_count;
 	int ret = 0;
 
-	if (sh7372_pd->stay_on)
+	if (sh7372_pd->genpd.status != GPD_STATE_POWER_OFF)
 		goto out;
 
 	if (__raw_readl(PSTR) & mask)
@@ -506,9 +508,35 @@ static int sh7372_enter_suspend(suspend_
 	return 0;
 }
 
+static void sh7372_pm_power_on_for_suspend(struct generic_pm_domain *genpd)
+{
+	struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
+
+	if (sh7372_pd->stay_on)
+		pm_genpd_poweron(genpd);
+}
+
+static int sh7372_pm_notifier_fn(struct notifier_block *notifier,
+				 unsigned long pm_event, void *unused)
+{
+	switch (pm_event) {
+	case PM_SUSPEND_PREPARE:
+		system_pm_transition = true;
+		pm_genpd_for_each_domain(sh7372_pm_power_on_for_suspend);
+		break;
+	case PM_POST_SUSPEND:
+		system_pm_transition = false;
+		pm_genpd_poweroff_unused();
+		break;
+	}
+
+	return NOTIFY_DONE;
+}
+
 static void sh7372_suspend_init(void)
 {
 	shmobile_suspend_ops.enter = sh7372_enter_suspend;
+	pm_notifier(sh7372_pm_notifier_fn, 0);
 }
 #else
 static void sh7372_suspend_init(void) {}
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -243,6 +243,25 @@ int pm_genpd_poweron(struct generic_pm_d
 	return ret;
 }
 
+/**
+ * pm_genpd_for_each_domain - Execute function for each generic PM domain.
+ * @fun: Function to execute.
+ */
+void pm_genpd_for_each_domain(void (*fun)(struct generic_pm_domain *))
+{
+	struct generic_pm_domain *genpd;
+
+	if (!fun)
+		return;
+
+	mutex_lock(&gpd_list_lock);
+
+	list_for_each_entry(genpd, &gpd_list, gpd_list_node)
+		fun(genpd);
+
+	mutex_unlock(&gpd_list_lock);
+}
+
 #endif /* CONFIG_PM */
 
 #ifdef CONFIG_PM_RUNTIME
@@ -598,14 +617,7 @@ static int pm_genpd_runtime_resume(struc
  */
 void pm_genpd_poweroff_unused(void)
 {
-	struct generic_pm_domain *genpd;
-
-	mutex_lock(&gpd_list_lock);
-
-	list_for_each_entry(genpd, &gpd_list, gpd_list_node)
-		genpd_queue_power_off_work(genpd);
-
-	mutex_unlock(&gpd_list_lock);
+	pm_genpd_for_each_domain(genpd_queue_power_off_work);
 }
 
 #else
Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -137,6 +137,7 @@ extern void pm_genpd_init(struct generic
 			  struct dev_power_governor *gov, bool is_off);
 
 extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
+extern void pm_genpd_for_each_domain(void (*fun)(struct generic_pm_domain *));
 
 extern bool default_stop_ok(struct device *dev);
 
@@ -189,6 +190,9 @@ static inline int pm_genpd_poweron(struc
 {
 	return -ENOSYS;
 }
+static inline void pm_genpd_for_each_domain(void (*fun)(struct generic_pm_domain *))
+{
+}
 static inline bool default_stop_ok(struct device *dev)
 {
 	return false;


^ permalink raw reply

* [PATCH 0/4] sh: div6 clock update for paul/common/clkfwk
From: Kuninori Morimoto @ 2011-12-05  6:25 UTC (permalink / raw)
  To: linux-sh


Hi Paul, Magnus

These are div6 clock update patch set for paul/common/clkfwk

Kuninori Morimoto (4):
      sh: clock-sh7723: add CLKDEV_ICK_ID for cleanup
      sh: modify SH_CLK_DIV6_EXT macro parameter
      sh: clock-sh7724: all div6_clks use SH_CLK_DIV6_EXT()
      sh: clock-sh73a0: all div6_clks use SH_CLK_DIV6_EXT()

#1 patch is not div6, but clean up patch.
#3, #4 try to use sh_clk_div6_reparent_register() for all div6 clock

Best regards
---
Kuninori Morimoto

^ permalink raw reply

* [PATCH 1/4] sh: clock-sh7723: add CLKDEV_ICK_ID for cleanup
From: Kuninori Morimoto @ 2011-12-05  6:25 UTC (permalink / raw)
  To: linux-sh

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/sh/kernel/cpu/sh4a/clock-sh7723.c |   76 +++++--------------------------
 1 files changed, 13 insertions(+), 63 deletions(-)

diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
index 3cc3827..f254166 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
@@ -233,73 +233,10 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]),
 	CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]),
 	CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]),
-	{
-		/* TMU0 */
-		.dev_id		= "sh_tmu.0",
-		.con_id		= "tmu_fck",
-		.clk		= &mstp_clks[HWBLK_TMU0],
-	}, {
-		/* TMU1 */
-		.dev_id		= "sh_tmu.1",
-		.con_id		= "tmu_fck",
-		.clk		= &mstp_clks[HWBLK_TMU0],
-	}, {
-		/* TMU2 */
-		.dev_id		= "sh_tmu.2",
-		.con_id		= "tmu_fck",
-		.clk		= &mstp_clks[HWBLK_TMU0],
-	},
 	CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]),
 	CLKDEV_CON_ID("rwdt0", &mstp_clks[HWBLK_RWDT]),
 	CLKDEV_CON_ID("dmac1", &mstp_clks[HWBLK_DMAC1]),
-	{
-		/* TMU3 */
-		.dev_id		= "sh_tmu.3",
-		.con_id		= "tmu_fck",
-		.clk		= &mstp_clks[HWBLK_TMU1],
-	}, {
-		/* TMU4 */
-		.dev_id		= "sh_tmu.4",
-		.con_id		= "tmu_fck",
-		.clk		= &mstp_clks[HWBLK_TMU1],
-	}, {
-		/* TMU5 */
-		.dev_id		= "sh_tmu.5",
-		.con_id		= "tmu_fck",
-		.clk		= &mstp_clks[HWBLK_TMU1],
-	},
 	CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]),
-	{
-		/* SCIF0 */
-		.dev_id		= "sh-sci.0",
-		.con_id		= "sci_fck",
-		.clk		= &mstp_clks[HWBLK_SCIF0],
-	}, {
-		/* SCIF1 */
-		.dev_id		= "sh-sci.1",
-		.con_id		= "sci_fck",
-		.clk		= &mstp_clks[HWBLK_SCIF1],
-	}, {
-		/* SCIF2 */
-		.dev_id		= "sh-sci.2",
-		.con_id		= "sci_fck",
-		.clk		= &mstp_clks[HWBLK_SCIF2],
-	}, {
-		/* SCIF3 */
-		.dev_id		= "sh-sci.3",
-		.con_id		= "sci_fck",
-		.clk		= &mstp_clks[HWBLK_SCIF3],
-	}, {
-		/* SCIF4 */
-		.dev_id		= "sh-sci.4",
-		.con_id		= "sci_fck",
-		.clk		= &mstp_clks[HWBLK_SCIF4],
-	}, {
-		/* SCIF5 */
-		.dev_id		= "sh-sci.5",
-		.con_id		= "sci_fck",
-		.clk		= &mstp_clks[HWBLK_SCIF5],
-	},
 	CLKDEV_CON_ID("msiof0", &mstp_clks[HWBLK_MSIOF0]),
 	CLKDEV_CON_ID("msiof1", &mstp_clks[HWBLK_MSIOF1]),
 	CLKDEV_CON_ID("meram0", &mstp_clks[HWBLK_MERAM]),
@@ -324,6 +261,19 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_CON_ID("veu0", &mstp_clks[HWBLK_VEU2H0]),
 	CLKDEV_CON_ID("vpu0", &mstp_clks[HWBLK_VPU]),
 	CLKDEV_CON_ID("lcdc0", &mstp_clks[HWBLK_LCDC]),
+
+	CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU0]),
+	CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU0]),
+	CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU0]),
+	CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[HWBLK_TMU1]),
+	CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[HWBLK_TMU1]),
+	CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[HWBLK_TMU1]),
+	CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[HWBLK_SCIF0]),
+	CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[HWBLK_SCIF1]),
+	CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[HWBLK_SCIF2]),
+	CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[HWBLK_SCIF3]),
+	CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[HWBLK_SCIF4]),
+	CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[HWBLK_SCIF5]),
 };
 
 int __init arch_clk_init(void)
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 2/4] sh: modify SH_CLK_DIV6_EXT macro parameter
From: Kuninori Morimoto @ 2011-12-05  6:26 UTC (permalink / raw)
  To: linux-sh

array size which can be calculated from specific table was removed,
and the "flags" which can use CLK_ENABLE_ON_INIT became last parameter.

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

diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index e349c22..bb7fe48 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -411,12 +411,9 @@ static struct clk *fsibckcr_parent[] = {
 };
 
 static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
-	[DIV6_HDMI] = SH_CLK_DIV6_EXT(HDMICKCR, 0,
-				      hdmi_parent, ARRAY_SIZE(hdmi_parent), 6, 2),
-	[DIV6_FSIA] = SH_CLK_DIV6_EXT(FSIACKCR, 0,
-				      fsiackcr_parent, ARRAY_SIZE(fsiackcr_parent), 6, 2),
-	[DIV6_FSIB] = SH_CLK_DIV6_EXT(FSIBCKCR, 0,
-				      fsibckcr_parent, ARRAY_SIZE(fsibckcr_parent), 6, 2),
+	[DIV6_HDMI] = SH_CLK_DIV6_EXT(HDMICKCR, hdmi_parent, 6, 2, 0),
+	[DIV6_FSIA] = SH_CLK_DIV6_EXT(FSIACKCR, fsiackcr_parent, 6, 2, 0),
+	[DIV6_FSIB] = SH_CLK_DIV6_EXT(FSIBCKCR, fsibckcr_parent, 6, 2, 0),
 };
 
 /* FSI DIV */
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 7711838..4957ca4 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -189,10 +189,8 @@ static struct clk *fclkbcr_parent[] = {
 };
 
 static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
-	[DIV6_FA] = SH_CLK_DIV6_EXT(FCLKACR, 0,
-				      fclkacr_parent, ARRAY_SIZE(fclkacr_parent), 6, 2),
-	[DIV6_FB] = SH_CLK_DIV6_EXT(FCLKBCR, 0,
-				      fclkbcr_parent, ARRAY_SIZE(fclkbcr_parent), 6, 2),
+	[DIV6_FA] = SH_CLK_DIV6_EXT(FCLKACR, fclkacr_parent, 6, 2, 0),
+	[DIV6_FB] = SH_CLK_DIV6_EXT(FCLKBCR, fclkbcr_parent, 6, 2, 0),
 };
 
 static struct clk mstp_clks[HWBLK_NR] = {
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index e834304..4d65540 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -131,13 +131,12 @@ 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(_reg, _flags, _parents,			\
-			_num_parents, _src_shift, _src_width)	\
+#define SH_CLK_DIV6_EXT(_reg, _parents, _src_shift, _src_width, _flags)\
 {								\
 	.enable_reg = (void __iomem *)_reg,			\
 	.flags = _flags,					\
 	.parent_table = _parents,				\
-	.parent_num = _num_parents,				\
+	.parent_num = ARRAY_SIZE(_parents),			\
 	.src_shift = _src_shift,				\
 	.src_width = _src_width,				\
 }
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 3/4] sh: clock-sh7724: all div6_clks use SH_CLK_DIV6_EXT()
From: Kuninori Morimoto @ 2011-12-05  6:26 UTC (permalink / raw)
  To: linux-sh

Current div6 clocks can specify their current parent clocks
from its register value if it is registered
by sh_clk_div6_reparent_register().
This patch modifies all div6 clocks into SH_CLK_DIV6_EXT().

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

diff --git a/arch/sh/include/cpu-sh4/cpu/sh7724.h b/arch/sh/include/cpu-sh4/cpu/sh7724.h
index cbc47e6..36ce466 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7724.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7724.h
@@ -314,5 +314,6 @@ enum {
 
 extern struct clk sh7724_fsimcka_clk;
 extern struct clk sh7724_fsimckb_clk;
+extern struct clk sh7724_dv_clki;
 
 #endif /* __ASM_SH7724_H__ */
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 4957ca4..a374cbc 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -111,13 +111,16 @@ static struct clk div3_clk = {
 	.parent		= &pll_clk,
 };
 
-/* External input clock (pin name: FSIMCKA/FSIMCKB ) */
+/* External input clock (pin name: FSIMCKA/FSIMCKB/DV_CLKI ) */
 struct clk sh7724_fsimcka_clk = {
 };
 
 struct clk sh7724_fsimckb_clk = {
 };
 
+struct clk sh7724_dv_clki = {
+};
+
 static struct clk *main_clks[] = {
 	&r_clk,
 	&extal_clk,
@@ -126,6 +129,7 @@ static struct clk *main_clks[] = {
 	&div3_clk,
 	&sh7724_fsimcka_clk,
 	&sh7724_fsimckb_clk,
+	&sh7724_dv_clki,
 };
 
 static void div4_kick(struct clk *clk)
@@ -163,17 +167,25 @@ struct clk div4_clks[DIV4_NR] = {
 	[DIV4_M1] = DIV4(FRQCRB, 4, 0x2f7c, CLK_ENABLE_ON_INIT),
 };
 
-enum { DIV6_V, DIV6_I, DIV6_S, DIV6_NR };
+enum { DIV6_V, DIV6_I, DIV6_S, DIV6_FA, DIV6_FB, DIV6_NR };
 
-static struct clk div6_clks[DIV6_NR] = {
-	[DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0),
-	[DIV6_I] = SH_CLK_DIV6(&div3_clk, IRDACLKCR, 0),
-	[DIV6_S] = SH_CLK_DIV6(&div3_clk, SPUCLKCR, CLK_ENABLE_ON_INIT),
+/* Indices are important - they are the actual src selecting values */
+static struct clk *common_parent[] = {
+	[0] = &div3_clk,
+	[1] = NULL,
 };
 
-enum { DIV6_FA, DIV6_FB, DIV6_REPARENT_NR };
+static struct clk *vclkcr_parent[] = {
+	[0] = &div3_clk,
+	[1] = NULL,
+	[2] = &sh7724_dv_clki,
+	[3] = NULL,
+	[4] = &extal_clk,
+	[5] = NULL,
+	[6] = NULL,
+	[7] = NULL,
+};
 
-/* Indices are important - they are the actual src selecting values */
 static struct clk *fclkacr_parent[] = {
 	[0] = &div3_clk,
 	[1] = NULL,
@@ -188,7 +200,10 @@ static struct clk *fclkbcr_parent[] = {
 	[3] = NULL,
 };
 
-static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
+static struct clk div6_clks[DIV6_NR] = {
+	[DIV6_V] = SH_CLK_DIV6_EXT(VCLKCR, vclkcr_parent, 12, 3, 0),
+	[DIV6_I] = SH_CLK_DIV6_EXT(IRDACLKCR, common_parent, 6, 1, 0),
+	[DIV6_S] = SH_CLK_DIV6_EXT(SPUCLKCR, common_parent, 6, 1, CLK_ENABLE_ON_INIT),
 	[DIV6_FA] = SH_CLK_DIV6_EXT(FCLKACR, fclkacr_parent, 6, 2, 0),
 	[DIV6_FB] = SH_CLK_DIV6_EXT(FCLKBCR, fclkbcr_parent, 6, 2, 0),
 };
@@ -267,8 +282,8 @@ static struct clk_lookup lookups[] = {
 
 	/* DIV6 clocks */
 	CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]),
-	CLKDEV_CON_ID("fsia_clk", &div6_reparent_clks[DIV6_FA]),
-	CLKDEV_CON_ID("fsib_clk", &div6_reparent_clks[DIV6_FB]),
+	CLKDEV_CON_ID("fsia_clk", &div6_clks[DIV6_FA]),
+	CLKDEV_CON_ID("fsib_clk", &div6_clks[DIV6_FB]),
 	CLKDEV_CON_ID("irda_clk", &div6_clks[DIV6_I]),
 	CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_S]),
 
@@ -354,10 +369,7 @@ int __init arch_clk_init(void)
 		ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
 
 	if (!ret)
-		ret = sh_clk_div6_register(div6_clks, DIV6_NR);
-
-	if (!ret)
-		ret = sh_clk_div6_reparent_register(div6_reparent_clks, DIV6_REPARENT_NR);
+		ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR);
 
 	if (!ret)
 		ret = sh_hwblk_clk_register(mstp_clks, HWBLK_NR);
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 4/4] sh: clock-sh73a0: all div6_clks use SH_CLK_DIV6_EXT()
From: Kuninori Morimoto @ 2011-12-05  6:32 UTC (permalink / raw)
  To: linux-sh

Current div6 clocks can specify their current parent clocks
from its register value if it is registered
by sh_clk_div6_reparent_register().
This patch modifies all div6 clocks into SH_CLK_DIV6_EXT().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/clock-sh73a0.c        |  132 +++++++++++++++++++++-----
 arch/arm/mach-shmobile/include/mach/common.h |    2 +
 2 files changed, 112 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 61a846b..8daf21a 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -92,6 +92,24 @@ static struct clk_ops div2_clk_ops = {
 	.recalc		= div2_recalc,
 };
 
+static unsigned long div7_recalc(struct clk *clk)
+{
+	return clk->parent->rate / 7;
+}
+
+static struct clk_ops div7_clk_ops = {
+	.recalc		= div7_recalc,
+};
+
+static unsigned long div13_recalc(struct clk *clk)
+{
+	return clk->parent->rate / 13;
+}
+
+static struct clk_ops div13_clk_ops = {
+	.recalc		= div13_recalc,
+};
+
 /* Divide extal1 by two */
 static struct clk extal1_div2_clk = {
 	.ops		= &div2_clk_ops,
@@ -113,6 +131,11 @@ static struct clk main_clk = {
 	.ops		= &main_clk_ops,
 };
 
+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)
 {
@@ -168,12 +191,29 @@ static struct clk pll3_clk = {
 	.enable_bit	= 3,
 };
 
-/* Divide PLL1 by two */
+/* Divide PLL */
 static struct clk pll1_div2_clk = {
 	.ops		= &div2_clk_ops,
 	.parent		= &pll1_clk,
 };
 
+static struct clk pll1_div7_clk = {
+	.ops		= &div7_clk_ops,
+	.parent		= &pll1_clk,
+};
+
+static struct clk pll1_div13_clk = {
+	.ops		= &div13_clk_ops,
+	.parent		= &pll1_clk,
+};
+
+/* External input clock */
+struct clk sh73a0_extcki_clk = {
+};
+
+struct clk sh73a0_extalr_clk = {
+};
+
 static struct clk *main_clks[] = {
 	&r_clk,
 	&sh73a0_extal1_clk,
@@ -181,11 +221,16 @@ static struct clk *main_clks[] = {
 	&extal1_div2_clk,
 	&extal2_div2_clk,
 	&main_clk,
+	&main_div2_clk,
 	&pll0_clk,
 	&pll1_clk,
 	&pll2_clk,
 	&pll3_clk,
 	&pll1_div2_clk,
+	&pll1_div7_clk,
+	&pll1_div13_clk,
+	&sh73a0_extcki_clk,
+	&sh73a0_extalr_clk,
 };
 
 static void div4_kick(struct clk *clk)
@@ -239,27 +284,70 @@ enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1,
 	DIV6_DSIT, DIV6_DSI0P, DIV6_DSI1P,
 	DIV6_NR };
 
+static struct clk *vck_parent[] = {
+	[0] = &pll1_div2_clk,
+	[1] = &pll2_clk,
+	[2] = &sh73a0_extcki_clk,
+	[3] = &sh73a0_extal2_clk,
+	[4] = &main_div2_clk,
+	[5] = &sh73a0_extalr_clk,
+	[6] = &main_clk,
+	[7] = NULL,
+};
+
+static struct clk *pll_parent[] = {
+	[0] = &pll1_div2_clk,
+	[1] = &pll2_clk,
+	[2] = &pll1_div13_clk,
+	[3] = NULL,
+};
+
+static struct clk *hsi_parent[] = {
+	[0] = &pll1_div2_clk,
+	[1] = &pll2_clk,
+	[2] = &pll1_div7_clk,
+	[3] = NULL,
+};
+
+static struct clk *pll_extal2_parent[] = {
+	[0] = &pll1_div2_clk,
+	[1] = &pll2_clk,
+	[2] = &sh73a0_extal2_clk,
+	[3] = &sh73a0_extal2_clk,
+};
+
+static struct clk *dsi_parent[] = {
+	[0] = &pll1_div2_clk,
+	[1] = &pll2_clk,
+	[2] = &main_clk,
+	[3] = &sh73a0_extal2_clk,
+	[4] = &sh73a0_extcki_clk,
+	[5] = NULL,
+	[6] = NULL,
+	[7] = NULL,
+};
+
 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_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),
-	[DIV6_SDHI2] = SH_CLK_DIV6(&pll1_div2_clk, SD2CKCR, 0),
-	[DIV6_FSIA] = SH_CLK_DIV6(&pll1_div2_clk, FSIACKCR, 0),
-	[DIV6_FSIB] = SH_CLK_DIV6(&pll1_div2_clk, FSIBCKCR, 0),
-	[DIV6_SUB] = SH_CLK_DIV6(&sh73a0_extal2_clk, SUBCKCR, 0),
-	[DIV6_SPUA] = SH_CLK_DIV6(&pll1_div2_clk, SPUACKCR, 0),
-	[DIV6_SPUV] = SH_CLK_DIV6(&pll1_div2_clk, SPUVCKCR, 0),
-	[DIV6_MSU] = SH_CLK_DIV6(&pll1_div2_clk, MSUCKCR, 0),
-	[DIV6_HSI] = SH_CLK_DIV6(&pll1_div2_clk, HSICKCR, 0),
-	[DIV6_MFG1] = SH_CLK_DIV6(&pll1_div2_clk, MFCK1CR, 0),
-	[DIV6_MFG2] = SH_CLK_DIV6(&pll1_div2_clk, MFCK2CR, 0),
-	[DIV6_DSIT] = SH_CLK_DIV6(&pll1_div2_clk, DSITCKCR, 0),
-	[DIV6_DSI0P] = SH_CLK_DIV6(&pll1_div2_clk, DSI0PCKCR, 0),
-	[DIV6_DSI1P] = SH_CLK_DIV6(&pll1_div2_clk, DSI1PCKCR, 0),
+	[DIV6_VCK1]	= SH_CLK_DIV6_EXT(VCLKCR1, vck_parent, 12, 3, 0),
+	[DIV6_VCK2]	= SH_CLK_DIV6_EXT(VCLKCR2, vck_parent, 12, 3, 0),
+	[DIV6_VCK3]	= SH_CLK_DIV6_EXT(VCLKCR3, vck_parent, 12, 3, 0),
+	[DIV6_ZB1]	= SH_CLK_DIV6_EXT(ZBCKCR,  pll_parent, 7, 1, 0),
+	[DIV6_FLCTL]	= SH_CLK_DIV6_EXT(FLCKCR,  pll_parent, 7, 1, 0),
+	[DIV6_SDHI0]	= SH_CLK_DIV6_EXT(SD0CKCR, pll_parent, 6, 2, 0),
+	[DIV6_SDHI1]	= SH_CLK_DIV6_EXT(SD1CKCR, pll_parent, 6, 2, 0),
+	[DIV6_SDHI2]	= SH_CLK_DIV6_EXT(SD2CKCR, pll_parent, 6, 2, 0),
+	[DIV6_FSIA]	= SH_CLK_DIV6_EXT(FSIACKCR, pll_parent, 6, 1, 0),
+	[DIV6_FSIB]	= SH_CLK_DIV6_EXT(FSIBCKCR, pll_parent, 6, 1, 0),
+	[DIV6_SUB]	= SH_CLK_DIV6_EXT(SUBCKCR,  pll_extal2_parent, 6, 2, 0),
+	[DIV6_SPUA]	= SH_CLK_DIV6_EXT(SPUACKCR, pll_extal2_parent, 6, 2, 0),
+	[DIV6_SPUV]	= SH_CLK_DIV6_EXT(SPUVCKCR, pll_extal2_parent, 6, 2, 0),
+	[DIV6_MSU]	= SH_CLK_DIV6_EXT(MSUCKCR, pll_parent, 7, 1, 0),
+	[DIV6_HSI]	= SH_CLK_DIV6_EXT(HSICKCR, hsi_parent, 6, 2, 0),
+	[DIV6_MFG1]	= SH_CLK_DIV6_EXT(MFCK1CR, pll_parent, 7, 1, 0),
+	[DIV6_MFG2]	= SH_CLK_DIV6_EXT(MFCK2CR, pll_parent, 7, 1, 0),
+	[DIV6_DSIT]	= SH_CLK_DIV6_EXT(DSITCKCR, pll_parent, 7, 1, 0),
+	[DIV6_DSI0P]	= SH_CLK_DIV6_EXT(DSI0PCKCR, dsi_parent, 12, 3, 0),
+	[DIV6_DSI1P]	= SH_CLK_DIV6_EXT(DSI1PCKCR, dsi_parent, 12, 3, 0),
 };
 
 enum { MSTP001,
@@ -387,7 +475,7 @@ void __init sh73a0_clock_init(void)
 		ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
 
 	if (!ret)
-		ret = sh_clk_div6_register(div6_clks, DIV6_NR);
+		ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR);
 
 	if (!ret)
 		ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR);
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 834bd6c..d055d05 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -47,6 +47,8 @@ extern void sh73a0_clock_init(void);
 extern void sh73a0_pinmux_init(void);
 extern struct clk sh73a0_extal1_clk;
 extern struct clk sh73a0_extal2_clk;
+extern struct clk sh73a0_extcki_clk;
+extern struct clk sh73a0_extalr_clk;
 
 extern unsigned int sh73a0_get_core_count(void);
 extern void sh73a0_secondary_init(unsigned int cpu);
-- 
1.7.5.4


^ permalink raw reply related

* Re: [PATCH-RFC 09/10] sh: switch to GENERIC_PCI_IOMAP
From: Paul Mundt @ 2011-12-06  5:08 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <20111204104858.GK15464@redhat.com>

On Sun, Dec 04, 2011 at 12:48:59PM +0200, Michael S. Tsirkin wrote:
> On Thu, Nov 24, 2011 at 10:20:37PM +0200, Michael S. Tsirkin wrote:
> > sh copied pci_iomap from generic code, probably to avoid
> > pulling the rest of iomap.c in.  Since that's in
> > a separate file now, we can reuse the common implementation.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Sorry to nag, any ACKs/NACKs on the sh changes?
> I intend to send this to Linus if there are no
> objections. Thanks!
> 
Nope, looks fine to me.

Acked-by: Paul Mundt <lethal@linux-sh.org>

^ permalink raw reply

* Re: [PATCH 2/4] sh: modify SH_CLK_DIV6_EXT macro parameter
From: Paul Mundt @ 2011-12-06  5:22 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <874nxf8rgh.wl%kuninori.morimoto.gx@renesas.com>

On Sun, Dec 04, 2011 at 10:26:09PM -0800, Kuninori Morimoto wrote:
> array size which can be calculated from specific table was removed,
> and the "flags" which can use CLK_ENABLE_ON_INIT became last parameter.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

It can, but no, I don't really like these sorts of changes. From a usage
point of view it might look more straightforward but in reality it's just
pushing down complexity in to the macro that's non-obvious without
manually going and looking at the macro definition.

Saving a bit of screen real-estate isn't worth the hassle of having to
track down macro definitions to find out what exactly they're doing.

^ permalink raw reply

* Re: [PATCH 1/4] sh: clock-sh7723: add CLKDEV_ICK_ID for cleanup
From: Paul Mundt @ 2011-12-06  5:23 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <8762hv8rh3.wl%kuninori.morimoto.gx@renesas.com>

On Sun, Dec 04, 2011 at 10:25:48PM -0800, Kuninori Morimoto wrote:
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  arch/sh/kernel/cpu/sh4a/clock-sh7723.c |   76 +++++--------------------------
>  1 files changed, 13 insertions(+), 63 deletions(-)
> 
This one looks fine.

^ permalink raw reply

* Re: [PATCH 3/4] sh: clock-sh7724: all div6_clks use SH_CLK_DIV6_EXT()
From: Paul Mundt @ 2011-12-06  5:25 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <8739cz8rfx.wl%kuninori.morimoto.gx@renesas.com>

On Sun, Dec 04, 2011 at 10:26:30PM -0800, Kuninori Morimoto wrote:
> -static struct clk div6_clks[DIV6_NR] = {
> -	[DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0),
> -	[DIV6_I] = SH_CLK_DIV6(&div3_clk, IRDACLKCR, 0),
> -	[DIV6_S] = SH_CLK_DIV6(&div3_clk, SPUCLKCR, CLK_ENABLE_ON_INIT),
> +/* Indices are important - they are the actual src selecting values */
> +static struct clk *common_parent[] = {
> +	[0] = &div3_clk,
> +	[1] = NULL,
>  };
>  
> -enum { DIV6_FA, DIV6_FB, DIV6_REPARENT_NR };
> +static struct clk *vclkcr_parent[] = {
> +	[0] = &div3_clk,
> +	[1] = NULL,
> +	[2] = &sh7724_dv_clki,
> +	[3] = NULL,
> +	[4] = &extal_clk,
> +	[5] = NULL,
> +	[6] = NULL,
> +	[7] = NULL,
> +};
>  
You don't really need any of these NULL initializers, they can all be
dropped.

^ permalink raw reply

* Re: [PATCH 4/4] sh: clock-sh73a0: all div6_clks use SH_CLK_DIV6_EXT()
From: Paul Mundt @ 2011-12-06  5:26 UTC (permalink / raw)
  To: linux-sh
In-Reply-To: <871usj8r6b.wl%kuninori.morimoto.gx@renesas.com>

On Sun, Dec 04, 2011 at 10:32:16PM -0800, Kuninori Morimoto wrote:
> Current div6 clocks can specify their current parent clocks
> from its register value if it is registered
> by sh_clk_div6_reparent_register().
> This patch modifies all div6 clocks into SH_CLK_DIV6_EXT().
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This one looks fine too, although it will need to be respun to not depend
on 2/4.

^ 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