intel_scu_ipc.c 17 KB

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