lkml.org 
[lkml]   [2023]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/8] i2c: sprd: Add configurations that support 1Mhz and 3.4Mhz frequencies
From
Le 17/08/2023 à 11:45, Huangzheng Lai a écrit :
> This patch adds I2C controller driver support for 1Mhz and 3.4Mhz
> frequency configurations.
> @@ -347,6 +347,10 @@ static void sprd_i2c_set_clk(struct sprd_i2c *i2c_dev, u32 freq)
> writel((6 * apb_clk) / 10000000, i2c_dev->base + ADDR_STA0_DVD);
> else if (freq == I2C_MAX_STANDARD_MODE_FREQ)
> writel((4 * apb_clk) / 1000000, i2c_dev->base + ADDR_STA0_DVD);
> + else if (freq == I2C_MAX_FAST_MODE_PLUS_FREQ)
> + writel((8 * apb_clk) / 10000000, i2c_dev->base + ADDR_STA0_DVD);
> + else if (freq == I2C_MAX_HIGH_SPEED_MODE_FREQ)
> + writel((8 * apb_clk) / 10000000, i2c_dev->base + ADDR_STA0_DVD);
> }

Maybe using a switch case could be beneficial to readability instead of
a series of if / else if ?

--

Yann

\
 
 \ /
  Last update: 2023-08-17 16:08    [W:3.105 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site