From patchwork Fri Feb 8 01:05:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 1038410 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=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=lunn.ch header.i=@lunn.ch header.b="D8kQd8rO"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43wcTp0rjQz9rxp for ; Fri, 8 Feb 2019 12:07:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726844AbfBHBHJ (ORCPT ); Thu, 7 Feb 2019 20:07:09 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:43201 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbfBHBHJ (ORCPT ); Thu, 7 Feb 2019 20:07:09 -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: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wOO9Zcxi/bEhsGd3JxzzglGUiXHEbW2OH3XKIibFq4k=; b=D8kQd8rO5KTsVdcmHGzlOZT1IT dHxIxWmakZD9ZbX1r4nQtPHXFSXVjPVEnAebDxWpzmUpfjZLJOTfA56jmEy+40+0Xnw/GlVai3fgW A5tTm3PdBmkHhu0Jfw88Nc5tOnddDp6UqGbRUCZpy/tHio3CsfxrEnZOXHnHR6r0k8RA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1grubz-0003F7-C9; Fri, 08 Feb 2019 02:05:47 +0100 From: Andrew Lunn To: Wolfram Sang Cc: Lee Jones , linux-i2c@vger.kernel.org, Federico Vaga , Andrew Lunn Subject: [PATCH v3 3/4] i2c: ocores: Add support for bus clock via platform data Date: Fri, 8 Feb 2019 02:05:06 +0100 Message-Id: <20190208010507.12411-4-andrew@lunn.ch> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190208010507.12411-1-andrew@lunn.ch> References: <20190208010507.12411-1-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 */