Skip to content

Commit

Permalink
i2c: designware: Consolidate default functionality bits
Browse files Browse the repository at this point in the history
Use a common place for default functionality bits for both platform
and pci driver.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Alexander Stein authored and Wolfram Sang committed Nov 29, 2016
1 parent feff5c0 commit f06122f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
8 changes: 8 additions & 0 deletions drivers/i2c/busses/i2c-designware-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
*
*/

#include <linux/i2c.h>

#define DW_IC_DEFAULT_FUNCTIONALITY (I2C_FUNC_I2C | \
I2C_FUNC_SMBUS_BYTE | \
I2C_FUNC_SMBUS_BYTE_DATA | \
I2C_FUNC_SMBUS_WORD_DATA | \
I2C_FUNC_SMBUS_BLOCK_DATA | \
I2C_FUNC_SMBUS_I2C_BLOCK)

#define DW_IC_CON_MASTER 0x1
#define DW_IC_CON_SPEED_STD 0x2
Expand Down
9 changes: 1 addition & 8 deletions drivers/i2c/busses/i2c-designware-pcidrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ struct dw_pci_controller {
DW_IC_CON_SLAVE_DISABLE | \
DW_IC_CON_RESTART_EN)

#define DW_DEFAULT_FUNCTIONALITY (I2C_FUNC_I2C | \
I2C_FUNC_SMBUS_BYTE | \
I2C_FUNC_SMBUS_BYTE_DATA | \
I2C_FUNC_SMBUS_WORD_DATA | \
I2C_FUNC_SMBUS_BLOCK_DATA | \
I2C_FUNC_SMBUS_I2C_BLOCK)

/* Merrifield HCNT/LCNT/SDA hold time */
static struct dw_scl_sda_cfg mrfld_config = {
.ss_hcnt = 0x2f8,
Expand Down Expand Up @@ -250,7 +243,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
}

dev->functionality = controller->functionality |
DW_DEFAULT_FUNCTIONALITY;
DW_IC_DEFAULT_FUNCTIONALITY;

dev->master_cfg = controller->bus_cfg;
if (controller->scl_sda_cfg) {
Expand Down
9 changes: 1 addition & 8 deletions drivers/i2c/busses/i2c-designware-platdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
if (r)
return r;

dev->functionality =
I2C_FUNC_I2C |
I2C_FUNC_10BIT_ADDR |
I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_BLOCK_DATA |
I2C_FUNC_SMBUS_I2C_BLOCK;
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;
Expand Down

0 comments on commit f06122f

Please sign in to comment.