|
82 | 82 |
|
83 | 83 | #define ISMT_DESC_ENTRIES 2 /* number of descriptor entries */
|
84 | 84 | #define ISMT_MAX_RETRIES 3 /* number of SMBus retries to attempt */
|
| 85 | +#define ISMT_LOG_ENTRIES 3 /* number of interrupt cause log entries */ |
85 | 86 |
|
86 | 87 | /* Hardware Descriptor Constants - Control Field */
|
87 | 88 | #define ISMT_DESC_CWRL 0x01 /* Command/Write Length */
|
@@ -175,6 +176,8 @@ struct ismt_priv {
|
175 | 176 | u8 head; /* ring buffer head pointer */
|
176 | 177 | struct completion cmp; /* interrupt completion */
|
177 | 178 | u8 buffer[I2C_SMBUS_BLOCK_MAX + 16]; /* temp R/W data buffer */
|
| 179 | + dma_addr_t log_dma; |
| 180 | + u32 *log; |
178 | 181 | };
|
179 | 182 |
|
180 | 183 | static const struct pci_device_id ismt_ids[] = {
|
@@ -411,6 +414,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
|
411 | 414 | memset(desc, 0, sizeof(struct ismt_desc));
|
412 | 415 | desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, read_write);
|
413 | 416 |
|
| 417 | + /* Always clear the log entries */ |
| 418 | + memset(priv->log, 0, ISMT_LOG_ENTRIES * sizeof(u32)); |
| 419 | + |
414 | 420 | /* Initialize common control bits */
|
415 | 421 | if (likely(pci_dev_msi_enabled(priv->pci_dev)))
|
416 | 422 | desc->control = ISMT_DESC_INT | ISMT_DESC_FAIR;
|
@@ -708,6 +714,8 @@ static void ismt_hw_init(struct ismt_priv *priv)
|
708 | 714 | /* initialize the Master Descriptor Base Address (MDBA) */
|
709 | 715 | writeq(priv->io_rng_dma, priv->smba + ISMT_MSTR_MDBA);
|
710 | 716 |
|
| 717 | + writeq(priv->log_dma, priv->smba + ISMT_GR_SMTICL); |
| 718 | + |
711 | 719 | /* initialize the Master Control Register (MCTRL) */
|
712 | 720 | writel(ISMT_MCTRL_MEIE, priv->smba + ISMT_MSTR_MCTRL);
|
713 | 721 |
|
@@ -795,6 +803,12 @@ static int ismt_dev_init(struct ismt_priv *priv)
|
795 | 803 | priv->head = 0;
|
796 | 804 | init_completion(&priv->cmp);
|
797 | 805 |
|
| 806 | + priv->log = dmam_alloc_coherent(&priv->pci_dev->dev, |
| 807 | + ISMT_LOG_ENTRIES * sizeof(u32), |
| 808 | + &priv->log_dma, GFP_KERNEL); |
| 809 | + if (!priv->log) |
| 810 | + return -ENOMEM; |
| 811 | + |
798 | 812 | return 0;
|
799 | 813 | }
|
800 | 814 |
|
|
0 commit comments