From patchwork Thu May 10 16:13:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Austin Christ X-Patchwork-Id: 10392051 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5490760236 for ; Thu, 10 May 2018 16:15:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41FB728C0B for ; Thu, 10 May 2018 16:15:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4067527F7F; Thu, 10 May 2018 16:15:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B3B128C76 for ; Thu, 10 May 2018 16:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966447AbeEJQOL (ORCPT ); Thu, 10 May 2018 12:14:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:56108 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966443AbeEJQOJ (ORCPT ); Thu, 10 May 2018 12:14:09 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EBFB760C67; Thu, 10 May 2018 16:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525968848; bh=9zeOlLR6S6+XyzWKHZuvSnpFHFsrbXOSHi3WmjWyETo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqIAwmhFY2lnD4BcWaYgGWYn4TgWuNYs0myjIBbg6vnI0POvPhA/0rFRlSjegchcE RLi7hBIulC2cTo6Lwu+am4UqbFS/U/ScTmCGoBlVFmA6V9gZ/uRuIL6L7j1XpgS9kO aIpoBuEISNi4EjIgnnGe1BdAMG5N8mvH6S4gHWsg= Received: from austinwc-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: austinwc@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B9D2760881; Thu, 10 May 2018 16:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525968848; bh=9zeOlLR6S6+XyzWKHZuvSnpFHFsrbXOSHi3WmjWyETo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqIAwmhFY2lnD4BcWaYgGWYn4TgWuNYs0myjIBbg6vnI0POvPhA/0rFRlSjegchcE RLi7hBIulC2cTo6Lwu+am4UqbFS/U/ScTmCGoBlVFmA6V9gZ/uRuIL6L7j1XpgS9kO aIpoBuEISNi4EjIgnnGe1BdAMG5N8mvH6S4gHWsg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B9D2760881 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=austinwc@codeaurora.org From: Austin Christ To: wsa@the-dreams.de, linux-i2c@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, sricharan@codeaurora.org, timur@codeaurora.org, rruigrok@codeaurora.org, andy.gross@linaro.org, david.brown@linaro.org, Austin Christ Subject: [PATCH v3 4/4] i2c: qup: Add command-line parameter to override SCL frequency Date: Thu, 10 May 2018 10:13:57 -0600 Message-Id: <1525968837-13381-5-git-send-email-austinwc@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525968837-13381-1-git-send-email-austinwc@codeaurora.org> References: <1525968837-13381-1-git-send-email-austinwc@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a module parameter to override SCL frequency provided by firmware. This can be useful when testing spec compliance for I2C modes or when debugging issues across multiple operating frequencies. Signed-off-by: Austin Christ Reviewed-by: Sricharan R Reviewed-by: Andy Gross --- v1: - Initial v2: - No changes v3: - No changes --- drivers/i2c/busses/i2c-qup.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index f87f29f..da4cc57 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -155,6 +155,10 @@ /* TAG length for DATA READ in RX FIFO */ #define READ_RX_TAGS_LEN 2 +static unsigned int scl_freq; +module_param_named(scl_freq, scl_freq, uint, 0444); +MODULE_PARM_DESC(scl_freq, "SCL frequency override"); + /* * count: no of blocks * pos: current block number @@ -1682,11 +1686,16 @@ static int qup_i2c_probe(struct platform_device *pdev) init_completion(&qup->xfer); platform_set_drvdata(pdev, qup); - ret = device_property_read_u32(qup->dev, "clock-frequency", &clk_freq); - if (ret) { - dev_notice(qup->dev, "using default clock-frequency %d", - DEFAULT_CLK_FREQ); - } + if (scl_freq) { + dev_notice(qup->dev, "Using override frequency of %u\n", scl_freq); + clk_freq = scl_freq; + } else { + ret = device_property_read_u32(qup->dev, "clock-frequency", &clk_freq); + if (ret) { + dev_notice(qup->dev, "using default clock-frequency %d", + DEFAULT_CLK_FREQ); + } + } if (of_device_is_compatible(pdev->dev.of_node, "qcom,i2c-qup-v1.1.1")) { qup->adap.algo = &qup_i2c_algo;