File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -137,23 +137,25 @@ struct mss_i2c_data {
137
137
};
138
138
139
139
140
- static int mss_i2c_configure (const struct device * dev , uint32_t dev_config_raw )
140
+ static int mss_i2c_configure (const struct device * dev , uint32_t dev_config )
141
141
{
142
142
const struct mss_i2c_config * cfg = dev -> config ;
143
-
144
143
uint8_t ctrl = sys_read8 (cfg -> i2c_base_addr + CORE_I2C_CTRL );
145
144
146
- switch (I2C_SPEED_GET (dev_config_raw )) {
145
+ ctrl &= ~CLK_MASK ;
146
+
147
+ switch (I2C_SPEED_GET (dev_config )) {
147
148
case I2C_SPEED_STANDARD :
148
- sys_write8 (( ctrl | PCLK_DIV_960 ), cfg -> i2c_base_addr + CORE_I2C_CTRL ) ;
149
+ ctrl |= PCLK_DIV_960 ;
149
150
break ;
150
151
case I2C_SPEED_FAST :
151
- sys_write8 (( ctrl | PCLK_DIV_256 ), cfg -> i2c_base_addr + CORE_I2C_CTRL ) ;
152
+ ctrl |= PCLK_DIV_256 ;
152
153
break ;
153
154
default :
154
155
return - EINVAL ;
155
156
}
156
157
158
+ sys_write8 (ctrl , cfg -> i2c_base_addr + CORE_I2C_CTRL );
157
159
return 0 ;
158
160
}
159
161
You can’t perform that action at this time.
0 commit comments