Re: [PATCH 1/1] i2c: qcom-geni: add 32MHz I2C SE clock support for IPQ5424

Manikanta Mylavarapu
2024-09-25T08:44:11Z

On 9/25/2024 1:06 PM, Mukesh Kumar Savaliya wrote:
> Hi Manikanta,
>
> On 9/24/2024 12:20 PM, Manikanta Mylavarapu wrote:
>> The IPQ5424 I2C SE clock operates at a frequency of 32MHz. Since the
> would it be better to say , I2C SE is sourced from 32MHZ ?

Okay, sure.

>> existing map table is based on 19.2MHz, this patch incorporate the
> based on 19.2MHz. this patch /,/.

Okay, sure.

>> clock map table to derive the SCL clock from the 32MHz SE clock.
> from the 32MHz Source Clock frequency.
> SE = Expand OR  (I2C Serial Engine Controller)

Okay, sure.

>>
>> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com>
>> ---
>>   drivers/i2c/busses/i2c-qcom-geni.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
>> index 212336f724a6..bbd9ecf09f4b 100644
>> --- a/drivers/i2c/busses/i2c-qcom-geni.c
>> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
>> @@ -71,6 +71,7 @@ enum geni_i2c_err_code {
>>     #define I2C_AUTO_SUSPEND_DELAY    250
>>   #define KHZ(freq)        (1000 * freq)
>> +#define MHZ(freq)        (1000000 * freq)
>>   #define PACKING_BYTES_PW    4
>>     #define ABORT_TIMEOUT        HZ
>> @@ -152,11 +153,21 @@ static const struct geni_i2c_clk_fld geni_i2c_clk_map[] = {
> A thought - Should we rename this appending _19.2M ? In future one or more may come as it evolves speed.

Okay, sure.

Thanks & Regards,
Manikanta.

>>       {KHZ(1000), 1, 3,  9, 18},
>>   };
>>   +/* source_clock = 32 MHz */
>> +static const struct geni_i2c_clk_fld geni_i2c_clk_map_32M[] = {
>> +    {KHZ(100), 7, 14, 18, 40},
>> +    {KHZ(400), 4,  3, 11, 20},
>> +    {KHZ(1000), 4, 3,  6, 15},
>> +};
>> +
>>   static int geni_i2c_clk_map_idx(struct geni_i2c_dev *gi2c)
>>   {
>>       int i;
>>       const struct geni_i2c_clk_fld *itr = geni_i2c_clk_map;
>>   +    if (clk_get_rate(gi2c->se.clk) == MHZ(32))
>> +        itr = geni_i2c_clk_map_32M;
>> +
>>       for (i = 0; i < ARRAY_SIZE(geni_i2c_clk_map); i++, itr++) {
>>           if (itr->clk_freq_out == gi2c->clk_freq_out) {
>>               gi2c->clk_fld = itr;