Skip to content

Commit 2ec6185

Browse files
committed
Merge: i2c: designware: add a new bit check for IC_CON control
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7070 JIRA: https://issues.redhat.com/browse/RHEL-78660 i2c: designware: add a new bit check for IC_CON control Signed-off-by: John Allen <johnalle@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents c251dbb + 98d750f commit 2ec6185

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

drivers/i2c/busses/i2c-designware-core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#define DW_IC_CON_STOP_DET_IFADDRESSED BIT(7)
3838
#define DW_IC_CON_TX_EMPTY_CTRL BIT(8)
3939
#define DW_IC_CON_RX_FIFO_FULL_HLD_CTRL BIT(9)
40+
#define DW_IC_CON_BUS_CLEAR_CTRL BIT(11)
4041

4142
#define DW_IC_DATA_CMD_DAT GENMASK(7, 0)
4243

drivers/i2c/busses/i2c-designware-master.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,7 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
875875
{
876876
struct i2c_adapter *adap = &dev->adapter;
877877
unsigned long irq_flags;
878+
unsigned int ic_con;
878879
int ret;
879880

880881
init_completion(&dev->cmd_complete);
@@ -895,6 +896,25 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
895896
if (ret)
896897
return ret;
897898

899+
/* Lock the bus for accessing DW_IC_CON */
900+
ret = i2c_dw_acquire_lock(dev);
901+
if (ret)
902+
return ret;
903+
904+
/*
905+
* On AMD platforms BIOS advertises the bus clear feature
906+
* and enables the SCL/SDA stuck low. SMU FW does the
907+
* bus recovery process. Driver should not ignore this BIOS
908+
* advertisement of bus clear feature.
909+
*/
910+
ret = regmap_read(dev->map, DW_IC_CON, &ic_con);
911+
i2c_dw_release_lock(dev);
912+
if (ret)
913+
return ret;
914+
915+
if (ic_con & DW_IC_CON_BUS_CLEAR_CTRL)
916+
dev->master_cfg |= DW_IC_CON_BUS_CLEAR_CTRL;
917+
898918
ret = dev->init(dev);
899919
if (ret)
900920
return ret;

0 commit comments

Comments
 (0)