i2c: qup: make use of the new infrastructure for quirks
authorWolfram Sang <wsa@the-dreams.de>
Wed, 7 Jan 2015 11:24:10 +0000 (12:24 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Fri, 13 Mar 2015 14:10:53 +0000 (15:10 +0100)
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Tested-by: Ivan T. Ivanov <iivanov@mm-sol.com>
drivers/i2c/busses/i2c-qup.c

index 4dad23bdffbe901e0180be86dadc6c3eea03ec82..fdcbdab808e9fcbea9eb301ab7a2fb261abb3226 100644 (file)
@@ -412,17 +412,6 @@ static int qup_i2c_read_one(struct qup_i2c_dev *qup, struct i2c_msg *msg)
        unsigned long left;
        int ret;
 
-       /*
-        * The QUP block will issue a NACK and STOP on the bus when reaching
-        * the end of the read, the length of the read is specified as one byte
-        * which limits the possible read to 256 (QUP_READ_LIMIT) bytes.
-        */
-       if (msg->len > QUP_READ_LIMIT) {
-               dev_err(qup->dev, "HW not capable of reads over %d bytes\n",
-                       QUP_READ_LIMIT);
-               return -EINVAL;
-       }
-
        qup->msg = msg;
        qup->pos  = 0;
 
@@ -534,6 +523,15 @@ static const struct i2c_algorithm qup_i2c_algo = {
        .functionality  = qup_i2c_func,
 };
 
+/*
+ * The QUP block will issue a NACK and STOP on the bus when reaching
+ * the end of the read, the length of the read is specified as one byte
+ * which limits the possible read to 256 (QUP_READ_LIMIT) bytes.
+ */
+static struct i2c_adapter_quirks qup_i2c_quirks = {
+       .max_read_len = QUP_READ_LIMIT,
+};
+
 static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup)
 {
        clk_prepare_enable(qup->clk);
@@ -670,6 +668,7 @@ static int qup_i2c_probe(struct platform_device *pdev)
 
        i2c_set_adapdata(&qup->adap, qup);
        qup->adap.algo = &qup_i2c_algo;
+       qup->adap.quirks = &qup_i2c_quirks;
        qup->adap.dev.parent = qup->dev;
        qup->adap.dev.of_node = pdev->dev.of_node;
        strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name));