Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp507018ybk; Wed, 20 May 2020 05:20:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsSV6TWE11FcFNdRSnHPRbHyy2IEh+ecTkSG1pF7LKZC18PvJDZRTPWGxRYVrKRWLd5cCw X-Received: by 2002:a50:a693:: with SMTP id e19mr3007348edc.275.1589977241728; Wed, 20 May 2020 05:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589977241; cv=none; d=google.com; s=arc-20160816; b=rLV4V2yeDhH85P6oP/8yKSTHF25tmp218HO1++qbK+OCyJ+lRe+guFOvTtlfaIjVr4 Za6gmnCG12u1iGOIInX/7sH8QAyzEeYbFm3MEn3Pus9HBtiiZpNPxAgkfOqatlFDLrlc cAnT8+usWvB7kC8Lb/CebZS+B+NiIx/XJZckW3I7NCowBS/kPV7CfXkBaVVD0S4I7oRM QK/CFFpL/937Bvny41A5EajYFgPMcZO4VZI2RI04a+81ci+rdgkGxh2/iG/5z5FemAp/ qUS8zTT8/3romKZqrdmfXEEd9zoA+Lm1grJXLKhLnbqnBP5+iuaAvVFWU7MnIj1EJ/Ci 41tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=K1DuHgqXaTR9cY7u6Q6DccDsB2WXbx1/JXsi5De8OpY=; b=Q7chhLpDY3asxwwH4RR/9NSccmEjplamEhFhkzxt16bKYGoaOCfoht8qyUxgitUxmB 6ztCro5iEotO3dnH72RHtCzILa6nQCAkYnszbgau08LHpKWib5PkC3vW7AaBepEVHHCq 8EyIv8KRDAVSrU/U4g/eplmOJ+8JHqgB0VbIRpO5lh1mkqQSWylJOTovfuY8iCU6IRTo 6NiFonZgdRUrxN/xpjyxYJ/r5O1HZ2X1D+4jO4nwfIwprZ5guAS58y2iaCRjPlGqhQ// LAowMNHuQhIUzKIk3/8Q8lfYF+sL4GiUBVbXuq/7XilVeKZlxeNuUMcW/QFy6mJJorRf wZuw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cn24si1263181edb.340.2020.05.20.05.20.18; Wed, 20 May 2020 05:20:41 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726835AbgETMQ1 (ORCPT + 99 others); Wed, 20 May 2020 08:16:27 -0400 Received: from mga05.intel.com ([192.55.52.43]:33945 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgETMQ1 (ORCPT ); Wed, 20 May 2020 08:16:27 -0400 IronPort-SDR: Nc4IjrnjrqyZ4j8nL6mvjmU4ynU3kFY2dcVMjVV6tbGo1XQo8xQVQqoW4QK36fBkFGsrT5k94J HsgWGHvNRsQA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2020 05:16:12 -0700 IronPort-SDR: 2vuCUDa26VNYQNo+oULASX2jp1NV/gy70EFU73mz6dvdkjgFsNpoNEZdVHZLpUTtl4b5sfaOqJ p2YbNF/24iTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,413,1583222400"; d="scan'208";a="289330868" Received: from mylly.fi.intel.com (HELO [10.237.72.161]) ([10.237.72.161]) by fmsmga004.fm.intel.com with ESMTP; 20 May 2020 05:16:08 -0700 Subject: Re: [PATCH v2 04/12] i2c: designware: Convert driver to using regmap API To: Serge Semin , Andy Shevchenko , Mika Westerberg Cc: Serge Semin , Alexey Malahov , Thomas Bogendoerfer , Paul Burton , Ralf Baechle , Wolfram Sang , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, linux-mips@vger.kernel.org, Wolfram Sang , Jean Delvare , Krzysztof Kozlowski , Max Staudt , Stefan Roese , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Shaokun Zhang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200306132001.1B875803087C@mail.baikalelectronics.ru> <20200510095019.20981-1-Sergey.Semin@baikalelectronics.ru> <20200510095019.20981-5-Sergey.Semin@baikalelectronics.ru> From: Jarkko Nikula Message-ID: Date: Wed, 20 May 2020 15:16:07 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200510095019.20981-5-Sergey.Semin@baikalelectronics.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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