From: Andrey Danin <danindrey-JGs/UdohzUI@public.gmane.org>
To: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ac100-oU9gvf+ajcQ97yFScArB1dHuzzzSOjJt@public.gmane.org,
Laxman Dewangan
<ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Thierry Reding
<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Alexandre Courbot
<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
Subject: Re: [PATCH 1/3] i2c: tegra: implement slave mode
Date: Tue, 31 Mar 2015 09:25:38 +0300 [thread overview]
Message-ID: <551A3DE2.90806@mail.ru> (raw)
In-Reply-To: <20150129114155.GA9080@katana>
Hi,
Sorry for long delay.
And thanks for the quick review. It helped a lot!
On 29.01.2015 14:41, Wolfram Sang wrote:
> Hi,
>
>> Initialization code is based on NVEC driver.
>>
>> There is a HW bug in AP20 that was also mentioned in kernel sources
>> for Toshiba AC100.
>>
>> Signed-off-by: Andrey Danin <danindrey-JGs/UdohzUI@public.gmane.org>
>
> Cool, thanks for the converison. While I usually like to only get the
> patches which I need to handle, please CC me to all patches next time. I
> am interested what changes were needed for the user of the slave
> framework, too.
Done. I sent v2 yesterday evening.
>
>> +static bool tegra_i2c_slave_isr(int irq, struct tegra_i2c_dev *i2c_dev)
>> +{
>> + unsigned long status;
>> + u8 value;
>> +
>> + if (!i2c_dev->slave || !i2c_dev->slave->slave_cb)
>> + return false;
>
> Can this happen?
Yes. I call slave ISR without any conditions from main ISR routine.
>
>> + /* i2c master sends data to us */
>> + if (is_write(status)) {
>> + i2c_slave_event(i2c_dev->slave, I2C_SLAVE_REQ_WRITE_START,
>> + NULL);
>
> Can this HW create an interrupt once the address detection + RW bit are
> received? Or only if a complete write has been received?
Tegra I2C generates one interrupt per byte (address or data) and one
interrupt for stop bit.
>
>> +static int tegra_reg_slave(struct i2c_client *slave)
>> +{
>> + struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(slave->adapter);
>> +
>> + if (i2c_dev->slave)
>> + return -EBUSY;
>> +
>> + i2c_dev->slave = slave;
>> +
>> + tegra_i2c_clock_enable(i2c_dev);
>> +
>> + reset_control_assert(i2c_dev->rst);
>> + udelay(2);
>> + reset_control_deassert(i2c_dev->rst);
>
> Why do you need a reset when a slave gets registered?
I copied this code from nvec driver. Reset is done during I2C controller
initialization. This reset is not needed. Thanks for pointing.
>
>> +
>> + i2c_writel(i2c_dev, I2C_SL_CNFG_NEWSL, I2C_SL_CNFG);
>> + i2c_writel(i2c_dev, 0x1E, I2C_SL_DELAY_COUNT);
>
> What does this magic number mean?
It's a default value. I created a constant for it.
>
>> +
>> + i2c_writel(i2c_dev, slave->addr, I2C_SL_ADDR1);
>> + i2c_writel(i2c_dev, 0, I2C_SL_ADDR2);
>
> Handling 10 bit addresses?
In v2.
>
>> +
>> + return 0;
>> +}
>> +
>
>> static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
>> @@ -679,6 +808,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
>> .has_single_clk_source = false,
>> .clk_divisor_hs_mode = 3,
>> .clk_divisor_std_fast_mode = 0,
>> + .slave_read_start_delay = 0,
>
> No need to init to 0 IMO.
>
Ok.
WARNING: multiple messages have this Message-ID (diff)
From: danindrey@mail.ru (Andrey Danin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] i2c: tegra: implement slave mode
Date: Tue, 31 Mar 2015 09:25:38 +0300 [thread overview]
Message-ID: <551A3DE2.90806@mail.ru> (raw)
In-Reply-To: <20150129114155.GA9080@katana>
Hi,
Sorry for long delay.
And thanks for the quick review. It helped a lot!
On 29.01.2015 14:41, Wolfram Sang wrote:
> Hi,
>
>> Initialization code is based on NVEC driver.
>>
>> There is a HW bug in AP20 that was also mentioned in kernel sources
>> for Toshiba AC100.
>>
>> Signed-off-by: Andrey Danin <danindrey@mail.ru>
>
> Cool, thanks for the converison. While I usually like to only get the
> patches which I need to handle, please CC me to all patches next time. I
> am interested what changes were needed for the user of the slave
> framework, too.
Done. I sent v2 yesterday evening.
>
>> +static bool tegra_i2c_slave_isr(int irq, struct tegra_i2c_dev *i2c_dev)
>> +{
>> + unsigned long status;
>> + u8 value;
>> +
>> + if (!i2c_dev->slave || !i2c_dev->slave->slave_cb)
>> + return false;
>
> Can this happen?
Yes. I call slave ISR without any conditions from main ISR routine.
>
>> + /* i2c master sends data to us */
>> + if (is_write(status)) {
>> + i2c_slave_event(i2c_dev->slave, I2C_SLAVE_REQ_WRITE_START,
>> + NULL);
>
> Can this HW create an interrupt once the address detection + RW bit are
> received? Or only if a complete write has been received?
Tegra I2C generates one interrupt per byte (address or data) and one
interrupt for stop bit.
>
>> +static int tegra_reg_slave(struct i2c_client *slave)
>> +{
>> + struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(slave->adapter);
>> +
>> + if (i2c_dev->slave)
>> + return -EBUSY;
>> +
>> + i2c_dev->slave = slave;
>> +
>> + tegra_i2c_clock_enable(i2c_dev);
>> +
>> + reset_control_assert(i2c_dev->rst);
>> + udelay(2);
>> + reset_control_deassert(i2c_dev->rst);
>
> Why do you need a reset when a slave gets registered?
I copied this code from nvec driver. Reset is done during I2C controller
initialization. This reset is not needed. Thanks for pointing.
>
>> +
>> + i2c_writel(i2c_dev, I2C_SL_CNFG_NEWSL, I2C_SL_CNFG);
>> + i2c_writel(i2c_dev, 0x1E, I2C_SL_DELAY_COUNT);
>
> What does this magic number mean?
It's a default value. I created a constant for it.
>
>> +
>> + i2c_writel(i2c_dev, slave->addr, I2C_SL_ADDR1);
>> + i2c_writel(i2c_dev, 0, I2C_SL_ADDR2);
>
> Handling 10 bit addresses?
In v2.
>
>> +
>> + return 0;
>> +}
>> +
>
>> static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
>> @@ -679,6 +808,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
>> .has_single_clk_source = false,
>> .clk_divisor_hs_mode = 3,
>> .clk_divisor_std_fast_mode = 0,
>> + .slave_read_start_delay = 0,
>
> No need to init to 0 IMO.
>
Ok.
WARNING: multiple messages have this Message-ID (diff)
From: Andrey Danin <danindrey@mail.ru>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
ac100@lists.launchpad.net, Laxman Dewangan <ldewangan@nvidia.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>,
Alexandre Courbot <gnurou@gmail.com>,
Marc Dietrich <marvin24@gmx.de>
Subject: Re: [PATCH 1/3] i2c: tegra: implement slave mode
Date: Tue, 31 Mar 2015 09:25:38 +0300 [thread overview]
Message-ID: <551A3DE2.90806@mail.ru> (raw)
In-Reply-To: <20150129114155.GA9080@katana>
Hi,
Sorry for long delay.
And thanks for the quick review. It helped a lot!
On 29.01.2015 14:41, Wolfram Sang wrote:
> Hi,
>
>> Initialization code is based on NVEC driver.
>>
>> There is a HW bug in AP20 that was also mentioned in kernel sources
>> for Toshiba AC100.
>>
>> Signed-off-by: Andrey Danin <danindrey@mail.ru>
>
> Cool, thanks for the converison. While I usually like to only get the
> patches which I need to handle, please CC me to all patches next time. I
> am interested what changes were needed for the user of the slave
> framework, too.
Done. I sent v2 yesterday evening.
>
>> +static bool tegra_i2c_slave_isr(int irq, struct tegra_i2c_dev *i2c_dev)
>> +{
>> + unsigned long status;
>> + u8 value;
>> +
>> + if (!i2c_dev->slave || !i2c_dev->slave->slave_cb)
>> + return false;
>
> Can this happen?
Yes. I call slave ISR without any conditions from main ISR routine.
>
>> + /* i2c master sends data to us */
>> + if (is_write(status)) {
>> + i2c_slave_event(i2c_dev->slave, I2C_SLAVE_REQ_WRITE_START,
>> + NULL);
>
> Can this HW create an interrupt once the address detection + RW bit are
> received? Or only if a complete write has been received?
Tegra I2C generates one interrupt per byte (address or data) and one
interrupt for stop bit.
>
>> +static int tegra_reg_slave(struct i2c_client *slave)
>> +{
>> + struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(slave->adapter);
>> +
>> + if (i2c_dev->slave)
>> + return -EBUSY;
>> +
>> + i2c_dev->slave = slave;
>> +
>> + tegra_i2c_clock_enable(i2c_dev);
>> +
>> + reset_control_assert(i2c_dev->rst);
>> + udelay(2);
>> + reset_control_deassert(i2c_dev->rst);
>
> Why do you need a reset when a slave gets registered?
I copied this code from nvec driver. Reset is done during I2C controller
initialization. This reset is not needed. Thanks for pointing.
>
>> +
>> + i2c_writel(i2c_dev, I2C_SL_CNFG_NEWSL, I2C_SL_CNFG);
>> + i2c_writel(i2c_dev, 0x1E, I2C_SL_DELAY_COUNT);
>
> What does this magic number mean?
It's a default value. I created a constant for it.
>
>> +
>> + i2c_writel(i2c_dev, slave->addr, I2C_SL_ADDR1);
>> + i2c_writel(i2c_dev, 0, I2C_SL_ADDR2);
>
> Handling 10 bit addresses?
In v2.
>
>> +
>> + return 0;
>> +}
>> +
>
>> static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
>> @@ -679,6 +808,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
>> .has_single_clk_source = false,
>> .clk_divisor_hs_mode = 3,
>> .clk_divisor_std_fast_mode = 0,
>> + .slave_read_start_delay = 0,
>
> No need to init to 0 IMO.
>
Ok.
next prev parent reply other threads:[~2015-03-31 6:25 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-29 7:20 [PATCH 0/3] arm: tegra: implement NVEC driver using tegra i2c Andrey Danin
2015-01-29 7:20 ` Andrey Danin
2015-01-29 7:20 ` Andrey Danin
2015-01-29 7:20 ` [PATCH 1/3] i2c: tegra: implement slave mode Andrey Danin
2015-01-29 7:20 ` Andrey Danin
2015-01-29 7:20 ` Andrey Danin
2015-01-29 9:40 ` Marc Dietrich
2015-01-29 9:40 ` Marc Dietrich
2015-01-29 11:41 ` Wolfram Sang
2015-01-29 11:41 ` Wolfram Sang
2015-03-31 6:25 ` Andrey Danin [this message]
2015-03-31 6:25 ` Andrey Danin
2015-03-31 6:25 ` Andrey Danin
2015-01-29 7:20 ` [PATCH 2/3] staging/nvec: reimplement on top of tegra i2c driver Andrey Danin
2015-01-29 7:20 ` Andrey Danin
2015-01-29 9:53 ` Marc Dietrich
2015-01-29 9:53 ` Marc Dietrich
2015-01-29 7:20 ` [PATCH 3/3] dt: paz00: define nvec as child of i2c bus Andrey Danin
2015-01-29 7:20 ` Andrey Danin
2015-01-29 7:20 ` Andrey Danin
2015-01-29 10:01 ` Marc Dietrich
2015-01-29 10:01 ` Marc Dietrich
[not found] ` <1422516022-27161-4-git-send-email-danindrey-JGs/UdohzUI@public.gmane.org>
2015-02-02 21:20 ` Stephen Warren
2015-02-02 21:20 ` Stephen Warren
2015-02-02 21:20 ` Stephen Warren
[not found] ` <54CFEA2F.8040701-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-03-31 6:40 ` Andrey Danin
2015-03-31 6:40 ` Andrey Danin
2015-03-31 6:40 ` Andrey Danin
2015-03-31 14:09 ` Stephen Warren
2015-03-31 14:09 ` Stephen Warren
[not found] ` <551AAA9B.6070607-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-03-31 15:46 ` Andrey Danin
2015-03-31 15:46 ` Andrey Danin
2015-03-31 15:46 ` Andrey Danin
[not found] ` <551AC153.7060103-JGs/UdohzUI@public.gmane.org>
2015-03-31 16:04 ` Andrey Danin
2015-03-31 16:04 ` Andrey Danin
2015-03-31 16:04 ` Andrey Danin
2015-04-01 17:28 ` Stephen Warren
2015-04-01 17:28 ` Stephen Warren
2015-04-01 17:28 ` Stephen Warren
[not found] ` <551C2AC0.9030304-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-04-02 9:37 ` Marc Dietrich
2015-04-02 9:37 ` Marc Dietrich
2015-04-02 9:37 ` Marc Dietrich
2015-04-02 14:50 ` Stephen Warren
2015-04-02 14:50 ` Stephen Warren
2015-04-02 14:50 ` Stephen Warren
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=551A3DE2.90806@mail.ru \
--to=danindrey-jgs/udohzui@public.gmane.org \
--cc=ac100-oU9gvf+ajcQ97yFScArB1dHuzzzSOjJt@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marvin24-Mmb7MZpHnFY@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.