From patchwork Fri Dec 7 09:15:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ronny Lubke X-Patchwork-Id: 1009394 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=metirionic.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=metirionic.onmicrosoft.com header.i=@metirionic.onmicrosoft.com header.b="H30m/y/f"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43BBPv13trz9s1c for ; Fri, 7 Dec 2018 23:20:34 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id AF0E3C2206E; Fri, 7 Dec 2018 12:20:01 +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=SPF_HELO_PASS, 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 454A8C226E7; Fri, 7 Dec 2018 12:19:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 575C8C21E6C; Fri, 7 Dec 2018 09:15:54 +0000 (UTC) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00125.outbound.protection.outlook.com [40.107.0.125]) by lists.denx.de (Postfix) with ESMTPS id F0B88C21E56 for ; Fri, 7 Dec 2018 09:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metirionic.onmicrosoft.com; s=selector1-metirionic-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WiovgePpUbFIK6gvwuzIUCmFAtkdgB4Himd+ZBGciCY=; b=H30m/y/fWH9pKPicqny+Ei5cFp4YjvAPSJ0wDhPbY1GEVMU88AFkbVHvNyJa+4Nh43P1wjQvWkX3u8rrIfs+D04mdyyRz/kQM4SkGfXvVSyILkaIyfUVOfwBJHmt5dZ23aDTf8BRZ+85BBXUdHBhIOzG1VlVth80q/82+ezNLkg= Received: from HE1PR08MB1163.eurprd08.prod.outlook.com (10.166.96.11) by HE1PR08MB1004.eurprd08.prod.outlook.com (10.166.125.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.20; Fri, 7 Dec 2018 09:15:51 +0000 Received: from HE1PR08MB1163.eurprd08.prod.outlook.com ([fe80::b0e9:d655:1005:36d1]) by HE1PR08MB1163.eurprd08.prod.outlook.com ([fe80::b0e9:d655:1005:36d1%2]) with mapi id 15.20.1404.021; Fri, 7 Dec 2018 09:15:51 +0000 From: Ronny Lubke To: "u-boot@lists.denx.de" Thread-Topic: [U-Boot] [Patch] Enable I2C0 of NanoPiNeo2 Thread-Index: AQHUjg1yoY7DPjMxuUWEtbxl4whhsg== Date: Fri, 7 Dec 2018 09:15:51 +0000 Message-ID: <48205673-cd75-6f48-f85c-e924a7e38b38@metirionic.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR0102CA0013.eurprd01.prod.exchangelabs.com (2603:10a6:209:14::26) To HE1PR08MB1163.eurprd08.prod.outlook.com (2a01:111:e400:7b85::11) authentication-results: spf=none (sender IP is ) smtp.mailfrom=ronny.lubke@metirionic.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [80.155.149.82] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR08MB1004; 6:d3xWap003DiQnMbR4DJ86MJMj9QJxtmt5mOHr3Soku1zfMQTOE+wDsTGBG5jgx5Co7heT23br+DhJ1sPOMSUCAijSxLsp6gzc4xY3kn68T9+/yhJlX74RO7Cj9ldSuJ8w7XUvYksKKB9fsrz7C+n8QOV7j/xt+cSzzzOf8zFxDneDP2ovhYP4Tr5VNzDTN+fs1AbaXJ9+kc32QYhSS6WO4w3GmRp1A1nwv4xA/WpNrqJaEhxVPDU08ssl+ZG+GIMkZOk1i+ww20EevJp0B3i3GmZx043TmJOoYb5++UyL2hLLGRzaaWqsHbJKeKuAqnI1CDvlSTWFYcQk/TQSzwZk0AWw/ANh5T+1zFR2WOrKIQym4GxB09XjNe+MRJDgvTbbR+8ThxcRYajWf3wMUYbvDMiEiV6uoz2h3cYTsg53b4hXJgSbPV+61EHvW5hE0aChtOnfeOxCrDzhFYLFKOIaQ==; 5:FtOKibd6oNqNNXjvkjz/EhKyOutKNx1wAwETTEkWSVGTOCJiRLhQ9+pRdCQaFP1pPeidxP9GAzhsPtYOkAG9ERtvGTfY5pw11rW8UmXwNRKKR1TMrCJR1Qdq/81IJjwxn6KjoKz+5CmFXlRI+TcuEVGbGfG7GStX24gpVMN+0aQ=; 7:QvLHFrLPLq+3mxTmIse7oXvQquYpcUUmwUJFgjwPhaQnz3XQTrb5M+bwDNi+7gsM3rDWfUrW4sfpI0ZaKb1KTAKz+ulvos3jaRxNDgTq86CuM0Ra+UD/XUfwnyiqa0JGKKwUs63XJdP0BOnwHLn5bg== x-ms-office365-filtering-correlation-id: 17ee3bf3-2556-4f3f-9f67-08d65c2494ea x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(7021145)(8989299)(5600074)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(49563074)(7193020); SRVR:HE1PR08MB1004; x-ms-traffictypediagnostic: HE1PR08MB1004: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(102415395)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231455)(999002)(944501520)(4983020)(4982022)(52105112)(148016)(149066)(150057)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6043046)(201708071742011)(7699051)(76991095); SRVR:HE1PR08MB1004; BCL:0; PCL:0; RULEID:; SRVR:HE1PR08MB1004; x-forefront-prvs: 0879599414 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6029001)(346002)(366004)(136003)(39830400003)(396003)(376002)(189003)(199004)(106356001)(26005)(186003)(2351001)(6486002)(25786009)(31686004)(6916009)(486006)(2501003)(105586002)(2616005)(52116002)(44832011)(31696002)(476003)(99286004)(66066001)(8936002)(36756003)(81156014)(8676002)(81166006)(99936001)(6306002)(6512007)(5640700003)(6436002)(102836004)(53936002)(386003)(6506007)(256004)(86362001)(5660300001)(7736002)(14454004)(68736007)(97736004)(71200400001)(71190400001)(508600001)(305945005)(6116002)(3846002)(966005)(316002)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR08MB1004; H:HE1PR08MB1163.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: metirionic.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 921R+p4fhdGwBgw1ju3ulSyubdh6vgrMzMCUqJJgLWuLL3eFmo4vD4m1MQ6VA5pL8x8WWde70xS2Kvbake3CoUhHtvt/a/P5YL6++KFr+6z8pxe9HDB5qMYXHL5HRc2XcGMXLckRqMJpOm4kU0GCXaqq+QESs6mnO5y9Gffi+P6hFgL80uZ1/b/uEXS2DndZzzJIQ3B/Ki4BR0xyTgJS+vDbyfFgqTg0VTKaa/Xr8NA6ubHrzKSmD38STjUXmV2F1uDQpL+erZssK+P9bcnAxjnroHBMfy3WXUzZo5yszq54EOqm3BwFjkpYJ87Ss7iTEZOzSXXes45fTld9pBi3B0o9iSv1fc+ttR5cVv7xby4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: metirionic.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17ee3bf3-2556-4f3f-9f67-08d65c2494ea X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Dec 2018 09:15:51.2871 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 676478f6-6738-42fb-8855-d923251096e2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB1004 X-Mailman-Approved-At: Fri, 07 Dec 2018 12:19:39 +0000 Subject: [U-Boot] [Patch] Enable I2C0 of NanoPiNeo2 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" For getting the I2C0 bus working in u-boot, the used PINS had to be enabled in the board.c. In the nanopi_neo2_defconfig you have to set the CONFIG_I2C0_ENABLE=y. Best regards Ronny Lubke ------------------------------------- Engineer Metirionic GmbH Strehlener Straße 12 - 14 01069 Dresden phone: +49-351-873229-26 http://www.metirionic.com/ Geschaeftsfuehrung: Dr. Attila Roemer Gesellschaftssitz: Dresden Amtsgericht: Dresden HRB 32209 diff --git a/arch/arm/dts/sun50i-h5-nanopi-neo2.dts b/arch/arm/dts/sun50i-h5-nanopi-neo2.dts index cc268a6978..d25d38f742 100644 --- a/arch/arm/dts/sun50i-h5-nanopi-neo2.dts +++ b/arch/arm/dts/sun50i-h5-nanopi-neo2.dts @@ -52,6 +52,7 @@ aliases { ethernet0 = &emac; serial0 = &uart0; + i2c0 = &i2c0; }; chosen { @@ -125,6 +126,12 @@ }; }; +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "okay"; +}; + &mmc0 { vmmc-supply = <®_vcc3v3>; bus-width = <4>; diff --git a/board/sunxi/board.c b/board/sunxi/board.c index b196d48674..2a8391dc74 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -94,10 +94,15 @@ 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_GPH_TWI0); + sunxi_gpio_set_cfgpin(SUNXI_GPA(12), SUN8I_GPH_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); clock_twi_onoff(0, 1); + #endif #endif diff --git a/configs/nanopi_neo2_defconfig b/configs/nanopi_neo2_defconfig index ee693be1a8..bbdac43b66 100644 --- a/configs/nanopi_neo2_defconfig +++ b/configs/nanopi_neo2_defconfig @@ -13,3 +13,8 @@ CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-nanopi-neo2" CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y + +# enable I2C0 +CONFIG_I2C0_ENABLE=y +# enable i2c u-boot command prompt for testing +CONFIG_CMD_I2C=y