Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Three more bugfixes and one revert. I accidently applied one patch too
  early"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: exynos5: Preserve high speed master code
  Revert "i2c: i2c-qcom-geni: Add shutdown callback for i2c"
  i2c: designware: Get right data length
  i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition
This commit is contained in:
Linus Torvalds 2021-02-27 07:55:27 -08:00
commit 580cd7736f
5 changed files with 11 additions and 37 deletions

View File

@ -316,7 +316,7 @@ static int brcmstb_send_i2c_cmd(struct brcmstb_i2c_dev *dev,
goto cmd_out;
}
if ((CMD_RD || CMD_WR) &&
if ((cmd == CMD_RD || cmd == CMD_WR) &&
bsc_readl(dev, iic_enable) & BSC_IIC_EN_NOACK_MASK) {
rc = -EREMOTEIO;
dev_dbg(dev->device, "controller received NOACK intr for %s\n",

View File

@ -38,6 +38,8 @@
#define DW_IC_CON_TX_EMPTY_CTRL BIT(8)
#define DW_IC_CON_RX_FIFO_FULL_HLD_CTRL BIT(9)
#define DW_IC_DATA_CMD_DAT GENMASK(7, 0)
/*
* Registers offset
*/

View File

@ -432,7 +432,7 @@ i2c_dw_read(struct dw_i2c_dev *dev)
regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
/* Ensure length byte is a valid value */
if (flags & I2C_M_RECV_LEN &&
tmp <= I2C_SMBUS_BLOCK_MAX && tmp > 0) {
(tmp & DW_IC_DATA_CMD_DAT) <= I2C_SMBUS_BLOCK_MAX && tmp > 0) {
len = i2c_dw_recv_len(dev, tmp);
}
*buf++ = tmp;

View File

@ -606,6 +606,7 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop)
u32 i2c_ctl;
u32 int_en = 0;
u32 i2c_auto_conf = 0;
u32 i2c_addr = 0;
u32 fifo_ctl;
unsigned long flags;
unsigned short trig_lvl;
@ -640,7 +641,12 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop)
int_en |= HSI2C_INT_TX_ALMOSTEMPTY_EN;
}
writel(HSI2C_SLV_ADDR_MAS(i2c->msg->addr), i2c->regs + HSI2C_ADDR);
i2c_addr = HSI2C_SLV_ADDR_MAS(i2c->msg->addr);
if (i2c->op_clock >= I2C_MAX_FAST_MODE_PLUS_FREQ)
i2c_addr |= HSI2C_MASTER_ID(MASTER_ID(i2c->adap.nr));
writel(i2c_addr, i2c->regs + HSI2C_ADDR);
writel(fifo_ctl, i2c->regs + HSI2C_FIFO_CTL);
writel(i2c_ctl, i2c->regs + HSI2C_CTL);

View File

@ -375,32 +375,6 @@ static void geni_i2c_tx_msg_cleanup(struct geni_i2c_dev *gi2c,
}
}
static void geni_i2c_stop_xfer(struct geni_i2c_dev *gi2c)
{
int ret;
u32 geni_status;
struct i2c_msg *cur;
/* Resume device, as runtime suspend can happen anytime during transfer */
ret = pm_runtime_get_sync(gi2c->se.dev);
if (ret < 0) {
dev_err(gi2c->se.dev, "Failed to resume device: %d\n", ret);
return;
}
geni_status = readl_relaxed(gi2c->se.base + SE_GENI_STATUS);
if (geni_status & M_GENI_CMD_ACTIVE) {
cur = gi2c->cur;
geni_i2c_abort_xfer(gi2c);
if (cur->flags & I2C_M_RD)
geni_i2c_rx_msg_cleanup(gi2c, cur);
else
geni_i2c_tx_msg_cleanup(gi2c, cur);
}
pm_runtime_put_sync_suspend(gi2c->se.dev);
}
static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
u32 m_param)
{
@ -676,13 +650,6 @@ static int geni_i2c_remove(struct platform_device *pdev)
return 0;
}
static void geni_i2c_shutdown(struct platform_device *pdev)
{
struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev);
geni_i2c_stop_xfer(gi2c);
}
static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev)
{
int ret;
@ -747,7 +714,6 @@ MODULE_DEVICE_TABLE(of, geni_i2c_dt_match);
static struct platform_driver geni_i2c_driver = {
.probe = geni_i2c_probe,
.remove = geni_i2c_remove,
.shutdown = geni_i2c_shutdown,
.driver = {
.name = "geni_i2c",
.pm = &geni_i2c_pm_ops,