diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2013-06-07 22:16:52 +0300 |
---|---|---|
committer | Aaron Durbin <adurbin@google.com> | 2013-07-01 17:10:55 +0200 |
commit | fb387dfb920f73abb144183b8a41dc917e2e32da (patch) | |
tree | 27f1947471fc8bae8944b892c16719c0856f3724 /src/southbridge/amd/cimx | |
parent | 0d8d482f6316885d7e553d9aeb538ce5bbd2fbba (diff) |
usbdebug: Drop duplicates of EHCI BAR relocation code
All the additional work that needs to be done in EHCI BAR relocation
is independent of the hardware platform and was functionally identical
in all the copies removed.
When USBDEBUG is not selected, PCI EHCI controllers use standard
pci_dev_read_resources() call.
With USBDEBUG selected, PCI EHCI controller's device_operations
.read_resources is replaced with pci_ehci_read_resources() call,
which in turn will replace the device_operations .set_resources call.
The replacement for .set_resources reconfigures usbdebug driver side,
and calls the original .set_resources to configure hardware side.
Change-Id: I8e136a5da4efedf60b6dd7068c0488153efaaf8e
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3412
Reviewed-by: Aaron Durbin <adurbin@google.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/southbridge/amd/cimx')
-rw-r--r-- | src/southbridge/amd/cimx/sb700/late.c | 32 | ||||
-rw-r--r-- | src/southbridge/amd/cimx/sb800/late.c | 31 | ||||
-rw-r--r-- | src/southbridge/amd/cimx/sb900/late.c | 32 |
3 files changed, 6 insertions, 89 deletions
diff --git a/src/southbridge/amd/cimx/sb700/late.c b/src/southbridge/amd/cimx/sb700/late.c index b259a7b797..e2ecdc32cc 100644 --- a/src/southbridge/amd/cimx/sb700/late.c +++ b/src/southbridge/amd/cimx/sb700/late.c @@ -25,6 +25,7 @@ #include <device/smbus.h> /* smbus_bus_operations */ #include <pc80/mc146818rtc.h> #include <console/console.h> /* printk */ +#include <usbdebug.h> #include "lpc.h" /* lpc_read_resources */ #include "Platform.h" /* Platfrom Specific Definitions */ #include "sb_cimx.h" @@ -120,38 +121,9 @@ static const struct pci_driver sata_driver __pci_driver = { .device = PCI_DEVICE_ID_ATI_SB700_SATA, //SATA IDE Mode 4390 }; -#if CONFIG_USBDEBUG -static void usb_set_resources(struct device *dev) -{ - struct resource *res; - u32 base; - u32 old_debug; - - printk(BIOS_SPEW, "SB700 - Late.c - %s - Start.\n", __func__); - old_debug = get_ehci_debug(); - set_ehci_debug(0); - - pci_dev_set_resources(dev); - - res = find_resource(dev, 0x10); - set_ehci_debug(old_debug); - if (!res) - return; - base = res->base; - set_ehci_base(base); - report_resource_stored(dev, res, ""); - printk(BIOS_SPEW, "SB700 - Late.c - %s - End.\n", __func__); -} -#endif - - static struct device_operations usb_ops = { - .read_resources = pci_dev_read_resources, -#if CONFIG_USBDEBUG - .set_resources = usb_set_resources, -#else + .read_resources = pci_ehci_read_resources, .set_resources = pci_dev_set_resources, -#endif .enable_resources = pci_dev_enable_resources, .init = 0, .scan_bus = 0, diff --git a/src/southbridge/amd/cimx/sb800/late.c b/src/southbridge/amd/cimx/sb800/late.c index 74b2d089eb..90b26aedb9 100644 --- a/src/southbridge/amd/cimx/sb800/late.c +++ b/src/southbridge/amd/cimx/sb800/late.c @@ -26,6 +26,7 @@ #include <pc80/mc146818rtc.h> #include <console/console.h> /* printk */ #include <arch/acpi.h> +#include <usbdebug.h> #include "lpc.h" /* lpc_read_resources */ #include "SBPLATFORM.h" /* Platfrom Specific Definitions */ #include "cfg.h" /* sb800 Cimx configuration */ @@ -179,37 +180,9 @@ static const struct pci_driver raid5_driver __pci_driver = { .device = PCI_DEVICE_ID_ATI_SB800_SATA_RAID5, }; -#if CONFIG_USBDEBUG -static void usb_set_resources(struct device *dev) -{ - struct resource *res; - u32 base; - u32 old_debug; - - printk(BIOS_DEBUG, "SB800 - Late.c - %s - Start.\n", __func__); - old_debug = get_ehci_debug(); - set_ehci_debug(0); - - pci_dev_set_resources(dev); - - res = find_resource(dev, 0x10); - set_ehci_debug(old_debug); - if (!res) - return; - base = res->base; - set_ehci_base(base); - report_resource_stored(dev, res, ""); - printk(BIOS_DEBUG, "SB800 - Late.c - %s - End.\n", __func__); -} -#endif - static struct device_operations usb_ops = { - .read_resources = pci_dev_read_resources, -#if CONFIG_USBDEBUG - .set_resources = usb_set_resources, -#else + .read_resources = pci_ehci_read_resources, .set_resources = pci_dev_set_resources, -#endif .enable_resources = pci_dev_enable_resources, .init = 0, .scan_bus = 0, diff --git a/src/southbridge/amd/cimx/sb900/late.c b/src/southbridge/amd/cimx/sb900/late.c index 947e882fd9..d2ce72cc01 100644 --- a/src/southbridge/amd/cimx/sb900/late.c +++ b/src/southbridge/amd/cimx/sb900/late.c @@ -24,6 +24,7 @@ #include <device/smbus.h> /* smbus_bus_operations */ #include <pc80/mc146818rtc.h> #include <console/console.h> /* printk */ +#include <usbdebug.h> #include "lpc.h" /* lpc_read_resources */ #include "SbPlatform.h" /* Platfrom Specific Definitions */ #include "chip.h" /* struct southbridge_amd_cimx_sb900_config */ @@ -174,31 +175,6 @@ static const struct pci_driver sata_driver __pci_driver = { #endif }; - -#if CONFIG_USBDEBUG -static void usb_set_resources(struct device *dev) -{ - struct resource *res; - u32 base; - u32 old_debug; - - printk(BIOS_DEBUG, "SB900 - Late.c - usb_set_resources - Start.\n"); - old_debug = get_ehci_debug(); - set_ehci_debug(0); - - pci_dev_set_resources(dev); - - res = find_resource(dev, 0x10); - set_ehci_debug(old_debug); - if (!res) - return; - base = res->base; - set_ehci_base(base); - report_resource_stored(dev, res, ""); - printk(BIOS_DEBUG, "SB900 - Late.c - usb_set_resources - End.\n"); -} -#endif - static void usb_init(struct device *dev) { printk(BIOS_DEBUG, "SB900 - Late.c - usb_init - Start.\n"); @@ -208,12 +184,8 @@ static void usb_init(struct device *dev) } static struct device_operations usb_ops = { - .read_resources = pci_dev_read_resources, -#if CONFIG_USBDEBUG - .set_resources = usb_set_resources, -#else + .read_resources = pci_ehci_read_resources, .set_resources = pci_dev_set_resources, -#endif .enable_resources = pci_dev_enable_resources, .init = usb_init, .scan_bus = 0, |