From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750897AbbLHRAc (ORCPT ); Tue, 8 Dec 2015 12:00:32 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:63299 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbbLHRAa (ORCPT ); Tue, 8 Dec 2015 12:00:30 -0500 From: Arnd Bergmann To: Masahiro Yamada Cc: arm@kernel.org, Mark Rutland , devicetree@vger.kernel.org, Kumar Gala , linux-kernel@vger.kernel.org, Ian Campbell , Rob Herring , Pawel Moll , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3] bus: uniphier-system-bus: add UniPhier System Bus driver Date: Tue, 08 Dec 2015 17:59:44 +0100 Message-ID: <14233302.P9onBQovHz@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1449591718-21753-1-git-send-email-yamada.masahiro@socionext.com> References: <1449591718-21753-1-git-send-email-yamada.masahiro@socionext.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:Vc20isqBdpvITW+RPmPn0h2LJfdy357g9sGjhFGR6ZA2T3BwFup DCn5xf61/ag4p9WYekCLalHvU041NmENMlbB42vyhxdajpCqD1vs6fQcCWaqERBHIH0z1/A ltNgZboeKOo0bOcJhnSdzNxY2LsVF0R4WUwYL2d0VCIw9gLehU+faudHLiyBpqLYCJaHB+M D6h8qZhETNJ5pQpkdO+Fg== X-UI-Out-Filterresults: notjunk:1;V01:K0:ftnhFS42rT0=:gG/zT3Rp/Pwoj/r9mtWZiv AkgbSUwf/2oYogNFIX7NGjm2eX5Mhp+EQjF6yLphASL/qDi0b7XRdeW4Z6alFAaUESIuASsVP eiwJm1Z0edvEPZ4uu5we1Zu0fJwn10TXLCJRPwmVsBMe1JbKxf0kAKxqgeBHdZVAWHJZKCpUM wuSjPge3r7cRQjVWJN0+fmUkEPIF49jdwJa3CiuEvxRGRFX1RBQzndp8z/LrPLIkpXFVt9P57 mIfk7212U0l9KHQ8mY2/rC5KzhI6tvYamfRSgHWKO02wZt9UuHwiQXePTeRphUf9hKYFLpJva R5pnwqUzviJWm0OTch+AaA1YEvx2cxC4sBdxBUNtF9Wd9IKnf9mGXmifpw7YT4Y9gLnGYAeM0 b4CS0uXGJB0bTSe/fdbzvRHk5YNtxm8tIsamtDJI3yYPyfM0FAIL95M/UibhoURWer+qsRZgc GKPNHaEVNu0Dgv8Tc64ZQwBVeWWJRBMHFKhCf3w8MKTQzFzgTDJOX8ViYJPAvJ9Z3qx3mILlM sPJTZI64vS2AYz3xZBaIORFgE5f38Wv1b21oH+nGCfbYkelFTqcGZEvSvrC9xuWpL3iSAK5xw gbxVJmOV36RiRpPJiZflKEV6u5WSfk2Ju05I3cBbdSSxYh25c2d1l/hzWtvgSJQ9iyXECEaC/ zceajfAY4PhQjYg6TnnfEq6Lvn8sOPMsF+O8sL1lzJe+gNJlFdlSnr7qoGb4iRZi+5arev8Sm 2q14RUR8BowZZB+n Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 09 December 2015 01:21:58 Masahiro Yamada wrote: > The UniPhier System Bus is an external that connects on-board devices > to the UniPhier SoC. Each bank (chip select) is dynamically mapped > to the CPU-viewed address base via the bus controller. The bus > controller must be configured before any access to the bus. > > This driver parses the "ranges" property of the System Bus node and > initialized the bus controller. After the bus becomes ready, devices > below it are populated. > > Note: > Each bank can be mapped anywhere in the supported address space; > there is nothing preventing us from assigning bank 0 on 0x42000000, > 0x43000000, or anywhere as long as such region is not used by others. > So, the "ranges" is just one possible software configuration, which > does not seem to fit in device tree because device tree is a hardware > description language. However, of_translate_address() requires > "ranges" in every bus node between CPUs and device mapped on the CPU > address space. In other words, "ranges" properties must be statically > defined in device tree. After some discussion, I decided the dynamic > address reassignment by the driver is too bothersome. Instead, the > device tree should provide a reasonable translation setup that the OS > can rely on. > > Signed-off-by: Masahiro Yamada > Acked-by: Rob Herring Looks very nice. Acked-by: Arnd Bergmann Just a little thought about one thing I found odd: > +static int uniphier_system_bus_check_overlap( > + struct uniphier_system_bus_priv tmp) > +{ Did you intentionally pass this by value? Maybe do it explicitly using a pointer and memcpy to a local variable, which has a similar effect. Alternatively just check each newly probed child node for conflicts with any of the previous children. That is slightly more expensive at O(n^2) instead of O(n) but n is always small here and you can avoid sorting first. Arnd