From patchwork Fri Apr 5 09:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 786206 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp67499wrw; Fri, 5 Apr 2024 02:08:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVxap7vGrZOFhETzF1ZXUIya07msBFaQYmgzOwp3YPU+lyBTFxN5tw7ejcEJyDzkFzv36Qm6tIhqnjJ/eC57vMW X-Google-Smtp-Source: AGHT+IEWZbwpeoNEjtEK/sUSDOQwSAcDZUvVZQJlzTYGdn6+UJZpoc6Hoee8BwCrH2zsvuJ4eLpP X-Received: by 2002:a17:906:6a1a:b0:a4e:4278:8a01 with SMTP id qw26-20020a1709066a1a00b00a4e42788a01mr768687ejc.11.1712308123996; Fri, 05 Apr 2024 02:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712308123; cv=none; d=google.com; s=arc-20160816; b=LSuFmQNV+E4zSaOWpaSA2/Kpn9mRP0OXbA2gi/IxYmMMhmR/GZTT4rP6hJAYnYzssS aJGGmDSF++a71yL39WKoX1mqV9BpmP6JMU+et3iA7IKzWCFRO7e9GCJC8vm+oOVcTql1 7jKqxviswrmPZOjJF0TRNqDIoNUTHcjBp3gJ1WxfnoO4osdBQl/O8t7NzWtiQby0q46i FIDihsrM+NKD2BEbcV4lEabInZ9lpq1ncl2U501uznStElT3VjRN3Z1/5MV1NLIcr1aE m9/pf523VW6OqgFGLsYT63l1yCm8MDmDuY6Kl1cmIjz9kGEmWzNeTwyygBFH9bGm9Uz9 7/dA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W5mdOOExPAXMAEe+Bx+qErpp9/cMTqsnWS0nVCzdeW8=; fh=T5H15yVH0x76eljP78R1SA5aX1AOqAQ+w8cgext4uuk=; b=nfTCa5fWdVdn0OLY9WBD2Fhk75McNVYQ9bNuE4thXM+XQO9G2CpplzD/vRqz0kq371 I9A3jc0PAqf5OWV4Ii+jUknFVPqpZu+v1cAacjc5B7FuMojUSnnh47A4SwJ6Rm2dUGbF kJjNnGSRfOOiyyHK5xGbiq01lyieYWvSqPpwH+CWQEgxT4rypRgu7Mhs4skxUtT6Fagk 7qtdtdAv1m7CerVJEVaeo9W74UEi42MF0GiBoFeDAZt96fo8bBL8Yyk3soOcooQJXOkt LU0X5MazOuG3qiu7hrP9tIV47ZzGnUqQIcKcwl+n9bj7fkkrgjLv93eRnEm7ZIUZVdyj bI7g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CrJEkROb; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id r21-20020a170906365500b00a4df2eb3828si539079ejb.86.2024.04.05.02.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 02:08:43 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CrJEkROb; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E7E0E884F2; Fri, 5 Apr 2024 11:08:39 +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="CrJEkROb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B02ED884CA; Fri, 5 Apr 2024 11:08:38 +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-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (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 83EF0884E6 for ; Fri, 5 Apr 2024 11:08:36 +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=sumit.garg@linaro.org Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1dff837d674so16835035ad.3 for ; Fri, 05 Apr 2024 02:08:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712308115; x=1712912915; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W5mdOOExPAXMAEe+Bx+qErpp9/cMTqsnWS0nVCzdeW8=; b=CrJEkRObKUcMZh0zkJTMHukH6TIhLIgObPwvbdOGUZRB9VGBsG6gHERW474SzcNVQX ECJSaV+VGtdP+skDOSEkuI0x6r6EIHHIKF88C3JnYXk7EADpZVm+zVsb9bh/t2j554Fz x2N7L+pPtBLconGyw4sSc2PdwBwVpadfCmKssbNU86eRz6YWHU7wdo960wQM0ceK8yqy fR4+NhxoDY55zaZyMa4QtPOCJZVuMv34hxrkvoIfYxgT+yXg70IvmhiHFtT9mQDyoVlq Ej+IDpgkHY90yDB0smx+EB7BdmiMHpE0T8DjOzh5DBIUT2mIz9iHD78VaG+6//SUcfr+ yJnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712308115; x=1712912915; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W5mdOOExPAXMAEe+Bx+qErpp9/cMTqsnWS0nVCzdeW8=; b=qsXnZC2YOKKk9emofbdmGln3uvW43P6OOrtBStAxi9bTtmWn7toOPCgmxfIH91Q7UW XOfpBkSxBXPEZoL1UpPxhGziIbswAM0kTXQOTJmED1cuHc1Q5hjKvCSVdFfXTnencb6o 8UzldWU58KTWdqhsyKu3TZjhx/92SqTAnp9AGu9+z0BjZDBQ63A02w1g9GdYYejn4Jbv W0XyByPnjz/SLvAV+mbZCliO83GDJWrUavGdHWBQ8+dOIU2nyZt0t1VkFLR/u52BN1Qt FcM8eLBIVHH47UhJZNu48s0wRn5Ql68ppVUN1F9w63NwhF8dciBYfFXH1dN/3D7cqQiw 8Zuw== X-Gm-Message-State: AOJu0Yx5mddO+1xptZIQrWpIfk2TFFtuEcda2CIw+Xd4lYCOE2fXZNYB I3MJNGjN/f2dnIgFOZ240r5HhupvEOlq37FmtsN+X6ph9BUN4q/Ul3geWyPPlufpEDTnJ74Lw8n U X-Received: by 2002:a17:903:1252:b0:1e2:8d7f:10ad with SMTP id u18-20020a170903125200b001e28d7f10admr967879plh.1.1712308114786; Fri, 05 Apr 2024 02:08:34 -0700 (PDT) Received: from sumit-X1.. ([223.178.208.62]) by smtp.gmail.com with ESMTPSA id k9-20020a170902c40900b001e2c0b77b53sm1055959plk.255.2024.04.05.02.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 02:08:34 -0700 (PDT) From: Sumit Garg To: u-boot@lists.denx.de Cc: caleb.connolly@linaro.org, neil.armstrong@linaro.org, trini@konsulko.com, lukma@denx.de, seanga2@gmail.com, sjg@chromium.org, laetitia.mariottini@se.com, pascal.eberhard@se.com, abdou.saker@se.com, jimmy.lalande@se.com, benjamin.missey@non.se.com, daniel.thompson@linaro.org, stephan@gerhold.net, Sumit Garg Subject: [PATCH v3 2/6] apq8016: Add support for UART1 clocks and pinmux Date: Fri, 5 Apr 2024 14:37:38 +0530 Message-Id: <20240405090742.4148304-3-sumit.garg@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240405090742.4148304-1-sumit.garg@linaro.org> References: <20240405090742.4148304-1-sumit.garg@linaro.org> MIME-Version: 1.0 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 SE HMIBSC board uses UART1 as the main debug console, so add corresponding clocks and pinmux support. Along with that update instructions to enable clocks for debug UART support. Signed-off-by: Sumit Garg Reviewed-by: Caleb Connolly --- drivers/clk/qcom/clock-apq8016.c | 38 ++++++++++++++++++-------- drivers/pinctrl/qcom/pinctrl-apq8016.c | 1 + drivers/serial/serial_msm.c | 11 ++++++-- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/drivers/clk/qcom/clock-apq8016.c b/drivers/clk/qcom/clock-apq8016.c index 5a5868169c8..9556b94774a 100644 --- a/drivers/clk/qcom/clock-apq8016.c +++ b/drivers/clk/qcom/clock-apq8016.c @@ -31,7 +31,8 @@ #define BLSP1_AHB_CBCR 0x1008 /* Uart clock control registers */ -#define BLSP1_UART2_BCR (0x3028) +#define BLSP1_UART1_APPS_CBCR (0x203C) +#define BLSP1_UART1_APPS_CMD_RCGR (0x2044) #define BLSP1_UART2_APPS_CBCR (0x302C) #define BLSP1_UART2_APPS_CMD_RCGR (0x3034) @@ -52,7 +53,7 @@ static struct vote_clk gcc_blsp1_ahb_clk = { }; /* SDHCI */ -static int clk_init_sdc(struct msm_clk_priv *priv, int slot, uint rate) +static int apq8016_clk_init_sdc(struct msm_clk_priv *priv, int slot, uint rate) { int div = 15; /* 100MHz default */ @@ -70,20 +71,35 @@ static int clk_init_sdc(struct msm_clk_priv *priv, int slot, uint rate) } /* UART: 115200 */ -int apq8016_clk_init_uart(phys_addr_t base) +int apq8016_clk_init_uart(phys_addr_t base, unsigned long id) { + u32 cmd_rcgr, apps_cbcr; + + switch (id) { + case GCC_BLSP1_UART1_APPS_CLK: + cmd_rcgr = BLSP1_UART1_APPS_CMD_RCGR; + apps_cbcr = BLSP1_UART1_APPS_CBCR; + break; + case GCC_BLSP1_UART2_APPS_CLK: + cmd_rcgr = BLSP1_UART2_APPS_CMD_RCGR; + apps_cbcr = BLSP1_UART2_APPS_CBCR; + break; + default: + return 0; + } + /* Enable AHB clock */ clk_enable_vote_clk(base, &gcc_blsp1_ahb_clk); /* 7372800 uart block clock @ GPLL0 */ - clk_rcg_set_rate_mnd(base, BLSP1_UART2_APPS_CMD_RCGR, 1, 144, 15625, - CFG_CLK_SRC_GPLL0, 16); + clk_rcg_set_rate_mnd(base, cmd_rcgr, 1, 144, 15625, CFG_CLK_SRC_GPLL0, + 16); /* Vote for gpll0 clock */ clk_enable_gpll0(base, &gpll0_vote_clk); /* Enable core clk */ - clk_enable_cbc(base + BLSP1_UART2_APPS_CBCR); + clk_enable_cbc(base + apps_cbcr); return 0; } @@ -94,14 +110,12 @@ static ulong apq8016_clk_set_rate(struct clk *clk, ulong rate) switch (clk->id) { case GCC_SDCC1_APPS_CLK: /* SDC1 */ - return clk_init_sdc(priv, 0, rate); - break; + return apq8016_clk_init_sdc(priv, 0, rate); case GCC_SDCC2_APPS_CLK: /* SDC2 */ - return clk_init_sdc(priv, 1, rate); - break; + return apq8016_clk_init_sdc(priv, 1, rate); + case GCC_BLSP1_UART1_APPS_CLK: /* UART1 */ case GCC_BLSP1_UART2_APPS_CLK: /* UART2 */ - return apq8016_clk_init_uart(priv->base); - break; + return apq8016_clk_init_uart(priv->base, clk->id); default: return 0; } diff --git a/drivers/pinctrl/qcom/pinctrl-apq8016.c b/drivers/pinctrl/qcom/pinctrl-apq8016.c index a9a00f4b081..1ee8b7db1a2 100644 --- a/drivers/pinctrl/qcom/pinctrl-apq8016.c +++ b/drivers/pinctrl/qcom/pinctrl-apq8016.c @@ -29,6 +29,7 @@ static const char * const msm_pinctrl_pins[] = { }; static const struct pinctrl_function msm_pinctrl_functions[] = { + {"blsp_uart1", 2}, {"blsp_uart2", 2}, }; diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index ac4280c6c4c..4de10e75191 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -248,12 +248,17 @@ static struct msm_serial_data init_serial_data = { #include /* Uncomment to turn on UART clocks when debugging U-Boot as aboot on MSM8916 */ -//int apq8016_clk_init_uart(phys_addr_t gcc_base); +//int apq8016_clk_init_uart(phys_addr_t gcc_base, unsigned long id); static inline void _debug_uart_init(void) { - /* Uncomment to turn on UART clocks when debugging U-Boot as aboot on MSM8916 */ - //apq8016_clk_init_uart(0x1800000); + /* + * Uncomment to turn on UART clocks when debugging U-Boot as aboot + * on MSM8916. Supported debug UART clock IDs: + * - db410c: GCC_BLSP1_UART2_APPS_CLK + * - HMIBSC: GCC_BLSP1_UART1_APPS_CLK + */ + //apq8016_clk_init_uart(0x1800000, ); uart_dm_init(&init_serial_data); }