intel_scu_ipc: Read resources from PCI configuration

Read the resources from PCI BAR0 instead of using hardcoded values.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
This commit is contained in:
Andy Shevchenko 2015-01-21 21:38:11 +02:00 committed by Darren Hart
parent f0295a36dc
commit 32d0e4a337
1 changed files with 6 additions and 15 deletions

View File

@ -43,10 +43,9 @@
/* /*
* IPC register summary * IPC register summary
* *
* IPC register blocks are memory mapped at fixed address of 0xFF11C000 * IPC register blocks are memory mapped at fixed address of PCI BAR 0.
* To read or write information to the SCU, driver writes to IPC-1 memory * To read or write information to the SCU, driver writes to IPC-1 memory
* mapped registers (base address 0xFF11C000). The following is the IPC * mapped registers. The following is the IPC mechanism
* mechanism
* *
* 1. IA core cDMI interface claims this transaction and converts it to a * 1. IA core cDMI interface claims this transaction and converts it to a
* Transaction Layer Packet (TLP) message which is sent across the cDMI. * Transaction Layer Packet (TLP) message which is sent across the cDMI.
@ -69,34 +68,26 @@
/* intel scu ipc driver data */ /* intel scu ipc driver data */
struct intel_scu_ipc_pdata_t { struct intel_scu_ipc_pdata_t {
u32 ipc_base;
u32 i2c_base; u32 i2c_base;
u32 ipc_len;
u32 i2c_len; u32 i2c_len;
u8 irq_mode; u8 irq_mode;
}; };
static struct intel_scu_ipc_pdata_t intel_scu_ipc_lincroft_pdata = { static struct intel_scu_ipc_pdata_t intel_scu_ipc_lincroft_pdata = {
.ipc_base = 0xff11c000,
.i2c_base = 0xff12b000, .i2c_base = 0xff12b000,
.ipc_len = 0x100,
.i2c_len = 0x10, .i2c_len = 0x10,
.irq_mode = 0, .irq_mode = 0,
}; };
/* Penwell and Cloverview */ /* Penwell and Cloverview */
static struct intel_scu_ipc_pdata_t intel_scu_ipc_penwell_pdata = { static struct intel_scu_ipc_pdata_t intel_scu_ipc_penwell_pdata = {
.ipc_base = 0xff11c000,
.i2c_base = 0xff12b000, .i2c_base = 0xff12b000,
.ipc_len = 0x100,
.i2c_len = 0x10, .i2c_len = 0x10,
.irq_mode = 1, .irq_mode = 1,
}; };
static struct intel_scu_ipc_pdata_t intel_scu_ipc_tangier_pdata = { static struct intel_scu_ipc_pdata_t intel_scu_ipc_tangier_pdata = {
.ipc_base = 0xff009000,
.i2c_base = 0xff00d000, .i2c_base = 0xff00d000,
.ipc_len = 0x100,
.i2c_len = 0x10, .i2c_len = 0x10,
.irq_mode = 0, .irq_mode = 0,
}; };
@ -572,7 +563,7 @@ static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
{ {
int err; int err;
struct intel_scu_ipc_pdata_t *pdata; struct intel_scu_ipc_pdata_t *pdata;
resource_size_t pci_resource; resource_size_t base;
if (ipcdev.pdev) /* We support only one SCU */ if (ipcdev.pdev) /* We support only one SCU */
return -EBUSY; return -EBUSY;
@ -590,8 +581,8 @@ static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (err) if (err)
return err; return err;
pci_resource = pci_resource_start(dev, 0); base = pci_resource_start(dev, 0);
if (!pci_resource) if (!base)
return -ENOMEM; return -ENOMEM;
init_completion(&ipcdev.cmd_complete); init_completion(&ipcdev.cmd_complete);
@ -599,7 +590,7 @@ static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (request_irq(dev->irq, ioc, 0, "intel_scu_ipc", &ipcdev)) if (request_irq(dev->irq, ioc, 0, "intel_scu_ipc", &ipcdev))
return -EBUSY; return -EBUSY;
ipcdev.ipc_base = ioremap_nocache(pdata->ipc_base, pdata->ipc_len); ipcdev.ipc_base = ioremap_nocache(base, pci_resource_len(dev, 0));
if (!ipcdev.ipc_base) if (!ipcdev.ipc_base)
return -ENOMEM; return -ENOMEM;