Skip to content

Commit 74e9748

Browse files
westeriandy-shev
authored andcommitted
platform/x86: intel_scu_ipc: Drop intel_scu_ipc_i2c_cntrl()
There are no existing users for this functionality so drop it from the driver completely. This also means we don't need to keep the struct intel_scu_ipc_pdata_t around anymore so remove that as well. Signed-off-by: Mika Westerberg <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent b47018a commit 74e9748

File tree

2 files changed

+3
-90
lines changed

2 files changed

+3
-90
lines changed

arch/x86/include/asm/intel_scu_ipc.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen,
5353
int intel_scu_ipc_raw_command(int cmd, int sub, u8 *in, int inlen,
5454
u32 *out, int outlen, u32 dptr, u32 sptr);
5555

56-
/* I2C control api */
57-
int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data);
58-
5956
/* Update FW version */
6057
int intel_scu_ipc_fw_update(u8 *buffer, u32 length);
6158

drivers/platform/x86/intel_scu_ipc.c

Lines changed: 3 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,9 @@
5858
#define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */
5959
#define IPC_IOC 0x100 /* IPC command register IOC bit */
6060

61-
#define PCI_DEVICE_ID_PENWELL 0x080e
62-
#define PCI_DEVICE_ID_CLOVERVIEW 0x08ea
63-
#define PCI_DEVICE_ID_TANGIER 0x11a0
64-
65-
/* intel scu ipc driver data */
66-
struct intel_scu_ipc_pdata_t {
67-
u32 i2c_base;
68-
u32 i2c_len;
69-
};
70-
71-
/* Penwell and Cloverview */
72-
static const struct intel_scu_ipc_pdata_t intel_scu_ipc_penwell_pdata = {
73-
.i2c_base = 0xff12b000,
74-
.i2c_len = 0x10,
75-
};
76-
77-
static const struct intel_scu_ipc_pdata_t intel_scu_ipc_tangier_pdata = {
78-
.i2c_base = 0xff00d000,
79-
.i2c_len = 0x10,
80-
};
81-
8261
struct intel_scu_ipc_dev {
8362
struct device *dev;
8463
void __iomem *ipc_base;
85-
void __iomem *i2c_base;
8664
struct completion cmd_complete;
8765
u8 irq_mode;
8866
};
@@ -101,9 +79,6 @@ static struct intel_scu_ipc_dev ipcdev; /* Only one for now */
10179
#define IPC_WRITE_BUFFER 0x80
10280
#define IPC_READ_BUFFER 0x90
10381

104-
#define IPC_I2C_CNTRL_ADDR 0
105-
#define I2C_DATA_ADDR 0x04
106-
10782
static DEFINE_MUTEX(ipclock); /* lock used to prevent multiple call to SCU */
10883

10984
/*
@@ -544,54 +519,6 @@ int intel_scu_ipc_raw_command(int cmd, int sub, u8 *in, int inlen,
544519
}
545520
EXPORT_SYMBOL_GPL(intel_scu_ipc_raw_command);
546521

547-
/* I2C commands */
548-
#define IPC_I2C_WRITE 1 /* I2C Write command */
549-
#define IPC_I2C_READ 2 /* I2C Read command */
550-
551-
/**
552-
* intel_scu_ipc_i2c_cntrl - I2C read/write operations
553-
* @addr: I2C address + command bits
554-
* @data: data to read/write
555-
*
556-
* Perform an an I2C read/write operation via the SCU. All locking is
557-
* handled for the caller. This function may sleep.
558-
*
559-
* Returns an error code or 0 on success.
560-
*
561-
* This has to be in the IPC driver for the locking.
562-
*/
563-
int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data)
564-
{
565-
struct intel_scu_ipc_dev *scu = &ipcdev;
566-
u32 cmd = 0;
567-
568-
mutex_lock(&ipclock);
569-
if (scu->dev == NULL) {
570-
mutex_unlock(&ipclock);
571-
return -ENODEV;
572-
}
573-
cmd = (addr >> 24) & 0xFF;
574-
if (cmd == IPC_I2C_READ) {
575-
writel(addr, scu->i2c_base + IPC_I2C_CNTRL_ADDR);
576-
/* Write not getting updated without delay */
577-
usleep_range(1000, 2000);
578-
*data = readl(scu->i2c_base + I2C_DATA_ADDR);
579-
} else if (cmd == IPC_I2C_WRITE) {
580-
writel(*data, scu->i2c_base + I2C_DATA_ADDR);
581-
usleep_range(1000, 2000);
582-
writel(addr, scu->i2c_base + IPC_I2C_CNTRL_ADDR);
583-
} else {
584-
dev_err(scu->dev,
585-
"intel_scu_ipc: I2C INVALID_CMD = 0x%x\n", cmd);
586-
587-
mutex_unlock(&ipclock);
588-
return -EIO;
589-
}
590-
mutex_unlock(&ipclock);
591-
return 0;
592-
}
593-
EXPORT_SYMBOL(intel_scu_ipc_i2c_cntrl);
594-
595522
/*
596523
* Interrupt handler gets called when ioc bit of IPC_COMMAND_REG set to 1
597524
* When ioc bit is set to 1, caller api must wait for interrupt handler called
@@ -622,15 +549,10 @@ static int ipc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
622549
{
623550
int err;
624551
struct intel_scu_ipc_dev *scu = &ipcdev;
625-
struct intel_scu_ipc_pdata_t *pdata;
626552

627553
if (scu->dev) /* We support only one SCU */
628554
return -EBUSY;
629555

630-
pdata = (struct intel_scu_ipc_pdata_t *)id->driver_data;
631-
if (!pdata)
632-
return -ENODEV;
633-
634556
err = pcim_enable_device(pdev);
635557
if (err)
636558
return err;
@@ -643,10 +565,6 @@ static int ipc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
643565

644566
scu->ipc_base = pcim_iomap_table(pdev)[0];
645567

646-
scu->i2c_base = ioremap_nocache(pdata->i2c_base, pdata->i2c_len);
647-
if (!scu->i2c_base)
648-
return -ENOMEM;
649-
650568
err = devm_request_irq(&pdev->dev, pdev->irq, ioc, 0, "intel_scu_ipc",
651569
scu);
652570
if (err)
@@ -661,12 +579,10 @@ static int ipc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
661579
return 0;
662580
}
663581

664-
#define SCU_DEVICE(id, pdata) {PCI_VDEVICE(INTEL, id), (kernel_ulong_t)&pdata}
665-
666582
static const struct pci_device_id pci_ids[] = {
667-
SCU_DEVICE(PCI_DEVICE_ID_PENWELL, intel_scu_ipc_penwell_pdata),
668-
SCU_DEVICE(PCI_DEVICE_ID_CLOVERVIEW, intel_scu_ipc_penwell_pdata),
669-
SCU_DEVICE(PCI_DEVICE_ID_TANGIER, intel_scu_ipc_tangier_pdata),
583+
{ PCI_VDEVICE(INTEL, 0x080e) },
584+
{ PCI_VDEVICE(INTEL, 0x08ea) },
585+
{ PCI_VDEVICE(INTEL, 0x11a0) },
670586
{}
671587
};
672588

0 commit comments

Comments
 (0)