From patchwork Thu Sep 3 05:07:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1356315 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm3 header.b=buHTSW+5; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=soUNU+zi; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bhpk04dbHz9sTR for ; Thu, 3 Sep 2020 15:08:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B8046822FB; Thu, 3 Sep 2020 07:07:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="buHTSW+5"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="soUNU+zi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5B11B822E1; Thu, 3 Sep 2020 07:07:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AF853822D8 for ; Thu, 3 Sep 2020 07:07:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6D2045C0190; Thu, 3 Sep 2020 01:07:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 03 Sep 2020 01:07:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=U4jA0nvRK7Czr dgeNIS5gDY5tElSJ2feLLbT7NYhO6s=; b=buHTSW+5/tt6GjGA2vOU6Ivto0Cdk fngE70LZVaDreoNlTLgMANhhiJzWyBYb3mjmMUR2EHBJeYNdzuOYpRL/hBztVsqa B+hq24fQr6OsXlroOC+9DIkrBtgkfEXrmaHqyO9jP0/BBHQUHBAjJr6RkItNOJqs tL5255/XbQw05IUwTN+fwQs+x1qtv9dPXiYVdELfBIhuTKSyQJaKqBLEO3mPFxRz PIISy3OQi1lzdrJdmurLcp6DfbzqB9nJfuD0CtslCI1Bu09KsMgr7sn/mxITx0Vy qyWz9p5t9Vr2A3xct652aED771i3Ra6UK+UYoSayMMMyCG4g+rb0DzJhQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=U4jA0nvRK7CzrdgeNIS5gDY5tElSJ2feLLbT7NYhO6s=; b=soUNU+zi uXuVOTwtphqr7B11oSRvrTR5EMY1G0DCfVWT5s+K/e9h3V/TodXW0tbddWCX1Qhf 2EbJfg61h8/UFqtAFCwuDtcIaxiykHsoFtLgyvzZrBQIoWF9LF/YDvRSmyDr1lyV hY8s0GIVyKaAXjkwwoUEaknhWhGHrbVOeWZTWUnB9W1++iN+4uXoWlMohB72yOlk 3TZ7XBSJLe2Nd4NxPuirhOfuGpWFLHiTQ/cSUcvZW+8DPmy+hZL/KNYEgY4NjN0I uAZwnZNHCO2j+82cPGETrg4u4iziby3clWWhVNK04wJCiBfVWlkQgL5VP4ORJUzp E1csDeRCXdGAgw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudegtddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id B6856306005E; Thu, 3 Sep 2020 01:07:17 -0400 (EDT) From: Samuel Holland To: Jagan Teki , Maxime Ripard Cc: Andre Przywara , Peter Robinson , u-boot@lists.denx.de, Samuel Holland Subject: [PATCH 1/8] sunxi: board: Use a more descriptive variable name Date: Thu, 3 Sep 2020 00:07:09 -0500 Message-Id: <20200903050716.48488-2-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903050716.48488-1-samuel@sholland.org> References: <20200903050716.48488-1-samuel@sholland.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The variable "cmp_str" always leaves me wondering if it is the DT name of the current board (yes) or DT name in the FIT config entry (no). In preparation for expanding the functionality here, rename it to something that obviously means "this is the DT name we are looking for". Signed-off-by: Samuel Holland --- board/sunxi/board.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 71e2b758a3e..674e6816d2d 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -892,14 +892,14 @@ int ft_board_setup(void *blob, struct bd_info *bd) int board_fit_config_name_match(const char *name) { struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION); - const char *cmp_str = (const char *)spl; + const char *best_dt_name = (const char *)spl; /* Check if there is a DT name stored in the SPL header and use that. */ if (spl != INVALID_SPL_HEADER && spl->dt_name_offset) { - cmp_str += spl->dt_name_offset; + best_dt_name += spl->dt_name_offset; } else { #ifdef CONFIG_DEFAULT_DEVICE_TREE - cmp_str = CONFIG_DEFAULT_DEVICE_TREE; + best_dt_name = CONFIG_DEFAULT_DEVICE_TREE; #else return 0; #endif @@ -907,15 +907,15 @@ int board_fit_config_name_match(const char *name) #ifdef CONFIG_PINE64_DT_SELECTION /* Differentiate the two Pine64 board DTs by their DRAM size. */ - if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) { + if (strstr(name, "-pine64") && strstr(best_dt_name, "-pine64")) { if ((gd->ram_size > 512 * 1024 * 1024)) return !strstr(name, "plus"); else return !!strstr(name, "plus"); } else { - return strcmp(name, cmp_str); + return strcmp(name, best_dt_name); } #endif - return strcmp(name, cmp_str); + return strcmp(name, best_dt_name); } #endif From patchwork Thu Sep 3 05:07:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1356309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm3 header.b=Sj8OLfL4; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=gP0Xb3h8; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bhphf6BH6z9sTR for ; Thu, 3 Sep 2020 15:07:30 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A8413822E3; Thu, 3 Sep 2020 07:07:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="Sj8OLfL4"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="gP0Xb3h8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B2D9822E8; Thu, 3 Sep 2020 07:07:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 88299822CA for ; Thu, 3 Sep 2020 07:07:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 76A985C0185; Thu, 3 Sep 2020 01:07:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 03 Sep 2020 01:07:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=PQN64SHY0DFbJ Xj9YPEcwJKL0bbybvo9/xMWQLiHCkU=; b=Sj8OLfL4WM4t/eW8xPA7XiaXE7bRC 9oDd5605MwRja78aJ+GwV1TuxapJm7IlVNnlBETATblOjQenK4B7tAuxyPitzu+K yJP+d0AYfgltsx888/hHtABBhsY20/7onFV1xxF/nB6fWwM6UTYfzsg2QQ2QYHmb R5QGX38IUdDGZPR/U3bd2roatbUMK+xMqPZku3+3xxbSlLdWpeXp3YBmNCZFrkef DjNUZE0kZWZIXIEk25bliOi1Yol1RZQZBq4As373rtZSvdXJbPKxU6C5c2TH6OgZ ZcjNRU6zogMnOHhe/nklaCLzZQPx8Wz5Nse8PYJuRlDGk5tu5tOcONmog== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=PQN64SHY0DFbJXj9YPEcwJKL0bbybvo9/xMWQLiHCkU=; b=gP0Xb3h8 lzo0knlriZlcpqJf2dY4yeWblYiYIsakrHO3GUDeZ7G9RYeSSWZ89RjUPZIHn4tw mTk7vKxHbWz88EaQ+iPXaHsygzVk6RGrnU+7eGtJzZmUmKAm19hTi1uqkP/nXGyY yyL1IKzw3pieBI1wHq1JPBo+AqTyAsrhrjgdalM+f9/0WwcdAWLTWYUXdR65xW1W oFUPZ3bjJWrhFb1KFwEiJKdkK9tpivNCGKLe9fvnTLEelYQVoKMAE5G0xVdJhIqY mQAq41sXJ3LRSeQWUb4Nd00bQsDTsroKLXDYc1P2K57wRGNIalbkkWZmbadPn2VW 5jUVvdCWPvDEZQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudegtddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 0C6DA306005B; Thu, 3 Sep 2020 01:07:18 -0400 (EDT) From: Samuel Holland To: Jagan Teki , Maxime Ripard Cc: Andre Przywara , Peter Robinson , u-boot@lists.denx.de, Samuel Holland Subject: [PATCH 2/8] sunxi: board: Add a helper to get the SPL DT name Date: Thu, 3 Sep 2020 00:07:10 -0500 Message-Id: <20200903050716.48488-3-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903050716.48488-1-samuel@sholland.org> References: <20200903050716.48488-1-samuel@sholland.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This moves the validity checking and typecasts all to one place away from the string comparison logic, and it detangles the compile-time and runtime control flow. The new helper will also be used by U-Boot proper in a future commit. Signed-off-by: Samuel Holland --- board/sunxi/board.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 674e6816d2d..5c9b811f27a 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -319,6 +319,17 @@ static struct boot_file_head * get_spl_header(uint8_t req_version) return spl; } +static const char *get_spl_dt_name(void) +{ + struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION); + + /* Check if there is a DT name stored in the SPL header. */ + if (spl != INVALID_SPL_HEADER && spl->dt_name_offset) + return (char *)spl + spl->dt_name_offset; + + return NULL; +} + int dram_init(void) { struct boot_file_head *spl = get_spl_header(SPL_DRAM_HEADER_VERSION); @@ -891,20 +902,17 @@ int ft_board_setup(void *blob, struct bd_info *bd) #ifdef CONFIG_SPL_LOAD_FIT int board_fit_config_name_match(const char *name) { - struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION); - const char *best_dt_name = (const char *)spl; + const char *best_dt_name = get_spl_dt_name(); - /* Check if there is a DT name stored in the SPL header and use that. */ - if (spl != INVALID_SPL_HEADER && spl->dt_name_offset) { - best_dt_name += spl->dt_name_offset; - } else { #ifdef CONFIG_DEFAULT_DEVICE_TREE + if (best_dt_name == NULL) best_dt_name = CONFIG_DEFAULT_DEVICE_TREE; -#else - return 0; #endif - }; + if (best_dt_name == NULL) { + /* No DT name was provided, so accept the first config. */ + return 0; + } #ifdef CONFIG_PINE64_DT_SELECTION /* Differentiate the two Pine64 board DTs by their DRAM size. */ if (strstr(name, "-pine64") && strstr(best_dt_name, "-pine64")) { From patchwork Thu Sep 3 05:07:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1356311 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm3 header.b=YljKqDaX; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=KFsvPFSQ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bhpj50Q5mz9sTR for ; Thu, 3 Sep 2020 15:07:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 921A1822EA; Thu, 3 Sep 2020 07:07:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="YljKqDaX"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="KFsvPFSQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 29DBC822EA; Thu, 3 Sep 2020 07:07:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AA176822D5 for ; Thu, 3 Sep 2020 07:07:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id C1C965C01A4; Thu, 3 Sep 2020 01:07:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 03 Sep 2020 01:07:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=Qd9EKlOeDxNxU GjePDGIEyZE9Rx9hOCoFpYSpjLblzg=; b=YljKqDaXzM+KcF2P5M1Qm4ZqIN47C vZyob9mNeC9Ih6xzht0zmIiswyR4o06F6F75APKEHOLdF98lM16tFq5lm2c0K2C/ FLv20iU82lyakGbT5y0fX9BUw2B1l6InAM81fN1aIyj6vKXDINvzr0Njek5zd82e EBZJnaT7r4LgQ3tDupNPvYm+nq18jIibpUUERREvoNh6ktNeYOJbWPpuyRpW06+o zKpzwXrrMFjcTuczM3DCSk0LchI0IGfF9STJXcWYrkwILpOIIZIn7Pcxbxg3LuPP EF8OLTHGhbp2yvtbSVxuSyV5XrLKaiMTJNs8Z8T/AVWTfuAfwA146icVg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=Qd9EKlOeDxNxUGjePDGIEyZE9Rx9hOCoFpYSpjLblzg=; b=KFsvPFSQ oz3tuB0IgFDRGBPs9pm02ZFiQW6XW9io0ha6PFYr7sl2irhSUuA89cAncxDeQ99n /SKVx+jefi15iu+rEUTEdZwFzb8FbfQ6faNIyvJ1RL4m+eH9ifIF0yuc62Qe9Pt2 Y0+6e1tDB3SyFRABn0Vib5DrnmbMSYeSJZug7TRAxINnW/qdG6pq1ycNPbhvYy7V L0yBLcV7gP/gwEF5OtEWV2X22kqKFir6fKCsAVDK2KUTmM3ezGifn8h6u7n8ksWC +4UbNfjcBKfNLHFEEIb7CdNdtixI4oo/XIsA8eDHULQ0v7cF7bZ1KAR+jBSW4Bf9 CRQNy2hCu5K+Rg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudegtddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 56CF53060062; Thu, 3 Sep 2020 01:07:18 -0400 (EDT) From: Samuel Holland To: Jagan Teki , Maxime Ripard Cc: Andre Przywara , Peter Robinson , u-boot@lists.denx.de, Samuel Holland Subject: [PATCH 3/8] sunxi: board: Simplify Pine A64 DT selection logic Date: Thu, 3 Sep 2020 00:07:11 -0500 Message-Id: <20200903050716.48488-4-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903050716.48488-1-samuel@sholland.org> References: <20200903050716.48488-1-samuel@sholland.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Instead of using an entirely separate matching algorithm, simply update the name of the DT we want to match. Enabling this logic does not depend on the FIT config name, only on the initial guess of the board name. Importantly, the initial guess must be "sun50i-a64-pine64-plus", because otherwise the logic would trigger when "sun50i-a64-pine64-lts" was written to the SPL header. Signed-off-by: Samuel Holland --- board/sunxi/board.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 5c9b811f27a..fb0d5bf4743 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -914,14 +914,10 @@ int board_fit_config_name_match(const char *name) return 0; } #ifdef CONFIG_PINE64_DT_SELECTION -/* Differentiate the two Pine64 board DTs by their DRAM size. */ - if (strstr(name, "-pine64") && strstr(best_dt_name, "-pine64")) { - if ((gd->ram_size > 512 * 1024 * 1024)) - return !strstr(name, "plus"); - else - return !!strstr(name, "plus"); - } else { - return strcmp(name, best_dt_name); + else if (strstr(best_dt_name, "-pine64-plus")) { + /* Differentiate the Pine A64 boards by their DRAM size. */ + if ((gd->ram_size == 512 * 1024 * 1024)) + best_dt_name = "sun50i-a64-pine64"; } #endif return strcmp(name, best_dt_name); From patchwork Thu Sep 3 05:07:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1356310 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm3 header.b=WQvh0tb6; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=Va8mMuMz; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bhphw0Nkzz9sTR for ; Thu, 3 Sep 2020 15:07:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 19AFA822DF; Thu, 3 Sep 2020 07:07:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="WQvh0tb6"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Va8mMuMz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3129B822E3; Thu, 3 Sep 2020 07:07:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D694E822E1 for ; Thu, 3 Sep 2020 07:07:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 1C9B95C0116; Thu, 3 Sep 2020 01:07:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 03 Sep 2020 01:07:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=CNkIsGtVD92kV ynV0NXjTV4vykOq+sdspxFol5f0iNM=; b=WQvh0tb6tyqtZYusFC0NyOcSeWaQm ikcA+euqToY6scf0d256r+20fb4HnTosS+vXbhpF5vlo1hBhc2RW2/e+dR3a3AKH qb8j3UwBWhpnwwZMS8HqUob5Cfq1BxHU1+/2tjRXvlMxDxNd/HvUoRlLBhfK57OA Ln6MfWcRmxHlq5Js5MGAD9hRdzkPrnDX4x/NdRttkUaH/WMSGNEO0TnKW88PYXsE 8u0eiuJQWWLED8nBAxf89vvVUf7o+It6gx5i+r5Bjl/BE5Ykj4O4kpMX2MeiB+Zh KjYjivDQw8wmG4CrFKPCq4Bd/RoSQd9zHYBp6QuYpvY80vw+jLX7oVwMw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=CNkIsGtVD92kVynV0NXjTV4vykOq+sdspxFol5f0iNM=; b=Va8mMuMz othxHX11xn91XUTb1pYRnk4BO4zhPNKy7f+RU+S4/3DaYnmV9zl4x03LblsUWZRs bnICHr20DS5YKUcqT9ag5zm1ocAxwJQGTc/SnTpWkZsJXR8unpsmm89jDyV+w5dM p3YUeZ3AhxjEFHJXhqUnnOIXSLXGzYsnWA+szWf0dHI7tpZJqaV5O4X8xTk2X5cp 2siDwjLGLi7PUtB/vcNZmOOZQbROGonW6mu2iNurHnrBUk4gOOmQhmeiEkjJb9lk +MfMZsLXllNr8/o7323d6iP90v1scxaBASDC+q2zzEmUVAmU/Y/fyH0B6frHJy3O QTcFTnYy45X3Zw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudegtddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id A21AB306005B; Thu, 3 Sep 2020 01:07:18 -0400 (EDT) From: Samuel Holland To: Jagan Teki , Maxime Ripard Cc: Andre Przywara , Peter Robinson , u-boot@lists.denx.de, Samuel Holland Subject: [PATCH 4/8] sunxi: board: Add PinePhone DT selection logic Date: Thu, 3 Sep 2020 00:07:12 -0500 Message-Id: <20200903050716.48488-5-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903050716.48488-1-samuel@sholland.org> References: <20200903050716.48488-1-samuel@sholland.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean There are two different publicly-released revisions of the PinePhone hardware, versions 1.1 and 1.2; and they need different device trees. Since some GPIO pins were rerouted, we can use that to distinguish between them. Signed-off-by: Samuel Holland --- arch/arm/mach-sunxi/Kconfig | 7 +++++++ board/sunxi/board.c | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index be0822bfb7d..8421f3b6854 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -1010,4 +1010,11 @@ config PINE64_DT_SELECTION option, the device tree selection code specific to Pine64 which utilizes the DRAM size will be enabled. +config PINEPHONE_DT_SELECTION + bool "Enable PinePhone device tree selection code" + depends on MACH_SUN50I + help + Enable this option to automatically select the device tree for the + correct PinePhone hardware revision during boot. + endif diff --git a/board/sunxi/board.c b/board/sunxi/board.c index fb0d5bf4743..3d64ed18664 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -920,6 +921,26 @@ int board_fit_config_name_match(const char *name) best_dt_name = "sun50i-a64-pine64"; } #endif +#ifdef CONFIG_PINEPHONE_DT_SELECTION + else if (strstr(best_dt_name, "-pinephone")) { + /* Differentiate the PinePhone revisions by GPIO inputs. */ + prcm_apb0_enable(PRCM_APB0_GATE_PIO); + sunxi_gpio_set_pull(SUNXI_GPL(6), SUNXI_GPIO_PULL_UP); + sunxi_gpio_set_cfgpin(SUNXI_GPL(6), SUNXI_GPIO_INPUT); + udelay(100); + + /* PL6 is pulled low by the modem on v1.2. */ + if (gpio_get_value(SUNXI_GPL(6)) == 0) + best_dt_name = "sun50i-a64-pinephone-1.2"; + else + best_dt_name = "sun50i-a64-pinephone-1.1"; + + sunxi_gpio_set_cfgpin(SUNXI_GPL(6), SUNXI_GPIO_DISABLE); + sunxi_gpio_set_pull(SUNXI_GPL(6), SUNXI_GPIO_PULL_DISABLE); + prcm_apb0_disable(PRCM_APB0_GATE_PIO); + } +#endif + return strcmp(name, best_dt_name); } #endif From patchwork Thu Sep 3 05:07:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1356314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm3 header.b=fyCJtExp; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=B5Js1Nb8; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bhpjn2MLBz9sTR for ; Thu, 3 Sep 2020 15:08:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 774738230A; Thu, 3 Sep 2020 07:07:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="fyCJtExp"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="B5Js1Nb8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 43189822ED; Thu, 3 Sep 2020 07:07:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2BF26822D9 for ; Thu, 3 Sep 2020 07:07:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 672025C018A; Thu, 3 Sep 2020 01:07:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 03 Sep 2020 01:07:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=azt3bcG2gyjJM Z+euNV8r3HcVvCpV+eSxdiwdmzQYjE=; b=fyCJtExpAf8Pds8sXBs5pz5z9Werb vqBSzut0Ck+pcCvap7NpVy7HIRtLqRZZ5TVdGQrBdCyjMYPaBcpnxw/mfUNJKoX9 WjOBrSnHpTrRp42ZQmJhQhQwBcX/s0j54ruprCfSqKSDuTOBG1N1JvKxI/PpfY6r SsSEbwLKYq1RtK4noXm6JikphM9ME5i5XlR5n4XPsXPdM3UhM9DZXrkVwtWp+NyK 4Xz63Is8oAxwJZAmqv049v/YeMe/Rsf9FY93zxcnQyZVoOHuW1s17AsX7jF8wDRy xqvpvT8c3cJYXaFLGLrY+nmcGoKIjQSszLh9y5NwbGmjlEElJCcUUJW1A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=azt3bcG2gyjJMZ+euNV8r3HcVvCpV+eSxdiwdmzQYjE=; b=B5Js1Nb8 5VzNH4aOuAW1FHK3OmKXRhz2sqhORkqO2K1N+kVfuPWZeATNjSIGEHwqkBJeJDNc i+/y18eeCQg5sWkt3YCGaFv//m+LNamP1DRTkwLglswewvGqj0zfgN4MjMJvBWt3 0bbdP8+D9o1geSld8IyI3lyRZgu7QN+3vJs4xxyTQL6xTOg6VizhNwm6nwSSl2u8 O6WzLWqrShbb6PD7Lqy5FrJ+BiqwRR+QrRp1JI86QDXssPJh1CtMiF2LnrkmwPxB DSp3hr1nqudSNopltfwdUyNu3GdkGbMCE8Iv+4KIZpD8oRH12hS19aRtIqosAuXm 1Ljrqzx4Vp/yNA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudegtddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id EE48F306005E; Thu, 3 Sep 2020 01:07:18 -0400 (EDT) From: Samuel Holland To: Jagan Teki , Maxime Ripard Cc: Andre Przywara , Peter Robinson , u-boot@lists.denx.de, Samuel Holland Subject: [PATCH 5/8] sunxi: board: Save the chosen DT name in the SPL header Date: Thu, 3 Sep 2020 00:07:13 -0500 Message-Id: <20200903050716.48488-6-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903050716.48488-1-samuel@sholland.org> References: <20200903050716.48488-1-samuel@sholland.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This overwrites the name loaded from the SPL image. It will be different if there was previously no name provided, or if a more accurate name was determined by the board variant selection logic. This means that the DT name in the SPL header now always matches the DT appended to U-Boot. Signed-off-by: Samuel Holland --- board/sunxi/board.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 3d64ed18664..eaa40a1ea96 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -331,6 +331,21 @@ static const char *get_spl_dt_name(void) return NULL; } +static void set_spl_dt_name(const char *name) +{ + struct boot_file_head *spl = get_spl_header(SPL_ENV_HEADER_VERSION); + + if (spl == INVALID_SPL_HEADER) + return; + + /* Promote the header version for U-Boot proper, if needed. */ + if (spl->spl_signature[3] < SPL_DT_HEADER_VERSION) + spl->spl_signature[3] = SPL_DT_HEADER_VERSION; + + strcpy((char *)&spl->string_pool, name); + spl->dt_name_offset = offsetof(struct boot_file_head, string_pool); +} + int dram_init(void) { struct boot_file_head *spl = get_spl_header(SPL_DRAM_HEADER_VERSION); @@ -904,6 +919,7 @@ int ft_board_setup(void *blob, struct bd_info *bd) int board_fit_config_name_match(const char *name) { const char *best_dt_name = get_spl_dt_name(); + int ret; #ifdef CONFIG_DEFAULT_DEVICE_TREE if (best_dt_name == NULL) @@ -941,6 +957,15 @@ int board_fit_config_name_match(const char *name) } #endif - return strcmp(name, best_dt_name); + ret = strcmp(name, best_dt_name); + + /* + * If one of the FIT configurations matches the most accurate DT name, + * update the SPL header to provide that DT name to U-Boot proper. + */ + if (ret == 0) + set_spl_dt_name(best_dt_name); + + return ret; } #endif From patchwork Thu Sep 3 05:07:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1356313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm3 header.b=Ps0W2fd7; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=irLh9odg; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BhpjY18DVz9sTR for ; Thu, 3 Sep 2020 15:08:17 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1375E82300; Thu, 3 Sep 2020 07:07:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="Ps0W2fd7"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="irLh9odg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E9DCE822E1; Thu, 3 Sep 2020 07:07:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2CC5D822DF for ; Thu, 3 Sep 2020 07:07:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id AAA455C0197; Thu, 3 Sep 2020 01:07:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 03 Sep 2020 01:07:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=YJZBYh6lhnaT4 or+KKTYoX0BgbruFrnszv2AxRFjCUg=; b=Ps0W2fd7vmO9tBRewK6ov5Y2vWsh9 oAAVK6vPK0hEzUkkeBIkhSenj5xlmR2HCeP5LxQU+Vgty5CzLJnc48U8lCQwGRFR ZZ6tAiD9/vOtdVCbU2dRH7WK3uoAEi4AB688do5c3H3KhS8ZN6N7vsakr50TbczK beuX76xciz0QEuRhJUFbnK9EYpV8/CDS1OFv6P+kA6OSIb71gm9FeFgdHHpmdQ/U 7sE6vbkMYhL7pFMzeBCYWSfUWF6NK3gfJApDaxFqR1KBlszLuGbIXLVYWImA3WV8 sFDNZWGk2swSOB1ivq+Xvb2WTlPidjY0OrROgggZcyDHPRFEoZaS1ezAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=YJZBYh6lhnaT4or+KKTYoX0BgbruFrnszv2AxRFjCUg=; b=irLh9odg 4mUJO3vUBGyeYD/WBs8BrulYezzsNoTAJp4uGEv0b9KyxbofUjok4+liYvAT/QZa ED/iKo1bqgGmEwNPLoM0YORd0pXRd5jyv9W53Z96qzGsNOe0iGkJtSlOMXF3Lrfl aIpGPRSMoRkqztR6oWBAEHeCm3NCFY4LDzzCoPFQqdcWmiDl+Wi3YfpApRGHdL3v 4XVOruQFZlZUHZPp42VOzgbJyz+uWB3Z/RN2y0P7Lof1CrYtsWNftV4LuXDQ70VZ P9TlSWjk75qTa1dqHdj/cvbi5WFBqa4FJKgCCV1OgCCEAc1ZGLhPBVDjt4W7FHJh hNPlKS0liPCmGQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudegtddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 4678A306005B; Thu, 3 Sep 2020 01:07:19 -0400 (EDT) From: Samuel Holland To: Jagan Teki , Maxime Ripard Cc: Andre Przywara , Peter Robinson , u-boot@lists.denx.de, Samuel Holland Subject: [PATCH 6/8] sunxi: board: Set fdtfile to match the DT chosen by SPL Date: Thu, 3 Sep 2020 00:07:14 -0500 Message-Id: <20200903050716.48488-7-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903050716.48488-1-samuel@sholland.org> References: <20200903050716.48488-1-samuel@sholland.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Previously, fdtfile was always the value in CONFIG_DEFAULT_DEVICE_TREE. This meant that, regardless of the DT chosen by SPL (either by changing the header in the image or by the selection code at runtime), Linux always used the default DT. By using the name from the SPL header (which, because of the previous commit, always matches the DT used by U-Boot proper), Linux also sees the same board as U-Boot/SPL, even if the boot script later loads a DT from disk. Signed-off-by: Samuel Holland --- board/sunxi/board.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index eaa40a1ea96..5457b28e135 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -870,6 +870,7 @@ static void setup_environment(const void *fdt) int misc_init_r(void) { + const char *spl_dt_name; uint boot; env_set("fel_booted", NULL); @@ -888,6 +889,16 @@ int misc_init_r(void) env_set("mmc_bootdev", "1"); } + /* Set fdtfile to match the FIT configuration chosen in SPL. */ + spl_dt_name = get_spl_dt_name(); + if (spl_dt_name) { + char *prefix = IS_ENABLED(CONFIG_ARM64) ? "allwinner/" : ""; + char str[64]; + + snprintf(str, sizeof(str), "%s%s.dtb", prefix, spl_dt_name); + env_set("fdtfile", str); + } + setup_environment(gd->fdt_blob); #ifdef CONFIG_USB_ETHER From 9e91885814f880ce13ee98cab79876338811949f Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 9 Jul 2020 12:44:55 +0100 Subject: [PATCH 7/8] arm64: dts: allwinner: Add initial support for Pine64 PinePhone At the moment PinePhone comes in three slightly incompatible variants: - 1.0: Early Developer Batch - 1.1: Braveheart Batch - 1.2: Initial Production version This syncs the Pinephone DTs from Linux 5.8-rc1. Signed-off-by: Peter Robinson --- arch/arm/dts/Makefile | 3 + arch/arm/dts/sun50i-a64-pinephone-1.0.dts | 11 + arch/arm/dts/sun50i-a64-pinephone-1.1.dts | 11 + arch/arm/dts/sun50i-a64-pinephone-1.2.dts | 40 +++++++++++++++++++++++ arch/arm/dts/sun50i-a64-pinephone.dtsi | 379 ++++++++++++++++++++++ 5 files changed, 403 insertions(+) create mode 100644 arch/arm/dts/sun50i-a64-pinephone-1.0.dts create mode 100644 arch/arm/dts/sun50i-a64-pinephone-1.1.dts create mode 100644 arch/arm/dts/sun50i-a64-pinephone-1.2.dts create mode 100644 arch/arm/dts/sun50i-a64-pinephone.dtsi diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index f8f529435b..193f5c6138 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -608,6 +608,9 @@ dtb-$(CONFIG_MACH_SUN50I) += \ sun50i-a64-pine64-plus.dtb \ sun50i-a64-pine64.dtb \ sun50i-a64-pinebook.dtb \ + sun50i-a64-pinephone-1.0.dtb \ + sun50i-a64-pinephone-1.1.dtb \ + sun50i-a64-pinephone-1.2.dtb \ sun50i-a64-sopine-baseboard.dtb \ sun50i-a64-teres-i.dtb dtb-$(CONFIG_MACH_SUN9I) += \ diff --git a/arch/arm/dts/sun50i-a64-pinephone-1.0.dts b/arch/arm/dts/sun50i-a64-pinephone-1.0.dts new file mode 100644 index 0000000000..0c42272106 --- /dev/null +++ b/arch/arm/dts/sun50i-a64-pinephone-1.0.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (C) 2020 Ondrej Jirman + +/dts-v1/; + +#include "sun50i-a64-pinephone.dtsi" + +/ { + model = "Pine64 PinePhone Developer Batch (1.0)"; + compatible = "pine64,pinephone-1.0", "allwinner,sun50i-a64"; +}; diff --git a/arch/arm/dts/sun50i-a64-pinephone-1.1.dts b/arch/arm/dts/sun50i-a64-pinephone-1.1.dts new file mode 100644 index 0000000000..06a775c416 --- /dev/null +++ b/arch/arm/dts/sun50i-a64-pinephone-1.1.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (C) 2020 Ondrej Jirman + +/dts-v1/; + +#include "sun50i-a64-pinephone.dtsi" + +/ { + model = "Pine64 PinePhone Braveheart (1.1)"; + compatible = "pine64,pinephone-1.1", "allwinner,sun50i-a64"; +}; diff --git a/arch/arm/dts/sun50i-a64-pinephone-1.2.dts b/arch/arm/dts/sun50i-a64-pinephone-1.2.dts new file mode 100644 index 0000000000..a9f5b670c9 --- /dev/null +++ b/arch/arm/dts/sun50i-a64-pinephone-1.2.dts @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (C) 2020 Ondrej Jirman + +/dts-v1/; + +#include "sun50i-a64-pinephone.dtsi" + +/ { + model = "Pine64 PinePhone (1.2)"; + compatible = "pine64,pinephone-1.2", "allwinner,sun50i-a64"; +}; + +&backlight { + power-supply = <®_ldo_io0>; + /* + * PWM backlight circuit on this PinePhone revision was changed since 1.0, + * and the lowest PWM duty cycle that doesn't lead to backlight being off + * is around 10%. Duty cycle for the lowest brightness level also varries + * quite a bit between individual boards, so the lowest value here was + * chosen as a safe default. + */ + brightness-levels = < + 5000 5248 5506 5858 6345 + 6987 7805 8823 10062 11543 + 13287 15317 17654 20319 23336 + 26724 30505 34702 39335 44427 + 50000 + >; + num-interpolated-steps = <50>; + default-brightness-level = <500>; +}; + +&lis3mdl { + /* + * Board revision 1.2 fixed routing of the interrupt to DRDY pin, + * enable interrupts. + */ + interrupt-parent = <&pio>; + interrupts = <1 1 IRQ_TYPE_EDGE_RISING>; /* PB1 */ +}; diff --git a/arch/arm/dts/sun50i-a64-pinephone.dtsi b/arch/arm/dts/sun50i-a64-pinephone.dtsi new file mode 100644 index 0000000000..cefda145c3 --- /dev/null +++ b/arch/arm/dts/sun50i-a64-pinephone.dtsi @@ -0,0 +1,379 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (C) 2019 Icenowy Zheng +// Copyright (C) 2020 Martijn Braam +// Copyright (C) 2020 Ondrej Jirman + +#include "sun50i-a64.dtsi" +#include "sun50i-a64-cpu-opp.dtsi" + +#include +#include +#include +#include + +/ { + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + blue { + function = LED_FUNCTION_INDICATOR; + color = ; + gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */ + }; + + green { + function = LED_FUNCTION_INDICATOR; + color = ; + gpios = <&pio 3 18 GPIO_ACTIVE_HIGH>; /* PD18 */ + }; + + red { + function = LED_FUNCTION_INDICATOR; + color = ; + gpios = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */ + }; + }; + + speaker_amp: audio-amplifier { + compatible = "simple-audio-amplifier"; + enable-gpios = <&pio 2 7 GPIO_ACTIVE_HIGH>; /* PC7 */ + sound-name-prefix = "Speaker Amp"; + }; + + vibrator { + compatible = "gpio-vibrator"; + enable-gpios = <&pio 3 2 GPIO_ACTIVE_HIGH>; /* PD2 */ + vcc-supply = <®_dcdc1>; + }; +}; + +&codec { + status = "okay"; +}; + +&codec_analog { + cpvdd-supply = <®_eldo1>; + status = "okay"; +}; + +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + +&cpu1 { + cpu-supply = <®_dcdc2>; +}; + +&cpu2 { + cpu-supply = <®_dcdc2>; +}; + +&cpu3 { + cpu-supply = <®_dcdc2>; +}; + +&dai { + status = "okay"; +}; + +&ehci0 { + status = "okay"; +}; + +&ehci1 { + status = "okay"; +}; + +&i2c1 { + status = "okay"; + + /* Magnetometer */ + lis3mdl@1e { + compatible = "st,lis3mdl-magn"; + reg = <0x1e>; + vdd-supply = <®_dldo1>; + vddio-supply = <®_dldo1>; + }; + + /* Accelerometer/gyroscope */ + mpu6050@68 { + compatible = "invensense,mpu6050"; + reg = <0x68>; + interrupt-parent = <&pio>; + interrupts = <7 5 IRQ_TYPE_EDGE_RISING>; /* PH5 */ + vdd-supply = <®_dldo1>; + vddio-supply = <®_dldo1>; + }; +}; + +/* Connected to pogo pins (external spring based pinheader for user addons) */ +&i2c2 { + status = "okay"; +}; + +&lradc { + vref-supply = <®_aldo3>; + status = "okay"; + + button-200 { + label = "Volume Up"; + linux,code = ; + channel = <0>; + voltage = <200000>; + }; + + button-400 { + label = "Volume Down"; + linux,code = ; + channel = <0>; + voltage = <400000>; + }; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins>; + vmmc-supply = <®_dcdc1>; + vqmmc-supply = <®_dcdc1>; + cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ + disable-wp; + bus-width = <4>; + status = "okay"; +}; + +&mmc2 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc2_pins>; + vmmc-supply = <®_dcdc1>; + vqmmc-supply = <®_dcdc1>; + bus-width = <8>; + non-removable; + cap-mmc-hw-reset; + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&ohci1 { + status = "okay"; +}; + +&pio { + vcc-pb-supply = <®_dcdc1>; + vcc-pc-supply = <®_dcdc1>; + vcc-pd-supply = <®_dcdc1>; + vcc-pe-supply = <®_aldo1>; + vcc-pf-supply = <®_dcdc1>; + vcc-pg-supply = <®_dldo4>; + vcc-ph-supply = <®_dcdc1>; +}; + +&r_pio { + /* + * FIXME: We can't add that supply for now since it would + * create a circular dependency between pinctrl, the regulator + * and the RSB Bus. + * + * vcc-pl-supply = <®_aldo2>; + */ +}; + +&r_rsb { + status = "okay"; + + axp803: pmic@3a3 { + compatible = "x-powers,axp803"; + reg = <0x3a3>; + interrupt-parent = <&r_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +#include "axp803.dtsi" + +&ac_power_supply { + status = "okay"; +}; + +&battery_power_supply { + status = "okay"; +}; + +®_aldo1 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "dovdd-csi"; +}; + +®_aldo2 { + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc-pl"; +}; + +®_aldo3 { + regulator-always-on; + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-pll-avcc"; +}; + +®_dcdc1 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-3v3"; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1300000>; + regulator-name = "vdd-cpux"; +}; + +/* DCDC3 is polyphased with DCDC2 */ + +®_dcdc5 { + regulator-always-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-name = "vcc-dram"; +}; + +®_dcdc6 { + regulator-always-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-name = "vdd-sys"; +}; + +®_dldo1 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-dsi-sensor"; +}; + +®_dldo2 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc-mipi-io"; +}; + +®_dldo3 { + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-name = "avdd-csi"; +}; + +®_dldo4 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi-io"; +}; + +®_eldo1 { + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc-lpddr"; +}; + +®_eldo3 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "dvdd-1v8-csi"; +}; + +®_fldo1 { + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-name = "vcc-1v2-hsic"; +}; + +®_fldo2 { + regulator-always-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-name = "vdd-cpus"; +}; + +®_ldo_io0 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-lcd-ctp-stk"; + status = "okay"; +}; + +®_ldo_io1 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc-1v8-typec"; + status = "okay"; +}; + +®_rtc_ldo { + regulator-name = "vcc-rtc"; +}; + +&sound { + status = "okay"; + simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; + simple-audio-card,widgets = "Microphone", "Headset Microphone", + "Microphone", "Internal Microphone", + "Headphone", "Headphone Jack", + "Speaker", "Internal Earpiece", + "Speaker", "Internal Speaker"; + simple-audio-card,routing = + "Headphone Jack", "HP", + "Internal Earpiece", "EARPIECE", + "Internal Speaker", "Speaker Amp OUTL", + "Internal Speaker", "Speaker Amp OUTR", + "Speaker Amp INL", "LINEOUT", + "Speaker Amp INR", "LINEOUT", + "Left DAC", "AIF1 Slot 0 Left", + "Right DAC", "AIF1 Slot 0 Right", + "AIF1 Slot 0 Left ADC", "Left ADC", + "AIF1 Slot 0 Right ADC", "Right ADC", + "Internal Microphone", "MBIAS", + "MIC1", "Internal Microphone", + "Headset Microphone", "HBIAS", + "MIC2", "Headset Microphone"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pb_pins>; + status = "okay"; +}; + +/* Connected to the modem (hardware flow control can't be used) */ +&uart3 { + pinctrl-names = "default"; + pinctrl-0 = <&uart3_pins>; + status = "okay"; +}; + +&usb_otg { + dr_mode = "peripheral"; + status = "okay"; +}; + +&usb_power_supply { + status = "okay"; +}; + +&usbphy { + status = "okay"; +}; -- 2.26.2 From bed9375bf6d11bdbf08839135541c44d80189384 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 9 Sep 2020 11:19:09 +0100 Subject: [PATCH] pinephone dts sync to 5.9-rc1 --- arch/arm/dts/sun50i-a64-pinephone-1.1.dts | 19 ++++++++ arch/arm/dts/sun50i-a64-pinephone.dtsi | 54 ++++++++++++++++++++++- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/sun50i-a64-pinephone-1.1.dts b/arch/arm/dts/sun50i-a64-pinephone-1.1.dts index 06a775c416..3e99a87e9c 100644 --- a/arch/arm/dts/sun50i-a64-pinephone-1.1.dts +++ b/arch/arm/dts/sun50i-a64-pinephone-1.1.dts @@ -9,3 +9,22 @@ model = "Pine64 PinePhone Braveheart (1.1)"; compatible = "pine64,pinephone-1.1", "allwinner,sun50i-a64"; }; + +&backlight { + power-supply = <®_ldo_io0>; + /* + * PWM backlight circuit on this PinePhone revision was changed since + * 1.0, and the lowest PWM duty cycle that doesn't lead to backlight + * being off is around 20%. Duty cycle for the lowest brightness level + * also varries quite a bit between individual boards, so the lowest + * value here was chosen as a safe default. + */ + brightness-levels = < + 774 793 814 842 + 882 935 1003 1088 + 1192 1316 1462 1633 + 1830 2054 2309 2596 + 2916 3271 3664 4096>; + num-interpolated-steps = <50>; + default-brightness-level = <400>; +}; diff --git a/arch/arm/dts/sun50i-a64-pinephone.dtsi b/arch/arm/dts/sun50i-a64-pinephone.dtsi index cefda145c3..25150aba74 100644 --- a/arch/arm/dts/sun50i-a64-pinephone.dtsi +++ b/arch/arm/dts/sun50i-a64-pinephone.dtsi @@ -16,6 +16,13 @@ serial0 = &uart0; }; + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>; + enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */ + /* Backlight configuration differs per PinePhone revision. */ + }; + chosen { stdout-path = "serial0:115200n8"; }; @@ -84,6 +91,28 @@ status = "okay"; }; +&de { + status = "okay"; +}; + +&dphy { + status = "okay"; +}; + +&dsi { + vcc-dsi-supply = <®_dldo1>; + status = "okay"; + + panel@0 { + compatible = "xingbangda,xbd599"; + reg = <0>; + reset-gpios = <&pio 3 23 GPIO_ACTIVE_LOW>; /* PD23 */ + iovcc-supply = <®_dldo2>; + vcc-supply = <®_ldo_io0>; + backlight = <&backlight>; + }; +}; + &ehci0 { status = "okay"; }; @@ -92,11 +121,28 @@ status = "okay"; }; +&i2c0 { + status = "okay"; + + touchscreen@5d { + compatible = "goodix,gt917s"; + reg = <0x5d>; + interrupt-parent = <&pio>; + interrupts = <7 4 IRQ_TYPE_LEVEL_HIGH>; /* PH4 */ + irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */ + reset-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */ + AVDD28-supply = <®_ldo_io0>; + VDDIO-supply = <®_ldo_io0>; + touchscreen-size-x = <720>; + touchscreen-size-y = <1440>; + }; +}; + &i2c1 { status = "okay"; /* Magnetometer */ - lis3mdl@1e { + lis3mdl: lis3mdl@1e { compatible = "st,lis3mdl-magn"; reg = <0x1e>; vdd-supply = <®_dldo1>; @@ -188,6 +234,10 @@ */ }; +&r_pwm { + status = "okay"; +}; + &r_rsb { status = "okay"; @@ -279,7 +329,7 @@ ®_dldo4 { regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <3300000>; + regulator-max-microvolt = <1800000>; regulator-name = "vcc-wifi-io"; }; -- 2.26.2 From ab4bad52587be7da4262d943f19b5db02a24a045 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 15 Jul 2020 13:14:09 +0100 Subject: [PATCH 8/8] Initial Pine64 Pinephone support The Pine64 Pinephone is a smartphone based on the AllWinner A64 SoC. It has the following features: * 2GB LPDDR3 SDRAM * 5.95 inch 1440x720 HD IPS capacitive touchscreen * 16GB eMMC, mSD slot * Quectel EG25 LTE Modem * Realtek RTL8723CS WiFi/BT * Front and read cameras * Accelerometer, gyro, proximity, ambient light, compass sensors * A USB Type-C, USB Host, DisplayPort alt mode output, 15W 5V 3A Quick Charge, follows USB PD specification Signed-off-by: Peter Robinson --- arch/arm/Kconfig | 2 +- configs/pinephone_defconfig | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 configs/pinephone_defconfig diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e16fe03887..636ba26938 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1004,7 +1004,7 @@ config ARCH_SUNXI bool "Support sunxi (Allwinner) SoCs" select BINMAN select CMD_GPIO - select CMD_MMC if MMC +select CMD_MMC if MMC select CMD_USB if DISTRO_DEFAULTS select CLK select DM diff --git a/configs/pinephone_defconfig b/configs/pinephone_defconfig new file mode 100644 index 0000000000..d5750aa954 --- /dev/null +++ b/configs/pinephone_defconfig @@ -0,0 +1,39 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_SPL=y +CONFIG_MACH_SUN50I=y +CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y +CONFIG_DRAM_CLK=552 +CONFIG_DRAM_ZQ=3881949 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_MMC_SUNXI_SLOT_EXTRA=2 +CONFIG_R_I2C_ENABLE=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +# CONFIG_SPL_SPI_SUNXI is not set +# CONFIG_SPL_DOS_PARTITION is not set +# CONFIG_SPL_EFI_PARTITION is not set +CONFIG_PINEPHONE_DT_SELECTION=y +CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinephone-1.2" +CONFIG_OF_LIST=" sun50i-a64-pinephone-1.2 sun50i-a64-pinephone-1.1 sun50i-a64-pinephone-1.0" +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_PWM=y +CONFIG_PWM_SUNXI=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_I2C=y +CONFIG_CMD_MMC=y +# CONFIG_CMD_MII is not set +# CONFIG_CMD_NFS is not set +# CONFIG_DM_ETH is not set +# CONFIG_PHY is not set +# CONFIG_PHY_GIGE is not set +# CONFIG_SUN8I_EMAC is not set +# CONFIG_PHY_REALTEK is not set +# CONFIG_CMD_SF is not set +# CONFIG_SPI is not set +# CONFIG_DM_SPI is not set +# CONFIG_SPI_FLASH is not set +# CONFIG_SPI_MEM is not set +# CONFIG_DM_SPI_FLASH is not set -- 2.26.2