* net{space,xbig} TCLK determination @ 2010-10-20 5:08 Lennert Buytenhek 2010-10-20 8:48 ` Simon Guinot 0 siblings, 1 reply; 17+ messages in thread From: Lennert Buytenhek @ 2010-10-20 5:08 UTC (permalink / raw) To: linux-arm-kernel Hi, The net{space,xbig} board support files have this: static void netspace_v2_timer_init(void) { kirkwood_tclk = 166666667; orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); } This is a pretty ugly hack -- if kirkwood_find_tclk() is not determining the right TCLK on these boards, then that would be the real bug, and it should be fixed there, and not by putting hacks like these in board support files. thanks, Lennert ^ permalink raw reply [flat|nested] 17+ messages in thread
* net{space,xbig} TCLK determination 2010-10-20 5:08 net{space,xbig} TCLK determination Lennert Buytenhek @ 2010-10-20 8:48 ` Simon Guinot 2010-10-20 8:57 ` Lennert Buytenhek 0 siblings, 1 reply; 17+ messages in thread From: Simon Guinot @ 2010-10-20 8:48 UTC (permalink / raw) To: linux-arm-kernel Hi Lennert, On Wed, Oct 20, 2010 at 07:08:20AM +0200, Lennert Buytenhek wrote: > Hi, > > The net{space,xbig} board support files have this: > > static void netspace_v2_timer_init(void) > { > kirkwood_tclk = 166666667; > orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); > } > > This is a pretty ugly hack -- if kirkwood_find_tclk() is not > determining the right TCLK on these boards, then that would be the > real bug, and it should be fixed there, and not by putting hacks > like these in board support files. In the Marvell LSP, TCLK detection is based on the Sample at Reset Register bit 21. There is no description about this bit usage in the Kirkwood functional specification document. The given result _seems_ to be correct for the boards on my desk, but I have no idea how this way is reliable... I simply don't have the needed platform knowledge to solve this issue. So, if you want me to fix kirkwood_find_tclk(), you will have to give more hints. The lacie_v2_timer_init() function is maybe a ugly hack but that is the only I found. My concern was to avoid breaking TCLK detection for other boards. Thanks, Simon -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20101020/a2471756/attachment.sig> ^ permalink raw reply [flat|nested] 17+ messages in thread
* net{space,xbig} TCLK determination 2010-10-20 8:48 ` Simon Guinot @ 2010-10-20 8:57 ` Lennert Buytenhek 2010-10-21 7:45 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Simon Guinot 2010-10-21 9:42 ` [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection Simon Guinot 0 siblings, 2 replies; 17+ messages in thread From: Lennert Buytenhek @ 2010-10-20 8:57 UTC (permalink / raw) To: linux-arm-kernel On Wed, Oct 20, 2010 at 08:48:26AM +0000, Simon Guinot wrote: > Hi Lennert, Hi Simon, > > The net{space,xbig} board support files have this: > > > > static void netspace_v2_timer_init(void) > > { > > kirkwood_tclk = 166666667; > > orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); > > } > > > > This is a pretty ugly hack -- if kirkwood_find_tclk() is not > > determining the right TCLK on these boards, then that would be the > > real bug, and it should be fixed there, and not by putting hacks > > like these in board support files. > > In the Marvell LSP, TCLK detection is based on the Sample at Reset > Register bit 21. There is no description about this bit usage in the > Kirkwood functional specification document. > The given result _seems_ to be correct for the boards on my desk, but > I have no idea how this way is reliable... > > I simply don't have the needed platform knowledge to solve this issue. > So, if you want me to fix kirkwood_find_tclk(), you will have to give > more hints. This came up when the upstream kirkwood port was initially done, and the reliable method of detecting TCLK is based on a register that is internal use only, so what kirkwood_find_tclk() currently does is an approximation of that using other registers that _are_ public. If the LSP uses the SaR register, then I don't see why the upstream kernel shouldn't be doing that as well. The mv78xx0 port in the upstream kernel uses that method too (see mach-mv78xx0/common.c, get_*clk() functions). > The lacie_v2_timer_init() function is maybe a ugly hack but that is > the only I found. My concern was to avoid breaking TCLK detection for > other boards. Makes sense. thanks, Lennert ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection 2010-10-20 8:57 ` Lennert Buytenhek @ 2010-10-21 7:45 ` Simon Guinot 2010-10-21 7:45 ` [PATCH 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards Simon Guinot ` (2 more replies) 2010-10-21 9:42 ` [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection Simon Guinot 1 sibling, 3 replies; 17+ messages in thread From: Simon Guinot @ 2010-10-21 7:45 UTC (permalink / raw) To: linux-arm-kernel From: Simon Guinot <sguinot@lacie.com> According to the Marvell LSP, the Sample at Reset regiter bit 21 can be used to detect TCLK on 6281 and 6282 devices. This patch has only been tested on LaCie boards. Signed-off-by: Simon Guinot <sguinot@lacie.com> --- arch/arm/mach-kirkwood/common.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 1c82d42..72bb76f 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c @@ -854,10 +854,9 @@ int __init kirkwood_find_tclk(void) kirkwood_pcie_id(&dev, &rev); - if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || - rev == MV88F6281_REV_A1)) || - (dev == MV88F6282_DEV_ID)) - return 200000000; + if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) + if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) + return 200000000; return 166666667; } -- 1.6.3.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards 2010-10-21 7:45 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Simon Guinot @ 2010-10-21 7:45 ` Simon Guinot 2010-10-21 7:53 ` Lennert Buytenhek 2010-10-21 7:53 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Lennert Buytenhek 2010-10-21 7:56 ` Saeed Bishara 2 siblings, 1 reply; 17+ messages in thread From: Simon Guinot @ 2010-10-21 7:45 UTC (permalink / raw) To: linux-arm-kernel From: Simon Guinot <sguinot@lacie.com> Signed-off-by: Simon Guinot <sguinot@lacie.com> --- arch/arm/mach-kirkwood/d2net_v2-setup.c | 2 +- arch/arm/mach-kirkwood/lacie_v2-common.c | 14 -------------- arch/arm/mach-kirkwood/lacie_v2-common.h | 2 -- arch/arm/mach-kirkwood/netspace_v2-setup.c | 6 +++--- arch/arm/mach-kirkwood/netxbig_v2-setup.c | 4 ++-- 5 files changed, 6 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-kirkwood/d2net_v2-setup.c b/arch/arm/mach-kirkwood/d2net_v2-setup.c index cd62d0f..b8078ae 100644 --- a/arch/arm/mach-kirkwood/d2net_v2-setup.c +++ b/arch/arm/mach-kirkwood/d2net_v2-setup.c @@ -227,5 +227,5 @@ MACHINE_START(D2NET_V2, "LaCie d2 Network v2") .init_machine = d2net_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.c b/arch/arm/mach-kirkwood/lacie_v2-common.c index d3ea1b6..285edab 100644 --- a/arch/arm/mach-kirkwood/lacie_v2-common.c +++ b/arch/arm/mach-kirkwood/lacie_v2-common.c @@ -111,17 +111,3 @@ void __init lacie_v2_hdd_power_init(int hdd_num) pr_err("Failed to power up HDD%d\n", i + 1); } } - -/***************************************************************************** - * Timer - ****************************************************************************/ - -static void lacie_v2_timer_init(void) -{ - kirkwood_tclk = 166666667; - orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); -} - -struct sys_timer lacie_v2_timer = { - .init = lacie_v2_timer_init, -}; diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.h b/arch/arm/mach-kirkwood/lacie_v2-common.h index af52131..fc64f57 100644 --- a/arch/arm/mach-kirkwood/lacie_v2-common.h +++ b/arch/arm/mach-kirkwood/lacie_v2-common.h @@ -13,6 +13,4 @@ void lacie_v2_register_flash(void); void lacie_v2_register_i2c_devices(void); void lacie_v2_hdd_power_init(int hdd_num); -extern struct sys_timer lacie_v2_timer; - #endif diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c index fed264d..fc934e5 100644 --- a/arch/arm/mach-kirkwood/netspace_v2-setup.c +++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c @@ -221,7 +221,7 @@ MACHINE_START(NETSPACE_V2, "LaCie Network Space v2") .init_machine = netspace_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif @@ -233,7 +233,7 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2") .init_machine = netspace_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif @@ -245,6 +245,6 @@ MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2") .init_machine = netspace_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif diff --git a/arch/arm/mach-kirkwood/netxbig_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c index d970e1e..a855c9f 100644 --- a/arch/arm/mach-kirkwood/netxbig_v2-setup.c +++ b/arch/arm/mach-kirkwood/netxbig_v2-setup.c @@ -405,7 +405,7 @@ MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2") .init_machine = netxbig_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif @@ -417,6 +417,6 @@ MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2") .init_machine = netxbig_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif -- 1.6.3.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards 2010-10-21 7:45 ` [PATCH 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards Simon Guinot @ 2010-10-21 7:53 ` Lennert Buytenhek 0 siblings, 0 replies; 17+ messages in thread From: Lennert Buytenhek @ 2010-10-21 7:53 UTC (permalink / raw) To: linux-arm-kernel On Thu, Oct 21, 2010 at 09:45:27AM +0200, Simon Guinot wrote: > From: Simon Guinot <sguinot@lacie.com> > > Signed-off-by: Simon Guinot <sguinot@lacie.com> Acked-by: Lennert Buytenhek <buytenh@wantstofly.org> ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection 2010-10-21 7:45 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Simon Guinot 2010-10-21 7:45 ` [PATCH 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards Simon Guinot @ 2010-10-21 7:53 ` Lennert Buytenhek 2010-10-21 8:11 ` Saeed Bishara 2010-10-21 7:56 ` Saeed Bishara 2 siblings, 1 reply; 17+ messages in thread From: Lennert Buytenhek @ 2010-10-21 7:53 UTC (permalink / raw) To: linux-arm-kernel In the patch title: > [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection s/TLCK/TCLK/ On Thu, Oct 21, 2010 at 09:45:26AM +0200, Simon Guinot wrote: > From: Simon Guinot <sguinot@lacie.com> > > According to the Marvell LSP, the Sample at Reset regiter bit 21 can be > used to detect TCLK on 6281 and 6282 devices. > > This patch has only been tested on LaCie boards. > > [snip] > > - if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || > - rev == MV88F6281_REV_A1)) || > - (dev == MV88F6282_DEV_ID)) > - return 200000000; > + if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) > + if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) > + return 200000000; > > return 166666667; > } Can we not just make this: if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) return 200000000; else return 166666667; (I don't have the necessary docs, Saeed might have to answer this one.) thanks, Lennert ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection 2010-10-21 7:53 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Lennert Buytenhek @ 2010-10-21 8:11 ` Saeed Bishara 2010-10-21 9:58 ` Lennert Buytenhek 0 siblings, 1 reply; 17+ messages in thread From: Saeed Bishara @ 2010-10-21 8:11 UTC (permalink / raw) To: linux-arm-kernel >-----Original Message----- >From: Lennert Buytenhek [mailto:buytenh at wantstofly.org] >Sent: Thursday, October 21, 2010 9:53 AM >To: Simon Guinot >Cc: Nicolas Pitre; linux-arm-kernel at lists.infradead.org; >Benoit Canet; Saeed Bishara; Simon Guinot >Subject: Re: [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection > >In the patch title: > >> [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection > >s/TLCK/TCLK/ > > > >On Thu, Oct 21, 2010 at 09:45:26AM +0200, Simon Guinot wrote: > >> From: Simon Guinot <sguinot@lacie.com> >> >> According to the Marvell LSP, the Sample at Reset regiter >bit 21 can be >> used to detect TCLK on 6281 and 6282 devices. >> >> This patch has only been tested on LaCie boards. >> >> [snip] >> >> - if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || >> - rev == MV88F6281_REV_A1)) || >> - (dev == MV88F6282_DEV_ID)) >> - return 200000000; >> + if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) >> + if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) >> + return 200000000; >> >> return 166666667; >> } > >Can we not just make this: > > if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) > return 200000000; > else > return 166666667; > >(I don't have the necessary docs, Saeed might have to answer this one.) Lennert, the docs and our reference code shows that the original code of Simor is correct,s o I suggest to do : if ((dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) && ((readl(SAMPLE_AT_RESET) & BIT(21)) == 0)) return 200000000; else return 166666667; > > >thanks, >Lennert > ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection 2010-10-21 8:11 ` Saeed Bishara @ 2010-10-21 9:58 ` Lennert Buytenhek 2010-10-21 11:03 ` Saeed Bishara 0 siblings, 1 reply; 17+ messages in thread From: Lennert Buytenhek @ 2010-10-21 9:58 UTC (permalink / raw) To: linux-arm-kernel On Thu, Oct 21, 2010 at 10:11:24AM +0200, Saeed Bishara wrote: > >> - if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || > >> - rev == MV88F6281_REV_A1)) || > >> - (dev == MV88F6282_DEV_ID)) > >> - return 200000000; > >> + if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) > >> + if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) > >> + return 200000000; > >> > >> return 166666667; > >> } > > > >Can we not just make this: > > > > if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) > > return 200000000; > > else > > return 166666667; > > > >(I don't have the necessary docs, Saeed might have to answer this one.) > > Lennert, the docs and our reference code shows that the original code of Simor is correct So what does it mean if bit 21 is 0 on 6180/6192? If [21] == 0 is not supported on 6180/6192 because those parts officially only support 166 MHz TCLK operation, then that doesn't need a test for the part number, I think. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection 2010-10-21 9:58 ` Lennert Buytenhek @ 2010-10-21 11:03 ` Saeed Bishara 2010-10-21 14:10 ` Lennert Buytenhek 0 siblings, 1 reply; 17+ messages in thread From: Saeed Bishara @ 2010-10-21 11:03 UTC (permalink / raw) To: linux-arm-kernel >-----Original Message----- >From: Lennert Buytenhek [mailto:buytenh at wantstofly.org] >Sent: Thursday, October 21, 2010 11:58 AM >To: Saeed Bishara >Cc: Simon Guinot; Nicolas Pitre; >linux-arm-kernel at lists.infradead.org; Benoit Canet; Simon Guinot >Subject: Re: [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection > >On Thu, Oct 21, 2010 at 10:11:24AM +0200, Saeed Bishara wrote: > >> >> - if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || >> >> - rev == MV88F6281_REV_A1)) || >> >> - (dev == MV88F6282_DEV_ID)) >> >> - return 200000000; >> >> + if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) >> >> + if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) >> >> + return 200000000; >> >> >> >> return 166666667; >> >> } >> > >> >Can we not just make this: >> > >> > if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) >> > return 200000000; >> > else >> > return 166666667; >> > >> >(I don't have the necessary docs, Saeed might have to >answer this one.) >> >> Lennert, the docs and our reference code shows that the >original code of Simor is correct > >So what does it mean if bit 21 is 0 on 6180/6192? > >If [21] == 0 is not supported on 6180/6192 because those parts >officially only support 166 MHz TCLK operation, then that doesn't >need a test for the part number, I think. The spec says that bit 21 for 6180 is for internal testing, so lets don't assume any thing about it. saeed > ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection 2010-10-21 11:03 ` Saeed Bishara @ 2010-10-21 14:10 ` Lennert Buytenhek 0 siblings, 0 replies; 17+ messages in thread From: Lennert Buytenhek @ 2010-10-21 14:10 UTC (permalink / raw) To: linux-arm-kernel On Thu, Oct 21, 2010 at 01:03:26PM +0200, Saeed Bishara wrote: > >> >> - if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || > >> >> - rev == MV88F6281_REV_A1)) || > >> >> - (dev == MV88F6282_DEV_ID)) > >> >> - return 200000000; > >> >> + if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) > >> >> + if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) > >> >> + return 200000000; > >> >> > >> >> return 166666667; > >> >> } > >> > > >> >Can we not just make this: > >> > > >> > if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) > >> > return 200000000; > >> > else > >> > return 166666667; > >> > > >> >(I don't have the necessary docs, Saeed might have to > >answer this one.) > >> > >> Lennert, the docs and our reference code shows that the > >original code of Simor is correct > > > >So what does it mean if bit 21 is 0 on 6180/6192? > > > >If [21] == 0 is not supported on 6180/6192 because those parts > >officially only support 166 MHz TCLK operation, then that doesn't > >need a test for the part number, I think. > > The spec says that bit 21 for 6180 is for internal testing, so lets > don't assume any thing about it. OK, I agree. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection 2010-10-21 7:45 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Simon Guinot 2010-10-21 7:45 ` [PATCH 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards Simon Guinot 2010-10-21 7:53 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Lennert Buytenhek @ 2010-10-21 7:56 ` Saeed Bishara 2010-10-21 9:49 ` Simon Guinot 2 siblings, 1 reply; 17+ messages in thread From: Saeed Bishara @ 2010-10-21 7:56 UTC (permalink / raw) To: linux-arm-kernel >-----Original Message----- >From: Simon Guinot [mailto:simon at sequanux.org] >Sent: Thursday, October 21, 2010 9:45 AM >To: Lennert Buytenhek; Nicolas Pitre >Cc: linux-arm-kernel at lists.infradead.org; Benoit Canet; Saeed >Bishara; Simon Guinot >Subject: [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection > >From: Simon Guinot <sguinot@lacie.com> > >According to the Marvell LSP, the Sample at Reset regiter bit 21 can be >used to detect TCLK on 6281 and 6282 devices. > >This patch has only been tested on LaCie boards. > >Signed-off-by: Simon Guinot <sguinot@lacie.com> >--- > arch/arm/mach-kirkwood/common.c | 7 +++---- > 1 files changed, 3 insertions(+), 4 deletions(-) > >diff --git a/arch/arm/mach-kirkwood/common.c >b/arch/arm/mach-kirkwood/common.c >index 1c82d42..72bb76f 100644 >--- a/arch/arm/mach-kirkwood/common.c >+++ b/arch/arm/mach-kirkwood/common.c >@@ -854,10 +854,9 @@ int __init kirkwood_find_tclk(void) > > kirkwood_pcie_id(&dev, &rev); > >- if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || >- rev == MV88F6281_REV_A1)) || >- (dev == MV88F6282_DEV_ID)) >- return 200000000; >+ if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) >+ if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) >+ return 200000000; The flow is ok, but the code doesn't look correct, the & precedence is higher thatn >>. saeed > > return 166666667; > } >-- >1.6.3.1 > > ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection 2010-10-21 7:56 ` Saeed Bishara @ 2010-10-21 9:49 ` Simon Guinot 0 siblings, 0 replies; 17+ messages in thread From: Simon Guinot @ 2010-10-21 9:49 UTC (permalink / raw) To: linux-arm-kernel On Thu, Oct 21, 2010 at 09:56:08AM +0200, Saeed Bishara wrote: > > > >-----Original Message----- > >From: Simon Guinot [mailto:simon at sequanux.org] > >Sent: Thursday, October 21, 2010 9:45 AM > >To: Lennert Buytenhek; Nicolas Pitre > >Cc: linux-arm-kernel at lists.infradead.org; Benoit Canet; Saeed > >Bishara; Simon Guinot > >Subject: [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection > > > >From: Simon Guinot <sguinot@lacie.com> > > > >According to the Marvell LSP, the Sample at Reset regiter bit 21 can be > >used to detect TCLK on 6281 and 6282 devices. > > > >This patch has only been tested on LaCie boards. > > > >Signed-off-by: Simon Guinot <sguinot@lacie.com> > >--- > > arch/arm/mach-kirkwood/common.c | 7 +++---- > > 1 files changed, 3 insertions(+), 4 deletions(-) > > > >diff --git a/arch/arm/mach-kirkwood/common.c > >b/arch/arm/mach-kirkwood/common.c > >index 1c82d42..72bb76f 100644 > >--- a/arch/arm/mach-kirkwood/common.c > >+++ b/arch/arm/mach-kirkwood/common.c > >@@ -854,10 +854,9 @@ int __init kirkwood_find_tclk(void) > > > > kirkwood_pcie_id(&dev, &rev); > > > >- if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || > >- rev == MV88F6281_REV_A1)) || > >- (dev == MV88F6282_DEV_ID)) > >- return 200000000; > >+ if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) > >+ if ((readl(SAMPLE_AT_RESET) >> 21 & 1) == 0) > >+ return 200000000; > The flow is ok, but the code doesn't look correct, the & precedence is higher thatn >>. Sorry for missing that. The compiler optimize in the way with and without parenthesis. Thanks, Simon -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20101021/d82303ea/attachment.sig> ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection 2010-10-20 8:57 ` Lennert Buytenhek 2010-10-21 7:45 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Simon Guinot @ 2010-10-21 9:42 ` Simon Guinot 2010-10-21 9:42 ` [PATCH v2 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards Simon Guinot ` (2 more replies) 1 sibling, 3 replies; 17+ messages in thread From: Simon Guinot @ 2010-10-21 9:42 UTC (permalink / raw) To: linux-arm-kernel From: Simon Guinot <sguinot@lacie.com> According to the Marvell LSP, the Sample at Reset regiter bit 21 can be used to detect TCLK on 6281 and 6282 devices. This patch has only been tested on LaCie boards. Signed-off-by: Simon Guinot <sguinot@lacie.com> --- arch/arm/mach-kirkwood/common.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 1c82d42..ee99a5a 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c @@ -854,10 +854,9 @@ int __init kirkwood_find_tclk(void) kirkwood_pcie_id(&dev, &rev); - if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || - rev == MV88F6281_REV_A1)) || - (dev == MV88F6282_DEV_ID)) - return 200000000; + if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) + if (((readl(SAMPLE_AT_RESET) >> 21) & 1) == 0) + return 200000000; return 166666667; } -- 1.6.3.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards 2010-10-21 9:42 ` [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection Simon Guinot @ 2010-10-21 9:42 ` Simon Guinot 2010-10-21 13:54 ` [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection Simon Guinot 2010-10-21 14:11 ` Lennert Buytenhek 2 siblings, 0 replies; 17+ messages in thread From: Simon Guinot @ 2010-10-21 9:42 UTC (permalink / raw) To: linux-arm-kernel From: Simon Guinot <sguinot@lacie.com> Signed-off-by: Simon Guinot <sguinot@lacie.com> Acked-by: Lennert Buytenhek <buytenh@wantstofly.org> --- arch/arm/mach-kirkwood/d2net_v2-setup.c | 2 +- arch/arm/mach-kirkwood/lacie_v2-common.c | 14 -------------- arch/arm/mach-kirkwood/lacie_v2-common.h | 2 -- arch/arm/mach-kirkwood/netspace_v2-setup.c | 6 +++--- arch/arm/mach-kirkwood/netxbig_v2-setup.c | 4 ++-- 5 files changed, 6 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-kirkwood/d2net_v2-setup.c b/arch/arm/mach-kirkwood/d2net_v2-setup.c index cd62d0f..b8078ae 100644 --- a/arch/arm/mach-kirkwood/d2net_v2-setup.c +++ b/arch/arm/mach-kirkwood/d2net_v2-setup.c @@ -227,5 +227,5 @@ MACHINE_START(D2NET_V2, "LaCie d2 Network v2") .init_machine = d2net_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.c b/arch/arm/mach-kirkwood/lacie_v2-common.c index d3ea1b6..285edab 100644 --- a/arch/arm/mach-kirkwood/lacie_v2-common.c +++ b/arch/arm/mach-kirkwood/lacie_v2-common.c @@ -111,17 +111,3 @@ void __init lacie_v2_hdd_power_init(int hdd_num) pr_err("Failed to power up HDD%d\n", i + 1); } } - -/***************************************************************************** - * Timer - ****************************************************************************/ - -static void lacie_v2_timer_init(void) -{ - kirkwood_tclk = 166666667; - orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); -} - -struct sys_timer lacie_v2_timer = { - .init = lacie_v2_timer_init, -}; diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.h b/arch/arm/mach-kirkwood/lacie_v2-common.h index af52131..fc64f57 100644 --- a/arch/arm/mach-kirkwood/lacie_v2-common.h +++ b/arch/arm/mach-kirkwood/lacie_v2-common.h @@ -13,6 +13,4 @@ void lacie_v2_register_flash(void); void lacie_v2_register_i2c_devices(void); void lacie_v2_hdd_power_init(int hdd_num); -extern struct sys_timer lacie_v2_timer; - #endif diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c index fed264d..fc934e5 100644 --- a/arch/arm/mach-kirkwood/netspace_v2-setup.c +++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c @@ -221,7 +221,7 @@ MACHINE_START(NETSPACE_V2, "LaCie Network Space v2") .init_machine = netspace_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif @@ -233,7 +233,7 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2") .init_machine = netspace_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif @@ -245,6 +245,6 @@ MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2") .init_machine = netspace_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif diff --git a/arch/arm/mach-kirkwood/netxbig_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c index d970e1e..a855c9f 100644 --- a/arch/arm/mach-kirkwood/netxbig_v2-setup.c +++ b/arch/arm/mach-kirkwood/netxbig_v2-setup.c @@ -405,7 +405,7 @@ MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2") .init_machine = netxbig_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif @@ -417,6 +417,6 @@ MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2") .init_machine = netxbig_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &lacie_v2_timer, + .timer = &kirkwood_timer, MACHINE_END #endif -- 1.6.3.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection 2010-10-21 9:42 ` [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection Simon Guinot 2010-10-21 9:42 ` [PATCH v2 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards Simon Guinot @ 2010-10-21 13:54 ` Simon Guinot 2010-10-21 14:11 ` Lennert Buytenhek 2 siblings, 0 replies; 17+ messages in thread From: Simon Guinot @ 2010-10-21 13:54 UTC (permalink / raw) To: linux-arm-kernel Hi Lennert and Nicolas, This patch is my best attempt to fix the tclk detection. Unfortunately, I can't test it on machines I don't have. Let me know if I can do something else. Simon On Thu, Oct 21, 2010 at 11:42:28AM +0200, Simon Guinot wrote: > From: Simon Guinot <sguinot@lacie.com> > > According to the Marvell LSP, the Sample at Reset regiter bit 21 can be > used to detect TCLK on 6281 and 6282 devices. > > This patch has only been tested on LaCie boards. > > Signed-off-by: Simon Guinot <sguinot@lacie.com> > --- > arch/arm/mach-kirkwood/common.c | 7 +++---- > 1 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c > index 1c82d42..ee99a5a 100644 > --- a/arch/arm/mach-kirkwood/common.c > +++ b/arch/arm/mach-kirkwood/common.c > @@ -854,10 +854,9 @@ int __init kirkwood_find_tclk(void) > > kirkwood_pcie_id(&dev, &rev); > > - if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || > - rev == MV88F6281_REV_A1)) || > - (dev == MV88F6282_DEV_ID)) > - return 200000000; > + if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID) > + if (((readl(SAMPLE_AT_RESET) >> 21) & 1) == 0) > + return 200000000; > > return 166666667; > } > -- > 1.6.3.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20101021/40fea5a5/attachment.sig> ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection 2010-10-21 9:42 ` [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection Simon Guinot 2010-10-21 9:42 ` [PATCH v2 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards Simon Guinot 2010-10-21 13:54 ` [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection Simon Guinot @ 2010-10-21 14:11 ` Lennert Buytenhek 2 siblings, 0 replies; 17+ messages in thread From: Lennert Buytenhek @ 2010-10-21 14:11 UTC (permalink / raw) To: linux-arm-kernel On Thu, Oct 21, 2010 at 11:42:28AM +0200, Simon Guinot wrote: > From: Simon Guinot <sguinot@lacie.com> > > According to the Marvell LSP, the Sample at Reset regiter bit 21 can be > used to detect TCLK on 6281 and 6282 devices. > > This patch has only been tested on LaCie boards. > > Signed-off-by: Simon Guinot <sguinot@lacie.com> Acked-by: Lennert Buytenhek <buytenh@wantstofly.org> ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2010-10-21 14:11 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-10-20 5:08 net{space,xbig} TCLK determination Lennert Buytenhek 2010-10-20 8:48 ` Simon Guinot 2010-10-20 8:57 ` Lennert Buytenhek 2010-10-21 7:45 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Simon Guinot 2010-10-21 7:45 ` [PATCH 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards Simon Guinot 2010-10-21 7:53 ` Lennert Buytenhek 2010-10-21 7:53 ` [PATCH 1/2] [ARM] Kirkwood: enhance TLCK detection Lennert Buytenhek 2010-10-21 8:11 ` Saeed Bishara 2010-10-21 9:58 ` Lennert Buytenhek 2010-10-21 11:03 ` Saeed Bishara 2010-10-21 14:10 ` Lennert Buytenhek 2010-10-21 7:56 ` Saeed Bishara 2010-10-21 9:49 ` Simon Guinot 2010-10-21 9:42 ` [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection Simon Guinot 2010-10-21 9:42 ` [PATCH v2 2/2] [ARM] Kirkwood: fix timer initialization for LaCie boards Simon Guinot 2010-10-21 13:54 ` [PATCH v2 1/2] [ARM] Kirkwood: enhance TCLK detection Simon Guinot 2010-10-21 14:11 ` Lennert Buytenhek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).