From patchwork Sun May 27 15:25:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 921157 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=tkos.co.il Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40v3kf5XZcz9s0q for ; Mon, 28 May 2018 01:27:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B52D7C21DFA; Sun, 27 May 2018 15:26:58 +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 43D5AC21C27; Sun, 27 May 2018 15:26:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EB9B7C21C27; Sun, 27 May 2018 15:26:54 +0000 (UTC) Received: from mx.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by lists.denx.de (Postfix) with ESMTPS id 7134EC21BE5 for ; Sun, 27 May 2018 15:26:54 +0000 (UTC) Received: from sapphire.tkos.co.il (unknown [10.0.4.3]) by mx.tkos.co.il (Postfix) with ESMTPA id 2E6D64402B3; Sun, 27 May 2018 18:26:53 +0300 (IDT) From: Baruch Siach To: Prafulla Wadaskar , Luka Perkov , Stefan Roese Date: Sun, 27 May 2018 18:25:46 +0300 Message-Id: <9accb099dc87fd17cd6c352c7df1c7e55cd2a838.1527434746.git.baruch@tkos.co.il> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Cc: u-boot@lists.denx.de, Baruch Siach , Rabeeh Khoury Subject: [U-Boot] [PATCH] arm: mvebu: move i2c slave disable to generic SPL code 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The hidden i2c slave that interferes the i2c bus is not board specific. All Armada 38x SoCs are affected. Move the code disabling this slave to generic code to make it work on all affected hardware. Cc: Marek BehĂșn Cc: Rabeeh Khoury Signed-off-by: Baruch Siach --- arch/arm/mach-mvebu/spl.c | 16 ++++++++++++++++ board/CZ.NIC/turris_omnia/turris_omnia.c | 9 --------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 50b24f5760b7..cbd900fee5d1 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -8,10 +8,13 @@ #include #include #include +#include #include #include #include +#define MVTWSI_ARMADA_DEBUG_REG 0x8c + static u32 get_boot_device(void) { u32 val; @@ -69,10 +72,23 @@ u32 spl_boot_device(void) return get_boot_device(); } +static void disable_i2c_slave(void) +{ + u32 i2c_debug_reg; + + /* Disable I2C debug mode blocking 0x64 I2C address */ + i2c_debug_reg = readl(MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG); + i2c_debug_reg &= ~BIT(18); + writel(i2c_debug_reg, MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG); +} + void board_init_f(ulong dummy) { int ret; + if (IS_ENABLED(CONFIG_ARMADA_38X)) + disable_i2c_slave(); + /* * Pin muxing needs to be done before UART output, since * on A38x the UART pins need some re-muxing for output diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index da663cf1bb0c..044c959d1b13 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -50,8 +50,6 @@ DECLARE_GLOBAL_DATA_PTR; #define OMNIA_ATSHA204_OTP_MAC0 3 #define OMNIA_ATSHA204_OTP_MAC1 4 -#define MVTWSI_ARMADA_DEBUG_REG 0x8c - /* * Those values and defines are taken from the Marvell U-Boot version * "u-boot-2013.01-2014_T3.0" @@ -297,8 +295,6 @@ static int set_regdomain(void) int board_early_init_f(void) { - u32 i2c_debug_reg; - /* Configure MPP */ writel(0x11111111, MVEBU_MPP_BASE + 0x00); writel(0x11111111, MVEBU_MPP_BASE + 0x04); @@ -321,11 +317,6 @@ int board_early_init_f(void) writel(OMNIA_GPP_OUT_ENA_LOW, MVEBU_GPIO0_BASE + 0x04); writel(OMNIA_GPP_OUT_ENA_MID, MVEBU_GPIO1_BASE + 0x04); - /* Disable I2C debug mode blocking 0x64 I2C address */ - i2c_debug_reg = readl(MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG); - i2c_debug_reg &= ~(1<<18); - writel(i2c_debug_reg, MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG); - return 0; }