* [PATCH] 85xxCDS: Make sure restart resets the PCI bus.
@ 2007-06-07 20:38 Randy Vinson
2007-06-07 22:29 ` Mark A. Greer
0 siblings, 1 reply; 2+ messages in thread
From: Randy Vinson @ 2007-06-07 20:38 UTC (permalink / raw)
To: linuxppc-dev@ozlabs•org
The current 85xxCDS restart code fails to reset the PCI bus which can
lead to odd behavior after the restart. This patch uses the VIA Super
Southbridge to perform a PCI reset which will reset the entire system.
NOTE: Since the VIA chip is behind a PCI-to-PCI bridge which can be
disabled with a switch setting, it may not be possible to perform the
PCI bus reset. In this case, the code defaults to the previous restart
mechanism.
Signed-off-by: Randy Vinson <rvinson@mvista•com>
---
arch/powerpc/platforms/85xx/mpc85xx_cds.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 431aaa2..f1eaf07 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -62,6 +62,28 @@ static volatile u8 *cadmus;
extern int mpc85xx_pci2_busno;
+static void mpc85xx_cds_restart(char *cmd)
+{
+ struct pci_dev *dev;
+ u_char tmp;
+
+ if ((dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686,
+ NULL))) {
+
+ /* Use the VIA Super Southbridge to force a PCI reset */
+ pci_read_config_byte(dev, 0x47, &tmp);
+ pci_write_config_byte(dev, 0x47, tmp | 1);
+
+ pci_dev_put(dev);
+ }
+
+ /*
+ * We should only get here if the P2P bridge is disabled. In that
+ * case, just use the default reset.
+ */
+ mpc85xx_restart(NULL);
+}
+
static int mpc85xx_exclude_device(u_char bus, u_char devfn)
{
if (bus == 0 && PCI_SLOT(devfn) == 0)
@@ -327,7 +349,11 @@ define_machine(mpc85xx_cds) {
.init_IRQ = mpc85xx_cds_pic_init,
.show_cpuinfo = mpc85xx_cds_show_cpuinfo,
.get_irq = mpic_get_irq,
+#ifdef CONFIG_PCI
+ .restart = mpc85xx_cds_restart,
+#else
.restart = mpc85xx_restart,
+#endif
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
};
--
1.5.0.GIT
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] 85xxCDS: Make sure restart resets the PCI bus.
2007-06-07 20:38 [PATCH] 85xxCDS: Make sure restart resets the PCI bus Randy Vinson
@ 2007-06-07 22:29 ` Mark A. Greer
0 siblings, 0 replies; 2+ messages in thread
From: Mark A. Greer @ 2007-06-07 22:29 UTC (permalink / raw)
To: Randy Vinson; +Cc: linuxppc-dev@ozlabs•org
On Thu, Jun 07, 2007 at 01:38:07PM -0700, Randy Vinson wrote:
> --- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> + if ((dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686,
> + NULL))) {
> +
> + /* Use the VIA Super Southbridge to force a PCI reset */
> + pci_read_config_byte(dev, 0x47, &tmp);
> + pci_write_config_byte(dev, 0x47, tmp | 1);
How about adding another "pci_read_config_byte(dev, 0x47, &tmp);" to
flush the write out of any fifo's and adding a comment that explains
that once that write hits the hardware, the reset is essentially
instantaneous. IOW, there isn't a race between this reset and the reset
you'd call if/when it falls out of this 'if'.
> +
> + pci_dev_put(dev);
> + }
> +
> + /*
> + * We should only get here if the P2P bridge is disabled. In that
> + * case, just use the default reset.
> + */
> + mpc85xx_restart(NULL);
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-07 22:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07 20:38 [PATCH] 85xxCDS: Make sure restart resets the PCI bus Randy Vinson
2007-06-07 22:29 ` Mark A. Greer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox