Commit 463a9215 authored by Pierre-Yves MORDRET's avatar Pierre-Yves MORDRET Committed by Wolfram Sang

i2c: stm32f7: fix setup structure

I2C drive setup structure is not properly allocated.
Make it static instead of pointer to store driver data.

Fixes: aeb068c5 ("i2c: i2c-stm32f7: add driver")
Signed-off-by: default avatarPierre-Yves MORDRET <pierre-yves.mordret@st.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 9e66317d
...@@ -215,7 +215,7 @@ struct stm32f7_i2c_dev { ...@@ -215,7 +215,7 @@ struct stm32f7_i2c_dev {
unsigned int msg_num; unsigned int msg_num;
unsigned int msg_id; unsigned int msg_id;
struct stm32f7_i2c_msg f7_msg; struct stm32f7_i2c_msg f7_msg;
struct stm32f7_i2c_setup *setup; struct stm32f7_i2c_setup setup;
struct stm32f7_i2c_timings timing; struct stm32f7_i2c_timings timing;
}; };
...@@ -537,7 +537,7 @@ static void stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev) ...@@ -537,7 +537,7 @@ static void stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev)
writel_relaxed(timing, i2c_dev->base + STM32F7_I2C_TIMINGR); writel_relaxed(timing, i2c_dev->base + STM32F7_I2C_TIMINGR);
/* Enable I2C */ /* Enable I2C */
if (i2c_dev->setup->analog_filter) if (i2c_dev->setup.analog_filter)
stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1,
STM32F7_I2C_CR1_ANFOFF); STM32F7_I2C_CR1_ANFOFF);
else else
...@@ -887,22 +887,19 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) ...@@ -887,22 +887,19 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
} }
setup = of_device_get_match_data(&pdev->dev); setup = of_device_get_match_data(&pdev->dev);
i2c_dev->setup->rise_time = setup->rise_time; i2c_dev->setup = *setup;
i2c_dev->setup->fall_time = setup->fall_time;
i2c_dev->setup->dnf = setup->dnf;
i2c_dev->setup->analog_filter = setup->analog_filter;
ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns", ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns",
&rise_time); &rise_time);
if (!ret) if (!ret)
i2c_dev->setup->rise_time = rise_time; i2c_dev->setup.rise_time = rise_time;
ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-falling-time-ns", ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-falling-time-ns",
&fall_time); &fall_time);
if (!ret) if (!ret)
i2c_dev->setup->fall_time = fall_time; i2c_dev->setup.fall_time = fall_time;
ret = stm32f7_i2c_setup_timing(i2c_dev, i2c_dev->setup); ret = stm32f7_i2c_setup_timing(i2c_dev, &i2c_dev->setup);
if (ret) if (ret)
goto clk_free; goto clk_free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment