From patchwork Fri Jan 20 07:17:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 644615 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp638372pvb; Thu, 19 Jan 2023 23:20:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXsmDiTJceiikbdC4b67IFEygYJ9S+9fYIDuFWOTVWdouQWOjLm4TPpUM5Ys+RfILW5taKrd X-Received: by 2002:a05:6830:26d9:b0:684:cd04:6684 with SMTP id m25-20020a05683026d900b00684cd046684mr6234327otu.14.1674199215455; Thu, 19 Jan 2023 23:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674199215; cv=none; d=google.com; s=arc-20160816; b=PhIyIPNU36wrIrSa4rBxv9BAWh8cwnuNhvbHh2AI9WTGjoGZDcok2Yp8lrYQj6vo2z STwh4mICu0u2zSkeRf3OMiDvFHauZNlSKamqyhBKgbyESVLYytUwu1TGFyK/cYxhsVfx mD6RdF2H8J3/i9logKlA0ZsIgpgMdP6kp8RD6YvfgbXPT0dy3msL5/B6GwOzehCTfjMN rmXeKv3ib+dPE2kthEX375Nzm7YYLL8n5iGwgCWG0KV5eYnVpvh5bqdidXXlGHxm6g5D mzYiBACwDgyqrNMK574emAtyb02gNjeeqrHquOhVOG6JpkX4V9kbZhwUsJgFIeG7OMpd 3Big== 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=PfPCoj3SXxX8BeKajevQ8cFnAmbQjLo3kGosLmqaGTo=; b=s6055+pKh6rUFEWMupyUgk+EXowe9Km8yHMqEa8CmSChmuNQMnL6h4Usu0pp/9YUJ4 Ws4xE1ZAiF4GVFkJ5lkFwItZZo60U9rz3LbyjXqf6p7P21PS0WVKf1saTiTka6RsiqSW 7B9MHTRzIDY5ie0RM2AC9phpMjMWbymacLMwcFhHOEx8FYL3XYdxYFDh+p/V+OkeHb0J ih/uHb1B/KXM5aLIvmyh0WigXf+61ZdrJwpDvaK4Z2qpiVycUWK3+63cZBUsUih0sl0A MhytLuYDMWuNu9HIVgreZ+ZFptHLx4AEajCRhHYzs9861ROGfXRkcWVem/wPA33Bulx3 GVbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lmNOaBey; 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 s31-20020a0568302a9f00b00686506878ebsi9126674otu.218.2023.01.19.23.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 23:20:15 -0800 (PST) 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=lmNOaBey; 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 467E3856CD; Fri, 20 Jan 2023 08:18:48 +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="lmNOaBey"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B43685657; Fri, 20 Jan 2023 08:18:27 +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 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0: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 398E4856A0 for ; Fri, 20 Jan 2023 08:18:24 +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=sumit.garg@linaro.org Received: by mail-pf1-x42e.google.com with SMTP id i65so3362759pfc.0 for ; Thu, 19 Jan 2023 23:18:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=PfPCoj3SXxX8BeKajevQ8cFnAmbQjLo3kGosLmqaGTo=; b=lmNOaBeyW9pZ9nUHPUri/tegRJzzROqeeGEz6LtfEQRGH8+dmppgijSRboz96YQQjA v+4VjW7nnF6vQWBUhaMepXa1OJ586b9YRddbWL+urEeyvG+KJ/EFsb0z1BRBUEwaD8B6 IPSLw+VMohlHjJOwB4nU7PQFzIUmt2XPYlGWw7BBOYpCd0D0/VGQxtWmDwkneTiqJTtp FDUKhXZId9lAiAQx3cEyfPZ4e5uF0s9GNiqIMklI65/tm2lMS99RQpQ1M10m/dMqrjzK mYXIHIsh2ZCKtrn3+2CFbpinEmoy8YKgg2vzx/SpzHSyeTkzIW+uV3xmVVc+oMevPBB0 jY4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=PfPCoj3SXxX8BeKajevQ8cFnAmbQjLo3kGosLmqaGTo=; b=asd5JDgd8T4g7UOS0F3JVRr3BJJ0MmwnPBPRELZT2S1CZmvUt+AF2/ZbsrJV+rA0da lMmszlEU3XG2eZ43jRMlh2SZuRVbnb4hxamBTctFijBWwzuw2Fo52OJ86DDIbL3gWy6o d096AyYkH5/3u3PjPdwUSPNe0QDcnlRJiszTHgLIa9wNAZO82x8tINnfppT8tN2UiKX0 6EZJu22QdZvnmQCy1AMDg4baU81NyAqqnAuLCT/5GORMJm5JNLRiHFKfMzX/fWEDEbVl toVTVRfON2ZYPWASUE2YZo9ZrC+ZA84Ouyouk0pwwcM+dc3ijXh6eYfSyDKLlhqsCJ6u qPlQ== X-Gm-Message-State: AFqh2koxVcvH0uU7OsfRNDGppWZu0JRPNGtFrO1kT7ncGyUPX8rUs/KP iiQNpOLbXCiE1tQsuo5IPhipRb9+/O8DrJ/u X-Received: by 2002:aa7:8a45:0:b0:58d:924e:e5de with SMTP id n5-20020aa78a45000000b0058d924ee5demr14266445pfa.11.1674199102434; Thu, 19 Jan 2023 23:18:22 -0800 (PST) Received: from sumit-X1.. ([223.178.212.120]) by smtp.gmail.com with ESMTPSA id x15-20020aa7956f000000b0058bacd6c4e8sm9797586pfq.207.2023.01.19.23.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 23:18:22 -0800 (PST) From: Sumit Garg To: u-boot@lists.denx.de Cc: rfried.dev@gmail.com, hs@denx.de, joe.hershberger@ni.com, stephan@gerhold.net, mworsfold@impinj.com, lgillham@impinj.com, jbrennan@impinj.com, nicolas.dechesne@linaro.org, vinod.koul@linaro.org, daniel.thompson@linaro.org, Sumit Garg Subject: [PATCH 11/14] clocks: qcs404: Add support for I2C clocks Date: Fri, 20 Jan 2023 12:47:16 +0530 Message-Id: <20230120071719.623661-12-sumit.garg@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230120071719.623661-1-sumit.garg@linaro.org> References: <20230120071719.623661-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.6 at phobos.denx.de X-Virus-Status: Clean Co-developed-by: Mike Worsfold Signed-off-by: Mike Worsfold Signed-off-by: Sumit Garg --- arch/arm/mach-snapdragon/clock-qcs404.c | 58 +++++++++++++++++++ .../include/mach/sysmap-qcs404.h | 17 ++++++ 2 files changed, 75 insertions(+) diff --git a/arch/arm/mach-snapdragon/clock-qcs404.c b/arch/arm/mach-snapdragon/clock-qcs404.c index b8f5691aae..3357b54c30 100644 --- a/arch/arm/mach-snapdragon/clock-qcs404.c +++ b/arch/arm/mach-snapdragon/clock-qcs404.c @@ -81,6 +81,36 @@ static const struct bcr_regs emac_ptp_regs = { .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 */ +}; + ulong msm_set_rate(struct clk *clk, ulong rate) { struct msm_clk_priv *priv = dev_get_priv(clk->dev); @@ -171,6 +201,34 @@ int msm_enable(struct clk *clk) case GCC_ETH_AXI_CLK: clk_enable_cbc(priv->base + ETH_AXI_CBCR); break; + case GCC_BLSP1_AHB_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, + 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, + 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, + 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, + 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, + CFG_CLK_SRC_CXO); + break; default: return 0; } diff --git a/arch/arm/mach-snapdragon/include/mach/sysmap-qcs404.h b/arch/arm/mach-snapdragon/include/mach/sysmap-qcs404.h index 8920c4ee8f..5768fb1377 100644 --- a/arch/arm/mach-snapdragon/include/mach/sysmap-qcs404.h +++ b/arch/arm/mach-snapdragon/include/mach/sysmap-qcs404.h @@ -28,6 +28,23 @@ #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)