From patchwork Thu Feb 17 20:06:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 12750620 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69C8BC433F5 for ; Thu, 17 Feb 2022 20:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=mVo0yd34w8eXyDSpPIlHbT51MI69S/czDiGK6UdxAhY=; b=PCsSQgnuF+BAdl lpIhuTAHhxuBaOd8JgDC7QQ4z1bn8pJCrkd0xx5I4NVRHqQ+Ley6iE0lUrWdq2LUtkV244Bx66zkE 1Er+K8x6FOyQ0yhxxLl5MApIVp720fuYwbVSCavjWBvDToBDv9M0zrWvm4v+bja44l8YGG6XrF4lA ylutWrhra3FVZprEA/pawtjjBAruvNe+e8WFofGpUg91kLwGuWxEC2wtOix2wtl5nukMtiQzvCAAr SixxjTB3EzHi+Etv6zW7sbz0tbl0Wv6tWVk6jyTNJEnPO+Kwac4rFsVraiysMIf0MGIATD6D4tauz skvowGNXG6H77rVmIdwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKn2r-00BzpM-C3; Thu, 17 Feb 2022 20:06:29 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKn2o-00BzoF-Dg for linux-arm-kernel@lists.infradead.org; Thu, 17 Feb 2022 20:06:27 +0000 Received: by mail-lf1-x12a.google.com with SMTP id u20so1363401lff.2 for ; Thu, 17 Feb 2022 12:06:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+U20TDiI9vrXWGSFRa4Lg+MjXVh4ORPUTxC5hPPoqRY=; b=fgBkzxdeJezeTziXMC8DxQUk4rtG9UDMNHF0gj23J3G/GQKrM5s39KjyWrrI+c6JxQ o5dsO8/c/qfC0VBmls61cbamyge4ml71R60CjasjS4zOOk7OUat5WZzOdiD7FDv8Ixvu GJMxbumsw8SYWUvvBPR89D2xVZQgg8ZhuKXXuLumMbxuD25OoQ21qUNF2lvK8cH8egZp ZBbMsrKMFiuQWAXKskg+lqEPywyMXMrzzwhqm/uD8ymDOymDselGagUq0T64tTDoLNdf lQiqkWz7Kx5LApJCxDAsJT0pxNUZ1OHqhKtPFRtoiY/ClGTnqoUZKrN4z514+jD/R+8v 8R3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+U20TDiI9vrXWGSFRa4Lg+MjXVh4ORPUTxC5hPPoqRY=; b=5ChTEvOp5F9uCvjTXMydPfImHkMwn4+LoZjF4rqIBNeIwmNdpDT8pf49AIpeH+haQN esQHLIGAHVtabsH5oSL5BDwLzqBzISoXGNffPVVOyzOssh9kfzcMKaoG/DL7wLuk5FSL C6g4CqCMqJsetbysKK6IZ//6/4GXeUQ4s7TZR6s9CnQYfGTIVDFt4QfJtkdRjvVIVFmj hYfEiHoGAgF1L0NLGz79vJbtYaiZMEjrfYc7jd24uwoas/pjnQ2wkwhKpS4URdNg7sIq bIWqPKIMll9XKANOoofxRwbWTVudYY4wNaB4HvyHWO2WV/78GSOiE9m9EAD9LD+HwPe7 8ydA== X-Gm-Message-State: AOAM531A+m4TBmtqkdwiRM+mkNi+lCoC1zyF7XMrA1+M1qELS3Bn/BmO zDukSywoWdesO5dLX+DSKE8= X-Google-Smtp-Source: ABdhPJy68mgWekGRNL2Jy+ovOpm7OKzgfRnKLRLm5LUnja+UKV6dXx9crOg0qx6v1UgfnLWod7+OTw== X-Received: by 2002:a05:6512:46f:b0:443:77fa:f857 with SMTP id x15-20020a056512046f00b0044377faf857mr3167285lfd.140.1645128383744; Thu, 17 Feb 2022 12:06:23 -0800 (PST) Received: from dell.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id k9sm55768lfo.155.2022.02.17.12.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 12:06:23 -0800 (PST) From: Janusz Krzysztofik To: Tony Lindgren Cc: Paul Walmsley , Aaro Koskinen , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Janusz Krzysztofik Subject: [RFC RFT PATCH] ARM: OMAP1: clock: Fix early UART rate issues Date: Thu, 17 Feb 2022 21:06:06 +0100 Message-Id: <20220217200606.415391-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220217_120626_483040_63B19063 X-CRM114-Status: GOOD ( 14.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit ef772f2ee31e ("ARM: OMAP: Fix CONFIG_DEBUG_LL") was supposed to fix low level debugging, most possibly by early enabling UART clocks. The fix actually introduced early reset of most bits of MOD_CONF_CTRL_0 register, with the exception of UART1 and UART2 clock related bits which were set high. However, UART1 clock bit can play different roles on different OMAP1 variants. On OMAP1610 it enables the clock as intended, but on OMAP1510 it switches the clock rate from 12 to 48 MHz. Even worth, for UART2 the bit changes its clock rate also on OMAP1610. As a result, UART rates set by a bootloader can be unintentionally changed early on kernel boot and low level debugging broken, not fixed. Besides, reset of all other bits was not justified. Don't touch register bits not related to UART clocks. Also, don't touch the bit of UART2 clock. Make sure UART1 and UART3 are enabled early on relevant OMAP1610 machine types while preserving bootloader UART clock rates on others. Signed-off-by: Janusz Krzysztofik --- Tested only on OMAP1510 ams_delta. arch/arm/mach-omap1/clock_data.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index 3ebcd96efbff..7a7951a63bc2 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c @@ -767,11 +767,11 @@ int __init omap1_clk_init(void) u32 reg; #ifdef CONFIG_DEBUG_LL - /* - * Resets some clocks that may be left on from bootloader, - * but leaves serial clocks on. - */ - omap_writel(0x3 << 29, MOD_CONF_CTRL_0); + /* Make sure UART clocks are enabled early */ + if (cpu_is_omap16xx()) + omap_writel(omap_readl(MOD_CONF_CTRL_0) | + CONF_MOD_UART1_CLK_MODE_R | + CONF_MOD_UART3_CLK_MODE_R, MOD_CONF_CTRL_0); #endif /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */