Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3862
-gerrit
commit 84b0f09a4082c87b7cafeb8a67ce6a3c86f88498
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Aug 12 15:32:25 2013 +0300
usbdebug: Halt host controller before resetting it
Resetting an EHCI controller when it is not halted can have
undefined behaviour. This mostly fixes a case where calling
usbdebug_init() twice would fail to reset the USB dongle device
properly.
On amd/persimmon it still requires one extra retry, but at least it
is now possible to have usbdebug enabled for both romstage and
ramstage.
Change-Id: Ib0e6e5a0167404f68af2edf112306fdb8def0be9
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/lib/usbdebug.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c
index 81e78c6..c7c5520 100644
--- a/src/lib/usbdebug.c
+++ b/src/lib/usbdebug.c
@@ -449,6 +449,23 @@ try_next_port:
return -1;
}
+ /* Wait until the controller is halted */
+ status = read32((unsigned long)&ehci_regs->status);
+ if (!(status & STS_HALT)) {
+ cmd = read32((unsigned long)&ehci_regs->command);
+ cmd &= ~CMD_RUN;
+ write32((unsigned long)&ehci_regs->command, cmd);
+ loop = 100;
+ do {
+ dbgp_mdelay(10);
+ status = read32((unsigned long)&ehci_regs->status);
+ } while (!(status & STS_HALT) && (--loop > 0));
+ if (status & STS_HALT)
+ dprintk(BIOS_INFO, "EHCI controller halted successfully.\n");
+ else
+ dprintk(BIOS_INFO, "EHCI controller is not halted. Reset may fail.\n");
+ }
+
loop = 100;
/* Reset the EHCI controller */
cmd = read32((unsigned long)&ehci_regs->command);
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3861
-gerrit
commit 5ada3c5aa6152ed939f6ad6a40496f790ea76765
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Aug 12 00:09:21 2013 +0300
usbdebug: Only test two possible USB device numbers
After an USB device sees USB bus reset on the bus, it will reset to
device number 0. Per the EHCI debug port specification, a debug
dongle device may reset to the fixed debug device number of 127 instead.
Thus there is no need to try device numbers from 1 to 126.
Change-Id: I78d58f3dc049cd8c20c6e2aa3a4207ad7e6a6d33
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/lib/usbdebug.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c
index 53ba4db..4ac7762 100644
--- a/src/lib/usbdebug.c
+++ b/src/lib/usbdebug.c
@@ -523,21 +523,27 @@ try_next_port:
dbgp_mdelay(100);
/* Find the debug device and make it device number 127 */
- for (devnum = 0; devnum <= 127; devnum++) {
+ devnum = 0;
+ do {
+ memset(&dbgp_desc, 0, sizeof(dbgp_desc));
ret = dbgp_control_msg(ehci_debug, devnum,
USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
USB_REQ_GET_DESCRIPTOR, (USB_DT_DEBUG << 8), 0,
&dbgp_desc, sizeof(dbgp_desc));
if (ret > 0)
break;
- }
- if (devnum > 127) {
+ if (devnum == 0)
+ devnum = USB_DEBUG_DEVNUM;
+ else
+ break;
+ } while (1);
+ if (ret < 0) {
dprintk(BIOS_INFO, "Could not find attached debug device.\n");
ret = -5;
goto err;
}
- if (ret < 0) {
- dprintk(BIOS_INFO, "Attached device is not a debug device.\n");
+ if (ret != sizeof(dbgp_desc)) {
+ dprintk(BIOS_INFO, "Invalid debug device descriptor.\n");
ret = -6;
goto err;
}
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3386
-gerrit
commit 1d2d65625b0e25667139e1cea548478ed1db23de
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Thu Jun 6 10:33:39 2013 +0300
usbdebug: Add compatibility quirk for FX2
This quirk is needed with a DIY debug dongle using obsolete
CY7C68013 (aka FX2) USB chips. Old revision of chip requires a
SET_CONFIGURATION to be sent, while this is not required in EHCI
debug port specs.
Change-Id: I4926eb19b7e991d6efeef782682756571ad006b9
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/lib/usbdebug.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c
index a5d3c37..53ba4db 100644
--- a/src/lib/usbdebug.c
+++ b/src/lib/usbdebug.c
@@ -411,7 +411,7 @@ static int usbdebug_init_(unsigned ehci_bar, unsigned offset, struct ehci_debug_
u32 cmd, ctrl, status, portsc, hcs_params;
u32 debug_port, new_debug_port = 0, n_ports;
u32 devnum;
- int ret, i;
+ int ret, i, configured;
int loop;
int port_map_tried;
int playtimes = 3;
@@ -569,9 +569,22 @@ try_next_port:
dprintk(BIOS_INFO, "EHCI debug interface enabled.\n");
/* Perform a small write to get the even/odd data state in sync */
+ configured = 0;
+small_write:
ret = dbgp_bulk_write(ehci_debug, USB_DEBUG_DEVNUM, dbgp_desc.bDebugOutEndpoint, "USB\r\n",5);
if (ret < 0) {
dprintk(BIOS_INFO, "dbgp_bulk_write failed: %d\n", ret);
+ if (!configured) {
+ /* Send Set Configure request to device. This is required for FX2
+ (CY7C68013) to transfer from USB state Addressed to Configured,
+ only then endpoints other than 0 are enabled. */
+ if (dbgp_control_msg(ehci_debug, USB_DEBUG_DEVNUM,
+ USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
+ USB_REQ_SET_CONFIGURATION, 1, 0, NULL, 0) >= 0) {
+ configured = 1;
+ goto small_write;
+ }
+ }
ret = -9;
goto err;
}
Bruce Griffith (Bruce.Griffith(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3822
-gerrit
commit 41ebe627ec38285c8c5be110ddd4e09c3c977a82
Author: Mike Loptien <mike.loptien(a)se-eng.com>
Date: Thu Jul 18 10:16:31 2013 -0600
AMD Fam16: Add secondary bus number to CRES method
Adding the 'WordBusNumber' macro to the PCI0
CRES ResourceTemplate in the AMD FCH ACPI code.
This sets up the bus number for the PCI0 device
and the secondary bus number in the CRS method.
This change came in response to a 'dmesg' error
which states:
'[FIRMWARE BUG]: ACPI: no secondary bus range in _CRS'
By adding the 'WordBusNumber' macro, ACPI can set
up a valid range for the PCIe downstream busses,
thereby relieving the Linux kernel from "guessing"
the valid range based off _BBN or assuming [0-0xFF].
The Linux kernel code that checks this bus range is
in `drivers/acpi/pci_root.c`. PCI busses can have
up to 256 secondary busses connected to them via
a PCI-PCI bridge. However, these busses do not
have to be sequentially numbered, so leaving out a
section of the range (eg. allowing [0-0x7F]) will
unnecessarily restrict the downstream busses.
Change-Id: Ib2d36f69a26b715798ef1ea17deb0905fa0cad87
Signed-off-by: Mike Loptien <mike.loptien(a)se-eng.com>
---
src/southbridge/amd/agesa/hudson/acpi/fch.asl | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/southbridge/amd/agesa/hudson/acpi/fch.asl b/src/southbridge/amd/agesa/hudson/acpi/fch.asl
index 4fbf853..5d3a29c 100755
--- a/src/southbridge/amd/agesa/hudson/acpi/fch.asl
+++ b/src/southbridge/amd/agesa/hudson/acpi/fch.asl
@@ -71,6 +71,22 @@ Device(ACMD) {
#endif
Name(CRES, ResourceTemplate() {
+ /* Set the Bus number and Secondary Bus number for the PCI0 device
+ * The Secondary bus range for PCI0 lets the system
+ * know what bus values are allowed on the downstream
+ * side of this PCI bus if there is a PCI-PCI bridge.
+ * PCI busses can have 256 secondary busses which
+ * range from [0-0xFF] but they do not need to be
+ * sequential.
+ */
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
+ 0x0000, /* address granularity */
+ 0x0000, /* range minimum */
+ 0x00FF, /* range maximum */
+ 0x0000, /* translation */
+ 0x0100, /* length */
+ ,, PSB0) /* ResourceSourceIndex, ResourceSource, DescriptorName */
+
IO(Decode16, 0x0CF8, 0x0CF8, 1, 8)
WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,