aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>2013-11-14 17:15:04 -0500
committerMatthew Garrett <matthew.garrett@nebula.com>2013-11-20 18:51:28 -0500
commite97a1c981723f3b7620b124859383a457b12f06f (patch)
treed3a4454eea5b1306eefd6a37e1162799d7e73fdf /drivers/platform
parentcab6661344f14a09d7aecdf821a40f68ef9b18cc (diff)
ipc: Added platform data structure
Since the same ipc driver can be used by many platforms, using macros for defining ipc_base and i2c_base addresses is not a scalable approach. So added a platform data structure to pass this information. Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Acked-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Cc: David Cohen <david.a.cohen@linux.intel.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/intel_scu_ipc.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index d654f831410d..39ff57bdf18f 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -58,12 +58,29 @@
58 * message handler is called within firmware. 58 * message handler is called within firmware.
59 */ 59 */
60 60
61#define IPC_BASE_ADDR 0xFF11C000 /* IPC1 base register address */
62#define IPC_MAX_ADDR 0x100 /* Maximum IPC regisers */
63#define IPC_WWBUF_SIZE 20 /* IPC Write buffer Size */ 61#define IPC_WWBUF_SIZE 20 /* IPC Write buffer Size */
64#define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */ 62#define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */
65#define IPC_I2C_BASE 0xFF12B000 /* I2C control register base address */ 63
66#define IPC_I2C_MAX_ADDR 0x10 /* Maximum I2C regisers */ 64enum {
65 SCU_IPC_LINCROFT,
66};
67
68/* intel scu ipc driver data*/
69struct intel_scu_ipc_pdata_t {
70 u32 ipc_base;
71 u32 i2c_base;
72 u32 ipc_len;
73 u32 i2c_len;
74};
75
76static struct intel_scu_ipc_pdata_t intel_scu_ipc_pdata[] = {
77 [SCU_IPC_LINCROFT] = {
78 .ipc_base = 0xff11c000,
79 .i2c_base = 0xff12b000,
80 .ipc_len = 0x100,
81 .i2c_len = 0x10,
82 },
83};
67 84
68static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id); 85static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id);
69static void ipc_remove(struct pci_dev *pdev); 86static void ipc_remove(struct pci_dev *pdev);
@@ -504,12 +521,16 @@ static irqreturn_t ioc(int irq, void *dev_id)
504 */ 521 */
505static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id) 522static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
506{ 523{
507 int err; 524 int err, pid;
525 struct intel_scu_ipc_pdata_t *pdata;
508 resource_size_t pci_resource; 526 resource_size_t pci_resource;
509 527
510 if (ipcdev.pdev) /* We support only one SCU */ 528 if (ipcdev.pdev) /* We support only one SCU */
511 return -EBUSY; 529 return -EBUSY;
512 530
531 pid = id->driver_data;
532 pdata = &intel_scu_ipc_pdata[pid];
533
513 ipcdev.pdev = pci_dev_get(dev); 534 ipcdev.pdev = pci_dev_get(dev);
514 535
515 err = pci_enable_device(dev); 536 err = pci_enable_device(dev);
@@ -527,11 +548,11 @@ static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
527 if (request_irq(dev->irq, ioc, 0, "intel_scu_ipc", &ipcdev)) 548 if (request_irq(dev->irq, ioc, 0, "intel_scu_ipc", &ipcdev))
528 return -EBUSY; 549 return -EBUSY;
529 550
530 ipcdev.ipc_base = ioremap_nocache(IPC_BASE_ADDR, IPC_MAX_ADDR); 551 ipcdev.ipc_base = ioremap_nocache(pdata->ipc_base, pdata->ipc_len);
531 if (!ipcdev.ipc_base) 552 if (!ipcdev.ipc_base)
532 return -ENOMEM; 553 return -ENOMEM;
533 554
534 ipcdev.i2c_base = ioremap_nocache(IPC_I2C_BASE, IPC_I2C_MAX_ADDR); 555 ipcdev.i2c_base = ioremap_nocache(pdata->i2c_base, pdata->i2c_len);
535 if (!ipcdev.i2c_base) { 556 if (!ipcdev.i2c_base) {
536 iounmap(ipcdev.ipc_base); 557 iounmap(ipcdev.ipc_base);
537 return -ENOMEM; 558 return -ENOMEM;
@@ -564,7 +585,7 @@ static void ipc_remove(struct pci_dev *pdev)
564} 585}
565 586
566static DEFINE_PCI_DEVICE_TABLE(pci_ids) = { 587static DEFINE_PCI_DEVICE_TABLE(pci_ids) = {
567 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x082a)}, 588 {PCI_VDEVICE(INTEL, 0x082a), SCU_IPC_LINCROFT},
568 { 0,} 589 { 0,}
569}; 590};
570MODULE_DEVICE_TABLE(pci, pci_ids); 591MODULE_DEVICE_TABLE(pci, pci_ids);