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>
This commit is contained in:
parent
0d8d482f63
commit
fb387dfb92
|
@ -21,9 +21,12 @@
|
|||
#include <string.h>
|
||||
#include <console/console.h>
|
||||
#include <usbdebug.h>
|
||||
#include <device/pci.h>
|
||||
#include <pc80/mc146818rtc.h>
|
||||
|
||||
static struct ehci_debug_info dbg_info;
|
||||
static struct device_operations *ehci_drv_ops;
|
||||
static struct device_operations ehci_dbg_ops;
|
||||
|
||||
void set_ehci_base(unsigned ehci_base)
|
||||
{
|
||||
|
@ -48,6 +51,43 @@ unsigned get_ehci_debug(void)
|
|||
return (unsigned)dbg_info.ehci_debug;
|
||||
}
|
||||
|
||||
static void pci_ehci_set_resources(struct device *dev)
|
||||
{
|
||||
struct resource *res;
|
||||
u32 base;
|
||||
u32 usb_debug;
|
||||
|
||||
printk(BIOS_DEBUG, "%s EHCI Debug Port hook triggered\n", dev_path(dev));
|
||||
usb_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
|
||||
if (ehci_drv_ops->set_resources)
|
||||
ehci_drv_ops->set_resources(dev);
|
||||
|
||||
res = find_resource(dev, EHCI_BAR_INDEX);
|
||||
set_ehci_debug(usb_debug);
|
||||
if (!res) return;
|
||||
base = res->base;
|
||||
set_ehci_base(base);
|
||||
report_resource_stored(dev, res, "");
|
||||
printk(BIOS_DEBUG, "%s EHCI Debug Port relocated\n", dev_path(dev));
|
||||
}
|
||||
|
||||
void pci_ehci_read_resources(struct device *dev)
|
||||
{
|
||||
if (!ehci_drv_ops) {
|
||||
memcpy(&ehci_dbg_ops, dev->ops, sizeof(ehci_dbg_ops));
|
||||
ehci_drv_ops = dev->ops;
|
||||
ehci_dbg_ops.set_resources = pci_ehci_set_resources;
|
||||
dev->ops = &ehci_dbg_ops;
|
||||
printk(BIOS_DEBUG, "%s EHCI BAR hook registered\n", dev_path(dev));
|
||||
} else {
|
||||
printk(BIOS_DEBUG, "More than one caller of %s from %s\n", __func__, dev_path(dev));
|
||||
}
|
||||
|
||||
pci_dev_read_resources(dev);
|
||||
}
|
||||
|
||||
static void dbgp_init(void)
|
||||
{
|
||||
#if !CONFIG_EARLY_CONSOLE
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#ifndef EHCI_H
|
||||
#define EHCI_H
|
||||
|
||||
#define EHCI_BAR_INDEX 0x10
|
||||
|
||||
/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */
|
||||
|
||||
/* Section 2.2 Host Controller Capability Registers */
|
||||
|
|
|
@ -21,7 +21,24 @@
|
|||
#ifndef USBDEBUG_H
|
||||
#define USBDEBUG_H
|
||||
|
||||
#include <ehci.h>
|
||||
#define EHCI_BAR_INDEX 0x10
|
||||
|
||||
#ifndef __PRE_RAM__
|
||||
#if !CONFIG_USBDEBUG
|
||||
#define pci_ehci_read_resources pci_dev_read_resources
|
||||
#else
|
||||
/* Relocation of EHCI Debug Port BAR
|
||||
*
|
||||
* PCI EHCI controller with Debug Port capability shall replace
|
||||
* pci_dev_read_resources() with pci_ehci_read_resources() in its
|
||||
* declaration of device_operations for .read_resources.
|
||||
* This installs a hook to reconfigure usbdebug when resource allocator
|
||||
* assigns a new BAR for the device.
|
||||
*/
|
||||
struct device;
|
||||
void pci_ehci_read_resources(struct device *dev);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct ehci_debug_info {
|
||||
void *ehci_caps;
|
||||
|
|
|
@ -34,33 +34,9 @@ static void usb_init(struct device *dev)
|
|||
{
|
||||
}
|
||||
|
||||
static void usb_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
u32 base;
|
||||
u32 old_debug;
|
||||
|
||||
old_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
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, "");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static struct device_operations usb_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_set_resources, /* pci_dev_set_resources, */
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_init,
|
||||
.scan_bus = 0,
|
||||
|
@ -100,8 +76,8 @@ static const struct pci_driver usb_4_driver __pci_driver = {
|
|||
|
||||
/*
|
||||
static struct device_operations usb_ops2 = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_set_resources,
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_init2,
|
||||
.scan_bus = 0,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -130,33 +130,9 @@ static void usb_init2(struct device *dev)
|
|||
pci_write_config8(dev, 0x54, byte);
|
||||
}
|
||||
|
||||
static void usb_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
u32 base;
|
||||
u32 old_debug;
|
||||
|
||||
old_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
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, "");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static struct device_operations usb_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_set_resources, /* pci_dev_set_resources, */
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_init,
|
||||
/*.enable = sb600_enable, */
|
||||
|
@ -180,8 +156,8 @@ static const struct pci_driver usb_0_driver __pci_driver = {
|
|||
};
|
||||
|
||||
static struct device_operations usb_ops2 = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_set_resources, /* pci_dev_set_resources, */
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_init2,
|
||||
/*.enable = sb600_enable, */
|
||||
|
|
|
@ -182,32 +182,9 @@ static void usb_init2(struct device *dev)
|
|||
printk(BIOS_DEBUG, "rpr 6.23, final dword=%x\n", dword);
|
||||
}
|
||||
|
||||
static void usb_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
u32 base;
|
||||
u32 old_debug;
|
||||
|
||||
old_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
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, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct device_operations usb_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_set_resources, /* pci_dev_set_resources, */
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_init,
|
||||
.scan_bus = 0,
|
||||
|
@ -247,8 +224,8 @@ static const struct pci_driver usb_4_driver __pci_driver = {
|
|||
};
|
||||
|
||||
static struct device_operations usb_ops2 = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_set_resources, /* pci_dev_set_resources, */
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_init2,
|
||||
.scan_bus = 0,
|
||||
|
|
|
@ -147,33 +147,9 @@ static void usb_init2(struct device *dev)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void usb_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
u32 base;
|
||||
u32 old_debug;
|
||||
|
||||
old_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
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, "");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static struct device_operations usb_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_set_resources, /* pci_dev_set_resources, */
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_init,
|
||||
.scan_bus = 0,
|
||||
|
@ -212,8 +188,8 @@ static const struct pci_driver usb_4_driver __pci_driver = {
|
|||
};
|
||||
|
||||
static struct device_operations usb_ops2 = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_set_resources, /* pci_dev_set_resources, */
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_init2,
|
||||
.scan_bus = 0,
|
||||
|
|
|
@ -65,37 +65,13 @@ static void usb_ehci_set_subsystem(device_t dev, unsigned vendor, unsigned devic
|
|||
pci_write_config8(dev, 0x80, access_cntl);
|
||||
}
|
||||
|
||||
static void usb_ehci_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
u32 base;
|
||||
u32 usb_debug;
|
||||
|
||||
usb_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
res = find_resource(dev, 0x10);
|
||||
set_ehci_debug(usb_debug);
|
||||
if (!res) return;
|
||||
base = res->base;
|
||||
set_ehci_base(base);
|
||||
report_resource_stored(dev, res, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct pci_operations lops_pci = {
|
||||
.set_subsystem = &usb_ehci_set_subsystem,
|
||||
};
|
||||
|
||||
static struct device_operations usb_ehci_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_ehci_set_resources,
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_ehci_init,
|
||||
.scan_bus = 0,
|
||||
|
|
|
@ -83,37 +83,13 @@ static void usb_ehci_set_subsystem(device_t dev, unsigned vendor, unsigned devic
|
|||
pci_write_config8(dev, 0x80, access_cntl);
|
||||
}
|
||||
|
||||
static void usb_ehci_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
u32 base;
|
||||
u32 usb_debug;
|
||||
|
||||
usb_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
res = find_resource(dev, 0x10);
|
||||
set_ehci_debug(usb_debug);
|
||||
if (!res) return;
|
||||
base = res->base;
|
||||
set_ehci_base(base);
|
||||
report_resource_stored(dev, res, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct pci_operations lops_pci = {
|
||||
.set_subsystem = &usb_ehci_set_subsystem,
|
||||
};
|
||||
|
||||
static struct device_operations usb_ehci_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_ehci_set_resources,
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_ehci_init,
|
||||
.scan_bus = 0,
|
||||
|
|
|
@ -58,29 +58,6 @@ static void usb_ehci_set_subsystem(device_t dev, unsigned vendor, unsigned devic
|
|||
pci_write_config8(dev, 0x80, access_cntl);
|
||||
}
|
||||
|
||||
static void usb_ehci_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
u32 base;
|
||||
u32 usb_debug;
|
||||
|
||||
usb_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
res = find_resource(dev, 0x10);
|
||||
set_ehci_debug(usb_debug);
|
||||
if (!res) return;
|
||||
base = res->base;
|
||||
set_ehci_base(base);
|
||||
report_resource_stored(dev, res, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static const unsigned short pci_device_ids[] = {
|
||||
0x293a,
|
||||
0x293c,
|
||||
|
@ -92,8 +69,8 @@ static struct pci_operations lops_pci = {
|
|||
};
|
||||
|
||||
static struct device_operations usb_ehci_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_ehci_set_resources,
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_ehci_init,
|
||||
.scan_bus = 0,
|
||||
|
|
|
@ -65,37 +65,13 @@ static void usb_ehci_set_subsystem(device_t dev, unsigned vendor, unsigned devic
|
|||
pci_write_config8(dev, 0x80, access_cntl);
|
||||
}
|
||||
|
||||
static void usb_ehci_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
u32 base;
|
||||
u32 usb_debug;
|
||||
|
||||
usb_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
res = find_resource(dev, 0x10);
|
||||
set_ehci_debug(usb_debug);
|
||||
if (!res) return;
|
||||
base = res->base;
|
||||
set_ehci_base(base);
|
||||
report_resource_stored(dev, res, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct pci_operations lops_pci = {
|
||||
.set_subsystem = &usb_ehci_set_subsystem,
|
||||
};
|
||||
|
||||
static struct device_operations usb_ehci_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb_ehci_set_resources,
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb_ehci_init,
|
||||
.scan_bus = 0,
|
||||
|
|
|
@ -37,32 +37,9 @@ static void usb2_init(struct device *dev)
|
|||
pci_write_config32(dev, 0xf8, dword);
|
||||
}
|
||||
|
||||
static void usb2_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
unsigned base;
|
||||
unsigned old_debug;
|
||||
|
||||
old_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
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, "");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static struct device_operations usb2_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb2_set_resources,
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb2_init,
|
||||
// .enable = mcp55_enable,
|
||||
|
|
|
@ -112,28 +112,6 @@ static void usb2_init(struct device *dev)
|
|||
print_debug("USB 2.0 INIT:<----------\n");
|
||||
}
|
||||
|
||||
static void usb2_set_resources(struct device *dev)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
struct resource *res;
|
||||
unsigned base;
|
||||
unsigned old_debug;
|
||||
|
||||
old_debug = get_ehci_debug();
|
||||
set_ehci_debug(0);
|
||||
#endif
|
||||
pci_dev_set_resources(dev);
|
||||
|
||||
#if CONFIG_USBDEBUG
|
||||
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, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
|
||||
{
|
||||
pci_write_config32(dev, 0x40,
|
||||
|
@ -145,8 +123,8 @@ static struct pci_operations lops_pci = {
|
|||
};
|
||||
|
||||
static struct device_operations usb2_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.set_resources = usb2_set_resources,
|
||||
.read_resources = pci_ehci_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = usb2_init,
|
||||
// .enable = sis966_enable,
|
||||
|
|
Loading…
Reference in New Issue