diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2018-07-23 16:26:10 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-10-05 12:05:08 -0400 |
commit | de82bb431855580ad659bfed3e858bd9dd12efd0 (patch) | |
tree | f5fbc6a024e89ecf5d03e9dabeacab517a6e91db | |
parent | f37b2bb6ac3e6ebf855d9d4f05cc6932a8e5b463 (diff) |
i2c: qup: use core to detect 'no zero length' quirk
And don't reimplement in the driver.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r-- | drivers/i2c/busses/i2c-qup.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index c86c3ae1318f..e09cd0775ae9 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c | |||
@@ -1088,11 +1088,6 @@ static int qup_i2c_xfer(struct i2c_adapter *adap, | |||
1088 | writel(I2C_MINI_CORE | I2C_N_VAL, qup->base + QUP_CONFIG); | 1088 | writel(I2C_MINI_CORE | I2C_N_VAL, qup->base + QUP_CONFIG); |
1089 | 1089 | ||
1090 | for (idx = 0; idx < num; idx++) { | 1090 | for (idx = 0; idx < num; idx++) { |
1091 | if (msgs[idx].len == 0) { | ||
1092 | ret = -EINVAL; | ||
1093 | goto out; | ||
1094 | } | ||
1095 | |||
1096 | if (qup_i2c_poll_state_i2c_master(qup)) { | 1091 | if (qup_i2c_poll_state_i2c_master(qup)) { |
1097 | ret = -EIO; | 1092 | ret = -EIO; |
1098 | goto out; | 1093 | goto out; |
@@ -1520,9 +1515,6 @@ qup_i2c_determine_mode_v2(struct qup_i2c_dev *qup, | |||
1520 | 1515 | ||
1521 | /* All i2c_msgs should be transferred using either dma or cpu */ | 1516 | /* All i2c_msgs should be transferred using either dma or cpu */ |
1522 | for (idx = 0; idx < num; idx++) { | 1517 | for (idx = 0; idx < num; idx++) { |
1523 | if (msgs[idx].len == 0) | ||
1524 | return -EINVAL; | ||
1525 | |||
1526 | if (msgs[idx].flags & I2C_M_RD) | 1518 | if (msgs[idx].flags & I2C_M_RD) |
1527 | max_rx_len = max_t(unsigned int, max_rx_len, | 1519 | max_rx_len = max_t(unsigned int, max_rx_len, |
1528 | msgs[idx].len); | 1520 | msgs[idx].len); |
@@ -1636,9 +1628,14 @@ static const struct i2c_algorithm qup_i2c_algo_v2 = { | |||
1636 | * which limits the possible read to 256 (QUP_READ_LIMIT) bytes. | 1628 | * which limits the possible read to 256 (QUP_READ_LIMIT) bytes. |
1637 | */ | 1629 | */ |
1638 | static const struct i2c_adapter_quirks qup_i2c_quirks = { | 1630 | static const struct i2c_adapter_quirks qup_i2c_quirks = { |
1631 | .flags = I2C_AQ_NO_ZERO_LEN, | ||
1639 | .max_read_len = QUP_READ_LIMIT, | 1632 | .max_read_len = QUP_READ_LIMIT, |
1640 | }; | 1633 | }; |
1641 | 1634 | ||
1635 | static const struct i2c_adapter_quirks qup_i2c_quirks_v2 = { | ||
1636 | .flags = I2C_AQ_NO_ZERO_LEN, | ||
1637 | }; | ||
1638 | |||
1642 | static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup) | 1639 | static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup) |
1643 | { | 1640 | { |
1644 | clk_prepare_enable(qup->clk); | 1641 | clk_prepare_enable(qup->clk); |
@@ -1701,6 +1698,7 @@ static int qup_i2c_probe(struct platform_device *pdev) | |||
1701 | is_qup_v1 = true; | 1698 | is_qup_v1 = true; |
1702 | } else { | 1699 | } else { |
1703 | qup->adap.algo = &qup_i2c_algo_v2; | 1700 | qup->adap.algo = &qup_i2c_algo_v2; |
1701 | qup->adap.quirks = &qup_i2c_quirks_v2; | ||
1704 | is_qup_v1 = false; | 1702 | is_qup_v1 = false; |
1705 | if (acpi_match_device(qup_i2c_acpi_match, qup->dev)) | 1703 | if (acpi_match_device(qup_i2c_acpi_match, qup->dev)) |
1706 | goto nodma; | 1704 | goto nodma; |