From c5834d97d14426c6459481f1587dfba9f546c9d6 Mon Sep 17 00:00:00 2001 From: Jian Hu Date: Wed, 14 Mar 2018 17:43:16 +0800 Subject: [PATCH] i2c: fix writing w_token reg error PD#161535: i2c: fix writing w_token reg error 1.fix writing w_token reg error 2.set default clock frequency 100khz 3.config i2c1 pinmux and change clock frequency to 300k Change-Id: I9b3fe3ed404255e3897d7353c57770a6019e6f9b Signed-off-by: Jian Hu --- arch/arm64/boot/dts/amlogic/mesontxlx.dtsi | 7 ++++++- arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts | 7 +++++++ drivers/amlogic/i2c/i2c-meson-master.c | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/mesontxlx.dtsi b/arch/arm64/boot/dts/amlogic/mesontxlx.dtsi index 3328300..45077bc 100644 --- a/arch/arm64/boot/dts/amlogic/mesontxlx.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesontxlx.dtsi @@ -567,6 +567,7 @@ #size-cells = <0>; clocks = <&clkc CLKID_I2C>; clock-names = "clk_i2c"; + clock-frequency = <100000>; }; i2c1: i2c@1e000 { @@ -579,6 +580,7 @@ #size-cells = <0>; clocks = <&clkc CLKID_I2C>; clock-names = "clk_i2c"; + clock-frequency = <100000>; }; i2c2: i2c@1d000 { @@ -591,6 +593,7 @@ #size-cells = <0>; clocks = <&clkc CLKID_I2C>; clock-names = "clk_i2c"; + clock-frequency = <100000>; }; i2c3: i2c@1c000 { @@ -603,6 +606,7 @@ #size-cells = <0>; clocks = <&clkc CLKID_I2C>; clock-names = "clk_i2c"; + clock-frequency = <100000>; }; pwm_ab: pwm@1b000 { @@ -738,6 +742,7 @@ #size-cells = <0>; clocks = <&clkc CLKID_I2C>; clock-names = "clk_i2c"; + clock-frequency = <100000>; }; aoclkc: clock-controller@0 { @@ -1107,7 +1112,7 @@ i2c1_dv_pins:i2c1_z { mux { groups = "i2c1_sda", - "i2c2_sck"; + "i2c1_sck"; function = "i2c1"; }; }; diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts index 1dd426a..2e9ef1a 100644 --- a/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts +++ b/arch/arm64/boot/dts/amlogic/txlx_t962e_r321.dts @@ -1375,6 +1375,13 @@ }; }; +&i2c1 { + status = "okay"; + clock-frequency = <300000>; + pinctrl-names="default"; + pinctrl-0=<&i2c1_dv_pins>; +}; + &pinctrl_periphs { /*i2s*/ aml_audio_i2s: aml_audio_i2s { diff --git a/drivers/amlogic/i2c/i2c-meson-master.c b/drivers/amlogic/i2c/i2c-meson-master.c index ae4ba75..ed651db 100644 --- a/drivers/amlogic/i2c/i2c-meson-master.c +++ b/drivers/amlogic/i2c/i2c-meson-master.c @@ -273,7 +273,7 @@ static void meson_i2c_put_data(struct meson_i2c *i2c, char *buf, int len) wdata1 |= *buf++ << ((i - 4) * 8); writel(wdata0, i2c->regs + REG_TOK_WDATA0); - writel(wdata0, i2c->regs + REG_TOK_WDATA1); + writel(wdata1, i2c->regs + REG_TOK_WDATA1); dev_dbg(i2c->dev, "%s: data %08x %08x len %d\n", __func__, wdata0, wdata1, len); -- 2.7.4