From patchwork Mon Mar 26 11:19:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 890893 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=microchip.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 408s9n1ggLz9s1b for ; Mon, 26 Mar 2018 22:19:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751071AbeCZLTk (ORCPT ); Mon, 26 Mar 2018 07:19:40 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:22833 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbeCZLTk (ORCPT ); Mon, 26 Mar 2018 07:19:40 -0400 X-IronPort-AV: E=Sophos;i="5.48,364,1517900400"; d="scan'208";a="10527468" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 Mar 2018 04:19:39 -0700 Received: from localhost.localdomain.com (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.352.0; Mon, 26 Mar 2018 04:19:38 -0700 From: Tudor Ambarus To: , , , , , CC: Tudor Ambarus Subject: [RFC PATCH 2/2] i2c: at91: provide bus_freq_hz Date: Mon, 26 Mar 2018 14:19:27 +0300 Message-ID: <20180326111927.16040-2-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20180326111927.16040-1-tudor.ambarus@microchip.com> References: <20180326111927.16040-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The clock-frequency property is not mandatory for the i2c buses. If it's not present in device tree, the buses usually assume that is 100kHZ. There are i2c clients that need to know the clock frequency in order to compute their wake token. Spare the clients of making (wrong) assumptions and provide the bus frequency in adapter. Signed-off-by: Tudor Ambarus Acked-by: Ludovic Desroches --- drivers/i2c/busses/i2c-at91.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index bfd1fdf..d3cd84e 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -1116,6 +1116,7 @@ static int at91_twi_probe(struct platform_device *pdev) dev->adapter.quirks = &at91_twi_quirks; dev->adapter.dev.parent = dev->dev; dev->adapter.nr = pdev->id; + dev->adapter.bus_freq_hz = bus_clk_rate; dev->adapter.timeout = AT91_I2C_TIMEOUT; dev->adapter.dev.of_node = pdev->dev.of_node;