Commit 055d8d9e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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

Wolfram writes:
  "i2c for 4.19

   I2C has three driver bugfixes and a fix for a typo for you."

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: designware: Call i2c_dw_clk_rate() only when calculating timings
  i2c: i2c-scmi: fix for i2c_smbus_write_block_data
  i2c: i2c-isch: fix spelling mistake "unitialized" -> "uninitialized"
  i2c: i2c-qcom-geni: Properly handle DMA safe buffers
parents 40fa9167 9ce7610e
...@@ -34,11 +34,11 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev *dev) ...@@ -34,11 +34,11 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev *dev)
static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev)
{ {
u32 ic_clk = i2c_dw_clk_rate(dev);
const char *mode_str, *fp_str = ""; const char *mode_str, *fp_str = "";
u32 comp_param1; u32 comp_param1;
u32 sda_falling_time, scl_falling_time; u32 sda_falling_time, scl_falling_time;
struct i2c_timings *t = &dev->timings; struct i2c_timings *t = &dev->timings;
u32 ic_clk;
int ret; int ret;
ret = i2c_dw_acquire_lock(dev); ret = i2c_dw_acquire_lock(dev);
...@@ -53,6 +53,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) ...@@ -53,6 +53,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev)
/* Calculate SCL timing parameters for standard mode if not set */ /* Calculate SCL timing parameters for standard mode if not set */
if (!dev->ss_hcnt || !dev->ss_lcnt) { if (!dev->ss_hcnt || !dev->ss_lcnt) {
ic_clk = i2c_dw_clk_rate(dev);
dev->ss_hcnt = dev->ss_hcnt =
i2c_dw_scl_hcnt(ic_clk, i2c_dw_scl_hcnt(ic_clk,
4000, /* tHD;STA = tHIGH = 4.0 us */ 4000, /* tHD;STA = tHIGH = 4.0 us */
...@@ -89,6 +90,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) ...@@ -89,6 +90,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev)
* needed also in high speed mode. * needed also in high speed mode.
*/ */
if (!dev->fs_hcnt || !dev->fs_lcnt) { if (!dev->fs_hcnt || !dev->fs_lcnt) {
ic_clk = i2c_dw_clk_rate(dev);
dev->fs_hcnt = dev->fs_hcnt =
i2c_dw_scl_hcnt(ic_clk, i2c_dw_scl_hcnt(ic_clk,
600, /* tHD;STA = tHIGH = 0.6 us */ 600, /* tHD;STA = tHIGH = 0.6 us */
......
...@@ -164,7 +164,7 @@ static s32 sch_access(struct i2c_adapter *adap, u16 addr, ...@@ -164,7 +164,7 @@ static s32 sch_access(struct i2c_adapter *adap, u16 addr,
* run ~75 kHz instead which should do no harm. * run ~75 kHz instead which should do no harm.
*/ */
dev_notice(&sch_adapter.dev, dev_notice(&sch_adapter.dev,
"Clock divider unitialized. Setting defaults\n"); "Clock divider uninitialized. Setting defaults\n");
outw(backbone_speed / (4 * 100), SMBHSTCLK); outw(backbone_speed / (4 * 100), SMBHSTCLK);
} }
......
...@@ -367,20 +367,26 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, ...@@ -367,20 +367,26 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
dma_addr_t rx_dma; dma_addr_t rx_dma;
enum geni_se_xfer_mode mode; enum geni_se_xfer_mode mode;
unsigned long time_left = XFER_TIMEOUT; unsigned long time_left = XFER_TIMEOUT;
void *dma_buf;
gi2c->cur = msg; gi2c->cur = msg;
mode = msg->len > 32 ? GENI_SE_DMA : GENI_SE_FIFO; mode = GENI_SE_FIFO;
dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
if (dma_buf)
mode = GENI_SE_DMA;
geni_se_select_mode(&gi2c->se, mode); geni_se_select_mode(&gi2c->se, mode);
writel_relaxed(msg->len, gi2c->se.base + SE_I2C_RX_TRANS_LEN); writel_relaxed(msg->len, gi2c->se.base + SE_I2C_RX_TRANS_LEN);
geni_se_setup_m_cmd(&gi2c->se, I2C_READ, m_param); geni_se_setup_m_cmd(&gi2c->se, I2C_READ, m_param);
if (mode == GENI_SE_DMA) { if (mode == GENI_SE_DMA) {
int ret; int ret;
ret = geni_se_rx_dma_prep(&gi2c->se, msg->buf, msg->len, ret = geni_se_rx_dma_prep(&gi2c->se, dma_buf, msg->len,
&rx_dma); &rx_dma);
if (ret) { if (ret) {
mode = GENI_SE_FIFO; mode = GENI_SE_FIFO;
geni_se_select_mode(&gi2c->se, mode); geni_se_select_mode(&gi2c->se, mode);
i2c_put_dma_safe_msg_buf(dma_buf, msg, false);
} }
} }
...@@ -393,6 +399,7 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, ...@@ -393,6 +399,7 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
if (gi2c->err) if (gi2c->err)
geni_i2c_rx_fsm_rst(gi2c); geni_i2c_rx_fsm_rst(gi2c);
geni_se_rx_dma_unprep(&gi2c->se, rx_dma, msg->len); geni_se_rx_dma_unprep(&gi2c->se, rx_dma, msg->len);
i2c_put_dma_safe_msg_buf(dma_buf, msg, !gi2c->err);
} }
return gi2c->err; return gi2c->err;
} }
...@@ -403,20 +410,26 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, ...@@ -403,20 +410,26 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
dma_addr_t tx_dma; dma_addr_t tx_dma;
enum geni_se_xfer_mode mode; enum geni_se_xfer_mode mode;
unsigned long time_left; unsigned long time_left;
void *dma_buf;
gi2c->cur = msg; gi2c->cur = msg;
mode = msg->len > 32 ? GENI_SE_DMA : GENI_SE_FIFO; mode = GENI_SE_FIFO;
dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
if (dma_buf)
mode = GENI_SE_DMA;
geni_se_select_mode(&gi2c->se, mode); geni_se_select_mode(&gi2c->se, mode);
writel_relaxed(msg->len, gi2c->se.base + SE_I2C_TX_TRANS_LEN); writel_relaxed(msg->len, gi2c->se.base + SE_I2C_TX_TRANS_LEN);
geni_se_setup_m_cmd(&gi2c->se, I2C_WRITE, m_param); geni_se_setup_m_cmd(&gi2c->se, I2C_WRITE, m_param);
if (mode == GENI_SE_DMA) { if (mode == GENI_SE_DMA) {
int ret; int ret;
ret = geni_se_tx_dma_prep(&gi2c->se, msg->buf, msg->len, ret = geni_se_tx_dma_prep(&gi2c->se, dma_buf, msg->len,
&tx_dma); &tx_dma);
if (ret) { if (ret) {
mode = GENI_SE_FIFO; mode = GENI_SE_FIFO;
geni_se_select_mode(&gi2c->se, mode); geni_se_select_mode(&gi2c->se, mode);
i2c_put_dma_safe_msg_buf(dma_buf, msg, false);
} }
} }
...@@ -432,6 +445,7 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, ...@@ -432,6 +445,7 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
if (gi2c->err) if (gi2c->err)
geni_i2c_tx_fsm_rst(gi2c); geni_i2c_tx_fsm_rst(gi2c);
geni_se_tx_dma_unprep(&gi2c->se, tx_dma, msg->len); geni_se_tx_dma_unprep(&gi2c->se, tx_dma, msg->len);
i2c_put_dma_safe_msg_buf(dma_buf, msg, !gi2c->err);
} }
return gi2c->err; return gi2c->err;
} }
......
...@@ -152,6 +152,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, ...@@ -152,6 +152,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
mt_params[3].type = ACPI_TYPE_INTEGER; mt_params[3].type = ACPI_TYPE_INTEGER;
mt_params[3].integer.value = len; mt_params[3].integer.value = len;
mt_params[4].type = ACPI_TYPE_BUFFER; mt_params[4].type = ACPI_TYPE_BUFFER;
mt_params[4].buffer.length = len;
mt_params[4].buffer.pointer = data->block + 1; mt_params[4].buffer.pointer = data->block + 1;
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment