File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments