Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1023498ybk; Wed, 20 May 2020 19:04:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8LwA6sw1QRw38HH1to0N6X3K1G36usyu0bV/3bFJdEUK5Ehdrv1MFcyK3AQM2x/M1pfjH X-Received: by 2002:a17:906:5615:: with SMTP id f21mr1552306ejq.372.1590026693073; Wed, 20 May 2020 19:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590026693; cv=none; d=google.com; s=arc-20160816; b=s5hPkSpEymoBQu2yrHjFgU4j9wTgaBRgu22644qpzQhhYYzhClGMR6hF8ZvFLwKjJs EUkoe45e+RL1uulUSWfNC+uj+FQlNDj+6fLdXwgkDLDhjSnqY/UmAd/5fB72NgoDj3Xz KbZOPmYgQQRQS0gk1fXGYIQMcvcxtvenNa+ur0YIUDCtACSsKlZcXlhacgeCtFvcNL/J WHPS7nCVOMcE73cRvnFFdEvWTfswkzSWHjdsMcnVNIISVCt2iH8LXAyj+oGC6We/IROA gcq29G5wWw8TwvMyoRPcn3ZkzcpEA4+DTAv1Bn1x7f+H+73Hf6uNDlNnhi5M/uQojmjK 3H6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=JB+ovAmbiKVYgxD104X7DbROLPwp333FlX6P2EDPHYk=; b=t66wEFeApm4f8Tkpyj5etuVcYHyHVniIi0F5H7PTBjgrwxtwg46A8LCGjpY1PFeYi5 gmD95MYT1F6kyYjHqaqhYAj2/2fZuvbJmzpYW54Pk21nQkiEdFJw0yRHg73x26eSDds/ rTxHbGb4AlSugKB7qCsWK24BsGDL8BtGyoirT5P8Q2rlXFmC/M2UGrkc+CHtRgQEWpYE EBGiS9sMvUf//jcEmN6SMEP0XvvLAUtlJdCGIFYUKzVJVhQN/X2A7N5qj0Vg17I1wCqe JA7NhY0VMr+PgRDBTPQo4YfFqJ/P7FWKU4VNwvH795vWwA4VbChoMPMIl2KecOPY9/Uy zjUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si27268edj.552.2020.05.20.19.04.30; Wed, 20 May 2020 19:04:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727853AbgEUCDD (ORCPT + 99 others); Wed, 20 May 2020 22:03:03 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:34392 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbgEUCDC (ORCPT ); Wed, 20 May 2020 22:03:02 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 22B0C803087B; Thu, 21 May 2020 02:02:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V8qhQs_h6n-P; Thu, 21 May 2020 05:02:58 +0300 (MSK) Date: Thu, 21 May 2020 05:02:56 +0300 From: Serge Semin To: Jarkko Nikula CC: Serge Semin , Andy Shevchenko , Mika Westerberg , Alexey Malahov , Thomas Bogendoerfer , Paul Burton , Ralf Baechle , Wolfram Sang , Rob Herring , Frank Rowand , , , Wolfram Sang , Jean Delvare , Krzysztof Kozlowski , Max Staudt , Stefan Roese , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Shaokun Zhang , , Subject: Re: [PATCH v2 04/12] i2c: designware: Convert driver to using regmap API Message-ID: <20200521020256.mfdark6vzinuktf7@mobilestation> References: <20200306132001.1B875803087C@mail.baikalelectronics.ru> <20200510095019.20981-1-Sergey.Semin@baikalelectronics.ru> <20200510095019.20981-5-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 20, 2020 at 03:16:07PM +0300, Jarkko Nikula wrote: > On 5/10/20 12:50 PM, Serge Semin wrote: > > Seeing the DW I2C driver is using flags-based accessors with two > > conditional clauses it would be better to replace them with the regmap > > API IO methods and to initialize the regmap object with read/write > > callbacks specific to the controller registers map implementation. This > > will be also handy for the drivers with non-standard registers mapping > > (like an embedded into the Baikal-T1 System Controller DW I2C block, which > > glue-driver is a part of this series). > > > > As before the driver tries to detect the mapping setup at probe stage and > > creates a regmap object accordingly, which will be used by the rest of the > > code to correctly access the controller registers. In two places it was > > appropriate to convert the hand-written read-modify-write and > > read-poll-loop design patterns to the corresponding regmap API > > ready-to-use methods. > > > > Note the regmap IO methods return value is checked only at the probe > > stage. The rest of the code won't do this because basically we have > > MMIO-based regmap so non of the read/write methods can fail (this also > > won't be needed for the Baikal-T1-specific I2C controller). > > > > Suggested-by: Andy Shevchenko > > Signed-off-by: Serge Semin > > Cc: Alexey Malahov > > Cc: Thomas Bogendoerfer > > Cc: Paul Burton > > Cc: Ralf Baechle > > Cc: Wolfram Sang > > Cc: Rob Herring > > Cc: Frank Rowand > > Cc: devicetree@vger.kernel.org > > Cc: linux-mips@vger.kernel.org > > --- > > drivers/i2c/busses/Kconfig | 1 + > > drivers/i2c/busses/i2c-designware-common.c | 171 +++++++++++++++------ > > drivers/i2c/busses/i2c-designware-core.h | 18 +-- > > drivers/i2c/busses/i2c-designware-master.c | 125 ++++++++------- > > drivers/i2c/busses/i2c-designware-slave.c | 77 +++++----- > > 5 files changed, 239 insertions(+), 153 deletions(-) > > > Looking at patches 4/12-12/12 I think it would be good to move fixes and > less invasive patches before this. Like > > i2c: designware: slave: Set DW I2C core module dependency > i2c: designware: Use `-y` to build multi-object modules > i2c: designware: Move Baytrail sem config to the platform if-clause > > That said, you may add: > > Tested-by: Jarkko Nikula > Acked-by: Jarkko Nikula Ok. I'll move those three patches to be before this one in v3. Thanks. -Sergey