From patchwork Thu Apr 18 17:25:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 789801 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp684768wrm; Thu, 18 Apr 2024 10:27:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXKsXewaMbMRIyg5KtaJ5ce6640yiKiVJG0G0O0HGBN588UtGm7jbivzBBMJUFiiAi61R/ghopA+XGxHbjtIhPm X-Google-Smtp-Source: AGHT+IHlA69b/amK7LM2KP3wTujMz/iNCxVX1RLVhSZZ3HiPpifdX5QPNssPuo4z8JpPl2YKB6fr X-Received: by 2002:a17:906:d98:b0:a52:262d:d998 with SMTP id m24-20020a1709060d9800b00a52262dd998mr2217521eji.62.1713461243985; Thu, 18 Apr 2024 10:27:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713461243; cv=none; d=google.com; s=arc-20160816; b=A8sepGGK/rbSpq+Ti+gxcPbk0bhAa9SJQgTbxPk4T+gW7X/uB5+6NWQP9X1HHtZV6l vKKv9Oc2imC8Ci85ecHO1ujOFtTzKVIwskuDyHfTVPCoMwQRrOgx3eGT+z8wByTYvYpQ gwXNGNgrFXij3yUE0X9H10FFx2Hu5NFp36AOXMl0iwyf7/mgyxdODFX3nO79V1UbilL7 UvgINqzTjbpmWjhM155N8kU1I6saHD2GBHpqAr9HGZvQe+Fa03SPn7u9ea9Fj6sKluWe 9fPA/2fzeaeTdt7T7gvfu1kecEfysqN+38tEFpBAOtraEsTcyA+TR10sYdN++pGRcUft rqvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=uIunq2hVl4wOxoVQv+vRWpmXjACM5TsW7K5jOwtHs2s=; fh=cxVCy3eHy3nijErbMEJaNRtqkZXikxCx2t/IdwYWGwE=; b=xRtxTquXpC/OxZjoWaBWUUU9Ne/Ededv+RaWpl9YmXmhxiebGQCjUYSJPDmmdGJE0M s8WWSvI1naMtAiTLLTYoCn2y9UD9m8VEqVU/tEgnDQVGXCDlaqjQDlrdeuKafVDr4VMR nR9IhO3kM/ybnGFs49paymTTm8WwWaEED/b2cYiu4mLaHM3XUiUlaY9NbyPVsqqHIqHE O/NFVkIWizHaTU7OOXXQpUQfuCi4PMu5OvvOmiu2OW+6LgqtfiRL61zNZtBFMyA4v97z M25Uwc2nCzs+OzWeAheKCCeFwAq7RN/vAjlvIh4/rQBZxZiHjrE4Fkil9Ckq3TcqQMri WhoA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WzTv+/VF"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id jw24-20020a17090776b800b00a555506da5esi1080805ejc.346.2024.04.18.10.27.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 10:27:23 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WzTv+/VF"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 69175886A7; Thu, 18 Apr 2024 19:26:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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=linaro.org header.i=@linaro.org header.b="WzTv+/VF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E28F8869D; Thu, 18 Apr 2024 19:26:32 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C34298869A for ; Thu, 18 Apr 2024 19:26:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-34665dd7744so720736f8f.1 for ; Thu, 18 Apr 2024 10:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713461189; x=1714065989; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uIunq2hVl4wOxoVQv+vRWpmXjACM5TsW7K5jOwtHs2s=; b=WzTv+/VFMEBi7D2zOC8uhYrwr++DfoC4Oi6/H/SISCpf5TuQLsjGkHIoYp1K/tiGGM itVQmmh2PdYfJGrOiN85voYLdP4t24U7DTG73xJaMEwFctqPcxtk8/VP+f4X0y5gx6w9 B0qHiVaToQxKFFSZusft0c8uaq9iyENv2CcXyylymMlooG4BvRvMot2y4IFc1aW0VNx0 m8Iom0V3Y7nv6YuvdaTDXwiiWjy0egETIDNhkDoC0U9GwVZ18qKrbvy4c8HWXgK3mP9V RgQzGrOgAvqhT1x9iKNliVlY/fJqBThCjzfkb6L7+BVNCXWd+MP/QfSe+40EU0lq6TSD XSDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713461189; x=1714065989; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uIunq2hVl4wOxoVQv+vRWpmXjACM5TsW7K5jOwtHs2s=; b=RYdRjnfphMpBp2HzYstzEoL7Qlg0L85s3GTbgCFjrqbuMWRG7RqUavX9EYNsMPYA7v EebSVS9n/A9FfFw6O7XxeF+CesTMTIsc7WkLk2j4V0AaSIbWMNyVmvE8B2tFEflqw2Oa 6SBI3bgGE7TfSC/CjtAG5jt/+7FvAgk+FREIoAIvVB3DejJZuUGk2VM9bGZIR6Ed7FXX GT6/teFuV47rbK7UvFwz5Ud7giRF6pQBRJ+JD3PBXu8zEm5ffxpVZZxaasYOVX+6HSU9 5hsbdvGqCxqyrgLCc2zN5747I2VTJy5+0iWHINSsJbTwhW1tT28BknHbc5tfEz5ypWrG yKQw== X-Forwarded-Encrypted: i=1; AJvYcCWIu1xAskIbLJ1VxJ3kDxyz76kO8GgCZNjPnoIaWPXeNOwWiF+cgCm52BjS5u0bqAAXnHeR1DWrdcltSzi1bYu7zOUBWg== X-Gm-Message-State: AOJu0Yz5mnEkoPeizvPl8Vnlc+cAjg6bZ1LQsYYml+hBJob4AwU/fHj8 9oL6vGr79PHZpFv8vDIssPk2iNN04VPaiKJ/u7bocZaS6zdZz4DLfgRr+xSTt5Q= X-Received: by 2002:a5d:684c:0:b0:345:f08b:a7cb with SMTP id o12-20020a5d684c000000b00345f08ba7cbmr2380672wrw.4.1713461189373; Thu, 18 Apr 2024 10:26:29 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c19d100b00416b163e52bsm7166057wmq.14.2024.04.18.10.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 10:26:28 -0700 (PDT) From: Caleb Connolly Date: Thu, 18 Apr 2024 18:25:49 +0100 Subject: [PATCH 6/9] mach-snapdragon: implement ft_board_setup() for USB role selection MIME-Version: 1.0 Message-Id: <20240418-b4-qcom-rbx-fixes-v1-6-f5f19d52969e@linaro.org> References: <20240418-b4-qcom-rbx-fixes-v1-0-f5f19d52969e@linaro.org> In-Reply-To: <20240418-b4-qcom-rbx-fixes-v1-0-f5f19d52969e@linaro.org> To: Caleb Connolly , Neil Armstrong , Sumit Garg , Tom Rini Cc: u-boot-qcom@groups.io, u-boot@lists.denx.de X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1783; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=vTdWylU+Qm/b2Kjzlu3fUijp+wgsNbm8wf9HDTuxWOg=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhjTF8H388XE9U1fUmLvWffZNU5pRtttEoqq74PGq+S1ux 6X1Lv3rKGVhEORgkBVTZBE/scyyae1le43tCy7AzGFlAhnCwMUpABNhSGH4yTh5E//KkzeZOLkZ d+5PfGzPv6r4jeZjK8bqjxf5TYsWhDAytE9c4TJrX/jcXl5PjukqSW2bKryzWXkid/758m1xVs4 PNgA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Some Qualcomm boards have only one USB controller which is muxed between the type-c port and an internal USB hub for type-A and ethernet. We modify the DT for these to force them to host mode in U-Boot. However in Linux DRD role switching is supported (required, even). Use ft_board_setup() to adjust the dr_mode property for these boards. While we're here, define pr_fmt for this file so we can more easily identify log messages. Signed-off-by: Caleb Connolly --- arch/arm/mach-snapdragon/of_fixup.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c index 3f7ac227bd09..55368dd43b66 100644 --- a/arch/arm/mach-snapdragon/of_fixup.c +++ b/arch/arm/mach-snapdragon/of_fixup.c @@ -16,8 +16,10 @@ * Copyright (c) 2024 Linaro Ltd. * Author: Caleb Connolly */ +#define pr_fmt(fmt) "of_fixup: " fmt + #include #include #include #include @@ -152,4 +154,22 @@ void qcom_of_fixup_nodes(void) { time_call(fixup_usb_nodes); time_call(fixup_power_domains); } + +int ft_board_setup(void *blob, struct bd_info __maybe_unused *bd) +{ + struct fdt_header *fdt = blob; + int node; + + /* We only want to do this fix-up for the RB1 board, quick return for all others */ + if (!fdt_node_check_compatible(fdt, 0, "qcom,qrb4210-rb2")) + return 0; + + fdt_for_each_node_by_compatible(node, blob, 0, "snps,dwc3") { + log_debug("%s: Setting 'dr_mode' to OTG\n", fdt_get_name(blob, node, NULL)); + fdt_setprop_string(fdt, node, "dr_mode", "otg"); + break; + } + + return 0; +}