From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Bill Brown <bill.e.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Seth Heasley
<seth.heasley-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v6] i2c: Adding support for Intel iSMT SMBus 2.0 host controller
Date: Mon, 4 Feb 2013 18:19:02 +0100 [thread overview]
Message-ID: <20130204181902.06c247ad@endymion.delvare> (raw)
In-Reply-To: <20130204104744.5f83541e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
On Mon, 4 Feb 2013 10:47:44 +0100, Jean Delvare wrote:
> I have backported your code to kernel 3.0 and I'll get back to you when
> I finally get a chance to test it.
OK, I am done with the backport and testing. The test system I have
access to appears to have a single slave on the second iSMT channel, at
address 0x54. I have no idea what this device is so my testing is
fairly limited, in particular I can't test writes. But at least I could
test the quick command and read byte transactions. I believe the
following fix is needed on top of your patch to make non-quick,
non-block transactions right:
---
i2c-ismt.c | 35 +++++++++++++++++++++++++----------
1 file changed, 25 insertions(+), 10 deletions(-)
--- i2c-ismt.orig/i2c-ismt.c
+++ i2c-ismt/i2c-ismt.c
@@ -329,10 +329,23 @@ static int ismt_process_desc(const struc
__ismt_desc_dump(&priv->pci_dev->dev, desc);
if (desc->status & ISMT_DESC_SCS) {
- if ((size != I2C_SMBUS_QUICK) &&
- (read_write == I2C_SMBUS_READ)) {
+ if (read_write == I2C_SMBUS_WRITE &&
+ size != I2C_SMBUS_PROC_CALL)
+ return 0;
+
+ switch (size) {
+ case I2C_SMBUS_BYTE:
+ case I2C_SMBUS_BYTE_DATA:
+ data->byte = dma_buffer[0];
+ break;
+ case I2C_SMBUS_WORD_DATA:
+ case I2C_SMBUS_PROC_CALL:
+ data->word = dma_buffer[0] | (dma_buffer[1] << 8);
+ break;
+ case I2C_SMBUS_BLOCK_DATA:
memcpy(&data->block[1], dma_buffer, desc->rxbytes);
data->block[0] = desc->rxbytes;
+ break;
}
return 0;
}
@@ -426,6 +439,8 @@ static int ismt_access(struct i2c_adapte
desc->wr_len_cmd = 2;
dma_size = 2;
dma_direction = DMA_TO_DEVICE;
+ priv->dma_buffer[0] = command;
+ priv->dma_buffer[1] = data->byte;
} else {
/* Read Byte */
dev_dbg(dev, "I2C_SMBUS_BYTE_DATA: READ\n");
@@ -444,6 +459,9 @@ static int ismt_access(struct i2c_adapte
desc->wr_len_cmd = 3;
dma_size = 3;
dma_direction = DMA_TO_DEVICE;
+ priv->dma_buffer[0] = command;
+ priv->dma_buffer[1] = data->word & 0xff;
+ priv->dma_buffer[2] = data->word >> 8;
} else {
/* Read Word */
dev_dbg(dev, "I2C_SMBUS_WORD_DATA: READ\n");
@@ -461,6 +479,9 @@ static int ismt_access(struct i2c_adapte
desc->rd_len = 2;
dma_size = 3;
dma_direction = DMA_BIDIRECTIONAL;
+ priv->dma_buffer[0] = command;
+ priv->dma_buffer[1] = data->word & 0xff;
+ priv->dma_buffer[2] = data->word >> 8;
break;
case I2C_SMBUS_BLOCK_DATA:
@@ -471,6 +492,8 @@ static int ismt_access(struct i2c_adapte
dma_direction = DMA_TO_DEVICE;
desc->wr_len_cmd = dma_size;
desc->control |= ISMT_DESC_BLK;
+ priv->dma_buffer[0] = command;
+ memcpy(&priv->dma_buffer[1], &data->block[1], dma_size);
} else {
/* Block Read */
dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n");
@@ -488,14 +511,6 @@ static int ismt_access(struct i2c_adapte
return -EOPNOTSUPP;
}
- /* Create a temporary buffer for the DMA transaction */
- /* and insert the command at the beginning of the buffer */
- if ((read_write == I2C_SMBUS_WRITE) &&
- (size > I2C_SMBUS_BYTE)) {
- memcpy(&priv->dma_buffer[1], &data->block[1], dma_size);
- priv->dma_buffer[0] = command;
- }
-
/* map the data buffer */
if (dma_size != 0) {
dev_dbg(dev, " dev=%p\n", dev);
Maybe that's what Seth was missing. Seth, can you please try this patch
of mine and let us know if it helps? Warning: I was only able to test
the quick, receive byte and read byte transactions.
--
Jean Delvare
next prev parent reply other threads:[~2013-02-04 17:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 0:36 [PATCH v4] i2c: Adding support for Intel iSMT SMBus 2.0 host controller Bill E Brown
[not found] ` <1354840604-8160-1-git-send-email-bill.e.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-12-07 0:34 ` Brown, Bill E
2012-12-18 14:03 ` Jean Delvare
[not found] ` <20121218150337.5b861ae3-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-01-28 19:43 ` [PATCH v5] " Neil Horman
[not found] ` <1359402232-21369-1-git-send-email-nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
2013-01-29 14:05 ` Jean Delvare
[not found] ` <20130129150551.498b2a9b-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-01-29 15:32 ` Neil Horman
[not found] ` <20130129153253.GA14044-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2013-01-29 22:10 ` Jean Delvare
[not found] ` <20130129231028.41b04fc9-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-01-30 14:15 ` Neil Horman
[not found] ` <20130130141504.GA2968-0o1r3XBGOEbbgkc5XkKeNuvMHUBZFtU3YPYVAmT7z5s@public.gmane.org>
2013-01-30 21:55 ` Jean Delvare
2013-01-29 16:57 ` Heasley, Seth
[not found] ` <DEC3922D1904474A8862C7BFF516EA9A59B47EB2-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-01-29 18:52 ` Jean Delvare
2013-01-29 14:29 ` Jean Delvare
2013-02-01 19:48 ` [PATCH v6] " Neil Horman
[not found] ` <1359748083-24423-1-git-send-email-nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
2013-02-04 9:47 ` Jean Delvare
[not found] ` <20130204104744.5f83541e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-02-04 17:19 ` Jean Delvare [this message]
[not found] ` <20130204181902.06c247ad-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-02-04 17:28 ` Neil Horman
[not found] ` <20130204172851.GA24749-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2013-02-05 7:21 ` Jean Delvare
2013-02-04 19:54 ` [PATCH v7] " Neil Horman
[not found] ` <1360007650-26272-1-git-send-email-nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
2013-02-05 1:13 ` Heasley, Seth
[not found] ` <DEC3922D1904474A8862C7BFF516EA9A59B4A8B8-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-02-05 7:16 ` Jean Delvare
[not found] ` <20130205081642.5349bd1a-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-02-05 14:52 ` Neil Horman
[not found] ` <20130205145230.GA4511-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2013-02-05 16:41 ` Jean Delvare
2013-02-05 16:41 ` Jean Delvare
2013-02-10 15:02 ` Wolfram Sang
[not found] ` <20130210150205.GB6282-8EAEigeeuNG034pCzgS/Qg7AFbiQbgqx@public.gmane.org>
2013-03-05 14:22 ` Neil Horman
[not found] ` <20130305142225.GA23095-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2013-03-05 14:42 ` Jean Delvare
[not found] ` <20130305154253.317bd23a-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-03-05 16:09 ` Neil Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130204181902.06c247ad@endymion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=bill.e.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
--cc=seth.heasley-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).