From d1a0c5770803e45dabecf6094fccb9895ea76d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sun, 30 Jul 2017 11:37:14 +0300 Subject: usbdebug: Consolidate EHCI_BAR setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is assumption of static EHCI_BAR_INDEX, try to clean it up by bringing BAR programming at one spot. Change-Id: Ie16090536ac5470c24720a54813015250ae2d0dd Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/20825 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Stefan Reinauer --- src/drivers/usb/pci_ehci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/drivers/usb') diff --git a/src/drivers/usb/pci_ehci.c b/src/drivers/usb/pci_ehci.c index de291ee258..8b72f57a5a 100644 --- a/src/drivers/usb/pci_ehci.c +++ b/src/drivers/usb/pci_ehci.c @@ -47,12 +47,18 @@ int ehci_debug_hw_enable(unsigned int *base, unsigned int *dbg_offset) u32 cap = pci_read_config32(dev, pos); /* FIXME: We should remove static EHCI_BAR_INDEX. */ - u8 dbg_bar = 0x10 + 4 * ((cap >> 29) - 1); - if (dbg_bar != EHCI_BAR_INDEX) + u8 ehci_bar = 0x10 + 4 * ((cap >> 29) - 1); + if (ehci_bar != EHCI_BAR_INDEX) return -1; + pci_write_config32(dev, ehci_bar, CONFIG_EHCI_BAR); + + pci_write_config8(dev, PCI_COMMAND, PCI_COMMAND_MEMORY | + PCI_COMMAND_MASTER); + *base = CONFIG_EHCI_BAR; *dbg_offset = (cap>>16) & 0x1ffc; + return 0; } -- cgit v1.2.3