@@ -38,7 +38,7 @@ int i2c_dw_baytrail_probe_lock_support(struct dw_i2c_dev *dev)
dev_info(dev->dev, "I2C bus managed by PUNIT\n");
dev->acquire_lock = iosf_mbi_block_punit_i2c_access;
dev->release_lock = iosf_mbi_unblock_punit_i2c_access;
- dev->shared_with_punit = true;
+ dev->flags |= SEMAPHORE_INTEL_PUNIT;
return 0;
}
@@ -235,7 +235,6 @@ struct reset_control;
* @release_lock: function to release a hardware lock on the bus
* @semaphore_idx: Index of table with semaphore type attached to the bus. It's
* -1 if there is no semaphore.
- * @shared_with_punit: true if this bus is shared with the SoCs PUNIT
* @disable: function to disable the controller
* @init: function to initialize the I2C hardware
* @set_sda_hold_time: callback to retrieve IP specific SDA hold timing
@@ -292,7 +291,6 @@ struct dw_i2c_dev {
int (*acquire_lock)(void);
void (*release_lock)(void);
int semaphore_idx;
- bool shared_with_punit;
void (*disable)(struct dw_i2c_dev *dev);
int (*init)(struct dw_i2c_dev *dev);
int (*set_sda_hold_time)(struct dw_i2c_dev *dev);
@@ -304,6 +302,7 @@ struct dw_i2c_dev {
#define ACCESS_NO_IRQ_SUSPEND BIT(1)
#define SEMAPHORE_AMD_PSP (1 << 4)
+#define SEMAPHORE_INTEL_PUNIT (2 << 4)
#define SEMAPHORE_MASK GENMASK(7, 4)
#define MODEL_MSCC_OCELOT (1 << 8)
@@ -181,7 +181,7 @@ static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev)
{
pm_runtime_disable(dev->dev);
- if (dev->shared_with_punit)
+ if ((dev->flags & SEMAPHORE_MASK) == SEMAPHORE_INTEL_PUNIT)
pm_runtime_put_noidle(dev->dev);
}
@@ -381,7 +381,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
- if (dev->shared_with_punit)
+ if ((dev->flags & SEMAPHORE_MASK) == SEMAPHORE_INTEL_PUNIT)
pm_runtime_get_noresume(&pdev->dev);
pm_runtime_enable(&pdev->dev);
@@ -433,7 +433,7 @@ static int dw_i2c_plat_runtime_suspend(struct device *dev)
{
struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
- if (i_dev->shared_with_punit)
+ if ((i_dev->flags & SEMAPHORE_MASK) == SEMAPHORE_INTEL_PUNIT)
return 0;
i_dev->disable(i_dev);
@@ -455,7 +455,7 @@ static int dw_i2c_plat_runtime_resume(struct device *dev)
{
struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
- if (!i_dev->shared_with_punit)
+ if ((i_dev->flags & SEMAPHORE_MASK) != SEMAPHORE_INTEL_PUNIT)
i2c_dw_prepare_clk(i_dev, true);
i_dev->init(i_dev);
Remove the shared_with_punit member variable from the struct dw_i2c_dev and make it one semaphore type. Idea is to make code more uniform when there is need to differentiate between bus semaphores. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> --- drivers/i2c/busses/i2c-designware-baytrail.c | 2 +- drivers/i2c/busses/i2c-designware-core.h | 3 +-- drivers/i2c/busses/i2c-designware-platdrv.c | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-)