* [PATCH] SSB PCI core driver fixes
@ 2007-08-09 0:23 Aurelien Jarno
2007-08-09 0:27 ` Michael Buesch
0 siblings, 1 reply; 5+ messages in thread
From: Aurelien Jarno @ 2007-08-09 0:23 UTC (permalink / raw)
To: Michael Buesch; +Cc: netdev
The patch below against 2.6.23-rc1-mm2 fixes various things on the SSB
PCI core driver:
- Correctly write the configuration register value in
ssb_extpci_write_config() for len = 1 or len = 2.
- Set the PCI latency timer to handle devices on the PCI bus.
- Set the PCI arbiter control to internal.
- Add some delay between the configuration of the PCI controller
and its registration.
Note: this is the latest SSB patch from my local tree. Next ones are
only BCM947xx or CFE related.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -99,6 +99,9 @@
/* Enable PCI bridge BAR1 prefetch and burst */
pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
+
+ /* Make sure our latency is high enough to handle the devices behind us */
+ pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xa8);
}
DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge);
@@ -230,7 +233,7 @@
val = *((const u32 *)buf);
break;
}
- writel(*((const u32 *)buf), mmio);
+ writel(val, mmio);
err = 0;
unmap:
@@ -311,6 +314,8 @@
udelay(150); /* Assertion time demanded by the PCI standard */
val |= SSB_PCICORE_CTL_RST; /* Deassert RST# */
pcicore_write32(pc, SSB_PCICORE_CTL, val);
+ val = SSB_PCICORE_ARBCTL_INTERN;
+ pcicore_write32(pc, SSB_PCICORE_ARBCTL, val);
udelay(1); /* Assertion time demanded by the PCI standard */
/*TODO cardbus mode */
@@ -340,6 +345,7 @@
* The following needs change, if we want to port hostmode
* to non-MIPS platform. */
set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000));
+ mdelay(300);
register_pci_controller(&ssb_pcicore_controller);
}
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SSB PCI core driver fixes
2007-08-09 0:23 [PATCH] SSB PCI core driver fixes Aurelien Jarno
@ 2007-08-09 0:27 ` Michael Buesch
2007-08-09 0:38 ` Aurelien Jarno
0 siblings, 1 reply; 5+ messages in thread
From: Michael Buesch @ 2007-08-09 0:27 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: netdev
On Thursday 09 August 2007, Aurelien Jarno wrote:
> - Add some delay between the configuration of the PCI controller
> and its registration.
Why? It is _huge_ and people won't like it ;)
At least add a comment why this is needed.
> @@ -340,6 +345,7 @@
> * The following needs change, if we want to port hostmode
> * to non-MIPS platform. */
> set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000));
> + mdelay(300);
> register_pci_controller(&ssb_pcicore_controller);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SSB PCI core driver fixes
2007-08-09 0:27 ` Michael Buesch
@ 2007-08-09 0:38 ` Aurelien Jarno
2007-08-09 1:09 ` Aurelien Jarno
0 siblings, 1 reply; 5+ messages in thread
From: Aurelien Jarno @ 2007-08-09 0:38 UTC (permalink / raw)
To: Michael Buesch; +Cc: netdev
Michael Buesch a écrit :
> On Thursday 09 August 2007, Aurelien Jarno wrote:
>> - Add some delay between the configuration of the PCI controller
>> and its registration.
>
> Why? It is _huge_ and people won't like it ;)
> At least add a comment why this is needed.
It is need, otherwise the PCI controller gets confused, which causes a
reset of the machine. Then CFE goes into a loop booting again and again
without being able to get up to the prompt.
I agree this is a huge value, so I will try to find the minimum value
and then add some margin.
I will send an updated patch.
>> @@ -340,6 +345,7 @@
>> * The following needs change, if we want to port hostmode
>> * to non-MIPS platform. */
>> set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000));
>> + mdelay(300);
>> register_pci_controller(&ssb_pcicore_controller);
>> }
>>
>
>
>
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SSB PCI core driver fixes
2007-08-09 0:38 ` Aurelien Jarno
@ 2007-08-09 1:09 ` Aurelien Jarno
0 siblings, 0 replies; 5+ messages in thread
From: Aurelien Jarno @ 2007-08-09 1:09 UTC (permalink / raw)
To: Michael Buesch; +Cc: netdev
On Thu, Aug 09, 2007 at 02:38:24AM +0200, Aurelien Jarno wrote:
> Michael Buesch a écrit :
> > On Thursday 09 August 2007, Aurelien Jarno wrote:
> >> - Add some delay between the configuration of the PCI controller
> >> and its registration.
> >
> > Why? It is _huge_ and people won't like it ;)
> > At least add a comment why this is needed.
>
> It is need, otherwise the PCI controller gets confused, which causes a
> reset of the machine. Then CFE goes into a loop booting again and again
> without being able to get up to the prompt.
>
> I agree this is a huge value, so I will try to find the minimum value
> and then add some margin.
>
> I will send an updated patch.
>
A few experiments have shown that the minimum value is 3ms on my WGT634U
machine. I haved changed the value to 10ms in the new patch below, which
gives some margin, and added a comment.
Aurelien
The patch below against 2.6.23-rc1-mm2 fixes various things on the SSB
PCI core driver:
- Correctly write the configuration register value in
ssb_extpci_write_config() for len = 1 or len = 2.
- Set the PCI_LATENCY_TIMER to handle devices on the PCI bus.
- Set the PCI arbiter control to internal.
- Add some delay between the configuration of the PCI controller
and its registration.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -99,6 +99,9 @@
/* Enable PCI bridge BAR1 prefetch and burst */
pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
+
+ /* Make sure our latency is high enough to handle the devices behind us */
+ pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xa8);
}
DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge);
@@ -230,7 +233,7 @@
val = *((const u32 *)buf);
break;
}
- writel(*((const u32 *)buf), mmio);
+ writel(val, mmio);
err = 0;
unmap:
@@ -311,6 +314,8 @@
udelay(150); /* Assertion time demanded by the PCI standard */
val |= SSB_PCICORE_CTL_RST; /* Deassert RST# */
pcicore_write32(pc, SSB_PCICORE_CTL, val);
+ val = SSB_PCICORE_ARBCTL_INTERN;
+ pcicore_write32(pc, SSB_PCICORE_ARBCTL, val);
udelay(1); /* Assertion time demanded by the PCI standard */
/*TODO cardbus mode */
@@ -340,6 +345,9 @@
* The following needs change, if we want to port hostmode
* to non-MIPS platform. */
set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000));
+ /* Give some time to the PCI controller to configure itself with the new
+ * values. Not waiting at this point causes crashes of the machine. */
+ mdelay(10);
register_pci_controller(&ssb_pcicore_controller);
}
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ssb: pci core driver fixes
@ 2007-08-09 10:10 Michael Buesch
0 siblings, 0 replies; 5+ messages in thread
From: Michael Buesch @ 2007-08-09 10:10 UTC (permalink / raw)
To: John Linville; +Cc: Aurelien Jarno, netdev
From: Aurelien Jarno <aurelien@aurel32.net>
Fixes various things on the SSB
PCI core driver:
- Correctly write the configuration register value in
ssb_extpci_write_config() for len = 1 or len = 2.
- Set the PCI_LATENCY_TIMER to handle devices on the PCI bus.
- Set the PCI arbiter control to internal.
- Add some delay between the configuration of the PCI controller
and its registration.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -99,6 +99,9 @@
/* Enable PCI bridge BAR1 prefetch and burst */
pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
+
+ /* Make sure our latency is high enough to handle the devices behind us */
+ pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xa8);
}
DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge);
@@ -230,7 +233,7 @@
val = *((const u32 *)buf);
break;
}
- writel(*((const u32 *)buf), mmio);
+ writel(val, mmio);
err = 0;
unmap:
@@ -311,6 +314,8 @@
udelay(150); /* Assertion time demanded by the PCI standard */
val |= SSB_PCICORE_CTL_RST; /* Deassert RST# */
pcicore_write32(pc, SSB_PCICORE_CTL, val);
+ val = SSB_PCICORE_ARBCTL_INTERN;
+ pcicore_write32(pc, SSB_PCICORE_ARBCTL, val);
udelay(1); /* Assertion time demanded by the PCI standard */
/*TODO cardbus mode */
@@ -340,6 +345,9 @@
* The following needs change, if we want to port hostmode
* to non-MIPS platform. */
set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000));
+ /* Give some time to the PCI controller to configure itself with the new
+ * values. Not waiting at this point causes crashes of the machine. */
+ mdelay(10);
register_pci_controller(&ssb_pcicore_controller);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-08-09 10:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-09 0:23 [PATCH] SSB PCI core driver fixes Aurelien Jarno
2007-08-09 0:27 ` Michael Buesch
2007-08-09 0:38 ` Aurelien Jarno
2007-08-09 1:09 ` Aurelien Jarno
-- strict thread matches above, loose matches on Subject: below --
2007-08-09 10:10 [PATCH] ssb: pci " Michael Buesch
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).