From: Oleksandr Date: Tue, 12 Feb 2019 21:52:31 +0200 Subject: [U-Boot] [PATCH 1/3] ARM: rmobile: Switch CPU to non-secure HYP mode for r8a7790 based boards In-Reply-To: References: <1548956309-24113-1-git-send-email-olekstysh@gmail.com> <1548956309-24113-2-git-send-email-olekstysh@gmail.com> <795f212f-6178-b71a-c2de-5f84e38203e5@gmail.com> <285fafea-aaf4-a307-1f78-eb8752eb6904@gmail.com> <9c8a4b4b-5da5-23b5-80de-f629a7597e79@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On 09.02.19 18:35, Marek Vasut wrote: Hi > On 2/7/19 6:19 PM, Oleksandr wrote: > > [...] > >>>>>> +        /* Update registers with correct frequency */ >>>>>> +        writel(freq, TIMER_BASE + TIMER_CNTFID0); >>>>>> +        asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq)); >>>>>> + >>>>>> +        /* Make sure arch timer is started by setting bit 0 of >>>>>> CNTCR */ >>>>>> +        writel(1, TIMER_BASE + TIMER_CNTCR); >>>>> Shouldn't this be in the timer driver instead ? >>>> Which timer driver? Probably, I missed something, but I didn't find any >>>> arch timer driver being used for Gen2. >>>> >>>> I see that TMU timer (arch/sh/lib/time.c) is used as a system timer, but >>>> it is yet another IP. >>>> >>>> Would it be correct, if I move arch timer updating code to >>>> arch/arm/mach-rmobile directory? >>>> >>>> Actually, at the same location the corresponding code lives in Linux: >>>> >>>> https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm/mach-shmobile/setup-rcar-gen2.c#L61 >>>> >>> Presumably if this is something else than TMU, it needs proper driver >>> that goes into drivers/ . >> Did I get your point correctly that new driver (specially for Gen2 arch >> timer) should be introduced in U-Boot and >> >> the only one thing it is intended to do is to configure that timer for >> the future use by Linux/Hypervisor? >> >> If yes, the only question I have is how that new driver is going to be >> populated? There is no corresponding node for arch timer in the device >> tree. >> >> https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm/boot/dts/r8a7790.dtsi >> >> >> So, do I need specially for this case add arch timer node with reg and >> compatible properties? >> >> Sorry if I ask obvious questions, not familiar enough with U-Boot. > You would need a DT entry and a bit of code to start the timer in case > the PSCI is enabled, yes. This would then fit into the DM/DT paradigm. I understand your point, thank you. Will create a simple driver for arch timer in V2. > >>>>>> +    } >>>>>> +} >>>>>> + >>>>>> +/* >>>>>> + * In order not to break compilation if someone decides to build >>>>>> with PSCI >>>>>> + * support disabled, keep these dummy functions. >>>>>> + */ >>>>> That's currently the only use-case. >>>> Shall I drop this comment and dummy functions below? >>> Since there is no PSCI support, yes. >> Understand. >> >>> [...] >>> >>> I'd like to have a cover letter go with V2, which describes what you're >>> trying to achieve here. >> Yes, sure. Cover letter is present for the current V1 as well. >> >> I thought that I had CC-ed all. >> >> This is a link to it: >> >> http://u-boot.10912.n7.nabble.com/PATCH-0-3-PSCI-support-for-r8a7790-SoC-Lager-Stout-boards-td357352.html > Thanks >