From patchwork Wed Apr 3 12:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919268 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=fwnHO3GY; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k6H1668z23tl for ; Wed, 3 Apr 2024 23:08:07 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5FF9C88389; Wed, 3 Apr 2024 14:07:55 +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="fwnHO3GY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3C2F28838F; Wed, 3 Apr 2024 14:07:54 +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-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (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 D48ED88367 for ; Wed, 3 Apr 2024 14:07:50 +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-ej1-x636.google.com with SMTP id a640c23a62f3a-a51320fc5d6so55100066b.1 for ; Wed, 03 Apr 2024 05:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146070; x=1712750870; 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=dJza8irKGD1LCWutbG2pawgU5HuytyqoLzmIGB2jhMo=; b=fwnHO3GYAn2CAuIbL8DdLWSSMGVT+tR5JdijB9eNKQHCus0SX5Bcq0qzXgIZ7wjobj Iu0JewLKVhlR5ggFXigwSk4N49x1xJHTeNgSWB3nqv6HL++uSCLPAgkUZUpp4DhCQI5A zy1omTBIr0LBuM8ygnS+5hEoQoQQWioMDJwURxrSX8/jjfNEmIPB2WxaFiHF5G4Me0EP 1NDcTPN7McEBzIvPMyIBhJzQl6uYfEiFgO5gbfxWHZv8ccCwQ9mmQB87FF+ZVBakApxK hBeLES61O0u1szc5ryXmpYc2nGDHO3QNnEIpsh9k5Qe48pgAUIEGL4ZYQjOpjGdy7xfV ifyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146070; x=1712750870; 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=dJza8irKGD1LCWutbG2pawgU5HuytyqoLzmIGB2jhMo=; b=iboQdB/XUQ1/RcorTySC72oGr41NDLSfEyiXZJmxCu5banoCuLocSs4NdtQU4dBDd0 oBW5Wb4WcxqLbaQ8j2J2iFS46RD+JsGWkX+jr0OUEx3oQc1T+2OHJHfvCSry7rI5ykg3 /x0pWMCrNne9Qf90913JjO/bIfLIbaTcEzafkaOkhlRG7I3qLYY+waJcYXC3G9osa31v UeurQj57qAcINxUGAl6oVC78qIcfnTjnAU/oiD4UUfCZN1lAYlhNGJvS2mGfRbgzUbcx 6735wlLyTysHWv80MnOO467pln3iEppnMEg7awp02KpENJxDItaM1VztQiGm9LgOudH5 Wh+g== X-Gm-Message-State: AOJu0YxbEnTt5iaAIeXAfE6p9KhtJQanHRmt2K+3MwHWfz2ICOzFgkQO 4XRlNU7fY+Y6TrtWD5mL+cd8wBMXtoHeYhj56Ctn3ez2ryss2+zAnaQBN89AV4c= X-Google-Smtp-Source: AGHT+IGQCcKDbZK1EZ4wjhPKwQ6QBUtTZlNfidIei9rx11T2I+9pErK90YlS3j1OLD5loSSvk63KIg== X-Received: by 2002:a17:906:46db:b0:a51:763e:b788 with SMTP id k27-20020a17090646db00b00a51763eb788mr460710ejs.40.1712146070341; Wed, 03 Apr 2024 05:07:50 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:49 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:36 +0200 Subject: [PATCH v6 01/16] mailmap: update Bhupesh's email address MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-1-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de, Bhupesh Sharma X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1165; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=XSvtB4NoCXg6pY1Nq/qGGGjasqOo57hNo8/eyKot594=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaQdJWqOJj/3btMERubBnuE8mU26MvMG4hTz rjs1ma/V1aJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkAAKCRAFgzErGV9k ttItD/9zubcpV2vuUddY7HYzDoSXrRb+t9CcPRSgVtPoE/kxe+oNsAXkBKUgNO5fCp7vAy36G1A tNZ53fu/RLvVvWFlyY2JwIUR9w6vRbil4jyPKIOpAeF6hEC91IyqRqvsvENOGcRBtpBQZYds8TA dtdrKSTuq5R7L0OcqM3iH152tGJHEn3bx1gNWm5TpHM0REVG4jqbKSV39FT4gREC4O/VuqNrsvp jXf3QN+NOXy65n6nVwyFCQ7wQ6cCXX3xExn5VgrsuowvdJobK/V2MhOjYCe+DjfNWON4P7jrGgM ok9+dKbCxV6qlNmkSGCAQyddQcX8owBW+SM3XDo2EmUnR8kg/T0YA+GEZgFYS6nTKLaJG8WgB+A hI35RpaAgGTBbSud9hYxkFFf+lOaStOtA8elndG7/m18yNnhipzHq+INyOhz4BeLCeVPQTe/FVK fcZd0ZIUuFGJkjJtHwOOyGr+jYZo4VuT3i70crybJzaG/hOBrFqBlrjZjJo/ds7OjCRgCAdFFoF HWaxoOY2tGE49ROEhteYDh02Vd0A8CamZuX6Rd4m/55lRemUX72HNGHK+kVHk5HDU98J+WDf4ue rPOftyV+756o7CniwPMQ5pMoNZFTjGx01t+sIhkLU1hOppTRbh3atPDWTa9122hKlxHlxMvwK0n hrO27WMMH20YLmw== 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 Update Bhupesh's email to his new one. Reviewed-by: Neil Armstrong Signed-off-by: Caleb Connolly --- Cc: Bhupesh Sharma --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index d1f08f3eca8a..f6e0847b2168 100644 --- a/.mailmap +++ b/.mailmap @@ -29,8 +29,9 @@ Ashok Reddy Soma Atish Patra Bharat Kumar Gogada Bharat Kumar Gogada Bhargava Sreekantappa Gayathri +Bhupesh Sharma Bin Meng Boris Brezillon Boris Brezillon Christian Kohn From patchwork Wed Apr 3 12:07:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919269 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Spyhkpgh; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k6T1ZJfz23tl for ; Wed, 3 Apr 2024 23:08:17 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC7C088392; Wed, 3 Apr 2024 14:07:55 +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="Spyhkpgh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8FD0D88378; Wed, 3 Apr 2024 14:07:54 +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-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (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 01A4788381 for ; Wed, 3 Apr 2024 14:07:52 +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-ej1-x62f.google.com with SMTP id a640c23a62f3a-a4f1928bda5so64819666b.2 for ; Wed, 03 Apr 2024 05:07:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146071; x=1712750871; 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=aOr/sX+VlUJKn+m2ODZMVOXoyYKzp0OTGmvKS29yZIE=; b=Spyhkpghwi2Oirvo+CvMnfwSQTdl32+NxUiqpAhpTF5iTrVtlSj/SkTBQJI86pw9Qm ZI7ZOJcFCrf22eS+Ab1aNrB9tPgG0XYx7px3sPB7NLNzWUrs3r+5zTZ9OIpvh+tLd68u OUz7RC8l6FfOgGvQD6AlJCTIxVAg+aecW1oIpQQx8OcQLBhp+jqakseGq1fotNfDHKf5 XdL6Qdqn8tIuCVvNUxuKI01VHoZgOguUBCG6EbcJskZwODYW+5fNsL1YyG3mB4PmJ7bG KC23cBUxs8He/wt3qR+X6t8IvGVe4fKw/HKm2LY5a+gn8zmIggUHdyjOC8GfLN7kUp/b HCoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146071; x=1712750871; 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=aOr/sX+VlUJKn+m2ODZMVOXoyYKzp0OTGmvKS29yZIE=; b=B0G+gjces2pOssa/4UV2OC8QrJRGQ92CnmRWfJXmJlwBpMgXPsv9sOFSCOQxwNwlHw sVzQofuYM1Ie7nnJ16ZLGwhJIUCuMGgluxQO2mmP1KyDT8lWBRdPLMxG+x1wCnKKIzrI UQ0Nwc2g9Lev1sDLhRMwAnK5IH9RS20T+D6mTAxhPRaRL+0qc4C1CpNJp5KyQ27AkevK EToTwYyJx6typi4YvF3IuegczUzbF+lLLIv85Nie+rFMAxPGE2zxAra/uquM3KUdYQ3N Aw/CmYZsv1t3FR/boGGT6sBQipti6yBT9xPakPrbrOMP40n+nj7qk8SRGcE9e8lV5PV4 tcnQ== X-Gm-Message-State: AOJu0YxrNJqYjYRFthaFdEzzKXprOrfbFL9oibjAq1ljSO10l2fhUH7w 2/LeoGevLndOHOZjbAczj4iQYZ+njJeTvXvgbUF/71Kodbx0PfbbP/ZdKVpMWn8eKKbXFok4qx1 PJrg= X-Google-Smtp-Source: AGHT+IHlJCCoJkqJX1NCUXROb+hsoZ25LbBmDtGNw7mbtXRtv0BtVjvaShzIMHSAZmy3aZ7XRnQhqA== X-Received: by 2002:a17:906:f203:b0:a4e:8be4:8cea with SMTP id gt3-20020a170906f20300b00a4e8be48ceamr3724473ejb.47.1712146071351; Wed, 03 Apr 2024 05:07:51 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:50 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:37 +0200 Subject: [PATCH v6 02/16] phy: qcom: add Qualcomm QUSB2 USB PHY driver MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-2-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de, Bhupesh Sharma , Bhupesh Sharma X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=14100; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=4b2mnUOwURE79EaLZQk8U/Csv3o5Zh+Q2/iPjqCNkAI=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaQV2wtFCAb6vfio4SGYBwUj5VtJ+xYlYAeG E6oxYG8geyJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkAAKCRAFgzErGV9k tl4vEACXXqks97/+3Mxs/jBShjttFYH/yCCBIr3QMxs1SBQfjwls+heX5Sem/JOqUKZeU+Z4i6p 2F7L7cEoQze3aacVGkD9DoGwNwyzj42lPwdMoEd3Swy+pIBx0FI3fThZMH974jSo3TO8Xeij4ud wqKlloqobOw+BfdwCCNu4vk+YJMNNgClQOfIMIQo/69nCV65h9wd/dkT+3EjSVFJTP05bRC9hNo G6TJTuMvq/AzgpB1boOLrJltL5lUFMyYzNZObTU2yxs2NxP3j5Ntot4lxspXDhXKqR75nxRoTiG oYxDS/KQ50tG8l7amd6GB0TFFfSQLolkglKXK+jKjFilrF7BDC7RrQIDsJ/mK//h+JeEqDyDMD9 0xg/pLZnfC36TsfQmG0HAZ5pFqs6A8BfpuFExXHYQfasrDcNZaQxcQhEeCt29N7hQsgLGtbvl/I ZlzLIzwv+0Fn16g6rst+CsvXkUQxK005MNe0OU7wXfkc/3dryNRAmbHje/uC8TVounY2vOGMKVR 0qCgHRW2THBVoknRFhBJDrGXgv1yavOhjJ3hekKSbts189qY8b1zj9S9++pA6goUutQSztVOMgt auO7wvRRSHIntUbvu6PGRtzO6cAl7ImDAEdcQCVdpd+CTGQXpbZBEkOhrh7rO8x+VtisA7BBPR1 RibF+gzRr4CINpQ== 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 From: Bhupesh Sharma The Snapdragon 845 and several other Qualcomm SoCs feature this USB high-speed phy. Add a driver for it based on the Linux driver, with support for the SDM845, and the QCM2290 and SM6115 SoCs which will gain support in U-Boot in future patches. Signed-off-by: Bhupesh Sharma [code cleanup, switch to clk_bulk] Acked-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/phy/qcom/Kconfig | 7 + drivers/phy/qcom/Makefile | 1 + drivers/phy/qcom/phy-qcom-qusb2.c | 429 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 437 insertions(+) diff --git a/drivers/phy/qcom/Kconfig b/drivers/phy/qcom/Kconfig index f4ca174805a4..361dfb6e1126 100644 --- a/drivers/phy/qcom/Kconfig +++ b/drivers/phy/qcom/Kconfig @@ -11,8 +11,15 @@ config PHY_QCOM_IPQ4019_USB depends on PHY && ARCH_IPQ40XX help Support for the USB PHY-s on Qualcomm IPQ40xx SoC-s. +config PHY_QCOM_QUSB2 + tristate "Qualcomm USB QUSB2 PHY driver" + depends on PHY && ARCH_SNAPDRAGON + help + Enable this to support the Super-Speed USB transceiver on various + Qualcomm chipsets. + config PHY_QCOM_USB_HS_28NM tristate "Qualcomm 28nm High-Speed PHY" depends on PHY && ARCH_SNAPDRAGON help diff --git a/drivers/phy/qcom/Makefile b/drivers/phy/qcom/Makefile index 2113f178c0c7..f6af985666a4 100644 --- a/drivers/phy/qcom/Makefile +++ b/drivers/phy/qcom/Makefile @@ -1,4 +1,5 @@ obj-$(CONFIG_PHY_QCOM_IPQ4019_USB) += phy-qcom-ipq4019-usb.o obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o +obj-$(CONFIG_PHY_QCOM_QUSB2) += phy-qcom-qusb2.o obj-$(CONFIG_PHY_QCOM_USB_HS_28NM) += phy-qcom-usb-hs-28nm.o obj-$(CONFIG_PHY_QCOM_USB_SS) += phy-qcom-usb-ss.o diff --git a/drivers/phy/qcom/phy-qcom-qusb2.c b/drivers/phy/qcom/phy-qcom-qusb2.c new file mode 100644 index 000000000000..c91ba18c4ab1 --- /dev/null +++ b/drivers/phy/qcom/phy-qcom-qusb2.c @@ -0,0 +1,429 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2023 Bhupesh Sharma + * + * Based on Linux driver + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#define QUSB2PHY_PLL 0x0 +#define QUSB2PHY_PLL_TEST 0x04 +#define CLK_REF_SEL BIT(7) + +#define QUSB2PHY_PLL_TUNE 0x08 +#define QUSB2PHY_PLL_USER_CTL1 0x0c +#define QUSB2PHY_PLL_USER_CTL2 0x10 +#define QUSB2PHY_PLL_AUTOPGM_CTL1 0x1c +#define QUSB2PHY_PLL_PWR_CTRL 0x18 + +/* QUSB2PHY_PLL_STATUS register bits */ +#define PLL_LOCKED BIT(5) + +/* QUSB2PHY_PLL_COMMON_STATUS_ONE register bits */ +#define CORE_READY_STATUS BIT(0) + +/* QUSB2PHY_PORT_POWERDOWN register bits */ +#define CLAMP_N_EN BIT(5) +#define FREEZIO_N BIT(1) +#define POWER_DOWN BIT(0) + +/* QUSB2PHY_PWR_CTRL1 register bits */ +#define PWR_CTRL1_VREF_SUPPLY_TRIM BIT(5) +#define PWR_CTRL1_CLAMP_N_EN BIT(1) + +#define QUSB2PHY_REFCLK_ENABLE BIT(0) + +#define PHY_CLK_SCHEME_SEL BIT(0) + +/* QUSB2PHY_INTR_CTRL register bits */ +#define DMSE_INTR_HIGH_SEL BIT(4) +#define DPSE_INTR_HIGH_SEL BIT(3) +#define CHG_DET_INTR_EN BIT(2) +#define DMSE_INTR_EN BIT(1) +#define DPSE_INTR_EN BIT(0) + +/* QUSB2PHY_PLL_CORE_INPUT_OVERRIDE register bits */ +#define CORE_PLL_EN_FROM_RESET BIT(4) +#define CORE_RESET BIT(5) +#define CORE_RESET_MUX BIT(6) + +/* QUSB2PHY_IMP_CTRL1 register bits */ +#define IMP_RES_OFFSET_MASK GENMASK(5, 0) +#define IMP_RES_OFFSET_SHIFT 0x0 + +/* QUSB2PHY_PLL_BIAS_CONTROL_2 register bits */ +#define BIAS_CTRL2_RES_OFFSET_MASK GENMASK(5, 0) +#define BIAS_CTRL2_RES_OFFSET_SHIFT 0x0 + +/* QUSB2PHY_CHG_CONTROL_2 register bits */ +#define CHG_CTRL2_OFFSET_MASK GENMASK(5, 4) +#define CHG_CTRL2_OFFSET_SHIFT 0x4 + +/* QUSB2PHY_PORT_TUNE1 register bits */ +#define HSTX_TRIM_MASK GENMASK(7, 4) +#define HSTX_TRIM_SHIFT 0x4 +#define PREEMPH_WIDTH_HALF_BIT BIT(2) +#define PREEMPHASIS_EN_MASK GENMASK(1, 0) +#define PREEMPHASIS_EN_SHIFT 0x0 + +/* QUSB2PHY_PORT_TUNE2 register bits */ +#define HSDISC_TRIM_MASK GENMASK(1, 0) +#define HSDISC_TRIM_SHIFT 0x0 + +#define QUSB2PHY_PLL_ANALOG_CONTROLS_TWO 0x04 +#define QUSB2PHY_PLL_CLOCK_INVERTERS 0x18c +#define QUSB2PHY_PLL_CMODE 0x2c +#define QUSB2PHY_PLL_LOCK_DELAY 0x184 +#define QUSB2PHY_PLL_DIGITAL_TIMERS_TWO 0xb4 +#define QUSB2PHY_PLL_BIAS_CONTROL_1 0x194 +#define QUSB2PHY_PLL_BIAS_CONTROL_2 0x198 +#define QUSB2PHY_PWR_CTRL2 0x214 +#define QUSB2PHY_IMP_CTRL1 0x220 +#define QUSB2PHY_IMP_CTRL2 0x224 +#define QUSB2PHY_CHG_CTRL2 0x23c + +struct qusb2_phy_init_tbl { + unsigned int offset; + unsigned int val; + /* + * register part of layout ? + * if yes, then offset gives index in the reg-layout + */ + int in_layout; +}; + +struct qusb2_phy_cfg { + const struct qusb2_phy_init_tbl *tbl; + /* number of entries in the table */ + unsigned int tbl_num; + /* offset to PHY_CLK_SCHEME register in TCSR map */ + unsigned int clk_scheme_offset; + + /* array of registers with different offsets */ + const unsigned int *regs; + unsigned int mask_core_ready; + unsigned int disable_ctrl; + unsigned int autoresume_en; + + /* true if PHY has PLL_TEST register to select clk_scheme */ + bool has_pll_test; + + /* true if TUNE1 register must be updated by fused value, else TUNE2 */ + bool update_tune1_with_efuse; + + /* true if PHY has PLL_CORE_INPUT_OVERRIDE register to reset PLL */ + bool has_pll_override; +}; + +/* set of registers with offsets different per-PHY */ +enum qusb2phy_reg_layout { + QUSB2PHY_PLL_CORE_INPUT_OVERRIDE, + QUSB2PHY_PLL_STATUS, + QUSB2PHY_PORT_TUNE1, + QUSB2PHY_PORT_TUNE2, + QUSB2PHY_PORT_TUNE3, + QUSB2PHY_PORT_TUNE4, + QUSB2PHY_PORT_TUNE5, + QUSB2PHY_PORT_TEST1, + QUSB2PHY_PORT_TEST2, + QUSB2PHY_PORT_POWERDOWN, + QUSB2PHY_INTR_CTRL, +}; + +#define QUSB2_PHY_INIT_CFG(o, v) \ + { \ + .offset = o, .val = v, \ + } + +#define QUSB2_PHY_INIT_CFG_L(o, v) \ + { \ + .offset = o, .val = v, .in_layout = 1, \ + } + +static const struct qusb2_phy_init_tbl sm6115_init_tbl[] = { + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE1, 0xf8), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE2, 0x53), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE3, 0x81), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE4, 0x17), + + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_TUNE, 0x30), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_USER_CTL1, 0x79), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_USER_CTL2, 0x21), + + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TEST2, 0x14), + + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_AUTOPGM_CTL1, 0x9f), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_PWR_CTRL, 0x00), +}; + +static const unsigned int sm6115_regs_layout[] = { + [QUSB2PHY_PLL_STATUS] = 0x38, [QUSB2PHY_PORT_TUNE1] = 0x80, + [QUSB2PHY_PORT_TUNE2] = 0x84, [QUSB2PHY_PORT_TUNE3] = 0x88, + [QUSB2PHY_PORT_TUNE4] = 0x8c, [QUSB2PHY_PORT_TUNE5] = 0x90, + [QUSB2PHY_PORT_TEST1] = 0xb8, [QUSB2PHY_PORT_TEST2] = 0x9c, + [QUSB2PHY_PORT_POWERDOWN] = 0xb4, [QUSB2PHY_INTR_CTRL] = 0xbc, +}; + +static const struct qusb2_phy_init_tbl qusb2_v2_init_tbl[] = { + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_ANALOG_CONTROLS_TWO, 0x03), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_CLOCK_INVERTERS, 0x7c), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_CMODE, 0x80), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_LOCK_DELAY, 0x0a), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_DIGITAL_TIMERS_TWO, 0x19), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_BIAS_CONTROL_1, 0x40), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_BIAS_CONTROL_2, 0x20), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PWR_CTRL2, 0x21), + QUSB2_PHY_INIT_CFG(QUSB2PHY_IMP_CTRL1, 0x0), + QUSB2_PHY_INIT_CFG(QUSB2PHY_IMP_CTRL2, 0x58), + + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE1, 0x30), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE2, 0x29), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE3, 0xca), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE4, 0x04), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE5, 0x03), + + QUSB2_PHY_INIT_CFG(QUSB2PHY_CHG_CTRL2, 0x0), +}; + +static const unsigned int qusb2_v2_regs_layout[] = { + [QUSB2PHY_PLL_CORE_INPUT_OVERRIDE] = 0xa8, + [QUSB2PHY_PLL_STATUS] = 0x1a0, + [QUSB2PHY_PORT_TUNE1] = 0x240, + [QUSB2PHY_PORT_TUNE2] = 0x244, + [QUSB2PHY_PORT_TUNE3] = 0x248, + [QUSB2PHY_PORT_TUNE4] = 0x24c, + [QUSB2PHY_PORT_TUNE5] = 0x250, + [QUSB2PHY_PORT_TEST1] = 0x254, + [QUSB2PHY_PORT_TEST2] = 0x258, + [QUSB2PHY_PORT_POWERDOWN] = 0x210, + [QUSB2PHY_INTR_CTRL] = 0x230, +}; + +static const struct qusb2_phy_cfg sm6115_phy_cfg = { + .tbl = sm6115_init_tbl, + .tbl_num = ARRAY_SIZE(sm6115_init_tbl), + .regs = sm6115_regs_layout, + + .has_pll_test = true, + .disable_ctrl = (CLAMP_N_EN | FREEZIO_N | POWER_DOWN), + .mask_core_ready = PLL_LOCKED, + .autoresume_en = BIT(3), +}; + +static const struct qusb2_phy_cfg qusb2_v2_phy_cfg = { + .tbl = qusb2_v2_init_tbl, + .tbl_num = ARRAY_SIZE(qusb2_v2_init_tbl), + .regs = qusb2_v2_regs_layout, + + .disable_ctrl = (PWR_CTRL1_VREF_SUPPLY_TRIM | PWR_CTRL1_CLAMP_N_EN | + POWER_DOWN), + .mask_core_ready = CORE_READY_STATUS, + .has_pll_override = true, + .autoresume_en = BIT(0), + .update_tune1_with_efuse = true, +}; + +/** + * struct qusb2_phy - structure holding qusb2 phy attributes + * + * @phy: generic phy + * @base: iomapped memory space for qubs2 phy + * + * @cfg_ahb_clk: AHB2PHY interface clock + * @phy_rst: phy reset control + * + * @cfg: phy config data + * @has_se_clk_scheme: indicate if PHY has single-ended ref clock scheme + */ +struct qusb2_phy { + struct phy *phy; + void __iomem *base; + + struct clk cfg_ahb_clk; + struct reset_ctl phy_rst; + + const struct qusb2_phy_cfg *cfg; + bool has_se_clk_scheme; +}; + +static inline void qusb2_phy_configure(void __iomem *base, + const unsigned int *regs, + const struct qusb2_phy_init_tbl tbl[], + int num) +{ + int i; + + for (i = 0; i < num; i++) { + if (tbl[i].in_layout) + writel(tbl[i].val, base + regs[tbl[i].offset]); + else + writel(tbl[i].val, base + tbl[i].offset); + } +} + +static int qusb2phy_do_reset(struct qusb2_phy *qphy) +{ + int ret; + + ret = reset_assert(&qphy->phy_rst); + if (ret) + return ret; + + udelay(500); + + ret = reset_deassert(&qphy->phy_rst); + if (ret) + return ret; + + return 0; +} + +static int qusb2phy_power_on(struct phy *phy) +{ + struct qusb2_phy *qphy = dev_get_priv(phy->dev); + const struct qusb2_phy_cfg *cfg = qphy->cfg; + int ret; + u32 val; + + ret = qusb2phy_do_reset(qphy); + if (ret) + return ret; + + /* Disable the PHY */ + setbits_le32(qphy->base + cfg->regs[QUSB2PHY_PORT_POWERDOWN], + qphy->cfg->disable_ctrl); + + if (cfg->has_pll_test) { + /* save reset value to override reference clock scheme later */ + val = readl(qphy->base + QUSB2PHY_PLL_TEST); + } + + qusb2_phy_configure(qphy->base, cfg->regs, cfg->tbl, cfg->tbl_num); + + /* Enable the PHY */ + clrbits_le32(qphy->base + cfg->regs[QUSB2PHY_PORT_POWERDOWN], + POWER_DOWN); + + /* Required to get phy pll lock successfully */ + udelay(150); + + if (cfg->has_pll_test) { + val |= CLK_REF_SEL; + + writel(val, qphy->base + QUSB2PHY_PLL_TEST); + + /* ensure above write is through */ + readl(qphy->base + QUSB2PHY_PLL_TEST); + } + + /* Required to get phy pll lock successfully */ + udelay(100); + + val = readb(qphy->base + cfg->regs[QUSB2PHY_PLL_STATUS]); + if (!(val & cfg->mask_core_ready)) { + pr_err("QUSB2PHY pll lock failed: status reg = %x\n", val); + ret = -EBUSY; + return ret; + } + + return 0; +} + +static int qusb2phy_power_off(struct phy *phy) +{ + struct qusb2_phy *qphy = dev_get_priv(phy->dev); + + /* Disable the PHY */ + setbits_le32(qphy->base + qphy->cfg->regs[QUSB2PHY_PORT_POWERDOWN], + qphy->cfg->disable_ctrl); + + reset_assert(&qphy->phy_rst); + + clk_disable(&qphy->cfg_ahb_clk); + + return 0; +} + +static int qusb2phy_clk_init(struct udevice *dev, struct qusb2_phy *qphy) +{ + int ret; + + /* We ignore the ref clock as we currently lack a driver for rpmcc/rpmhcc where + * it usually comes from - we assume it's always on. + */ + ret = clk_get_by_name(dev, "cfg_ahb", &qphy->cfg_ahb_clk); + if (ret == -ENOSYS || ret == -ENOENT) + return 0; + if (ret) + return ret; + + ret = clk_enable(&qphy->cfg_ahb_clk); + if (ret) + return ret; + + return 0; +} + +static int qusb2phy_probe(struct udevice *dev) +{ + struct qusb2_phy *qphy = dev_get_priv(dev); + int ret; + + qphy->base = (void __iomem *)dev_read_addr(dev); + if (IS_ERR(qphy->base)) + return PTR_ERR(qphy->base); + + ret = qusb2phy_clk_init(dev, qphy); + if (ret) { + printf("%s: Couldn't get clocks: %d\n", __func__, ret); + return ret; + } + + ret = reset_get_by_index(dev, 0, &qphy->phy_rst); + if (ret) { + printf("%s: Couldn't get resets: %d\n", __func__, ret); + return ret; + } + + qphy->cfg = (const struct qusb2_phy_cfg *)dev_get_driver_data(dev); + if (!qphy->cfg) { + printf("%s: Couldn't get driver data\n", __func__); + return -EINVAL; + } + + debug("%s success qusb phy cfg %p\n", __func__, qphy->cfg); + return 0; +} + +static struct phy_ops qusb2phy_ops = { + .power_on = qusb2phy_power_on, + .power_off = qusb2phy_power_off, +}; + +static const struct udevice_id qusb2phy_ids[] = { + { .compatible = "qcom,qusb2-phy" }, + { .compatible = "qcom,qcm2290-qusb2-phy", + .data = (ulong)&sm6115_phy_cfg }, + { .compatible = "qcom,sm6115-qusb2-phy", + .data = (ulong)&sm6115_phy_cfg }, + { .compatible = "qcom,qusb2-v2-phy", .data = (ulong)&qusb2_v2_phy_cfg }, + {} +}; + +U_BOOT_DRIVER(qcom_qusb2_phy) = { + .name = "qcom-qusb2-phy", + .id = UCLASS_PHY, + .of_match = qusb2phy_ids, + .ops = &qusb2phy_ops, + .probe = qusb2phy_probe, + .priv_auto = sizeof(struct qusb2_phy), +}; From patchwork Wed Apr 3 12:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919270 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=j7j7aknG; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k6f6wy9z23tl for ; Wed, 3 Apr 2024 23:08:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4614788387; Wed, 3 Apr 2024 14:07:56 +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="j7j7aknG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E300588238; Wed, 3 Apr 2024 14:07:54 +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-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (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 C387988238 for ; Wed, 3 Apr 2024 14:07:52 +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-ej1-x629.google.com with SMTP id a640c23a62f3a-a4715991c32so815377866b.1 for ; Wed, 03 Apr 2024 05:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146072; x=1712750872; 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=+o3PpMc4oPrjWdLdX8pAaY+amZFo64S0kQetGnJX5jI=; b=j7j7aknGZelmtA/B8PmmAO0uMvWRhmcyFUCy76tVTR8g2JXC9uCUn3lR9JC0gvgMqc TrmqExOZm8NEY0gIxoGskoRMwTbUDpVdV5+ntWYwJlq4WpJuXlKoxv5AQ2fybPIcsTfQ 2njXfp3MMjTXIYehsrIQnJN1LjyIf+CEYDfcQD1b33u9PCxLylHdDJryqr4AD4k9OYol zsxnhh9ck7o7Pg2keB3IlhE3TOdw3nYPJEMAPpQ2V4fsQkIei79EQ5AWUc1JWqeoaSpY XSNjTJoDZ1C/zbYzz7/eV9kcKB8rYF4YcpB67uzwF04rniUtDcaPpPxhLBpK9e6js95s aiBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146072; x=1712750872; 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=+o3PpMc4oPrjWdLdX8pAaY+amZFo64S0kQetGnJX5jI=; b=CC/wg5RsQYbxlwjW1D0EZeHoEedovTWoLNVrpBbcJrSRYFyuExzC7lc/CrFFAX08ux j7EDY+Zo9qqF3lhx/loYKAG3GYh2BTo/HfCT4bnRxOZDKUhcBe8g620YzUhYyk0PMYvi /YmNwokUB+W/MI2OTG12n6kPQbr+Xqtzyi3eE+6UrW9G1O9UFaZ8MVgjMJa+yumqfoDS CdKl8jkafSZYc9DT7pxkpzvTgf36PALXpL9cGzDLo2grvbBGmaIp99lTkjHvZifUb8Ag AOdkTTUtWPhcr+/tPwCuPjuUCQ0b4p1Da6veGYnf6kWSFUiWUtmLmpGDjVOFXO/cIkKI T62w== X-Gm-Message-State: AOJu0Yy77932ZF6KfPP2vl8n63fAVSjCGQo6fnLkRBYbrHxQIAeW2KFT NEbfvNeDpSiNJCWzdqr2gamtxalY/0nGPhSdjakR3UNwsVd/hb7RIrgp9VpxWAY= X-Google-Smtp-Source: AGHT+IF3yzq0/VCWTBbY58qHJ/Q4wj5f9+lettpZy+QgHyluI+ucCezxgPNS4jcTtqLUB4uK/9THHA== X-Received: by 2002:a17:906:c109:b0:a4e:3b78:ed1f with SMTP id do9-20020a170906c10900b00a4e3b78ed1fmr11326289ejc.47.1712146072359; Wed, 03 Apr 2024 05:07:52 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:51 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:38 +0200 Subject: [PATCH v6 03/16] phy: qcom: Add SNPS femto v2 USB HS phy MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-3-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de, Bhupesh Sharma , Bhupesh Sharma X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=8526; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=oOL/DRfxrv8Q9P4HeVQuAVE7WGDbbN6Fr8CRIXm0LIY=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaQL1GrMz+gf3ATcnAOOurAGuBnQkWYYIMvr V4s1GwpqV+JAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkAAKCRAFgzErGV9k tk75EACBf++fM19tSb9HvnNGBUNkL+NE7THb5oArslQQI3ynP6rxMifSuZydRbPNiL3V/fDKytT BV/tH49A79MJVz9itF0HsBmax/r8LbR0kavFyVan8JJVz8rJLZxMBs4iI/npnsnWsp8ud7pgCxz ITJThCewVdyOYIVeMssaHkmvtX9SPDBUyd5hnzOVj5QX5y+NlPh9uSHUyZxlgOMMOgAyDf2bvUU eQQCxyNsDHr9xX4IZM6dujvi25PGAPtZy0XRdrtRv7FAgMZ5g/W65h6ExLuFmhkrDXvW4Cn2Pby NJ2CCew1PV4v44QAtGdZerzuiAgq8yE7vqg+QvDXKbKNdsV91fTf3MIV72Dl7EGpxpZeP6j3nJM Gk2rnbZjYUQnqk1/BfIQ1XOBGlUlKyUKXzKRg97/Ysv85VxeihQASqWFRJwOtx3USCgVU1HG4iN cql6FegqVe3l34lwMXT2qQNqCKZkVWL8Orl4R9qf+ppB6r+y8N/101t0g/AR0snBb6XjU38i5Ol Kgj1E/XthktQXXYx+gtNh8t0IdCvY6KW9bVhx7BSppW8LDcgaICuL3rKlQ+MVdReWXM7+MMz1Gk XYZpH5cJABznQn3pnbMp6p/WIa2B1dKT0tfhY4LWU7Imvx5959AhJawlxFO7N0V39/5uSBZvskb CB+fuq/oDlrLTSQ== 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 From: Bhupesh Sharma Some Qualcomm SoCs newer than SDM845 feature a so-called "7nm phy" driver, notable the SM8250 SoC which will gain U-Boot support in upcoming patches. Introduce a driver based on the Linux driver. Signed-off-by: Bhupesh Sharma [code cleanup, align symbol names with Linux, switch to clk/reset_bulk APIs] Acked-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/phy/qcom/Kconfig | 8 ++ drivers/phy/qcom/Makefile | 1 + drivers/phy/qcom/phy-qcom-snps-femto-v2.c | 216 ++++++++++++++++++++++++++++++ 3 files changed, 225 insertions(+) diff --git a/drivers/phy/qcom/Kconfig b/drivers/phy/qcom/Kconfig index 361dfb6e1126..b9fe608c2798 100644 --- a/drivers/phy/qcom/Kconfig +++ b/drivers/phy/qcom/Kconfig @@ -18,8 +18,16 @@ config PHY_QCOM_QUSB2 help Enable this to support the Super-Speed USB transceiver on various Qualcomm chipsets. +config PHY_QCOM_USB_SNPS_FEMTO_V2 + tristate "Qualcomm SNPS FEMTO USB HS PHY v2" + depends on PHY && ARCH_SNAPDRAGON + help + Enable this to support the Qualcomm Synopsys DesignWare Core 7nm + High-Speed PHY driver. This driver supports the Hi-Speed PHY which + is usually paired with Synopsys DWC3 USB IPs on MSM SOCs. + config PHY_QCOM_USB_HS_28NM tristate "Qualcomm 28nm High-Speed PHY" depends on PHY && ARCH_SNAPDRAGON help diff --git a/drivers/phy/qcom/Makefile b/drivers/phy/qcom/Makefile index f6af985666a4..5f4db4a53788 100644 --- a/drivers/phy/qcom/Makefile +++ b/drivers/phy/qcom/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_PHY_QCOM_IPQ4019_USB) += phy-qcom-ipq4019-usb.o obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o obj-$(CONFIG_PHY_QCOM_QUSB2) += phy-qcom-qusb2.o +obj-$(CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2) += phy-qcom-snps-femto-v2.o obj-$(CONFIG_PHY_QCOM_USB_HS_28NM) += phy-qcom-usb-hs-28nm.o obj-$(CONFIG_PHY_QCOM_USB_SS) += phy-qcom-usb-ss.o diff --git a/drivers/phy/qcom/phy-qcom-snps-femto-v2.c b/drivers/phy/qcom/phy-qcom-snps-femto-v2.c new file mode 100644 index 000000000000..a1675b664e46 --- /dev/null +++ b/drivers/phy/qcom/phy-qcom-snps-femto-v2.c @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020, The Linux Foundation. All rights reserved. + * Copyright (C) 2023 Bhupesh Sharma + * + * Based on Linux driver + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define USB2_PHY_USB_PHY_UTMI_CTRL0 (0x3c) +#define SLEEPM BIT(0) +#define OPMODE_MASK GENMASK(4, 3) +#define OPMODE_NORMAL (0x00) +#define OPMODE_NONDRIVING BIT(3) +#define TERMSEL BIT(5) + +#define USB2_PHY_USB_PHY_UTMI_CTRL5 (0x50) +#define POR BIT(1) + +#define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0 (0x54) +#define SIDDQ BIT(2) +#define RETENABLEN BIT(3) +#define FSEL_MASK GENMASK(6, 4) +#define FSEL_DEFAULT (0x3 << 4) + +#define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1 (0x58) +#define VBUSVLDEXTSEL0 BIT(4) +#define PLLBTUNE BIT(5) + +#define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON2 (0x5c) +#define VREGBYPASS BIT(0) + +#define USB2_PHY_USB_PHY_HS_PHY_CTRL1 (0x60) +#define VBUSVLDEXT0 BIT(0) + +#define USB2_PHY_USB_PHY_HS_PHY_CTRL2 (0x64) +#define USB2_AUTO_RESUME BIT(0) +#define USB2_SUSPEND_N BIT(2) +#define USB2_SUSPEND_N_SEL BIT(3) + +#define USB2_PHY_USB_PHY_CFG0 (0x94) +#define UTMI_PHY_DATAPATH_CTRL_OVERRIDE_EN BIT(0) +#define UTMI_PHY_CMN_CTRL_OVERRIDE_EN BIT(1) + +#define USB2_PHY_USB_PHY_REFCLK_CTRL (0xa0) +#define REFCLK_SEL_MASK GENMASK(1, 0) +#define REFCLK_SEL_DEFAULT (0x2 << 0) + +struct qcom_snps_hsphy { + void __iomem *base; + struct clk_bulk clks; + struct reset_ctl_bulk resets; +}; + +/* + * We should just be able to use clrsetbits_le32() here, but this results + * in crashes on some boards. This is suspected to be because of some bus + * arbitration quirks with the PHY (i.e. it takes several bus clock cycles + * for the write to actually go through). The readl_relaxed() at the end will + * block until the write is completed (and all registers updated), and thus + * ensure that we don't access the PHY registers when they're in an + * undetermined state. + */ +static inline void qcom_snps_hsphy_write_mask(void __iomem *base, u32 offset, + u32 mask, u32 val) +{ + u32 reg; + + reg = readl_relaxed(base + offset); + + reg &= ~mask; + reg |= val & mask; + writel_relaxed(reg, base + offset); + + /* Ensure above write is completed */ + readl_relaxed(base + offset); +} + +static int qcom_snps_hsphy_usb_init(struct phy *phy) +{ + struct qcom_snps_hsphy *priv = dev_get_priv(phy->dev); + + qcom_snps_hsphy_write_mask(priv->base, USB2_PHY_USB_PHY_CFG0, + UTMI_PHY_CMN_CTRL_OVERRIDE_EN, + UTMI_PHY_CMN_CTRL_OVERRIDE_EN); + qcom_snps_hsphy_write_mask(priv->base, USB2_PHY_USB_PHY_UTMI_CTRL5, POR, + POR); + qcom_snps_hsphy_write_mask(priv->base, + USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0, FSEL_MASK, 0); + qcom_snps_hsphy_write_mask(priv->base, + USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1, + PLLBTUNE, PLLBTUNE); + qcom_snps_hsphy_write_mask(priv->base, USB2_PHY_USB_PHY_REFCLK_CTRL, + REFCLK_SEL_DEFAULT, REFCLK_SEL_MASK); + qcom_snps_hsphy_write_mask(priv->base, + USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1, + VBUSVLDEXTSEL0, VBUSVLDEXTSEL0); + qcom_snps_hsphy_write_mask(priv->base, USB2_PHY_USB_PHY_HS_PHY_CTRL1, + VBUSVLDEXT0, VBUSVLDEXT0); + + qcom_snps_hsphy_write_mask(priv->base, + USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON2, + VREGBYPASS, VREGBYPASS); + + qcom_snps_hsphy_write_mask(priv->base, USB2_PHY_USB_PHY_HS_PHY_CTRL2, + USB2_SUSPEND_N_SEL | USB2_SUSPEND_N, + USB2_SUSPEND_N_SEL | USB2_SUSPEND_N); + + qcom_snps_hsphy_write_mask(priv->base, USB2_PHY_USB_PHY_UTMI_CTRL0, + SLEEPM, SLEEPM); + + qcom_snps_hsphy_write_mask( + priv->base, USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0, SIDDQ, 0); + + qcom_snps_hsphy_write_mask(priv->base, USB2_PHY_USB_PHY_UTMI_CTRL5, POR, + 0); + + qcom_snps_hsphy_write_mask(priv->base, USB2_PHY_USB_PHY_HS_PHY_CTRL2, + USB2_SUSPEND_N_SEL, 0); + + qcom_snps_hsphy_write_mask(priv->base, USB2_PHY_USB_PHY_CFG0, + UTMI_PHY_CMN_CTRL_OVERRIDE_EN, 0); + + return 0; +} + +static int qcom_snps_hsphy_power_on(struct phy *phy) +{ + struct qcom_snps_hsphy *priv = dev_get_priv(phy->dev); + int ret; + + clk_enable_bulk(&priv->clks); + + ret = reset_deassert_bulk(&priv->resets); + if (ret) + return ret; + + ret = qcom_snps_hsphy_usb_init(phy); + if (ret) + return ret; + + return 0; +} + +static int qcom_snps_hsphy_power_off(struct phy *phy) +{ + struct qcom_snps_hsphy *priv = dev_get_priv(phy->dev); + + reset_assert_bulk(&priv->resets); + clk_disable_bulk(&priv->clks); + + return 0; +} + +static int qcom_snps_hsphy_phy_probe(struct udevice *dev) +{ + struct qcom_snps_hsphy *priv = dev_get_priv(dev); + int ret; + + priv->base = dev_read_addr_ptr(dev); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + ret = clk_get_bulk(dev, &priv->clks); + if (ret < 0 && ret != -ENOENT) { + printf("%s: Failed to get clocks %d\n", __func__, ret); + return ret; + } + + ret = reset_get_bulk(dev, &priv->resets); + if (ret < 0) { + printf("failed to get resets, ret = %d\n", ret); + return ret; + } + + clk_enable_bulk(&priv->clks); + reset_deassert_bulk(&priv->resets); + + return 0; +} + +static struct phy_ops qcom_snps_hsphy_phy_ops = { + .power_on = qcom_snps_hsphy_power_on, + .power_off = qcom_snps_hsphy_power_off, +}; + +static const struct udevice_id qcom_snps_hsphy_phy_ids[] = { + { .compatible = "qcom,sm8150-usb-hs-phy" }, + { .compatible = "qcom,usb-snps-hs-5nm-phy" }, + { .compatible = "qcom,usb-snps-hs-7nm-phy" }, + { .compatible = "qcom,usb-snps-femto-v2-phy" }, + {} +}; + +U_BOOT_DRIVER(qcom_usb_qcom_snps_hsphy) = { + .name = "qcom-snps-hsphy", + .id = UCLASS_PHY, + .of_match = qcom_snps_hsphy_phy_ids, + .ops = &qcom_snps_hsphy_phy_ops, + .probe = qcom_snps_hsphy_phy_probe, + .priv_auto = sizeof(struct qcom_snps_hsphy), +}; From patchwork Wed Apr 3 12:07:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919271 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=RiJNzoc4; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k6s3vxgz23tl for ; Wed, 3 Apr 2024 23:08:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B265F8838B; Wed, 3 Apr 2024 14:07:57 +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="RiJNzoc4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6217A8839A; Wed, 3 Apr 2024 14:07:56 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (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 C61F788388 for ; Wed, 3 Apr 2024 14:07:53 +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-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-56c1922096cso7947305a12.0 for ; Wed, 03 Apr 2024 05:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146073; x=1712750873; 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=oFmODt990ad8kjLTTOpTYnAwB7mre5Em7KQhg5E3z/E=; b=RiJNzoc43lpAeo0f5f+k6xR1WdoIHC18juJRWpvNDu+CpuWrA3XXd/kViaOkBqiFt5 7QAL6Mfo8hoOnaOQ/oNlqd9bXIHw9N+4qbLl2jyALm2jSS6HQ9Q35hDtOYu8h/Lmyknc c0ksEhx8SZYWQzlPFaFr+bInqqcWuA4qVci3aIoR7BcwnfYhnTR7qzg3KgINH6DIxwa5 uHJtahz8hbshI+t51mUhaE6Okxcx2SQm4QHp3HJgQRqiMMTofwDXPrERaF5S/4yV9x4i 1K+btKHve7L9b49a4Yx3gKCS4AC/96P2RZsDzLaAq9a19bbU45FctAa5sMNHIIIycHcS WLDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146073; x=1712750873; 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=oFmODt990ad8kjLTTOpTYnAwB7mre5Em7KQhg5E3z/E=; b=GJDi+ucLgBOBAs2Kwhx4I02cDxxhKINzSRY8y/2aLwfck3+s++Z1ZBZqzlJlpiIaWj IlaWZvIaUm8JbAyINQfb2faaPHQ/JG6X3ieXX+yfkjjZrlKZ0O70nVOHaMrEwzJA54HZ LlJuphDgOfXjKe7oZGR9MuPX8LgeGE+z6UZGq3dIaC0MsePeM6Onmdx0F1fCdq5r2o+1 vzeJHTsT4yuoC22962OXT5JL2RebNnWHy5W91RmsvvtCbGKYu7MidXLE6vkd2oWhpInf rhkgwt9qBwAGAqflmtnWCo3HPA6J9Z/8gzKQOe9bGD0olys4tkKNTZ5kuCr9MKjmQJG6 9oCg== X-Gm-Message-State: AOJu0YyOizR5F92zsghVlNNxTpaZs9+aY/GbqZ34R2q0UyTHKddK39st AQMLjW3APmb/YTI4QIp/S0E4i36IAMNBKsJelBzTMu8+yktyHaSi/ANHeq+E7lw= X-Google-Smtp-Source: AGHT+IEtQWcAYHbcIpOpKu4Qj+jkybg8SchurszYXTAHp0Pqa5Toj8MZDPNKI9+yUinYqdYe2uy6Yw== X-Received: by 2002:a17:906:1390:b0:a4e:3a09:4854 with SMTP id f16-20020a170906139000b00a4e3a094854mr1777036ejc.61.1712146073290; Wed, 03 Apr 2024 05:07:53 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:52 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:39 +0200 Subject: [PATCH v6 04/16] mach-snapdragon: disable power-domains for pre-reloc drivers MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-4-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=2212; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=lNaop02wGgSTfoA1P61dU8gqi6TppeaoShUOEotMpkk=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaQh0TUDYxDDlWcEcuRvg+s5Pljaxsg6bg2f Gel6j6K9pmJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkAAKCRAFgzErGV9k ttSOEACUCi38xX1DWsp6y1yN0ttnZvTr/0Qw4sJ3xHKb4tgB+F4SrTtwXs2J3qwOyhePJFgx2gy 7HTjV+O3aowzabnyinx5jDxEsjUSMR8jMj47Z7cnm/ZMummpB3bf8WBPFX1G7A2ytGPFhh/3OBw CwWofyR89X2bh+LX7xiSO62gby7X8OVmSzmZyP/ny8BpH/FJJ/neVAncQwmBwnULyVnzNH7ZklY +Xlz8PT+zg3jvudiG1YqevM6jeCjHO6oX5LHVgOu+uBDPPKBtRWrXpYvLHYZdTUkB5KCy0HuVUZ eLr+00kwOnLIku4Qu8f7DWCK7KEW6+faIbYg6aSr3ccg4XfjQSj098/mrnxVmd7aF+AC4FtMKlx tzBBjeSfc/fksorNBqOjjg3ZpQrvx1l7r4CQhoySxZiDXME8lUJmhE827qfsFnQKUmUDUqsdBTx G9J4vH5bkg0AXHo+reBGn8GDhReEcNWVgQaHHU6VDWmHXvjjpTiB0Zc8mXo/J7cyPoJSQQE8EWH CHvrQfak49w1w1n495Vj9FF/AY81pXyh9Kq9tWdYJtQFyGQii6pQnspL0H2J9BHT+D9mnRFOO5w KOEmRe9iCqgPGvx6TUHzBxMzaa0PsPrWb49t7lEJfcpV8obEkezKvxMRu79Hp87MKl/YeaYYMVf r+vM6+hRlvWVXQA== 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 devices like the UART and clock controller reference an RPM(h) power domain. We don't support this device in U-Boot, so add DM_FLAG_DEFAULT_PD_CTRL_OFF to tell DM core not to try and enable the power domain. Reviewed-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/clk/qcom/clock-qcom.c | 2 ++ drivers/clk/qcom/clock-sdm845.c | 2 +- drivers/serial/serial_msm_geni.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/clock-qcom.c b/drivers/clk/qcom/clock-qcom.c index 7a5938a06a34..6303dcbf8461 100644 --- a/drivers/clk/qcom/clock-qcom.c +++ b/drivers/clk/qcom/clock-qcom.c @@ -226,8 +226,9 @@ U_BOOT_DRIVER(qcom_clk) = { .id = UCLASS_CLK, .ops = &msm_clk_ops, .priv_auto = sizeof(struct msm_clk_priv), .probe = msm_clk_probe, + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF, }; int qcom_cc_bind(struct udevice *parent) { @@ -410,5 +411,6 @@ U_BOOT_DRIVER(qcom_power) = { .name = "qcom_power", .id = UCLASS_POWER_DOMAIN, .ops = &qcom_power_ops, .probe = qcom_power_probe, + .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/clk/qcom/clock-sdm845.c b/drivers/clk/qcom/clock-sdm845.c index 36ffee79d966..babd83119e2c 100644 --- a/drivers/clk/qcom/clock-sdm845.c +++ b/drivers/clk/qcom/clock-sdm845.c @@ -182,6 +182,6 @@ U_BOOT_DRIVER(gcc_sdm845) = { .name = "gcc_sdm845", .id = UCLASS_NOP, .of_match = gcc_sdm845_of_match, .bind = qcom_cc_bind, - .flags = DM_FLAG_PRE_RELOC, + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF, }; diff --git a/drivers/serial/serial_msm_geni.c b/drivers/serial/serial_msm_geni.c index e5c3dcffc1c6..4aa0bc8c72bc 100644 --- a/drivers/serial/serial_msm_geni.c +++ b/drivers/serial/serial_msm_geni.c @@ -602,9 +602,9 @@ U_BOOT_DRIVER(serial_msm_geni) = { .of_to_plat = msm_serial_ofdata_to_platdata, .priv_auto = sizeof(struct msm_serial_data), .probe = msm_serial_probe, .ops = &msm_serial_ops, - .flags = DM_FLAG_PRE_RELOC, + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF, }; #ifdef CONFIG_DEBUG_UART_MSM_GENI From patchwork Wed Apr 3 12:07:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919272 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=WchRs6y0; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k741h95z23tl for ; Wed, 3 Apr 2024 23:08:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3318A8839C; Wed, 3 Apr 2024 14:07:59 +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="WchRs6y0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5AFE8839E; Wed, 3 Apr 2024 14:07:57 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (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 EC8B988378 for ; Wed, 3 Apr 2024 14:07:54 +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-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-56df377bd13so2262512a12.0 for ; Wed, 03 Apr 2024 05:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146074; x=1712750874; 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=juaadawQi5dtqVZYnJ+QwO1/OAexPncDaRDXhesSnrw=; b=WchRs6y0xnUKKCbkJUdmIu4wxK1vNf8XA55KSMze3lOuQVP0oOTXWd2YKibxIfdcgT ER0cER2d6MFXQIvJJvCwRc9xdNUnVDD9SHE5yS4LhR6kWk9R+a2wPtf4144usi3esEFw R6Zx0EhDrZDb8cV2KrMlgFfhNcMzN7chPAj58Lvyk55E3q5I5iNdkBw8rqR17niQI3Wb 4K5gp491MK+Jnj+rshLkAST3AnPKt56J5Gem/2M2AXUFK/HaT+DAwkW9i8e8/d4+dYd9 hP067NxAg0aTPYRuoalJ5gSP2J8z7IoUpBmMNS14/3rNhRF/i55TS9Hv7BYp8r7XJ5pV pilA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146074; x=1712750874; 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=juaadawQi5dtqVZYnJ+QwO1/OAexPncDaRDXhesSnrw=; b=U+lEXI64HsvxMbr9u8WJEtW6c5EtSP3tdxm+wfTudKjMnGtiOgT9q7CJfISLumjH2H v+KWm3WbVfVIzgMpxemTgAKa1ls83hTczN7AUIe9PhFhOKJrdLf2JYxgOJb0tnzLLbT4 /IIRTsrjHWUTETfKJk0U+fJKRzavN0Dax/dxoGUacVLn920XHpOSOp6GtqUIt+9N5iHW xnJRkG4IflKUGtRBFNSW0X8gIdHCa7uezQqO2KSa/gg7HuO3ene5tvuX8Umd4M1dr+IH cuehH6PS6GSNzyp2jHjglK5bti+roeOfujJp8tcZFkR7BQ+RSclhLz33BHUanGuNTg0y mgiA== X-Gm-Message-State: AOJu0Yy0sBRmadMVu1+a6O8Ja2nV730ZK0ICBqv61kdU4l6+1ZE2Q/rt ZeHD8cEP+kDhj1SZW+plZ++QskmR02nVxaG4aiKAlH3SrTPWAX+rX5x4NPEZlnk= X-Google-Smtp-Source: AGHT+IHuA5Bg2l+usyL6yoiSWU2lBQyGkaN1LhOIPUeQdaqXj9v0h3ofirq+BlILVCpeQbL0qID2XA== X-Received: by 2002:a17:906:1d45:b0:a4e:46df:bae9 with SMTP id o5-20020a1709061d4500b00a4e46dfbae9mr7777423ejh.20.1712146074487; Wed, 03 Apr 2024 05:07:54 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:54 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:40 +0200 Subject: [PATCH v6 05/16] clk/qcom: use offsets for RCG registers MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-5-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=21534; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=eOFtlhU96dqlEnXPalbLBCT2nnod4qFsAzqcv/bfsS4=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaQe2zgFrVaTDXAmGS8YDzJYqXf3T2xg30H1 28mHSQTWz6JAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkAAKCRAFgzErGV9k ttaTEACmZThTBsfTW8OII0oQ4Z4OsbVv3xhmnvjJAZTphUnMFot4WNMI7zfUz8nX7TMALGIS4/i whcV8RZySCLr6skDsWuAybwtXVC1pcF9YNthyI2b0SVcVOcRGs4z6xtwIbN2QxaL+Zg7krd1rRq /Td4DCxfQP7uG5Nba3q7JdcwZ0xhHtesuDXNjgVGoI4Hu838tKVLQN/VYXVwZEwl8ezFK5sWE+5 fL3abhCZZiue+CIn5U2z7t4IL7Y7Ufw0iXF6l+BHoz2PKAy/x/ZYUNBWRSf4kKKj0acxxqnxCM9 oLEOYE0UM0x2jg22elXUyPBqLKm7i9xuj3YSI1nrTpZ5hKifNDPjABaYSQU/a3spOxkTwfXlRwK TOK+ZOHrEvkMKCxxaPmNMoFlQn3Tmv+pANPdho11D7f93zOxo543yMHIYg/KJMPpQTkNrgUhlyd 6i+l4Iz9/HdVASlR6L5WXWRKisyEB5PjGGL7bck0z+6Orm6Q25L+jX3HiqSpQiU7doUtwJuC70A GR43c+dyQyc44nwT+yJkk6+lNuB9BD/l33WYuFaje8iZHRU0dEz99oGdQhnuZzj7EkdeGPllnVn gzQPq+4WZU8ddH+KtAyxhPIFQK8JSJHsZ07QmEksl9kF87PAmC8iF0jDQ10AOckU7/6dDkQt4qm Hdv0szJ5M+pmwiQ== 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 The RCG registers always have the same offsets, so only store the base CMD register address and calculate the others relative to that. Reviewed-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/clk/qcom/clock-apq8016.c | 39 +------------ drivers/clk/qcom/clock-apq8096.c | 28 +-------- drivers/clk/qcom/clock-qcom.c | 22 +++---- drivers/clk/qcom/clock-qcom.h | 16 +++-- drivers/clk/qcom/clock-qcs404.c | 122 +++++---------------------------------- drivers/clk/qcom/clock-sdm845.c | 16 +---- 6 files changed, 39 insertions(+), 204 deletions(-) diff --git a/drivers/clk/qcom/clock-apq8016.c b/drivers/clk/qcom/clock-apq8016.c index e6647f7c41dd..5a5868169c89 100644 --- a/drivers/clk/qcom/clock-apq8016.c +++ b/drivers/clk/qcom/clock-apq8016.c @@ -22,13 +22,9 @@ #define APCS_GPLL_ENA_VOTE (0x45000) #define APCS_CLOCK_BRANCH_ENA_VOTE (0x45004) #define SDCC_BCR(n) ((n * 0x1000) + 0x41000) -#define SDCC_CMD_RCGR(n) ((n * 0x1000) + 0x41004) -#define SDCC_CFG_RCGR(n) ((n * 0x1000) + 0x41008) -#define SDCC_M(n) ((n * 0x1000) + 0x4100C) -#define SDCC_N(n) ((n * 0x1000) + 0x41010) -#define SDCC_D(n) ((n * 0x1000) + 0x41014) +#define SDCC_CMD_RCGR(n) (((n + 1) * 0x1000) + 0x41004) #define SDCC_APPS_CBCR(n) ((n * 0x1000) + 0x41018) #define SDCC_AHB_CBCR(n) ((n * 0x1000) + 0x4101C) /* BLSP1 AHB clock (root clock for BLSP) */ @@ -37,33 +33,12 @@ /* Uart clock control registers */ #define BLSP1_UART2_BCR (0x3028) #define BLSP1_UART2_APPS_CBCR (0x302C) #define BLSP1_UART2_APPS_CMD_RCGR (0x3034) -#define BLSP1_UART2_APPS_CFG_RCGR (0x3038) -#define BLSP1_UART2_APPS_M (0x303C) -#define BLSP1_UART2_APPS_N (0x3040) -#define BLSP1_UART2_APPS_D (0x3044) /* GPLL0 clock control registers */ #define GPLL0_STATUS_ACTIVE BIT(17) -static const struct bcr_regs sdc_regs[] = { - { - .cfg_rcgr = SDCC_CFG_RCGR(1), - .cmd_rcgr = SDCC_CMD_RCGR(1), - .M = SDCC_M(1), - .N = SDCC_N(1), - .D = SDCC_D(1), - }, - { - .cfg_rcgr = SDCC_CFG_RCGR(2), - .cmd_rcgr = SDCC_CMD_RCGR(2), - .M = SDCC_M(2), - .N = SDCC_N(2), - .D = SDCC_D(2), - } -}; - static struct pll_vote_clk gpll0_vote_clk = { .status = GPLL0_STATUS, .status_bit = GPLL0_STATUS_ACTIVE, .ena_vote = APCS_GPLL_ENA_VOTE, @@ -85,32 +60,24 @@ static int clk_init_sdc(struct msm_clk_priv *priv, int slot, uint rate) div = 4; clk_enable_cbc(priv->base + SDCC_AHB_CBCR(slot)); /* 800Mhz/div, gpll0 */ - clk_rcg_set_rate_mnd(priv->base, &sdc_regs[slot], div, 0, 0, + clk_rcg_set_rate_mnd(priv->base, SDCC_CMD_RCGR(slot), div, 0, 0, CFG_CLK_SRC_GPLL0, 8); clk_enable_gpll0(priv->base, &gpll0_vote_clk); clk_enable_cbc(priv->base + SDCC_APPS_CBCR(slot)); return rate; } -static const struct bcr_regs uart2_regs = { - .cfg_rcgr = BLSP1_UART2_APPS_CFG_RCGR, - .cmd_rcgr = BLSP1_UART2_APPS_CMD_RCGR, - .M = BLSP1_UART2_APPS_M, - .N = BLSP1_UART2_APPS_N, - .D = BLSP1_UART2_APPS_D, -}; - /* UART: 115200 */ int apq8016_clk_init_uart(phys_addr_t base) { /* Enable AHB clock */ clk_enable_vote_clk(base, &gcc_blsp1_ahb_clk); /* 7372800 uart block clock @ GPLL0 */ - clk_rcg_set_rate_mnd(base, &uart2_regs, 1, 144, 15625, + clk_rcg_set_rate_mnd(base, BLSP1_UART2_APPS_CMD_RCGR, 1, 144, 15625, CFG_CLK_SRC_GPLL0, 16); /* Vote for gpll0 clock */ clk_enable_gpll0(base, &gpll0_vote_clk); diff --git a/drivers/clk/qcom/clock-apq8096.c b/drivers/clk/qcom/clock-apq8096.c index a4731613c5e0..479f9771a464 100644 --- a/drivers/clk/qcom/clock-apq8096.c +++ b/drivers/clk/qcom/clock-apq8096.c @@ -25,33 +25,17 @@ #define SDCC2_BCR (0x14000) /* block reset */ #define SDCC2_APPS_CBCR (0x14004) /* branch control */ #define SDCC2_AHB_CBCR (0x14008) #define SDCC2_CMD_RCGR (0x14010) -#define SDCC2_CFG_RCGR (0x14014) -#define SDCC2_M (0x14018) -#define SDCC2_N (0x1401C) -#define SDCC2_D (0x14020) #define BLSP2_AHB_CBCR (0x25004) #define BLSP2_UART2_APPS_CBCR (0x29004) #define BLSP2_UART2_APPS_CMD_RCGR (0x2900C) -#define BLSP2_UART2_APPS_CFG_RCGR (0x29010) -#define BLSP2_UART2_APPS_M (0x29014) -#define BLSP2_UART2_APPS_N (0x29018) -#define BLSP2_UART2_APPS_D (0x2901C) /* GPLL0 clock control registers */ #define GPLL0_STATUS_ACTIVE BIT(30) #define APCS_GPLL_ENA_VOTE_GPLL0 BIT(0) -static const struct bcr_regs sdc_regs = { - .cfg_rcgr = SDCC2_CFG_RCGR, - .cmd_rcgr = SDCC2_CMD_RCGR, - .M = SDCC2_M, - .N = SDCC2_N, - .D = SDCC2_D, -}; - static const struct pll_vote_clk gpll0_vote_clk = { .status = GPLL0_STATUS, .status_bit = GPLL0_STATUS_ACTIVE, .ena_vote = APCS_GPLL_ENA_VOTE, @@ -68,31 +52,23 @@ static int clk_init_sdc(struct msm_clk_priv *priv, uint rate) { int div = 5; clk_enable_cbc(priv->base + SDCC2_AHB_CBCR); - clk_rcg_set_rate_mnd(priv->base, &sdc_regs, div, 0, 0, + clk_rcg_set_rate_mnd(priv->base, SDCC2_CMD_RCGR, div, 0, 0, CFG_CLK_SRC_GPLL0, 8); clk_enable_gpll0(priv->base, &gpll0_vote_clk); clk_enable_cbc(priv->base + SDCC2_APPS_CBCR); return rate; } -static const struct bcr_regs uart2_regs = { - .cfg_rcgr = BLSP2_UART2_APPS_CFG_RCGR, - .cmd_rcgr = BLSP2_UART2_APPS_CMD_RCGR, - .M = BLSP2_UART2_APPS_M, - .N = BLSP2_UART2_APPS_N, - .D = BLSP2_UART2_APPS_D, -}; - static int clk_init_uart(struct msm_clk_priv *priv) { /* Enable AHB clock */ clk_enable_vote_clk(priv->base, &gcc_blsp2_ahb_clk); /* 7372800 uart block clock @ GPLL0 */ - clk_rcg_set_rate_mnd(priv->base, &uart2_regs, 1, 192, 15625, + clk_rcg_set_rate_mnd(priv->base, BLSP2_UART2_APPS_CMD_RCGR, 1, 192, 15625, CFG_CLK_SRC_GPLL0, 16); /* Vote for gpll0 clock */ clk_enable_gpll0(priv->base, &gpll0_vote_clk); diff --git a/drivers/clk/qcom/clock-qcom.c b/drivers/clk/qcom/clock-qcom.c index 6303dcbf8461..05e5ab7d094b 100644 --- a/drivers/clk/qcom/clock-qcom.c +++ b/drivers/clk/qcom/clock-qcom.c @@ -103,9 +103,9 @@ void clk_bcr_update(phys_addr_t apps_cmd_rcgr) /* * root set rate for clocks with half integer and MND divider * div should be pre-calculated ((div * 2) - 1) */ -void clk_rcg_set_rate_mnd(phys_addr_t base, const struct bcr_regs *regs, +void clk_rcg_set_rate_mnd(phys_addr_t base, uint32_t cmd_rcgr, int div, int m, int n, int source, u8 mnd_width) { u32 cfg; /* M value for MND divider. */ @@ -119,14 +119,14 @@ void clk_rcg_set_rate_mnd(phys_addr_t base, const struct bcr_regs *regs, debug("m %#x n %#x d %#x div %#x mask %#x\n", m_val, n_val, d_val, div, mask); /* Program MND values */ - writel(m_val & mask, base + regs->M); - writel(n_val & mask, base + regs->N); - writel(d_val & mask, base + regs->D); + writel(m_val & mask, base + cmd_rcgr + RCG_M_REG); + writel(n_val & mask, base + cmd_rcgr + RCG_N_REG); + writel(d_val & mask, base + cmd_rcgr + RCG_D_REG); /* setup src select and divider */ - cfg = readl(base + regs->cfg_rcgr); + cfg = readl(base + cmd_rcgr + RCG_CFG_REG); cfg &= ~(CFG_SRC_SEL_MASK | CFG_MODE_MASK | CFG_HW_CLK_CTRL_MASK | CFG_SRC_DIV_MASK); cfg |= source & CFG_SRC_SEL_MASK; /* Select clock source */ @@ -135,22 +135,22 @@ void clk_rcg_set_rate_mnd(phys_addr_t base, const struct bcr_regs *regs, if (n && n != m) cfg |= CFG_MODE_DUAL_EDGE; - writel(cfg, base + regs->cfg_rcgr); /* Write new clock configuration */ + writel(cfg, base + cmd_rcgr + RCG_CFG_REG); /* Write new clock configuration */ /* Inform h/w to start using the new config. */ - clk_bcr_update(base + regs->cmd_rcgr); + clk_bcr_update(base + cmd_rcgr); } /* root set rate for clocks with half integer and mnd_width=0 */ -void clk_rcg_set_rate(phys_addr_t base, const struct bcr_regs *regs, int div, +void clk_rcg_set_rate(phys_addr_t base, uint32_t cmd_rcgr, int div, int source) { u32 cfg; /* setup src select and divider */ - cfg = readl(base + regs->cfg_rcgr); + cfg = readl(base + cmd_rcgr + RCG_CFG_REG); cfg &= ~(CFG_SRC_SEL_MASK | CFG_MODE_MASK | CFG_HW_CLK_CTRL_MASK); cfg |= source & CFG_CLK_SRC_MASK; /* Select clock source */ /* @@ -159,12 +159,12 @@ void clk_rcg_set_rate(phys_addr_t base, const struct bcr_regs *regs, int div, */ if (div) cfg |= (2 * div - 1) & CFG_SRC_DIV_MASK; - writel(cfg, base + regs->cfg_rcgr); /* Write new clock configuration */ + writel(cfg, base + cmd_rcgr + RCG_CFG_REG); /* Write new clock configuration */ /* Inform h/w to start using the new config. */ - clk_bcr_update(base + regs->cmd_rcgr); + clk_bcr_update(base + cmd_rcgr); } const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, uint rate) { diff --git a/drivers/clk/qcom/clock-qcom.h b/drivers/clk/qcom/clock-qcom.h index 12a1eaec2b2e..a7f833a4b6dd 100644 --- a/drivers/clk/qcom/clock-qcom.h +++ b/drivers/clk/qcom/clock-qcom.h @@ -11,8 +11,13 @@ #define CFG_CLK_SRC_GPLL0 (1 << 8) #define CFG_CLK_SRC_GPLL0_EVEN (6 << 8) #define CFG_CLK_SRC_MASK (7 << 8) +#define RCG_CFG_REG 0x4 +#define RCG_M_REG 0x8 +#define RCG_N_REG 0xc +#define RCG_D_REG 0x10 + struct pll_vote_clk { uintptr_t status; int status_bit; uintptr_t ena_vote; @@ -23,15 +28,8 @@ struct vote_clk { uintptr_t cbcr_reg; uintptr_t ena_vote; int vote_bit; }; -struct bcr_regs { - uintptr_t cfg_rcgr; - uintptr_t cmd_rcgr; - uintptr_t M; - uintptr_t N; - uintptr_t D; -}; struct freq_tbl { uint freq; uint src; @@ -87,11 +85,11 @@ void clk_enable_gpll0(phys_addr_t base, const struct pll_vote_clk *gpll0); void clk_bcr_update(phys_addr_t apps_cmd_rgcr); void clk_enable_cbc(phys_addr_t cbcr); void clk_enable_vote_clk(phys_addr_t base, const struct vote_clk *vclk); const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, uint rate); -void clk_rcg_set_rate_mnd(phys_addr_t base, const struct bcr_regs *regs, +void clk_rcg_set_rate_mnd(phys_addr_t base, uint32_t cmd_rcgr, int div, int m, int n, int source, u8 mnd_width); -void clk_rcg_set_rate(phys_addr_t base, const struct bcr_regs *regs, int div, +void clk_rcg_set_rate(phys_addr_t base, uint32_t cmd_rcgr, int div, int source); static inline void qcom_gate_clk_en(const struct msm_clk_priv *priv, unsigned long id) { diff --git a/drivers/clk/qcom/clock-qcs404.c b/drivers/clk/qcom/clock-qcs404.c index 958312b88842..8a897a52bc00 100644 --- a/drivers/clk/qcom/clock-qcs404.c +++ b/drivers/clk/qcom/clock-qcs404.c @@ -27,37 +27,24 @@ /* Uart clock control registers */ #define BLSP1_UART2_BCR (0x3028) #define BLSP1_UART2_APPS_CBCR (0x302C) #define BLSP1_UART2_APPS_CMD_RCGR (0x3034) -#define BLSP1_UART2_APPS_CFG_RCGR (0x3038) -#define BLSP1_UART2_APPS_M (0x303C) -#define BLSP1_UART2_APPS_N (0x3040) -#define BLSP1_UART2_APPS_D (0x3044) /* I2C controller clock control registerss */ #define BLSP1_QUP0_I2C_APPS_CBCR (0x6028) #define BLSP1_QUP0_I2C_APPS_CMD_RCGR (0x602C) -#define BLSP1_QUP0_I2C_APPS_CFG_RCGR (0x6030) #define BLSP1_QUP1_I2C_APPS_CBCR (0x2008) #define BLSP1_QUP1_I2C_APPS_CMD_RCGR (0x200C) -#define BLSP1_QUP1_I2C_APPS_CFG_RCGR (0x2010) #define BLSP1_QUP2_I2C_APPS_CBCR (0x3010) #define BLSP1_QUP2_I2C_APPS_CMD_RCGR (0x3000) -#define BLSP1_QUP2_I2C_APPS_CFG_RCGR (0x3004) #define BLSP1_QUP3_I2C_APPS_CBCR (0x4020) #define BLSP1_QUP3_I2C_APPS_CMD_RCGR (0x4000) -#define BLSP1_QUP3_I2C_APPS_CFG_RCGR (0x4004) #define BLSP1_QUP4_I2C_APPS_CBCR (0x5020) #define BLSP1_QUP4_I2C_APPS_CMD_RCGR (0x5000) -#define BLSP1_QUP4_I2C_APPS_CFG_RCGR (0x5004) /* SD controller clock control registers */ #define SDCC_BCR(n) (((n) * 0x1000) + 0x41000) -#define SDCC_CMD_RCGR(n) (((n) * 0x1000) + 0x41004) -#define SDCC_CFG_RCGR(n) (((n) * 0x1000) + 0x41008) -#define SDCC_M(n) (((n) * 0x1000) + 0x4100C) -#define SDCC_N(n) (((n) * 0x1000) + 0x41010) -#define SDCC_D(n) (((n) * 0x1000) + 0x41014) +#define SDCC_CMD_RCGR(n) (((n + 1) * 0x1000) + 0x41004) #define SDCC_APPS_CBCR(n) (((n) * 0x1000) + 0x41018) #define SDCC_AHB_CBCR(n) (((n) * 0x1000) + 0x4101C) /* USB-3.0 controller clock control registers */ @@ -69,12 +56,8 @@ #define USB30_MOCK_UTMI_CBCR (0x39014) #define USB30_MOCK_UTMI_CMD_RCGR (0x3901C) #define USB30_MOCK_UTMI_CFG_RCGR (0x39020) #define USB30_MASTER_CMD_RCGR (0x39028) -#define USB30_MASTER_CFG_RCGR (0x3902C) -#define USB30_MASTER_M (0x39030) -#define USB30_MASTER_N (0x39034) -#define USB30_MASTER_D (0x39038) #define USB2A_PHY_SLEEP_CBCR (0x4102C) #define USB_HS_PHY_CFG_AHB_CBCR (0x41030) /* ETH controller clock control registers */ @@ -82,14 +65,9 @@ #define ETH_RGMII_CBCR (0x4e008) #define ETH_SLAVE_AHB_CBCR (0x4e00c) #define ETH_AXI_CBCR (0x4e010) #define EMAC_PTP_CMD_RCGR (0x4e014) -#define EMAC_PTP_CFG_RCGR (0x4e018) #define EMAC_CMD_RCGR (0x4e01c) -#define EMAC_CFG_RCGR (0x4e020) -#define EMAC_M (0x4e024) -#define EMAC_N (0x4e028) -#define EMAC_D (0x4e02c) /* GPLL0 clock control registers */ #define GPLL0_STATUS_ACTIVE BIT(31) @@ -102,24 +80,8 @@ static struct vote_clk gcc_blsp1_ahb_clk = { .ena_vote = APCS_CLOCK_BRANCH_ENA_VOTE, .vote_bit = BIT(10) | BIT(5) | BIT(4), }; -static const struct bcr_regs uart2_regs = { - .cfg_rcgr = BLSP1_UART2_APPS_CFG_RCGR, - .cmd_rcgr = BLSP1_UART2_APPS_CMD_RCGR, - .M = BLSP1_UART2_APPS_M, - .N = BLSP1_UART2_APPS_N, - .D = BLSP1_UART2_APPS_D, -}; - -static const struct bcr_regs sdc_regs = { - .cfg_rcgr = SDCC_CFG_RCGR(1), - .cmd_rcgr = SDCC_CMD_RCGR(1), - .M = SDCC_M(1), - .N = SDCC_N(1), - .D = SDCC_D(1), -}; - static struct pll_vote_clk gpll0_vote_clk = { .status = GPLL0_STATUS, .status_bit = GPLL0_STATUS_ACTIVE, .ena_vote = APCS_GPLL_ENA_VOTE, @@ -132,92 +94,38 @@ static struct pll_vote_clk gpll1_vote_clk = { .ena_vote = APCS_GPLL_ENA_VOTE, .vote_bit = BIT(1), }; -static const struct bcr_regs usb30_master_regs = { - .cfg_rcgr = USB30_MASTER_CFG_RCGR, - .cmd_rcgr = USB30_MASTER_CMD_RCGR, - .M = USB30_MASTER_M, - .N = USB30_MASTER_N, - .D = USB30_MASTER_D, -}; - -static const struct bcr_regs emac_regs = { - .cfg_rcgr = EMAC_CFG_RCGR, - .cmd_rcgr = EMAC_CMD_RCGR, - .M = EMAC_M, - .N = EMAC_N, - .D = EMAC_D, -}; - -static const struct bcr_regs emac_ptp_regs = { - .cfg_rcgr = EMAC_PTP_CFG_RCGR, - .cmd_rcgr = EMAC_PTP_CMD_RCGR, - .M = EMAC_M, - .N = EMAC_N, - .D = EMAC_D, -}; - -static const struct bcr_regs blsp1_qup0_i2c_apps_regs = { - .cmd_rcgr = BLSP1_QUP0_I2C_APPS_CMD_RCGR, - .cfg_rcgr = BLSP1_QUP0_I2C_APPS_CFG_RCGR, - /* mnd_width = 0 */ -}; - -static const struct bcr_regs blsp1_qup1_i2c_apps_regs = { - .cmd_rcgr = BLSP1_QUP1_I2C_APPS_CMD_RCGR, - .cfg_rcgr = BLSP1_QUP1_I2C_APPS_CFG_RCGR, - /* mnd_width = 0 */ -}; - -static const struct bcr_regs blsp1_qup2_i2c_apps_regs = { - .cmd_rcgr = BLSP1_QUP2_I2C_APPS_CMD_RCGR, - .cfg_rcgr = BLSP1_QUP2_I2C_APPS_CFG_RCGR, - /* mnd_width = 0 */ -}; - -static const struct bcr_regs blsp1_qup3_i2c_apps_regs = { - .cmd_rcgr = BLSP1_QUP3_I2C_APPS_CMD_RCGR, - .cfg_rcgr = BLSP1_QUP3_I2C_APPS_CFG_RCGR, - /* mnd_width = 0 */ -}; - -static const struct bcr_regs blsp1_qup4_i2c_apps_regs = { - .cmd_rcgr = BLSP1_QUP4_I2C_APPS_CMD_RCGR, - .cfg_rcgr = BLSP1_QUP4_I2C_APPS_CFG_RCGR, - /* mnd_width = 0 */ -}; - static ulong qcs404_clk_set_rate(struct clk *clk, ulong rate) { struct msm_clk_priv *priv = dev_get_priv(clk->dev); switch (clk->id) { case GCC_BLSP1_UART2_APPS_CLK: /* UART: 1843200Hz for a fixed 115200 baudrate (19200000 * (12/125)) */ - clk_rcg_set_rate_mnd(priv->base, &uart2_regs, 0, 12, 125, + clk_rcg_set_rate_mnd(priv->base, BLSP1_UART2_APPS_CMD_RCGR, 0, 12, 125, CFG_CLK_SRC_CXO, 16); clk_enable_cbc(priv->base + BLSP1_UART2_APPS_CBCR); return 1843200; case GCC_SDCC1_APPS_CLK: /* SDCC1: 200MHz */ - clk_rcg_set_rate_mnd(priv->base, &sdc_regs, 7, 0, 0, + clk_rcg_set_rate_mnd(priv->base, SDCC_CMD_RCGR(0), 7, 0, 0, CFG_CLK_SRC_GPLL0, 8); clk_enable_gpll0(priv->base, &gpll0_vote_clk); clk_enable_cbc(priv->base + SDCC_APPS_CBCR(1)); return rate; case GCC_ETH_RGMII_CLK: if (rate == 250000000) - clk_rcg_set_rate_mnd(priv->base, &emac_regs, 3, 0, 0, + clk_rcg_set_rate_mnd(priv->base, EMAC_CMD_RCGR, 3, 0, 0, CFG_CLK_SRC_GPLL1, 8); else if (rate == 125000000) - clk_rcg_set_rate_mnd(priv->base, &emac_regs, 7, 0, 0, + clk_rcg_set_rate_mnd(priv->base, EMAC_CMD_RCGR, 7, 0, 0, CFG_CLK_SRC_GPLL1, 8); else if (rate == 50000000) - clk_rcg_set_rate_mnd(priv->base, &emac_regs, 19, 0, 0, + clk_rcg_set_rate_mnd(priv->base, EMAC_CMD_RCGR, 19, 0, 0, CFG_CLK_SRC_GPLL1, 8); else if (rate == 5000000) - clk_rcg_set_rate_mnd(priv->base, &emac_regs, 3, 1, 50, + clk_rcg_set_rate_mnd(priv->base, EMAC_CMD_RCGR, 3, 1, 50, CFG_CLK_SRC_GPLL1, 8); return rate; } @@ -236,9 +144,9 @@ static int qcs404_clk_enable(struct clk *clk) switch (clk->id) { case GCC_USB30_MASTER_CLK: clk_enable_cbc(priv->base + USB30_MASTER_CBCR); - clk_rcg_set_rate_mnd(priv->base, &usb30_master_regs, 7, 0, 0, + clk_rcg_set_rate_mnd(priv->base, USB30_MASTER_CMD_RCGR, 7, 0, 0, CFG_CLK_SRC_GPLL0, 8); break; case GCC_SYS_NOC_USB3_CLK: clk_enable_cbc(priv->base + SYS_NOC_USB3_CBCR); @@ -258,16 +166,16 @@ static int qcs404_clk_enable(struct clk *clk) case GCC_ETH_PTP_CLK: /* SPEED_1000: freq -> 250MHz */ clk_enable_cbc(priv->base + ETH_PTP_CBCR); clk_enable_gpll0(priv->base, &gpll1_vote_clk); - clk_rcg_set_rate_mnd(priv->base, &emac_ptp_regs, 3, 0, 0, + clk_rcg_set_rate_mnd(priv->base, EMAC_PTP_CMD_RCGR, 3, 0, 0, CFG_CLK_SRC_GPLL1, 8); break; case GCC_ETH_RGMII_CLK: /* SPEED_1000: freq -> 250MHz */ clk_enable_cbc(priv->base + ETH_RGMII_CBCR); clk_enable_gpll0(priv->base, &gpll1_vote_clk); - clk_rcg_set_rate_mnd(priv->base, &emac_regs, 3, 0, 0, + clk_rcg_set_rate_mnd(priv->base, EMAC_CMD_RCGR, 3, 0, 0, CFG_CLK_SRC_GPLL1, 8); break; case GCC_ETH_SLAVE_AHB_CLK: clk_enable_cbc(priv->base + ETH_SLAVE_AHB_CBCR); @@ -279,29 +187,29 @@ static int qcs404_clk_enable(struct clk *clk) clk_enable_vote_clk(priv->base, &gcc_blsp1_ahb_clk); break; case GCC_BLSP1_QUP0_I2C_APPS_CLK: clk_enable_cbc(priv->base + BLSP1_QUP0_I2C_APPS_CBCR); - clk_rcg_set_rate(priv->base, &blsp1_qup0_i2c_apps_regs, 0, + clk_rcg_set_rate(priv->base, BLSP1_QUP0_I2C_APPS_CMD_RCGR, 0, CFG_CLK_SRC_CXO); break; case GCC_BLSP1_QUP1_I2C_APPS_CLK: clk_enable_cbc(priv->base + BLSP1_QUP1_I2C_APPS_CBCR); - clk_rcg_set_rate(priv->base, &blsp1_qup1_i2c_apps_regs, 0, + clk_rcg_set_rate(priv->base, BLSP1_QUP1_I2C_APPS_CMD_RCGR, 0, CFG_CLK_SRC_CXO); break; case GCC_BLSP1_QUP2_I2C_APPS_CLK: clk_enable_cbc(priv->base + BLSP1_QUP2_I2C_APPS_CBCR); - clk_rcg_set_rate(priv->base, &blsp1_qup2_i2c_apps_regs, 0, + clk_rcg_set_rate(priv->base, BLSP1_QUP2_I2C_APPS_CMD_RCGR, 0, CFG_CLK_SRC_CXO); break; case GCC_BLSP1_QUP3_I2C_APPS_CLK: clk_enable_cbc(priv->base + BLSP1_QUP3_I2C_APPS_CBCR); - clk_rcg_set_rate(priv->base, &blsp1_qup3_i2c_apps_regs, 0, + clk_rcg_set_rate(priv->base, BLSP1_QUP3_I2C_APPS_CMD_RCGR, 0, CFG_CLK_SRC_CXO); break; case GCC_BLSP1_QUP4_I2C_APPS_CLK: clk_enable_cbc(priv->base + BLSP1_QUP4_I2C_APPS_CBCR); - clk_rcg_set_rate(priv->base, &blsp1_qup4_i2c_apps_regs, 0, + clk_rcg_set_rate(priv->base, BLSP1_QUP4_I2C_APPS_CMD_RCGR, 0, CFG_CLK_SRC_CXO); break; case GCC_SDCC1_AHB_CLK: clk_enable_cbc(priv->base + SDCC_AHB_CBCR(1)); diff --git a/drivers/clk/qcom/clock-sdm845.c b/drivers/clk/qcom/clock-sdm845.c index babd83119e2c..ccb0cf245d33 100644 --- a/drivers/clk/qcom/clock-sdm845.c +++ b/drivers/clk/qcom/clock-sdm845.c @@ -18,15 +18,9 @@ #include #include "clock-qcom.h" -#define SE9_AHB_CBCR 0x25004 -#define SE9_UART_APPS_CBCR 0x29004 #define SE9_UART_APPS_CMD_RCGR 0x18148 -#define SE9_UART_APPS_CFG_RCGR 0x1814C -#define SE9_UART_APPS_M 0x18150 -#define SE9_UART_APPS_N 0x18154 -#define SE9_UART_APPS_D 0x18158 static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s0_clk_src[] = { F(7372800, CFG_CLK_SRC_GPLL0_EVEN, 1, 384, 15625), F(14745600, CFG_CLK_SRC_GPLL0_EVEN, 1, 768, 15625), @@ -45,25 +39,17 @@ static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s0_clk_src[] = { F(128000000, CFG_CLK_SRC_GPLL0, 1, 16, 75), { } }; -static const struct bcr_regs uart2_regs = { - .cfg_rcgr = SE9_UART_APPS_CFG_RCGR, - .cmd_rcgr = SE9_UART_APPS_CMD_RCGR, - .M = SE9_UART_APPS_M, - .N = SE9_UART_APPS_N, - .D = SE9_UART_APPS_D, -}; - static ulong sdm845_clk_set_rate(struct clk *clk, ulong rate) { struct msm_clk_priv *priv = dev_get_priv(clk->dev); const struct freq_tbl *freq; switch (clk->id) { case GCC_QUPV3_WRAP1_S1_CLK: /* UART9 */ freq = qcom_find_freq(ftbl_gcc_qupv3_wrap0_s0_clk_src, rate); - clk_rcg_set_rate_mnd(priv->base, &uart2_regs, + clk_rcg_set_rate_mnd(priv->base, SE9_UART_APPS_CMD_RCGR, freq->pre_div, freq->m, freq->n, freq->src, 16); return freq->freq; default: return 0; From patchwork Wed Apr 3 12:07:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919273 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=kKmq3YEK; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k7H5sSmz23tl for ; Wed, 3 Apr 2024 23:08:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A191F88378; Wed, 3 Apr 2024 14:07:59 +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="kKmq3YEK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E08198839E; Wed, 3 Apr 2024 14:07:57 +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-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (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 CBE3C88391 for ; Wed, 3 Apr 2024 14:07:55 +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-ej1-x631.google.com with SMTP id a640c23a62f3a-a4e62f3e63dso406921066b.0 for ; Wed, 03 Apr 2024 05:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146075; x=1712750875; 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=MOEUaSh2jP1fM+GMfk9jn6DYONqGieAUpvNGE9zTi/M=; b=kKmq3YEKi6XLbho74MQYWCekPP9yoRkKq9SUtFtcjkA/0PK6ZUztta27P8N3C21GaE ONO32eraomxfeRELo6x8T3gWdKUn96Ieq115z6WH7vyH58uEacrldEgNZBR1Q8dfjXic faBqXjGu4BsirC6iWdI/a5Yn9obmEAMdIzZzHPb7TANTopoDxc2MK/zVGQwV71cfAP65 0LCs9vdYETBAZ6yFyKK9XLoR81VuLXqL+Ids0/jr73STmmZORNtFNISWXI/0LRqPGYbl BMp0XlVdRBJI9uzIfBCpPKpGbA6w1ufOc10e+1lXnplwa630S1xUeaTlucQ/sPt08r5u Agng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146075; x=1712750875; 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=MOEUaSh2jP1fM+GMfk9jn6DYONqGieAUpvNGE9zTi/M=; b=C5ot+snIA7dzBVEP2BVcy83zzIkCE0Uqe0Lw38xIy3UdXkdC9IQa0pkubUH4J+FVhs 0yP7bqlm5CRhsOX9lc+HI9fx65wWRr/LDstU+NsjeCcJ2YY8WSOb+QzbjPQVl/wQxUGT mBJwJRtQQKIOWsDcnZLBNn9uUibIOn4C5glX74uEbJGUmZB4/CJ6Ytt/hUjalgIcelg2 hckVX9D7yp5iPRD6rszE8HAa3sA5PS4Z5zcnjJ0mlMWDTFRLEKBSBYJlcdGo1d9CQ1Zd E3J8hnFIv2dbhxfI81rdttnWMhvJAdSvfbfsziuj+bXwa/Oa8L4At8p43l3jdrrJI4QU 9yMA== X-Gm-Message-State: AOJu0YwwV9QdnY1GWTZM9fLP3k4eV58A1n3zHHBFglwZOn7jAcFmsMrT 1U60oCFzoz6mXqYP6lBxCXfqKkrhZdW1I5bzBHKNJZ0xFF0lIXiySF+XaeHLa1E= X-Google-Smtp-Source: AGHT+IGSkfJ3NHZzNp5DAa1OQCBY6wOKSErVpMIGDAfH4tXIWjAN2ONtD6vHOdylQ2BuNOTqTxuKUQ== X-Received: by 2002:a17:907:7d89:b0:a4e:696e:6b78 with SMTP id oz9-20020a1709077d8900b00a4e696e6b78mr7190649ejc.66.1712146075439; Wed, 03 Apr 2024 05:07:55 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:54 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:41 +0200 Subject: [PATCH v6 06/16] clk/qcom: sdm845: add gdscs MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-6-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1714; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=J2wyNARYq0khhF05IOZjfXaKY3NwgELyfaNZ+Dn9LDc=; b=kA0DAAgBBYMxKxlfZLYByyZiAGYNRpDI5k+7JMVTtSRnCXD/ehfdX3XshvJbt0/K/CoMxa+AQ 4kCMwQAAQgAHRYhBLZRoUY8ar7QaQxVzQWDMSsZX2S2BQJmDUaQAAoJEAWDMSsZX2S26Z8QAI2V 9XC4zPfc7182XWB8Vm64mGnmaLyXR4NJslKM6a+qWG3zVcAF6p3HZmM5MNGJPwhtraloydzhVsw SrMvJhh1L02uLRVR3JTizB8jMDMwDHx4pWlTs67W5+0yfxz9OPmSI0KtFQunzpMhrIXuj4Mk5Od i+EU5vLn/5+D6TW+QxT7foOCB/qO8PQMJ260ZliwHed5I2TF76BfRtk/REplMoIQlWoX0l7eLkJ 2wwA2yynShgErPltZipu4yGQ68KEzjGi7Yk6MMBogcFH5+y4lQ6pFXFoDqynUcG5UPrh1uXjmFf cjPtsHaS7FkUomuZcjRLuAK4RbEwc0jWc+Bu3e2H0VS39WPwyPXhfzPzOQpbhL5SmPVpDtX6aa0 83wMcMBfcFUCYqNsO7Kt0a03pTLzupkERpVX8df1RGWf1kvtq29rl5eSVG8ITjLFZP+Tl4GKhRU iLyjowkhB7CSbWeZYmpB/F6S7YhGkXKTqP2iAgHUl4c8j16vUmDcOXPMUpSf4zIXO+nx2JVm0O9 eHVDKZO8Q7x9CgZivjAfhNIV85gmLrH/CwldDOE/mjukov6bzs3RSeTfnX+Alsnqm6CfFY5IjiE UhyxBIExlcoJwKwupGBUWc/W+w8FMLYofCt4qjMcF8E2NkaQzdiJFJF8Ozjkqy96y6dYzrvwTI3 yEG39 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 Define the GDSC power domains for SDM845. Reviewed-by: Neil Armstrong Reviewed-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/clk/qcom/clock-sdm845.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/clk/qcom/clock-sdm845.c b/drivers/clk/qcom/clock-sdm845.c index ccb0cf245d33..b7154360894a 100644 --- a/drivers/clk/qcom/clock-sdm845.c +++ b/drivers/clk/qcom/clock-sdm845.c @@ -145,13 +145,31 @@ static const struct qcom_reset_map sdm845_gcc_resets[] = { [GCC_USB3_DP_PHY_SEC_BCR] = { 0x50014 }, [GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0x6a000 }, }; +static const struct qcom_power_map sdm845_gdscs[] = { + [PCIE_0_GDSC] = { 0x6b004 }, + [PCIE_1_GDSC] = { 0x8d004 }, + [UFS_CARD_GDSC] = { 0x75004 }, + [UFS_PHY_GDSC] = { 0x77004 }, + [USB30_PRIM_GDSC] = { 0xf004 }, + [USB30_SEC_GDSC] = { 0x10004 }, + [HLOS1_VOTE_AGGRE_NOC_MMU_AUDIO_TBU_GDSC] = { 0x7d030 }, + [HLOS1_VOTE_AGGRE_NOC_MMU_PCIE_TBU_GDSC] = { 0x7d03c }, + [HLOS1_VOTE_AGGRE_NOC_MMU_TBU1_GDSC] = { 0x7d034 }, + [HLOS1_VOTE_AGGRE_NOC_MMU_TBU2_GDSC] = { 0x7d038 }, + [HLOS1_VOTE_MMNOC_MMU_TBU_HF0_GDSC] = { 0x7d040 }, + [HLOS1_VOTE_MMNOC_MMU_TBU_HF1_GDSC] = { 0x7d048 }, + [HLOS1_VOTE_MMNOC_MMU_TBU_SF_GDSC] = { 0x7d044 }, +}; + static struct msm_clk_data sdm845_clk_data = { .resets = sdm845_gcc_resets, .num_resets = ARRAY_SIZE(sdm845_gcc_resets), .clks = sdm845_clks, .num_clks = ARRAY_SIZE(sdm845_clks), + .power_domains = sdm845_gdscs, + .num_power_domains = ARRAY_SIZE(sdm845_gdscs), .enable = sdm845_clk_enable, .set_rate = sdm845_clk_set_rate, }; From patchwork Wed Apr 3 12:07:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919274 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=QL4PZfnb; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k7T5Dp6z23tl for ; Wed, 3 Apr 2024 23:09:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0E868883A8; Wed, 3 Apr 2024 14:08:00 +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="QL4PZfnb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1EEF7882E4; Wed, 3 Apr 2024 14:07:59 +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-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (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 0D31E8839A for ; Wed, 3 Apr 2024 14:07:57 +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-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-55a179f5fa1so7368397a12.0 for ; Wed, 03 Apr 2024 05:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146076; x=1712750876; 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=GewhX1AhomHs5Aohn6YwaTX+GkXafQtxsWjEwPDqGAk=; b=QL4PZfnbG/ZULb77vB1YzgLdNkPzzlSLr00pPUi+sLDdw2wug3hkPnw3/B8ta+2ncQ b5P53bUfvvuPppM75onmHCV+0wLbn9VW5JE32EBYPOWdRz+fq7aTBJMJ+AYBhIv929wT JVZ/s2YZzMGewz89COfvkpjulO8DjiHvbj+Xs+bDp2ouFhAIixAR1BcP04Mk+GmHD0Im a9+k0VLTgb0teMlQHYGI6tOYeRSOnZ+5RVj97l/mcc28ceaBkHICcs/lYnKU7+0sJe1a jkP1b0uyT+ZH2FHKE/zFb8VbAfwODidyM2woshyaeKwJ3zLm1rbjRfBZ/+3fXBjaMctG NEUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146076; x=1712750876; 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=GewhX1AhomHs5Aohn6YwaTX+GkXafQtxsWjEwPDqGAk=; b=DatnOvcBal+iKxyWkpsryFt6lUJjcQftl36I/eZbNVBzdj2V/uNmgswF35S4MB5FO+ Wui8LxZ0vl2Uyez4QqipFR/jSAXKChfSGd+OqTzFoQbSwXXg7pH/jHwu1ThiaktcKKjA SGGIzjLZPIP1bs0o3mGvGcq2uoYLHG2jgYBsnQA1OPP3D9IY+Yqn+1LMyibT4lJkVwgG AHBJ5cP+thtI6x1DWia1NO0wjeMEbJZi2TGeMkoDlgEd8ovmF1gIMfppZ/Sd1HTGKM31 4l5f6/YByKnNUtnskfZVxZzVjA9QqQXcbr5+nX5P1hOgGgjCJQ0MBsTpaF2ns1j3GJcS mtvg== X-Gm-Message-State: AOJu0Yzpl0kUqWCRe51dDZ05/Nhilb+55soD14lL7p7cmO/7c1ZQTvbQ oloMk80K2oddlRhPdiOq/e6oiVVkWLi/hB7IFlrDHXWQ5+sxGpNlmuK3FN21png= X-Google-Smtp-Source: AGHT+IFUG+942kojTTmDOHfNTbIb2TvH1SUWsrC7s15mY8gsBDlN9aoKluHWZvi3e6vlJa6CC+UUFA== X-Received: by 2002:a17:906:1744:b0:a4e:2d7d:3fd5 with SMTP id d4-20020a170906174400b00a4e2d7d3fd5mr11678735eje.1.1712146076611; Wed, 03 Apr 2024 05:07:56 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:56 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:42 +0200 Subject: [PATCH v6 07/16] clk/qcom: sdm845: add USB clocks MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-7-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=2569; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=LQeBYALcRlahXsl7p+tCEbXEjlrRYAIfZnvrRJ8uguA=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaQdpMOklPbiCYxOwt2EOYELrByP8i2WG9ed Gvn2nE+dZmJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkAAKCRAFgzErGV9k tjaMD/90afp5tmvx53pAOPulfcBcx9CBMAb5orNwDhm7/UppxBJ0uWNo4bDAsBWAw2KSMReCmLa iomFmD4Lf5NQbCFxGxZ2ow+QwSUxRpYZ3swRSOD/ax+Mj9KMiaJKhJITnODNU6t1kUM0EB3CRJc kRSvDRX8qMcB4M5mqeHzM0G0fIc1mBaZgxNGTPmA2xZq/N6LksoalGn5FR9FtwQe3KPwVsz9Ynu vQmSIEYElqZAQTTXZSAy2qH54w+c1A2khj6/+k4Y8L6bpL1h6StuoksyuuE6ThatYvzvwPK3nJI gcqjCpI/RJNgJ26VgO3Amg3bf//xYglRS/RS73lrKTzmTFmLuEI66bFk5tLNyxnJcS1POe8BUFe 7bAgubauJfLCo0DX+uW3Kjo1SYvnS9vD3HVZKsiAnhDqLKPV3vSO/bWGSRj4hsHPYPSTe3IBiBn 4Ik/NMaSdTZHd1ho+mYvJHeEp7OZNLIVIB3JFhtG6QLFnJzHX1Umxpn++n0WnEqVU8BnF0OCElF oJ//61Jl/5Dqdxbmjn2tyXaxDSUH7vvXXY/9ZjGVDYB8Vonw+JnVdYlC4kmQLlasa3g9+v6Bix6 IjwH7eARADuUB3QHJ7oflHot8zSSVP2v+cg85uy57Jt0EsXSpwn+N02JUEAbGvg/lPT3nDfNflc 8zgnIXSX3Em45rQ== 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 Most devices only initialise the USB clocks for us if we boot via "fastboot boot", add the missing clock configuration to get both USB ports working regardless of the bootloader state. Reviewed-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/clk/qcom/clock-sdm845.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/clk/qcom/clock-sdm845.c b/drivers/clk/qcom/clock-sdm845.c index b7154360894a..e9c61eb480de 100644 --- a/drivers/clk/qcom/clock-sdm845.c +++ b/drivers/clk/qcom/clock-sdm845.c @@ -20,8 +20,12 @@ #include "clock-qcom.h" #define SE9_UART_APPS_CMD_RCGR 0x18148 +#define USB30_PRIM_MASTER_CLK_CMD_RCGR 0xf018 +#define USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR 0xf030 +#define USB3_PRIM_PHY_AUX_CMD_RCGR 0xf05c + static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s0_clk_src[] = { F(7372800, CFG_CLK_SRC_GPLL0_EVEN, 1, 384, 15625), F(14745600, CFG_CLK_SRC_GPLL0_EVEN, 1, 768, 15625), F(19200000, CFG_CLK_SRC_CXO, 1, 0, 0), @@ -56,8 +60,10 @@ static ulong sdm845_clk_set_rate(struct clk *clk, ulong rate) } } static const struct gate_clk sdm845_clks[] = { + GATE_CLK(GCC_AGGRE_USB3_SEC_AXI_CLK, 0x82020, 0x00000001), + GATE_CLK(GCC_CFG_NOC_USB3_SEC_AXI_CLK, 0x05030, 0x00000001), GATE_CLK(GCC_QUPV3_WRAP0_S0_CLK, 0x5200c, 0x00000400), GATE_CLK(GCC_QUPV3_WRAP0_S1_CLK, 0x5200c, 0x00000800), GATE_CLK(GCC_QUPV3_WRAP0_S2_CLK, 0x5200c, 0x00001000), GATE_CLK(GCC_QUPV3_WRAP0_S3_CLK, 0x5200c, 0x00002000), @@ -120,8 +126,27 @@ static int sdm845_clk_enable(struct clk *clk) struct msm_clk_priv *priv = dev_get_priv(clk->dev); debug("%s: clk %s\n", __func__, sdm845_clks[clk->id].name); + switch (clk->id) { + case GCC_USB30_PRIM_MASTER_CLK: + qcom_gate_clk_en(priv, GCC_USB_PHY_CFG_AHB2PHY_CLK); + /* These numbers are just pulled from the frequency tables in the Linux driver */ + clk_rcg_set_rate_mnd(priv->base, USB30_PRIM_MASTER_CLK_CMD_RCGR, + (4.5 * 2) - 1, 0, 0, 1 << 8, 8); + clk_rcg_set_rate_mnd(priv->base, USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR, + 1, 0, 0, 0, 8); + clk_rcg_set_rate_mnd(priv->base, USB3_PRIM_PHY_AUX_CMD_RCGR, + 1, 0, 0, 0, 8); + break; + case GCC_USB30_SEC_MASTER_CLK: + qcom_gate_clk_en(priv, GCC_USB3_SEC_PHY_AUX_CLK); + + qcom_gate_clk_en(priv, GCC_USB3_SEC_CLKREF_CLK); + qcom_gate_clk_en(priv, GCC_USB3_SEC_PHY_COM_AUX_CLK); + break; + } + qcom_gate_clk_en(priv, clk->id); return 0; } From patchwork Wed Apr 3 12:07:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919276 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=P13VzyKF; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k7v28trz23tl for ; Wed, 3 Apr 2024 23:09:31 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DA5B4883A0; Wed, 3 Apr 2024 14:08:04 +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="P13VzyKF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A8E51883B6; Wed, 3 Apr 2024 14:08:03 +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-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 E7F1388391 for ; Wed, 3 Apr 2024 14:07:57 +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-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-56c0d1bddc1so7438920a12.3 for ; Wed, 03 Apr 2024 05:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146077; x=1712750877; 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=R7r7yaX5GC6A7b+YWiB29a1fIsl80G8kHqu1xhDh7Zc=; b=P13VzyKFtDlmWRCAMx3ebtXdckxM7J/ef9rnYTnX5utc08oPpnjWICdTQ/jALj1LXh ZzxfnieuKLDmNP18x5GzpBjQzuGv70y385li3k2hGcc6Gbagcjuhrqlb/FCsUgZmM9sf DlDHId8z5Ysdm0m4YcQ/qNA3upYjJiOAeBhf+dWwGvTmBAHmUFJ+2hZayq6WI3LvvfWe 7GcSQuvyWfz/MSaSINSSCqRNM1odj/lVL+NVLFmlBIamfaI3hExVo1iMh0gqWQNpdbF9 n4H6n/xfyQy8b3BXTbu73gw5tTWgM1/pdvP2bmrrVHIOqLtFIQMyKTnTMQdbV3hlKpWC HL8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146077; x=1712750877; 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=R7r7yaX5GC6A7b+YWiB29a1fIsl80G8kHqu1xhDh7Zc=; b=loBkZhPfjz+2lZbJ2ZEm8qFanFor/y0g9I/t3384MEq6M1UCwlYtroPR7naWoKwmu+ x0p+G81Lfk49WNCWC7hSq82UuNFeUQVarm5KbmSU8W7ELfsFpNXOTa3TPraN/nFlKEwU +qOSZoCeYkxbpOGIUzhpPUwxEJcVBrNbxuEWBijvRK3XWkwAthBgeZ+57AcheDF0YZe8 kukMGWfm4nVQfbbwbsaGH/tBqklUojKxBAa0j5DObQjP9L4qbmW7bfPBMP71DwNy70VG px+rEfnjOMFPCndsPdPKqaD0I+R6XNtLR8xKQ0ng6R1k6vgpxj0irW8pWA4qMcfCyjeC xPAw== X-Gm-Message-State: AOJu0YzmobeBaHdS4gUAfwuW7j6Y0Yw27ZDaGSYtIR5MejfGIzfseRQL yGR3auZzn4lYGpnc01rmYGZknOdQQgFB2N4F4p66XaBYQOeStKRtAIoceWzYNdU= X-Google-Smtp-Source: AGHT+IHzU1n8FCdNfB+/85R0srwpnDSEHExDtr11OShpPxgjvS+9Yx2C+lN4nzph7K5e0OSwcd2bBw== X-Received: by 2002:a17:906:1c4a:b0:a4e:42f3:3c87 with SMTP id l10-20020a1709061c4a00b00a4e42f33c87mr9820017ejg.60.1712146077493; Wed, 03 Apr 2024 05:07:57 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:57 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:43 +0200 Subject: [PATCH v6 08/16] gpio: msm_gpio: add .set_flags op MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-8-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=2578; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=O61GGp35CPRo6Gs3ecjo0wdiQX5EtInYxOC3wND9vEE=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaRI+s2edccwZXKeIJz7QHuJSjYYg0RrDtwb x0ivGFAF4mJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkQAKCRAFgzErGV9k tjD1D/0eBRXRly5Xacetqhfl+bYHm/I4+1ecokY0ZruWArO2y4oSD4CMqNPzMg0ckPsl6xeXIZf T6L6lRv6UznCzk2OXkKJyBg1relZesNwq9MIL4wFnnFV8id7x3Ks6RZ2mpalgZoLpGCmd261tK0 yTVOvKQLt0aHpf7Fhl1CT45EPpXi44NQOsLaSNkjtHwhUr4s0+dEZEeNx8rqWXDsm9+nkrfkdrq tJQE6t1qOPNIVeibKsMI86bdzPJcXCdpO1lt94msM90QJ2UzR8ljeEbb0aORNafAY6Ix5abOcWs tJ837Nb/RltsCAGSVOkRkqoLvLiXZrIXqpZ6qzW+bQnWPV0FAJ1jkvfpGxYFb1mlp0pJ4RztjhR Nt4Fx3ST9UK0qgproknOhlaO7csxvmt1yuajsjQ3JG8ICsyhlhZ7Ox/ZuPP1gVtSz2aqEsJTxpY Mjs84g+uqo1B7ZdSesb9/OZpeUcy1zBAS6/yLSNbd92Z+rz2jsDUJCdE1jPpzRQDxfFSH0lqp8Z 9Kr+zF82m9TSHF24llo25i1GJjlOs0BNXP8gCk0gePQJEruIHSeIYbzH2tzBz1RVAU9ilF0f1CQ VAJLKRUELcAjCNKVM6QmGWjtaAggQ0uehdvCyHmRwSzBumkhRsHvY3ObxvFutXTiQbeIjLDnVvI S1mAaTr0nQV4zcg== 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 The .direction_input and .direction_output ops are deprecated, and don't seem to behave properly for us. Implement our own .set_flags op to handle this correctly. Reviewed-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/gpio/msm_gpio.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/msm_gpio.c index 5e57b0cbde75..f5d9ab54e817 100644 --- a/drivers/gpio/msm_gpio.c +++ b/drivers/gpio/msm_gpio.c @@ -34,21 +34,21 @@ struct msm_gpio_bank { #define GPIO_IN_OUT_REG(dev, x) \ (GPIO_CONFIG_REG(dev, x) + 0x4) -static int msm_gpio_direction_input(struct udevice *dev, unsigned int gpio) +static void msm_gpio_direction_input(struct udevice *dev, unsigned int gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); /* Always NOP for special pins, assume they're in the correct state */ if (qcom_is_special_pin(priv->pin_data, gpio)) - return 0; + return; /* Disable OE bit */ clrsetbits_le32(priv->base + GPIO_CONFIG_REG(dev, gpio), GPIO_OE_MASK, GPIO_OE_DISABLE); - return 0; + return; } static int msm_gpio_set_value(struct udevice *dev, unsigned int gpio, int value) { @@ -83,8 +83,25 @@ static int msm_gpio_direction_output(struct udevice *dev, unsigned int gpio, return 0; } +static int msm_gpio_set_flags(struct udevice *dev, unsigned int gpio, ulong flags) +{ + if (flags & GPIOD_IS_OUT_ACTIVE) { + return msm_gpio_direction_output(dev, gpio, 1); + } else if (flags & GPIOD_IS_OUT) { + return msm_gpio_direction_output(dev, gpio, 0); + } else if (flags & GPIOD_IS_IN) { + msm_gpio_direction_input(dev, gpio); + if (flags & GPIOD_PULL_UP) + return msm_gpio_set_value(dev, gpio, 1); + else if (flags & GPIOD_PULL_DOWN) + return msm_gpio_set_value(dev, gpio, 0); + } + + return 0; +} + static int msm_gpio_get_value(struct udevice *dev, unsigned int gpio) { struct msm_gpio_bank *priv = dev_get_priv(dev); @@ -109,12 +126,10 @@ static int msm_gpio_get_function(struct udevice *dev, unsigned int gpio) return GPIOF_INPUT; } static const struct dm_gpio_ops gpio_msm_ops = { - .direction_input = msm_gpio_direction_input, - .direction_output = msm_gpio_direction_output, + .set_flags = msm_gpio_set_flags, .get_value = msm_gpio_get_value, - .set_value = msm_gpio_set_value, .get_function = msm_gpio_get_function, }; static int msm_gpio_probe(struct udevice *dev) From patchwork Wed Apr 3 12:07:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919280 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=shKD9eEh; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k8k4TCvz1yZJ for ; Wed, 3 Apr 2024 23:10:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 93C2C883B5; Wed, 3 Apr 2024 14:08:09 +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="shKD9eEh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3608C883B3; Wed, 3 Apr 2024 14:08:08 +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-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (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 E3D8F88391 for ; Wed, 3 Apr 2024 14:08:03 +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-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-56dfb52d10cso1340034a12.2 for ; Wed, 03 Apr 2024 05:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146078; x=1712750878; 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=cgGFkOv1r6ZqedijumR44euV2V/PWTObj0uui6365Yw=; b=shKD9eEhdTscW7Igv0DkMp6XYQCJOohxYnjsowwP13Eci9T4/TEzbI+jNM1SBZNsZi WFKaQVFkrBwPGOaEl2Vcp09EHOOR2R6ROYy4HvbAjz9s8J47qDEVXQcuj1Nk4v+GVSAk O70V7LlZTxDFTwg0HTMn5Vs9fG3WzqAUj7LEq3VXbw3ciD/OjnBHcsXqsjbM6v8yKeiW WECiXzJH9ot4YUp56OEanWMnjypgkCscWpxyqrAyO67FzNyXXW44Et03hSfLYSa3uAw9 fLh7YoQtfdipHKlHKC2YoABzOE/z+TgXn5isNFU2yzyyNRG2Us3IwcPRUxUM+LFUNjL0 zd2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146078; x=1712750878; 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=cgGFkOv1r6ZqedijumR44euV2V/PWTObj0uui6365Yw=; b=Zhjoa2qH7tKzQPTIjH7Gm1fJQdt4LSuIBaI4cpFAE2+AKKbaNd9oxqiWCK2N2UfyCD 2KMj9gKaZD118skGP1CG0RcQpSV6/7wiog2Fz9jndcKZol8UjaDNW2zPfGUfd3YjFAow hgUev1H4fpQsVqgYu9sn6WWDdOfzUBheyU4slSZHzA4Nm8zC5LjSqOj7qtvGkYkFrdOz zdl0DdRF13oi7Si4W3heSbMgtGPKsjayX7WOMEp+zbPWilFsHUrgEc4VJwf8W6saPvIw jKECTMt8cFo2q87UsnKhkQ946Tl2C7L63Q6HI/sTLRaNab3vnFHUfgweOJHc/9CyyWDv LCcA== X-Gm-Message-State: AOJu0YzGlqNDYInC4SagvL5JK+RwXF5jSgIVrfXHAFtWmvvhgxbAUFDo W00qyEJjoIkGm9tbFqnWPffOb8sGDf1YoI+zCz4TVo9X6O7Aj0zTvRha+/aUkXg= X-Google-Smtp-Source: AGHT+IEuPTqlvtjGHa/UUEpwXl2sr9dPmdeEfqC+C8abj9oqxheIZTJmdtzyT718mhdD85J1Tm5L0Q== X-Received: by 2002:a17:906:f54:b0:a4d:b960:7b8d with SMTP id h20-20020a1709060f5400b00a4db9607b8dmr8946057ejj.18.1712146078552; Wed, 03 Apr 2024 05:07:58 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:58 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:44 +0200 Subject: [PATCH v6 09/16] serial: msm-geni: support livetree MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-9-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1262; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=e9QvEtgQXqVS65y/B+mDQKCzyUPIH18kPws1KWRjbZI=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaRmWSur1rzD8CIDcVepOfCj+IadBnFRwqJU ZSG4RNzQVqJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkQAKCRAFgzErGV9k tpvSD/sG0z1sTuSAmuBleFC4+P/cgyaEcoGPMxViiMakB22iKyycA4n/al263SlA/VlA3lwQToo ucxnbdBObtIxA/ejqIGZGuMi60vaGQkIe1nT+/JE4t149V7KUWDCDmW8UeLa8GC9z1YU0u6KSEA AYGxaCLgMDkgNodqiwK8DNs/DT620DSWOIwnJtdCiO/WV8bfqPUcsWmpl2N8Fy/74O2blD+XVxR hNfVPe/ldsUc11UzVopvxeQHm+QEO5Ne+OfPu8dS+ERDTgngSkwTKkPvBR+4WUy9gOZALPPEfqz tFcBngvpEcpGFGI4bHdnz57PFBchz8SIfPa7K8ihhI1DZNA4wJbMH0o1jnUzKBpr/xdZn5jnkfs mhUKsfvVvmQh6IMAAd3papyRKbrGcSM/8TsbaU2sGKZyN1nAxHfBn9cLLn6dx/T6vfPjGbBE7WR kvqh6MODxLlMduj8JvCEFXk4BORjJeaVoiArCESgmUlK1VHmZcBJCV7en1KOoq8LXgYp/2CGpxx 2B+EiYSCZdFtb7PX0twKaOR04lzrxKGMcup/lNSOGwxCygxqh3n3RvOH2S/t8f6mowusNYcKrGH iH1s8C+oW5Bjqr/4Iy0qTxvGmoYHYcP2cTTivsNpySxF2/sDnaBFHl4FWyrA15xtMIKbX6+yTuV AqJXcFaSsArRwaw== 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 When using OF_LIVE, the debug UART driver won't be probed if it's a subnode of the geni-se-qup controller. Add a NOP driver for the controller to correctly discover its child nodes. Reviewed-by: Neil Armstrong Reviewed-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/serial/serial_msm_geni.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/serial/serial_msm_geni.c b/drivers/serial/serial_msm_geni.c index 4aa0bc8c72bc..5260474fb9a4 100644 --- a/drivers/serial/serial_msm_geni.c +++ b/drivers/serial/serial_msm_geni.c @@ -605,8 +605,21 @@ U_BOOT_DRIVER(serial_msm_geni) = { .ops = &msm_serial_ops, .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF, }; +static const struct udevice_id geniqup_ids[] = { + { .compatible = "qcom,geni-se-qup" }, + { } +}; + +U_BOOT_DRIVER(geni_se_qup) = { + .name = "geni-se-qup", + .id = UCLASS_NOP, + .of_match = geniqup_ids, + .bind = dm_scan_fdt_dev, + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF, +}; + #ifdef CONFIG_DEBUG_UART_MSM_GENI static struct msm_serial_data init_serial_data = { .base = CONFIG_VAL(DEBUG_UART_BASE) From patchwork Wed Apr 3 12:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919275 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ismhyZR+; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k7j2jX3z23tl for ; Wed, 3 Apr 2024 23:09:21 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D75A883BB; Wed, 3 Apr 2024 14:08:04 +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="ismhyZR+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDC32883B3; Wed, 3 Apr 2024 14:08:02 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (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 0A7A9883A7 for ; Wed, 3 Apr 2024 14:08:00 +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-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-565c6cf4819so1522862a12.1 for ; Wed, 03 Apr 2024 05:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146079; x=1712750879; 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=w2IoZleQFmWAeQEyW4JHzoO3O7JYnf70UC0Z9/INMRQ=; b=ismhyZR+BMslNB5X37kfgImb5x6PIU9MPF5jtM7xtA494C4Z69TH/7MbRyk8RrSHSJ Ly2G65jmUSdlKzAsm+qWnaVKVkW19gqkSFb7Ob2wwzrFWRcqdXTHiyAw9gFfuRQdsbAR A4ki+Z+IE/xPEmTaQPcqyhpaZFbxDNrj6C95QPQYEXCoZvknxqc+K4cTWG/sS+T3idgv ne2w/gfrApfrNVPK8R+AcrrP/0QfBbLUOY2rUb4FPk2STCE/FcQaHTMxZ/YgSDAaOuC4 XWVwxSbUu8+LYiR5Tuih99pKE/RJDazp0EPnjCDmBp5OuCdUDYpzsGQJ/t+nt6LS2+ce sBoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146079; x=1712750879; 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=w2IoZleQFmWAeQEyW4JHzoO3O7JYnf70UC0Z9/INMRQ=; b=aEfNYlb/vfO2pqUeW1ivWlxdbJvBXhZpg6DJevBCFc1LrKa+ex9HDSg60XXIZQ2C+x 9zSl+2+PdN08jIDgaeir5qrlm0157GujDRVHZEQhf8rb/b/dZATEqo32ygeJFy7RCINR LMM2joLQqL1J38mpuHVUU5EK/L11hT4FejSendDAz5tXHzhikj7ufXlI1liA2mf9+rHH 5IB0CEjoJnkLv+rdMhqVp1vWdXWtodTD7q+wF/Iilckj1fhSnJj5tKmYWY8x9sPc8lxd tU8swLKGYqn05ZiCAWPx9x2uPCym8FGotdxsMSWcIMCho8FajlCuSwGbPaMrDA+qlWdy lnDg== X-Gm-Message-State: AOJu0YxM5bGpTC8Dl4BXd59/rMA0W3l2s9CBCFyHKRhRqkzaV6yIuoAE QIOQxq5QL5mTd4qjN2qRRrUtVaJ8/nem+2UGE6XuA9Ed5yNJJW8/X64ePMGIZ2s= X-Google-Smtp-Source: AGHT+IHuJNX4EkCy5Qh19SVQCtLJmdwCqsDZmj2Aye0bY8oP/beJQ+JWbVDjyaa8uiFt1FgWu4tNmw== X-Received: by 2002:a17:906:b058:b0:a47:1f61:4d02 with SMTP id bj24-20020a170906b05800b00a471f614d02mr1911874ejb.36.1712146079519; Wed, 03 Apr 2024 05:07:59 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:59 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:45 +0200 Subject: [PATCH v6 10/16] mach-snapdragon: fixup USB nodes MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-10-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=6975; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=1hpSGa/6NmcAEUCxy7k7ir1TnSOYsoVZZz4LMLguGzU=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaRuqLaab/d7DkPptfaDcFzak0BeIqe1jYRj ef+ipnQs4WJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkQAKCRAFgzErGV9k tuuTD/9bwaAKTJy1ZrcmykgXzwVPJQp+vIQIWzsoCEUuLapkVhR3kf5y/ne209dUq2RVC4GTySv lOc1thLJcDVbSK/YOyqclyI0uYOMEoC/pNrol9k2XKXBoui+DBk9AZWNqa7QY8mvof4iK4B4HLK w8jjdwnhVbUguW0qBVGXO134VzQfl5n1kd3w4XPn/sxE4x3RoZbeo/c+P4gUErOj9fuVBhmZLvY Zu3yEScIssxyMknWfUuBli1hrVmkU6KBdicMZz7AQqT3xbVipCJ9H529EVtbyaGyTWKDCoTacQZ zofMgNTSYYZPzHWM8Fgu4lQllrLxXgYqQpqTGV231YYwqo2uLn+PISX3zZ9lZ3EmhXa2q7pB7qr IUxJgH0pvxvI8k3MMr2MgSFUGxHB6+biq/+Ch+vNQaBg/h61IatuWv+4OCrYPpJ9qEqYTqi9vNp G6FRsIeJ5YHdcy/TEfAoVoQuU6qTNNItmHONHJvLToOj3QwnxfiSPSjvr9caCPQLdLT4mC60FUj DK9H8dlx79QLdrT934SZuVFq1oAejkSNkl4AUTaQ85r9FA/k/IguqCKZVolSdoqvlGQ/Wt6WzD9 k8bF8cKFnCZR5p1u3bAXMknJMnVHypERT1q481ck4zufNFrKjKnoZmMU+hgbtMMJuTamqs9ZWlN UMemak1iO0FysOQ== 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 We don't support USB super-speed in U-Boot yet, we lack the SS PHY drivers, however from my testing even with a PHY driver there seem to be other issues when talking to super-speed peripherals. In pursuit of maintaining upstream DT compatibility, and simplifying porting for new devices, let's implement the DT fixups necessary to configure USB in high-speed only mode at runtime. The pattern is identical for all Qualcomm boards that use the Synaptics DWC3 controller: * Add an additional property on the Qualcomm wrapper node * Remove the super-speed phy phandle and phy-name entries. Acked-by: Sumit Garg Reviewed-by: Neil Armstrong Tested-by: Neil Armstrong Signed-off-by: Caleb Connolly --- arch/arm/mach-snapdragon/Makefile | 1 + arch/arm/mach-snapdragon/board.c | 3 + arch/arm/mach-snapdragon/of_fixup.c | 123 +++++++++++++++++++++++++++++++++++ arch/arm/mach-snapdragon/qcom-priv.h | 20 ++++++ 4 files changed, 147 insertions(+) diff --git a/arch/arm/mach-snapdragon/Makefile b/arch/arm/mach-snapdragon/Makefile index 857171e593da..7a4495c8108f 100644 --- a/arch/arm/mach-snapdragon/Makefile +++ b/arch/arm/mach-snapdragon/Makefile @@ -2,4 +2,5 @@ # # (C) Copyright 2015 Mateusz Kulikowski obj-y += board.o +obj-$(CONFIG_OF_LIVE) += of_fixup.o diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c index 6f762fc948bf..65e4c61e866a 100644 --- a/arch/arm/mach-snapdragon/board.c +++ b/arch/arm/mach-snapdragon/board.c @@ -27,8 +27,10 @@ #include #include #include +#include "qcom-priv.h" + DECLARE_GLOBAL_DATA_PTR; static struct mm_region rbx_mem_map[CONFIG_NR_DRAM_BANKS + 2] = { { 0 } }; @@ -159,8 +161,9 @@ void __weak qcom_board_init(void) int board_init(void) { show_psci_version(); + qcom_of_fixup_nodes(); qcom_board_init(); return 0; } diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c new file mode 100644 index 000000000000..4fdfed2dff16 --- /dev/null +++ b/arch/arm/mach-snapdragon/of_fixup.c @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * OF_LIVE devicetree fixup. + * + * This file implements runtime fixups for Qualcomm DT to improve + * compatibility with U-Boot. This includes adjusting the USB nodes + * to only use USB high-speed, as well as remapping volume buttons + * to behave as up/down for navigating U-Boot. + * + * We use OF_LIVE for this rather than early FDT fixup for a couple + * of reasons: it has a much nicer API, is most likely more efficient, + * and our changes are only applied to U-Boot. This allows us to use a + * DT designed for Linux, run U-Boot with a modified version, and then + * boot Linux with the original FDT. + * + * Copyright (c) 2024 Linaro Ltd. + * Author: Caleb Connolly + */ + +#include +#include +#include +#include +#include +#include + +/* U-Boot only supports USB high-speed mode on Qualcomm platforms with DWC3 + * USB controllers. Rather than requiring source level DT changes, we fix up + * DT here. This improves compatibility with upstream DT and simplifies the + * porting process for new devices. + */ +static int fixup_qcom_dwc3(struct device_node *glue_np) +{ + struct device_node *dwc3; + int ret, len, hsphy_idx = 1; + const __be32 *phandles; + const char *second_phy_name; + + debug("Fixing up %s\n", glue_np->name); + + /* Tell the glue driver to configure the wrapper for high-speed only operation */ + ret = of_write_prop(glue_np, "qcom,select-utmi-as-pipe-clk", 0, NULL); + if (ret) { + log_err("Failed to add property 'qcom,select-utmi-as-pipe-clk': %d\n", ret); + return ret; + } + + /* Find the DWC3 node itself */ + dwc3 = of_find_compatible_node(glue_np, NULL, "snps,dwc3"); + if (!dwc3) { + log_err("Failed to find dwc3 node\n"); + return -ENOENT; + } + + phandles = of_get_property(dwc3, "phys", &len); + len /= sizeof(*phandles); + if (len == 1) { + log_debug("Only one phy, not a superspeed controller\n"); + return 0; + } + + /* Figure out if the superspeed phy is present and if so then which phy is it? */ + ret = of_property_read_string_index(dwc3, "phy-names", 1, &second_phy_name); + if (ret == -ENODATA) { + log_debug("Only one phy, not a super-speed controller\n"); + return 0; + } else if (ret) { + log_err("Failed to read second phy name: %d\n", ret); + return ret; + } + + if (!strncmp("usb3-phy", second_phy_name, strlen("usb3-phy"))) { + log_debug("Second phy isn't superspeed (is '%s') assuming first phy is SS\n", + second_phy_name); + hsphy_idx = 0; + } + + /* Overwrite the "phys" property to only contain the high-speed phy */ + ret = of_write_prop(dwc3, "phys", sizeof(*phandles), phandles + hsphy_idx); + if (ret) { + log_err("Failed to overwrite 'phys' property: %d\n", ret); + return ret; + } + + /* Overwrite "phy-names" to only contain a single entry */ + ret = of_write_prop(dwc3, "phy-names", strlen("usb2-phy"), "usb2-phy"); + if (ret) { + log_err("Failed to overwrite 'phy-names' property: %d\n", ret); + return ret; + } + + ret = of_write_prop(dwc3, "maximum-speed", strlen("high-speed"), "high-speed"); + if (ret) { + log_err("Failed to set 'maximum-speed' property: %d\n", ret); + return ret; + } + + return 0; +} + +static void fixup_usb_nodes(void) +{ + struct device_node *glue_np = NULL; + int ret; + + while ((glue_np = of_find_compatible_node(glue_np, NULL, "qcom,dwc3"))) { + ret = fixup_qcom_dwc3(glue_np); + if (ret) + log_warning("Failed to fixup node %s: %d\n", glue_np->name, ret); + } +} + +#define time_call(func, ...) \ + do { \ + u64 start = timer_get_us(); \ + func(__VA_ARGS__); \ + debug(#func " took %lluus\n", timer_get_us() - start); \ + } while (0) + +void qcom_of_fixup_nodes(void) +{ + time_call(fixup_usb_nodes); +} diff --git a/arch/arm/mach-snapdragon/qcom-priv.h b/arch/arm/mach-snapdragon/qcom-priv.h new file mode 100644 index 000000000000..0a7ed5eff8b8 --- /dev/null +++ b/arch/arm/mach-snapdragon/qcom-priv.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 + +#ifndef __QCOM_PRIV_H__ +#define __QCOM_PRIV_H__ + +#if CONFIG_IS_ENABLED(OF_LIVE) +/** + * qcom_of_fixup_nodes() - Fixup Qualcomm DT nodes + * + * Adjusts nodes in the live tree to improve compatibility with U-Boot. + */ +void qcom_of_fixup_nodes(void); +#else +static inline void qcom_of_fixup_nodes(void) +{ + log_debug("Unable to dynamically fixup USB nodes, please enable CONFIG_OF_LIVE\n"); +} +#endif /* OF_LIVE */ + +#endif /* __QCOM_PRIV_H__ */ From patchwork Wed Apr 3 12:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919277 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=bNd8wJuC; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k845BjDz23tl for ; Wed, 3 Apr 2024 23:09:40 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 53306883B1; Wed, 3 Apr 2024 14:08:06 +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="bNd8wJuC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C444C883C2; Wed, 3 Apr 2024 14:08:04 +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-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (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 29AD98837E for ; Wed, 3 Apr 2024 14:08:01 +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-ej1-x632.google.com with SMTP id a640c23a62f3a-a4e65dec03eso423720766b.0 for ; Wed, 03 Apr 2024 05:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146080; x=1712750880; 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=atk6K8T5n8lDURrFo1/qujfmQUqqKVW2EVC2laZ1DQA=; b=bNd8wJuCfrLOgD5ZgJPoiWVGwjZFG/pjikJUqw00S4a4A4XR6bv4daDv9O3zC8ZIDu nskExG/bC7Iv6F0UGsAFfMDZEmR6RcAS3IKXxwlK2fpaiTEsrS0esZiRp4pPB/c/VndJ oyf4UL56PEzrBueUOS3v4ydBry97SM8sXavunSP04vLTkwvpnnsXX9/aKMjNiYprGpr6 F+Hndw/fPXNizUeUMTbuzAycoDWRhrvIVdhDejX5LECiAoupPYEzQv0orwTHwLM/CSPb 6vfwjFDgGJ9gxps5AtJfM3hZQGNGYvXWGvbcETst0bPsc9VgSSSEsvwNejkiGVUfKW9e ztNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146080; x=1712750880; 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=atk6K8T5n8lDURrFo1/qujfmQUqqKVW2EVC2laZ1DQA=; b=mDENC7RTs/H0CZw+p+rj/QThcXb1XRIDcf4Erbd7B9nZvSu6wHoZYq3YI/ZyJJf5VM WONtPXAxlSwCCNlC7O1j9nBj8v/LwM904dF2UPSL5JKf6Xcz2Xy5Fy17W4ucUCFJtJGk sfNtFDRsqHeHqdjSp8BWTRJQem9H6Om3TemSfgFA4pzp5qjXta+ims+u1usoKxKUzFfc NSbsM6kIfb2chSabhh8Vjtx//ra8/XLlm4oKqz1h34wFecd5RVbdMQXt9i3eUZPGym6J /oMCgHRxqQt4q9CIGiZrFbsGNTepP8k4WtXgOyONYycsuV0foD0OElPq5oZV/pIP4sjI zWpg== X-Gm-Message-State: AOJu0Ywn7NRxIej5Y1nJMKVVtZi/wsJhMc2eUoFDfXlv9P5qPb01UN3o 9eYK6lmDjID+Y6ysQ5Re7t+48cnbqKUhZqVvsJMEMZHwWsrWpV9jbAoDDpXL/O4= X-Google-Smtp-Source: AGHT+IGs5iivAuYyZOL71uKP2HJY+XkG9adNdMyD8u397dQGL4q/DmlNk+I9wIeMOSv1MpDrHvVmiQ== X-Received: by 2002:a17:906:f6d1:b0:a4d:f927:f747 with SMTP id jo17-20020a170906f6d100b00a4df927f747mr1667039ejb.4.1712146080715; Wed, 03 Apr 2024 05:08:00 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:08:00 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:46 +0200 Subject: [PATCH v6 11/16] mach-snapdragon: fixup power-domains MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-11-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=2816; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=+xkPcC5ur3MqWn3Swwn7ynawtVqmdU6FvDe+TLJNJp0=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaR+lLCJ75/J9UzxAWvDD/XxTQTUvryQFyWq C9vmSgOneyJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkQAKCRAFgzErGV9k thm5D/wJO61B+q1mAWrgarXFIvpD1kR95szbkgIE3PhHqrog6o4W2+o6K/dgcwC7hyT8cnJ4LPj 5uh6j3ksd29UJEPLaAWewfJbRZ0HE7ozTy0RrkG7xnF5su8vIYXqO1YpiyesaECVSysT4+BPUZl IDtV3LtonAKsVU1S1WleE69waK0fZ4NRHhqdqk5cfw6/Iore1u4gLinXuA0o3nNtc2iYJ3uh9dK ibEYeEUP3wtCqWIcBQgW6N5tsxvv7KGIeFiAru9+jCNI8RW3gGsZQ1iXo516pPc/e6DWncLUBFb zUvum/7rd6t4m/mxTde3OrV++JlS9rtbe/keDNGKog3h6fZF6svyi+0BLhKvx+K6lAg2lhLJo49 gUP39LMfOqGDxOZhKSVOnLlclZ6txw2F+Bx3R/BlMxOIUXOHUEOuxQVkH/hOGGgJwXaAdFJPiKC zvzMYsrpM5KSS68fxT6ddQz+gaMrcu0wI6K94mPcF4XEfmVYWgrp5b5INPbnmxLlFTsxKGgHPnl yT5a/wHerFzLtnK2PrITFrI5O/b/Ec17j9mxRrElHdIPCuVHMt73ztdYEOqPSv1AX6IsWkj2r19 jZAufl1PK5kwaCE3w4eHBLvJsQ8HWGVB4bJrZtmzJm3lNm6GtR7bx9VZFihaGDPqu34Fg0lmMbA z8eFhnxuE2Ku2sQ== 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 We don't support the RPM(h)PD power domains in U-Boot, and we don't need to - the necessary resources are on, and we aren't going to enter any low power modes. We could try using a no-op device, but this requires adding a compatible for every platform, and just pollutes the driver model. So instead let's just remove every "power-domains" property that references the RPM(h)pd power controller. This takes <1ms as we're using OF_LIVE. Of note, this only applies to drivers which are loading post-relocation. Drivers loaded pre-reloc that reference the rpm(h)pd still need DM_FLAG_DEFAULT_PD_CTRL_OFF in their flags. Acked-by: Sumit Garg Reviewed-by: Neil Armstrong Tested-by: Neil Armstrong Signed-off-by: Caleb Connolly --- arch/arm/mach-snapdragon/of_fixup.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c index 4fdfed2dff16..3f7ac227bd09 100644 --- a/arch/arm/mach-snapdragon/of_fixup.c +++ b/arch/arm/mach-snapdragon/of_fixup.c @@ -21,8 +21,9 @@ #include #include #include #include +#include #include /* U-Boot only supports USB high-speed mode on Qualcomm platforms with DWC3 * USB controllers. Rather than requiring source level DT changes, we fix up @@ -109,8 +110,38 @@ static void fixup_usb_nodes(void) log_warning("Failed to fixup node %s: %d\n", glue_np->name, ret); } } +/* Remove all references to the rpmhpd device */ +static void fixup_power_domains(void) +{ + struct device_node *pd = NULL, *np = NULL; + struct property *prop; + const __be32 *val; + + /* All Qualcomm platforms name the rpm(h)pd "power-controller" */ + for_each_of_allnodes(pd) { + if (pd->name && !strcmp("power-controller", pd->name)) + break; + } + + /* Sanity check that this is indeed a power domain controller */ + if (!of_find_property(pd, "#power-domain-cells", NULL)) { + log_err("Found power-controller but it doesn't have #power-domain-cells\n"); + return; + } + + /* Remove all references to the power domain controller */ + for_each_of_allnodes(np) { + if (!(prop = of_find_property(np, "power-domains", NULL))) + continue; + + val = prop->value; + if (val[0] == cpu_to_fdt32(pd->phandle)) + of_remove_property(np, prop); + } +} + #define time_call(func, ...) \ do { \ u64 start = timer_get_us(); \ func(__VA_ARGS__); \ @@ -119,5 +150,6 @@ static void fixup_usb_nodes(void) void qcom_of_fixup_nodes(void) { time_call(fixup_usb_nodes); + time_call(fixup_power_domains); } From patchwork Wed Apr 3 12:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919278 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=RzJvP38o; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k8H69B6z23tl for ; Wed, 3 Apr 2024 23:09:51 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C52EF883CA; Wed, 3 Apr 2024 14:08:06 +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="RzJvP38o"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D8FDE883C5; Wed, 3 Apr 2024 14:08:05 +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-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (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 48E89883A3 for ; Wed, 3 Apr 2024 14:08:02 +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-ej1-x636.google.com with SMTP id a640c23a62f3a-a467d8efe78so783724166b.3 for ; Wed, 03 Apr 2024 05:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146082; x=1712750882; 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=CEa1uvzHHZiFQ7KW80s5FU7jkCJCbFju98xTsCLC/qw=; b=RzJvP38opPIdGya2mtqh3yh4LEGZse+ifnd+NENAlsbKqOLmI9oe5n8pWt8ghCq+dT 02KlDtkEyJC414d0tliybd7qxVzmw0liz0HexK0Dyw7JbVEb1ZrZovia+kT1+LsQcVQZ kuvy7L1+O0zkyA9pHhajSETDFouMrqB4booZRwGlBc1r17v2eEURj6oCJ4REWQMwykYY e55IP8y9p+j0K2b4kSuxCVu+FA8tL+qsvpw+cjFNHhzB9mYgw6n+4c5av5QIemZ03jLD 6u0eJ2mcBTDmTSBsw8TUV9uUQL3dMB2VgT2pEhP/GqoCKLUg7milA79jDemV80RLFjoa +YxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146082; x=1712750882; 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=CEa1uvzHHZiFQ7KW80s5FU7jkCJCbFju98xTsCLC/qw=; b=qliGGSDsgHqF/07bqlYZLeOwPVIgq8/67KLdtc4fA/4bMzvksI6pgLpZIvrRn41pR6 VowbZu7AMxnOsH1X/4SRDZxFkVB83JU2KUMLJp3hiN3nbzaND+Mjbk2Vkj6/9s3vpK2t 9o9hsxkEu45LIwmTXG6HP68/ey3SBoOijMtmSBrtVwaGjmhUOLnW+o+/AFwF8dEHo/wy 2fYuFQ0tpN/oMklwpmhiXRxNCXmjB3meQXetXOZxmtLnT6KXYQXl/BrwekHvDLp26fBd 8TVqSdezsZEHBWdQbdEswwjYKa779tszZusY1Okae7KowEgiAI7dqb66HetepnZUzVU1 zhSw== X-Gm-Message-State: AOJu0Yy2DFjvrnDSLXMEWJa5ll5DVhe4oVrZP6Vj+qDcNoGWYRpNZy4N N3iKO4mO1BWWQ0GgJBV23fQbE3MUmQIaGkSpUNXUZKjjxfytKV/JxYpJZHM3ff0= X-Google-Smtp-Source: AGHT+IHlTT2kyheE5l/03l/vtOIAmIcIV/rmxdR+74dcrnh3g/7IrbFNurQ5oPc4ZkvnhStzfd3Xjg== X-Received: by 2002:a17:906:16c4:b0:a4e:22a6:17c0 with SMTP id t4-20020a17090616c400b00a4e22a617c0mr10952894ejd.53.1712146081900; Wed, 03 Apr 2024 05:08:01 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:08:01 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:47 +0200 Subject: [PATCH v6 12/16] mach-snapdragon: call regulators_enable_boot_on() MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-12-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1052; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=dRy9leI1WDAXwtHW2U3ZWullcNHhVVqJ6wANm74o24s=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaRT6gwNE9TIZsxlDpzZdOMhwcl1VvaTLGHz 9IQiwT0U1GJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkQAKCRAFgzErGV9k tjVsD/90ZXPSFb7gqqq0TidjFs87orWP+jL+D/sxXi2KZJNh7GzWB6j1lkFG55C3wxW+RkyaY9a LTJqMP1XJYHSViqqbmQE6RaJT+fTXKDxchRTsAbzBdZ6G+ubSNeJIX/6o8EfwYz+E0QTcqMfpdT iPkUgJg+2MKdbib+S23wYkH96Nx1KyLIGwEwnzwfZnGdYOGqaqZhDXohKgoExBKiTn0e2Uf/a3r 4lGwgxiouHFrOdmJkBax+Ll6c5jQhBqyjenZMUf9LYgJU0Yhc3xFKzyddJxT4lW+pUKet8M9b8c BCPiIX6uOzh3lbWREFYO3avQVdmcg4A9iX2hNFe5ZOnIwc6eCdnvH4lXeK1Q0OoD6IRoTBcYqGZ dCEjRumfTEtT6FY3ALgDdXtcGqv4pJchO0S75L/YQux+d3OJY20IzKo2TMjdHdgVk4YRb6SYXtU jHZ+ahXYCUW/0SHWH0IAuO4w/ZDPI9Odt3OBQu/pkr8wm2PDLwKHlN2YPARz/Mkqo/TPbyOb2p3 oYzHbTKQWb/eKeIVQp12Eih67Oi7iXp8bbnapi7S6g9w00L6SnbxIkGNUHW076KkOyrKuX24/CZ p7gPCwUTLiEhg6sMs8D/T5YRHykACqInLFA76Nhx5WATRvBzGZGT7RrjuHpit/CwiJLqQU4rmQ2 H4sGleZbrzcAexA== 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 Make sure we power on any boot-on or always-on regulators. These are used for peripherals like USB on some platforms. Reviewed-by: Sumit Garg Reviewed-by: Neil Armstrong Signed-off-by: Caleb Connolly --- arch/arm/mach-snapdragon/board.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c index 65e4c61e866a..3d5994c87886 100644 --- a/arch/arm/mach-snapdragon/board.c +++ b/arch/arm/mach-snapdragon/board.c @@ -15,8 +15,9 @@ #include #include #include #include +#include #include #include #include #include @@ -160,8 +161,9 @@ void __weak qcom_board_init(void) } int board_init(void) { + regulators_enable_boot_on(false); show_psci_version(); qcom_of_fixup_nodes(); qcom_board_init(); return 0; From patchwork Wed Apr 3 12:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=i/hI2lk6; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k8V4J6cz23tv for ; Wed, 3 Apr 2024 23:10:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 35DAF88399; Wed, 3 Apr 2024 14:08:09 +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="i/hI2lk6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8E8C7883C5; Wed, 3 Apr 2024 14:08:07 +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-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (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 5DD30883AC for ; Wed, 3 Apr 2024 14:08:03 +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-ej1-x62f.google.com with SMTP id a640c23a62f3a-a517a492055so15230766b.1 for ; Wed, 03 Apr 2024 05:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146083; x=1712750883; 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=rT2hJHvXJ3OID9Ciyja3ANXjBepnBUwLb+A7aW2D5jw=; b=i/hI2lk6UnGXOP2YBdjKQ0da1wFGQ9XxqpZyqzwgvLShYTNdWS23TSbR/lhRy6SUmQ M44d3BcBaGpLr2MQy4HZ6DGL/VUk9acXMcTkQdIaqlaQ0LvQQgm2+ZuXZkr0fLAYGZQS zJBu+jA1HIZ3e5liIoTTXKLtYAnwBnMHdghCE5imE03GCbOZHH/1UQd4fOiU3QSXrDNq C92mUufd3m3ZVAWMb8ZLciunXPpWzhD9Uk3QVynnv0m+DoU7r440KHsRK9QQDWM/aIxA xLWe71697dhJX+/rJFkYIMRVBeHCr2TCqFXL7CXHDTrPCk94XksuqqwIrZSB6LM4k5uZ Gmsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146083; x=1712750883; 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=rT2hJHvXJ3OID9Ciyja3ANXjBepnBUwLb+A7aW2D5jw=; b=DsgcHe0GJZ7N8an+f58FyBCioXf8fDMyBDuvRBg8wkhfY1llrYvVYYEpyLVuvQTI1v IsOFOIQu95dCiFE5IMJqS66zvsInFf1yFg8PSpzzo3HL+MnW3MWzpEE3anBGEQgxxpwy d1/hccBj+j8r5nHkdQ+lhXcnvepYbqyLeACSq3Wg3gc6jQeIA9A0tlzuLL1lNNF4rplB hWuVpu5ABGU6ZiR/nULGcmoZ9M1Nfac5tyCcbYN6Idly2qAiuBAlQqK+1cwsgXwaergH 01VEPr0O4+Nkp9Rvdl8QHdr80+nZBMkD3H0ViT/5PJkOqxHDgBDxA/R5quQ5BAAdR/4Y mFnQ== X-Gm-Message-State: AOJu0YzY6Z94Svc/Idg/bNGr1GzY9QBJF/CXH1+gNjLCl6joZotlogs8 lEWxH2q3M5/6mJlbEomzo/XtjHSOvoFRWc4FJr8uSQ8f92AE5ZXE85TxsW0zZo0= X-Google-Smtp-Source: AGHT+IGbC7HTepLFKQ+OZQ9uLW4nEYtucnMnVP5QjE1lcTIh2ckFOwehkFemK1ad50p1WrlrPkFWIA== X-Received: by 2002:a17:906:22ca:b0:a4e:a7a:84e0 with SMTP id q10-20020a17090622ca00b00a4e0a7a84e0mr1559586eja.34.1712146082954; Wed, 03 Apr 2024 05:08:02 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.08.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:08:02 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:48 +0200 Subject: [PATCH v6 13/16] dts: sdm845-db845c: add u-boot fixups MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-13-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1169; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=1IDFJJ2BawZVnf9CpUigdeE7f6YRQUBvg/1YpdTtwBY=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaRgBKiXoaLUJGiuJjkydjXsh9X5t5TpTITi 0a/FryVOoGJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkQAKCRAFgzErGV9k tnumD/9DXm++u+nC9Np19NklsZE63Uqlepa02+VfYA96QNC3DizJxmyWR+1iubtPqLdvFWJKFtZ mP1g59LCMG8p5pkFiUSecltdTgV7MJvB3yvq5EJAvGkBhw5bF6NLHFwD8jv3QXgWiKgqklrYBCX Mxsg8kfFNnJ9qeeen1lrC+3cPUoWCXo+EtTmivL993vXpLCImvVvxYV2tXf33+DqNWrKnf+8XVI NpriFkiXIxHNpbR4HiiZ5+XfHGIpBK9QgSFZ3Fp+ET28wA/6pWXcj1O7sfaswVeGMsgZVsXpTJL GBvtM9lJXY//PUT3wvQ1vzwLkEr/ER/Wt9CXknXjmAKZ93H7cAh9VfLlUOCgxUdBzcHtcSDw2FV 6tF0uDj4KNZxGWqd/y7WbcQwFtL1/IFXTlHG/y+m/F6qfotZph9rWXEluWi/RdyftwXj1vAUurh psj6gjX/gQJvo5OJ5OUdjNQTVIARWcZCal6JVrgQ4rdiDiFUahR6zXuESGNTNv7zGx4Jy9X8DsU cV7/cOJgbck47b91y6OoweZ0s7UI1jUWvzQCNY1/nH1qcgY5GUVaVZudMUwqeBU6gTOlyWGPBG4 RCGAiMpX8rpyX7MrWOdZ4AWgRNDM+dMPZCyWfgSFhVL73ecqxgVA9tmP7YMBihnBdrqiYtgf2pe xx3RJrGs1CtBKBg== 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 The USB VBUS supply for the type-A port is enabled via a GPIO regulator. This is incorrectly modelled in Linux where only the PCIe dependency is expressed. The correct way to handle this will be through a usb-connector node, but for now we'll just mark the regulator as always-on so that it will be enabled automatically during boot. Reviewed-by: Sumit Garg Reviewed-by: Neil Armstrong Signed-off-by: Caleb Connolly --- arch/arm/dts/sdm845-db845c-u-boot.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/dts/sdm845-db845c-u-boot.dtsi b/arch/arm/dts/sdm845-db845c-u-boot.dtsi new file mode 100644 index 000000000000..906f9faa5451 --- /dev/null +++ b/arch/arm/dts/sdm845-db845c-u-boot.dtsi @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* Needed for Linux to boot from USB, otherwise if PCIe driver is not in initramfs + * the VBUS supply will never get turned on. + * https://lore.kernel.org/linux-arm-msm/20240320122515.3243711-1-caleb.connolly@linaro.org/ + */ +&pcie0_3p3v_dual { + regulator-always-on; +}; From patchwork Wed Apr 3 12:07: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: 1919281 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=f7tMCc/5; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k8x0pd6z1yZJ for ; Wed, 3 Apr 2024 23:10:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 07EAE883C3; Wed, 3 Apr 2024 14:08:11 +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="f7tMCc/5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF593883BA; Wed, 3 Apr 2024 14:08:09 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) (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 6E5D8883BC for ; Wed, 3 Apr 2024 14:08:04 +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-ej1-x634.google.com with SMTP id a640c23a62f3a-a4e39f5030dso650516666b.0 for ; Wed, 03 Apr 2024 05:08:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146084; x=1712750884; 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=dkr+CmAQ64eUqOg4M49/tTSWR5zwY0MG3Z7wMHd84mg=; b=f7tMCc/5xuqSxA2NwVpwRrfVH9ZVqZMojSILnxnG/qyprINn6XpU6e6tHb0GS+i2hy +hst8fB4QZtyj7rcz8u+CkKdoC85fZIgDsfiah8EL1RPYyPPL+vnCGtykrnVU34BTOI1 /lDOpP8ll4E5y5pbUyjgi8A3JEe7AvBF77J1YpE/JqwFzhhdHYw64HOG9cmnALLxgBpZ 1PPxacRYigFxsDd+nrUIIP9iIQeXBlpZD9U68lzWttTMNb9iw4EIhnt2vts3MrAuoMwd NzDofkfm7riBIWWE1ZmHG0L8RAVTkVrLOGSgLmL9qrVCkZvYbs8PEwK7y9cXZ69QZx1D 4pYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146084; x=1712750884; 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=dkr+CmAQ64eUqOg4M49/tTSWR5zwY0MG3Z7wMHd84mg=; b=AY9gIglPASP4fKal2GeUt48TPiHLviNRPh9cXyjka1gt1xyq5HzbYEOgiwFaNfRCqF bjyiCHHRaeF93AUvsKBJyseeu1dzQpFuprKfUCRyMKuR4WilfrqK9GUh9yrlYJohKcpu 52FznGh4ZZ6hRczB+cUWlM8JWSVweyA8xxH1z73hrrya5c0Tn8XPYnKaTi0KjYAnjxN7 5/p54O2Siawl46Y/KIVu81j51Tf0n0FvKavrGXSB7v5Oh4LDCGUTbsMH3CkHZRAw0NNl VHpFJ8+iheLHktYu20SdTxq5Yq/9tXzTWWgHQBY6NcgKV9BpIQJD54unW+wAtOzistIF aRhQ== X-Gm-Message-State: AOJu0Ywl09E8iYJt1DJ4jHF/x81DwBf5dI4GkeiQAfUoEwm+o58i0G0N z8WgT3DTANNAOSeMSykgk7e70LZ7vDlJtdFkIvs3sK1P4oV5mNlEBAMTKCttg4c= X-Google-Smtp-Source: AGHT+IH8OHUQLuLK74/rl7dH6AjuR8hfs1lKAg1p5yOCFzrWosf/erDztz2UGJA4kTR2EILSXHZ9Tw== X-Received: by 2002:a17:906:5794:b0:a4e:7b8e:35ae with SMTP id k20-20020a170906579400b00a4e7b8e35aemr4946670ejq.38.1712146084063; Wed, 03 Apr 2024 05:08:04 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:08:03 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:49 +0200 Subject: [PATCH v6 14/16] qcom_defconfig: enable livetree MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-14-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1150; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=FnsFYaj7bNmRgQrn2qeK5nE0SjWYSdwas1Nyt0LNrPk=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaRNjL0dpjtsO/f/nGBGvsouO+laHYNvvFVZ RL+UaRbG36JAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkQAKCRAFgzErGV9k tpxlD/45EFB1QPcNTGXXbiZVVMrDUCPk1mv9NgMJHvcAgsX4usbflk2lcQUoDzW35GEMOIlMHsx Q0CRRaOhP5T1WyuXq8n38TmIgg0KDg9r5WvG5NqUlHMkSoN5x2BZz0vkIh96moE0AGMsBTtDcHh rRddm2tDd5TQIw2VuKot30CQyI8Qpzfc/JUMKY3HKv75XSwWw6+jfwKTNfvk8/lmsXuKDFChJFD 6xMS4KseCxN+3L+gFfmuO6S9SpEpKiqNzqqQZkib0fzRIPSbBAjmWnb4flO5uIPej2644tlh4Ur mqg8Chjd7IqDxHYkd3Rhba5Nw7qr5XZsIHovwVCbAcgiJ4+hS/N6t80UZTsDM0QUDJ34EKdb0ZM uKh7jOs7otAws/I1Sw2eajPXwg6ng1SEI/5iYEfvx9ycqMZQPR4+Vk9oa+fnYOwZsLnoUKwioD5 SKmmoxohg9Wu9JJMVl6mINOP+m2to/oR4w9gjKV9z9QSOPezVdKykymQeylyxJaXzV1uRyGlKD2 lQuuvsN32ak9Votp64bUiIBWO5yDDFAgqC94qL1UJp0PPEWW12iXyapqiwmo5goUKhDZIHareKk z6OeGznL1kX4oGc+VvBizs5oO+8wAbIwkv1cecbh1Rw+lkJIdpUjag3QVyqovi4jqZFcZ870kRR StdqN9seckz1Alw== 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 Qualcomm FDTs are on the larger size, and with the addition of DT modifications during board_init() it makes sense to enable OF_LIVE globally. The cost of building the tree should be offset by the increased efficiency at which we can walk it. Some rough measurements with CONFIG_BOOTSTAGE suggests that this might add 0.1-0.2ms to the boot-to-console time. However the reset-to-reset timer difference is in the range of 0.5ms so this could just be noise. Suffice to say, no significant slow down. Reviewed-by: Neil Armstrong Acked-by: Sumit Garg Signed-off-by: Caleb Connolly --- configs/qcom_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/qcom_defconfig b/configs/qcom_defconfig index cbc612b44bd9..8c4402e8f780 100644 --- a/configs/qcom_defconfig +++ b/configs/qcom_defconfig @@ -25,8 +25,9 @@ CONFIG_CMD_UFS=y CONFIG_CMD_USB=y CONFIG_CMD_CAT=y CONFIG_CMD_BMP=y CONFIG_CMD_LOG=y +CONFIG_OF_LIVE=y CONFIG_BUTTON_QCOM_PMIC=y CONFIG_CLK=y CONFIG_CLK_QCOM_QCS404=y CONFIG_CLK_QCOM_SDM845=y From patchwork Wed Apr 3 12:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919282 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=bRrIR0Yp; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k971tQtz1yZJ for ; Wed, 3 Apr 2024 23:10:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 74895883CE; Wed, 3 Apr 2024 14:08:11 +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="bRrIR0Yp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 242B9883BD; Wed, 3 Apr 2024 14:08:10 +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, UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (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 84F858839F for ; Wed, 3 Apr 2024 14:08:05 +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-ej1-x62c.google.com with SMTP id a640c23a62f3a-a4e5ee91879so457409566b.3 for ; Wed, 03 Apr 2024 05:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146085; x=1712750885; 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=lXyr6tJR6QFXRSTjw1XngBqNszpjZjRzQWF6T1YQB14=; b=bRrIR0YpahYC/V/b8uGNrWwqrFqWYDOOD9k7h/JtzeixxEh8cFuz7LnGldHwJWfK1W Q6U1xxTR/qB3KSVTbX2HXmeYLB8waxx/sCePzCpyfoCRmwJcRgmBgU28Hi1j4pCxuf99 wjW9jRmI3/r8aIHJ4+1ifosY7sc0REsVjt9MJqxE9iYqbQcWHMJUC/xyi8nVi7F+03rL yCTxtpRxYSBW/Q1NzqhzMUgSrzSrClf3lelmcq+tV5ujTi0VWmY4r/eD/DpU7Ze/wKBx /Aww5e6bBNU59WzgEaGjisv71JngtFvmpudLtQwRIjzFan3QzNF91zUdwjPEMZzY4n34 ripw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146085; x=1712750885; 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=lXyr6tJR6QFXRSTjw1XngBqNszpjZjRzQWF6T1YQB14=; b=lBJwsIaKHfL0/ABUH8abJMQTAqJJy1DzC4Owzmce8Z0lZEWs/J32jmYIyIdBPv3PRs mXjPyvsAvZRnhAhZInjWSELgf6refEbc9b69o14iqL7F4a7Mr4X3csU67KFYz6YqHyGX QBJlhZPt63zdecO81azT3RJcxsv0NGWiFiFZzWF72G2RpNg8y7iYu0qlBO3wgtaMFRCv Ild0IuYgmwzxMSp0rtY/uJre7Va/DIhxnSRNsvssJnZhqXWeeP+vJyDCxsXubDnXDtBx d0DNFH83l1M2yQGNd9nPmFRl2ZqpP8TMyoX3qdhSPzyLb8oRQA808TV0SaTIcUy1ksXq ahrA== X-Gm-Message-State: AOJu0YzS5HQiPwqOCFGIYQVs/YKHii0l66vOIHzH3ad/JYhsvYx6iNZr eUpluhsUkI2Uyzghv8uHqIgyHxECMjaZ37r9VbnMny9QIW3B+0BifE3hHRCHeKU= X-Google-Smtp-Source: AGHT+IHDzMoCihRG9iOAaxuT9TbPiZmEKt1i2ovIttbRxTnHUx+VU+2w2gxs1Ltv46GmaEJIezzC+w== X-Received: by 2002:a17:906:251b:b0:a4e:21e0:2e6e with SMTP id i27-20020a170906251b00b00a4e21e02e6emr1760632ejb.5.1712146085119; Wed, 03 Apr 2024 05:08:05 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:08:04 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:50 +0200 Subject: [PATCH v6 15/16] qcom_defconfig: enable USB MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-15-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=3037; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=IiD4QOo4vMkDUnm2KTlh/8akfMnxgScbcOmu27O4wOg=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaRqzvIYQZ/RjSRt07WmWRnBYvOAq7BEx9uA UiEPOSiRxCJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkQAKCRAFgzErGV9k ts5GD/99sMJAEUdyITeqQ1w5MGwakn3EUmV7X/iZgdT2rZXqxoJtA61jP9Vubv6rrZlxeqW0CSd QmJjw4LVVUeVMrRjtM7jZkGvSZk6eqBtAnc019wAS3oOfBGuw6KTFsct1WTVyVFgPv3lMW4lIA5 /+9R6YG1nCtO3UobWgMpBF1ChQl09YDczB6E/A1bMxFeWCddbQvgXGHFpxH9iYC5bTELTWvL+cU za6mFNJSE1lToYryMEfHlr+8vZYH7cUO8Rfu6zxYwL3JoxwuFXAlLjeU/0StwpoCm+Xmn0/Hl6y G7pm8mzzXnNaaSl3UaFb6asEIyenDH9+iIp4pxuVVBNNyGdi1UHnnpN8pW94X+ymRqjoSQZmiiE 0FJ0bivCT79Z13IGXWuuYgebINhtf0yPlgo/xIHPG5kAIgxdYHisEv1PPdX3dUYfKy41ZbgdB/7 fUOmBhbzOjdIodVD3jHHSKn246KsB+fWGapnzTrdhos+S88CGudQn0KX4gVwlY3Bpji1r3AvK7+ zFkHIi1vsr/PfiuifdTeZwW0Mf1qlO8Dg2d9tjYEYTf9o3xdqFDI6Vkr8SP+DcPLO7BZUNwsUVB Vk9h+K1uD6PsyqZ1kgpONGyAMiOIlh7EEFFwhyr7X5bvv3DyqXSXP+YV/LuDc7PjIDkC/xaAnXf mFuV4xhiZd0rqGQ== 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 Enable support for the DWC3 USB controller and required dependencies for Qualcomm boards, specifically the DB845c: * IOMMU / SMMU * USB high-speed PHYs * Mass storage and ACM gadgets Reviewed-by: Sumit Garg Signed-off-by: Caleb Connolly --- configs/qcom_defconfig | 52 ++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/configs/qcom_defconfig b/configs/qcom_defconfig index 8c4402e8f780..1abb57345ff1 100644 --- a/configs/qcom_defconfig +++ b/configs/qcom_defconfig @@ -17,10 +17,16 @@ CONFIG_LOG_MAX_LEVEL=9 CONFIG_LOG_DEFAULT_LEVEL=4 # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_CMD_BOOTMENU=y +CONFIG_CMD_EEPROM=y +CONFIG_SYS_I2C_EEPROM_BUS=2 +CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2 +CONFIG_SYS_EEPROM_PAGE_WRITE_BITS=5 +# CONFIG_CMD_BIND is not set CONFIG_CMD_CLK=y CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_UFS=y CONFIG_CMD_USB=y CONFIG_CMD_CAT=y @@ -32,20 +38,39 @@ CONFIG_CLK=y CONFIG_CLK_QCOM_QCS404=y CONFIG_CLK_QCOM_SDM845=y CONFIG_MSM_GPIO=y CONFIG_QCOM_PMIC_GPIO=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_QUP=y +CONFIG_I2C_MUX=y CONFIG_DM_KEYBOARD=y CONFIG_BUTTON_KEYBOARD=y +CONFIG_IOMMU=y +CONFIG_QCOM_HYP_SMMU=y +CONFIG_MISC=y +CONFIG_NVMEM=y +CONFIG_I2C_EEPROM=y CONFIG_MMC_HS200_SUPPORT=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ADMA=y CONFIG_MMC_SDHCI_MSM=y +CONFIG_PHY_MICREL=y +CONFIG_PHY_MICREL_KSZ90X1=y +CONFIG_DM_MDIO=y +CONFIG_DM_ETH_PHY=y +CONFIG_DWC_ETH_QOS=y +CONFIG_DWC_ETH_QOS_QCOM=y +CONFIG_RGMII=y CONFIG_PHY=y +CONFIG_PHY_QCOM_QUSB2=y +CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2=y CONFIG_PINCTRL=y CONFIG_PINCTRL_QCOM_QCS404=y CONFIG_PINCTRL_QCOM_SDM845=y CONFIG_DM_PMIC=y CONFIG_PMIC_QCOM=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y CONFIG_SCSI=y CONFIG_MSM_SERIAL=y CONFIG_MSM_GENI_SERIAL=y CONFIG_SPMI_MSM=y @@ -54,8 +79,12 @@ CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_USB_FUNCTION_MASS_STORAGE=y CONFIG_UFS=y CONFIG_VIDEO=y # CONFIG_VIDEO_FONT_8X16 is not set CONFIG_VIDEO_FONT_16X32=y @@ -64,27 +93,4 @@ CONFIG_NO_FB_CLEAR=y CONFIG_VIDEO_SIMPLE=y CONFIG_HEXDUMP=y # CONFIG_GENERATE_SMBIOS_TABLE is not set CONFIG_LMB_MAX_REGIONS=64 -CONFIG_CMD_DHCP=y -CONFIG_CMD_EEPROM=y -CONFIG_CMD_I2C=y -CONFIG_CMD_PING=y -CONFIG_DM_ETH=y -CONFIG_DM_ETH_PHY=y -CONFIG_DM_MDIO=y -CONFIG_DWC_ETH_QOS=y -CONFIG_DWC_ETH_QOS_QCOM=y -CONFIG_RGMII=y -CONFIG_PHY_MICREL=y -CONFIG_PHY_MICREL_KSZ90X1=y -CONFIG_MISC=y -CONFIG_NVMEM=y -CONFIG_DM_I2C=y -CONFIG_I2C_SUPPORT=y -CONFIG_I2C_MUX=y -CONFIG_I2C_EEPROM=y -CONFIG_SYS_I2C=y -CONFIG_SYS_I2C_QUP=y -CONFIG_SYS_I2C_EEPROM_BUS=2 -CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2 -CONFIG_SYS_EEPROM_PAGE_WRITE_BITS=5 From patchwork Wed Apr 3 12:07:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 1919283 X-Patchwork-Delegate: caleb.connolly@linaro.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=LT22a5lb; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V8k9J6g0Wz1yZJ for ; Wed, 3 Apr 2024 23:10:44 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DBB87883CC; Wed, 3 Apr 2024 14:08:11 +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="LT22a5lb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8C2E5883D2; Wed, 3 Apr 2024 14:08:11 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (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 725FC8839A for ; Wed, 3 Apr 2024 14:08:06 +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-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-56dfba6ae21so1405472a12.1 for ; Wed, 03 Apr 2024 05:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146086; x=1712750886; 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=2rIilUL3fPgdL00EeRjYvSoOr0+tfQS+h1cCC5JbimE=; b=LT22a5lb/5oD1bnMULOtUKfZzVZ0q01R83XjdDyJhkZc+H+OZ95qSlI9gALymrUFbU arWePJ9+My6TTWAGrPhAZkwPLNEvYWF5toF3AvxgZn1EYrt6mSjdXvpNFWOo+b2HamIm I/2iu7ScRV4/utc9eaKvPrPSonFeMg1BbAW7N7VTon7xHNiFoieu02l/JveuOlfiBU3C mUf1sAMXovy2SoZ+oM77uZ3EvFc9f24QsqbG/8zQnQq9BgMYCMnWOuFlgNV/jM5NzCJN LiThUl/A18bpSsuBiijDPskgJv9UUA7jnmPU5JwemEDYT5hAvPPnLDx0ONOuUkEon6PX 9XtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146086; x=1712750886; 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=2rIilUL3fPgdL00EeRjYvSoOr0+tfQS+h1cCC5JbimE=; b=q2cpvHI8ppukShdfdOMksXDojBX/5Nbrmf5TEgUhHI4RT2xBpB1o4ZuCslZGx/6PRP aLX5H/iO09u8Dx0K/N2pVy36ukdgkr/7uWIJkEXi0J3RbJS2gQJa+2y62HOrM7c8V8L9 MNTd/yJGNNk7LwvnG+V+j8rEmnyouSsAVoE1DVFlsocetk955hq6ZD17NGVJOIheBcFl JsaSskTg14QvPYEnXGkqGYx0qd4n1w9nFtJZe6oMDDh8z5c/IebPk+7/VQnFCon1bA5K rxr69MXuOmvYVd4mdffkUg8KEzlSvjXhauLHGi4DfEQkKCycQYVdelPqMrXIb6wtqdDR 1ZFg== X-Gm-Message-State: AOJu0YwvkNaXswKf6WOyFYG9sS+GufK7vRhgSqiJiBCGZAIogDtdIVY0 xp5DBYoXr60/0WgXiP362r09Fox7G0AW7pw9fWpHEMvqnJhHGxcybQ7YDsK2QeQ= X-Google-Smtp-Source: AGHT+IH//nvGIx2NsypSiF5nucxlrb+Qj6aUoJrpi62ois6iJCdGk3iDhVV4bpjhAnDEImQljR871g== X-Received: by 2002:a17:906:e086:b0:a4e:9a1a:e312 with SMTP id gh6-20020a170906e08600b00a4e9a1ae312mr1738155ejb.57.1712146086048; Wed, 03 Apr 2024 05:08:06 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:08:05 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:51 +0200 Subject: [PATCH v6 16/16] usb: gadget: UMS: fix 64-bit division on ARM32 MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-16-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de, Mattijs Korpershoek X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=2332; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=GILrVlJTLB7vGoUqwXYfiSFWeP5Fqv5LLGhQ18mVlh4=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaS/UZ3ATb1s4JU3qwNUdRjMg3ls3FbxVeRu oznn4aBsWmJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkgAKCRAFgzErGV9k tqHeD/9W1k82Ypg93K7ja/mXBrh31Lz9jFNXmGXQcMI/85VhfCyKcJD4d9poTWB3gKuEjcNk5uk sANbDuTJAbUIMrkVyF2j8vmpZHOTckDpyrBW/tu1RFtTGt/d03sW41kF0a7DLbmAMQf1v7iqYpt JiFsaURH3mCJn/7+fATHORobCVV7o2kQRU5vDGR5smGxGSjrCjnCRftsdL6aCFyGwcj46rD6Coy /Ag9WhR5+UQPeHEp7BMsA3LDLVm4eCCXZjeFCgL6dlQGujiJxuYm5tdxrJUF0WPS2OPgZzE3Mi4 dYTz1WcOiw4+q5DTUH2kfDADIQ1ViKb/2eS2CxrzdL3+mnV65OiOKCObtEBw6tZ7MoLN/HqZx5+ 1p3gKmURENsAyvx7ndOmc5W9HyiEG1j0EzyErJnsobrVQxH1YMOrIKnQjj3l6xZ82JjsdaYaLbC +SxAwwdjwpoGNn+sajFhsS1b6xeyNSNErideNm5iX/5WrdOGS1rN2dFr54KmKrrvJ8PpQw0cVfj X7eJe755PZkrhLGTG/fuLn8rlksxwrfveq5bkE2Em1aPxB8Y40isL9QllOJ2rtG5ssF/o3S0IHn jNtbfVAiptQ6QOQUnyuwVwPwhIoIV2jqCxS0I+KsxK3sALZX5+vkDd/gmw83ymQKUB7gUS30zpD agJ5Bav7l0fmemg== 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 The patch introducing support for dynamic sector sizes changed the types used in some divisions, resulting in the compiler attempting to use libgcc helpers (__aeabi_ldivmod). Replace these divisions with calls to lldiv() to handle this correctly. Fixes: 74e56e0c5065 ("usb: gadget: UMS: support multiple sector sizes") Signed-off-by: Caleb Connolly --- Cc: Mattijs Korpershoek --- drivers/usb/gadget/f_mass_storage.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index d880928044f4..ef90c7ec7fb5 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -239,8 +239,9 @@ /* #define VERBOSE_DEBUG */ /* #define DUMP_MSGS */ #include +#include #include #include #include #include @@ -768,10 +769,10 @@ static int do_read(struct fsg_common *common) } /* Perform the read */ rc = ums[common->lun].read_sector(&ums[common->lun], - file_offset / curlun->blksize, - amount / curlun->blksize, + lldiv(file_offset, curlun->blksize), + lldiv(amount, curlun->blksize), (char __user *)bh->buf); if (!rc) return -EIO; @@ -942,10 +943,10 @@ static int do_write(struct fsg_common *common) amount = bh->outreq->actual; /* Perform the write */ rc = ums[common->lun].write_sector(&ums[common->lun], - file_offset / curlun->blksize, - amount / curlun->blksize, + lldiv(file_offset, curlun->blksize), + lldiv(amount, curlun->blksize), (char __user *)bh->buf); if (!rc) return -EIO; nwritten = rc * curlun->blksize; @@ -1058,10 +1059,10 @@ static int do_verify(struct fsg_common *common) } /* Perform the read */ rc = ums[common->lun].read_sector(&ums[common->lun], - file_offset / curlun->blksize, - amount / curlun->blksize, + lldiv(file_offset, curlun->blksize), + lldiv(amount, curlun->blksize), (char __user *)bh->buf); if (!rc) return -EIO; nread = rc * curlun->blksize;