Commit 694e523c authored by David Cohen's avatar David Cohen Committed by Matthew Garrett

ipc: simplify platform data approach

This patch removes the unnecessary enum for platform type to handle the
array of pdatas. We can set pdata directly to pci_device_id struct
instead.
Signed-off-by: default avatarDavid Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: default avatarMatthew Garrett <matthew.garrett@nebula.com>
parent 50a639fb
...@@ -62,13 +62,6 @@ ...@@ -62,13 +62,6 @@
#define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */ #define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */
#define IPC_IOC 0x100 /* IPC command register IOC bit */ #define IPC_IOC 0x100 /* IPC command register IOC bit */
enum {
SCU_IPC_LINCROFT,
SCU_IPC_PENWELL,
SCU_IPC_CLOVERVIEW,
SCU_IPC_TANGIER,
};
/* 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 ipc_base;
...@@ -78,35 +71,29 @@ struct intel_scu_ipc_pdata_t { ...@@ -78,35 +71,29 @@ struct intel_scu_ipc_pdata_t {
u8 irq_mode; u8 irq_mode;
}; };
static struct intel_scu_ipc_pdata_t intel_scu_ipc_pdata[] = { static struct intel_scu_ipc_pdata_t intel_scu_ipc_lincroft_pdata = {
[SCU_IPC_LINCROFT] = { .ipc_base = 0xff11c000,
.ipc_base = 0xff11c000, .i2c_base = 0xff12b000,
.i2c_base = 0xff12b000, .ipc_len = 0x100,
.ipc_len = 0x100, .i2c_len = 0x10,
.i2c_len = 0x10, .irq_mode = 0,
.irq_mode = 0, };
},
[SCU_IPC_PENWELL] = { /* Penwell and Cloverview */
.ipc_base = 0xff11c000, static struct intel_scu_ipc_pdata_t intel_scu_ipc_penwell_pdata = {
.i2c_base = 0xff12b000, .ipc_base = 0xff11c000,
.ipc_len = 0x100, .i2c_base = 0xff12b000,
.i2c_len = 0x10, .ipc_len = 0x100,
.irq_mode = 1, .i2c_len = 0x10,
}, .irq_mode = 1,
[SCU_IPC_CLOVERVIEW] = { };
.ipc_base = 0xff11c000,
.i2c_base = 0xff12b000, static struct intel_scu_ipc_pdata_t intel_scu_ipc_tangier_pdata = {
.ipc_len = 0x100, .ipc_base = 0xff009000,
.i2c_len = 0x10, .i2c_base = 0xff00d000,
.irq_mode = 1, .ipc_len = 0x100,
}, .i2c_len = 0x10,
[SCU_IPC_TANGIER] = { .irq_mode = 0,
.ipc_base = 0xff009000,
.i2c_base = 0xff00d000,
.ipc_len = 0x100,
.i2c_len = 0x10,
.irq_mode = 0,
},
}; };
static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id); static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id);
...@@ -583,15 +570,14 @@ static irqreturn_t ioc(int irq, void *dev_id) ...@@ -583,15 +570,14 @@ static irqreturn_t ioc(int irq, void *dev_id)
*/ */
static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id) static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
{ {
int err, pid; int err;
struct intel_scu_ipc_pdata_t *pdata; struct intel_scu_ipc_pdata_t *pdata;
resource_size_t pci_resource; resource_size_t pci_resource;
if (ipcdev.pdev) /* We support only one SCU */ if (ipcdev.pdev) /* We support only one SCU */
return -EBUSY; return -EBUSY;
pid = id->driver_data; pdata = (struct intel_scu_ipc_pdata_t *)id->driver_data;
pdata = &intel_scu_ipc_pdata[pid];
ipcdev.pdev = pci_dev_get(dev); ipcdev.pdev = pci_dev_get(dev);
ipcdev.irq_mode = pdata->irq_mode; ipcdev.irq_mode = pdata->irq_mode;
...@@ -650,11 +636,21 @@ static void ipc_remove(struct pci_dev *pdev) ...@@ -650,11 +636,21 @@ static void ipc_remove(struct pci_dev *pdev)
} }
static DEFINE_PCI_DEVICE_TABLE(pci_ids) = { static DEFINE_PCI_DEVICE_TABLE(pci_ids) = {
{PCI_VDEVICE(INTEL, 0x082a), SCU_IPC_LINCROFT}, {
{PCI_VDEVICE(INTEL, 0x080e), SCU_IPC_PENWELL}, PCI_VDEVICE(INTEL, 0x082a),
{PCI_VDEVICE(INTEL, 0x08ea), SCU_IPC_CLOVERVIEW}, (kernel_ulong_t)&intel_scu_ipc_lincroft_pdata,
{PCI_VDEVICE(INTEL, 0x11a0), SCU_IPC_TANGIER}, }, {
{ 0,} PCI_VDEVICE(INTEL, 0x080e),
(kernel_ulong_t)&intel_scu_ipc_penwell_pdata,
}, {
PCI_VDEVICE(INTEL, 0x08ea),
(kernel_ulong_t)&intel_scu_ipc_penwell_pdata,
}, {
PCI_VDEVICE(INTEL, 0x11a0),
(kernel_ulong_t)&intel_scu_ipc_tangier_pdata,
}, {
0,
}
}; };
MODULE_DEVICE_TABLE(pci, pci_ids); MODULE_DEVICE_TABLE(pci, pci_ids);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment