aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2015-01-07 06:24:10 -0500
committerWolfram Sang <wsa@the-dreams.de>2015-03-13 10:10:53 -0400
commit994647db6bb2284de7dfee10a51b4d9fec760ed3 (patch)
treefd849536e6a6a8f1646086ef981378fa9677c80f
parenta531afdf93489e9357c4207c7bdec9b921ddfe9e (diff)
i2c: qup: make use of the new infrastructure for quirks
Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Tested-by: Ivan T. Ivanov <iivanov@mm-sol.com>
-rw-r--r--drivers/i2c/busses/i2c-qup.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 4dad23bdffbe..fdcbdab808e9 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -412,17 +412,6 @@ static int qup_i2c_read_one(struct qup_i2c_dev *qup, struct i2c_msg *msg)
412 unsigned long left; 412 unsigned long left;
413 int ret; 413 int ret;
414 414
415 /*
416 * The QUP block will issue a NACK and STOP on the bus when reaching
417 * the end of the read, the length of the read is specified as one byte
418 * which limits the possible read to 256 (QUP_READ_LIMIT) bytes.
419 */
420 if (msg->len > QUP_READ_LIMIT) {
421 dev_err(qup->dev, "HW not capable of reads over %d bytes\n",
422 QUP_READ_LIMIT);
423 return -EINVAL;
424 }
425
426 qup->msg = msg; 415 qup->msg = msg;
427 qup->pos = 0; 416 qup->pos = 0;
428 417
@@ -534,6 +523,15 @@ static const struct i2c_algorithm qup_i2c_algo = {
534 .functionality = qup_i2c_func, 523 .functionality = qup_i2c_func,
535}; 524};
536 525
526/*
527 * The QUP block will issue a NACK and STOP on the bus when reaching
528 * the end of the read, the length of the read is specified as one byte
529 * which limits the possible read to 256 (QUP_READ_LIMIT) bytes.
530 */
531static struct i2c_adapter_quirks qup_i2c_quirks = {
532 .max_read_len = QUP_READ_LIMIT,
533};
534
537static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup) 535static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup)
538{ 536{
539 clk_prepare_enable(qup->clk); 537 clk_prepare_enable(qup->clk);
@@ -670,6 +668,7 @@ static int qup_i2c_probe(struct platform_device *pdev)
670 668
671 i2c_set_adapdata(&qup->adap, qup); 669 i2c_set_adapdata(&qup->adap, qup);
672 qup->adap.algo = &qup_i2c_algo; 670 qup->adap.algo = &qup_i2c_algo;
671 qup->adap.quirks = &qup_i2c_quirks;
673 qup->adap.dev.parent = qup->dev; 672 qup->adap.dev.parent = qup->dev;
674 qup->adap.dev.of_node = pdev->dev.of_node; 673 qup->adap.dev.of_node = pdev->dev.of_node;
675 strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); 674 strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name));