From patchwork Thu Feb 15 20:52:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 773011 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp1035404wre; Thu, 15 Feb 2024 12:55:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVDp0qaVEcZMo7234dvpA7SyDc7CUNt9XC0nV+5hIJldSZda7GbxlB6eavlQ82E0BGQWtxrJhOEE+y8Kz+Tmaxo X-Google-Smtp-Source: AGHT+IFeufmR6QDZYjwzk1ugI0SaNTe+FKxrLJugNvWHMntKFlJ0Jp+hpvnOrn3KWGmiu9/Kly1z X-Received: by 2002:a50:ee89:0:b0:561:f4e1:8424 with SMTP id f9-20020a50ee89000000b00561f4e18424mr1889587edr.42.1708030515952; Thu, 15 Feb 2024 12:55:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708030515; cv=none; d=google.com; s=arc-20160816; b=vMr7b6EhJup3UMMwhqKQSlg87fSCM7/xDPac+kHQ9Eh+dfu/NVcVt7e5dR7rcF1i12 V8zOow0eX7JEiSi4QjIANn38P2LqWSc30Cuk0cL4i9T3upWXJvBzHOHnQevKXTZAqKMe //Lpybd0JTQfDNX6aBZJZNuvqs74/a4EdQKcAtFzfOkolBnaWEsNsNM+CBsUAne9+wiC 9V/VuRDiw/3py1RvRkRtRggGKmdzK0lb3L6nrZ5EcgdkZ/yrcfBQAwEQSo92frOuv8WO DOpsHiwwm7O4FCNaalVeHtuWFLc/vlYpHceCB4Y7Ab2QC6lzKpdWLr19JPotjkoOA9Mr LEKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=l6WYKOqLvYvzDXJxb1X9H2+sNPvmQE+2eGLcWk7k/oY=; fh=psWp6ImfxkhuzT//rmK327oklq6dJh9j7F46VKwW7es=; b=MF4E//MkmTesw6UMMQDgfQs2VIS+HErL80IirMKjROx6Rh40PYfSjAy2sraWWbAIA/ F5vcWrFyYpCj0DKFN5uEYVg/WhKrdJB0LNUtY0jRvrBkemryA5vEfAwlDiBo2gIuTeet uINXshXuc4KvTv3kXWmzzyggz3G7yGVA6EM6XGVrfSEQGI3ia0OAxL2d1ks4WTYKi8jf RPu7uT0tk3CVBTtOs74tS1m/HphF/Y8h34F9EYWvmXapbPeK/QQEh6MQG5FrsViTf85K N5GvlvCTl8jTpspwzRs0br0HDiaFPPs/Ie28Hcq8EsX6gT/UnykKJNZB0XeAdmmgCroK 3gmg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fgZbJ8yv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id f21-20020a50a6d5000000b00563e5c0848bsi54933edc.160.2024.02.15.12.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 12:55:15 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fgZbJ8yv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7E63287F4E; Thu, 15 Feb 2024 21:53:09 +0100 (CET) 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="fgZbJ8yv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D38687F3D; Thu, 15 Feb 2024 21:53:07 +0100 (CET) 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, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (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 4F7B487E01 for ; Thu, 15 Feb 2024 21:52:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33d118a181fso398530f8f.1 for ; Thu, 15 Feb 2024 12:52:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708030353; x=1708635153; 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=l6WYKOqLvYvzDXJxb1X9H2+sNPvmQE+2eGLcWk7k/oY=; b=fgZbJ8yvIr4V/6tZXn/lvCBulZJjbyiHLlTfNaxGaSEahmm3J9kt606+BL2FgNoWmM Icg1QLujKWhxuFHqUerVZtlgwpPewrJlMBWjMl1iK3+eqGTvR7IUOcE+L0+X5UOjjQYh ihvPO3d7uTsFio3gD1GJldjT0d6k476oPx17WbN7t2yGZC9eQ7zgCSxydar+tva8k3Dv Y+8d1wdYaOwW+ZG4+85zT2omLcR2o1w4xAH9sYOi96NovYgZpceQ4vcPSw5kwkXHpa7E VD4eQCfEfqScRH97b7q9Vx3HR7yI+VscohGascISbQPNjShnlhjsKmY7tndj+sfubbHV ScJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708030353; x=1708635153; 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=l6WYKOqLvYvzDXJxb1X9H2+sNPvmQE+2eGLcWk7k/oY=; b=v0a4o+GgZUXEjCWNl2C0ZjpGitaK+hzqz+Z12vIKOpSqtZXA/cNFEHq8s4Hcu2xaeh Lvs51T4bp248snIi6hkF+EZvSsHz68iLFUS9CdmxLoXIPRv+OASi1EwYdKJPkh7e8Yua ha8QZZ0zmwfwEry/7/eo5fJlIA/3R+2TkDSwB1Noal99VlN8wpnaz12l7vOmBUh9kAcy hc2dNwJcnmXSKpgQLJKHGAajRowLl1HJrBOf3/yXluRVF/QT50R0aOKp4CsNYkf5DDaJ /+C/wx8RuoiOQ4DgLquhNI5+AKSGtQBRDtTw/zaS58zXg84f5evSmhemdY1xqKmAdUx7 ONPw== X-Forwarded-Encrypted: i=1; AJvYcCX4JLvHrOmgxu3mpmU/d0JCbOLcuP+YgF/AhgGLtO3M5zROd2rn4P20YtC1aP9zzjJwtogniqa9Yyz50qknNPWCt7CpPw== X-Gm-Message-State: AOJu0YyIH7k9yjn833CIc6ZUsFHgTEssPvLtgY0K8sm2wd5sU26CPESW fKvsucQbLmLTXq6l63KjkzsMfBZCycM3Vbm+qRD6P0o/xk0ZiOSNTaVp2/o3aSd4CjVMNmpWCYt D X-Received: by 2002:adf:f6c4:0:b0:33b:37f5:f41d with SMTP id y4-20020adff6c4000000b0033b37f5f41dmr1850063wrp.70.1708030353351; Thu, 15 Feb 2024 12:52:33 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id e4-20020adfe384000000b0033cfa00e497sm194025wrm.64.2024.02.15.12.52.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 12:52:32 -0800 (PST) From: Caleb Connolly Date: Thu, 15 Feb 2024 20:52:26 +0000 Subject: [PATCH v4 08/39] serial: msm: fix clock handling and pinctrl MIME-Version: 1.0 Message-Id: <20240215-b4-qcom-common-target-v4-8-ed06355c634a@linaro.org> References: <20240215-b4-qcom-common-target-v4-0-ed06355c634a@linaro.org> In-Reply-To: <20240215-b4-qcom-common-target-v4-0-ed06355c634a@linaro.org> To: Neil Armstrong , Sumit Garg , Ramon Fried , Dzmitry Sankouski , Caleb Connolly , Peng Fan , Jaehoon Chung , Rayagonda Kokatanur , Lukasz Majewski , Sean Anderson , Jorge Ramirez-Ortiz , Stephan Gerhold Cc: Marek Vasut , u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=2971; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=vwwKNPE/rCfeopqHAkTWDML+TXlzX81EnHEcDPZPvhM=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRzlS2lRfbMv641bcn6c5Ejsu23tKGHjp+lgeoW6cydV hM/P2fpKGVhEORgkBVTZBE/scyyae1le43tCy7AzGFlAhnCwMUpABP5vpDhD7cRqwfT8017Pl5d f+oBxxLR5ppLh3Zlc7ebtS1efvfKSx6Gfwp+G0/of7wbw6NzTZR5QVvLRLfojK3pAuUNyz9sCPD V+wsA 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 Use the modern helpers to fetch the clock and use the correct property ("clocks" instead of "clock"). Drop the call to pinctrl_select_state() as no boards have a "uart" pinctrl state and this prints confusing errors. Signed-off-by: Caleb Connolly Reviewed-by: Neil Armstrong Reviewed-by: Sumit Garg --- arch/arm/dts/dragonboard410c.dts | 3 ++- arch/arm/dts/dragonboard820c.dts | 3 ++- drivers/serial/serial_msm.c | 25 +++++-------------------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts index 02c824d0226c..c395e6cc0427 100644 --- a/arch/arm/dts/dragonboard410c.dts +++ b/arch/arm/dts/dragonboard410c.dts @@ -84,7 +84,8 @@ serial@78b0000 { compatible = "qcom,msm-uartdm-v1.4"; reg = <0x78b0000 0x200>; - clock = <&clkc 4>; + clocks = <&clkc 4>; + clock-names = "core"; pinctrl-names = "uart"; pinctrl-0 = <&blsp1_uart>; }; diff --git a/arch/arm/dts/dragonboard820c.dts b/arch/arm/dts/dragonboard820c.dts index 146a0af8aafe..86b7f83d36d6 100644 --- a/arch/arm/dts/dragonboard820c.dts +++ b/arch/arm/dts/dragonboard820c.dts @@ -78,7 +78,8 @@ blsp2_uart2: serial@75b0000 { compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg = <0x75b0000 0x1000>; - clock = <&gcc 4>; + clocks = <&gcc 4>; + clock-names = "core"; pinctrl-names = "uart"; pinctrl-0 = <&blsp8_uart>; }; diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index 44b93bd7ff21..ac4280c6c4c2 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -160,29 +160,14 @@ static int msm_uart_clk_init(struct udevice *dev) { uint clk_rate = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev), "clock-frequency", 115200); - uint clkd[2]; /* clk_id and clk_no */ - int clk_offset; - struct udevice *clk_dev; struct clk clk; int ret; - ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "clock", - clkd, 2); - if (ret) - return ret; - - clk_offset = fdt_node_offset_by_phandle(gd->fdt_blob, clkd[0]); - if (clk_offset < 0) - return clk_offset; - - ret = uclass_get_device_by_of_offset(UCLASS_CLK, clk_offset, &clk_dev); - if (ret) - return ret; - - clk.id = clkd[1]; - ret = clk_request(clk_dev, &clk); - if (ret < 0) + ret = clk_get_by_name(dev, "core", &clk); + if (ret < 0) { + pr_warn("%s: Failed to get clock: %d\n", __func__, ret); return ret; + } ret = clk_set_rate(&clk, clk_rate); if (ret < 0) @@ -218,7 +203,6 @@ static int msm_serial_probe(struct udevice *dev) if (ret) return ret; - pinctrl_select_state(dev, "uart"); uart_dm_init(priv); return 0; @@ -251,6 +235,7 @@ U_BOOT_DRIVER(serial_msm) = { .priv_auto = sizeof(struct msm_serial_data), .probe = msm_serial_probe, .ops = &msm_serial_ops, + .flags = DM_FLAG_PRE_RELOC, }; #ifdef CONFIG_DEBUG_UART_MSM