From patchwork Fri Jan 19 18:35:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Nuno_Gon=C3=A7alves?= X-Patchwork-Id: 125227 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp45859ljf; Fri, 19 Jan 2018 15:27:32 -0800 (PST) X-Google-Smtp-Source: AH8x227WPOXgPdVT47i3ggU8mQRE5JjdTjLXwFughlybwO96Z00QcwyKd90AyTHHuO2PKEtD/kaB X-Received: by 10.80.148.248 with SMTP id t53mr769420eda.180.1516404452426; Fri, 19 Jan 2018 15:27:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516404452; cv=none; d=google.com; s=arc-20160816; b=L5b0h4rmnyTnrNAnDaUejjd3GF+Uri1PInWUlZvfqIOpCGMtE8cA4YEIlCXds1iiGP tZ2XDAz8Kqg7C++q1jGHgl5DbnDQ703nX6N4wVIi8AhQCxcVCanoWnms+Tz64fhYy0Yr y9xYG5birk/rtod+molefYTjpE8q0MaJOnaE6WXCtwM3nJSECS8bp8ys2rrevDjX9ghY H+EOddYiljaxMx3bVsBXETluKoQ59meyKKBPgIhk1oNa+YVyQuoUfbh920INYSUokyKD VBEQwGoSrvlGIoKYgBe3L0f0Zh9/9ryf9BPs9v4MTUso0LO16XW+Wq6U1w4F7oOyQQf+ 8fcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=F8p0UpN4MKqhaU/aZeyLBlKGFR5Bzyb1fyu6s/E/SB4=; b=QM7sif07QEQqYOUKXsjfm6B2uCghN/mC4vD771AtVG21whOtv/vRIEjm0kFGmXRpc6 NAPf81iCXNQr3u4zbpeFR49qw0BGnh1MjeojSPDzIOxYKWUWoZf+NOJpFXs2Q1ArJFir ylSAk4JXXGDMlg+LsS531dUgprtIJOoe1d3Yu2s9ko4rIG9yPSV26Qo21klhrA1i1/bU +lgSQ0LISox78Csze602uek1j2gWE6ruGOmmx0B3la/7Yzs2mEt/TbSUmuaqChbX3qqC dHOBoo4x5HTJ0J/LtQYE3tP07gn3mX45PxRxg4KUXavEw4529uwT3O+r3oxkzfcs4OHe /lUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=MQXd4X6d; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 93si1103603edl.231.2018.01.19.15.27.31; Fri, 19 Jan 2018 15:27:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=MQXd4X6d; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: by lists.denx.de (Postfix, from userid 105) id B3A54C21FA0; Fri, 19 Jan 2018 23:27:29 +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=FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID 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 AA92BC21F38; Fri, 19 Jan 2018 23:27:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 09D04C21F03; Fri, 19 Jan 2018 18:36:49 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id A5A20C21EF3 for ; Fri, 19 Jan 2018 18:36:49 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id t74so5223924wme.3 for ; Fri, 19 Jan 2018 10:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ylbWINY57Qq2tzBcxnCynbJ4683MKPdHW0H0M0BCoaA=; b=MQXd4X6dzkxSPpb/CqnAxDtbxQqQYObNlq0ARxU9yFHpKjcCRHSjBmVFEC8YCM+hrn 1Ub29mKwnbMRd0sGvvHWTc83Plm+30jxmHeWPdsUGD2y8gT3alpSHCA1uhB97lQNpZcJ CDLNW7K3wMvsFX1lfeQ/vgW0YrCg2pGf1Luy63XMRD6fjpkGt9xKIjjhQBCrW6f/BX7Y E+a2BFCvZVnwUFULLJT6pztF+9D8CLU/bV+sLMTIgS9+aje91yN34o6JJu2mjhP9TaEP K5iMU7/J4Kfd8CyEKxj0RjHFIKs2SSY/IJ0i8eQ87PT3R624lDc+WmhrkRcy+tPdrVcM hIKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ylbWINY57Qq2tzBcxnCynbJ4683MKPdHW0H0M0BCoaA=; b=tJCSvyVNcCR6GcwV/JtT42uu7WQb+B4JQYpRj3kXMJkcWvMXUcb/0q8UMZNah3WDp9 UpLjyfx+9XKZgmZBlt5Nd42MSb+F/SxnaIMzkCX9evDE0mgWd4RpvTatUPjHViUk/NV8 hdO8i1UvJHFa2zH0QvxFjFF52iYXaKbFsvZSaAG/rMpFbAkfEn1dQfYIodwgrroVKrKn RlEHBXmeMoIobQgDmZWlBcPT6Ls22TRGsZ6A63aDB0hYhkdCUWLXJPAEWEhc9/48tvdd ehJjqHZ7vX6kqiCrGN4lJks3N2+x4mkVteH7CxfNzESWPwCFl1kHquKyQkT+e1YILRWu S1uw== X-Gm-Message-State: AKwxyteodYc7j4GIhR0rrUUKJVPErRMe5jNqgCqO7SM2vdzhWmuvty5/ DXf5MsmdW+ejkSjw8N9IlL3sMvMR X-Received: by 10.28.113.150 with SMTP id d22mr8317099wmi.127.1516387008792; Fri, 19 Jan 2018 10:36:48 -0800 (PST) Received: from localhost.localdomain ([2001:a61:400:7e00:2c4c:5805:df3c:fcc4]) by smtp.gmail.com with ESMTPSA id k17sm7529982wrf.17.2018.01.19.10.36.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2018 10:36:46 -0800 (PST) From: Nuno Goncalves To: u-boot@lists.denx.de, jernej.skrabec@siol.net, maxime.ripard@free-electrons.com, contact@paulk.fr, hdegoede@redhat.com Date: Fri, 19 Jan 2018 19:35:59 +0100 Message-Id: <20180119183559.14430-1-nunojpg@gmail.com> X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Fri, 19 Jan 2018 23:27:25 +0000 Cc: Nuno Goncalves Subject: [U-Boot] [PATCH 1/2] sunxi: fix i2c support for sunxi H3/H5 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" Tested to work in a Orange Pi Zero (H2+/H3), and checked against H5 datasheet. Signed-off-by: Nuno Goncalves Acked-by: Maxime Ripard --- arch/arm/include/asm/arch-sunxi/gpio.h | 2 ++ arch/arm/mach-sunxi/Kconfig | 1 - board/sunxi/board.c | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h index 24f85206c8..52884886d7 100644 --- a/arch/arm/include/asm/arch-sunxi/gpio.h +++ b/arch/arm/include/asm/arch-sunxi/gpio.h @@ -149,6 +149,8 @@ enum sunxi_gpio_number { #define SUN6I_GPA_SDC2 5 #define SUN6I_GPA_SDC3 4 #define SUN8I_H3_GPA_UART0 2 +#define SUN8I_H3_H5_GPA_TWI0 2 +#define SUN8I_H3_H5_GPA_TWI1 3 #define SUN4I_GPB_PWM 2 #define SUN4I_GPB_TWI0 2 diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 1fededd0a3..a2a8599165 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -56,7 +56,6 @@ endif config MACH_SUNXI_H3_H5 bool - select DM_I2C select SUNXI_DE2 select SUNXI_DRAM_DW select SUNXI_DRAM_DW_32BIT diff --git a/board/sunxi/board.c b/board/sunxi/board.c index dcacdf3e62..6b55aef202 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -93,6 +93,10 @@ void i2c_init_board(void) sunxi_gpio_set_cfgpin(SUNXI_GPH(14), SUN6I_GPH_TWI0); sunxi_gpio_set_cfgpin(SUNXI_GPH(15), SUN6I_GPH_TWI0); clock_twi_onoff(0, 1); +#elif defined(CONFIG_MACH_SUNXI_H3_H5) + sunxi_gpio_set_cfgpin(SUNXI_GPA(11), SUN8I_H3_H5_GPA_TWI0); + sunxi_gpio_set_cfgpin(SUNXI_GPA(12), SUN8I_H3_H5_GPA_TWI0); + clock_twi_onoff(0, 1); #elif defined(CONFIG_MACH_SUN8I) sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN8I_GPH_TWI0); sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN8I_GPH_TWI0); @@ -115,6 +119,10 @@ void i2c_init_board(void) sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1); sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1); clock_twi_onoff(1, 1); +#elif defined(CONFIG_MACH_SUNXI_H3_H5) + sunxi_gpio_set_cfgpin(SUNXI_GPA(18), SUN8I_H3_H5_GPA_TWI1); + sunxi_gpio_set_cfgpin(SUNXI_GPA(19), SUN8I_H3_H5_GPA_TWI1); + clock_twi_onoff(1, 1); #elif defined(CONFIG_MACH_SUN8I) sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1); sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1); @@ -137,7 +145,7 @@ void i2c_init_board(void) sunxi_gpio_set_cfgpin(SUNXI_GPH(18), SUN6I_GPH_TWI2); sunxi_gpio_set_cfgpin(SUNXI_GPH(19), SUN6I_GPH_TWI2); clock_twi_onoff(2, 1); -#elif defined(CONFIG_MACH_SUN8I) +#elif defined(CONFIG_MACH_SUN8I) /* same for CONFIG_MACH_SUNXI_H3_H5 */ sunxi_gpio_set_cfgpin(SUNXI_GPE(12), SUN8I_GPE_TWI2); sunxi_gpio_set_cfgpin(SUNXI_GPE(13), SUN8I_GPE_TWI2); clock_twi_onoff(2, 1);