Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4114875pxb; Tue, 10 Nov 2020 08:16:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlPmC2VkzYAmSEz3tAzC5Orbi8UbsputheOG9w6lR49xWD2QLIsI5t2X5ZLV4kV2RYE3kp X-Received: by 2002:a17:906:cb0f:: with SMTP id lk15mr19903137ejb.431.1605025011909; Tue, 10 Nov 2020 08:16:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605025011; cv=none; d=google.com; s=arc-20160816; b=fz5ko87uaMIlLSbluTvM3bVR/sD+UWnCTmfdltpuRRvp7CLcx/j1RJjGL3PuPNQ4zJ uco8HALP/2sGk4yLkjHgcpKWMB7V4X91sVtIKgMEqwU4u/z/dja8VKRL7RyPTkK8pyfg u0LDf0bLYFiPd6TfZ6wTNLDE51jvh4Ji+vbDGG4pY5DBV9J4ibIV1Q0nE998HV/iAow8 UwavTeRrLDQXk/bzDnkBd0mtlW6mUWX1nmLdBrUbYT4nAcvn7wo13UP+WWm+grLMJFfp jQk7RNGgFk0bd6fUu0W5rnBWvh8J31v2/Sj3OlZOH9JJ14VVO9VoyohNlqL2gJW5yu5Z 6L9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=zfj8G+JgkZ9zgZO79A8KpXr7gqM99fuR9WP6NQ8D9Bg=; b=TiOHi0goTOG8pIoWL3FmmCvMfq6cqJjZ27OKdRuUcmO0KmUnhQ1yOwBZrtMFJYlHEu WqvvoeZymn38q+oJM1QILnNvneJgTkG1MCGEverE6JnlzwN2q/U6JSrQq2g5rnFZtHi1 UIUvuKbfhRCROMvuycXHWiiL7swXZM9f/N19hJqfRZ4gqjN5N7LaPm0jpamd9nkXmk6G laXvz1C80MXRbMjn4977Fenhwp85sVvK0M9yySpPaEwCCDW8NdVGKryeJtgvlHbU0h+j 4JWo9OD4dp3froIibcT6CQuXx2CztNWdjbzG39OIE6FUMLNa3h56wleRsHmxlqLAC0aK GB2Q== 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 a20si13486652edn.39.2020.11.10.08.16.20; Tue, 10 Nov 2020 08:16:51 -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; 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 S1731248AbgKJQLd (ORCPT + 99 others); Tue, 10 Nov 2020 11:11:33 -0500 Received: from mga02.intel.com ([134.134.136.20]:24495 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729909AbgKJQLd (ORCPT ); Tue, 10 Nov 2020 11:11:33 -0500 IronPort-SDR: yqYhsCwq5+HVBXsvatkYtE2uN9oeNsP83ay4KWM5urUMdtT9t/WdAXuvU4TrsrHst7dNNFSs6Y G5Nt6QqIHrXw== X-IronPort-AV: E=McAfee;i="6000,8403,9801"; a="157006055" X-IronPort-AV: E=Sophos;i="5.77,466,1596524400"; d="scan'208";a="157006055" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2020 08:11:26 -0800 IronPort-SDR: 4f5UwOTPqlOXN9XV1HjKqugNQhhq8QLBa1BAq/DN26sSYgEhNn+QmlCJ4RL5s1GZ/lU6SOOGKD nntiptJNX6tQ== X-IronPort-AV: E=Sophos;i="5.77,466,1596524400"; d="scan'208";a="473480795" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2020 08:11:24 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kcWFu-005WH1-05; Tue, 10 Nov 2020 18:12:26 +0200 Date: Tue, 10 Nov 2020 18:12:25 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , Jan Kiszka , David Laight , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Bartosz Golaszewski Subject: Re: [PATCH v4 6/7] gpio: exar: switch to using regmap Message-ID: <20201110161225.GZ4077@smile.fi.intel.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 04:12:38PM +0100, Bartosz Golaszewski wrote: > On Tue, Nov 10, 2020 at 4:09 PM Andy Shevchenko > wrote: > > > > On Tue, Nov 10, 2020 at 05:04:47PM +0200, Andy Shevchenko wrote: > > > On Tue, Nov 10, 2020 at 03:55:51PM +0100, Bartosz Golaszewski wrote: > > > > From: Bartosz Golaszewski > > > > > > > > We can simplify the code in gpio-exar by using regmap. This allows us to > > > > drop the mutex (regmap provides its own locking) and we can also reuse > > > > regmap's bit operations instead of implementing our own update function. > > > > > > ... > > > > > > > +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. -- With Best Regards, Andy Shevchenko