From patchwork Fri Nov 22 13:04:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Heider X-Patchwork-Id: 1199470 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 (no SPF record) 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cNm61tNp"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47KGr44yFjz9sPL for ; Sat, 23 Nov 2019 00:05:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4DB10C220A5; Fri, 22 Nov 2019 13:04:53 +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_H2, 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 7F34BC220BB; Fri, 22 Nov 2019 13:04:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B9214C220DA; Fri, 22 Nov 2019 13:04:11 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by lists.denx.de (Postfix) with ESMTPS id 92E30C220DA for ; Fri, 22 Nov 2019 13:04:06 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id b11so7353622wmb.5 for ; Fri, 22 Nov 2019 05:04:06 -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 :mime-version:content-transfer-encoding; bh=WdGaPmNm1vX6J0qh99R4KqiEMxSFiAnSZwa5IPXdHc8=; b=cNm61tNpGWK9ryxMAnV6OQf1sQsfInUmPSuJ8GPLWbRXRHs3bAkDFkImTKauWTzr8e vHO2d7I35gxCanoSsUEv0LKTwFhifyiiWBz99taqTJVuGxPuoMXgJUiEaGZUIGFNqyJ9 /9ezAiO1SE/yuQNaUbPwwprs9/uZWJ74aljh65HfPGlRNgu5PRx57ztDmytHJ5r5+chg GtCHo+qALkqi+bMVjlg4iX4IeA/INw3CbTwcHWk0VlBSPuDGxSnbU66MZhZvWCgMp9Vf 9PV+F6f3liY3fN4jOFog4oKMZOr9nrENjK9ENBkJCZJ+zGdwCFN9ROo2HfvyEb2/4Kx+ 5URw== 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:mime-version:content-transfer-encoding; bh=WdGaPmNm1vX6J0qh99R4KqiEMxSFiAnSZwa5IPXdHc8=; b=R53U5Xi1mh7SWV7tSeB669V84QDY9mTgqEtA+BYVr6GRdX94tjOy1CbwlKh8eQTqtJ yypXta2/cq3THUZLdqFugwRrKMmok1taP8qv4CXVjS4o3tbUeel3j5KcurRUGF6iRMPJ gDlinz47ocsqToQvNdlnPR0uqOcGycfUbJObfHsgR8lcKflHNvw6t7R8ELeDmwtAq/T3 UP8Dglmp2ZUeNKzVWDqd0JFFM6vigUk61YJI0wDed3wLxZqkPjs2t566etFS5NGMJEzx eFPbWA7cbXY1BE1gP5GWGbDkil9uIkgz+oJiBcATEg/ub74B5bSMVCxzZWoBvr0/CoN+ BInQ== X-Gm-Message-State: APjAAAXJI/qQS1i9/r7KQQTL5rPkynLiiIBlA7uy1mR+ug0XI7EXC5ut g2qD2nkVLNI6ub0JZ2o4S2k= X-Google-Smtp-Source: APXvYqzatLNWEn/fkiB8A2pDiZlGQZxYlO/KZqOMbrAENkKJ9YHZ1qja97x9T5d4dNDWAdWFOfJWrw== X-Received: by 2002:a1c:740a:: with SMTP id p10mr16227975wmc.121.1574427846280; Fri, 22 Nov 2019 05:04:06 -0800 (PST) Received: from mamamia.internal (a89-183-130-53.net-htp.de. [89.183.130.53]) by smtp.gmail.com with ESMTPSA id o187sm3533171wmo.20.2019.11.22.05.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2019 05:04:04 -0800 (PST) From: Andre Heider To: Jagan Teki , Maxime Ripard Date: Fri, 22 Nov 2019 14:04:00 +0100 Message-Id: <20191122130400.2155457-4-a.heider@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122130400.2155457-1-a.heider@gmail.com> References: <20191122130400.2155457-1-a.heider@gmail.com> MIME-Version: 1.0 Cc: Ondrej Jirman , u-boot@lists.denx.de, Jernej Skrabec Subject: [U-Boot] [PATCH 4/4] sunxi: board: fixup the BT address for Orange Pi 3 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" The BCM4345C5 of the Orange Pi 3 ships with the controller default address. Fix it up so it can function properly. The used address is "ethaddr" with the LSB flipped. Signed-off-by: Andre Heider --- NOTE: "local-bd-address" is a universal property, the kernel patch for btbcm to use that is in bluetooth-next. board/sunxi/board.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index bb35d6b66e..2897bf45e1 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -856,6 +856,32 @@ int misc_init_r(void) return 0; } +static void fixup_bd_address(void *blob) +{ +#if defined(CONFIG_MACH_SUN50I_H6) + /* Some devices ship with the controller default address. + * Set a valid address through the device tree. + */ + uchar mac[ETH_ALEN], bdaddr[ETH_ALEN]; + int i; + + if (!of_machine_is_compatible("xunlong,orangepi-3")) + return; + + if (!eth_env_get_enetaddr("ethaddr", mac)) + return; + + /* Addresses need to be in the binary format of the corresponding stack */ + for (i = 0; i < ETH_ALEN; ++i) + bdaddr[i] = mac[ETH_ALEN - i - 1]; + + bdaddr[0] ^= 1; + + do_fixup_by_compat(blob, "brcm,bcm4345c5", + "local-bd-address", bdaddr, ETH_ALEN, 1); +#endif +} + int ft_board_setup(void *blob, bd_t *bd) { int __maybe_unused r; @@ -866,6 +892,8 @@ int ft_board_setup(void *blob, bd_t *bd) */ setup_environment(blob); + fixup_bd_address(blob); + #ifdef CONFIG_VIDEO_DT_SIMPLEFB r = sunxi_simplefb_setup(blob); if (r)