From patchwork Wed Jan 24 10:01:52 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: 125636 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp354174ljf; Wed, 24 Jan 2018 03:37:41 -0800 (PST) X-Google-Smtp-Source: AH8x226g+CApZX6CgJCV3Y21qdNRqEUisl22SOJO3FZXE+vAV3tkwfmXCLPDqPgw4M8LjSGtjMas X-Received: by 10.80.130.2 with SMTP id 2mr24380245edf.7.1516793861642; Wed, 24 Jan 2018 03:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516793861; cv=none; d=google.com; s=arc-20160816; b=1KumGXHZALm+79igVSVMr5FnJvuYM7yVr+AY3L3yz4CiWhZbcbDfD5gNN3nAwGycQl OnuT/dp4OvHblmKswBBZ27fYIIVwI66Y9DVLF4S2s+hvYXly/4sc28ebR2Fjg4Lyw8N+ Vxqa63hN264RqLNSAI0xiKKsj02xh/si/T1vq101nGV4asURVK71Zeyeat/8ptoHCExG Im/YddEXc+RbWpurQdkaSNJa/jx6ra/bbgG0ld3FK7jsGvHa+Er6IbEGKpDlUXr7j+rt vyFTZ9dCuQ77hK9fHEpdbGblCSC70ZT2XfDUFIiAUbRMVNq/ylzaHo0Su7kmt1FWs+fS Jguw== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=mpPVGKQWMzteZbxCxC39d9mgo/TJC4QwvuQw6HxHNxE=; b=CZtI24Vymzh/dwPx3UFhp9Z/gITwvBe0Cz3VF+Vidp+9HrPc+PfNRV6r/YOsKo7wuJ E+ql2KKEJiNua7xNLrUvF69VGjCQians6RGUu70o4FjnEiUB9NmrOvW66IRDC41At3qB gOvnHgk9yaBnJq2X31C1883/vgmBeGLcwlISWinFebW/B1CggpbEn1G+lj64m3XgrDvp FrPeb3u85sCklqRfNSc7pMVy+AHCdKoUrb/7PJq4W3Wb7HOjxNY3hhCw6rqXhJcRxkiK jxskcLESL/Rl5XTqh7g0vA2m3fypH/c82+pnxGonafsPcGux6uKbox1cTkWsUjg7eQ49 SZIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=P2X1EUqR; 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 i64si85349edd.391.2018.01.24.03.37.41; Wed, 24 Jan 2018 03:37:41 -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=P2X1EUqR; 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 43D45C221D5; Wed, 24 Jan 2018 11:37:40 +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 AA86CC21EC2; Wed, 24 Jan 2018 11:32:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2B29AC21EA7; Wed, 24 Jan 2018 10:03:01 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id C9CE4C21C50 for ; Wed, 24 Jan 2018 10:03:00 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id j21so17260455wmh.1 for ; Wed, 24 Jan 2018 02:03:00 -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:in-reply-to:references; bh=jyoRBMkMdVfw3gTOthoP7unQ6aa8idUXOHstKyZyH4o=; b=P2X1EUqRXHb+EiztcCh+H27z6MnfzosSTELrhKIphhYqQ8MJy5l8vpfxkvg1C3S6mX D4NEaz73siuRkvtH26y8izOkxSppVIVgHsMt67KZVZw0hNhY2N3Yey0y6bZqjEE7gO2c ojMiJNxn9ryrcRjPq0b44bsQLjDkS3c9tAU2qsp6S1Oi/js22IxcItXoRZbqtqFpjBwo hLFL2G97rZc+HqfWinwQqvHscnrbrzavjKUCJMZEWStcfPNZ7C1Ko/3Sx5sBy+Q6ABBC 1UXvLklPKlTAMysbUfGmnnlB5UbzlFb/49aLvbRQZucG3QxJgWFnebn+oMD8iB83BVwN D2dA== 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:in-reply-to :references; bh=jyoRBMkMdVfw3gTOthoP7unQ6aa8idUXOHstKyZyH4o=; b=fO+PEcF0PKw8YfA93r+2eS4EFlKWCkVLDvxb5yd6uC4A+CTq8qIhHWgLJ663dc6GnK UOWV+35+YJg796u9UYSwNzsocRe46p4Vjotn2rWugY0jDvsk1uj+Z5z6GsOmSrAWAa2U lmjn/o0KhpOyPE/Ho2w6dJOoPRTITJICAW9mRZc+HlQEqvb3wtue90o+qEXbNfbtwoac EDuCmpNrx+J8/XtYHQh6ILPYm+g2FO8xjp+1REq2JYL9gbJ4Wco51OvJiO5SXOwxpXJa /HM5snw82EHOQJGPWGpWFLhu+yUnORMQ/E2tZ6JO7poCTYkLjeKF8UJz8uj1NHFDEDYi jqKQ== X-Gm-Message-State: AKwxyteOdsKNnSvauLYtmzhooECkn18mckDIJksMQbPM+rMVU1t+03ZM YLHJ0EdI6pSxjrJvhWHM7vUBGcyF X-Received: by 10.28.239.3 with SMTP id n3mr4627518wmh.88.1516788180189; Wed, 24 Jan 2018 02:03:00 -0800 (PST) Received: from localhost.localdomain ([2001:a61:432:f500:e0ed:3434:d36b:935c]) by smtp.gmail.com with ESMTPSA id m191sm710882wma.42.2018.01.24.02.02.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 02:02:59 -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: Wed, 24 Jan 2018 11:01:52 +0100 Message-Id: <20180124100153.25044-2-nunojpg@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180124100153.25044-1-nunojpg@gmail.com> References: <20180124100153.25044-1-nunojpg@gmail.com> X-Mailman-Approved-At: Wed, 24 Jan 2018 11:32:34 +0000 Cc: Nuno Goncalves Subject: [U-Boot] [PATCH 2/3] sunxi: add DM I2C support for 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" Signed-off-by: Nuno Goncalves --- arch/arm/dts/sun8i-h3.dtsi | 48 ++++++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-sunxi/gpio.h | 2 ++ board/sunxi/board.c | 10 ++++++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/sun8i-h3.dtsi b/arch/arm/dts/sun8i-h3.dtsi index df2742095e..da17dfa579 100644 --- a/arch/arm/dts/sun8i-h3.dtsi +++ b/arch/arm/dts/sun8i-h3.dtsi @@ -396,6 +396,21 @@ drive-strength = <10>; bias-disable; }; + + i2c0_pins_a: i2c0@0 { + pins = "PA11", "PA12"; + function = "i2c0"; + }; + + i2c1_pins_a: i2c1@0 { + pins = "PA18", "PA19"; + function = "i2c1"; + }; + + i2c2_pins_a: i2c2@0 { + pins = "PE12", "PE13"; + function = "i2c2"; + }; }; timer@01c20c00 { @@ -464,6 +479,39 @@ status = "disabled"; }; + i2c0: i2c@01c2ac00 { + compatible = "allwinner,sun6i-a31-i2c"; + reg = <0x01c2ac00 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_I2C0>; + resets = <&ccu RST_BUS_I2C0>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c1: i2c@01c2b000 { + compatible = "allwinner,sun6i-a31-i2c"; + reg = <0x01c2b000 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_I2C1>; + resets = <&ccu RST_BUS_I2C1>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c2: i2c@01c2b400 { + compatible = "allwinner,sun6i-a31-i2c"; + reg = <0x01c2b400 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_I2C2>; + resets = <&ccu RST_BUS_I2C2>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + emac: ethernet@1c30000 { compatible = "allwinner,sun8i-h3-emac"; reg = <0x01c30000 0x104>, <0x01c00030 0x4>; 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/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);