From patchwork Thu Dec 6 14:12:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 1008820 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=lunn.ch Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=lunn.ch header.i=@lunn.ch header.b="1m56sSGN"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 439cz36w0Nz9s3C for ; Fri, 7 Dec 2018 01:13:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728648AbeLFONu (ORCPT ); Thu, 6 Dec 2018 09:13:50 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:36165 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728346AbeLFONu (ORCPT ); Thu, 6 Dec 2018 09:13:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=8Hg/LdSYd6Q1/9NnliwEw56OKvMARWVs7odDLDiOq1Q=; b=1m56sSGNzL3+6s9J656ZUkI2RUd+/cV+8wrso2b0G46392OOv966DwVhS6cRLY6pKL/qdTEsEBcTgI2RHfQuSDWAC4rXrFoRyWfH1mgKNPkvE+kPTjbuxN0EmSIsfoEZ2L3UP+YlDBhocnlbX/xhbgGP/2BC9k4wxlchQBTYVAA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1gUuOH-0004qO-9w; Thu, 06 Dec 2018 15:12:33 +0100 From: Andrew Lunn To: peter@korsgaard.com Cc: linux-i2c@vger.kernel.org, Andrew Lunn Subject: [PATCH 2/3] i2c: ocores: Add support for bus clock via platform data Date: Thu, 6 Dec 2018 15:12:22 +0100 Message-Id: <1544105543-18578-3-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1544105543-18578-1-git-send-email-andrew@lunn.ch> References: <1544105543-18578-1-git-send-email-andrew@lunn.ch> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Add the I2C bus clock speed to the platform data structure. If not set, default to 100KHz as before. Signed-off-by: Andrew Lunn --- drivers/i2c/busses/i2c-ocores.c | 5 ++++- include/linux/platform_data/i2c-ocores.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index ddf089280847..d2730efe6bec 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -458,7 +458,10 @@ static int ocores_i2c_probe(struct platform_device *pdev) i2c->reg_shift = pdata->reg_shift; i2c->reg_io_width = pdata->reg_io_width; i2c->ip_clock_khz = pdata->clock_khz; - i2c->bus_clock_khz = 100; + if (pdata->bus_khz) + i2c->bus_clock_khz = pdata->bus_khz; + else + i2c->bus_clock_khz = 100; } else { ret = ocores_i2c_of_probe(pdev, i2c); if (ret) diff --git a/include/linux/platform_data/i2c-ocores.h b/include/linux/platform_data/i2c-ocores.h index 113d6b12f650..f497ab8fe9f8 100644 --- a/include/linux/platform_data/i2c-ocores.h +++ b/include/linux/platform_data/i2c-ocores.h @@ -15,6 +15,7 @@ struct ocores_i2c_platform_data { u32 reg_shift; /* register offset shift value */ u32 reg_io_width; /* register io read/write width */ u32 clock_khz; /* input clock in kHz */ + u32 bus_khz; /* bus clock in kHz */ bool big_endian; /* registers are big endian */ u8 num_devices; /* number of devices in the devices list */ struct i2c_board_info const *devices; /* devices connected to the bus */