diff options
author | David Cohen <david.a.cohen@linux.intel.com> | 2013-12-02 19:20:00 -0500 |
---|---|---|
committer | Matthew Garrett <matthew.garrett@nebula.com> | 2014-01-21 08:44:17 -0500 |
commit | 694e523cfe07e908d170c6b9691882e101f82cd6 (patch) | |
tree | a73e4d3859e5d665551d9378f64185c2fac89282 /drivers/platform/x86/intel_scu_ipc.c | |
parent | 50a639fb158c6aafe86ba7d6104de69518a9d09a (diff) |
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: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Diffstat (limited to 'drivers/platform/x86/intel_scu_ipc.c')
-rw-r--r-- | drivers/platform/x86/intel_scu_ipc.c | 84 |
1 files changed, 40 insertions, 44 deletions
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c index 60ea476a9130..259969d31055 100644 --- a/drivers/platform/x86/intel_scu_ipc.c +++ b/drivers/platform/x86/intel_scu_ipc.c | |||
@@ -62,13 +62,6 @@ | |||
62 | #define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */ | 62 | #define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */ |
63 | #define IPC_IOC 0x100 /* IPC command register IOC bit */ | 63 | #define IPC_IOC 0x100 /* IPC command register IOC bit */ |
64 | 64 | ||
65 | enum { | ||
66 | SCU_IPC_LINCROFT, | ||
67 | SCU_IPC_PENWELL, | ||
68 | SCU_IPC_CLOVERVIEW, | ||
69 | SCU_IPC_TANGIER, | ||
70 | }; | ||
71 | |||
72 | /* intel scu ipc driver data*/ | 65 | /* intel scu ipc driver data*/ |
73 | struct intel_scu_ipc_pdata_t { | 66 | struct intel_scu_ipc_pdata_t { |
74 | u32 ipc_base; | 67 | u32 ipc_base; |
@@ -78,35 +71,29 @@ struct intel_scu_ipc_pdata_t { | |||
78 | u8 irq_mode; | 71 | u8 irq_mode; |
79 | }; | 72 | }; |
80 | 73 | ||
81 | static struct intel_scu_ipc_pdata_t intel_scu_ipc_pdata[] = { | 74 | static struct intel_scu_ipc_pdata_t intel_scu_ipc_lincroft_pdata = { |
82 | [SCU_IPC_LINCROFT] = { | 75 | .ipc_base = 0xff11c000, |
83 | .ipc_base = 0xff11c000, | 76 | .i2c_base = 0xff12b000, |
84 | .i2c_base = 0xff12b000, | 77 | .ipc_len = 0x100, |
85 | .ipc_len = 0x100, | 78 | .i2c_len = 0x10, |
86 | .i2c_len = 0x10, | 79 | .irq_mode = 0, |
87 | .irq_mode = 0, | 80 | }; |
88 | }, | 81 | |
89 | [SCU_IPC_PENWELL] = { | 82 | /* Penwell and Cloverview */ |
90 | .ipc_base = 0xff11c000, | 83 | static struct intel_scu_ipc_pdata_t intel_scu_ipc_penwell_pdata = { |
91 | .i2c_base = 0xff12b000, | 84 | .ipc_base = 0xff11c000, |
92 | .ipc_len = 0x100, | 85 | .i2c_base = 0xff12b000, |
93 | .i2c_len = 0x10, | 86 | .ipc_len = 0x100, |
94 | .irq_mode = 1, | 87 | .i2c_len = 0x10, |
95 | }, | 88 | .irq_mode = 1, |
96 | [SCU_IPC_CLOVERVIEW] = { | 89 | }; |
97 | .ipc_base = 0xff11c000, | 90 | |
98 | .i2c_base = 0xff12b000, | 91 | static struct intel_scu_ipc_pdata_t intel_scu_ipc_tangier_pdata = { |
99 | .ipc_len = 0x100, | 92 | .ipc_base = 0xff009000, |
100 | .i2c_len = 0x10, | 93 | .i2c_base = 0xff00d000, |
101 | .irq_mode = 1, | 94 | .ipc_len = 0x100, |
102 | }, | 95 | .i2c_len = 0x10, |
103 | [SCU_IPC_TANGIER] = { | 96 | .irq_mode = 0, |
104 | .ipc_base = 0xff009000, | ||
105 | .i2c_base = 0xff00d000, | ||
106 | .ipc_len = 0x100, | ||
107 | .i2c_len = 0x10, | ||
108 | .irq_mode = 0, | ||
109 | }, | ||
110 | }; | 97 | }; |
111 | 98 | ||
112 | static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id); | 99 | 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 | */ | 570 | */ |
584 | static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id) | 571 | static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id) |
585 | { | 572 | { |
586 | int err, pid; | 573 | int err; |
587 | struct intel_scu_ipc_pdata_t *pdata; | 574 | struct intel_scu_ipc_pdata_t *pdata; |
588 | resource_size_t pci_resource; | 575 | resource_size_t pci_resource; |
589 | 576 | ||
590 | if (ipcdev.pdev) /* We support only one SCU */ | 577 | if (ipcdev.pdev) /* We support only one SCU */ |
591 | return -EBUSY; | 578 | return -EBUSY; |
592 | 579 | ||
593 | pid = id->driver_data; | 580 | pdata = (struct intel_scu_ipc_pdata_t *)id->driver_data; |
594 | pdata = &intel_scu_ipc_pdata[pid]; | ||
595 | 581 | ||
596 | ipcdev.pdev = pci_dev_get(dev); | 582 | ipcdev.pdev = pci_dev_get(dev); |
597 | ipcdev.irq_mode = pdata->irq_mode; | 583 | ipcdev.irq_mode = pdata->irq_mode; |
@@ -650,11 +636,21 @@ static void ipc_remove(struct pci_dev *pdev) | |||
650 | } | 636 | } |
651 | 637 | ||
652 | static DEFINE_PCI_DEVICE_TABLE(pci_ids) = { | 638 | static DEFINE_PCI_DEVICE_TABLE(pci_ids) = { |
653 | {PCI_VDEVICE(INTEL, 0x082a), SCU_IPC_LINCROFT}, | 639 | { |
654 | {PCI_VDEVICE(INTEL, 0x080e), SCU_IPC_PENWELL}, | 640 | PCI_VDEVICE(INTEL, 0x082a), |
655 | {PCI_VDEVICE(INTEL, 0x08ea), SCU_IPC_CLOVERVIEW}, | 641 | (kernel_ulong_t)&intel_scu_ipc_lincroft_pdata, |
656 | {PCI_VDEVICE(INTEL, 0x11a0), SCU_IPC_TANGIER}, | 642 | }, { |
657 | { 0,} | 643 | PCI_VDEVICE(INTEL, 0x080e), |
644 | (kernel_ulong_t)&intel_scu_ipc_penwell_pdata, | ||
645 | }, { | ||
646 | PCI_VDEVICE(INTEL, 0x08ea), | ||
647 | (kernel_ulong_t)&intel_scu_ipc_penwell_pdata, | ||
648 | }, { | ||
649 | PCI_VDEVICE(INTEL, 0x11a0), | ||
650 | (kernel_ulong_t)&intel_scu_ipc_tangier_pdata, | ||
651 | }, { | ||
652 | 0, | ||
653 | } | ||
658 | }; | 654 | }; |
659 | MODULE_DEVICE_TABLE(pci, pci_ids); | 655 | MODULE_DEVICE_TABLE(pci, pci_ids); |
660 | 656 | ||