From patchwork Mon May 28 16:10:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 921612 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 40vhgL18Pqz9s1R for ; Tue, 29 May 2018 02:11:24 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6CE8FC21DB5; Mon, 28 May 2018 16:11:20 +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 C33D6C21C27; Mon, 28 May 2018 16:11:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7C8EBC21C27; Mon, 28 May 2018 16:11:16 +0000 (UTC) Received: from mx.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by lists.denx.de (Postfix) with ESMTPS id E9A87C21BE5 for ; Mon, 28 May 2018 16:11:15 +0000 (UTC) Received: from tarshish.tkos.co.il (unknown [10.0.8.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPSA id B0F4144044D; Mon, 28 May 2018 19:11:14 +0300 (IDT) From: Baruch Siach To: Stefan Roese Date: Mon, 28 May 2018 19:10:30 +0300 Message-Id: <7df5b3ba13f226568e53f70d14b040b88a74bde6.1527523830.git.baruch@tkos.co.il> X-Mailer: git-send-email 2.17.0 Cc: u-boot@lists.denx.de, Baruch Siach , Rabeeh Khoury Subject: [U-Boot] [PATCH] arm: mvebu: switch clearfog to use device-tree i2c and gpio 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" From: Jon Nettleton This switches the clearfog boards to use DM based gpio and i2c drivers. The io expanders are configured via their device-tree entries. Signed-off-by: Jon Nettleton [baruch: add DT i2c aliases] Signed-off-by: Baruch Siach Reviewed-by: Chris Packham Reviewed-by: Stefan Roese --- The context lines in this patch depend on the patch adding SATA support. https://patchwork.ozlabs.org/patch/921400/ --- arch/arm/dts/armada-388-clearfog.dts | 2 ++ board/solidrun/clearfog/clearfog.c | 22 ---------------------- configs/clearfog_defconfig | 6 ++++++ include/configs/clearfog.h | 7 ------- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/arch/arm/dts/armada-388-clearfog.dts b/arch/arm/dts/armada-388-clearfog.dts index bc52bc0167d3..a0b566a5ae0e 100644 --- a/arch/arm/dts/armada-388-clearfog.dts +++ b/arch/arm/dts/armada-388-clearfog.dts @@ -62,6 +62,8 @@ ethernet2 = ð1; ethernet3 = ð2; spi1 = &spi1; + i2c0 = &i2c0; + i2c1 = &i2c1; }; chosen { diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index ede303d4ebf9..4e1386c8a223 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -32,22 +32,6 @@ DECLARE_GLOBAL_DATA_PTR; #define BOARD_GPP_POL_LOW 0x0 #define BOARD_GPP_POL_MID 0x0 -/* IO expander on Marvell GP board includes e.g. fan enabling */ -struct marvell_io_exp { - u8 chip; - u8 addr; - u8 val; -}; - -static struct marvell_io_exp io_exp[] = { - { 0x20, 2, 0x40 }, /* Deassert both mini pcie reset signals */ - { 0x20, 6, 0xf9 }, - { 0x20, 2, 0x46 }, /* rst signals and ena USB3 current limiter */ - { 0x20, 6, 0xb9 }, - { 0x20, 3, 0x00 }, /* Set SFP_TX_DIS to zero */ - { 0x20, 7, 0xbf }, /* Drive SFP_TX_DIS to zero */ -}; - static struct serdes_map board_serdes_map[] = { {SATA0, SERDES_SPEED_3_GBPS, SERDES_DEFAULT_MODE, 0, 0}, {SGMII1, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, @@ -126,8 +110,6 @@ int board_early_init_f(void) int board_init(void) { - int i; - /* Address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; @@ -142,10 +124,6 @@ int board_init(void) setbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19)); mdelay(10); - /* Init I2C IO expanders */ - for (i = 0; i < ARRAY_SIZE(io_exp); i++) - i2c_write(io_exp[i].chip, io_exp[i].addr, 1, &io_exp[i].val, 1); - return 0; } diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 3972c31ef978..2baf33701bca 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_TEXT_BASE=0x00800000 +CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 @@ -19,6 +20,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x141 CONFIG_SPL_I2C_SUPPORT=y # CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y @@ -34,6 +36,10 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_SCSI_AHCI=y +CONFIG_DM_GPIO=y +CONFIG_DM_PCA953X=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_MVTWSI=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_MV=y diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index ed6f000db16b..1141aee08b6e 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -21,13 +21,6 @@ * Commands configuration */ -/* I2C */ -#define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_MVTWSI -#define CONFIG_I2C_MVTWSI_BASE0 MVEBU_TWSI_BASE -#define CONFIG_SYS_I2C_SLAVE 0x0 -#define CONFIG_SYS_I2C_SPEED 100000 - /* SPI NOR flash default params, used by sf commands */ #define CONFIG_SF_DEFAULT_BUS 1