ARM: S5P: Fix USB and 48M clock enable procedure
Subsystems (3)
PATCH 1/1 ARM: S5P: Fix USB and 48M clock enable procedure
---
arch/arm/mach-s5p6440/clock.c | 23 ------- arch/arm/plat-s5p/clock.c | 86 ++++++++++++++++++++++++++++ arch/arm/plat-s5p/include/plat/s5p-clock.h | 1 3 files changed, 86 insertions(+), 24 deletions(-)
arch/arm/mach-s5p6440/clock.c +0 -23
@@ -295,27 +295,6 @@ static struct clksrc_clk clk_pclk_low = { .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 }, }; -int s5p6440_clk48m_ctrl (struct clk *clk,int enable) -{ -unsigned long flags; -u32 val; - -/* can't rely on clock lock, this register has other usages */ -local_irq_save (flags); - - val =__raw_readl (S5P_OTHERS ); -if (enable) - val |=S5P_OTHERS_USB_SIG_MASK ; -else - val &= ~S5P_OTHERS_USB_SIG_MASK ; - -__raw_writel (val,S5P_OTHERS ); - -local_irq_restore (flags); - -return 0 ; -} -static int s5p6440_pclk_ctrl (struct clk *clk,int enable) {return s5p_gatectrl (S5P_CLK_GATE_PCLK , clk, enable);
@@ -769,8 +748,6 @@ void __init_or_cpufreq s5p6440_setup_clocks(void) clk_fout_epll.enable = s5p6440_epll_enable; clk_fout_epll.ops = &s5p6440_epll_ops; - clk_48m.enable = s5p6440_clk48m_ctrl; - xtal_clk =clk_get (NULL ,"ext_xtal" );BUG_ON (IS_ERR (xtal_clk));
arch/arm/plat-s5p/clock.c +86 -0
112 lines not on this page · raw message
arch/arm/plat-s5p/include/plat/s5p-clock.h +0 -1
@@ -38,7 +38,6 @@ extern struct clksrc_sources clk_src_apll;extern struct clksrc_sources clk_src_mpll;extern struct clksrc_sources clk_src_epll; -extern int s5p6440_clk48m_ctrl (struct clk *clk,int enable);extern int s5p_gatectrl (void __iomem *reg,struct clk *clk,int enable);#endif /* __ASM_PLAT_S5P_CLOCK_H */
PATCH 1/1 ARM: S5P: Fix USB and 48M clock enable procedure
Quoted 10 lines · Paulius Zaleckas
Signed-off-by Paulius Zaleckas <[email protected]>---
arch/arm/mach-s5p6440/clock.c | 23 ------- arch/arm/plat-s5p/clock.c | 86 ++++++++++++++++++++++++++++ arch/arm/plat-s5p/include/plat/s5p-clock.h | 1 3 files changed, 86 insertions(+), 24 deletions(-)
Hi Paulius,
There are some comments about your patches which includes previous S3C64XX patches.
Basically your approach looks good trial and structure...but I'm not sure whether your approach can be used commonly on Samsung's all SoCs or not. Need to do more test on boards and I already informed your patches to USB engineers in my team, actually need to discuss about this.
As a note, I know, 'xusbxti' clock is structure for external xtal which is used for generating USB clock on board... it depends on board condition, because can be used 12/24/48Mhz on board. The clk_48m means generated actual USB clock, 48Mhz. So should be implemented enable function by using clk_48m...
Anyway let you know about the result of internal discussion soon, then let's talk.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
PATCH 1/1 ARM: S5P: Fix USB and 48M clock enable procedure
Quoted 11 lines · Kukjin Kim
Quoted 10 lines · Paulius Zaleckas
Signed-off-by Paulius Zaleckas <[email protected]>---
?arch/arm/mach-s5p6440/clock.c ? ? ? ? ? ? ?| ? 23 ------- ?arch/arm/plat-s5p/clock.c ? ? ? ? ? ? ? ? ?| ? 86
++++++++++++++++++++++++++++
?arch/arm/plat-s5p/include/plat/s5p-clock.h | ? ?1 ?3 files changed, 86 insertions(+), 24 deletions(-)
Quoted 8 lines
Hi Paulius,
There are some comments about your patches which includes previous S3C64XX patches.
Basically your approach looks good trial and structure...but I'm not sure whether your approach can be used commonly on Samsung's all SoCs or not. Need to do more test on boards and I already informed your patches to USB engineers in my team, actually need to discuss about this.
As a note, I know, 'xusbxti' clock is structure for external xtal which is used for generating USB clock on board... it depends on board condition, because can be used 12/24/48Mhz on board. The
clk_48mmeans generated actual USB clock, 48Mhz. So should be implemented enable function by usingclk_48m...
I don't agree that enable should be for clk_48m. The reason is that IMO it is possible
to enable 48m clock, but suspend the clock for USB device part (I am not sure about this yet...).
If that is true than I think we will need one more clk for USB device:
/->clk_48m
xusbxti-|
\->clk_usb_deviceQuoted 9 lines
Anyway let you know about the result of internal discussion soon, then let's talk.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
PATCH 1/1 ARM: S5P: Fix USB and 48M clock enable procedure
Quoted 2 lines · Paulius Zaleckas
On Thu, Oct 14, 2010 at 12:03 PM, Kukjin Kim <[email protected]>
Quoted 11 lines · wrote:
Quoted 11 lines
Quoted 10 lines · Paulius Zaleckas
Signed-off-by Paulius Zaleckas <[email protected]>---
arch/arm/mach-s5p6440/clock.c | 23 ------- arch/arm/plat-s5p/clock.c | 86 ++++++++++++++++++++++++++++ arch/arm/plat-s5p/include/plat/s5p-clock.h | 1 3 files changed, 86 insertions(+), 24 deletions(-)
Quoted 3 lines
Quoted 3 lines
Hi Paulius,
There are some comments about your patches which includes previous
S3C64XX
Quoted 3 lines
patches.
Quoted 2 lines
Basically your approach looks good trial and structure...but I'm not
sure
Quoted 2 lines
whether your approach can be used commonly on Samsung's all SoCs or not.
Quoted 1 line
Need to do more test on boards and I already informed your patches to
USB
Quoted 3 lines
engineers in my team, actually need to discuss about this.
Quoted 2 lines
As a note, I know, 'xusbxti' clock is structure for external xtal which
is
Quoted 2 lines
used for generating USB clock on board... it depends on board condition, because can be used 12/24/48Mhz on board. The
clk_48mmeans generated
actual
Quoted 1 line
USB clock, 48Mhz. So should be implemented enable function by using
clk_48m...
Quoted 5 lines
I don't agree that enable should be for
clk_48m. The reason is that IMO it is possible
to enable 48m clock, but suspend the clock for USB device part (I am not sure about this yet...).
Umm...please see below.
|\
xxti------|O|
|M|-----..System..-- HCLK --> usb_device...
xusbxti---| | |
| |/ |
| |
(1) (2) -------------
---------| USB OTG Phy | --> clk_48M
-------------Firstly, 'xusbxti' can be used to system clock when selected by OM pin. As I said, the rate of xusbxti can be 12/24/48Mhz and there is it on board...usually is used 12Mhz or 24Mhz on SMDK board.
It means depends on board and always enabled, so no need following 'rate' and 'enable' in your following patch.
struct clk clk_xusbxti = {
.name = "xusbxti",
.id = -1,
+ .rate = 48000000,
+ .enable = clk_xusbxti_ctrl,
};
struct clk s5p_clk_27m = {
@@ -49,6 +134,7 @@ struct clk clk_48m = {
.name = "clk_48m",
.id = -1,
.rate = 48000000,
+ .parent = &clk_xusbxti,
};
According to above clock diagram, the parent of 'clk_48m' can be 'xxti' or 'xusbxti', it is decided by SoC and OM pin. For example, there is line (1) on S5P6440 so your patch is right, but there is line (2) on S5PC100 but line (1) so it's wrong..the parent of clk_48m can be xxti by OM Pin.
It means the parent of clk_48m depends on SoC, can't define it in the plat- s5p. And maybe as you know, in the S5PV210/S5PC110 case, need two clk_48m structures for Host and Device...
So its clock structure has SoC(ARCH) dependency and it's difficult to merge it into plat-s5p now.
We need to re-think to implement it...and I and my team will sort out it.
Quoted 7 lines
If that is true than I think we will need one more clk for USB device:
/->clk_48m xusbxti-| \->clk_usb_device
Actually, it's different on each SoCs...
Quoted 3 lines
Quoted 1 line
Anyway let you know about the result of internal discussion soon, then
let's talk.
Quoted 1 line
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
PATCH 1/1 ARM: S5P: Fix USB and 48M clock enable procedure
Quoted 79 lines · Kukjin Kim
Quoted 2 lines · Paulius Zaleckas
On Thu, Oct 14, 2010 at 12:03 PM, Kukjin Kim<[email protected]>
Quoted 11 lines · wrote:
Quoted 11 lines
Quoted 10 lines · Paulius Zaleckas
Signed-off-by Paulius Zaleckas<[email protected]>---
arch/arm/mach-s5p6440/clock.c | 23 ------- arch/arm/plat-s5p/clock.c | 86 ++++++++++++++++++++++++++++ arch/arm/plat-s5p/include/plat/s5p-clock.h | 1 3 files changed, 86 insertions(+), 24 deletions(-)Quoted 3 lines
Quoted 3 lines
Hi Paulius,
There are some comments about your patches which includes previous
S3C64XX
Quoted 3 lines
patches.
Quoted 2 lines
Basically your approach looks good trial and structure...but I'm not
sure
Quoted 2 lines
whether your approach can be used commonly on Samsung's all SoCs or not.
Quoted 1 line
Need to do more test on boards and I already informed your patches to
USB
Quoted 3 lines
engineers in my team, actually need to discuss about this.
Quoted 2 lines
As a note, I know, 'xusbxti' clock is structure for external xtal which
is
Quoted 2 lines
used for generating USB clock on board... it depends on board condition, because can be used 12/24/48Mhz on board. The
clk_48mmeans generatedactual
Quoted 1 line
USB clock, 48Mhz. So should be implemented enable function by using
clk_48m...Quoted 5 lines
I don't agree that enable should be for
clk_48m. The reason is that IMO it is possible
to enable 48m clock, but suspend the clock for USB device part (I am not sure about this yet...).Umm...please see below.
|\ xxti------|O| |M|-----..System..-- HCLK --> usb_device... xusbxti---| | | | |/ | | | (1) (2) ------------- ---------| USB OTG Phy | --> clk_48M -------------Firstly, 'xusbxti' can be used to system clock when selected by OM pin. As I said, the rate of xusbxti can be 12/24/48Mhz and there is it on board...usually is used 12Mhz or 24Mhz on SMDK board.
It means depends on board and always enabled, so no need following 'rate' and 'enable' in your following patch.struct clk clk_xusbxti = { .name = "xusbxti", .id = -1,arch/arm/plat-s5p/clock.c +3
-0+ .rate = 48000000, + .enable = clk_xusbxti_ctrl, };struct clk s5p_clk_27m = {@@ -49,6 +134,7 @@ struct clk clk_48m = { .name = "clk_48m", .id = -1, .rate = 48000000, + .parent =&clk_xusbxti, };According to above clock diagram, the parent of '
clk_48m' can be 'xxti' or 'xusbxti', it is decided by SoC and OM pin. For example, there is line (1) on S5P6440 so your patch is right, but there is line (2) on S5PC100 but line (1) so it's wrong..the parent ofclk_48mcan be xxti by OM Pin.
Quoted 6 lines
It means the parent of
clk_48mdepends on SoC, can't define it in the plat- s5p. And maybe as you know, in the S5PV210/S5PC110 case, need twoclk_48mstructures for Host and Device...So its clock structure has SoC(ARCH) dependency and it's difficult to merge it into plat-s5p now.
I see... So maybe the best option is to define enable function not per platform, but per machine.
Originally I was trying to solve bug where OHCI was not working on S3C6410. I discovered that I need to select different clock source for it or fix enable procedure for 48M. For S5P platform I have datasheet only for S5PC100 and yes you are right about clock structure there.
Quoted 1 line
We need to re-think to implement it...and I and my team will sort out it.
Looking forward!
Quoted 22 lines
Quoted 7 lines
If that is true than I think we will need one more clk for USB device:
/->clk_48m xusbxti-| \->clk_usb_deviceActually, it's different on each SoCs...
Quoted 3 lines
Quoted 1 line
Anyway let you know about the result of internal discussion soon, then
let's talk.
Quoted 1 line
Thanks.
Best regards,
Kgene.
--
Kukjin Kim<[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.