From: Alexandre Courbot Date: Fri, 30 Sep 2016 18:57:22 +0900 Subject: [U-Boot] [PATCH] serial: ns16550: Fix serial output on Tegra186 In-Reply-To: <20212157.MZEfd0NuQ9@np-p-burton> References: <20160930084609.13307-1-thierry.reding@gmail.com> <20212157.MZEfd0NuQ9@np-p-burton> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Paul, On 09/30/2016 06:47 PM, Paul Burton wrote: > * PGP Signed by an unknown key > > On Friday, 30 September 2016 17:53:38 BST Alexandre Courbot wrote: >> On 09/30/2016 05:46 PM, Thierry Reding wrote: >>> From: Thierry Reding >>> >>> For Tegra186 there are currently no UART clocks wired up in device tree. >>> This exposes a regression introduced in commit 50fce1d5d874 ("serial: >>> ns16550: Support clocks via phandle"), which causes the p2771-0000-500 >>> board (and probably any Tegra186-based board as well) to fail to boot. >>> >>> The reason is that if no clocks property exists, then clk_get_by_index() >>> returns -ENOENT (via fdtdec_parse_phandle_with_args()) rather than >>> -ENODEV as the above-mentioned commit expects. >>> >>> Fix this by checking for the right error code. >> >> Tested-by: Alexandre Courbot >> >> I sent a similar patch ~10 minutes before this one, but Thierry's commit >> message is clearer than mine (and his handling of -ENODEV probably more >> correct as well), so let's go with this version! > > > Hi Thierry & Alexandre, > > Apologies for the breakage! > > If a DT contains a clock & the UART node references it by phandle then I > believe clk_get_by_index() could return -ENODEV via > uclass_get_device_by_of_offset & uclass_find_device_by_of_offset. So we > probably need to handle both -ENOENT for the "no clocks property" case & - > ENODEV for the "clocks property but no driver" case, as Alexandre's patch > does? But if a DT contains a clock, shouldn't it simply take precedence over the legacy method? (not very familiar with this code so my comment may not make sense). IOW, do we have a case where clk_get_by_index() returns -ENODEV and fdtdec_get_int() returns a valid clock?