Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3490209ybt; Tue, 23 Jun 2020 03:42:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrXvSNf2PUz/YtvjvnmzgXFpc3WdReyxIwLUOqnbrvrf31ciFyccGiogSR0mERyl9Tt0ao X-Received: by 2002:a17:906:7b54:: with SMTP id n20mr19308498ejo.144.1592908950283; Tue, 23 Jun 2020 03:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592908950; cv=none; d=google.com; s=arc-20160816; b=ISi6cmoLIWsDWByo0zFXcCi3r6kh0buFoiRth2vMaD5UAg830LisENLvCiuSb6Hs8d cBna/I5ZJCqUXhLuKxCdP+4bt7Jle59b7Ja5gop2C/K5XyCVqjxblKkKPCYk0K5wkCqS 4skY5mofsBhVBJ5RPLtmwEjclmD3mwWDbDLukYMm975Tlesgh8oFtsrx/mBGw5MjrZhL 99r7T3RwX8C09snUb+hfty0PR+f32dq/cePVKCfTQZMkxXRUP12N92XLrpkXHZcHSse9 f4ye0ckOtwkEg4mAIzhANZlG//Zp1oGwY/Ph0hSF7mwtW5JAsNUmjL/Tpz5szP63Tias uC9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=cMVA6XKobPYb2P5V4WDTE0sZ8KLU5FgijDwu8Cxplgs=; b=G8LhJMksreof9tve9PzOQuEjcBmy28bakyzDWRhFt7jvT0wyWvcjrY85fV8LppVzKz YnpBrA9vrSSsMGft6qnYJ+n+VTbeCD7C0lZLzbW6rOUn69cnoRwB9sOTpauazt9LAKK4 20UrQ/Nk6ghImqlgU3IcegM0dhpyox9PykAw7T/Hf1KEnAJaLK0qB1IgnkNiNBhVrgYj fT5uEtuN/mPDUxxPVvUyo9HWpNDd84yUIdevisspNrYXPYKXUDBbdGUdrA5ECW+HivYU v+KV+QeTr4ILm8FoDtcxP3ScXdnvvkHdYl7KAkPtPp3kaC13f1fA/ICtVjd+5XvWNUqt BlTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=PMz+y4t2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx10si9767800ejb.74.2020.06.23.03.42.07; Tue, 23 Jun 2020 03:42:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=PMz+y4t2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732383AbgFWKkD (ORCPT + 99 others); Tue, 23 Jun 2020 06:40:03 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:39924 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732338AbgFWKkA (ORCPT ); Tue, 23 Jun 2020 06:40:00 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1592908799; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=cMVA6XKobPYb2P5V4WDTE0sZ8KLU5FgijDwu8Cxplgs=; b=PMz+y4t2nSqGpW1gwIZpPi+lIsjvrYuQFixEUfxoK6k+86dcxDNZJrY1++A4WI2lRsaISZuO qQCNxotN4bJ2IbLeOSS+qYtGT+unUfC5BoQ0j8jsXbsn0JFc3SkkUzOmoy02eqGkN4+2dsGW +9IH9RTBebCQKZIFPRITG8j8E/Q= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n15.prod.us-east-1.postgun.com with SMTP id 5ef1dbe2356bcc26ab454ce6 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 23 Jun 2020 10:39:30 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id DD56EC433CB; Tue, 23 Jun 2020 10:39:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from akashast-linux.qualcomm.com (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: akashast) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8A84EC43395; Tue, 23 Jun 2020 10:39:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8A84EC43395 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=akashast@codeaurora.org From: Akash Asthana To: gregkh@linuxfoundation.org, agross@kernel.org, bjorn.andersson@linaro.org, wsa@the-dreams.de, broonie@kernel.org Cc: linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, devicetree@vger.kernel.org, swboyd@chromium.org, mgautam@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, mka@chromium.org, dianders@chromium.org, evgreen@codeaurora.org, linux-kernel@vger.kernel.org, Akash Asthana Subject: [PATCH V8 3/8] i2c: i2c-qcom-geni: Add interconnect support Date: Tue, 23 Jun 2020 16:08:52 +0530 Message-Id: <1592908737-7068-4-git-send-email-akashast@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592908737-7068-1-git-send-email-akashast@codeaurora.org> References: <1592908737-7068-1-git-send-email-akashast@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Get the interconnect paths for I2C based Serial Engine device and vote according to the bus speed of the driver. Signed-off-by: Akash Asthana Reviewed-by: Matthias Kaehlcke Acked-by: Wolfram Sang --- Changes in V2: - As per Bjorn's comment, removed se == NULL check from geni_i2c_icc_get - As per Bjorn's comment, removed code to set se->icc_path* to NULL in failure - As per Bjorn's comment, introduced and using devm_of_icc_get API for getting path handle - As per Matthias comment, added error handling for icc_set_bw call Changes in V3: - As per Matthias comment, use common library APIs defined in geni-se driver for ICC functionality. Changes in V4: - Move peak_bw guess as twice of avg_bw if nothing mentioned explicitly to ICC core. Changes in V5: - Use icc_enable/disable in power on/off call. Changes in V6: - No changes Changes in V7: - As per Matthias's comment removed usage of peak_bw variable because we don't have explicit peak requirement, we were voting peak = avg and this can be tracked using single variable for avg bw. Changes in V8: - No change. drivers/i2c/busses/i2c-qcom-geni.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 18d1e4f..32b2a99 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -557,6 +557,22 @@ static int geni_i2c_probe(struct platform_device *pdev) gi2c->adap.dev.of_node = dev->of_node; strlcpy(gi2c->adap.name, "Geni-I2C", sizeof(gi2c->adap.name)); + ret = geni_icc_get(&gi2c->se, "qup-memory"); + if (ret) + return ret; + /* + * Set the bus quota for core and cpu to a reasonable value for + * register access. + * Set quota for DDR based on bus speed. + */ + gi2c->se.icc_paths[GENI_TO_CORE].avg_bw = GENI_DEFAULT_BW; + gi2c->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW; + gi2c->se.icc_paths[GENI_TO_DDR].avg_bw = Bps_to_icc(gi2c->clk_freq_out); + + ret = geni_icc_set_bw(&gi2c->se); + if (ret) + return ret; + ret = geni_se_resources_on(&gi2c->se); if (ret) { dev_err(dev, "Error turning on resources %d\n", ret); @@ -579,6 +595,10 @@ static int geni_i2c_probe(struct platform_device *pdev) return ret; } + ret = geni_icc_disable(&gi2c->se); + if (ret) + return ret; + dev_dbg(dev, "i2c fifo/se-dma mode. fifo depth:%d\n", tx_depth); gi2c->suspended = 1; @@ -623,7 +643,7 @@ static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev) gi2c->suspended = 1; } - return 0; + return geni_icc_disable(&gi2c->se); } static int __maybe_unused geni_i2c_runtime_resume(struct device *dev) @@ -631,6 +651,10 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev) int ret; struct geni_i2c_dev *gi2c = dev_get_drvdata(dev); + ret = geni_icc_enable(&gi2c->se); + if (ret) + return ret; + ret = geni_se_resources_on(&gi2c->se); if (ret) return ret; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project