From patchwork Tue Apr 24 21:21:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Austin Christ X-Patchwork-Id: 10361099 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 320F9602D6 for ; Tue, 24 Apr 2018 21:21:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22C8828A3D for ; Tue, 24 Apr 2018 21:21:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17A6728D24; Tue, 24 Apr 2018 21:21:37 +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 9E38828A3D for ; Tue, 24 Apr 2018 21:21:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751233AbeDXVVf (ORCPT ); Tue, 24 Apr 2018 17:21:35 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51012 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbeDXVVe (ORCPT ); Tue, 24 Apr 2018 17:21:34 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1C4B7607E5; Tue, 24 Apr 2018 21:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524604894; bh=AZfK/OFspuH452rVYj1sTC7bUHsdVtLdUckHzr0q9ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dL4ver2JzP5LzVei9BUeTjmb9FCMMiDhu0oKX2pceWgTVTPNtxDKD61rRWBzylIVz k37MZ1H+S//ezuNGg9vIV10bfwEmmPH4+WF5IzVl+TZF+3PVlM3BBePTI5TlXE5n1Y YaxgvBJxIgSPD9FjTFZr186qNJwnftTni1BVjMLQ= 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 1930460F6B; Tue, 24 Apr 2018 21:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524604893; bh=AZfK/OFspuH452rVYj1sTC7bUHsdVtLdUckHzr0q9ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AVciapKuZPkmOQQC7n14qB/3ycfmtN6gLp/eMuHHI0DejV5xLMqgYWjBhOUaSHRJ5 t5eQkO93lO49CS0LNifDz4VzeYckksp9HIOy/hPZITiURzOVTNobuvBQG7+TxlpqFG tVt23JyLL0wDjtdFdbxwsNpCiq15AdHBKWGoEDIk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1930460F6B 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, rruigrok@codeaurora.org, timur@codeaurora.org, sricharan@codeaurora.org, Austin Christ Subject: [PATCH 4/4] i2c: qup: Add command-line parameter to override SCL frequency Date: Tue, 24 Apr 2018 15:21:22 -0600 Message-Id: <1524604882-25377-5-git-send-email-austinwc@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524604882-25377-1-git-send-email-austinwc@codeaurora.org> References: <1524604882-25377-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 --- 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;