From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751727AbbBPUZi (ORCPT ); Mon, 16 Feb 2015 15:25:38 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:59243 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751680AbbBPUZh (ORCPT ); Mon, 16 Feb 2015 15:25:37 -0500 Date: Mon, 16 Feb 2015 21:24:51 +0100 (CET) From: Stefan Wahren Reply-To: Stefan Wahren To: Fabio Estevam Cc: Sascha Hauer , linux-kernel , Shawn Guo , Mike Turquette , "linux-arm-kernel@lists.infradead.org" , Marek Vasut , Zhi Li Message-ID: <235965536.675649.1424118291283.JavaMail.open-xchange@oxbaltgw06.schlund.de> In-Reply-To: References: <1422645610-3052-1-git-send-email-stefan.wahren@i2se.com> <54DA020C.6030703@i2se.com> <54DA0DE7.5050708@i2se.com> <462270270.419156.1423603473431.JavaMail.open-xchange@oxbaltgw02.schlund.de> <1705379122.406018.1423686677196.JavaMail.open-xchange@oxbaltgw01.schlund.de> <1378197784.470306.1423767540298.JavaMail.open-xchange@oxbaltgw01.schlund.de> Subject: Re: [PATCH V2 RESEND] clk: mxs: Fix invalid 32-bit access to frac registers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.6.0-Rev36 X-Originating-Client: com.openexchange.ox.gui.dhtml X-Provags-ID: V03:K0:5bs0TVi6tHwDEsM86LZ80LCOUPTe0oFYbehixDFBlcaMOVPKc3v ihVTp2DLGbPtvrTFLLo8CyyP8wiwTBWadJyBE2dz9y7z/R39RBMB3NeQaN8cYd3Cpe4F1H+ CL9JY8pzX+gpF0fXlCkDyt9m6pESrTWh+6UAI9TIHOKR0pgDxzsJJWdh9xDnemQ7q/RWDkW NuBK5mBpGPS6t1zOTCblA== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Fabio, > Fabio Estevam hat am 12. Februar 2015 um 20:08 > geschrieben: > > > Hi Stefan, > > On Thu, Feb 12, 2015 at 4:59 PM, Stefan Wahren wrote: > > Hi Fabio, > > > >> Fabio Estevam hat am 11. Februar 2015 um 22:10 > >> geschrieben: > >> > >> > >> On Wed, Feb 11, 2015 at 6:31 PM, Stefan Wahren > >> wrote: > >> > >> >> I always get 0x5e5b5513 with or without your patch. > >> > > >> > very strange. Do you have any idea why IO1_STABLE is permanent low? > >> > >> On my case it is always 1. > > > > i expected the same behavior on my hardware. > > > > Do you use u-boot as bootloader? > > Yes, I do. i will try to test it with u-boot. > > >> > >> > Can you confirm the behavior according to your flash issue? > >> > >> In my tests IO1_STABLE stays the same. > > > > This wasn't the intension of my second question. I wanted to know about the > > state of the SPI NOR flash detection process. > > > > Does it sucessed if you apply the patch, but revert the changes in > > clk_ref_set_rate() from clk-ref.c? > > I don't have my mx28evk setup available at the moment, but when I > applied your patch and reverted all the changes in clk-ref.c, then the > SPI flash detection works. > > I haven't tested to only reverting the changes inside > clk_ref_set_rate(), but I can do it tomorrow. I think the reason for the problem in the flash detection is caused by the misaligned access on the frac register. Maybe you want to try the following after the second patch is reverted. Stefan ------------>8---------------------------------------------------------- diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c index 9fc9359..87969e3 100644 --- a/drivers/clk/mxs/clk-imx23.c +++ b/drivers/clk/mxs/clk-imx23.c @@ -73,8 +73,10 @@ static void __init clk_misc_init(void) * 480 MHz seems too high to be ssp clock source directly, * so set frac to get a 288 MHz ref_io. */ - writel_relaxed(0x3f << BP_FRAC_IOFRAC, FRAC + CLR); - writel_relaxed(30 << BP_FRAC_IOFRAC, FRAC + SET); + val = readl_relaxed(FRAC); + val &= ~(0x3f << BP_FRAC_IOFRAC); + val |= 30 << BP_FRAC_IOFRAC; + writel_relaxed(val, FRAC); } static const char *sel_pll[] __initconst = { "pll", "ref_xtal", }; diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c index a6c3501..e47ad69 100644 --- a/drivers/clk/mxs/clk-imx28.c +++ b/drivers/clk/mxs/clk-imx28.c @@ -118,10 +118,15 @@ static void __init clk_misc_init(void) /* * 480 MHz seems too high to be ssp clock source directly, * so set frac0 to get a 288 MHz ref_io0 and ref_io1. + * According to reference manual we must modify frac bytewise. */ val = readl_relaxed(FRAC0); - val &= ~((0x3f << BP_FRAC0_IO0FRAC) | (0x3f << BP_FRAC0_IO1FRAC)); - val |= (30 << BP_FRAC0_IO0FRAC) | (30 << BP_FRAC0_IO1FRAC); + val &= ~(0x3f << BP_FRAC0_IO0FRAC); + val |= 30 << BP_FRAC0_IO0FRAC; + writel_relaxed(val, FRAC0); + val = readl_relaxed(FRAC0); + val &= ~(0x3f << BP_FRAC0_IO1FRAC); + val |= 30 << BP_FRAC0_IO1FRAC; writel_relaxed(val, FRAC0); }