From patchwork Mon Mar 20 11:40:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Stuebner X-Patchwork-Id: 740963 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3vmvHN2Ppsz9s1y for ; Mon, 20 Mar 2017 22:44:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 030FFC21C2C; Mon, 20 Mar 2017 11:42:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2B1B1C21C7C; Mon, 20 Mar 2017 11:41:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 38A72C21C36; Mon, 20 Mar 2017 11:41:38 +0000 (UTC) Received: from gloria.sntech.de (gloria.sntech.de [95.129.55.99]) by lists.denx.de (Postfix) with ESMTPS id C442CC21C52 for ; Mon, 20 Mar 2017 11:41:37 +0000 (UTC) Received: from p5b127f1d.dip0.t-ipconnect.de ([91.18.127.29] helo=phil.lan) by gloria.sntech.de with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1cpvgt-0003XX-Qt; Mon, 20 Mar 2017 12:41:35 +0100 From: Heiko Stuebner To: sjg@chromium.org Date: Mon, 20 Mar 2017 12:40:34 +0100 Message-Id: <20170320114036.21475-7-heiko@sntech.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170320114036.21475-1-heiko@sntech.de> References: <20170320114036.21475-1-heiko@sntech.de> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 6/8] rockchip: rk3188: Switch to new i2c IP blocks X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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. The "new" blocks proved stable and nobody ever used the old ones anywhere, 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 well. Signed-off-by: Heiko Stuebner --- arch/arm/mach-rockchip/rk3188-board-spl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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 @@ #include #include #include +#include #include #include #include @@ -102,6 +103,7 @@ void board_init_f(ulong dummy) { struct udevice *pinctrl, *dev; struct rk3188_pmu *pmu; + struct rk3188_grf *grf; int ret; /* Example code showing how to enable the debug UART on RK3188 */ @@ -154,6 +156,25 @@ void board_init_f(ulong dummy) error("pmu syscon returned %ld\n", PTR_ERR(pmu)); SAVE_SP_ADDR = readl(&pmu->sys_reg[2]); + /* init common grf settings */ + grf = 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); + } + ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); if (ret) { debug("Pinctrl init failed: %d\n", ret);