|
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[] = { |
@@ -409,6 +412,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, |
409 | 412 | memset(desc, 0, sizeof(struct ismt_desc)); |
410 | 413 | desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, read_write); |
411 | 414 |
|
| 415 | + /* Always clear the log entries */ |
| 416 | + memset(priv->log, 0, ISMT_LOG_ENTRIES * sizeof(u32)); |
| 417 | + |
412 | 418 | /* Initialize common control bits */ |
413 | 419 | if (likely(pci_dev_msi_enabled(priv->pci_dev))) |
414 | 420 | desc->control = ISMT_DESC_INT | ISMT_DESC_FAIR; |
@@ -693,6 +699,8 @@ static void ismt_hw_init(struct ismt_priv *priv) |
693 | 699 | /* initialize the Master Descriptor Base Address (MDBA) */ |
694 | 700 | writeq(priv->io_rng_dma, priv->smba + ISMT_MSTR_MDBA); |
695 | 701 |
|
| 702 | + writeq(priv->log_dma, priv->smba + ISMT_GR_SMTICL); |
| 703 | + |
696 | 704 | /* initialize the Master Control Register (MCTRL) */ |
697 | 705 | writel(ISMT_MCTRL_MEIE, priv->smba + ISMT_MSTR_MCTRL); |
698 | 706 |
|
@@ -780,6 +788,12 @@ static int ismt_dev_init(struct ismt_priv *priv) |
780 | 788 | priv->head = 0; |
781 | 789 | init_completion(&priv->cmp); |
782 | 790 |
|
| 791 | + priv->log = dmam_alloc_coherent(&priv->pci_dev->dev, |
| 792 | + ISMT_LOG_ENTRIES * sizeof(u32), |
| 793 | + &priv->log_dma, GFP_KERNEL); |
| 794 | + if (!priv->log) |
| 795 | + return -ENOMEM; |
| 796 | + |
783 | 797 | return 0; |
784 | 798 | } |
785 | 799 |
|
|
0 commit comments