]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/platform/x86/intel_scu_ipc.c
intel_scu_ipc: Propagate pointer to struct intel_scu_ipc_dev
[karo-tx-linux.git] / drivers / platform / x86 / intel_scu_ipc.c
1 /*
2  * intel_scu_ipc.c: Driver for the Intel SCU IPC mechanism
3  *
4  * (C) Copyright 2008-2010,2015 Intel Corporation
5  * Author: Sreedhara DS (sreedhara.ds@intel.com)
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; version 2
10  * of the License.
11  *
12  * SCU running in ARC processor communicates with other entity running in IA
13  * core through IPC mechanism which in turn messaging between IA core ad SCU.
14  * SCU has two IPC mechanism IPC-1 and IPC-2. IPC-1 is used between IA32 and
15  * SCU where IPC-2 is used between P-Unit and SCU. This driver delas with
16  * IPC-1 Driver provides an API for power control unit registers (e.g. MSIC)
17  * along with other APIs.
18  */
19 #include <linux/delay.h>
20 #include <linux/errno.h>
21 #include <linux/init.h>
22 #include <linux/device.h>
23 #include <linux/pm.h>
24 #include <linux/pci.h>
25 #include <linux/interrupt.h>
26 #include <linux/sfi.h>
27 #include <linux/module.h>
28 #include <asm/intel-mid.h>
29 #include <asm/intel_scu_ipc.h>
30
31 /* IPC defines the following message types */
32 #define IPCMSG_WATCHDOG_TIMER 0xF8 /* Set Kernel Watchdog Threshold */
33 #define IPCMSG_BATTERY        0xEF /* Coulomb Counter Accumulator */
34 #define IPCMSG_FW_UPDATE      0xFE /* Firmware update */
35 #define IPCMSG_PCNTRL         0xFF /* Power controller unit read/write */
36 #define IPCMSG_FW_REVISION    0xF4 /* Get firmware revision */
37
38 /* Command id associated with message IPCMSG_PCNTRL */
39 #define IPC_CMD_PCNTRL_W      0 /* Register write */
40 #define IPC_CMD_PCNTRL_R      1 /* Register read */
41 #define IPC_CMD_PCNTRL_M      2 /* Register read-modify-write */
42
43 /*
44  * IPC register summary
45  *
46  * IPC register blocks are memory mapped at fixed address of PCI BAR 0.
47  * To read or write information to the SCU, driver writes to IPC-1 memory
48  * mapped registers. The following is the IPC mechanism
49  *
50  * 1. IA core cDMI interface claims this transaction and converts it to a
51  *    Transaction Layer Packet (TLP) message which is sent across the cDMI.
52  *
53  * 2. South Complex cDMI block receives this message and writes it to
54  *    the IPC-1 register block, causing an interrupt to the SCU
55  *
56  * 3. SCU firmware decodes this interrupt and IPC message and the appropriate
57  *    message handler is called within firmware.
58  */
59
60 #define IPC_WWBUF_SIZE    20            /* IPC Write buffer Size */
61 #define IPC_RWBUF_SIZE    20            /* IPC Read buffer Size */
62 #define IPC_IOC           0x100         /* IPC command register IOC bit */
63
64 #define PCI_DEVICE_ID_LINCROFT          0x082a
65 #define PCI_DEVICE_ID_PENWELL           0x080e
66 #define PCI_DEVICE_ID_CLOVERVIEW        0x08ea
67 #define PCI_DEVICE_ID_TANGIER           0x11a0
68
69 /* intel scu ipc driver data */
70 struct intel_scu_ipc_pdata_t {
71         u32 i2c_base;
72         u32 i2c_len;
73         u8 irq_mode;
74 };
75
76 static struct intel_scu_ipc_pdata_t intel_scu_ipc_lincroft_pdata = {
77         .i2c_base = 0xff12b000,
78         .i2c_len = 0x10,
79         .irq_mode = 0,
80 };
81
82 /* Penwell and Cloverview */
83 static struct intel_scu_ipc_pdata_t intel_scu_ipc_penwell_pdata = {
84         .i2c_base = 0xff12b000,
85         .i2c_len = 0x10,
86         .irq_mode = 1,
87 };
88
89 static struct intel_scu_ipc_pdata_t intel_scu_ipc_tangier_pdata = {
90         .i2c_base  = 0xff00d000,
91         .i2c_len = 0x10,
92         .irq_mode = 0,
93 };
94
95 static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id);
96 static void ipc_remove(struct pci_dev *pdev);
97
98 struct intel_scu_ipc_dev {
99         struct pci_dev *pdev;
100         void __iomem *ipc_base;
101         void __iomem *i2c_base;
102         struct completion cmd_complete;
103         u8 irq_mode;
104 };
105
106 static struct intel_scu_ipc_dev  ipcdev; /* Only one for now */
107
108 /*
109  * IPC Read Buffer (Read Only):
110  * 16 byte buffer for receiving data from SCU, if IPC command
111  * processing results in response data
112  */
113 #define IPC_READ_BUFFER         0x90
114
115 #define IPC_I2C_CNTRL_ADDR      0
116 #define I2C_DATA_ADDR           0x04
117
118 static DEFINE_MUTEX(ipclock); /* lock used to prevent multiple call to SCU */
119
120 /*
121  * Send ipc command
122  * Command Register (Write Only):
123  * A write to this register results in an interrupt to the SCU core processor
124  * Format:
125  * |rfu2(8) | size(8) | command id(4) | rfu1(3) | ioc(1) | command(8)|
126  */
127 static inline void ipc_command(struct intel_scu_ipc_dev *scu, u32 cmd)
128 {
129         if (scu->irq_mode) {
130                 reinit_completion(&scu->cmd_complete);
131                 writel(cmd | IPC_IOC, scu->ipc_base);
132         }
133         writel(cmd, scu->ipc_base);
134 }
135
136 /*
137  * Write ipc data
138  * IPC Write Buffer (Write Only):
139  * 16-byte buffer for sending data associated with IPC command to
140  * SCU. Size of the data is specified in the IPC_COMMAND_REG register
141  */
142 static inline void ipc_data_writel(struct intel_scu_ipc_dev *scu, u32 data, u32 offset)
143 {
144         writel(data, scu->ipc_base + 0x80 + offset);
145 }
146
147 /*
148  * Status Register (Read Only):
149  * Driver will read this register to get the ready/busy status of the IPC
150  * block and error status of the IPC command that was just processed by SCU
151  * Format:
152  * |rfu3(8)|error code(8)|initiator id(8)|cmd id(4)|rfu1(2)|error(1)|busy(1)|
153  */
154 static inline u8 ipc_read_status(struct intel_scu_ipc_dev *scu)
155 {
156         return __raw_readl(scu->ipc_base + 0x04);
157 }
158
159 /* Read ipc byte data */
160 static inline u8 ipc_data_readb(struct intel_scu_ipc_dev *scu, u32 offset)
161 {
162         return readb(scu->ipc_base + IPC_READ_BUFFER + offset);
163 }
164
165 /* Read ipc u32 data */
166 static inline u32 ipc_data_readl(struct intel_scu_ipc_dev *scu, u32 offset)
167 {
168         return readl(scu->ipc_base + IPC_READ_BUFFER + offset);
169 }
170
171 /* Wait till scu status is busy */
172 static inline int busy_loop(struct intel_scu_ipc_dev *scu)
173 {
174         u32 status = ipc_read_status(scu);
175         u32 loop_count = 100000;
176
177         /* break if scu doesn't reset busy bit after huge retry */
178         while ((status & BIT(0)) && --loop_count) {
179                 udelay(1); /* scu processing time is in few u secods */
180                 status = ipc_read_status(scu);
181         }
182
183         if (status & BIT(0)) {
184                 dev_err(&scu->pdev->dev, "IPC timed out");
185                 return -ETIMEDOUT;
186         }
187
188         if (status & BIT(1))
189                 return -EIO;
190
191         return 0;
192 }
193
194 /* Wait till ipc ioc interrupt is received or timeout in 3 HZ */
195 static inline int ipc_wait_for_interrupt(struct intel_scu_ipc_dev *scu)
196 {
197         int status;
198
199         if (!wait_for_completion_timeout(&scu->cmd_complete, 3 * HZ)) {
200                 struct device *dev = &scu->pdev->dev;
201                 dev_err(dev, "IPC timed out\n");
202                 return -ETIMEDOUT;
203         }
204
205         status = ipc_read_status(scu);
206         if (status & BIT(1))
207                 return -EIO;
208
209         return 0;
210 }
211
212 static int intel_scu_ipc_check_status(struct intel_scu_ipc_dev *scu)
213 {
214         return scu->irq_mode ? ipc_wait_for_interrupt(scu) : busy_loop(scu);
215 }
216
217 /* Read/Write power control(PMIC in Langwell, MSIC in PenWell) registers */
218 static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)
219 {
220         struct intel_scu_ipc_dev *scu = &ipcdev;
221         int nc;
222         u32 offset = 0;
223         int err;
224         u8 cbuf[IPC_WWBUF_SIZE];
225         u32 *wbuf = (u32 *)&cbuf;
226
227         memset(cbuf, 0, sizeof(cbuf));
228
229         mutex_lock(&ipclock);
230
231         if (scu->pdev == NULL) {
232                 mutex_unlock(&ipclock);
233                 return -ENODEV;
234         }
235
236         for (nc = 0; nc < count; nc++, offset += 2) {
237                 cbuf[offset] = addr[nc];
238                 cbuf[offset + 1] = addr[nc] >> 8;
239         }
240
241         if (id == IPC_CMD_PCNTRL_R) {
242                 for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
243                         ipc_data_writel(scu, wbuf[nc], offset);
244                 ipc_command(scu, (count * 2) << 16 | id << 12 | 0 << 8 | op);
245         } else if (id == IPC_CMD_PCNTRL_W) {
246                 for (nc = 0; nc < count; nc++, offset += 1)
247                         cbuf[offset] = data[nc];
248                 for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
249                         ipc_data_writel(scu, wbuf[nc], offset);
250                 ipc_command(scu, (count * 3) << 16 | id << 12 | 0 << 8 | op);
251         } else if (id == IPC_CMD_PCNTRL_M) {
252                 cbuf[offset] = data[0];
253                 cbuf[offset + 1] = data[1];
254                 ipc_data_writel(scu, wbuf[0], 0); /* Write wbuff */
255                 ipc_command(scu, 4 << 16 | id << 12 | 0 << 8 | op);
256         }
257
258         err = intel_scu_ipc_check_status(scu);
259         if (!err && id == IPC_CMD_PCNTRL_R) { /* Read rbuf */
260                 /* Workaround: values are read as 0 without memcpy_fromio */
261                 memcpy_fromio(cbuf, scu->ipc_base + 0x90, 16);
262                 for (nc = 0; nc < count; nc++)
263                         data[nc] = ipc_data_readb(scu, nc);
264         }
265         mutex_unlock(&ipclock);
266         return err;
267 }
268
269 /**
270  *      intel_scu_ipc_ioread8           -       read a word via the SCU
271  *      @addr: register on SCU
272  *      @data: return pointer for read byte
273  *
274  *      Read a single register. Returns 0 on success or an error code. All
275  *      locking between SCU accesses is handled for the caller.
276  *
277  *      This function may sleep.
278  */
279 int intel_scu_ipc_ioread8(u16 addr, u8 *data)
280 {
281         return pwr_reg_rdwr(&addr, data, 1, IPCMSG_PCNTRL, IPC_CMD_PCNTRL_R);
282 }
283 EXPORT_SYMBOL(intel_scu_ipc_ioread8);
284
285 /**
286  *      intel_scu_ipc_ioread16          -       read a word via the SCU
287  *      @addr: register on SCU
288  *      @data: return pointer for read word
289  *
290  *      Read a register pair. Returns 0 on success or an error code. All
291  *      locking between SCU accesses is handled for the caller.
292  *
293  *      This function may sleep.
294  */
295 int intel_scu_ipc_ioread16(u16 addr, u16 *data)
296 {
297         u16 x[2] = {addr, addr + 1};
298         return pwr_reg_rdwr(x, (u8 *)data, 2, IPCMSG_PCNTRL, IPC_CMD_PCNTRL_R);
299 }
300 EXPORT_SYMBOL(intel_scu_ipc_ioread16);
301
302 /**
303  *      intel_scu_ipc_ioread32          -       read a dword via the SCU
304  *      @addr: register on SCU
305  *      @data: return pointer for read dword
306  *
307  *      Read four registers. Returns 0 on success or an error code. All
308  *      locking between SCU accesses is handled for the caller.
309  *
310  *      This function may sleep.
311  */
312 int intel_scu_ipc_ioread32(u16 addr, u32 *data)
313 {
314         u16 x[4] = {addr, addr + 1, addr + 2, addr + 3};
315         return pwr_reg_rdwr(x, (u8 *)data, 4, IPCMSG_PCNTRL, IPC_CMD_PCNTRL_R);
316 }
317 EXPORT_SYMBOL(intel_scu_ipc_ioread32);
318
319 /**
320  *      intel_scu_ipc_iowrite8          -       write a byte via the SCU
321  *      @addr: register on SCU
322  *      @data: byte to write
323  *
324  *      Write a single register. Returns 0 on success or an error code. All
325  *      locking between SCU accesses is handled for the caller.
326  *
327  *      This function may sleep.
328  */
329 int intel_scu_ipc_iowrite8(u16 addr, u8 data)
330 {
331         return pwr_reg_rdwr(&addr, &data, 1, IPCMSG_PCNTRL, IPC_CMD_PCNTRL_W);
332 }
333 EXPORT_SYMBOL(intel_scu_ipc_iowrite8);
334
335 /**
336  *      intel_scu_ipc_iowrite16         -       write a word via the SCU
337  *      @addr: register on SCU
338  *      @data: word to write
339  *
340  *      Write two registers. Returns 0 on success or an error code. All
341  *      locking between SCU accesses is handled for the caller.
342  *
343  *      This function may sleep.
344  */
345 int intel_scu_ipc_iowrite16(u16 addr, u16 data)
346 {
347         u16 x[2] = {addr, addr + 1};
348         return pwr_reg_rdwr(x, (u8 *)&data, 2, IPCMSG_PCNTRL, IPC_CMD_PCNTRL_W);
349 }
350 EXPORT_SYMBOL(intel_scu_ipc_iowrite16);
351
352 /**
353  *      intel_scu_ipc_iowrite32         -       write a dword via the SCU
354  *      @addr: register on SCU
355  *      @data: dword to write
356  *
357  *      Write four registers. Returns 0 on success or an error code. All
358  *      locking between SCU accesses is handled for the caller.
359  *
360  *      This function may sleep.
361  */
362 int intel_scu_ipc_iowrite32(u16 addr, u32 data)
363 {
364         u16 x[4] = {addr, addr + 1, addr + 2, addr + 3};
365         return pwr_reg_rdwr(x, (u8 *)&data, 4, IPCMSG_PCNTRL, IPC_CMD_PCNTRL_W);
366 }
367 EXPORT_SYMBOL(intel_scu_ipc_iowrite32);
368
369 /**
370  *      intel_scu_ipc_readvv            -       read a set of registers
371  *      @addr: register list
372  *      @data: bytes to return
373  *      @len: length of array
374  *
375  *      Read registers. Returns 0 on success or an error code. All
376  *      locking between SCU accesses is handled for the caller.
377  *
378  *      The largest array length permitted by the hardware is 5 items.
379  *
380  *      This function may sleep.
381  */
382 int intel_scu_ipc_readv(u16 *addr, u8 *data, int len)
383 {
384         return pwr_reg_rdwr(addr, data, len, IPCMSG_PCNTRL, IPC_CMD_PCNTRL_R);
385 }
386 EXPORT_SYMBOL(intel_scu_ipc_readv);
387
388 /**
389  *      intel_scu_ipc_writev            -       write a set of registers
390  *      @addr: register list
391  *      @data: bytes to write
392  *      @len: length of array
393  *
394  *      Write registers. Returns 0 on success or an error code. All
395  *      locking between SCU accesses is handled for the caller.
396  *
397  *      The largest array length permitted by the hardware is 5 items.
398  *
399  *      This function may sleep.
400  *
401  */
402 int intel_scu_ipc_writev(u16 *addr, u8 *data, int len)
403 {
404         return pwr_reg_rdwr(addr, data, len, IPCMSG_PCNTRL, IPC_CMD_PCNTRL_W);
405 }
406 EXPORT_SYMBOL(intel_scu_ipc_writev);
407
408 /**
409  *      intel_scu_ipc_update_register   -       r/m/w a register
410  *      @addr: register address
411  *      @bits: bits to update
412  *      @mask: mask of bits to update
413  *
414  *      Read-modify-write power control unit register. The first data argument
415  *      must be register value and second is mask value
416  *      mask is a bitmap that indicates which bits to update.
417  *      0 = masked. Don't modify this bit, 1 = modify this bit.
418  *      returns 0 on success or an error code.
419  *
420  *      This function may sleep. Locking between SCU accesses is handled
421  *      for the caller.
422  */
423 int intel_scu_ipc_update_register(u16 addr, u8 bits, u8 mask)
424 {
425         u8 data[2] = { bits, mask };
426         return pwr_reg_rdwr(&addr, data, 1, IPCMSG_PCNTRL, IPC_CMD_PCNTRL_M);
427 }
428 EXPORT_SYMBOL(intel_scu_ipc_update_register);
429
430 /**
431  *      intel_scu_ipc_simple_command    -       send a simple command
432  *      @cmd: command
433  *      @sub: sub type
434  *
435  *      Issue a simple command to the SCU. Do not use this interface if
436  *      you must then access data as any data values may be overwritten
437  *      by another SCU access by the time this function returns.
438  *
439  *      This function may sleep. Locking for SCU accesses is handled for
440  *      the caller.
441  */
442 int intel_scu_ipc_simple_command(int cmd, int sub)
443 {
444         struct intel_scu_ipc_dev *scu = &ipcdev;
445         int err;
446
447         mutex_lock(&ipclock);
448         if (scu->pdev == NULL) {
449                 mutex_unlock(&ipclock);
450                 return -ENODEV;
451         }
452         ipc_command(scu, sub << 12 | cmd);
453         err = intel_scu_ipc_check_status(scu);
454         mutex_unlock(&ipclock);
455         return err;
456 }
457 EXPORT_SYMBOL(intel_scu_ipc_simple_command);
458
459 /**
460  *      intel_scu_ipc_command   -       command with data
461  *      @cmd: command
462  *      @sub: sub type
463  *      @in: input data
464  *      @inlen: input length in dwords
465  *      @out: output data
466  *      @outlein: output length in dwords
467  *
468  *      Issue a command to the SCU which involves data transfers. Do the
469  *      data copies under the lock but leave it for the caller to interpret
470  */
471 int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen,
472                           u32 *out, int outlen)
473 {
474         struct intel_scu_ipc_dev *scu = &ipcdev;
475         int i, err;
476
477         mutex_lock(&ipclock);
478         if (scu->pdev == NULL) {
479                 mutex_unlock(&ipclock);
480                 return -ENODEV;
481         }
482
483         for (i = 0; i < inlen; i++)
484                 ipc_data_writel(scu, *in++, 4 * i);
485
486         ipc_command(scu, (inlen << 16) | (sub << 12) | cmd);
487         err = intel_scu_ipc_check_status(scu);
488
489         if (!err) {
490                 for (i = 0; i < outlen; i++)
491                         *out++ = ipc_data_readl(scu, 4 * i);
492         }
493
494         mutex_unlock(&ipclock);
495         return err;
496 }
497 EXPORT_SYMBOL(intel_scu_ipc_command);
498
499 /* I2C commands */
500 #define IPC_I2C_WRITE 1 /* I2C Write command */
501 #define IPC_I2C_READ  2 /* I2C Read command */
502
503 /**
504  *      intel_scu_ipc_i2c_cntrl         -       I2C read/write operations
505  *      @addr: I2C address + command bits
506  *      @data: data to read/write
507  *
508  *      Perform an an I2C read/write operation via the SCU. All locking is
509  *      handled for the caller. This function may sleep.
510  *
511  *      Returns an error code or 0 on success.
512  *
513  *      This has to be in the IPC driver for the locking.
514  */
515 int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data)
516 {
517         struct intel_scu_ipc_dev *scu = &ipcdev;
518         u32 cmd = 0;
519
520         mutex_lock(&ipclock);
521         if (scu->pdev == NULL) {
522                 mutex_unlock(&ipclock);
523                 return -ENODEV;
524         }
525         cmd = (addr >> 24) & 0xFF;
526         if (cmd == IPC_I2C_READ) {
527                 writel(addr, scu->i2c_base + IPC_I2C_CNTRL_ADDR);
528                 /* Write not getting updated without delay */
529                 mdelay(1);
530                 *data = readl(scu->i2c_base + I2C_DATA_ADDR);
531         } else if (cmd == IPC_I2C_WRITE) {
532                 writel(*data, scu->i2c_base + I2C_DATA_ADDR);
533                 mdelay(1);
534                 writel(addr, scu->i2c_base + IPC_I2C_CNTRL_ADDR);
535         } else {
536                 dev_err(&scu->pdev->dev,
537                         "intel_scu_ipc: I2C INVALID_CMD = 0x%x\n", cmd);
538
539                 mutex_unlock(&ipclock);
540                 return -EIO;
541         }
542         mutex_unlock(&ipclock);
543         return 0;
544 }
545 EXPORT_SYMBOL(intel_scu_ipc_i2c_cntrl);
546
547 /*
548  * Interrupt handler gets called when ioc bit of IPC_COMMAND_REG set to 1
549  * When ioc bit is set to 1, caller api must wait for interrupt handler called
550  * which in turn unlocks the caller api. Currently this is not used
551  *
552  * This is edge triggered so we need take no action to clear anything
553  */
554 static irqreturn_t ioc(int irq, void *dev_id)
555 {
556         struct intel_scu_ipc_dev *scu = dev_id;
557
558         if (scu->irq_mode)
559                 complete(&scu->cmd_complete);
560
561         return IRQ_HANDLED;
562 }
563
564 /**
565  *      ipc_probe       -       probe an Intel SCU IPC
566  *      @dev: the PCI device matching
567  *      @id: entry in the match table
568  *
569  *      Enable and install an intel SCU IPC. This appears in the PCI space
570  *      but uses some hard coded addresses as well.
571  */
572 static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
573 {
574         int err;
575         struct intel_scu_ipc_dev *scu = &ipcdev;
576         struct intel_scu_ipc_pdata_t *pdata;
577
578         if (scu->pdev)          /* We support only one SCU */
579                 return -EBUSY;
580
581         pdata = (struct intel_scu_ipc_pdata_t *)id->driver_data;
582
583         scu->pdev = pci_dev_get(dev);
584         scu->irq_mode = pdata->irq_mode;
585
586         err = pcim_enable_device(dev);
587         if (err)
588                 return err;
589
590         err = pcim_iomap_regions(dev, 1 << 0, pci_name(dev));
591         if (err)
592                 return err;
593
594         init_completion(&scu->cmd_complete);
595
596         err = devm_request_irq(&dev->dev, dev->irq, ioc, 0, "intel_scu_ipc",
597                                scu);
598         if (err)
599                 return err;
600
601         scu->ipc_base = pcim_iomap_table(dev)[0];
602
603         scu->i2c_base = ioremap_nocache(pdata->i2c_base, pdata->i2c_len);
604         if (!scu->i2c_base)
605                 return -ENOMEM;
606
607         intel_scu_devices_create();
608
609         pci_set_drvdata(dev, scu);
610         return 0;
611 }
612
613 /**
614  *      ipc_remove      -       remove a bound IPC device
615  *      @pdev: PCI device
616  *
617  *      In practice the SCU is not removable but this function is also
618  *      called for each device on a module unload or cleanup which is the
619  *      path that will get used.
620  *
621  *      Free up the mappings and release the PCI resources
622  */
623 static void ipc_remove(struct pci_dev *pdev)
624 {
625         struct intel_scu_ipc_dev *scu = pci_get_drvdata(pdev);
626
627         pci_dev_put(scu->pdev);
628         scu->pdev = NULL;
629         iounmap(scu->i2c_base);
630         intel_scu_devices_destroy();
631 }
632
633 static const struct pci_device_id pci_ids[] = {
634         {
635                 PCI_VDEVICE(INTEL, PCI_DEVICE_ID_LINCROFT),
636                 (kernel_ulong_t)&intel_scu_ipc_lincroft_pdata,
637         }, {
638                 PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL),
639                 (kernel_ulong_t)&intel_scu_ipc_penwell_pdata,
640         }, {
641                 PCI_VDEVICE(INTEL, PCI_DEVICE_ID_CLOVERVIEW),
642                 (kernel_ulong_t)&intel_scu_ipc_penwell_pdata,
643         }, {
644                 PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER),
645                 (kernel_ulong_t)&intel_scu_ipc_tangier_pdata,
646         }, {
647                 0,
648         }
649 };
650 MODULE_DEVICE_TABLE(pci, pci_ids);
651
652 static struct pci_driver ipc_driver = {
653         .name = "intel_scu_ipc",
654         .id_table = pci_ids,
655         .probe = ipc_probe,
656         .remove = ipc_remove,
657 };
658
659 static int __init intel_scu_ipc_init(void)
660 {
661         int platform;           /* Platform type */
662
663         platform = intel_mid_identify_cpu();
664         if (platform == 0)
665                 return -ENODEV;
666         return  pci_register_driver(&ipc_driver);
667 }
668
669 static void __exit intel_scu_ipc_exit(void)
670 {
671         pci_unregister_driver(&ipc_driver);
672 }
673
674 MODULE_AUTHOR("Sreedhara DS <sreedhara.ds@intel.com>");
675 MODULE_DESCRIPTION("Intel SCU IPC driver");
676 MODULE_LICENSE("GPL");
677
678 module_init(intel_scu_ipc_init);
679 module_exit(intel_scu_ipc_exit);