Patchwork [U-Boot] MPC8308: Fixup clocks in PCI Host configuration

login
register
mail settings
Submitter Barry Grussling
Date Jan. 8, 2013, 6:24 p.m.
Message ID <1357669446-29334-1-git-send-email-barry@grussling.com>
Download mbox | patch
Permalink /patch/210543/
State Superseded
Delegated to: Kim Phillips
Headers show

Comments

Barry Grussling - Jan. 8, 2013, 6:24 p.m.
While trying to bring up a custom MPC8308 based board I found
that the clocking was wrong.  The comment in
include/configs/mpc8308_p1m.h led me to believe
setting HRCWH_PCI_HOST and HRCWH_PCI1_ARBITER_ENABLE in the
CONFIG_SYS_HRCW_HIGH should allow the system to work, but on
my newer version of the 8308 this is not working.  Setting
the HRCWH_PCI_HOST bit (which doesn't exist according to the manual)
doesn't latch, and as such the im->reset.rcwh & HRCWH_PCI_HOST test
in speed.c fails.  Since this board is running off the
CONFIG_83XX_CLKIN and is not a PCI client, I end up with 0xdeadbeef
and hosed clock values.

This patch allows for proper clocks on the 8308 as a workaround
for the lack of HRCWH_PCI_HOST support.

Signed-off-by: Barry Grussling <barry@grussling.com>
---
 arch/powerpc/cpu/mpc83xx/speed.c |    4 ++++
 1 file changed, 4 insertions(+)
Kim Phillips - Jan. 9, 2013, 1:18 a.m.
On Tue, 8 Jan 2013 10:24:05 -0800
Barry Grussling <barry@grussling.com> wrote:

> While trying to bring up a custom MPC8308 based board I found
> that the clocking was wrong.  The comment in
> include/configs/mpc8308_p1m.h led me to believe
> setting HRCWH_PCI_HOST and HRCWH_PCI1_ARBITER_ENABLE in the
> CONFIG_SYS_HRCW_HIGH should allow the system to work, but on
> my newer version of the 8308 this is not working.  Setting
> the HRCWH_PCI_HOST bit (which doesn't exist according to the manual)
> doesn't latch, and as such the im->reset.rcwh & HRCWH_PCI_HOST test
> in speed.c fails.  Since this board is running off the

I don't have an 8308 and nothing relevant shows up in the errata, so
modulo modifying the rcwh read with an i/o accessor (in_be32) and it
still failing, we ought to amend the comment with this new info.

cc'ing Ilya, in case he can test on his 8308.

> +#elif defined(CONFIG_83XX_CLKIN) && defined(CONFIG_MPC8308)
> +	/* 8308 doesn't have the HRCWH_PCI_HOST, but should 
> +	 * run off the CONFIG_83XX_CLKIN */
> +		pci_sync_in = CONFIG_83XX_CLKIN / (1 + clkin_div);

/*
 * this is the correct multi-line comment
 * style
 */

also align comment and code, and omit trailing whitespace:

ERROR: trailing whitespace
#119: FILE: arch/powerpc/cpu/mpc83xx/speed.c:164:
+^I/* 8308 doesn't have the HRCWH_PCI_HOST, but should $

Thanks,

Kim
Barry Grussling - Jan. 9, 2013, 2:29 a.m.
> I don't have an 8308 and nothing relevant shows up in the errata, so
> modulo modifying the rcwh read with an i/o accessor (in_be32) and it
> still failing, we ought to amend the comment with this new info.
>
> cc'ing Ilya, in case he can test on his 8308.

Sounds good to have more testing.  I am not sure how the
u-boot is working on 8308s right now :-(

>
>> +#elif defined(CONFIG_83XX_CLKIN) && defined(CONFIG_MPC8308)
>> +     /* 8308 doesn't have the HRCWH_PCI_HOST, but should
>> +      * run off the CONFIG_83XX_CLKIN */
>> +             pci_sync_in = CONFIG_83XX_CLKIN / (1 + clkin_div);
>
> /*
>  * this is the correct multi-line comment
>  * style
>  */
>
> also align comment and code, and omit trailing whitespace:
>
> ERROR: trailing whitespace
> #119: FILE: arch/powerpc/cpu/mpc83xx/speed.c:164:
> +^I/* 8308 doesn't have the HRCWH_PCI_HOST, but should $

Sent out a new version with this stuff fixed.  Sorry for the newbie errors.
I found checkpatch.pl and made my new patch clean.

Thanks,

Barry
Wolfgang Denk - Jan. 9, 2013, 8:15 p.m.
Dear Barry Grussling,

In message <1357669446-29334-1-git-send-email-barry@grussling.com> you wrote:
> While trying to bring up a custom MPC8308 based board I found
> that the clocking was wrong.  The comment in
> include/configs/mpc8308_p1m.h led me to believe
> setting HRCWH_PCI_HOST and HRCWH_PCI1_ARBITER_ENABLE in the
> CONFIG_SYS_HRCW_HIGH should allow the system to work, but on
> my newer version of the 8308 this is not working.  Setting
> the HRCWH_PCI_HOST bit (which doesn't exist according to the manual)
> doesn't latch, and as such the im->reset.rcwh & HRCWH_PCI_HOST test
> in speed.c fails.  Since this board is running off the
> CONFIG_83XX_CLKIN and is not a PCI client, I end up with 0xdeadbeef
> and hosed clock values.
> 
> This patch allows for proper clocks on the 8308 as a workaround
> for the lack of HRCWH_PCI_HOST support.

You say this patchis working on "your newer version of the 8308".  Can
you please be specific what "old" and "new" actually means here?

And has this patch been tested to also work on the "old" versions of
the 8308?


> +#elif defined(CONFIG_83XX_CLKIN) && defined(CONFIG_MPC8308)
> +	/* 8308 doesn't have the HRCWH_PCI_HOST, but should 
> +	 * run off the CONFIG_83XX_CLKIN */

Incorrect multiline comment style.

Best regards,

Wolfgang Denk
Barry Grussling - Jan. 10, 2013, 4:13 a.m.
>> This patch allows for proper clocks on the 8308 as a workaround
>> for the lack of HRCWH_PCI_HOST support.
>
> You say this patchis working on "your newer version of the 8308".  Can
> you please be specific what "old" and "new" actually means here?

Not exactly unfortunately.  On the 8308s I currently have u-boot doesn't work
without this patch.  I believe before on the 8308 development
board I had the PCI_HOST bit of the HRCW_HIGH would latch when
set in the #define for CONFIG_SYS_HRCW_HIGH.  I don't have the old
development board any more, and my new board doesn't appear to latch
that bit.  I also don't know what rev of the microprocessor the old one was.

It is entirely possible some other change was made and this is a manifestation
of that change instead (I was playing around with the 8308 development
board in the u-boot 1.3.0 timeframe).

> And has this patch been tested to also work on the "old" versions of
> the 8308?

No.  Don't have the old test board anymore.  As such, I have
only verified it on the custom board I have currently.  I did try playing
with the CONFIG_SYS_HRCW_HIGH and setting the PCI_HOST bit
in my current board but that didn't fix it.

Out of curiousity, does anyone have one of the 8308_p1m and is the
current u-boot booting on it?  I can't figure out why it would work on
the p1m and not my board.

>
>> +#elif defined(CONFIG_83XX_CLKIN) && defined(CONFIG_MPC8308)
>> +     /* 8308 doesn't have the HRCWH_PCI_HOST, but should
>> +      * run off the CONFIG_83XX_CLKIN */
>
> Incorrect multiline comment style.

Yea.  Sorry about that.  Fixed in V2 patch.

Thanks!

Barry

Patch

diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index b8c05d1..6f715ea 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -160,6 +160,10 @@  int get_clocks(void)
 	} else {
 #if defined(CONFIG_83XX_PCICLK)
 		pci_sync_in = CONFIG_83XX_PCICLK;
+#elif defined(CONFIG_83XX_CLKIN) && defined(CONFIG_MPC8308)
+	/* 8308 doesn't have the HRCWH_PCI_HOST, but should 
+	 * run off the CONFIG_83XX_CLKIN */
+		pci_sync_in = CONFIG_83XX_CLKIN / (1 + clkin_div);
 #else
 		pci_sync_in = 0xDEADBEEF;
 #endif