Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4141854pxb; Tue, 10 Nov 2020 08:54:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2C+Pf5UHwv6wuJdy0TLQflN+OSUPPXfxS6EeOfk/UaEiivCR6SpYeaXVTJlc0QTVblXQ4 X-Received: by 2002:a05:6402:1456:: with SMTP id d22mr234349edx.77.1605027296627; Tue, 10 Nov 2020 08:54:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605027296; cv=none; d=google.com; s=arc-20160816; b=Rma55XQnVcT8n20Po7aOFDxCN+OJIhUuKKmZ5QQaqS3kbK41uF6FFFXtU82H0AFA4d UqL5tFcHlrFGmNQtp7ut7E5hmKojfsuF6nZG3mTSlf+kn0GTAOv1kaf0ddrtM0rwcS6/ EqwXnA4Yd1zz7uvaXEStVf/xwpGTNI2853M2skeWHWjLEEvmTnZek+U4qcfm9rJ4EHci DCQC5FI55iszhSt6kU13wIYX/AseSFW4CylwRIfeIKqpwQRQnUc2KH/Tyggx/Z4JG/oZ RUaQrLG1phfKksNm/nNnW7HHBgwSpWRiocHyxPTLvP2h4l9ti1qsX4lFH78hKlpsa7Rh BqHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=h8aV1fRyAQr4lu0BWRM7KfIjU599lmTXpnXF/29ou/8=; b=LpImosdtBqFVNC6sazFtNOKCAmySYbmmVFVwc9EhES+SXL9OIBYv4+9zKT1evGT8AC 4UumGbLp+kIgPCWtvr4QfePJRhUR7XpLQD0/U8K1zewqxYQdk6WfiRz2bR6Q0S8/S07g Ulfjo/sV5wKnP/izaDBPPys4CdPxD5pi8t54v4+qSoPEAHdn1ubD+lTHEs/0N1qiNuju eHRR+ps0FxpXoHNUL0xnGNVa2OWJnacBrCvozdmTU9/gtp+ONFvwTi6Pw9z9mRT4Ik/y kn2jiOI0GPLUFAVudgJj9I3fnnf5Rtr2VvsVnO8csEgOREf+jc+yTibILbrfT8y97LIj 5m5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=LeDCrYse; 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 a6si9421110ejx.103.2020.11.10.08.54.32; Tue, 10 Nov 2020 08:54:56 -0800 (PST) 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; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=LeDCrYse; 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 S1730468AbgKJQwj (ORCPT + 99 others); Tue, 10 Nov 2020 11:52:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbgKJQwj (ORCPT ); Tue, 10 Nov 2020 11:52:39 -0500 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8299C0613CF for ; Tue, 10 Nov 2020 08:52:37 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id p7so14910447ioo.6 for ; Tue, 10 Nov 2020 08:52:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=h8aV1fRyAQr4lu0BWRM7KfIjU599lmTXpnXF/29ou/8=; b=LeDCrYseEV54t+QJ/c0KmtoQtibA3j/TYcLG1Qxs+L/v7kGAEXBpKq76n16mjKfakN uPACa6ThhNs+bRAll5Wpidpm5moKVd+ag49pJSn+YruLoszoM98vZy3SXShtzbsG1G6C t6z8RbDo+VKrrNDQMbCcU/r9ZXT8JPzDVCoVJlU476xTYyuEVY90UCsdJRwThxo+i5gm RTf1kLlV9gz4wbygu2LxYeoklDT2Mu4lUnlTJ8YuneQsjG0zIGGYbZtKnCgJ3irYRPtn Q3mqedE0I4FUjIjSO+Z+VMChANMFrJJpo3LKBvgMnZ02+Tmrt/SuibBv3GEzs24l6cTX rITA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h8aV1fRyAQr4lu0BWRM7KfIjU599lmTXpnXF/29ou/8=; b=p7AcxP92hKY0LxBOmSTrdWEPn4YiBJtqGdUb3gTtLAP8tVRW6di1IGawQxQft1gh+w txyAdaf1rkHsKOeugOoZTpiDU4wca3AsWhvdc2XhBuOX+F9hGNXuNd2WvwEnkbz+yzNQ UDVOr5zpqaF9fjP6xWjCLuOnRptDO/5toGM3UYSgLXJNXBflc8WqetrcEbygh9FjMIiz m0H7bDtUxa60O0C+OsDWieBMrfmUCOLuQVMUlYhG/b0Ws6nZmGJwcJEFy3HAqW2O2COE U/QMR4eWxGuVSRmVoIPDZ2tQWqyAS1noqHMRcbIcBYwXcCnrYDY7+ofCqXUegqBgez3E byfw== X-Gm-Message-State: AOAM533vtHIOo5xQ8ye5GRSUiWn8r1cyvMYx4tJM8ouLsFMGPrqiRxML vqmkGB+J1zm4whKWRDXZW6NyCfPwYqiF+nkdYMRhmA== X-Received: by 2002:a02:65cf:: with SMTP id u198mr15677478jab.24.1605027157271; Tue, 10 Nov 2020 08:52:37 -0800 (PST) MIME-Version: 1.0 References: <20201110145552.23024-1-brgl@bgdev.pl> <20201110145552.23024-7-brgl@bgdev.pl> <20201110150447.GW4077@smile.fi.intel.com> <20201110151022.GY4077@smile.fi.intel.com> <20201110161225.GZ4077@smile.fi.intel.com> In-Reply-To: From: Bartosz Golaszewski Date: Tue, 10 Nov 2020 17:52:26 +0100 Message-ID: Subject: Re: [PATCH v4 6/7] gpio: exar: switch to using regmap To: Andy Shevchenko Cc: Bartosz Golaszewski , Andy Shevchenko , Linus Walleij , Jan Kiszka , David Laight , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 5:43 PM Andy Shevchenko wrote: > > On Tue, Nov 10, 2020 at 6:37 PM Bartosz Golaszewski > wrote: > > On Tue, Nov 10, 2020 at 5:17 PM Andy Shevchenko > > wrote: > > ... > > > > > > > > +static const struct regmap_config exar_regmap_config = { > > > > > > > + .name = "exar-gpio", > > > > > > > + .reg_bits = 16, > > > > > > > > > > > > As per previous version comment. > > > > > > > > > > > > Hold on, the registers are 16-bit wide, but their halves are sparsed! > > > > > > So, I guess 8 and 8 with helpers to get hi and lo parts are essential. > > > > > > > > > > > > > > > > > > TABLE 5: DEVICE CONFIGURATION REGISTERS SHOWN IN BYTE ALIGNMENT > > > > > > > > > > > > > + .val_bits = 8, > > > > > > > +}; > > > > > > > > > > > > This is basically represents two banks out of 6 8-bit registers each. > > > > > > > > > > ...which makes me wonder if gpio-regmap can be utilized here... > > > > > > > > > > > > > But the address width won't affect the actuall accessing of 8 bits > > > > registers in an mmio regmap. Internally the mmio regmap does pretty > > > > much the same thing the previous driver did: call readb()/writeb() on > > > > 8-bit "chunks" of the banks. > > > > > > It will affect reg dump in debugfs. I would really narrow down the register > > > address space in the config, otherwise that debugfs facility will screw up a > > > lot of things. > > > > > > So, and to be on pedantic side... > > > > > > "The Device Configuration Registers and the two individual UART Configuration > > > Registers of the XR17V352 occupy 2K of PCI bus memory address space." > > > > > > 11 seems the correct value for the address width. > > > > I take it as a typo and assume you meant 16. So the patch should be > > correct and your review tag is good to go? > > It's not a typo. But thinking again. This is basically done in regmap > to support serial buses. Here we have MMIO pretty much with 32-bit or > 64-bit address accesses. I didn't dig into regmap implementation to > understand the consequences of changing this to the different values > (it seems like rather offset, and in this case 11 is a correct one, > not a typo, and regmap is okay with that). > But I would rather ask Jan to actually mount debugfs and dump > registers and see if it screws up the UART (because it may go all over > important registers), that's why I think this configuration is still > missing some strict rules about what addresses (offsets) driver may or > may not access. Ok now I get it. Yes 11 seems to be right in this case for the max address. We can implement the readable/writable callbacks to be very strict about the register accesses but isn't it overkill? This driver is very small and only accesses a couple registers. I don't see such strict checking very often except for very complicated modules (like pca953x you mentioned). Bartosz