From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko =?ISO-8859-1?Q?St=FCbner?= Date: Fri, 24 Mar 2017 08:32:54 +0100 Subject: [U-Boot] [PATCH 6/8] rockchip: rk3188: Switch to new i2c IP blocks In-Reply-To: References: <20170320114036.21475-1-heiko@sntech.de> <20170320114036.21475-7-heiko@sntech.de> Message-ID: <2357013.395ksi81Ae@diego> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de Am Donnerstag, 23. M=C3=A4rz 2017, 21:28:08 CET schrieb Simon Glass: > Hi Heiko, >=20 > On 20 March 2017 at 05:40, Heiko Stuebner wrote: > > The rk3066/rk3188 introduced new i2c IP blocks but kept the old ones > > around just in case. The default also points to these old controllers. > >=20 > > The "new" blocks proved stable and nobody ever used the old ones anywhe= re, > > not in the kernel and not in U-Boot, so to be able to reuse the already > > existing driver make the rk3188 switch to the new ones in U-Boot as wel= l. > >=20 > > Signed-off-by: Heiko Stuebner > > --- > >=20 > > arch/arm/mach-rockchip/rk3188-board-spl.c | 21 +++++++++++++++++++++ > > 1 file changed, 21 insertions(+) > >=20 > > diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c > > b/arch/arm/mach-rockchip/rk3188-board-spl.c index affd959f86..14847a7b1b > > 100644 > > --- a/arch/arm/mach-rockchip/rk3188-board-spl.c > > +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c > > @@ -17,6 +17,7 @@ > >=20 > > #include > > #include > > #include > >=20 > > +#include > >=20 > > #include > > #include > > #include > >=20 > > @@ -102,6 +103,7 @@ void board_init_f(ulong dummy) > >=20 > > { > > =20 > > struct udevice *pinctrl, *dev; > > struct rk3188_pmu *pmu; > >=20 > > + struct rk3188_grf *grf; > >=20 > > int ret; > > =20 > > /* Example code showing how to enable the debug UART on RK3188 = */ > >=20 > > @@ -154,6 +156,25 @@ void board_init_f(ulong dummy) > >=20 > > error("pmu syscon returned %ld\n", PTR_ERR(pmu)); > > =20 > > SAVE_SP_ADDR =3D readl(&pmu->sys_reg[2]); > >=20 > > + /* init common grf settings */ > > + grf =3D syscon_get_first_range(ROCKCHIP_SYSCON_GRF); > > + if (IS_ERR(grf)) { > > + error("grf syscon returned %ld\n", PTR_ERR(grf)); > > + } else { > > + /* make i2c controllers use the new IP */ > > + rk_clrsetreg(&grf->soc_con1, > > + RKI2C4_SEL_MASK << RKI2C4_SEL_SHIFT | > > + RKI2C3_SEL_MASK << RKI2C3_SEL_SHIFT | > > + RKI2C2_SEL_MASK << RKI2C2_SEL_SHIFT | > > + RKI2C1_SEL_MASK << RKI2C1_SEL_SHIFT | > > + RKI2C0_SEL_MASK << RKI2C0_SEL_SHIFT, > > + RKI2C4_SEL_MASK << RKI2C4_SEL_SHIFT | > > + RKI2C3_SEL_MASK << RKI2C3_SEL_SHIFT | > > + RKI2C2_SEL_MASK << RKI2C2_SEL_SHIFT | > > + RKI2C1_SEL_MASK << RKI2C1_SEL_SHIFT | > > + RKI2C0_SEL_MASK << RKI2C0_SEL_SHIFT); > > + } >=20 > Can you move this to the pinctrl driver? Are you sure that is the right approach? This setting switches the i2c controller IP block used, while the i2c-pins = are=20 not affected by this at all. You could also use the i2c pins with the other= =20 i2c controller with the same pinctrl settings, so it feels a tiny bit stran= ge=20 to burden the pinctrl driver with this. Heiko