* [PATCH v2 1/5] i2c: designware: Use devm_platform_ioremap_resource() to simplify code
@ 2020-04-25 13:44 Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 2/5] i2c: designware: Move configuration routines to respective modules Andy Shevchenko
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Andy Shevchenko @ 2020-04-25 13:44 UTC (permalink / raw)
To: Jarkko Nikula, Mika Westerberg, linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko
Use devm_platform_ioremap_resource() instead of
platform_get_resource() + devm_ioremap_resource().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new patch
drivers/i2c/busses/i2c-designware-platdrv.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index c429d664f6555..5b090480aa03e 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -157,12 +157,10 @@ static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev)
static int dw_i2c_of_configure(struct platform_device *pdev)
{
struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
- struct resource *mem;
switch (dev->flags & MODEL_MASK) {
case MODEL_MSCC_OCELOT:
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- dev->ext = devm_ioremap_resource(&pdev->dev, mem);
+ dev->ext = devm_platform_ioremap_resource(pdev, 1);
if (!IS_ERR(dev->ext))
dev->set_sda_hold_time = mscc_twi_set_sda_hold_time;
break;
@@ -241,7 +239,6 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
struct dw_i2c_dev *dev;
struct i2c_timings *t;
u32 acpi_speed;
- struct resource *mem;
int i, irq, ret;
irq = platform_get_irq(pdev, 0);
@@ -252,8 +249,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
if (!dev)
return -ENOMEM;
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- dev->base = devm_ioremap_resource(&pdev->dev, mem);
+ dev->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(dev->base))
return PTR_ERR(dev->base);
--
2.26.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/5] i2c: designware: Move configuration routines to respective modules
2020-04-25 13:44 [PATCH v2 1/5] i2c: designware: Use devm_platform_ioremap_resource() to simplify code Andy Shevchenko
@ 2020-04-25 13:44 ` Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 3/5] i2c: designware: Switch PCI driver to use i2c_dw_configure_master() Andy Shevchenko
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2020-04-25 13:44 UTC (permalink / raw)
To: Jarkko Nikula, Mika Westerberg, linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko
Move configuration routines to respective modules, i.e. master and slave.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
drivers/i2c/busses/i2c-designware-core.h | 12 +++++++
drivers/i2c/busses/i2c-designware-master.c | 24 +++++++++++++
drivers/i2c/busses/i2c-designware-platdrv.c | 38 +--------------------
drivers/i2c/busses/i2c-designware-slave.c | 11 ++++++
4 files changed, 48 insertions(+), 37 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index b220ad64c38d7..b2f894f685233 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -314,13 +314,25 @@ static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev)
void __i2c_dw_disable(struct dw_i2c_dev *dev);
+extern void i2c_dw_configure_master(struct dw_i2c_dev *dev);
extern int i2c_dw_probe(struct dw_i2c_dev *dev);
+
#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_SLAVE)
+extern void i2c_dw_configure_slave(struct dw_i2c_dev *dev);
extern int i2c_dw_probe_slave(struct dw_i2c_dev *dev);
#else
+static inline void i2c_dw_configure_slave(struct dw_i2c_dev *dev) { }
static inline int i2c_dw_probe_slave(struct dw_i2c_dev *dev) { return -EINVAL; }
#endif
+static inline void i2c_dw_configure(struct dw_i2c_dev *dev)
+{
+ if (i2c_detect_slave_mode(dev->dev))
+ i2c_dw_configure_slave(dev);
+ else
+ i2c_dw_configure_master(dev);
+}
+
#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_BAYTRAIL)
extern int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev);
#else
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index b6c17b550d31e..139ba98c40331 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -657,6 +657,30 @@ static irqreturn_t i2c_dw_isr(int this_irq, void *dev_id)
return IRQ_HANDLED;
}
+void i2c_dw_configure_master(struct dw_i2c_dev *dev)
+{
+ struct i2c_timings *t = &dev->timings;
+
+ dev->functionality = I2C_FUNC_10BIT_ADDR | DW_IC_DEFAULT_FUNCTIONALITY;
+
+ dev->master_cfg = DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE |
+ DW_IC_CON_RESTART_EN;
+
+ dev->mode = DW_IC_MASTER;
+
+ switch (t->bus_freq_hz) {
+ case I2C_MAX_STANDARD_MODE_FREQ:
+ dev->master_cfg |= DW_IC_CON_SPEED_STD;
+ break;
+ case I2C_MAX_HIGH_SPEED_MODE_FREQ:
+ dev->master_cfg |= DW_IC_CON_SPEED_HIGH;
+ break;
+ default:
+ dev->master_cfg |= DW_IC_CON_SPEED_FAST;
+ }
+}
+EXPORT_SYMBOL_GPL(i2c_dw_configure_master);
+
static void i2c_dw_prepare_recovery(struct i2c_adapter *adap)
{
struct dw_i2c_dev *dev = i2c_get_adapdata(adap);
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 5b090480aa03e..108b7d9d78bb5 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -184,39 +184,6 @@ static inline int dw_i2c_of_configure(struct platform_device *pdev)
}
#endif
-static void i2c_dw_configure_master(struct dw_i2c_dev *dev)
-{
- struct i2c_timings *t = &dev->timings;
-
- dev->functionality = I2C_FUNC_10BIT_ADDR | DW_IC_DEFAULT_FUNCTIONALITY;
-
- dev->master_cfg = DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE |
- DW_IC_CON_RESTART_EN;
-
- dev->mode = DW_IC_MASTER;
-
- switch (t->bus_freq_hz) {
- case I2C_MAX_STANDARD_MODE_FREQ:
- dev->master_cfg |= DW_IC_CON_SPEED_STD;
- break;
- case I2C_MAX_HIGH_SPEED_MODE_FREQ:
- dev->master_cfg |= DW_IC_CON_SPEED_HIGH;
- break;
- default:
- dev->master_cfg |= DW_IC_CON_SPEED_FAST;
- }
-}
-
-static void i2c_dw_configure_slave(struct dw_i2c_dev *dev)
-{
- dev->functionality = I2C_FUNC_SLAVE | DW_IC_DEFAULT_FUNCTIONALITY;
-
- dev->slave_cfg = DW_IC_CON_RX_FIFO_FULL_HLD_CTRL |
- DW_IC_CON_RESTART_EN | DW_IC_CON_STOP_DET_IFADDRESSED;
-
- dev->mode = DW_IC_SLAVE;
-}
-
static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev)
{
pm_runtime_disable(dev->dev);
@@ -319,10 +286,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
if (ret)
goto exit_reset;
- if (i2c_detect_slave_mode(&pdev->dev))
- i2c_dw_configure_slave(dev);
- else
- i2c_dw_configure_master(dev);
+ i2c_dw_configure(dev);
/* Optional interface clock */
dev->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c
index f5ecf76c0d024..576e7af4e94be 100644
--- a/drivers/i2c/busses/i2c-designware-slave.c
+++ b/drivers/i2c/busses/i2c-designware-slave.c
@@ -241,6 +241,17 @@ static const struct i2c_algorithm i2c_dw_algo = {
.unreg_slave = i2c_dw_unreg_slave,
};
+void i2c_dw_configure_slave(struct dw_i2c_dev *dev)
+{
+ dev->functionality = I2C_FUNC_SLAVE | DW_IC_DEFAULT_FUNCTIONALITY;
+
+ dev->slave_cfg = DW_IC_CON_RX_FIFO_FULL_HLD_CTRL |
+ DW_IC_CON_RESTART_EN | DW_IC_CON_STOP_DET_IFADDRESSED;
+
+ dev->mode = DW_IC_SLAVE;
+}
+EXPORT_SYMBOL_GPL(i2c_dw_configure_slave);
+
int i2c_dw_probe_slave(struct dw_i2c_dev *dev)
{
struct i2c_adapter *adap = &dev->adapter;
--
2.26.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/5] i2c: designware: Switch PCI driver to use i2c_dw_configure_master()
2020-04-25 13:44 [PATCH v2 1/5] i2c: designware: Use devm_platform_ioremap_resource() to simplify code Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 2/5] i2c: designware: Move configuration routines to respective modules Andy Shevchenko
@ 2020-04-25 13:44 ` Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 4/5] i2c: designware: Rename i2c_dw_probe() to i2c_dw_probe_master() Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 5/5] i2c: designware: Allow slave mode for PCI enumerated devices Andy Shevchenko
3 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2020-04-25 13:44 UTC (permalink / raw)
To: Jarkko Nikula, Mika Westerberg, linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko
Since we have available helper to configure master mode, let's use it
in the PCI driver instead of spread open-coded variant.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new patch
drivers/i2c/busses/i2c-designware-pcidrv.c | 33 +++++-----------------
1 file changed, 7 insertions(+), 26 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 7a0b65b5b5b59..d5e5abc03683f 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -46,20 +46,14 @@ struct dw_scl_sda_cfg {
struct dw_pci_controller {
u32 bus_num;
- u32 bus_cfg;
u32 tx_fifo_depth;
u32 rx_fifo_depth;
u32 clk_khz;
- u32 functionality;
u32 flags;
struct dw_scl_sda_cfg *scl_sda_cfg;
int (*setup)(struct pci_dev *pdev, struct dw_pci_controller *c);
};
-#define INTEL_MID_STD_CFG (DW_IC_CON_MASTER | \
- DW_IC_CON_SLAVE_DISABLE | \
- DW_IC_CON_RESTART_EN)
-
/* Merrifield HCNT/LCNT/SDA hold time */
static struct dw_scl_sda_cfg mrfld_config = {
.ss_hcnt = 0x2f8,
@@ -88,10 +82,11 @@ static struct dw_scl_sda_cfg hsw_config = {
static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c)
{
+ struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev);
+
switch (pdev->device) {
case 0x0817:
- c->bus_cfg &= ~DW_IC_CON_SPEED_MASK;
- c->bus_cfg |= DW_IC_CON_SPEED_STD;
+ dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ;
/* fall through */
case 0x0818:
case 0x0819:
@@ -128,53 +123,41 @@ static int mrfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c)
static struct dw_pci_controller dw_pci_controllers[] = {
[medfield] = {
.bus_num = -1,
- .bus_cfg = INTEL_MID_STD_CFG | DW_IC_CON_SPEED_FAST,
.tx_fifo_depth = 32,
.rx_fifo_depth = 32,
- .functionality = I2C_FUNC_10BIT_ADDR,
.clk_khz = 25000,
.setup = mfld_setup,
},
[merrifield] = {
.bus_num = -1,
- .bus_cfg = INTEL_MID_STD_CFG | DW_IC_CON_SPEED_FAST,
.tx_fifo_depth = 64,
.rx_fifo_depth = 64,
- .functionality = I2C_FUNC_10BIT_ADDR,
.scl_sda_cfg = &mrfld_config,
.setup = mrfld_setup,
},
[baytrail] = {
.bus_num = -1,
- .bus_cfg = INTEL_MID_STD_CFG | DW_IC_CON_SPEED_FAST,
.tx_fifo_depth = 32,
.rx_fifo_depth = 32,
- .functionality = I2C_FUNC_10BIT_ADDR,
.scl_sda_cfg = &byt_config,
},
[haswell] = {
.bus_num = -1,
- .bus_cfg = INTEL_MID_STD_CFG | DW_IC_CON_SPEED_FAST,
.tx_fifo_depth = 32,
.rx_fifo_depth = 32,
- .functionality = I2C_FUNC_10BIT_ADDR,
.scl_sda_cfg = &hsw_config,
},
[cherrytrail] = {
.bus_num = -1,
- .bus_cfg = INTEL_MID_STD_CFG | DW_IC_CON_SPEED_FAST,
.tx_fifo_depth = 32,
.rx_fifo_depth = 32,
- .functionality = I2C_FUNC_10BIT_ADDR,
.flags = MODEL_CHERRYTRAIL,
.scl_sda_cfg = &byt_config,
},
[elkhartlake] = {
.bus_num = -1,
- .bus_cfg = INTEL_MID_STD_CFG | DW_IC_CON_SPEED_FAST,
.tx_fifo_depth = 32,
.rx_fifo_depth = 32,
- .functionality = I2C_FUNC_10BIT_ADDR,
.clk_khz = 100000,
},
};
@@ -250,14 +233,16 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
if (r < 0)
return r;
- dev->clk = NULL;
dev->controller = controller;
dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
+ dev->timings.bus_freq_hz = I2C_MAX_FAST_MODE_FREQ;
dev->base = pcim_iomap_table(pdev)[0];
dev->dev = &pdev->dev;
dev->irq = pci_irq_vector(pdev, 0);
dev->flags |= controller->flags;
+ pci_set_drvdata(pdev, dev);
+
if (controller->setup) {
r = controller->setup(pdev, controller);
if (r) {
@@ -266,10 +251,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
}
}
- dev->functionality = controller->functionality |
- DW_IC_DEFAULT_FUNCTIONALITY;
+ i2c_dw_configure_master(dev);
- dev->master_cfg = controller->bus_cfg;
if (controller->scl_sda_cfg) {
cfg = controller->scl_sda_cfg;
dev->ss_hcnt = cfg->ss_hcnt;
@@ -279,8 +262,6 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
dev->sda_hold_time = cfg->sda_hold;
}
- pci_set_drvdata(pdev, dev);
-
dev->tx_fifo_depth = controller->tx_fifo_depth;
dev->rx_fifo_depth = controller->rx_fifo_depth;
--
2.26.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/5] i2c: designware: Rename i2c_dw_probe() to i2c_dw_probe_master()
2020-04-25 13:44 [PATCH v2 1/5] i2c: designware: Use devm_platform_ioremap_resource() to simplify code Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 2/5] i2c: designware: Move configuration routines to respective modules Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 3/5] i2c: designware: Switch PCI driver to use i2c_dw_configure_master() Andy Shevchenko
@ 2020-04-25 13:44 ` Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 5/5] i2c: designware: Allow slave mode for PCI enumerated devices Andy Shevchenko
3 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2020-04-25 13:44 UTC (permalink / raw)
To: Jarkko Nikula, Mika Westerberg, linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko
As a preparatory patch to support slave mode for PCI enumerated devices rename
i2c_dw_probe() to i2c_dw_probe_master() and split common i2c_dw_probe() as
inline helper.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: drop MASTER module optional choice (Jarkko, Wolfram)
drivers/i2c/busses/Makefile | 3 ++-
drivers/i2c/busses/i2c-designware-core.h | 15 ++++++++++++++-
drivers/i2c/busses/i2c-designware-master.c | 4 ++--
drivers/i2c/busses/i2c-designware-pcidrv.c | 2 +-
drivers/i2c/busses/i2c-designware-platdrv.c | 6 +-----
5 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index c852d27370377..d5f56e6179a4b 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -49,7 +49,8 @@ obj-$(CONFIG_I2C_CBUS_GPIO) += i2c-cbus-gpio.o
obj-$(CONFIG_I2C_CPM) += i2c-cpm.o
obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o
obj-$(CONFIG_I2C_DESIGNWARE_CORE) += i2c-designware-core.o
-i2c-designware-core-objs := i2c-designware-common.o i2c-designware-master.o
+i2c-designware-core-objs := i2c-designware-common.o
+i2c-designware-core-objs += i2c-designware-master.o
ifeq ($(CONFIG_I2C_DESIGNWARE_SLAVE),y)
i2c-designware-core-objs += i2c-designware-slave.o
endif
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index b2f894f685233..1674caf277451 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -315,7 +315,7 @@ static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev)
void __i2c_dw_disable(struct dw_i2c_dev *dev);
extern void i2c_dw_configure_master(struct dw_i2c_dev *dev);
-extern int i2c_dw_probe(struct dw_i2c_dev *dev);
+extern int i2c_dw_probe_master(struct dw_i2c_dev *dev);
#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_SLAVE)
extern void i2c_dw_configure_slave(struct dw_i2c_dev *dev);
@@ -325,6 +325,19 @@ static inline void i2c_dw_configure_slave(struct dw_i2c_dev *dev) { }
static inline int i2c_dw_probe_slave(struct dw_i2c_dev *dev) { return -EINVAL; }
#endif
+static inline int i2c_dw_probe(struct dw_i2c_dev *dev)
+{
+ switch (dev->mode) {
+ case DW_IC_SLAVE:
+ return i2c_dw_probe_slave(dev);
+ case DW_IC_MASTER:
+ return i2c_dw_probe_master(dev);
+ default:
+ dev_err(dev->dev, "Wrong operation mode: %d\n", dev->mode);
+ return -EINVAL;
+ }
+}
+
static inline void i2c_dw_configure(struct dw_i2c_dev *dev)
{
if (i2c_detect_slave_mode(dev->dev))
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index 139ba98c40331..95eeec53c744f 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -727,7 +727,7 @@ static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev)
return 0;
}
-int i2c_dw_probe(struct dw_i2c_dev *dev)
+int i2c_dw_probe_master(struct dw_i2c_dev *dev)
{
struct i2c_adapter *adap = &dev->adapter;
unsigned long irq_flags;
@@ -794,7 +794,7 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
return ret;
}
-EXPORT_SYMBOL_GPL(i2c_dw_probe);
+EXPORT_SYMBOL_GPL(i2c_dw_probe_master);
MODULE_DESCRIPTION("Synopsys DesignWare I2C bus master adapter");
MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index d5e5abc03683f..7e994f366a5e8 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -271,7 +271,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
adap->nr = controller->bus_num;
- r = i2c_dw_probe(dev);
+ r = i2c_dw_probe_master(dev);
if (r) {
pci_free_irq_vectors(pdev);
return r;
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 108b7d9d78bb5..7e228ff91ad48 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -337,11 +337,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
- if (dev->mode == DW_IC_SLAVE)
- ret = i2c_dw_probe_slave(dev);
- else
- ret = i2c_dw_probe(dev);
-
+ ret = i2c_dw_probe(dev);
if (ret)
goto exit_probe;
--
2.26.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 5/5] i2c: designware: Allow slave mode for PCI enumerated devices
2020-04-25 13:44 [PATCH v2 1/5] i2c: designware: Use devm_platform_ioremap_resource() to simplify code Andy Shevchenko
` (2 preceding siblings ...)
2020-04-25 13:44 ` [PATCH v2 4/5] i2c: designware: Rename i2c_dw_probe() to i2c_dw_probe_master() Andy Shevchenko
@ 2020-04-25 13:44 ` Andy Shevchenko
2020-04-27 14:05 ` Jarkko Nikula
3 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2020-04-25 13:44 UTC (permalink / raw)
To: Jarkko Nikula, Mika Westerberg, linux-i2c, Wolfram Sang; +Cc: Andy Shevchenko
Allow slave mode for PCI enumerated devices by calling a common i2c_dw_probe()
instead of i2c_dw_probe_master().
While dropping dependency to platform driver in slave module, move its
configuration section above, closer to core.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new patch
drivers/i2c/busses/Kconfig | 21 ++++++++++-----------
drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ++--
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 70a561bff74a6..b1ad26269cc63 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -527,6 +527,16 @@ config I2C_DAVINCI
config I2C_DESIGNWARE_CORE
tristate
+config I2C_DESIGNWARE_SLAVE
+ bool "Synopsys DesignWare Slave"
+ select I2C_SLAVE
+ help
+ If you say yes to this option, support will be included for the
+ Synopsys DesignWare I2C slave adapter.
+
+ This is not a standalone module, this module compiles together with
+ i2c-designware-core.
+
config I2C_DESIGNWARE_PLATFORM
tristate "Synopsys DesignWare Platform"
select I2C_DESIGNWARE_CORE
@@ -538,17 +548,6 @@ config I2C_DESIGNWARE_PLATFORM
This driver can also be built as a module. If so, the module
will be called i2c-designware-platform.
-config I2C_DESIGNWARE_SLAVE
- bool "Synopsys DesignWare Slave"
- select I2C_SLAVE
- depends on I2C_DESIGNWARE_PLATFORM
- help
- If you say yes to this option, support will be included for the
- Synopsys DesignWare I2C slave adapter.
-
- This is not a standalone module, this module compiles together with
- i2c-designware-core.
-
config I2C_DESIGNWARE_PCI
tristate "Synopsys DesignWare PCI"
depends on PCI
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 7e994f366a5e8..c762e5a11e44e 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -251,7 +251,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
}
}
- i2c_dw_configure_master(dev);
+ i2c_dw_configure(dev);
if (controller->scl_sda_cfg) {
cfg = controller->scl_sda_cfg;
@@ -271,7 +271,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
adap->nr = controller->bus_num;
- r = i2c_dw_probe_master(dev);
+ r = i2c_dw_probe(dev);
if (r) {
pci_free_irq_vectors(pdev);
return r;
--
2.26.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 5/5] i2c: designware: Allow slave mode for PCI enumerated devices
2020-04-25 13:44 ` [PATCH v2 5/5] i2c: designware: Allow slave mode for PCI enumerated devices Andy Shevchenko
@ 2020-04-27 14:05 ` Jarkko Nikula
2020-04-28 22:18 ` Wolfram Sang
0 siblings, 1 reply; 9+ messages in thread
From: Jarkko Nikula @ 2020-04-27 14:05 UTC (permalink / raw)
To: Andy Shevchenko, Mika Westerberg, linux-i2c, Wolfram Sang
On 4/25/20 4:44 PM, Andy Shevchenko wrote:
> Allow slave mode for PCI enumerated devices by calling a common i2c_dw_probe()
> instead of i2c_dw_probe_master().
>
> While dropping dependency to platform driver in slave module, move its
> configuration section above, closer to core.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: new patch
> drivers/i2c/busses/Kconfig | 21 ++++++++++-----------
> drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ++--
> 2 files changed, 12 insertions(+), 13 deletions(-)
>
To all 5 patches
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 5/5] i2c: designware: Allow slave mode for PCI enumerated devices
2020-04-27 14:05 ` Jarkko Nikula
@ 2020-04-28 22:18 ` Wolfram Sang
2020-05-12 16:14 ` Andy Shevchenko
0 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2020-04-28 22:18 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: Andy Shevchenko, Mika Westerberg, linux-i2c, Wolfram Sang
[-- Attachment #1: Type: text/plain, Size: 797 bytes --]
On Mon, Apr 27, 2020 at 05:05:35PM +0300, Jarkko Nikula wrote:
> On 4/25/20 4:44 PM, Andy Shevchenko wrote:
> > Allow slave mode for PCI enumerated devices by calling a common i2c_dw_probe()
> > instead of i2c_dw_probe_master().
> >
> > While dropping dependency to platform driver in slave module, move its
> > configuration section above, closer to core.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > v2: new patch
> > drivers/i2c/busses/Kconfig | 21 ++++++++++-----------
> > drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ++--
> > 2 files changed, 12 insertions(+), 13 deletions(-)
> >
> To all 5 patches
>
> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
And all applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 5/5] i2c: designware: Allow slave mode for PCI enumerated devices
2020-04-28 22:18 ` Wolfram Sang
@ 2020-05-12 16:14 ` Andy Shevchenko
2020-05-12 16:22 ` Wolfram Sang
0 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2020-05-12 16:14 UTC (permalink / raw)
To: Wolfram Sang; +Cc: Jarkko Nikula, Mika Westerberg, linux-i2c, Wolfram Sang
On Wed, Apr 29, 2020 at 12:18:31AM +0200, Wolfram Sang wrote:
> On Mon, Apr 27, 2020 at 05:05:35PM +0300, Jarkko Nikula wrote:
> > On 4/25/20 4:44 PM, Andy Shevchenko wrote:
> > > Allow slave mode for PCI enumerated devices by calling a common i2c_dw_probe()
> > > instead of i2c_dw_probe_master().
> > >
> > > While dropping dependency to platform driver in slave module, move its
> > > configuration section above, closer to core.
> > >
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > ---
> > > v2: new patch
> > > drivers/i2c/busses/Kconfig | 21 ++++++++++-----------
> > > drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ++--
> > > 2 files changed, 12 insertions(+), 13 deletions(-)
> > >
> > To all 5 patches
> >
> > Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
>
> And all applied to for-next, thanks!
Wolfram, I do not see them in your tree.
Neither Linux next has them. Something should I do?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 5/5] i2c: designware: Allow slave mode for PCI enumerated devices
2020-05-12 16:14 ` Andy Shevchenko
@ 2020-05-12 16:22 ` Wolfram Sang
0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2020-05-12 16:22 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Jarkko Nikula, Mika Westerberg, linux-i2c
[-- Attachment #1: Type: text/plain, Size: 259 bytes --]
> > And all applied to for-next, thanks!
>
> Wolfram, I do not see them in your tree.
> Neither Linux next has them. Something should I do?
Sorry, Andy. I lost them when I was not correctly syncing from my
secondary machine. Pushed them out now.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-05-12 16:22 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25 13:44 [PATCH v2 1/5] i2c: designware: Use devm_platform_ioremap_resource() to simplify code Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 2/5] i2c: designware: Move configuration routines to respective modules Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 3/5] i2c: designware: Switch PCI driver to use i2c_dw_configure_master() Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 4/5] i2c: designware: Rename i2c_dw_probe() to i2c_dw_probe_master() Andy Shevchenko
2020-04-25 13:44 ` [PATCH v2 5/5] i2c: designware: Allow slave mode for PCI enumerated devices Andy Shevchenko
2020-04-27 14:05 ` Jarkko Nikula
2020-04-28 22:18 ` Wolfram Sang
2020-05-12 16:14 ` Andy Shevchenko
2020-05-12 16:22 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).