From: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
To: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>,
andi.shyti@kernel.org, linux-arm-msm@vger.kernel.org,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: quic_srichara@quicinc.com, quic_varada@quicinc.com
Subject: Re: [PATCH v2 1/1] i2c: qcom-geni: Support systems with 32MHz serial engine clock
Date: Thu, 3 Oct 2024 10:51:17 +0300 [thread overview]
Message-ID: <15306731-781e-41ca-b328-74001ceaca0a@linaro.org> (raw)
In-Reply-To: <0e38cd39-ba91-48f8-a4ee-c90bf95acdfe@quicinc.com>
On 9/30/24 17:45, Manikanta Mylavarapu wrote:
>
>
> On 9/29/2024 12:06 PM, Manikanta Mylavarapu wrote:
>>
>>
>> On 9/26/2024 3:58 PM, Vladimir Zapolskiy wrote:
>>> Hello Manikanta.
>>>
>>> On 9/26/24 06:43, Manikanta Mylavarapu wrote:
>>>> In existing socs, I2C serial engine is sourced from XO (19.2MHz).
>>>> Where as in IPQ5424, I2C serial engine is sourced from GPLL0 (32MHz).
>>>>
>>>> The existing map table is based on 19.2MHz. This patch incorporate
>>>> the clock map table to derive the SCL clock from the 32MHz source
>>>> clock frequency.
>>>>
>>>> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>>>> ---
>>>> Changes in v2:
>>>> - Dropped IPQ5424 from the commit title
>>>> - Added else part to assign geni_i2c_clk_map_19p2mhz to itr
>>>> - Dropped MHZ macro and used HZ_PER_MHZ macro
>>>> - Expanded SE to serial engine
>>>> - Added the reason for 32MHz clock in commit message
>>>>
>>>> drivers/i2c/busses/i2c-qcom-geni.c | 19 ++++++++++++++++---
>>>> 1 file changed, 16 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
>>>> index 212336f724a6..22f2a0d83641 100644
>>>> --- a/drivers/i2c/busses/i2c-qcom-geni.c
>>>> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
>>>> @@ -16,6 +16,7 @@
>>>> #include <linux/pm_runtime.h>
>>>> #include <linux/soc/qcom/geni-se.h>
>>>> #include <linux/spinlock.h>
>>>> +#include <linux/units.h>
>>>> #define SE_I2C_TX_TRANS_LEN 0x26c
>>>> #define SE_I2C_RX_TRANS_LEN 0x270
>>>> @@ -146,18 +147,30 @@ struct geni_i2c_clk_fld {
>>>> * clk_freq_out = t / t_cycle
>>>> * source_clock = 19.2 MHz
>>>> */
>>>> -static const struct geni_i2c_clk_fld geni_i2c_clk_map[] = {
>>>> +static const struct geni_i2c_clk_fld geni_i2c_clk_map_19p2mhz[] = {
>>>> {KHZ(100), 7, 10, 11, 26},
>>>> {KHZ(400), 2, 5, 12, 24},
>>>> {KHZ(1000), 1, 3, 9, 18},
>>>> };
>>>> +/* source_clock = 32 MHz */
>>>> +static const struct geni_i2c_clk_fld geni_i2c_clk_map_32mhz[] = {
>>>> + {KHZ(100), 7, 14, 18, 40},
>>>> + {KHZ(400), 4, 3, 11, 20},
>>>> + {KHZ(1000), 4, 3, 6, 15},
>>>> +};
>>>
>>> Please double check the values.
>>>
>>> This is what I get:
>>> * for 100KHz: 32000000 / (40 * 7) ~ 114286, apparently 32000000 / (40 * 8) would
>>> be a better fit, however it's unclear what would be proper t_high / t_low values,
>>> * for 400KHz: it seems good,
>>> * for 1000KHz: 32000000 / (15 * 4) ~ 533333, which is almost 1/2 of the wanted
>>> bus frequency, so this one looks very wrong.
>>>
>>> Do you have any ideas how to get better bus frequency settings?
>>>
>>
>> Thanks for pointing this out.
>>
>> I will double check and get back with the proper data.
>>
>> Thanks & Regards,
>> Manikanta.
>>
>
> Based on Qualcomm's internal hardware programming guide, below values need to be used for 100K & 1000K.
> {KHZ(100), 8, 14, 18, 40}
> {KHZ(1000), 2, 3, 6, 15}
>
> I will update these values in next version.
Great! These values make much more sence, thank you.
--
Best wishes,
Vladimir
prev parent reply other threads:[~2024-10-03 7:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 3:43 Manikanta Mylavarapu
2024-09-26 6:14 ` Mukesh Kumar Savaliya
2024-09-26 7:43 ` Manikanta Mylavarapu
2024-09-26 12:44 ` Bjorn Andersson
2024-09-26 10:28 ` Vladimir Zapolskiy
2024-09-26 12:48 ` Bjorn Andersson
2024-09-29 6:32 ` Manikanta Mylavarapu
2024-09-29 6:36 ` Manikanta Mylavarapu
2024-09-30 14:45 ` Manikanta Mylavarapu
2024-10-03 7:51 ` Vladimir Zapolskiy [this message]
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=15306731-781e-41ca-b328-74001ceaca0a@linaro.org \
--to=vladimir.zapolskiy@linaro.org \
--cc=andi.shyti@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_mmanikan@quicinc.com \
--cc=quic_srichara@quicinc.com \
--cc=quic_varada@quicinc.com \
/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
all inboxes | Powered by JetHome®