From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966029AbcAZNQe (ORCPT ); Tue, 26 Jan 2016 08:16:34 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:62277 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965726AbcAZNQ1 (ORCPT ); Tue, 26 Jan 2016 08:16:27 -0500 From: Arnd Bergmann To: Mark Brown Cc: Johannes Berg , Simon Arlott , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Revert "regmap-mmio: Use native endianness for read/write" Date: Tue, 26 Jan 2016 14:16:16 +0100 Message-ID: <2829394.8U4Fl4Zf7k@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160126113652.GC6588@sirena.org.uk> References: <1453759675-28461-1-git-send-email-johannes@sipsolutions.net> <1453800262.2759.9.camel@sipsolutions.net> <20160126113652.GC6588@sirena.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:9n5EN7E3MkPDXd76FpApHgVmkUEQ89eKRcXphn7nE2ZpKATHD+d xMSITX68+chCQULjfjyccFQh4P7uCdSY8h9tq2uetUepgrwpD9YltLxl+TMitG/8veoOv+R KdklwtqlEOn4jv9Cr0ilBqFLN5h/RzVkzwI7DL4nUvrA5eH3pyoqCe7lOix/36gBbFAg5ID zCDnk0dHBYiK+b0EXXhQg== X-UI-Out-Filterresults: notjunk:1;V01:K0:QRgcEpfUIT0=:MECeEJuqpulABFhuZXWw+a 1+T7C6EAdMmGSDSAu+jr11Z9qIbnGP3W2y1uYFfWscEOzQwNtugOeD7Gt9qHyCXgxpMpa1A/X MR/2bxP6fIy0A+ML72QeMZAqzlFrbc4I20fjGYQuFz7m8xgbaSxMDzpLD+BoIeoDqo3D1E2ok 0b9moC2OMHRs4UB0y1/QETlqDqxdpBdovyl7CToHF4iXEC+xG5XXZodMorhnQjn28lPfaMhGX Sz4pRoiDK8RBulPfwc54KAXBKFeN6KYZ4KUFubxMv6kZtoy9ksQ6O+7hpdQb9P3kuLND/D88Y K9OS5CowLOV2gpbo3M6s7Rfp4KuN8bH3GHDL9PQh9oeKLZuGqhBBCdmapvdXFT/XixO/x4/2g /CFU9APryeAh/VmC/W5l47MzzHxgZA2xyq/k8t1jz+kqu0lPh+MnJg6iJKocpmi0S1bzC69kL BDcBrsmqTpQvS1VFT4dGy2Znd6C+0kzsePrOGhQxcFlC6hedAgPe3LHfs6JvGhQXLdifWd6cu GkdKNVigHNgfDd8mnKtzRVI/PmjC1nYRQJqo5wh7rY8wjzmYWEmnIonvf8kSfC3i91dPQEZpY /dqynr3hjoYw2Ub66M4xxY7NdTVW01zf3DvKqRdkEoSYdXZ3WorMeRyS6rK/GThDQtuBMC097 79KKCj9XW1UHMwMlNtDX93mF9besLJJfYNd7f6BlSWrdd00zOoApJX3jRIrQ80SL4Yne7Wlbm 4EA6LhmxUDIeO1p17DCwlzim/A8Ij2OPLb1r4uF81jBe/Y0EaYc54MfBnrZsV1f9cBL8epVZM jhSGyC706WypVMmMAdSJU8JCzvUb23FUzicBUE55DI89IrkwrU= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 26 January 2016 11:36:52 Mark Brown wrote: > On Tue, Jan 26, 2016 at 10:24:22AM +0100, Johannes Berg wrote: > > On Tue, 2016-01-26 at 10:09 +0100, Arnd Bergmann wrote: > > > > However, we have some freedom at the regmap-mmio level, which we can > > > sanitize in 4.6 if we want to make it more consistent with the rest > > > of regmap. We have around 50 callers of {devm_,}regmap_init_mmio() > > > and almost all of them do not specify endianess but expect little- > > > endian behavior. We can change all existing instances to set > > > REGMAP_ENDIAN_NATIVE explicitly and change regmap_init_mmio() to > > > return an error if the caller does not specify a particular endianess > > > (big, little, native). > > > I'm not sure that we can, since regmap also takes the value from the DT > > directly, and it seems that a driver passing it would mean the DT value > > is no longer honoured? > > DT should override the value in the driver rather than the other way > around. So if we default to little-endian for all regmap-mmio mappings, and let the driver or DT override that, and the regmap core already has the logic to read the ordering from DT, should we remove the parsing of the byteorder attributes from syscon and just let regmap do its thing? I was thinking about adding the patch below, but it sounds like we can just remove the parsing completely. Arnd diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index b7aabeefab07..69d9bb84c94a 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -64,10 +64,13 @@ static struct syscon *of_syscon_register(struct device_node *np) goto err_map; } - /* Parse the device's DT node for an endianness specification */ + /* Parse the device's DT node for an endianness specification, + default to little-endian on all architectures */ if (of_property_read_bool(np, "big-endian")) syscon_config.val_format_endian = REGMAP_ENDIAN_BIG; - else if (of_property_read_bool(np, "little-endian")) + else if (of_property_read_bool(np, "native-endian")) + syscon_config.val_format_endian = REGMAP_ENDIAN_NATIVE; + else syscon_config.val_format_endian = REGMAP_ENDIAN_LITTLE; /*