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

Submitted by Barry Grussling on Jan. 9, 2013, 2:25 a.m.

Details

Message ID 1357698311-7392-1-git-send-email-barry@grussling.com
State Changes Requested
Delegated to: Kim Phillips
Headers show

Commit Message

Barry Grussling Jan. 9, 2013, 2:25 a.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>

---
Changes since V1:
* Fix multi-line comment style
* Remove trailing whitespace
* Align comment
 - All per Kim Phillips recommendation

* Verified output of checkpatch.pl clean now that I know
about checkpatch.pl :-)

---
 arch/powerpc/cpu/mpc83xx/speed.c |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Kim Phillips Jan. 15, 2013, 12:59 a.m.
On Tue, 8 Jan 2013 18:25:11 -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
> 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>
> 
> ---

can I get an ack from someone else with an 8308 here please?  This
custom board fix has the possibility of bricking all existing
8308 based mainline boards.

Thanks,

Kim
Gerlando Falauto Jan. 15, 2013, 7:15 a.m.
On 01/15/2013 01:59 AM, Kim Phillips wrote:
> On Tue, 8 Jan 2013 18:25:11 -0800
> Barry Grussling<barry@grussling.com>  wrote:
>> ---
>
> can I get an ack from someone else with an 8308 here please?  This
> custom board fix has the possibility of bricking all existing
> 8308 based mainline boards.

Sorry, we only have an 8309 board here - which I understand would not be 
affected by this patch anyway.

Regards,
Gerlando
Ira Snyder Jan. 15, 2013, 7:39 p.m.
On Mon, Jan 14, 2013 at 06:59:59PM -0600, Kim Phillips wrote:
> On Tue, 8 Jan 2013 18:25:11 -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
> > 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>
> > 
> > ---
> 
> can I get an ack from someone else with an 8308 here please?  This
> custom board fix has the possibility of bricking all existing
> 8308 based mainline boards.
> 
> Thanks,
> 
> Kim
> 

Hi Kim, Barry,

I have an MPC8308RDB board, which is reported by U-Boot as:
CPU:   e300c3, MPC8308, Rev: 1.0 at 400 MHz, CSB: 133.333 MHz
Board: Freescale MPC8308RDB Rev 1.0

Barry: what does your board report as it boots up? Is it a newer version
of the MPC8308 chip? Can you also dump the registers shown below? Use
"md e0000900 4" to dump them. Also, please send me the output of
"hexdump -C u-boot.bin | head" for your U-Boot image.

Dumping the HRCWH register, I get the value a0606c00.
=> md e0000900 4
e0000900: 44060000 a0606c00 00000000 00000000    D....`l.........

So on my board, the HRCWH_PCI_HOST bit *is* latched just fine. The
Freescale manual says the HRCWH register doesn't have this bit, but the
comments in include/configs/MPC8308RDB.h say that it must be set for the
board to work correctly.

The MPC8308RDB is a standalone board, and does not define
CONFIG_83XX_PCICLK. Since the HRCWH_PCI_HOST bit was latched, my U-Boot
takes the first branch in the "if (im->reset.rcwh & HRCWH_PCI_HOST) {"
path, and continues to work as normal.

In conclusion, the patch doesn't break my board. But I don't know why
Barry's board needs the patch.

Ira
Kim Phillips Jan. 18, 2013, 12:48 a.m.
On Tue, 15 Jan 2013 11:39:51 -0800
"Ira W. Snyder" <iws@ovro.caltech.edu> wrote:

> On Mon, Jan 14, 2013 at 06:59:59PM -0600, Kim Phillips wrote:
> > On Tue, 8 Jan 2013 18:25:11 -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
> > > 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>
> > > 
> > > ---
> > 
> > can I get an ack from someone else with an 8308 here please?  This
> > custom board fix has the possibility of bricking all existing
> > 8308 based mainline boards.
> > 
> > Thanks,
> > 
> > Kim
> > 
> 
> Hi Kim, Barry,
> 
> I have an MPC8308RDB board, which is reported by U-Boot as:
> CPU:   e300c3, MPC8308, Rev: 1.0 at 400 MHz, CSB: 133.333 MHz
> Board: Freescale MPC8308RDB Rev 1.0
> 
> Barry: what does your board report as it boots up? Is it a newer version
> of the MPC8308 chip? Can you also dump the registers shown below? Use
> "md e0000900 4" to dump them. Also, please send me the output of
> "hexdump -C u-boot.bin | head" for your U-Boot image.
> 
> Dumping the HRCWH register, I get the value a0606c00.
> => md e0000900 4
> e0000900: 44060000 a0606c00 00000000 00000000    D....`l.........
> 
> So on my board, the HRCWH_PCI_HOST bit *is* latched just fine. The
> Freescale manual says the HRCWH register doesn't have this bit, but the
> comments in include/configs/MPC8308RDB.h say that it must be set for the
> board to work correctly.
> 
> The MPC8308RDB is a standalone board, and does not define
> CONFIG_83XX_PCICLK. Since the HRCWH_PCI_HOST bit was latched, my U-Boot
> takes the first branch in the "if (im->reset.rcwh & HRCWH_PCI_HOST) {"
> path, and continues to work as normal.
> 
> In conclusion, the patch doesn't break my board. But I don't know why
> Barry's board needs the patch.

Thanks for taking a look at this, Ira.

Barry, can you post your custom board support code?  Does it set
HRCWH_PCI_HOST in the RCW in flash?  Can you confirm the RCW is
being read from flash correctly?

Kim

Patch hide | download patch | download mbox

diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index b8c05d1..8816d71 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -160,6 +160,12 @@  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