forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
f37b2bb6ac
commit
de82bb4318
|
@ -1088,11 +1088,6 @@ static int qup_i2c_xfer(struct i2c_adapter *adap,
|
||||||
writel(I2C_MINI_CORE | I2C_N_VAL, qup->base + QUP_CONFIG);
|
writel(I2C_MINI_CORE | I2C_N_VAL, qup->base + QUP_CONFIG);
|
||||||
|
|
||||||
for (idx = 0; idx < num; idx++) {
|
for (idx = 0; idx < num; idx++) {
|
||||||
if (msgs[idx].len == 0) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qup_i2c_poll_state_i2c_master(qup)) {
|
if (qup_i2c_poll_state_i2c_master(qup)) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1520,9 +1515,6 @@ qup_i2c_determine_mode_v2(struct qup_i2c_dev *qup,
|
||||||
|
|
||||||
/* All i2c_msgs should be transferred using either dma or cpu */
|
/* All i2c_msgs should be transferred using either dma or cpu */
|
||||||
for (idx = 0; idx < num; idx++) {
|
for (idx = 0; idx < num; idx++) {
|
||||||
if (msgs[idx].len == 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (msgs[idx].flags & I2C_M_RD)
|
if (msgs[idx].flags & I2C_M_RD)
|
||||||
max_rx_len = max_t(unsigned int, max_rx_len,
|
max_rx_len = max_t(unsigned int, max_rx_len,
|
||||||
msgs[idx].len);
|
msgs[idx].len);
|
||||||
|
@ -1636,9 +1628,14 @@ static const struct i2c_algorithm qup_i2c_algo_v2 = {
|
||||||
* which limits the possible read to 256 (QUP_READ_LIMIT) bytes.
|
* which limits the possible read to 256 (QUP_READ_LIMIT) bytes.
|
||||||
*/
|
*/
|
||||||
static const struct i2c_adapter_quirks qup_i2c_quirks = {
|
static const struct i2c_adapter_quirks qup_i2c_quirks = {
|
||||||
|
.flags = I2C_AQ_NO_ZERO_LEN,
|
||||||
.max_read_len = QUP_READ_LIMIT,
|
.max_read_len = QUP_READ_LIMIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct i2c_adapter_quirks qup_i2c_quirks_v2 = {
|
||||||
|
.flags = I2C_AQ_NO_ZERO_LEN,
|
||||||
|
};
|
||||||
|
|
||||||
static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup)
|
static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup)
|
||||||
{
|
{
|
||||||
clk_prepare_enable(qup->clk);
|
clk_prepare_enable(qup->clk);
|
||||||
|
@ -1701,6 +1698,7 @@ static int qup_i2c_probe(struct platform_device *pdev)
|
||||||
is_qup_v1 = true;
|
is_qup_v1 = true;
|
||||||
} else {
|
} else {
|
||||||
qup->adap.algo = &qup_i2c_algo_v2;
|
qup->adap.algo = &qup_i2c_algo_v2;
|
||||||
|
qup->adap.quirks = &qup_i2c_quirks_v2;
|
||||||
is_qup_v1 = false;
|
is_qup_v1 = false;
|
||||||
if (acpi_match_device(qup_i2c_acpi_match, qup->dev))
|
if (acpi_match_device(qup_i2c_acpi_match, qup->dev))
|
||||||
goto nodma;
|
goto nodma;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user