From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933700AbcAYXBl (ORCPT ); Mon, 25 Jan 2016 18:01:41 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:49714 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932373AbcAYXBi (ORCPT ); Mon, 25 Jan 2016 18:01:38 -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 00:01:25 +0100 Message-ID: <15472016.EVMMrUafC6@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160125224710.GX6588@sirena.org.uk> References: <1453759675-28461-1-git-send-email-johannes@sipsolutions.net> <6166456.VMAx8CBNIX@wuerfel> <20160125224710.GX6588@sirena.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:fjMZb8OHbiTu12mDh2hjbGjK3gUVB1lO3YKXfXgQgkwCubbHYYn F25Oz1pgskumF+3dcN+JkDciFyv7sxkNpusA5+a7xh0Xj2BVl4lnGda+GCkklPDUfi/ILVX rFjqZTxwX5925j+CM9IaTDJ3vwd1mA0VKb6sIue6XYOsvqzOFweTaoDjDzenqGQW+ib0GfW F/moUd7SEV0nuUM1iBihA== X-UI-Out-Filterresults: notjunk:1;V01:K0:qYP/HBiD7A0=:qyXTLf5Sm12CJ7ObJxvhN+ L448zBZvai6JgykpL2rmTARuuMg2aL9gC5ScDGlVbBy3rE0CurF/Auewt/WLyHaBmqcnpWisu ipzGQrxGIWlwwVTcdJNUwZaGOkbw3RaOrKVD0tkviY9Pvm2l3oJqzbJuPy6mFympXxTuc6Wmg WZ46ECUnKEWSlcu/39Xn9L/hM2xo+bFJE/L3vHtw1tzqkyuZMWnYmrVSwXFfMZSQgwmcQi+0P 6sZrSfCSkP8LkG2pXIz6cDP43Fij4yHmb1LbLTPk+addfpo4XgALSjPhcjPeDJRAi4e5MaBoC rpLq7K8EeQwrx7keVmKM+1KKiQU5dO4UkuSjW/zOXkZx1YH2RUelRmmcUYA2neH5sh/jXqLQd ik6uQWVR98cfY6fD2OPZCRuyzVsj4ElIfMZpcffet+lQj0qfhgotRLYcywXbCGXfLitVo2reP JhLAQg2s7087uHioipf7IILL8juNT6fNL7pyVBpJxqpTIPk+ubR1xK0X8N41xZzdRAK0JI5K4 FLaL0S2c5wMhjYNJMCgoXA0Fvy/3ChIzw482kMrZUDNQOd8mGGTrfHXRU2HkoNwXeXLNl7XJf 126k/ptzafEyzuKgwfjdStzOLsNhkcUAyYdburl/zE58T1SBAk6d3SEwQeLNR1QD2KWTyHEIq v1D1wdUQIQX4RBrap2I/LnuKTF9XkGkLF90poU61AiITH8SqVm2lRXBEb7LqWkcUYM0mWl9RN vNdFrlZxn5fVjl5J Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 25 January 2016 22:47:10 Mark Brown wrote: > On Mon, Jan 25, 2016 at 11:24:44PM +0100, Arnd Bergmann wrote: > > On Monday 25 January 2016 23:07:55 Johannes Berg wrote: > > > Consequently, this commit broke my HummingBoard i.MX6 in big > > > endian mode since it would now try to talk to the little > > > endian hardware with a big endian CPU without conversion. > > What I'd expect to be happening here is that either the driver or the > DT should be specifying the endianness of the hardware. If the device > is always a given endianness then I'd expect that to turn up in the > driver rather than the DT. > > > > What the patch really would have to do is introduce some kind > > > of "device-endian" readl/writel, that takes the endianness of > > > the device as an argument. That seems a bit overkill though, > > > and would likely not generate any better code than the double > > > byte-swaps that MIPS is getting now. > > The problem here is that regmap already has that functionality (it needs > it for non-MMIO buses anyway) and so it knows what's going on really > wants the I/O accessors to get out of the way. I think we need to at least document the default behavior for syscon (without changing behavior on ARM), and allow the DT to specify cpu-endian as an override (or make MIPS default to that, but that would be rather inconsistent and a pain to document in the syscon binding). > > This means that the devices are in fact CPU-endian, and we need > > some way for Linux to represent this. The patch to > > drivers/base/regmap/regmap-mmio.c is clearly wrong, as we > > must never use __raw_*() accessors in an architecture independent > > driver (for a number of reasons), but we still need a fix for > > MIPS so it can specify a way to do the double-swap without > > faking the endianess of the registers. > > I can't identify *anything* which says we shouldn't use the __raw > accessors in architecture neutral code with the possible exception of > the __. Seriously, how is anyone supposed to use this stuff if we have > hidden assumptions like this? I thought everyone knew by now. > > Also, defaulting syscon to "native-endian" when nothing else is > > specified sounds like a bad idea, but we may already be stuck there > > with the precedent in existing bindings after 6a55244e897d > > ("regmap: mmio: request native endian formatting"), we'll have > > to think about that some more. > > Yeah, the native endian formatting is causing a lot of trouble. The > MIPS folks really should also have come and talked to me rather than > writing such obvious nonsense in the DT in the first place. They should also have talked to me as the syscon maintainer... Arnd