From patchwork Sat Mar 26 10:22:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Tanure X-Patchwork-Id: 12792295 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 44CAAC433EF for ; Sat, 26 Mar 2022 10:23:02 +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:References:In-Reply-To: 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: List-Owner; bh=EHD43Jbd97W8PYwzFw4dx399/jVnIK4qbEtTGJIAsdg=; b=q0SHisTwjOeZqr jgcAenVJ5PUHui0jKlMqZEzPFJdmadVQcQnZsWYo4PYzFKls3RDOK5bXPHFMe0JIGtVp5f4cf4czg G8SmyOfzFk9TULZIoK0Wssst7pbG5YvN5BMdjaskkfcjdpVeaQjws6QfbJF8Y8v6u2pivQFx+4x9C eqAHd0ZV1C/jLZdiFNBQiHhrL8eLdhouwRxlBkGq2AjYy3RsNBgAQSUhEDs4Dj58yiLi6ZLplxMyB WsEFQDDoV+I5E4xXx+z/xoSLQO3p4Y4aggZ7UFbwi4sdHF4tOY1dyOSbC9+c9Mw9G22hXy9eiIsOd ZFXZ3VbT1agDxySdbeEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nY3ZS-0047sP-HA; Sat, 26 Mar 2022 10:22:58 +0000 Received: from mail-wr1-f46.google.com ([209.85.221.46]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nY3Z5-0047ln-0Y; Sat, 26 Mar 2022 10:22:36 +0000 Received: by mail-wr1-f46.google.com with SMTP id t11so13816585wrm.5; Sat, 26 Mar 2022 03:22:34 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=d+exwJ0T4eZrE1LWR6DE1MTkGjxyaQIeoK3XOhyJ12M=; b=xeXDyzPy9Dbsc2JHGNFjAO4EESK36h51x9npkxgC9WTBTltMIEuS8TjFvVrWt3AeJh 16OiEY2kzyLYlEXlXD5YiZFMiQ/wr6K+jnrwf+3M4VeLnz5oHUOGCM9MBdJYAA+5V0u2 ov5vWepLs3nb4qK3uJf7wCxP56Lw3iYorUll9FwLvmJnO4Lr3o7KOY+nSmFFj5o6vmfT SRz8nfypmuASNDYRpj0GOnHM2nbUpmddbYnTxcXEGAEEQ/KhgfRW4fOR9Zx/yhhAyMJA 7K8i9tW+sLQTgYAQOHz7W40N1guFPPuS1va2MBKAiybJacR3IOSarg0lmpXXC6lqJjLa NRjA== X-Gm-Message-State: AOAM533ASL5E8KfxOrPCeuOaY1kMWB6PAsaKPP2P/Ssg0HBgEF/HGopw sFyaRtEfBlftu+ZtbJ5HHHc= X-Google-Smtp-Source: ABdhPJxjN3JLIoXXR3q/9N1jVkloOzSFrQ58HCAROOXM2sTHmSipHOsc3L1UIedgnQdK9jCOApCV6A== X-Received: by 2002:adf:bc0b:0:b0:203:e55c:c793 with SMTP id s11-20020adfbc0b000000b00203e55cc793mr12560145wrg.693.1648290153514; Sat, 26 Mar 2022 03:22:33 -0700 (PDT) Received: from aryzen.lan (cpc87451-finc19-2-0-cust61.4-2.cable.virginm.net. [82.11.51.62]) by smtp.googlemail.com with ESMTPSA id l15-20020a05600c1d0f00b0038c8ff8e708sm6683057wms.13.2022.03.26.03.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Mar 2022 03:22:33 -0700 (PDT) From: Lucas Tanure To: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Lucas Tanure Subject: [PATCH 1/3] i2c: meson: Use _SHIFT and _MASK for register definitions Date: Sat, 26 Mar 2022 10:22:27 +0000 Message-Id: <20220326102229.421718-2-tanure@linux.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220326102229.421718-1-tanure@linux.com> References: <20220326102229.421718-1-tanure@linux.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220326_032235_076381_6E179882 X-CRM114-Status: GOOD ( 10.01 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Differentiate between masks and shifts Signed-off-by: Lucas Tanure --- drivers/i2c/busses/i2c-meson.c | 41 ++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c index 07eb819072c4..4b4a5b2d77ab 100644 --- a/drivers/i2c/busses/i2c-meson.c +++ b/drivers/i2c/busses/i2c-meson.c @@ -30,18 +30,21 @@ #define REG_TOK_RDATA1 0x1c /* Control register fields */ -#define REG_CTRL_START BIT(0) -#define REG_CTRL_ACK_IGNORE BIT(1) -#define REG_CTRL_STATUS BIT(2) -#define REG_CTRL_ERROR BIT(3) -#define REG_CTRL_CLKDIV GENMASK(21, 12) -#define REG_CTRL_CLKDIVEXT GENMASK(29, 28) - -#define REG_SLV_ADDR GENMASK(7, 0) -#define REG_SLV_SDA_FILTER GENMASK(10, 8) -#define REG_SLV_SCL_FILTER GENMASK(13, 11) -#define REG_SLV_SCL_LOW GENMASK(27, 16) -#define REG_SLV_SCL_LOW_EN BIT(28) +#define REG_CTRL_START BIT(0) +#define REG_CTRL_ACK_IGNORE BIT(1) +#define REG_CTRL_STATUS BIT(2) +#define REG_CTRL_ERROR BIT(3) +#define REG_CTRL_CLKDIV_SHIFT 12 +#define REG_CTRL_CLKDIV_MASK GENMASK(21, REG_CTRL_CLKDIV_SHIFT) +#define REG_CTRL_CLKDIVEXT_SHIFT 28 +#define REG_CTRL_CLKDIVEXT_MASK GENMASK(29, REG_CTRL_CLKDIVEXT_SHIFT) + +#define REG_SLV_ADDR_MASK GENMASK(7, 0) +#define REG_SLV_SDA_FILTER_MASK GENMASK(10, 8) +#define REG_SLV_SCL_FILTER_MASK GENMASK(13, 11) +#define REG_SLV_SCL_LOW_SHIFT 16 +#define REG_SLV_SCL_LOW_MASK GENMASK(27, REG_SLV_SCL_LOW_SHIFT) +#define REG_SLV_SCL_LOW_EN BIT(28) #define I2C_TIMEOUT_MS 500 #define FILTER_DELAY 15 @@ -149,11 +152,11 @@ static void meson_i2c_set_clk_div(struct meson_i2c *i2c, unsigned int freq) div = GENMASK(11, 0); } - meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIV, - FIELD_PREP(REG_CTRL_CLKDIV, div & GENMASK(9, 0))); + meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIV_MASK, + FIELD_PREP(REG_CTRL_CLKDIV_MASK, div & GENMASK(9, 0))); - meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIVEXT, - FIELD_PREP(REG_CTRL_CLKDIVEXT, div >> 10)); + meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIVEXT_MASK, + FIELD_PREP(REG_CTRL_CLKDIVEXT_MASK, div >> 10)); /* Disable HIGH/LOW mode */ meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, REG_SLV_SCL_LOW_EN, 0); @@ -292,8 +295,8 @@ static void meson_i2c_do_start(struct meson_i2c *i2c, struct i2c_msg *msg) TOKEN_SLAVE_ADDR_WRITE; - meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, REG_SLV_ADDR, - FIELD_PREP(REG_SLV_ADDR, msg->addr << 1)); + meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, REG_SLV_ADDR_MASK, + FIELD_PREP(REG_SLV_ADDR_MASK, msg->addr << 1)); meson_i2c_add_token(i2c, TOKEN_START); meson_i2c_add_token(i2c, token); @@ -467,7 +470,7 @@ static int meson_i2c_probe(struct platform_device *pdev) /* Disable filtering */ meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, - REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0); + REG_SLV_SDA_FILTER_MASK | REG_SLV_SCL_FILTER_MASK, 0); meson_i2c_set_clk_div(i2c, timings.bus_freq_hz); From patchwork Sat Mar 26 10:22:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Tanure X-Patchwork-Id: 12792297 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 2B319C433EF for ; Sat, 26 Mar 2022 10:23:15 +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:References:In-Reply-To: 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: List-Owner; bh=blIhw5KqJ8AZ6iQyh541PMD6CfFJUL8UpOkIUveoyGU=; b=xJHhemyavjx5eY KAdv/qhrBpJpET791eKWSA3SgvFyKbKBptCY0HtimslgFFJnbnIKemdB0gUoJEbKqTOXYfTgdpbd7 iVYrJLGLSi2AoY6PVfPNSzajajHAHoKPGxAztU0MRmU1cKljKAaft2gUgfHNjrUug7i2IKySPumH3 kUdPHrR4S/pDBYPWRXjvBJbfafZmXjBnmGUA2BbhUkYX0+SQp4VYQx4wDHEjJgJYVVH2tmnYU1rqS rSWeFLi2F8ZYiZlMoHpsLV6HLGtCDTnDx8NQwgwCdC3fV10bJrjNFkRoGi7TI4glJDGo2j6sYzhmB 6hcrW0hzk6xVoK172L1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nY3Zf-0047wk-I3; Sat, 26 Mar 2022 10:23:11 +0000 Received: from mail-wr1-f42.google.com ([209.85.221.42]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nY3Z7-0047mI-4O; Sat, 26 Mar 2022 10:22:38 +0000 Received: by mail-wr1-f42.google.com with SMTP id d7so13812107wrb.7; Sat, 26 Mar 2022 03:22:36 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=YGuZo2Hq9ChT5cMnSJKU17y7ywEpdIIE557tEVvhgqI=; b=33JJbdlxdv9a63Wza7sWKBCiDcwfikfTfVwYKpcoTrv8FEgMoLnCrIUdLUwCCGamdD 6j+t1E4/257RbkHbnGH8HvULdAHxahvHK1ZkZ05LGbBNNREq/5jIoAlGeMDb831y3Mh9 hF4z6q1O/BZFODUc9aqMlNjAHIuPh3tbtNLpehhNOYEuwmd7MH9lYaZrn/SE6TFmGDiw Z1gVir3C8QljcXQpc3G5JN6B4/XGxQlGgWoI2MAAvR7/bPEb5U8DSl+BXcnqQqles+FQ Da97LqRAFUIoj9JsFzZNYjBD+Z1WHrhCgMAdwomr7zyIoInV5kDrTsQZ0/DGuiYXNv3S o89A== X-Gm-Message-State: AOAM531xMRUsiim3uRc9P7u6j0wO30rVZRM+WIPWMScWJzMeXp2xNagX BbfDNL+5WIEbS21ctGiipd4= X-Google-Smtp-Source: ABdhPJwkdy9I3mVJNtJcYMmcPEdeTaDwkchZfl1LHWyFYJtZAthsxp5W5FuvoDTIjKY9m4amlMkv+A== X-Received: by 2002:a05:6000:18c2:b0:203:fc53:c70e with SMTP id w2-20020a05600018c200b00203fc53c70emr13102994wrq.198.1648290154316; Sat, 26 Mar 2022 03:22:34 -0700 (PDT) Received: from aryzen.lan (cpc87451-finc19-2-0-cust61.4-2.cable.virginm.net. [82.11.51.62]) by smtp.googlemail.com with ESMTPSA id l15-20020a05600c1d0f00b0038c8ff8e708sm6683057wms.13.2022.03.26.03.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Mar 2022 03:22:33 -0700 (PDT) From: Lucas Tanure To: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Lucas Tanure Subject: [PATCH 2/3] i2c: meson: Use 50% duty cycle for I2C clock Date: Sat, 26 Mar 2022 10:22:28 +0000 Message-Id: <20220326102229.421718-3-tanure@linux.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220326102229.421718-1-tanure@linux.com> References: <20220326102229.421718-1-tanure@linux.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220326_032237_193754_26BFD0A0 X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The duty cycle of 33% is less than the required by the I2C specs for the LOW period of the SCL clock. Move the duty cyle to 50% for 100Khz or lower clocks, and (40% High SCL / 60% Low SCL) duty cycle for clocks above 100Khz. Signed-off-by: Lucas Tanure --- drivers/i2c/busses/i2c-meson.c | 45 +++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c index 4b4a5b2d77ab..b913ba20f06e 100644 --- a/drivers/i2c/busses/i2c-meson.c +++ b/drivers/i2c/busses/i2c-meson.c @@ -140,29 +140,50 @@ static void meson_i2c_add_token(struct meson_i2c *i2c, int token) static void meson_i2c_set_clk_div(struct meson_i2c *i2c, unsigned int freq) { unsigned long clk_rate = clk_get_rate(i2c->clk); - unsigned int div; + unsigned int div_h, div_l; - div = DIV_ROUND_UP(clk_rate, freq); - div -= FILTER_DELAY; - div = DIV_ROUND_UP(div, i2c->data->div_factor); + if (freq <= 100000) { + div_h = DIV_ROUND_UP(clk_rate, freq); + div_l = DIV_ROUND_UP(div_h, 4); + div_h = DIV_ROUND_UP(div_h, 2) - FILTER_DELAY; + } else { + /* According to I2C-BUS Spec 2.1, in FAST-MODE, the minimum LOW period is 1.3uS, and + * minimum HIGH is least 0.6us. + * For 400000 freq, the period is 2.5us. To keep within the specs, give 40% of period to + * HIGH and 60% to LOW. This means HIGH at 1.0us and LOW 1.5us. + * The same applies for Fast-mode plus, where LOW is 0.5us and HIGH is 0.26us. + * Duty = H/(H + L) = 2/5 + */ + div_h = DIV_ROUND_UP(clk_rate * 2, freq * 5) - FILTER_DELAY; + div_l = DIV_ROUND_UP(clk_rate * 3, freq * 5 * 2); + } /* clock divider has 12 bits */ - if (div > GENMASK(11, 0)) { + if (div_h > GENMASK(11, 0)) { dev_err(i2c->dev, "requested bus frequency too low\n"); - div = GENMASK(11, 0); + div_h = GENMASK(11, 0); + } + if (div_l > GENMASK(11, 0)) { + dev_err(i2c->dev, "requested bus frequency too low\n"); + div_l = GENMASK(11, 0); } meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIV_MASK, - FIELD_PREP(REG_CTRL_CLKDIV_MASK, div & GENMASK(9, 0))); + FIELD_PREP(REG_CTRL_CLKDIV_MASK, div_h & GENMASK(9, 0))); meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIVEXT_MASK, - FIELD_PREP(REG_CTRL_CLKDIVEXT_MASK, div >> 10)); + FIELD_PREP(REG_CTRL_CLKDIVEXT_MASK, div_h >> 10)); + + + /* set SCL low delay */ + meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, REG_SLV_SCL_LOW_MASK, + (div_l << REG_SLV_SCL_LOW_SHIFT) & REG_SLV_SCL_LOW_MASK); - /* Disable HIGH/LOW mode */ - meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, REG_SLV_SCL_LOW_EN, 0); + /* Enable HIGH/LOW mode */ + meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, REG_SLV_SCL_LOW_EN, REG_SLV_SCL_LOW_EN); - dev_dbg(i2c->dev, "%s: clk %lu, freq %u, div %u\n", __func__, - clk_rate, freq, div); + dev_dbg(i2c->dev, "%s: clk %lu, freq %u, divh %u, divl %u\n", __func__, + clk_rate, freq, div_h, div_l); } static void meson_i2c_get_data(struct meson_i2c *i2c, char *buf, int len) From patchwork Sat Mar 26 10:22:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Tanure X-Patchwork-Id: 12792296 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 72A3DC433F5 for ; Sat, 26 Mar 2022 10:23:14 +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:References:In-Reply-To: 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: List-Owner; bh=pIlr4Ez9RIvm9EaLB5xg+UYGVnV2O2DJSRyp4CK+0UE=; b=CJpb+YwF7TH9AV tQhPy9wttZk2GwB+D3QeSvax1PeMkGpj/kFkmOuNCmqXozw6bvlfwcznS6QJ37AUGSkrcKi1IXut0 /Qm6vBgn9s+uiCJkVJnzCwkX9DM3kJF9XdVffJrdETxlBNGrK9AwE0pCz807LsyV4RqsakmQ1Izkg 4dtNQ5qHf5Gh4udoQCMtbcnAk6LZ5eszwE21/Famp6eKP9LooiYfZye9GkQvfQZY8cKj3/WjhxOm+ tsVy4e9sLL3pUVXoJnT8D0CWQpYhGnCiMQET4QO0EgPDeIldpsfk/E+6pTf9YDfh3nbiKRhwv0nZX 9KtjZvjVzlgAuf/SujTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nY3Ze-0047wW-M2; Sat, 26 Mar 2022 10:23:10 +0000 Received: from mail-wr1-f52.google.com ([209.85.221.52]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nY3Z6-0047mH-OD; Sat, 26 Mar 2022 10:22:37 +0000 Received: by mail-wr1-f52.google.com with SMTP id u3so13840213wrg.3; Sat, 26 Mar 2022 03:22:36 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=rMZJCSh8j3Scx/3Txqvkwixsg8qJcGalusKt/a4e+ag=; b=0Jd1CzY8qKlKJ/jehjNCAGK4aEIofC7NQzLiGxV0H8CXhazsyma3CRV16LVtDsFaHB ckg1ByvH+QhaETashUiTLFCdCBgca6mnSrRSXWGNT0Y+A35h+qYtfRjyIWB99tmRQJeW U4EObvyYpm9fkwCO1Npv1yxuNd5aO2nEm1CQL4E7p00Hv0+elPSerLrYUExafsyfYqNP glgToc7Fd7kqPtA7GOia8NpJ2rshetAtQCt128QHTlkwcSEU8h0dx4rKWGusCriEPwaP 1TrcwRc7oVgcw/5w3DtgzoHEEA4vIavVkaS6G59SWhn4ev9rXjGf5n+gv6k6tDKTMVOY lv7g== X-Gm-Message-State: AOAM531tVhxrx9A1+KnbXcTEwvUsW+bU2Hg6wI65in0JykiaD3oaf/LE xB+jt0JEQCosbWPBeiU4N3DUmvl/B5mHLw== X-Google-Smtp-Source: ABdhPJzaI24/mzl5qv3KP0ViFbjsTjiYbJsuzzk3dbm2uJIcK/DK2s2v9pDGdnM86sVwphHiXmtJ7Q== X-Received: by 2002:adf:e444:0:b0:203:d6f4:3cc4 with SMTP id t4-20020adfe444000000b00203d6f43cc4mr13112278wrm.493.1648290155255; Sat, 26 Mar 2022 03:22:35 -0700 (PDT) Received: from aryzen.lan (cpc87451-finc19-2-0-cust61.4-2.cable.virginm.net. [82.11.51.62]) by smtp.googlemail.com with ESMTPSA id l15-20020a05600c1d0f00b0038c8ff8e708sm6683057wms.13.2022.03.26.03.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Mar 2022 03:22:34 -0700 (PDT) From: Lucas Tanure To: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Lucas Tanure Subject: [PATCH 3/3] i2c: meson: Remove meson_i2c_data Date: Sat, 26 Mar 2022 10:22:29 +0000 Message-Id: <20220326102229.421718-4-tanure@linux.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220326102229.421718-1-tanure@linux.com> References: <20220326102229.421718-1-tanure@linux.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220326_032236_828433_F2397673 X-CRM114-Status: GOOD ( 11.34 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The div_factor is not used anymore and can be removed. With 50% duty cycle the div factor should 4 for all devices. Signed-off-by: Lucas Tanure --- drivers/i2c/busses/i2c-meson.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c index b913ba20f06e..c35fd4122bfc 100644 --- a/drivers/i2c/busses/i2c-meson.c +++ b/drivers/i2c/busses/i2c-meson.c @@ -65,10 +65,6 @@ enum { STATE_WRITE, }; -struct meson_i2c_data { - unsigned char div_factor; -}; - /** * struct meson_i2c - Meson I2C device private data * @@ -514,22 +510,10 @@ static int meson_i2c_remove(struct platform_device *pdev) return 0; } -static const struct meson_i2c_data i2c_meson6_data = { - .div_factor = 4, -}; - -static const struct meson_i2c_data i2c_gxbb_data = { - .div_factor = 4, -}; - -static const struct meson_i2c_data i2c_axg_data = { - .div_factor = 3, -}; - static const struct of_device_id meson_i2c_match[] = { - { .compatible = "amlogic,meson6-i2c", .data = &i2c_meson6_data }, - { .compatible = "amlogic,meson-gxbb-i2c", .data = &i2c_gxbb_data }, - { .compatible = "amlogic,meson-axg-i2c", .data = &i2c_axg_data }, + { .compatible = "amlogic,meson6-i2c", }, + { .compatible = "amlogic,meson-gxbb-i2c", }, + { .compatible = "amlogic,meson-axg-i2c", }, {}, };