Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK

2018-04-01 Thread Simon Glass
Hi Jagan,

On 2 April 2018 at 12:57, Jagan Teki  wrote:
>
> On Fri, Mar 30, 2018 at 4:13 AM, Simon Glass  wrote:
> > Hi Jagan,
> >
> > On 28 March 2018 at 02:04, Jagan Teki  wrote:
> >> On Mon, Sep 4, 2017 at 9:57 PM,   wrote:
> >>> Hi Tom,
> >>>
> >>> On 7 August 2017 at 09:39, Tom Rini  wrote:
>  On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote:
> 
> > The CONFIG_BLK conversion involves quite invasive changes in the U-Boot
> > code, with #ifdefs and different code paths. We should try to move over 
> > to
> > this soon so we can drop the old code.
> >>
> >> I hope this will applicable to SPL too?
> >>
> >> If so, we are having SPL size issues with few Allwinner families, if
> >> enable SPL_DM any suggestions?
> >
> > I don't think we can require BLK for SPL / TPL, or even DM for that
> > matter. We should use it when size permits.
>
> But we can still maintain non-dm code in driver with #ifdef right?
> indeed migration plan is to remove that.

I think for drivers that have to work with SPL and cannot use DM due
to code size, we have to provide a way. But I think over time, this
will fade out, as SoCs have more SRAM. Also with CONFIG_OF_PLATDATA
the penalty is very small.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK

2018-04-01 Thread Jagan Teki
On Fri, Mar 30, 2018 at 4:13 AM, Simon Glass  wrote:
> Hi Jagan,
>
> On 28 March 2018 at 02:04, Jagan Teki  wrote:
>> On Mon, Sep 4, 2017 at 9:57 PM,   wrote:
>>> Hi Tom,
>>>
>>> On 7 August 2017 at 09:39, Tom Rini  wrote:
 On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote:

> The CONFIG_BLK conversion involves quite invasive changes in the U-Boot
> code, with #ifdefs and different code paths. We should try to move over to
> this soon so we can drop the old code.
>>
>> I hope this will applicable to SPL too?
>>
>> If so, we are having SPL size issues with few Allwinner families, if
>> enable SPL_DM any suggestions?
>
> I don't think we can require BLK for SPL / TPL, or even DM for that
> matter. We should use it when size permits.

But we can still maintain non-dm code in driver with #ifdef right?
indeed migration plan is to remove that.

Jagan.

-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 31/36] rockchip: rk3399: prepare to use common board file

2018-04-01 Thread Kever Yang


On 04/02/2018 05:59 AM, Philipp Tomsich wrote:
>>
>> DECLARE_GLOBAL_DATA_PTR;
>>
>> -int board_init(void)
>> -{
>> -    int ret;
>> -
>> -    /*
>> - * We need to call into regulators_enable_boot_on() again, as
>> the call
>> - * during SPL may have not included all regulators.
>> - */
>> -    ret = regulators_enable_boot_on(false);
>> -    if (ret)
>> -    debug("%s: Cannot enable boot on regulator\n", __func__);
>> -
>
> This is critical during SPL for us.
> I don't see this being moved anywhere else. 

This will be in common board.c in coming up patch.

Thanks,
- Kever
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 30/36] rockchip: lion-rk3368: remove rockchip timer

2018-04-01 Thread Kever Yang


On 04/02/2018 05:34 AM, Philipp Tomsich wrote:
>
>
> On Tue, 27 Mar 2018, Kever Yang wrote:
>
>> We use ARM generic timer.
>
> A more enlightening commit message, please.
>
>> Signed-off-by: Kever Yang 
>
> See below for comments.
>
>> ---
>>
>> configs/lion-rk3368_defconfig | 4 
>> 1 file changed, 4 deletions(-)
>>
>> diff --git a/configs/lion-rk3368_defconfig
>> b/configs/lion-rk3368_defconfig
>> index 8a95ce3..89c4d76 100644
>> --- a/configs/lion-rk3368_defconfig
>> +++ b/configs/lion-rk3368_defconfig
>> @@ -88,10 +88,6 @@ CONFIG_DEBUG_UART_ANNOUNCE=y
>> CONFIG_DEBUG_UART_SKIP_INIT=y
>> CONFIG_ROCKCHIP_SPI=y
>> CONFIG_SYSRESET=y
>> -CONFIG_TIMER=y
>> -CONFIG_SPL_TIMER=y
>> -CONFIG_TPL_TIMER=y
>> -CONFIG_ROCKCHIP_TIMER=y
>
> NAK: The reason to not do this (and to have a DM time for the RK3368)
> has been discussed, when we originally added this: SPL should not be
> specific on the software stack.
>
> Consider the following cases:
> 1. Boot to Linux (or U-Boot in EL2): this always includes an ATF as the
>    next-stage... so no need to setup the secure time here, as ATF will
>    take care of this anyway.
> 2. Boot to U-Boot in EL3 (e.g. from the Miniloader): we shouldn't rely on
>    the secure time having been set up (but U-Boot can't do it either, as
>    the same binary could either run at EL3 or at EL2).
>

I'm sure(and we have to make sure) the secure timer have been set up before
U-Boot proper, no matter who do it(SPL/miniloader/trust), because kernel is
always using ARM generic timer as clock source. If the kernel can rely
on it,
then U-Boot can rely on it.

In rockchip binaries, ddr.bin will do setup the secure timer and in
U-Boot project,
SPL or TPL need to do this.

You can still use rockchip timer as DM timer for lion-rk3368, although I
prefer
all SoCs/boards to use the timer in a same way.

Thanks,
- Kever
> So the consensus was to not have U-Boot rely on the secure timer to be
> initialised... especially, as it doesn't have to rely on this.
>
> Note that this is also true for the RK3399, but I need to finish up
> further changes to the DRAM init code, as that currently relies on
> having a timebase before the DM timer is available.
>
>> CONFIG_USE_TINY_PRINTF=y
>> CONFIG_SPL_TINY_MEMSET=y
>> CONFIG_LZO=y
>>
>


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK

2018-04-01 Thread Simon Glass
Hi,

On 2 April 2018 at 11:07, Peter Robinson  wrote:
> On Mon, Apr 2, 2018 at 3:56 AM, Simon Glass  wrote:
>> Hi Peter,
>>
>> On 2 April 2018 at 10:45, Peter Robinson  wrote:
>>> On Mon, Apr 2, 2018 at 3:28 AM, Simon Glass  wrote:
 Hi Andre,

 On 2 April 2018 at 09:43, André Przywara  wrote:
> Hi,
>
> On 01/04/18 14:19, Tom Rini wrote:
>> On Tue, Mar 27, 2018 at 11:34:19PM +0530, Jagan Teki wrote:
>>> On Mon, Sep 4, 2017 at 9:57 PM,   wrote:
 Hi Tom,

 On 7 August 2017 at 09:39, Tom Rini  wrote:
> On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote:
>
>> The CONFIG_BLK conversion involves quite invasive changes in the 
>> U-Boot
>> code, with #ifdefs and different code paths. We should try to move 
>> over to
>> this soon so we can drop the old code.
>>>
>>> I hope this will applicable to SPL too?
>>>
>>> If so, we are having SPL size issues with few Allwinner families, if
>>> enable SPL_DM any suggestions?
>>
>> How close, and have you looked at the u-boot-spl.map to see what you can
>> maybe trim?  Or areas to look at reducing in code complexity?
>
> The Boot ROM limit for all Allwinner SoCs known so far is 32KB. The A64
> SPL (AArch64) stands at ~31KB at the moment. Yes, we went over the map
> and picked most low hanging fruits already.
> So far we discussed several mitigations, but mostly to cover the
> "natural" SPL code size grow over time:
> 1) The AArch64 exception vectors take 1KB, plus an unnecessary ~1.6KB of
> padding (for a 2KB architectural alignment). Given that the vectors are
> used only for debugging purposes, we could scrap them entirely or
> construct them on the fly in some other SRAM. So would free about 2.5KB,
> ideally. Lowest hanging fruit so far.
> 2) We can compile the SPL in AArch32 mode, which can use the Thumb2
> encoding. This reduces the size significantly, to about 20KB. The
> disadvantage is using a second cross-compiler or even a additional
> cross-compiler for native builds, complicating the build process.
> I maintain a branch for enabling FEL booting here [1], which provides
> two _defconfigs (one 32-bit for SPL, one 64-bit for U-Boot proper).
> There are no technical disadvantages in running the SPL in 32-bit, so
> this is mostly a build issue.

 FYI 32-bit tegra compiles SPL with ARMv4T and U-Boot proper with
 ARMv7. It should be fairly easy to do,
>>>
>>> ARMv4 and ARMv7 are both 32 bit though, as opposed to 32 and 64 bit in
>>> the case of Allwinner A64
>>
>> Yes, but that is just a matter of compiler or compiler flags. My point
>> was we should be able to use different build for each without too much
>> work.
>
> It's a lot more work for the way most distros build u-boot, but TBH
> the sooner I don't need to the better ;-)

I don't understand the last part of that sentence. But getting back to
the original question, DM does add size, DT adds more. There is
CONFIG_OF_PLATDATA which essentially removes the DT cost, but DM
remains (perhaps 5KB at a guess on 64-bit). So we will have pressure
to avoid using DM in SPL for some time to come, I think.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK

2018-04-01 Thread Peter Robinson
On Mon, Apr 2, 2018 at 3:56 AM, Simon Glass  wrote:
> Hi Peter,
>
> On 2 April 2018 at 10:45, Peter Robinson  wrote:
>> On Mon, Apr 2, 2018 at 3:28 AM, Simon Glass  wrote:
>>> Hi Andre,
>>>
>>> On 2 April 2018 at 09:43, André Przywara  wrote:
 Hi,

 On 01/04/18 14:19, Tom Rini wrote:
> On Tue, Mar 27, 2018 at 11:34:19PM +0530, Jagan Teki wrote:
>> On Mon, Sep 4, 2017 at 9:57 PM,   wrote:
>>> Hi Tom,
>>>
>>> On 7 August 2017 at 09:39, Tom Rini  wrote:
 On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote:

> The CONFIG_BLK conversion involves quite invasive changes in the 
> U-Boot
> code, with #ifdefs and different code paths. We should try to move 
> over to
> this soon so we can drop the old code.
>>
>> I hope this will applicable to SPL too?
>>
>> If so, we are having SPL size issues with few Allwinner families, if
>> enable SPL_DM any suggestions?
>
> How close, and have you looked at the u-boot-spl.map to see what you can
> maybe trim?  Or areas to look at reducing in code complexity?

 The Boot ROM limit for all Allwinner SoCs known so far is 32KB. The A64
 SPL (AArch64) stands at ~31KB at the moment. Yes, we went over the map
 and picked most low hanging fruits already.
 So far we discussed several mitigations, but mostly to cover the
 "natural" SPL code size grow over time:
 1) The AArch64 exception vectors take 1KB, plus an unnecessary ~1.6KB of
 padding (for a 2KB architectural alignment). Given that the vectors are
 used only for debugging purposes, we could scrap them entirely or
 construct them on the fly in some other SRAM. So would free about 2.5KB,
 ideally. Lowest hanging fruit so far.
 2) We can compile the SPL in AArch32 mode, which can use the Thumb2
 encoding. This reduces the size significantly, to about 20KB. The
 disadvantage is using a second cross-compiler or even a additional
 cross-compiler for native builds, complicating the build process.
 I maintain a branch for enabling FEL booting here [1], which provides
 two _defconfigs (one 32-bit for SPL, one 64-bit for U-Boot proper).
 There are no technical disadvantages in running the SPL in 32-bit, so
 this is mostly a build issue.
>>>
>>> FYI 32-bit tegra compiles SPL with ARMv4T and U-Boot proper with
>>> ARMv7. It should be fairly easy to do,
>>
>> ARMv4 and ARMv7 are both 32 bit though, as opposed to 32 and 64 bit in
>> the case of Allwinner A64
>
> Yes, but that is just a matter of compiler or compiler flags. My point
> was we should be able to use different build for each without too much
> work.

It's a lot more work for the way most distros build u-boot, but TBH
the sooner I don't need to the better ;-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK

2018-04-01 Thread Simon Glass
Hi Peter,

On 2 April 2018 at 10:45, Peter Robinson  wrote:
> On Mon, Apr 2, 2018 at 3:28 AM, Simon Glass  wrote:
>> Hi Andre,
>>
>> On 2 April 2018 at 09:43, André Przywara  wrote:
>>> Hi,
>>>
>>> On 01/04/18 14:19, Tom Rini wrote:
 On Tue, Mar 27, 2018 at 11:34:19PM +0530, Jagan Teki wrote:
> On Mon, Sep 4, 2017 at 9:57 PM,   wrote:
>> Hi Tom,
>>
>> On 7 August 2017 at 09:39, Tom Rini  wrote:
>>> On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote:
>>>
 The CONFIG_BLK conversion involves quite invasive changes in the U-Boot
 code, with #ifdefs and different code paths. We should try to move 
 over to
 this soon so we can drop the old code.
>
> I hope this will applicable to SPL too?
>
> If so, we are having SPL size issues with few Allwinner families, if
> enable SPL_DM any suggestions?

 How close, and have you looked at the u-boot-spl.map to see what you can
 maybe trim?  Or areas to look at reducing in code complexity?
>>>
>>> The Boot ROM limit for all Allwinner SoCs known so far is 32KB. The A64
>>> SPL (AArch64) stands at ~31KB at the moment. Yes, we went over the map
>>> and picked most low hanging fruits already.
>>> So far we discussed several mitigations, but mostly to cover the
>>> "natural" SPL code size grow over time:
>>> 1) The AArch64 exception vectors take 1KB, plus an unnecessary ~1.6KB of
>>> padding (for a 2KB architectural alignment). Given that the vectors are
>>> used only for debugging purposes, we could scrap them entirely or
>>> construct them on the fly in some other SRAM. So would free about 2.5KB,
>>> ideally. Lowest hanging fruit so far.
>>> 2) We can compile the SPL in AArch32 mode, which can use the Thumb2
>>> encoding. This reduces the size significantly, to about 20KB. The
>>> disadvantage is using a second cross-compiler or even a additional
>>> cross-compiler for native builds, complicating the build process.
>>> I maintain a branch for enabling FEL booting here [1], which provides
>>> two _defconfigs (one 32-bit for SPL, one 64-bit for U-Boot proper).
>>> There are no technical disadvantages in running the SPL in 32-bit, so
>>> this is mostly a build issue.
>>
>> FYI 32-bit tegra compiles SPL with ARMv4T and U-Boot proper with
>> ARMv7. It should be fairly easy to do,
>
> ARMv4 and ARMv7 are both 32 bit though, as opposed to 32 and 64 bit in
> the case of Allwinner A64

Yes, but that is just a matter of compiler or compiler flags. My point
was we should be able to use different build for each without too much
work.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK

2018-04-01 Thread Peter Robinson
On Mon, Apr 2, 2018 at 3:28 AM, Simon Glass  wrote:
> Hi Andre,
>
> On 2 April 2018 at 09:43, André Przywara  wrote:
>> Hi,
>>
>> On 01/04/18 14:19, Tom Rini wrote:
>>> On Tue, Mar 27, 2018 at 11:34:19PM +0530, Jagan Teki wrote:
 On Mon, Sep 4, 2017 at 9:57 PM,   wrote:
> Hi Tom,
>
> On 7 August 2017 at 09:39, Tom Rini  wrote:
>> On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote:
>>
>>> The CONFIG_BLK conversion involves quite invasive changes in the U-Boot
>>> code, with #ifdefs and different code paths. We should try to move over 
>>> to
>>> this soon so we can drop the old code.

 I hope this will applicable to SPL too?

 If so, we are having SPL size issues with few Allwinner families, if
 enable SPL_DM any suggestions?
>>>
>>> How close, and have you looked at the u-boot-spl.map to see what you can
>>> maybe trim?  Or areas to look at reducing in code complexity?
>>
>> The Boot ROM limit for all Allwinner SoCs known so far is 32KB. The A64
>> SPL (AArch64) stands at ~31KB at the moment. Yes, we went over the map
>> and picked most low hanging fruits already.
>> So far we discussed several mitigations, but mostly to cover the
>> "natural" SPL code size grow over time:
>> 1) The AArch64 exception vectors take 1KB, plus an unnecessary ~1.6KB of
>> padding (for a 2KB architectural alignment). Given that the vectors are
>> used only for debugging purposes, we could scrap them entirely or
>> construct them on the fly in some other SRAM. So would free about 2.5KB,
>> ideally. Lowest hanging fruit so far.
>> 2) We can compile the SPL in AArch32 mode, which can use the Thumb2
>> encoding. This reduces the size significantly, to about 20KB. The
>> disadvantage is using a second cross-compiler or even a additional
>> cross-compiler for native builds, complicating the build process.
>> I maintain a branch for enabling FEL booting here [1], which provides
>> two _defconfigs (one 32-bit for SPL, one 64-bit for U-Boot proper).
>> There are no technical disadvantages in running the SPL in 32-bit, so
>> this is mostly a build issue.
>
> FYI 32-bit tegra compiles SPL with ARMv4T and U-Boot proper with
> ARMv7. It should be fairly easy to do,

ARMv4 and ARMv7 are both 32 bit though, as opposed to 32 and 64 bit in
the case of Allwinner A64
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 17/36] rockchip: sdram_common: add common dram_init_banksize

2018-04-01 Thread Kever Yang


On 04/02/2018 05:50 AM, Philipp Tomsich wrote:
>
>
> On Tue, 27 Mar 2018, Kever Yang wrote:
>
>> dram_init_banksize() can be common used by all SoCs, move it into
>> sdram_common.c
>>
>> Signed-off-by: Kever Yang 
>> ---
>>
>> arch/arm/mach-rockchip/sdram_common.c | 63
>> ++-
>> 1 file changed, 62 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-rockchip/sdram_common.c
>> b/arch/arm/mach-rockchip/sdram_common.c
>> index 3a71f09..ff86096 100644
>> --- a/arch/arm/mach-rockchip/sdram_common.c
>> +++ b/arch/arm/mach-rockchip/sdram_common.c
>> @@ -21,13 +21,74 @@ struct ddr_param {
>>
>> #define PARAM_DRAM_INFO_OFFSET 0x200
>>
>> +#define TRUST_PARAMETER_OFFSET    (34 * 1024 * 1024)
>
> This isn't covered by what you commit message states as content for
> this patch.

Will add it.
>
>> +
>> +struct tos_parameter_t {
>> +    u32 version;
>> +    u32 checksum;
>> +    struct {
>> +    char name[8];
>> +    s64 phy_addr;
>> +    u32 size;
>> +    u32 flags;
>> +    } tee_mem;
>> +    struct {
>> +    char name[8];
>> +    s64 phy_addr;
>> +    u32 size;
>> +    u32 flags;
>> +    } drm_mem;
>> +    s64 reserve[8];
>> +};
>> +
>> +int dram_init_banksize(void)
>> +{
>> +    size_t top = min((unsigned long)(gd->ram_size +
>> CONFIG_SYS_SDRAM_BASE),
>> + gd->ram_top);
>> +
>> +#ifdef CONFIG_ARM64
>> +    /* Reserve 0x20 for ATF bl31 */
>> +    gd->bd->bi_dram[0].start = 0x20;
>> +    gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start;
>
> This should only be done when preparing to start a
> IH_OS_ARM_TRUSTED_FIRMWARE.

Yes, you are right, but ATF in ARM64 is not optional, it's mandatory, so
I don't think we need
a #if/#else here.
>
>> +#else
>> +#ifdef CONFIG_SPL_OPTEE
>
> I don't think that this CONFIG_SPL_OPTEE was what the comments in the
> OPTEE thread have arrived at... please check again.
>

Will update and use new MACRO, I leave it there because you have such a
slw response and then a looong time discussion.

Thanks,
- Kever
> Just as an unreleated comment/reminder: you still need to revise the
> other series as per the comments and final decision on how to
> implement it.
>
>> +    struct tos_parameter_t *tos_parameter;
>> +
>> +    tos_parameter = (struct tos_parameter_t *)(CONFIG_SYS_SDRAM_BASE +
>> +    TRUST_PARAMETER_OFFSET);
>> +
>> +    if (tos_parameter->tee_mem.flags == 1) {
>
> Please describe what this 'flags' member means and how it's encoded.
>
>> +    gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
>> +    gd->bd->bi_dram[0].size = tos_parameter->tee_mem.phy_addr
>> +    - CONFIG_SYS_SDRAM_BASE;
>> +    gd->bd->bi_dram[1].start = tos_parameter->tee_mem.phy_addr +
>> +    tos_parameter->tee_mem.size;
>> +    gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
>> +    + top - gd->bd->bi_dram[1].start;
>> +    } else {
>> +    gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
>> +    gd->bd->bi_dram[0].size = 0x840;
>> +    /* Reserve 32M for OPTEE with TA */
>> +    gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE
>> +    + gd->bd->bi_dram[0].size + 0x200;
>> +    gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
>> +    + top - gd->bd->bi_dram[1].start;
>> +    }
>
> This should again only be done, when the appropriate IH_OS_* is entered.
>
>> +#else
>> +    gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
>> +    gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start;
>
> This should be the default (so you can remove the #if paths) once you
> make sure that the other paths are actually called for entering the
> particular IH_OS_* types.
>
>> +#endif
>> +#endif
>> +
>> +    return 0;
>> +}
>> +
>> size_t rockchip_sdram_size(phys_addr_t reg)
>> {
>> u32 rank, col, bk, cs0_row, cs1_row, bw, row_3_4;
>> size_t chipsize_mb = 0;
>> size_t size_mb = 0;
>> u32 ch;
>> -
>
> Ok, but not really needed (unless you want to do a separate 'cosmetic'
> or 'whitespace' patch.  Touching an unrelated function is usually a
> bad idea.
>
>> u32 sys_reg = readl(reg);
>> u32 ch_num = 1 + ((sys_reg >> SYS_REG_NUM_CH_SHIFT)
>>    & SYS_REG_NUM_CH_MASK);
>>
>


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 16/36] rockchip: sdram-common: add api to pass dram info to trust os

2018-04-01 Thread Kever Yang


On 04/02/2018 05:43 AM, Philipp Tomsich wrote:
>
>
> On Tue, 27 Mar 2018, Kever Yang wrote:
>
>> Trust OS decode this info like this:
>> https://github.com/ARM-software/arm-trusted-firmware/blob/master/plat/rockchip/common/drivers/parameter/ddr_parameter.c#L19
>>
>> We have to set a available value, or else we get error info from
>> Trust OS like this:
>> "ERROR:   over or zero region, nr=3145987, max=10"
>
> Please describe what changes the patch makes.
>
>>
>> Signed-off-by: Kever Yang 
>
> See below for requested changes.
>
>> ---
>>
>> arch/arm/include/asm/arch-rockchip/sdram_common.h |  4 
>> arch/arm/mach-rockchip/sdram_common.c | 21
>> +
>> 2 files changed, 25 insertions(+)
>>
>> diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h
>> b/arch/arm/include/asm/arch-rockchip/sdram_common.h
>> index fec8586..55c6b81 100644
>> --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h
>> +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h
>> @@ -55,4 +55,8 @@ size_t rockchip_sdram_size(phys_addr_t reg);
>>
>> /* Called by U-Boot board_init_r for Rockchip SoCs */
>> int dram_init(void);
>> +
>> +/* Write ddr param to a known place for trustos */
>> +int rockchip_setup_ddr_param(struct ram_info *info);
>> +
>> #endif
>> diff --git a/arch/arm/mach-rockchip/sdram_common.c
>> b/arch/arm/mach-rockchip/sdram_common.c
>> index 76dbdc8..3a71f09 100644
>> --- a/arch/arm/mach-rockchip/sdram_common.c
>> +++ b/arch/arm/mach-rockchip/sdram_common.c
>> @@ -12,6 +12,15 @@
>> #include 
>>
>> DECLARE_GLOBAL_DATA_PTR;
>> +struct ddr_param {
>> +    u32 count;
>> +    u32 reserved;
>> +    u64 bank_addr;
>> +    u64 bank_size;
>> +};
>> +
>> +#define PARAM_DRAM_INFO_OFFSET 0x200
>
> Having this a fixed offset feels a bit hackish... especially as this
> is now implemented for all SOCs.

Yes, but it's using in all rockchip binaries now.
I would like to use fdt or ATAGS instead, but this still the most simple
way to implement.
Many modules with different owner in different team need to update if we
use fdt/atags:
- Rockchip ddr.bin to provide dram info, one os_reg may not enough for
those DRAM have more than one bank,
- Rockchip miniloader.bin to decode the DRAM info and pass it to
Trust(ATF/OPTEE);
- ATF/OPTEE get the DRAM info and update what memory it used, and then
passed to U-Boot,
- U-Boot need to decode the DRAM info from previous stage like ddr and
Trust.
- U-Boot TPL equal to rockchip ddr.bin, and U-Boot SPL equal to rockchip
miniloader.bin
7 modules for different SoCs need to update: ddr.bin, miniloader.bin,
atf bl31.bin, optee.bin, tpl, spl, U-Boot.

And here is the problem we may met:
- ddr.bin/TPL only have limited available internal sram, not able to
support fdt modify in most case, so ATAGS or private structure may be used;
- miniloader.bin/U-Boot SPL does not support parse input parameter,
miniloader event not support fdt now;
- U-Boot does not support parse input parameter;

So we have to use what already use in product before we make new
solution work in all modules.

Thanks,
- Kever
>
>> +
>> size_t rockchip_sdram_size(phys_addr_t reg)
>> {
>> u32 rank, col, bk, cs0_row, cs1_row, bw, row_3_4;
>> @@ -81,3 +90,15 @@ ulong board_get_usable_ram_top(ulong total_size)
>>
>> return (gd->ram_top > top) ? top : gd->ram_top;
>> }
>> +
>> +int rockchip_setup_ddr_param(struct ram_info *info)
>> +{
>> +    struct ddr_param *dinfo = (struct ddr_param
>> *)CONFIG_SYS_SDRAM_BASE +
>> +    PARAM_DRAM_INFO_OFFSET;
>> +
>> +    dinfo->count = 1;
>> +    dinfo->bank_addr = info->base;
>> +    dinfo->bank_size = info->size;
>> +
>> +    return 0;
>> +}
>
> This setup should only be performed when preparing the system to enter
> the ATF.  So you will need to hook it into path where the ATF is
> prepared for being jumped into.
>
> I would further prefer (but this is a personal preference) to
> eventually move to using the FDT we inject into the ATF to convey this
> information.
>
>>
>


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK

2018-04-01 Thread Simon Glass
[resending from correct address]

Hi Andre,

On 2 April 2018 at 09:43, André Przywara  wrote:
> Hi,
>
> On 01/04/18 14:19, Tom Rini wrote:
>> On Tue, Mar 27, 2018 at 11:34:19PM +0530, Jagan Teki wrote:
>>> On Mon, Sep 4, 2017 at 9:57 PM,   wrote:
 Hi Tom,

 On 7 August 2017 at 09:39, Tom Rini  wrote:
> On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote:
>
>> The CONFIG_BLK conversion involves quite invasive changes in the U-Boot
>> code, with #ifdefs and different code paths. We should try to move over 
>> to
>> this soon so we can drop the old code.
>>>
>>> I hope this will applicable to SPL too?
>>>
>>> If so, we are having SPL size issues with few Allwinner families, if
>>> enable SPL_DM any suggestions?
>>
>> How close, and have you looked at the u-boot-spl.map to see what you can
>> maybe trim?  Or areas to look at reducing in code complexity?
>
> The Boot ROM limit for all Allwinner SoCs known so far is 32KB. The A64
> SPL (AArch64) stands at ~31KB at the moment. Yes, we went over the map
> and picked most low hanging fruits already.
> So far we discussed several mitigations, but mostly to cover the
> "natural" SPL code size grow over time:
> 1) The AArch64 exception vectors take 1KB, plus an unnecessary ~1.6KB of
> padding (for a 2KB architectural alignment). Given that the vectors are
> used only for debugging purposes, we could scrap them entirely or
> construct them on the fly in some other SRAM. So would free about 2.5KB,
> ideally. Lowest hanging fruit so far.
> 2) We can compile the SPL in AArch32 mode, which can use the Thumb2
> encoding. This reduces the size significantly, to about 20KB. The
> disadvantage is using a second cross-compiler or even a additional
> cross-compiler for native builds, complicating the build process.
> I maintain a branch for enabling FEL booting here [1], which provides
> two _defconfigs (one 32-bit for SPL, one 64-bit for U-Boot proper).
> There are no technical disadvantages in running the SPL in 32-bit, so
> this is mostly a build issue.

FYI 32-bit tegra compiles SPL with ARMv4T and U-Boot proper with
ARMv7. It should be fairly easy to do,

> 3) Try to use ILP32 for the AArch64 SPL build. This reduces the pointer
> size and sizeof(long) to be 32-bit and should help, though I haven't
> been able to successfully compile it yet (relocation types problems).
> Despite lacking mainline support for AArch64 ILP32 in Linux and
> glibc(?), GCC supports it for quite a while already. Unknown saving effect.
> 4) Use runtime decompression. Most SoCs have larger or more SRAM than
> the 32KB, so we could leverage this. Siarhei knows more about this.
> 5) Use a TPL. Haven't looked at this in detail yet.
>
> So 1) would be the easiest to pursue, but 2.5KB are not enough to offset
> the >10 KB toll the DM_SPL support actually takes.

Is this the cost on 64-bit?

I wonder if CONFIG_OF_PLATDATA might be an option?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK

2018-04-01 Thread Simon Glass
Hi Andre,

On 2 April 2018 at 09:43, André Przywara  wrote:
> Hi,
>
> On 01/04/18 14:19, Tom Rini wrote:
>> On Tue, Mar 27, 2018 at 11:34:19PM +0530, Jagan Teki wrote:
>>> On Mon, Sep 4, 2017 at 9:57 PM,   wrote:
 Hi Tom,

 On 7 August 2017 at 09:39, Tom Rini  wrote:
> On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote:
>
>> The CONFIG_BLK conversion involves quite invasive changes in the U-Boot
>> code, with #ifdefs and different code paths. We should try to move over 
>> to
>> this soon so we can drop the old code.
>>>
>>> I hope this will applicable to SPL too?
>>>
>>> If so, we are having SPL size issues with few Allwinner families, if
>>> enable SPL_DM any suggestions?
>>
>> How close, and have you looked at the u-boot-spl.map to see what you can
>> maybe trim?  Or areas to look at reducing in code complexity?
>
> The Boot ROM limit for all Allwinner SoCs known so far is 32KB. The A64
> SPL (AArch64) stands at ~31KB at the moment. Yes, we went over the map
> and picked most low hanging fruits already.
> So far we discussed several mitigations, but mostly to cover the
> "natural" SPL code size grow over time:
> 1) The AArch64 exception vectors take 1KB, plus an unnecessary ~1.6KB of
> padding (for a 2KB architectural alignment). Given that the vectors are
> used only for debugging purposes, we could scrap them entirely or
> construct them on the fly in some other SRAM. So would free about 2.5KB,
> ideally. Lowest hanging fruit so far.
> 2) We can compile the SPL in AArch32 mode, which can use the Thumb2
> encoding. This reduces the size significantly, to about 20KB. The
> disadvantage is using a second cross-compiler or even a additional
> cross-compiler for native builds, complicating the build process.
> I maintain a branch for enabling FEL booting here [1], which provides
> two _defconfigs (one 32-bit for SPL, one 64-bit for U-Boot proper).
> There are no technical disadvantages in running the SPL in 32-bit, so
> this is mostly a build issue.

FYI 32-bit tegra compiles SPL with ARMv4T and U-Boot proper with
ARMv7. It should be fairly easy to do,

> 3) Try to use ILP32 for the AArch64 SPL build. This reduces the pointer
> size and sizeof(long) to be 32-bit and should help, though I haven't
> been able to successfully compile it yet (relocation types problems).
> Despite lacking mainline support for AArch64 ILP32 in Linux and
> glibc(?), GCC supports it for quite a while already. Unknown saving effect.
> 4) Use runtime decompression. Most SoCs have larger or more SRAM than
> the 32KB, so we could leverage this. Siarhei knows more about this.
> 5) Use a TPL. Haven't looked at this in detail yet.
>
> So 1) would be the easiest to pursue, but 2.5KB are not enough to offset
> the >10 KB toll the DM_SPL support actually takes.

Is this the cost on 64-bit?

I wonder if CONFIG_OF_PLATDATA might be an option?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 06/36] rockchip: add IRAM_START_ADDR for all SoCs

2018-04-01 Thread Kever Yang


On 04/02/2018 05:00 AM, Philipp Tomsich wrote:
>
>
> On Tue, 27 Mar 2018, Kever Yang wrote:
>
>> We add this for get the location for boot device of bootrom.
>
> Your commit message should be specific enough, so the motivation for
> the change, where it fits into the overall architecture and what is
> changed are apparent.
>
>> Signed-off-by: Kever Yang 
>> Acked-by: Philipp Tomsich 
>
> See below for requested changes.
>
>> ---
>>
>> arch/arm/mach-rockchip/Kconfig | 17 +
>> 1 file changed, 17 insertions(+)
>>
>> diff --git a/arch/arm/mach-rockchip/Kconfig
>> b/arch/arm/mach-rockchip/Kconfig
>> index 5dfe452..98bf935 100644
>> --- a/arch/arm/mach-rockchip/Kconfig
>> +++ b/arch/arm/mach-rockchip/Kconfig
>> @@ -209,6 +209,23 @@ config ROCKCHIP_STIMER_BASE
>>   The secure timer inited in SPL/TPL in secure word, ARM generic
>> timer
>>   works after this timer work.
>>
>> +config ROCKCHIP_IRAM_START_ADDR
>> +    hex "Rockchip Secure timer base address"
>
> Huh: copy-and-paste?

Sorry, my fault, will fix in next version.

Thanks,
- Kever
>
>> +    default 0xff0e if ROCKCHIP_PX30
>
> See my earlier comment regarding changes specific to the PX30.
>
>> +    default 0x1008 if ROCKCHIP_RK3036
>> +    default 0x1008 if ROCKCHIP_RK3128
>> +    default 0x1008 if ROCKCHIP_RK3188
>> +    default 0x1008 if ROCKCHIP_RK322X
>> +    default 0xff70 if ROCKCHIP_RK3288
>> +    default 0xff091000 if ROCKCHIP_RK3328
>> +    default 0xff8c if ROCKCHIP_RK3368
>> +    default 0xff8c if ROCKCHIP_RK3399
>> +    default 0x1008 if ROCKCHIP_RV1108
>> +    default 0
>> +    help
>> +  The IRAM start addr is to locate variant of the boot device from
>> +  bootrom.
>
> The same comment as for the secure timer-base applies here.
> This is way to important to have it in Kconfig, where a user can
> easily override.
>
>> +
>> config ROCKCHIP_SPL_RESERVE_IRAM
>> hex "Size of IRAM reserved in SPL"
>> default 0
>>
>


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,05/36] rockchip: add STIMER_BASE for all SoCs

2018-04-01 Thread Kever Yang


On 04/02/2018 04:58 AM, Philipp Tomsich wrote:
>
>
> On Tue, 27 Mar 2018, Kever Yang wrote:
>
>> STIMER is can only access in secure mode if the SoCs supports trust,
>> and it locate in alive power domain, as the source of ARM arch/generic
>> timer, we add a base addr for all SoCs so that we can init with a common
>> function.
>
> The commit message does not really tell what the source changes are

Then I have no idea what kind information need to add in this commit
message,
could you make it more clear?
I can add message about there is a coming up patch to use this address.
> (although it seems to describe part of the motivation for this change).
>
>>
>> Signed-off-by: Kever Yang 
>> Acked-by: Philipp Tomsich 
>
> See below for requested changes.
>
>> ---
>>
>> arch/arm/mach-rockchip/Kconfig | 19 +++
>> 1 file changed, 19 insertions(+)
>>
>> diff --git a/arch/arm/mach-rockchip/Kconfig
>> b/arch/arm/mach-rockchip/Kconfig
>> index 007cb22..5dfe452 100644
>> --- a/arch/arm/mach-rockchip/Kconfig
>> +++ b/arch/arm/mach-rockchip/Kconfig
>> @@ -190,6 +190,25 @@ config ROCKCHIP_BOOT_MODE_REG
>>   The Soc will enter to different boot mode(defined in
>> asm/arch/boot_mode.h)
>>   according to the value from this register.
>>
>> +config ROCKCHIP_STIMER_BASE
>> +    hex "Rockchip Secure timer base address"
>> +    default 0xff220020 if ROCKCHIP_PX30
>
> We don't have support for the PX30 in the U-Boot code base yet.
> Until a series to add support for the PX30 comes in, you should not
> have this here yet (and then add this specific case when the PX30
> support is added).
>
>> +    default 0x200440a0 if ROCKCHIP_RK3036
>> +    default 0x2000e000 if ROCKCHIP_RK3066
>> +    default 0x20018020 if ROCKCHIP_RK3126
>> +    default 0x200440a0 if ROCKCHIP_RK3128
>> +    default 0x2000e000 if ROCKCHIP_RK3188
>> +    default 0x110d0020 if ROCKCHIP_RK322X
>> +    default 0xff810020 if ROCKCHIP_RK3288
>> +    default 0xff1d0020 if ROCKCHIP_RK3328
>> +    default 0xff830020 if ROCKCHIP_RK3368
>> +    default 0xff8680a0 if ROCKCHIP_RK3399
>> +    default 0x10350020 if ROCKCHIP_RV1108
>> +    default 0
>> +    help
>> +  The secure timer inited in SPL/TPL in secure word, ARM generic
>> timer
>> +  works after this timer work.
>
> This should not be in Kconfig and rather in a header-file.

I think it's better to make this information in one place instead of in
different
header files(more then 10 soc header files).
> With what you do here, a user (e.g. via 'make menuconfig') or a
> defconfig file (e.g. due to a typo) could accidentially change
> overwrite this.

This value connect with the SoC type, I don't understand what kind of
typo will overwrite this.

Thanks,
- Kever
>
>> +
>> config ROCKCHIP_SPL_RESERVE_IRAM
>> hex "Size of IRAM reserved in SPL"
>> default 0
>>
>


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: Add migration plan for CONFIG_BLK

2018-04-01 Thread André Przywara
Hi,

On 01/04/18 14:19, Tom Rini wrote:
> On Tue, Mar 27, 2018 at 11:34:19PM +0530, Jagan Teki wrote:
>> On Mon, Sep 4, 2017 at 9:57 PM,   wrote:
>>> Hi Tom,
>>>
>>> On 7 August 2017 at 09:39, Tom Rini  wrote:
 On Sat, Aug 05, 2017 at 03:45:53PM -0600, Simon Glass wrote:

> The CONFIG_BLK conversion involves quite invasive changes in the U-Boot
> code, with #ifdefs and different code paths. We should try to move over to
> this soon so we can drop the old code.
>>
>> I hope this will applicable to SPL too?
>>
>> If so, we are having SPL size issues with few Allwinner families, if
>> enable SPL_DM any suggestions?
> 
> How close, and have you looked at the u-boot-spl.map to see what you can
> maybe trim?  Or areas to look at reducing in code complexity?

The Boot ROM limit for all Allwinner SoCs known so far is 32KB. The A64
SPL (AArch64) stands at ~31KB at the moment. Yes, we went over the map
and picked most low hanging fruits already.
So far we discussed several mitigations, but mostly to cover the
"natural" SPL code size grow over time:
1) The AArch64 exception vectors take 1KB, plus an unnecessary ~1.6KB of
padding (for a 2KB architectural alignment). Given that the vectors are
used only for debugging purposes, we could scrap them entirely or
construct them on the fly in some other SRAM. So would free about 2.5KB,
ideally. Lowest hanging fruit so far.
2) We can compile the SPL in AArch32 mode, which can use the Thumb2
encoding. This reduces the size significantly, to about 20KB. The
disadvantage is using a second cross-compiler or even a additional
cross-compiler for native builds, complicating the build process.
I maintain a branch for enabling FEL booting here [1], which provides
two _defconfigs (one 32-bit for SPL, one 64-bit for U-Boot proper).
There are no technical disadvantages in running the SPL in 32-bit, so
this is mostly a build issue.
3) Try to use ILP32 for the AArch64 SPL build. This reduces the pointer
size and sizeof(long) to be 32-bit and should help, though I haven't
been able to successfully compile it yet (relocation types problems).
Despite lacking mainline support for AArch64 ILP32 in Linux and
glibc(?), GCC supports it for quite a while already. Unknown saving effect.
4) Use runtime decompression. Most SoCs have larger or more SRAM than
the 32KB, so we could leverage this. Siarhei knows more about this.
5) Use a TPL. Haven't looked at this in detail yet.

So 1) would be the easiest to pursue, but 2.5KB are not enough to offset
the >10 KB toll the DM_SPL support actually takes.

Cheers,
Andre.


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 02/36] rockchip: add common MACRO to enable sys arch timer

2018-04-01 Thread Kever Yang


On 04/02/2018 04:51 AM, Philipp Tomsich wrote:
>
>
> On Tue, 27 Mar 2018, Kever Yang wrote:
>
>> All rockchip SoCs can use ARM arch timer, let's enable it in
>> common header file
>
> Please provide a commit message that is more descriptive of what
> actually happens... i.e. that COUNTER_FREQUENCY gets moved to a common
> header.

Well, will add this info.
> It would be great to document why this will always remain 24M.

All the setting in header file for Rockchip is 24M, doesn't it already a
common code and we should re-use it in common file?

>
>> Signed-off-by: Kever Yang 
>> Acked-by: Philipp Tomsich 
>
> See below for requested changes.
>
>> ---
>>
>> include/configs/rk3368_common.h   | 2 --
>> include/configs/rk3399_common.h   | 2 --
>> include/configs/rockchip-common.h | 4 
>> 3 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/configs/rk3368_common.h
>> b/include/configs/rk3368_common.h
>> index 10f643f..a7fe4ca 100644
>> --- a/include/configs/rk3368_common.h
>> +++ b/include/configs/rk3368_common.h
>> @@ -22,8 +22,6 @@
>> #define CONFIG_SYS_CBSIZE    1024
>> #define CONFIG_SKIP_LOWLEVEL_INIT
>>
>> -#define COUNTER_FREQUENCY   2400
>> -
>> #define CONFIG_SYS_NS16550_MEM32
>>
>> #define CONFIG_SYS_INIT_SP_ADDR    0x0030
>> diff --git a/include/configs/rk3399_common.h
>> b/include/configs/rk3399_common.h
>> index d700bf2..fe8c675 100644
>> --- a/include/configs/rk3399_common.h
>> +++ b/include/configs/rk3399_common.h
>> @@ -17,8 +17,6 @@
>> #define CONFIG_SPL_SPI_LOAD
>> #endif
>>
>> -#define COUNTER_FREQUENCY   2400
>> -
>> #define CONFIG_SYS_NS16550_MEM32
>>
>> #define CONFIG_SYS_INIT_SP_ADDR    0x0030
>> diff --git a/include/configs/rockchip-common.h
>> b/include/configs/rockchip-common.h
>> index 26d41b5..24651ce 100644
>> --- a/include/configs/rockchip-common.h
>> +++ b/include/configs/rockchip-common.h
>> @@ -8,6 +8,10 @@
>> #define _ROCKCHIP_COMMON_H_
>> #include 
>>
>> +#define COUNTER_FREQUENCY   2400
>
> Is this really safe for all past, current and future SOCs (after all:
> you are putting this into 'rockchip-common.h'?

Rockchip timer always have a option of 24M, it may not default in SoC value,
we need to select to use 24M in this case.
>
>> +#define CONFIG_SYS_ARCH_TIMER
>
> I don't agree with putting this here, as the CONFIG_SYS_ARCH_TIMER
> definition is only used on ARMv7, but this file is also included by
> ARMv8 SOCs.

Does this setting break anything in ARMv8?
I don't think we need to add a rockchip_common_armv7.h,
at least we can add macro for the definition is used for CONFIG_ARM64 or
not.

Thanks,
- Kever
>
>> +#define CONFIG_SYS_HZ_CLOCK    2400
>
> You might want to have this refer back to COUNTER_FREQUENCY.
>
>> +
>> #ifndef CONFIG_SPL_BUILD
>>
>> /* First try to boot from SD (index 0), then eMMC (index 1) */
>>
>


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 01/36] rockchip: rk3288: move configure_l2ctlr back to rk3288

2018-04-01 Thread Kever Yang
Hi Philipp,


On 04/02/2018 04:47 AM, Philipp Tomsich wrote:
>
>
> On Tue, 27 Mar 2018, Kever Yang wrote:
>
>> The configure_l2ctlr() is used only by rk3288, do not need to
>> locate in sys_proto.h
>
> Please elaborate on what the function does and why it is not needed by
> any of the other SOCs (after all: it has been available to all SOCs so
> far).

It does not available to all SoCs, only rk3288-board-spl use this function.
Jagan move this function from rk3288-board-spl.c to sys_proto.h because
he think both spl and tpl needs it:
a982d51 armv7: rk3288: Move configure_l2ctlr to common
I move this function back to rk3288 AS-IS and only with checkpatch fix,
I don't think I have to add  so much explanation for this AS-IS function
copy-paste.

>
>> Signed-off-by: Kever Yang 
>> Acked-by: Philipp Tomsich 
>
> This should be a standalone patch and doesn't need to be part of the
> series it is in.  This series has way too many different things
> happening at once and needs to be broken up into individual series
> that do one well-defined thing each.
>
> See below for requested changes.
>
>> ---
>>
>> arch/arm/include/asm/arch-rockchip/sys_proto.h | 22
>> --
>> arch/arm/mach-rockchip/rk3288/rk3288.c | 26
>> +-
>> 2 files changed, 25 insertions(+), 23 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/arch-rockchip/sys_proto.h
>> b/arch/arm/include/asm/arch-rockchip/sys_proto.h
>> index e428d59..3617ac2 100644
>> --- a/arch/arm/include/asm/arch-rockchip/sys_proto.h
>> +++ b/arch/arm/include/asm/arch-rockchip/sys_proto.h
>> @@ -7,27 +7,5 @@
>> #ifndef _ASM_ARCH_SYS_PROTO_H
>> #define _ASM_ARCH_SYS_PROTO_H
>>
>> -#ifdef CONFIG_ROCKCHIP_RK3288
>> -#include 
>> -
>> -static void configure_l2ctlr(void)
>> -{
>> -    uint32_t l2ctlr;
>> -
>> -    l2ctlr = read_l2ctlr();
>> -    l2ctlr &= 0xfffc; /* clear bit0~bit17 */
>> -
>> -    /*
>> -    * Data RAM write latency: 2 cycles
>> -    * Data RAM read latency: 2 cycles
>> -    * Data RAM setup latency: 1 cycle
>> -    * Tag RAM write latency: 1 cycle
>> -    * Tag RAM read latency: 1 cycle
>> -    * Tag RAM setup latency: 1 cycle
>> -    */
>> -    l2ctlr |= (1 << 3 | 1 << 0);
>> -    write_l2ctlr(l2ctlr);
>> -}
>> -#endif /* CONFIG_ROCKCHIP_RK3288 */
>>
>> #endif /* _ASM_ARCH_SYS_PROTO_H */
>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c
>> b/arch/arm/mach-rockchip/rk3288/rk3288.c
>> index acc3b79..1e1c6be 100644
>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
>> @@ -3,15 +3,39 @@
>>  *
>>  * SPDX-License-Identifier: GPL-2.0+
>>  */
>> +#include 
>> #include 
>> #include 
>>
>> #define GRF_SOC_CON2 0xff77024c
>
> Please make this a const-declaration in the function it is needed in.

This const-declaration does not belong to this patch, isn't it?
>
>>
>> +#ifdef CONFIG_SPL_BUILD
>
> Should this really happen both for TPL and SPL?

I think we only need do this once, if TPL do it, then SPL no need to do
it again.

>
>> +static void configure_l2ctlr(void)
>> +{
>> +    u32 l2ctlr;
>> +
>> +    l2ctlr = read_l2ctlr();
>> +    l2ctlr &= 0xfffc; /* clear bit0~bit17 */
>
> What are bits 0...17?
>
>> +
>> +    /*
>> + * Data RAM write latency: 2 cycles
>> + * Data RAM read latency: 2 cycles
>> + * Data RAM setup latency: 1 cycle
>> + * Tag RAM write latency: 1 cycle
>> + * Tag RAM read latency: 1 cycle
>> + * Tag RAM setup latency: 1 cycle
>> + */
>
> Please add a symbolic way to assemble these (i.e. something that makes
> it easy for the casual reader to see what values you are writing to
> which bitfields).
>
>> +    l2ctlr |= (1 << 3 | 1 << 0);
>
> From the "clear bit0 ~ bit17" and this, I assume you actually want to
> do a clrsetbits_le32...

Not really, this write operation is a 'mcr' write to cp15.
>
>> +    write_l2ctlr(l2ctlr);
>> +}
>> +#endif
>> +
>> int arch_cpu_init(void)
>> {
>> /* We do some SoC one time setting here. */
>> -
>> +#ifdef CONFIG_SPL_BUILD
>> +    configure_l2ctlr();
>> +#else
>> /* Use rkpwm by default */
>> rk_setreg(GRF_SOC_CON2, 1 << 0);
>
> Please use a symbolic way to write the (1 << 0), wo it is easy for the
> casual reader to see what gets enabled/disabled here.

Again, this content does not belong to this patch,

Thanks,
- Kever
>
>>
>>
>


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: stm32mp1: add PSCI support

2018-04-01 Thread Tom Rini
On Thu, Mar 29, 2018 at 04:59:21PM +, Patrick DELAUNAY wrote:
> Hi  Mark,
> 
> 
> > -Original Message-
> > From: Mark Rutland [mailto:mark.rutl...@arm.com]
> > 
> > Hi,
> > 
> > On Tue, Mar 20, 2018 at 01:59:03PM +0100, Patrick Delaunay wrote:
> > > Add minimal PSCI support for Linux.
> > >
> > > Signed-off-by: Patrick Delaunay 
> > 
> > > +int __secure psci_features(unsigned int psci_fid) {
> > > + switch (psci_fid) {
> > > + case ARM_PSCI_0_2_FN_PSCI_VERSION:
> > > + case ARM_PSCI_0_2_FN_CPU_ON:
> > > + case ARM_PSCI_0_2_FN_CPU_OFF:
> > > + case ARM_PSCI_0_2_FN_SYSTEM_RESET:
> > > + return 0x0;
> > > + }
> > > + return ARM_PSCI_RET_NI;
> > > +}
> > >
> > > +unsigned int __secure psci_version(void) {
> > > + return ARM_PSCI_VER_1_0;
> > > +}
> > 
> > I'm a bit worried, because while PSCI_VERSION reports PSCI 1.0, this does 
> > not
> > appear to be conformant with teh PSCI 1.0 spec, as some mandatory functions
> > are missing:
> > 
> > * AFFINITY_INFO -- Linux relies on this to ensure that CPUs have exited
> >   the kernel when calling CPU_OFF (e.g. so that we don't free any data /
> >   code that said CPU may be using on the path to calling CPU_OFF).
> > 
> > * SYSTEM_OFF -- Can you implement this similarly to SYSTEM_RESET?
> 
> I push this patch for STM32MP1 to be able to boot the Kernel version on board
> (requested by ST Linux team : https://patchwork.kernel.org/patch/10167343/)
> 
> This patch  a minimal PSCI support to be able to boot 
> And I miss these part of the requirement PSCI v1.0 and also in issue in Linux 
> trace:
> 
> [0.00] psci: probing for conduit method from DT.
> [0.00] psci: PSCIv1.0 detected in firmware.
> [0.00] psci: Using standard PSCI v0.2 function IDs
> [0.00] psci: MIGRATE_INFO_TYPE not supported.
> 
> Thanks to point these point .
> So I will add them in a second patch " arm: stm32mp1: complete PSCI v1.0 
> support"   
> 
> I want keep this patch in v1, to have it merged in v2018.05-rc1, I hope...
> Even if it is only a first step for a full PSCI v1.0 support, that allow 
> linux kernel boot.
> 
> And I need some time to check how to handle SYSTEM_OFF , to do the 
> "completely removes power" because I don't think if it is possible today.
> 
> > > +int __secure psci_cpu_on(u32 __always_unused unused, u32 mpidr, u32
> > > +pc) {
> > 
> > What about the context_id? PSCI 0.2+ mandates it, and some project rely upon
> > it (though Linux currently does not).
> 
> Yes context_id is not used in my code.
> 
> In fact, I use the same psci_cpu_on prototypes and logic than other platform :
>  ./arch/arm/cpu/armv7/sunxi/psci.c:246
> ./arch/arm/mach-uniphier/arm32/psci.c:134
> ./arch/arm/cpu/armv7/ls102xa/psci.S:117
> 
> => all are based on psci_save_target_pc() to save the PC in secure context 
> (psci_target_pc[])
>   ./arch/arm/cpu/armv7/psci-common.c:29
> 
> But context is not saved or used in generic PSCI code, only pc is restored
>   => ./arch/arm/cpu/armv7/psci.S:330
>   r0 = psci_get_target_pc() is called before _do_nonsec_entry
> 
> I will check deeper in this U-Boot PSCI code.
> 
> => I try to solve the problem and push a RFC or a patch  to have feedback 
> form other PSCI user.
>  Even it is not block for Linux point of view, as context ID is not used 
> in linux code always = 0:
>  ./drivers/firmware/psci.c:
>   static int psci_cpu_on(unsigned long cpuid, unsigned long entry_point)
>   
>   err = invoke_psci_fn(fn, cpuid, entry_point, 0);
>  
> > Does some other part of U-Boot do some state tracking? What happens if this 
> > is
> > called for a CPU that's already online?
> 
> No issue,  the CPU continue to run
> TAMP register is only used by BootRom to unpark the cpu on boot, update of 
> the backup have no impact when the CPU is running.
> 
> I will add a comment in the next patch " arm: stm32mp1: complete PSCI v1.0 
> support"  
> and also check if I can add test the cpu state to manage other possible 
> return value (never used in U-Boot):
>   PSCI_RET_ALREADY_ON 
>   PSCI_RET_ON_PENDING
> 
> > 
> > Thanks,
> > Mark.
> 
> Very thanks for the review.
> That allows me to read deeper the PSCI documents.
> 
> Tom:  do you think that this patch can be merged in v2018.05-rc1 ?
>and I will sent a 2nd patch for full PCSI v1.0 support and correct 
> the missing parts reported by Mark.

Lets see how far along you get before the v2018.05 final.  I don't think
it's a good idea to claim PSCI 1.0 support and not provide all of the
required functionality, as that would be breaking the point of declaring
that you support something like that :)  Thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/2] ARC: HSDK: add platform-specific commands

2018-04-01 Thread Tom Rini
On Fri, Mar 30, 2018 at 08:08:19PM +, Alexey Brodkin wrote:
> Hi Tom,
> 
> On Mon, 2018-03-26 at 15:57 +0300, Eugeniy Paltsev wrote:
> > This patch add support of hsdk platform-specific commands:
> > 
> > hsdk_clock set - set clock from axi_freq, cpu_freq and tun_freq
> > environment variables/command line arguments
> > 
> > hsdk_clock get - save clock frequencies to axi_freq, cpu_freq
> > and tun_freq environment variables
> > 
> > hsdk_clock print - show CPU, AXI, DDR and TUNNEL current
> > clock frequencies.
> > 
> > hsdk_clock print_all - show all currently used clock frequencies.
> > 
> > hsdk_init - setup board HW in one of pre-defined configuration
> > (hsdk_hs34 / hsdk_hs36 / hsdk_hs36_ccm / hsdk_hs38 /
> > hsdk_hs38_ccm / hsdk_hs38x2 / hsdk_hs38x3 / hsdk_hs38x4)
> > 
> > hsdk_go - run baremetal application on hsdk configured
> > by hsdk_init command.
> > 
> > This patch changes default behaviour of 'bootm' command:
> > now we are able to set number of CPUs to be kicked by setting
> > 'core_mask' environment variable before 'bootm' command run.
> > 
> > Signed-off-by: Eugeniy Paltsev 
> > ---
> 
> I was about to send you a pull-request containing this one but
> decided to give TravisCI a shot. And what I got was a warning
> due to not yet supported "naked" attribute in GCC 6.x for ARC,
> see https://travis-ci.org/abrodkin/u-boot/jobs/360259472
> 
> Ok I bumped ARC tools to the most recent arc-2017.09 based on
> GCC 7.1 where "naked" attr for ARC is already supported.
> But then I got another warning:
> ->8---
> board/synopsys/hsdk/hsdk.c: In function "hsdk_core_init_f":
> board/synopsys/hsdk/hsdk.c:345:1: error: stack usage computation not 
> supported for this target [-Werror]
>  }
>  ^
> ->8---
> see https://travis-ci.org/abrodkin/u-boot/jobs/360274604
> 
> 
> That happens because GCC for ARC unconditionally tries to compute
> stack requirements for all functions even if they are "naked".
> And for "naked" computed value is negative thus the warning above.
> 
> So far I didn't manage to find a simple way to disable that warning.
> 
> And my question would be how to proceed with this [patch]?
> Given we're seeing a problem in GCC it most probably won't be fixed
> in U-Boot and we'll need to wait before new tools are available.
> 
> Or otherwise we'll start to see "failing" ARC jobs in TravisCI.

Ugh.  (a) get the toolchain fixed to support this correctly and (b)
kludge scripts/gcc-stack-usage.sh to have a 'naked' example too so that
we'll just disable -fstack-usage on ARC for now.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Please pull u-boot-dm

2018-04-01 Thread Simon Glass
Hi Tom,

Here's an assortment of things that were in my queue. Test result is here:

https://travis-ci.org/sglass68/u-boot/builds/360881266


The following changes since commit 81cf7c8d45935a295991fe2cd1df286f0f47511f:

  Merge git://git.denx.de/u-boot-ubi (2018-03-25 12:02:13 -0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-dm.git

for you to fetch changes up to 641599a63df258c3e3cb259c75cdada0cc009d56:

  image.h: add forward declaration of struct fdt_region (2018-04-01
22:19:10 +0800)


Andre Heider (2):
  cmd: cbfs: fix reading the end_of_rom pointer for 64bit archs
  fs: cbfs: fix locating the cbfs header

Andy Yan (1):
  dm: core: make fixed-clock dt scan live dt compatible

Kever Yang (2):
  core: add uclass_get_device_by_phandle_id() api
  pinctrl-uclass: convert to use live dt

Mario Six (1):
  core: ofnode: Fix translation for #size-cells == 0

Masahiro Yamada (3):
  libfdt: move FDT_RAMDISK_OVERHEAD to image-fdt.c
  fdt_region: remove unneeded fdt_internal.h inclusion
  image.h: add forward declaration of struct fdt_region

 arch/sandbox/dts/test.dts| 48

 cmd/cbfs.c   |  2 +-
 common/image-fdt.c   |  3 +++
 drivers/core/fdtaddr.c   | 17 +++--
 drivers/core/ofnode.c|  5 -
 drivers/core/root.c  | 16 +++-
 drivers/core/uclass.c| 26 ++
 drivers/pinctrl/pinctrl-uclass.c | 19 +--
 fs/cbfs/cbfs.c   |  4 ++--
 include/dm/uclass-id.h   |  1 +
 include/dm/uclass.h  | 16 
 include/image.h  |  1 +
 include/linux/libfdt.h   |  3 ---
 lib/libfdt/fdt_region.c  |  2 --
 test/dm/test-fdt.c   | 43
+++
 15 files changed, 172 insertions(+), 34 deletions(-)

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 31/36] rockchip: rk3399: prepare to use common board file

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


Use common board file and move SoC spec setting into rk3399.c

Signed-off-by: Kever Yang 


See below for a few comments.
I'll review again, once this series is somewhat more mature...


---

arch/arm/mach-rockchip/rk3399-board-spl.c | 179 --
arch/arm/mach-rockchip/rk3399-board.c |  14 --
arch/arm/mach-rockchip/rk3399/rk3399.c|  86 +--
board/rockchip/evb_rk3399/evb-rk3399.c|  56 ---
board/theobroma-systems/puma_rk3399/puma-rk3399.c |  17 +-
5 files changed, 103 insertions(+), 249 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk3399-board-spl.c
delete mode 100644 arch/arm/mach-rockchip/rk3399-board.c

diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c 
b/arch/arm/mach-rockchip/rk3399-board-spl.c
deleted file mode 100644
index d35990e..000
--- a/arch/arm/mach-rockchip/rk3399-board-spl.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
- * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH


Please make sure when moving code we contributed, that our copyright shows 
up in the new location you are moving this to.



- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-void board_return_to_bootrom(void)
-{
-   back_to_bootrom(BROM_BOOT_NEXTSTAGE);
-}
-
-static const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
-   [BROM_BOOTSOURCE_EMMC] = "/sdhci@fe33",
-   [BROM_BOOTSOURCE_SPINOR] = "/spi@ff1d",
-   [BROM_BOOTSOURCE_SD] = "/dwmmc@fe32",
-};
-
-const char *board_spl_was_booted_from(void)
-{
-   u32  bootdevice_brom_id = readl(RK3399_BROM_BOOTSOURCE_ID_ADDR);
-   const char *bootdevice_ofpath = NULL;
-
-   if (bootdevice_brom_id < ARRAY_SIZE(boot_devices))
-   bootdevice_ofpath = boot_devices[bootdevice_brom_id];
-
-   if (bootdevice_ofpath)
-   debug("%s: brom_bootdevice_id %x maps to '%s'\n",
- __func__, bootdevice_brom_id, bootdevice_ofpath);
-   else
-   debug("%s: failed to resolve brom_bootdevice_id %x\n",
- __func__, bootdevice_brom_id);
-
-   return bootdevice_ofpath;
-}
-
-u32 spl_boot_device(void)
-{
-   u32 boot_device = BOOT_DEVICE_MMC1;
-
-   if (CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM))
-   return BOOT_DEVICE_BOOTROM;
-
-   return boot_device;
-}
-
-#define TIMER_CHN10_BASE   0xff8680a0
-#define TIMER_END_COUNT_L  0x00
-#define TIMER_END_COUNT_H  0x04
-#define TIMER_INIT_COUNT_L 0x10
-#define TIMER_INIT_COUNT_H 0x14
-#define TIMER_CONTROL_REG  0x1c
-
-#define TIMER_EN   0x1
-#defineTIMER_FMODE (0 << 1)
-#defineTIMER_RMODE (1 << 1)
-
-void secure_timer_init(void)
-{
-   writel(0x, TIMER_CHN10_BASE + TIMER_END_COUNT_L);
-   writel(0x, TIMER_CHN10_BASE + TIMER_END_COUNT_H);
-   writel(0, TIMER_CHN10_BASE + TIMER_INIT_COUNT_L);
-   writel(0, TIMER_CHN10_BASE + TIMER_INIT_COUNT_H);
-   writel(TIMER_EN | TIMER_FMODE, TIMER_CHN10_BASE + TIMER_CONTROL_REG);
-}
-
-void board_debug_uart_init(void)
-{
-#define GRF_BASE   0xff77
-   struct rk3399_grf_regs * const grf = (void *)GRF_BASE;
-
-#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff18)
-   /* Enable early UART0 on the RK3399 */
-   rk_clrsetreg(>gpio2c_iomux,
-GRF_GPIO2C0_SEL_MASK,
-GRF_UART0BT_SIN << GRF_GPIO2C0_SEL_SHIFT);
-   rk_clrsetreg(>gpio2c_iomux,
-GRF_GPIO2C1_SEL_MASK,
-GRF_UART0BT_SOUT << GRF_GPIO2C1_SEL_SHIFT);
-#else
-   /* Enable early UART2 channel C on the RK3399 */
-   rk_clrsetreg(>gpio4c_iomux,
-GRF_GPIO4C3_SEL_MASK,
-GRF_UART2DGBC_SIN << GRF_GPIO4C3_SEL_SHIFT);
-   rk_clrsetreg(>gpio4c_iomux,
-GRF_GPIO4C4_SEL_MASK,
-GRF_UART2DBGC_SOUT << GRF_GPIO4C4_SEL_SHIFT);
-   /* Set channel C as UART2 input */
-   rk_clrsetreg(>soc_con7,
-GRF_UART_DBG_SEL_MASK,
-GRF_UART_DBG_SEL_C << GRF_UART_DBG_SEL_SHIFT);
-#endif
-}
-
-void board_init_f(ulong dummy)
-{
-   struct udevice *pinctrl;
-   struct udevice *dev;
-   struct rk3399_pmusgrf_regs *sgrf;
-   struct rk3399_grf_regs *grf;
-   int ret;
-
-#define EARLY_UART
-#ifdef EARLY_UART
-   /*
-* Debug UART can be used from here if required:
-*
-* debug_uart_init();
-* printch('a');
-* printhex8(0x1234);
-* printascii("string");
-*/
-   debug_uart_init();
-   printascii("U-Boot SPL board init");
-#endif
-
-   ret = 

Re: [U-Boot] [PATCH v2 1/2] Migrate CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig

2018-04-01 Thread Petr Vorel
Hi Alex,

> Convert CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig

> Signed-off-by: Alex Kiernan 
> Reviewed-by: Lukasz Majewski 
Reviewed-by: Petr Vorel 


> ---

> Changes in v2:
> - Rebase against master
> - Drop default in Kconfig to avoid over conversion by moveconfig
> - Resolve conflict in include/configs/am335x_igep003x.h

Kind regards,
Petr
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 24/36] armv8: add timer_get_boot_us() for generic timer

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


We need timer_get_boot_us() for boot stage if we use generic timer only.

Signed-off-by: Kever Yang 


See below for requested changes/questions.


---

arch/arm/cpu/armv8/generic_timer.c | 6 ++
1 file changed, 6 insertions(+)

diff --git a/arch/arm/cpu/armv8/generic_timer.c 
b/arch/arm/cpu/armv8/generic_timer.c
index a2dda33..d96217e 100644
--- a/arch/arm/cpu/armv8/generic_timer.c
+++ b/arch/arm/cpu/armv8/generic_timer.c
@@ -7,6 +7,7 @@

#include 
#include 
+#include 
#include 

DECLARE_GLOBAL_DATA_PTR;
@@ -52,6 +53,11 @@ uint64_t get_ticks(void)
return ticks;
}

+ulong timer_get_boot_us(void)
+{
+   return lldiv(get_ticks(), CONFIG_SYS_HZ_CLOCK / (CONFIG_SYS_HZ * 1000));
+}
+


Can we be sure that this does never conflict with what is added by another 
timer implementation (e.g. DM_TIMER)?  If not, you may have to add some 
additional infrastructure to allow selection of what timer is the 
boot-timer.



unsigned long usec2ticks(unsigned long usec)
{
ulong ticks;


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 21/36] rockchip: rk3128: prepare use common board file

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


remoe rk3128 board file and move SoC spec setting into rk3128.c


'Remove'?
Also: please elaborate on what this patch is doing.



Signed-off-by: Kever Yang 


Many comments agains the similar changes also apply here.


---

arch/arm/mach-rockchip/rk3128-board.c | 127 --
1 file changed, 127 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk3128-board.c

diff --git a/arch/arm/mach-rockchip/rk3128-board.c 
b/arch/arm/mach-rockchip/rk3128-board.c
deleted file mode 100644
index 2e8393d..000
--- a/arch/arm/mach-rockchip/rk3128-board.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * (C) Copyright 2017 Rockchip Electronics Co., Ltd.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-__weak int rk_board_late_init(void)
-{
-   return 0;
-}
-
-int board_late_init(void)
-{
-   setup_boot_mode();
-
-   return rk_board_late_init();
-}
-
-int board_init(void)
-{
-   int ret = 0;
-
-   rockchip_timer_init();
-
-   ret = regulators_enable_boot_on(false);
-   if (ret) {
-   debug("%s: Cannot enable boot on regulator\n", __func__);
-   return ret;
-   }
-
-   return 0;
-}
-
-int dram_init_banksize(void)
-{
-   gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-   gd->bd->bi_dram[0].size = 0x840;
-   /* Reserve 0xe0(14MB) for OPTEE with TA enabled, otherwise 2MB */
-   gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE
-   + gd->bd->bi_dram[0].size + 0xe0;
-   gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
-   + gd->ram_size - gd->bd->bi_dram[1].start;
-
-   return 0;
-}
-
-#ifndef CONFIG_SYS_DCACHE_OFF
-void enable_caches(void)
-{
-   /* Enable D-cache. I-cache is already enabled in start.S */
-   dcache_enable();
-}
-#endif
-
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-#include 
-#include 
-
-static struct dwc2_plat_otg_data rk3128_otg_data = {
-   .rx_fifo_sz = 512,
-   .np_tx_fifo_sz  = 16,
-   .tx_fifo_sz = 128,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
-   int node;
-   const char *mode;
-   bool matched = false;
-   const void *blob = gd->fdt_blob;
-
-   /* find the usb_otg node */
-   node = fdt_node_offset_by_compatible(blob, -1,
-"rockchip,rk3128-usb");
-
-   while (node > 0) {
-   mode = fdt_getprop(blob, node, "dr_mode", NULL);
-   if (mode && strcmp(mode, "otg") == 0) {
-   matched = true;
-   break;
-   }
-
-   node = fdt_node_offset_by_compatible(blob, node,
-"rockchip,rk3128-usb");
-   }
-   if (!matched) {
-   debug("Not found usb_otg device\n");
-   return -ENODEV;
-   }
-   rk3128_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
-   return dwc2_udc_probe(_otg_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
-   return 0;
-}
-#endif
-
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
-int fb_set_reboot_flag(void)
-{
-   struct rk3128_grf *grf;
-
-   printf("Setting reboot to fastboot flag ...\n");
-   grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-   /* Set boot mode to fastboot */
-   writel(BOOT_FASTBOOT, >os_reg[0]);
-
-   return 0;
-}
-#endif


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 17/36] rockchip: sdram_common: add common dram_init_banksize

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


dram_init_banksize() can be common used by all SoCs, move it into
sdram_common.c

Signed-off-by: Kever Yang 
---

arch/arm/mach-rockchip/sdram_common.c | 63 ++-
1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/sdram_common.c 
b/arch/arm/mach-rockchip/sdram_common.c
index 3a71f09..ff86096 100644
--- a/arch/arm/mach-rockchip/sdram_common.c
+++ b/arch/arm/mach-rockchip/sdram_common.c
@@ -21,13 +21,74 @@ struct ddr_param {

#define PARAM_DRAM_INFO_OFFSET 0x200

+#define TRUST_PARAMETER_OFFSET(34 * 1024 * 1024)


This isn't covered by what you commit message states as content for this 
patch.



+
+struct tos_parameter_t {
+   u32 version;
+   u32 checksum;
+   struct {
+   char name[8];
+   s64 phy_addr;
+   u32 size;
+   u32 flags;
+   } tee_mem;
+   struct {
+   char name[8];
+   s64 phy_addr;
+   u32 size;
+   u32 flags;
+   } drm_mem;
+   s64 reserve[8];
+};
+
+int dram_init_banksize(void)
+{
+   size_t top = min((unsigned long)(gd->ram_size + CONFIG_SYS_SDRAM_BASE),
+gd->ram_top);
+
+#ifdef CONFIG_ARM64
+   /* Reserve 0x20 for ATF bl31 */
+   gd->bd->bi_dram[0].start = 0x20;
+   gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start;


This should only be done when preparing to start a
IH_OS_ARM_TRUSTED_FIRMWARE.


+#else
+#ifdef CONFIG_SPL_OPTEE


I don't think that this CONFIG_SPL_OPTEE was what the comments in the 
OPTEE thread have arrived at... please check again.


Just as an unreleated comment/reminder: you still need to revise the other 
series as per the comments and final decision on how to implement it.



+   struct tos_parameter_t *tos_parameter;
+
+   tos_parameter = (struct tos_parameter_t *)(CONFIG_SYS_SDRAM_BASE +
+   TRUST_PARAMETER_OFFSET);
+
+   if (tos_parameter->tee_mem.flags == 1) {


Please describe what this 'flags' member means and how it's encoded.


+   gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+   gd->bd->bi_dram[0].size = tos_parameter->tee_mem.phy_addr
+   - CONFIG_SYS_SDRAM_BASE;
+   gd->bd->bi_dram[1].start = tos_parameter->tee_mem.phy_addr +
+   tos_parameter->tee_mem.size;
+   gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
+   + top - gd->bd->bi_dram[1].start;
+   } else {
+   gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+   gd->bd->bi_dram[0].size = 0x840;
+   /* Reserve 32M for OPTEE with TA */
+   gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE
+   + gd->bd->bi_dram[0].size + 0x200;
+   gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
+   + top - gd->bd->bi_dram[1].start;
+   }


This should again only be done, when the appropriate IH_OS_* is entered.


+#else
+   gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+   gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start;


This should be the default (so you can remove the #if paths) once you make 
sure that the other paths are actually called for entering the particular 
IH_OS_* types.



+#endif
+#endif
+
+   return 0;
+}
+
size_t rockchip_sdram_size(phys_addr_t reg)
{
u32 rank, col, bk, cs0_row, cs1_row, bw, row_3_4;
size_t chipsize_mb = 0;
size_t size_mb = 0;
u32 ch;
-


Ok, but not really needed (unless you want to do a separate 'cosmetic' or 
'whitespace' patch.  Touching an unrelated function is usually a bad idea.



u32 sys_reg = readl(reg);
u32 ch_num = 1 + ((sys_reg >> SYS_REG_NUM_CH_SHIFT)
   & SYS_REG_NUM_CH_MASK);


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 18/36] rockchip: rk3188: remove rockchip timer as sys timer

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


We use ARM arch timer instead.






Signed-off-by: Kever Yang 
---

include/configs/rk3188_common.h | 3 ---
1 file changed, 3 deletions(-)

diff --git a/include/configs/rk3188_common.h b/include/configs/rk3188_common.h
index 30c150e..7dddf11 100644
--- a/include/configs/rk3188_common.h
+++ b/include/configs/rk3188_common.h
@@ -17,9 +17,6 @@
#define CONFIG_SYS_MALLOC_LEN   (32 << 20)
#define CONFIG_SYS_CBSIZE   1024

-#define CONFIG_SYS_TIMER_RATE  (24 * 1000 * 1000)
-#define CONFIG_SYS_TIMER_BASE  0x2000e000 /* TIMER3 */
-#define CONFIG_SYS_TIMER_COUNTER   (CONFIG_SYS_TIMER_BASE + 8)
#define CONFIG_SYS_TIMER_COUNTS_DOWN

#ifdef CONFIG_SPL_ROCKCHIP_BACK_TO_BROM


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 15/36] rockchip: declare sdram_init() in common header

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


We need a dedicate sdram_init() function for those SoCS not
using SPL_FRAMEWORK.

Signed-off-by: Kever Yang 
---

arch/arm/include/asm/arch-rockchip/sys_proto.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/arm/include/asm/arch-rockchip/sys_proto.h 
b/arch/arm/include/asm/arch-rockchip/sys_proto.h
index 3617ac2..7b7e336 100644
--- a/arch/arm/include/asm/arch-rockchip/sys_proto.h
+++ b/arch/arm/include/asm/arch-rockchip/sys_proto.h
@@ -7,5 +7,8 @@
#ifndef _ASM_ARCH_SYS_PROTO_H
#define _ASM_ARCH_SYS_PROTO_H

+#ifndef CONFIG_SPL_FRAMEWORK
+void sdram_init(void);


Please provide documentation for this function, as it is exposed in a 
header-file.



+#endif

#endif /* _ASM_ARCH_SYS_PROTO_H */


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 14/36] rockchip: rk3036: prepare to use commong board file

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


Move some soc spec setting into rk3036.c


Please provide a summary of the changes in your commit message.



Signed-off-by: Kever Yang 
---

arch/arm/mach-rockchip/rk3036-board.c  | 104 -
arch/arm/mach-rockchip/rk3036/Makefile |   2 +-
.../{rk3036-board-spl.c => rk3036/rk3036.c}|  41 ++--
arch/arm/mach-rockchip/rk3036/sdram_rk3036.c   |  14 +++
4 files changed, 24 insertions(+), 137 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk3036-board.c
rename arch/arm/mach-rockchip/{rk3036-board-spl.c => rk3036/rk3036.c} (50%)

diff --git a/arch/arm/mach-rockchip/rk3036-board.c 
b/arch/arm/mach-rockchip/rk3036-board.c
deleted file mode 100644
index a5d2571..000
--- a/arch/arm/mach-rockchip/rk3036-board.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * (C) Copyright 2015 Rockchip Electronics Co., Ltd
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-__weak int rk_board_late_init(void)
-{
-   return 0;
-}
-
-int board_late_init(void)
-{
-   setup_boot_mode();
-
-   return rk_board_late_init();
-}
-
-int board_init(void)
-{
-   return 0;
-}
-
-#if !CONFIG_IS_ENABLED(RAM)
-/*
- * When CONFIG_RAM is enabled, the dram_init() function is implemented
- * in sdram_common.c.
- */
-int dram_init(void)
-{
-   gd->ram_size = sdram_size();
-
-   return 0;
-}
-#endif
-
-#ifndef CONFIG_SYS_DCACHE_OFF
-void enable_caches(void)
-{
-   /* Enable D-cache. I-cache is already enabled in start.S */
-   dcache_enable();
-}
-#endif
-
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-#include 
-#include 
-
-static struct dwc2_plat_otg_data rk3036_otg_data = {
-   .rx_fifo_sz = 512,
-   .np_tx_fifo_sz  = 16,
-   .tx_fifo_sz = 128,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
-   int node;
-   const char *mode;
-   bool matched = false;
-   const void *blob = gd->fdt_blob;
-
-   /* find the usb_otg node */
-   node = fdt_node_offset_by_compatible(blob, -1,
-   "rockchip,rk3288-usb");
-
-   while (node > 0) {
-   mode = fdt_getprop(blob, node, "dr_mode", NULL);
-   if (mode && strcmp(mode, "otg") == 0) {
-   matched = true;
-   break;
-   }
-
-   node = fdt_node_offset_by_compatible(blob, node,
-   "rockchip,rk3288-usb");
-   }
-   if (!matched) {
-   debug("Not found usb_otg device\n");
-   return -ENODEV;
-   }
-   rk3036_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
-   return dwc2_udc_probe(_otg_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
-   return 0;
-}
-#endif
diff --git a/arch/arm/mach-rockchip/rk3036/Makefile 
b/arch/arm/mach-rockchip/rk3036/Makefile
index 20d28f7..8a144d1 100644
--- a/arch/arm/mach-rockchip/rk3036/Makefile
+++ b/arch/arm/mach-rockchip/rk3036/Makefile
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-2.0+
#

-obj-y += clk_rk3036.o
+obj-y += rk3036.o clk_rk3036.o

ifndef CONFIG_SPL_BUILD
obj-y += syscon_rk3036.o
diff --git a/arch/arm/mach-rockchip/rk3036-board-spl.c 
b/arch/arm/mach-rockchip/rk3036/rk3036.c
similarity index 50%
rename from arch/arm/mach-rockchip/rk3036-board-spl.c
rename to arch/arm/mach-rockchip/rk3036/rk3036.c
index 550e3a1..39cc43b 100644
--- a/arch/arm/mach-rockchip/rk3036-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3036/rk3036.c
@@ -1,28 +1,22 @@
/*
- * (C) Copyright 2015 Rockchip Electronics Co., Ltd
+ * Copyright (c) 2017 Rockchip Electronics Co., Ltd
 *
 * SPDX-License-Identifier: GPL-2.0+
 */
-
-#include 
-#include 
#include 
#include 
-#include 
#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
+#include 
#define GRF_BASE0x20008000

-#define DEBUG_UART_BASE0x20068000
-
-void board_init_f(ulong dummy)
+#ifdef CONFIG_SPL_BUILD
+int arch_cpu_init(void)
+{
+   return 0;
+}
+#endif
+void board_debug_uart_init(void)
{
-#ifdef EARLY_DEBUG
struct rk3036_grf * const grf = (void *)GRF_BASE;
/*
 * NOTE: sd card and debug uart use same iomux in rk3036,
@@ -34,22 +28,5 @@ void board_init_f(ulong dummy)
 GPIO1C2_MASK << GPIO1C2_SHIFT,
 GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT |
 GPIO1C2_UART2_SIN << GPIO1C2_SHIFT);
-   debug_uart_init();
-#endif
-   rockchip_timer_init();
-   sdram_init();
-
-   /* return to maskrom */
-   back_to_bootrom(BROM_BOOT_NEXTSTAGE);
-}

-/* Place Holders */
-void board_init_r(gd_t *id, ulong dest_addr)
-{
-   /*
-* Function attribute is no-return
-* This 

Re: [U-Boot] [U-Boot, 12/36] rockchip: rk3036: sdram: use udelay instead of rockchip_udelay

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


We are going to remove rockchip_udelay after enable arch timer.


Please use commit message that better describes what this commit is 
changing.




Signed-off-by: Kever Yang 
---

arch/arm/mach-rockchip/rk3036/sdram_rk3036.c | 19 +--
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-rockchip/rk3036/sdram_rk3036.c 
b/arch/arm/mach-rockchip/rk3036/sdram_rk3036.c
index e5393ec..ce3f09a 100644
--- a/arch/arm/mach-rockchip/rk3036/sdram_rk3036.c
+++ b/arch/arm/mach-rockchip/rk3036/sdram_rk3036.c
@@ -10,7 +10,6 @@
#include 
#include 
#include 
-#include 
#include 

/*
@@ -346,7 +345,7 @@ static void rkdclk_init(struct rk3036_sdram_priv *priv)

/* waiting for pll lock */
while (readl(>con1) & (1 << PLL_LOCK_STATUS_SHIFT))
-   rockchip_udelay(1);
+   udelay(1);

/* PLL enter normal-mode */
rk_clrsetreg(>cru->cru_mode_con, DPLL_MODE_MASK,
@@ -374,25 +373,25 @@ void phy_pctrl_reset(struct rk3036_sdram_priv *priv)
1 << DDRCTRL_PSRST_SHIFT | 1 << DDRCTRL_SRST_SHIFT |
1 << DDRPHY_PSRST_SHIFT | 1 << DDRPHY_SRST_SHIFT);

-   rockchip_udelay(10);
+   udelay(10);

rk_clrreg(>cru->cru_softrst_con[5], 1 << DDRPHY_PSRST_SHIFT |
  1 << DDRPHY_SRST_SHIFT);
-   rockchip_udelay(10);
+   udelay(10);

rk_clrreg(>cru->cru_softrst_con[5], 1 << DDRCTRL_PSRST_SHIFT |
  1 << DDRCTRL_SRST_SHIFT);
-   rockchip_udelay(10);
+   udelay(10);

clrsetbits_le32(_phy->ddrphy_reg1,
SOFT_RESET_MASK << SOFT_RESET_SHIFT,
0 << SOFT_RESET_SHIFT);
-   rockchip_udelay(10);
+   udelay(10);
clrsetbits_le32(_phy->ddrphy_reg1,
SOFT_RESET_MASK << SOFT_RESET_SHIFT,
3 << SOFT_RESET_SHIFT);

-   rockchip_udelay(1);
+   udelay(1);
}

void phy_dll_bypass_set(struct rk3036_sdram_priv *priv, unsigned int freq)
@@ -445,7 +444,7 @@ static void send_command(struct rk3036_ddr_pctl *pctl,
 u32 rank, u32 cmd, u32 arg)
{
writel((START_CMD | (rank << 20) | arg | cmd), >mcmd);
-   rockchip_udelay(1);
+   udelay(1);
while (readl(>mcmd) & START_CMD)
;
}
@@ -455,7 +454,7 @@ static void memory_init(struct rk3036_sdram_priv *priv)
struct rk3036_ddr_pctl *pctl = priv->pctl;

send_command(pctl, 3, DESELECT_CMD, 0);
-   rockchip_udelay(1);
+   udelay(1);
send_command(pctl, 3, PREA_CMD, 0);
send_command(pctl, 3, MRS_CMD,
 (0x02 & BANK_ADDR_MASK) << BANK_ADDR_SHIFT |
@@ -493,7 +492,7 @@ static void data_training(struct rk3036_sdram_priv *priv)
clrsetbits_le32(_phy->ddrphy_reg2, 0x03,
DQS_SQU_CAL_NORMAL_MODE | DQS_SQU_CAL_START);

-   rockchip_udelay(1);
+   udelay(1);
while ((readl(_phy->ddrphy_reg62) & CAL_DONE_MASK) !=
(HIGH_8BIT_CAL_DONE | LOW_8BIT_CAL_DONE)) {
;


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 16/36] rockchip: sdram-common: add api to pass dram info to trust os

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


Trust OS decode this info like this:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/plat/rockchip/common/drivers/parameter/ddr_parameter.c#L19
We have to set a available value, or else we get error info from
Trust OS like this:
"ERROR:   over or zero region, nr=3145987, max=10"


Please describe what changes the patch makes.



Signed-off-by: Kever Yang 


See below for requested changes.


---

arch/arm/include/asm/arch-rockchip/sdram_common.h |  4 
arch/arm/mach-rockchip/sdram_common.c | 21 +
2 files changed, 25 insertions(+)

diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h 
b/arch/arm/include/asm/arch-rockchip/sdram_common.h
index fec8586..55c6b81 100644
--- a/arch/arm/include/asm/arch-rockchip/sdram_common.h
+++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h
@@ -55,4 +55,8 @@ size_t rockchip_sdram_size(phys_addr_t reg);

/* Called by U-Boot board_init_r for Rockchip SoCs */
int dram_init(void);
+
+/* Write ddr param to a known place for trustos */
+int rockchip_setup_ddr_param(struct ram_info *info);
+
#endif
diff --git a/arch/arm/mach-rockchip/sdram_common.c 
b/arch/arm/mach-rockchip/sdram_common.c
index 76dbdc8..3a71f09 100644
--- a/arch/arm/mach-rockchip/sdram_common.c
+++ b/arch/arm/mach-rockchip/sdram_common.c
@@ -12,6 +12,15 @@
#include 

DECLARE_GLOBAL_DATA_PTR;
+struct ddr_param {
+   u32 count;
+   u32 reserved;
+   u64 bank_addr;
+   u64 bank_size;
+};
+
+#define PARAM_DRAM_INFO_OFFSET 0x200


Having this a fixed offset feels a bit hackish... especially as this is 
now implemented for all SOCs.



+
size_t rockchip_sdram_size(phys_addr_t reg)
{
u32 rank, col, bk, cs0_row, cs1_row, bw, row_3_4;
@@ -81,3 +90,15 @@ ulong board_get_usable_ram_top(ulong total_size)

return (gd->ram_top > top) ? top : gd->ram_top;
}
+
+int rockchip_setup_ddr_param(struct ram_info *info)
+{
+   struct ddr_param *dinfo = (struct ddr_param *)CONFIG_SYS_SDRAM_BASE +
+   PARAM_DRAM_INFO_OFFSET;
+
+   dinfo->count = 1;
+   dinfo->bank_addr = info->base;
+   dinfo->bank_size = info->size;
+
+   return 0;
+}


This setup should only be performed when preparing the system to enter the 
ATF.  So you will need to hook it into path where the ATF is prepared for 
being jumped into.


I would further prefer (but this is a personal preference) to eventually 
move to using the FDT we inject into the ATF to convey this information.





___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 33/36] rockchip: dts: rk3399-firefly: enable uart2 in spl

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


pre-loader console in SPL needs UART.


Please describe what the change is (with this I still need to look at the 
diff).




Signed-off-by: Kever Yang 


Just make this a separate patch, as I can apply this without the remainder 
of the series.



---

arch/arm/dts/rk3399-firefly.dts | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/rk3399-firefly.dts b/arch/arm/dts/rk3399-firefly.dts
index f134c00..a007fa1 100644
--- a/arch/arm/dts/rk3399-firefly.dts
+++ b/arch/arm/dts/rk3399-firefly.dts
@@ -648,6 +648,7 @@
};

 {
+   u-boot,dm-pre-reloc;
status = "okay";
};


This should go to *-u-boot.dtsi.





___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 29/36] rockchip: rk3368: prepare to use common board file

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


Use common board file and move SoC spec setting into rk3368.c


Please improve the commit message, so the casual reader knows what is 
changed it this patch and why.




Signed-off-by: Kever Yang 


See below for some requested changes.


---

arch/arm/mach-rockchip/rk3368-board-spl.c |  73 --
arch/arm/mach-rockchip/rk3368-board-tpl.c | 157 --
arch/arm/mach-rockchip/rk3368/rk3368.c| 116 ++--
board/geekbuying/geekbox/geekbox.c|   5 -
board/rockchip/evb_px5/evb-px5.c  |   5 -
board/rockchip/sheep_rk3368/sheep_rk3368.c|   5 -
board/theobroma-systems/lion_rk3368/lion_rk3368.c |   8 --
7 files changed, 106 insertions(+), 263 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk3368-board-spl.c
delete mode 100644 arch/arm/mach-rockchip/rk3368-board-tpl.c

diff --git a/arch/arm/mach-rockchip/rk3368-board-spl.c 
b/arch/arm/mach-rockchip/rk3368-board-spl.c
deleted file mode 100644
index 8055ae5..000
--- a/arch/arm/mach-rockchip/rk3368-board-spl.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-void board_debug_uart_init(void)
-{
-}
-
-void board_init_f(ulong dummy)
-{
-   struct udevice *pinctrl;
-   struct udevice *dev;
-   int ret;
-
-   ret = spl_early_init();
-   if (ret) {
-   debug("spl_early_init() failed: %d\n", ret);
-   hang();
-   }
-
-   /* Set up our preloader console */
-   ret = uclass_get_device(UCLASS_PINCTRL, 0, );
-   if (ret) {
-   pr_err("%s: pinctrl init failed: %d\n", __func__, ret);
-   hang();
-   }
-
-   ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART0);
-   if (ret) {
-   pr_err("%s: failed to set up console UART\n", __func__);
-   hang();
-   }
-
-   preloader_console_init();
-
-   ret = uclass_get_device(UCLASS_RAM, 0, );
-   if (ret) {
-   debug("DRAM init failed: %d\n", ret);
-   return;
-   }
-}
-
-u32 spl_boot_device(void)
-{
-   return BOOT_DEVICE_MMC1;
-}
-
-#ifdef CONFIG_SPL_LOAD_FIT
-int board_fit_config_name_match(const char *name)
-{
-   /* Just empty function now - can't decide what to choose */
-   debug("%s: %s\n", __func__, name);
-
-   return 0;
-}
-#endif
diff --git a/arch/arm/mach-rockchip/rk3368-board-tpl.c 
b/arch/arm/mach-rockchip/rk3368-board-tpl.c
deleted file mode 100644
index 60d5aea..000
--- a/arch/arm/mach-rockchip/rk3368-board-tpl.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH


If you move all of this code, please make sure that our copyright is 
reflected in the new file.



- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/*
- * The SPL (and also the full U-Boot stage on the RK3368) will run in
- * secure mode (i.e. EL3) and an ATF will eventually be booted before
- * starting up the operating system... so we can initialize the SGRF
- * here and rely on the ATF installing the final (secure) policy
- * later.
- */
-static inline uintptr_t sgrf_soc_con_addr(unsigned no)
-{
-   const uintptr_t SGRF_BASE =
-   (uintptr_t)syscon_get_first_range(ROCKCHIP_SYSCON_SGRF);
-
-   return SGRF_BASE + sizeof(u32) * no;
-}
-
-static inline uintptr_t sgrf_busdmac_addr(unsigned no)
-{
-   const uintptr_t SGRF_BASE =
-   (uintptr_t)syscon_get_first_range(ROCKCHIP_SYSCON_SGRF);
-   const uintptr_t SGRF_BUSDMAC_OFFSET = 0x100;
-   const uintptr_t SGRF_BUSDMAC_BASE = SGRF_BASE + SGRF_BUSDMAC_OFFSET;
-
-   return SGRF_BUSDMAC_BASE + sizeof(u32) * no;
-}
-
-static void sgrf_init(void)
-{
-   struct rk3368_cru * const cru =
-   (struct rk3368_cru * const)rockchip_get_cru();
-   const u16 SGRF_SOC_CON_SEC = GENMASK(15, 0);
-   const u16 SGRF_BUSDMAC_CON0_SEC = BIT(2);
-   const u16 SGRF_BUSDMAC_CON1_SEC = GENMASK(15, 12);
-
-   /* Set all configurable IP to 'non secure'-mode */
-   rk_setreg(sgrf_soc_con_addr(5), SGRF_SOC_CON_SEC);
-   rk_setreg(sgrf_soc_con_addr(6), SGRF_SOC_CON_SEC);
-   rk_setreg(sgrf_soc_con_addr(7), SGRF_SOC_CON_SEC);
-
-   /*
-* From rockchip-uboot/arch/arm/cpu/armv8/rk33xx/cpu.c
-* Original comment: "ddr space set no secure mode"
-*/
-   rk_clrreg(sgrf_soc_con_addr(8), SGRF_SOC_CON_SEC);
-   rk_clrreg(sgrf_soc_con_addr(9), SGRF_SOC_CON_SEC);
-   

Re: [U-Boot] [U-Boot, 30/36] rockchip: lion-rk3368: remove rockchip timer

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


We use ARM generic timer.


A more enlightening commit message, please.


Signed-off-by: Kever Yang 


See below for comments.


---

configs/lion-rk3368_defconfig | 4 
1 file changed, 4 deletions(-)

diff --git a/configs/lion-rk3368_defconfig b/configs/lion-rk3368_defconfig
index 8a95ce3..89c4d76 100644
--- a/configs/lion-rk3368_defconfig
+++ b/configs/lion-rk3368_defconfig
@@ -88,10 +88,6 @@ CONFIG_DEBUG_UART_ANNOUNCE=y
CONFIG_DEBUG_UART_SKIP_INIT=y
CONFIG_ROCKCHIP_SPI=y
CONFIG_SYSRESET=y
-CONFIG_TIMER=y
-CONFIG_SPL_TIMER=y
-CONFIG_TPL_TIMER=y
-CONFIG_ROCKCHIP_TIMER=y


NAK: The reason to not do this (and to have a DM time for the RK3368) has 
been discussed, when we originally added this: SPL should not be specific 
on the software stack.


Consider the following cases:
1. Boot to Linux (or U-Boot in EL2): this always includes an ATF as the
   next-stage... so no need to setup the secure time here, as ATF will
   take care of this anyway.
2. Boot to U-Boot in EL3 (e.g. from the Miniloader): we shouldn't rely on
   the secure time having been set up (but U-Boot can't do it either, as
   the same binary could either run at EL3 or at EL2).

So the consensus was to not have U-Boot rely on the secure timer to be 
initialised... especially, as it doesn't have to rely on this.


Note that this is also true for the RK3399, but I need to finish up 
further changes to the DRAM init code, as that currently relies on having 
a timebase before the DM timer is available.



CONFIG_USE_TINY_PRINTF=y
CONFIG_SPL_TINY_MEMSET=y
CONFIG_LZO=y


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 36/36] rockchip: add common board file for rockchip platform

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


We use common board/spl/tpl file for all rockchip SoCs,
- all the SoC spec setting should move into SoC file like rk3288.c;
- tpl is option and only purpose to init DRAM, clock, uart(option);
- spl do secure relate one time init, boot device select, boot into
 U-Boot or trust or OS in falcon mode;
- board do boot mode detect, enable regulator, usb init and so on.


There's too much going on in a single commit/single series.
This needs to be split up into multiple, independent steps (e.g. one for 
the timer changes, another one for the UART changes)...




Signed-off-by: Kever Yang 


See below for requested changes (beyond splitting this up).
Reviewing this in this state is a real chore, so I'll probably have more 
comments, once I see this presented in more manageable parcels.



---

arch/arm/mach-rockchip/Makefile |  23 +
arch/arm/mach-rockchip/board.c  | 136 
arch/arm/mach-rockchip/spl.c| 195 
arch/arm/mach-rockchip/tpl.c| 111 +++
4 files changed, 445 insertions(+), 20 deletions(-)
create mode 100644 arch/arm/mach-rockchip/board.c
create mode 100644 arch/arm/mach-rockchip/spl.c
create mode 100644 arch/arm/mach-rockchip/tpl.c

diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index e1b0519..3aba66c 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -11,15 +11,8 @@
obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o

-obj-tpl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-tpl.o
-obj-tpl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-tpl.o
-
-obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
-obj-spl-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-spl.o
-obj-spl-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board-spl.o
-obj-spl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o
-obj-spl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-spl.o spl-boot-order.o
-obj-spl-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o spl-boot-order.o
+obj-tpl-y += tpl.o
+obj-spl-y += spl.o spl-boot-order.o

ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)

@@ -28,21 +21,11 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
# we can have the preprocessor correctly recognise both 0x0 and 0
# meaning "turn it off".
obj-y += boot_mode.o
-
-obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o
-obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128-board.o
-obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board.o
-obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o
-obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board.o
-obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o
+obj-y += board.o
endif

obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o

-ifndef CONFIG_ARM64
-obj-y += rk_timer.o
-endif


This would need to have gone with the rk_timer.c removal.
Otherwise things don't build between the earlier patch and here.


-
obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036/
obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128/
ifndef CONFIG_TPL_BUILD
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
new file mode 100644
index 000..52c6f66
--- /dev/null
+++ b/arch/arm/mach-rockchip/board.c
@@ -0,0 +1,136 @@
+/*
+ * (C) Copyright 2017 Rockchip Electronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#ifdef CONFIG_DM_REGULATOR
+#include 
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
+int fb_set_reboot_flag(void)
+{
+   printf("Setting reboot to fastboot flag ...\n");
+   /* Set boot mode to fastboot */
+   writel(BOOT_FASTBOOT, CONFIG_ROCKCHIP_BOOT_MODE_REG);
+
+   return 0;
+}
+
+#define FASTBOOT_KEY_GPIO 43 /* GPIO1_B3 */
+static int fastboot_key_pressed(void)
+{
+   gpio_request(FASTBOOT_KEY_GPIO, "fastboot_key");
+   gpio_direction_input(FASTBOOT_KEY_GPIO);
+   return !gpio_get_value(FASTBOOT_KEY_GPIO);
+}
+#endif
+
+__weak int rk_board_init(void)
+{
+   return 0;
+}
+
+__weak int rk_board_late_init(void)
+{
+   return 0;
+}
+
+int board_late_init(void)
+{
+#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
+   if (fastboot_key_pressed()) {
+   printf("fastboot key pressed!\n");
+   fb_set_reboot_flag();
+   }
+#endif
+
+#if (CONFIG_ROCKCHIP_BOOT_MODE_REG > 0)
+   setup_boot_mode();
+#endif
+
+   return rk_board_late_init();
+}
+
+int board_init(void)
+{
+   int ret;
+
+#if !defined(CONFIG_SUPPORT_SPL)
+   board_debug_uart_init();
+#endif
+#ifdef CONFIG_DM_REGULATOR
+   ret = regulators_enable_boot_on(false);
+   if (ret)
+   debug("%s: Cannot enable boot on regulator\n", __func__);
+#endif
+
+   return rk_board_init();
+}
+
+#if !defined(CONFIG_SYS_DCACHE_OFF) && !defined(CONFIG_ARM64)
+void enable_caches(void)
+{
+   /* Enable D-cache. I-cache is 

Re: [U-Boot] [U-Boot, 35/36] rockchip: declear boot_devices in bootrom.h

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


boot_devices may defined in soc file, and used in board file,
we need to delear it in header file.


I think you meant to write 'declare'.
Again: a bit more context from the commit message might be useful (e.g. 
what is 'boot_devices'?


If 'boot_devices' suddenly becomes visible across multiple files, we may 
need to rethink its naming... 'boot_devices' is too similar to names used 
in SPL (e.g. 'boot_device') and could easily be confused.




Signed-off-by: Kever Yang 


See below for requested changes.


---

arch/arm/include/asm/arch-rockchip/bootrom.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/arch-rockchip/bootrom.h 
b/arch/arm/include/asm/arch-rockchip/bootrom.h
index 103b799..ac2f370 100644
--- a/arch/arm/include/asm/arch-rockchip/bootrom.h
+++ b/arch/arm/include/asm/arch-rockchip/bootrom.h
@@ -53,6 +53,8 @@ enum {
BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB
};

+extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1];


If you make this visible outside of a single board file and move it to a 
header file, this needs some documentation (and naming will need to be 
rethought as well, as described above).



+
/**
 * Locations of the boot-device identifier in SRAM
 */


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 10/36] rockchip: rk322x: prepare to use common board file

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


Move soc spec setting into rk322x.c and remove rk322x-board/board-spl.c


A clear description of what the patch is attempting to achieve.



Signed-off-by: Kever Yang 


See below for requested changes.


---

arch/arm/mach-rockchip/rk322x-board.c  | 155 -
arch/arm/mach-rockchip/rk322x/Makefile |   2 +-
.../{rk322x-board-spl.c => rk322x/rk322x.c}|  86 
3 files changed, 29 insertions(+), 214 deletions(-)
delete mode 100644 arch/arm/mach-rockchip/rk322x-board.c
rename arch/arm/mach-rockchip/{rk322x-board-spl.c => rk322x/rk322x.c} (51%)

diff --git a/arch/arm/mach-rockchip/rk322x-board.c 
b/arch/arm/mach-rockchip/rk322x-board.c
deleted file mode 100644
index 8642a90..000
--- a/arch/arm/mach-rockchip/rk322x-board.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * (C) Copyright 2017 Rockchip Electronics Co., Ltd.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-__weak int rk_board_late_init(void)
-{
-   return 0;
-}
-
-int board_late_init(void)
-{
-   setup_boot_mode();
-
-   return rk_board_late_init();
-}
-
-int board_init(void)
-{
-#include 
-   /* Enable early UART2 channel 1 on the RK322x */
-#define GRF_BASE   0x1100
-   struct rk322x_grf * const grf = (void *)GRF_BASE;
-   enum {
-   GPIO1B2_SHIFT   = 4,
-   GPIO1B2_MASK= 3 << GPIO1B2_SHIFT,
-   GPIO1B2_GPIO= 0,
-   GPIO1B2_UART21_SIN,
-
-   GPIO1B1_SHIFT   = 2,
-   GPIO1B1_MASK= 3 << GPIO1B1_SHIFT,
-   GPIO1B1_GPIO= 0,
-   GPIO1B1_UART1_SOUT,
-   GPIO1B1_UART21_SOUT,
-   };
-   enum {
-   CON_IOMUX_UART2SEL_SHIFT= 8,
-   CON_IOMUX_UART2SEL_MASK = 1 << CON_IOMUX_UART2SEL_SHIFT,
-   CON_IOMUX_UART2SEL_2= 0,
-   CON_IOMUX_UART2SEL_21,
-   };
-
-   rk_clrsetreg(>gpio1b_iomux,
-GPIO1B1_MASK | GPIO1B2_MASK,
-GPIO1B2_UART21_SIN << GPIO1B2_SHIFT |
-GPIO1B1_UART21_SOUT << GPIO1B1_SHIFT);
-   /* Set channel C as UART2 input */
-   rk_clrsetreg(>con_iomux,
-CON_IOMUX_UART2SEL_MASK,
-CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT);
-
-   /*
-   * The integrated macphy is enabled by default, disable it
-   * for saving power consuming.
-   */
-   rk_clrsetreg(>macphy_con[0],
-MACPHY_CFG_ENABLE_MASK,
-0 << MACPHY_CFG_ENABLE_SHIFT);
-
-   return 0;
-}
-
-int dram_init_banksize(void)
-{
-   gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-   gd->bd->bi_dram[0].size = 0x840;
-   /* Reserve 0x20 for OPTEE */
-   gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE
-   + gd->bd->bi_dram[0].size + 0x20;
-   gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
-   + gd->ram_size - gd->bd->bi_dram[1].start;
-
-   return 0;
-}
-
-#ifndef CONFIG_SYS_DCACHE_OFF
-void enable_caches(void)
-{
-   /* Enable D-cache. I-cache is already enabled in start.S */
-   dcache_enable();
-}
-#endif
-
-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
-#include 
-#include 
-
-static struct dwc2_plat_otg_data rk322x_otg_data = {
-   .rx_fifo_sz = 512,
-   .np_tx_fifo_sz  = 16,
-   .tx_fifo_sz = 128,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
-   int node;
-   const char *mode;
-   bool matched = false;
-   const void *blob = gd->fdt_blob;
-
-   /* find the usb_otg node */
-   node = fdt_node_offset_by_compatible(blob, -1,
-   "rockchip,rk3288-usb");
-
-   while (node > 0) {
-   mode = fdt_getprop(blob, node, "dr_mode", NULL);
-   if (mode && strcmp(mode, "otg") == 0) {
-   matched = true;
-   break;
-   }
-
-   node = fdt_node_offset_by_compatible(blob, node,
-   "rockchip,rk3288-usb");
-   }
-   if (!matched) {
-   debug("Not found usb_otg device\n");
-   return -ENODEV;
-   }
-   rk322x_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
-
-   return dwc2_udc_probe(_otg_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
-   return 0;
-}
-#endif
-
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
-int fb_set_reboot_flag(void)
-{
-   struct rk322x_grf *grf;
-
-   printf("Setting reboot to fastboot flag ...\n");
-   grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-

Re: [U-Boot] [U-Boot, 06/36] rockchip: add IRAM_START_ADDR for all SoCs

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


We add this for get the location for boot device of bootrom.


Your commit message should be specific enough, so the motivation for the 
change, where it fits into the overall architecture and what is changed 
are apparent.



Signed-off-by: Kever Yang 
Acked-by: Philipp Tomsich 


See below for requested changes.


---

arch/arm/mach-rockchip/Kconfig | 17 +
1 file changed, 17 insertions(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 5dfe452..98bf935 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -209,6 +209,23 @@ config ROCKCHIP_STIMER_BASE
  The secure timer inited in SPL/TPL in secure word, ARM generic timer
  works after this timer work.

+config ROCKCHIP_IRAM_START_ADDR
+   hex "Rockchip Secure timer base address"


Huh: copy-and-paste?


+   default 0xff0e if ROCKCHIP_PX30


See my earlier comment regarding changes specific to the PX30.


+   default 0x1008 if ROCKCHIP_RK3036
+   default 0x1008 if ROCKCHIP_RK3128
+   default 0x1008 if ROCKCHIP_RK3188
+   default 0x1008 if ROCKCHIP_RK322X
+   default 0xff70 if ROCKCHIP_RK3288
+   default 0xff091000 if ROCKCHIP_RK3328
+   default 0xff8c if ROCKCHIP_RK3368
+   default 0xff8c if ROCKCHIP_RK3399
+   default 0x1008 if ROCKCHIP_RV1108
+   default 0
+   help
+ The IRAM start addr is to locate variant of the boot device from
+ bootrom.


The same comment as for the secure timer-base applies here.
This is way to important to have it in Kconfig, where a user can easily 
override.



+
config ROCKCHIP_SPL_RESERVE_IRAM
hex "Size of IRAM reserved in SPL"
default 0


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 08/36] rockchip: rk322x: remove use rockchip timer as sys timer

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


We can use arch timer instead of rockchip timer.


A slightly more enlightening commit message would be great.


Signed-off-by: Kever Yang 
Acked-by: Philipp Tomsich 


These changes for (for the timer) should go into a separate series.
Also: you should refactor these patches in such a way that the tree (after 
every patch that is applied) this builds.  A good way to do so is to do 
one device after another per patch.



---

include/configs/rk322x_common.h | 3 ---
1 file changed, 3 deletions(-)

diff --git a/include/configs/rk322x_common.h b/include/configs/rk322x_common.h
index 832f037..29e222a 100644
--- a/include/configs/rk322x_common.h
+++ b/include/configs/rk322x_common.h
@@ -14,9 +14,6 @@
#define CONFIG_SYS_CBSIZE   1024
#define CONFIG_SYS_BOOTM_LEN(64 << 20)/*  64M */

-#define CONFIG_SYS_TIMER_RATE  (24 * 1000 * 1000)
-#define CONFIG_SYS_TIMER_BASE  0x110c00a0 /* TIMER5 */
-#define CONFIG_SYS_TIMER_COUNTER   (CONFIG_SYS_TIMER_BASE + 8)

#define CONFIG_SYS_INIT_SP_ADDR 0x6010
#define CONFIG_SYS_LOAD_ADDR0x60800800


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 07/36] rockchip: rk3328: add BOOT_MODE_REG for rk3328

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


Signed-off-by: Kever Yang 


Commit message is missing.


---

arch/arm/mach-rockchip/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 98bf935..892d51e 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -182,6 +182,7 @@ config ROCKCHIP_BOOT_MODE_REG
default 0x20004040 if ROCKCHIP_RK3188
default 0x110005c8 if ROCKCHIP_RK322X
default 0xff730094 if ROCKCHIP_RK3288
+   default 0xff1005c8 if ROCKCHIP_RK3328
default 0xff738200 if ROCKCHIP_RK3368
default 0xff320300 if ROCKCHIP_RK3399
default 0x10300580 if ROCKCHIP_RV1108


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 35/36] rockchip: declear boot_devices in bootrom.h

2018-04-01 Thread Philipp Tomsich
> boot_devices may defined in soc file, and used in board file,
> we need to delear it in header file.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/include/asm/arch-rockchip/bootrom.h | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 03/36] rockchip: enable SYS_NS16550 for all SoCs by default

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


All rockchip SoCs can use ns16550 driver, enable it for all
and set SYS_NS16550_MEM32 for all SoCs.

Signed-off-by: Kever Yang 
Acked-by: Philipp Tomsich 


Reviewed-by: Philipp Tomsich 

See below for a question.

Note that I believe that the NS16550 changes should go into a separate 
series and be split off this huge series (which honestly is trying to do 
too many things at once).




arch/arm/Kconfig  | 1 +
arch/arm/mach-rockchip/Kconfig| 1 -
include/configs/rk3036_common.h   | 3 ---
include/configs/rk3128_common.h   | 2 --
include/configs/rk3188_common.h   | 2 --
include/configs/rk322x_common.h   | 1 -
include/configs/rk3288_common.h   | 2 --
include/configs/rk3328_common.h   | 2 --
include/configs/rk3368_common.h   | 2 --
include/configs/rk3399_common.h   | 2 --
include/configs/rockchip-common.h | 2 ++
include/configs/rv1108_common.h   | 3 ---
12 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2c52ff0..3e9a80d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1167,6 +1167,7 @@ config ARCH_ROCKCHIP
select DM_PWM
select DM_REGULATOR
select ENABLE_ARM_SOC_BOOT0_HOOK
+   select SYS_NS16550


Just wondering: shouldn't this be an 'imply'?


imply CMD_FASTBOOT
imply FASTBOOT
imply FAT_WRITE
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 0adaed4..007cb22 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -103,7 +103,6 @@ config ROCKCHIP_RK3368
imply SPL_SERIAL_SUPPORT
imply TPL_SERIAL_SUPPORT
select DEBUG_UART_BOARD_INIT
-   select SYS_NS16550
help
  The Rockchip RK3368 is a ARM-based SoC with a octa-core (organised
  into a big and little cluster with 4 cores each) Cortex-A53 including
diff --git a/include/configs/rk3036_common.h b/include/configs/rk3036_common.h
index f39a272..c5ec864 100644
--- a/include/configs/rk3036_common.h
+++ b/include/configs/rk3036_common.h
@@ -18,9 +18,6 @@
#define CONFIG_SYS_TIMER_BASE   0x200440a0 /* TIMER5 */
#define CONFIG_SYS_TIMER_COUNTER(CONFIG_SYS_TIMER_BASE + 8)

-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_MEM32
-
#define CONFIG_SYS_INIT_SP_ADDR 0x6010
#define CONFIG_SYS_LOAD_ADDR0x60800800
#define CONFIG_SPL_STACK0x10081fff
diff --git a/include/configs/rk3128_common.h b/include/configs/rk3128_common.h
index bd8019c..c593f18 100644
--- a/include/configs/rk3128_common.h
+++ b/include/configs/rk3128_common.h
@@ -19,8 +19,6 @@
#define CONFIG_SYS_TIMER_BASE   0x200440a0 /* TIMER5 */
#define CONFIG_SYS_TIMER_COUNTER(CONFIG_SYS_TIMER_BASE + 8)

-#define CONFIG_SYS_NS16550_MEM32
-
#define CONFIG_SYS_INIT_SP_ADDR 0x6010
#define CONFIG_SYS_LOAD_ADDR0x60800800

diff --git a/include/configs/rk3188_common.h b/include/configs/rk3188_common.h
index 94f8cda..30c150e 100644
--- a/include/configs/rk3188_common.h
+++ b/include/configs/rk3188_common.h
@@ -22,8 +22,6 @@
#define CONFIG_SYS_TIMER_COUNTER(CONFIG_SYS_TIMER_BASE + 8)
#define CONFIG_SYS_TIMER_COUNTS_DOWN

-#define CONFIG_SYS_NS16550_MEM32
-
#ifdef CONFIG_SPL_ROCKCHIP_BACK_TO_BROM
/* Bootrom will load u-boot binary to 0x6000 once return from SPL */
#endif
diff --git a/include/configs/rk322x_common.h b/include/configs/rk322x_common.h
index 7f9c7fb..832f037 100644
--- a/include/configs/rk322x_common.h
+++ b/include/configs/rk322x_common.h
@@ -18,7 +18,6 @@
#define CONFIG_SYS_TIMER_BASE   0x110c00a0 /* TIMER5 */
#define CONFIG_SYS_TIMER_COUNTER(CONFIG_SYS_TIMER_BASE + 8)

-#define CONFIG_SYS_NS16550_MEM32
#define CONFIG_SYS_INIT_SP_ADDR 0x6010
#define CONFIG_SYS_LOAD_ADDR0x60800800
#define CONFIG_SPL_STACK0x10088000
diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h
index 78595b8..44d5c2a 100644
--- a/include/configs/rk3288_common.h
+++ b/include/configs/rk3288_common.h
@@ -19,8 +19,6 @@
#define CONFIG_SYS_TIMER_BASE   0xff810020 /* TIMER7 */
#define CONFIG_SYS_TIMER_COUNTER(CONFIG_SYS_TIMER_BASE + 8)

-#define CONFIG_SYS_NS16550_MEM32
-
#ifdef CONFIG_SPL_ROCKCHIP_BACK_TO_BROM
/* Bootrom will load u-boot binary to 0x0 once return from SPL */
#endif
diff --git a/include/configs/rk3328_common.h b/include/configs/rk3328_common.h
index 7018668..ce650c8 100644
--- a/include/configs/rk3328_common.h
+++ b/include/configs/rk3328_common.h
@@ -13,8 +13,6 @@
#define CONFIG_SYS_CBSIZE   1024
#define CONFIG_SKIP_LOWLEVEL_INIT

-#define CONFIG_SYS_NS16550_MEM32
-
#define CONFIG_SYS_INIT_SP_ADDR 0x0030
#define CONFIG_SYS_LOAD_ADDR0x00800800

diff --git a/include/configs/rk3368_common.h 

Re: [U-Boot] [U-Boot,05/36] rockchip: add STIMER_BASE for all SoCs

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


STIMER is can only access in secure mode if the SoCs supports trust,
and it locate in alive power domain, as the source of ARM arch/generic
timer, we add a base addr for all SoCs so that we can init with a common
function.


The commit message does not really tell what the source changes are 
(although it seems to describe part of the motivation for this change).




Signed-off-by: Kever Yang 
Acked-by: Philipp Tomsich 


See below for requested changes.


---

arch/arm/mach-rockchip/Kconfig | 19 +++
1 file changed, 19 insertions(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 007cb22..5dfe452 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -190,6 +190,25 @@ config ROCKCHIP_BOOT_MODE_REG
  The Soc will enter to different boot mode(defined in 
asm/arch/boot_mode.h)
  according to the value from this register.

+config ROCKCHIP_STIMER_BASE
+   hex "Rockchip Secure timer base address"
+   default 0xff220020 if ROCKCHIP_PX30


We don't have support for the PX30 in the U-Boot code base yet.
Until a series to add support for the PX30 comes in, you should not have 
this here yet (and then add this specific case when the PX30 support is 
added).



+   default 0x200440a0 if ROCKCHIP_RK3036
+   default 0x2000e000 if ROCKCHIP_RK3066
+   default 0x20018020 if ROCKCHIP_RK3126
+   default 0x200440a0 if ROCKCHIP_RK3128
+   default 0x2000e000 if ROCKCHIP_RK3188
+   default 0x110d0020 if ROCKCHIP_RK322X
+   default 0xff810020 if ROCKCHIP_RK3288
+   default 0xff1d0020 if ROCKCHIP_RK3328
+   default 0xff830020 if ROCKCHIP_RK3368
+   default 0xff8680a0 if ROCKCHIP_RK3399
+   default 0x10350020 if ROCKCHIP_RV1108
+   default 0
+   help
+ The secure timer inited in SPL/TPL in secure word, ARM generic timer
+ works after this timer work.


This should not be in Kconfig and rather in a header-file.
With what you do here, a user (e.g. via 'make menuconfig') or a defconfig 
file (e.g. due to a typo) could accidentially change overwrite this.



+
config ROCKCHIP_SPL_RESERVE_IRAM
hex "Size of IRAM reserved in SPL"
default 0


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 18/36] rockchip: rk3188: remove rockchip timer as sys timer

2018-04-01 Thread Philipp Tomsich
> We use ARM arch timer instead.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rk3188_common.h | 3 ---
>  1 file changed, 3 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 21/36] rockchip: rk3128: prepare use common board file

2018-04-01 Thread Philipp Tomsich
> remoe rk3128 board file and move SoC spec setting into rk3128.c
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk3128-board.c | 127 
> --
>  1 file changed, 127 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/rk3128-board.c
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 16/36] rockchip: sdram-common: add api to pass dram info to trust os

2018-04-01 Thread Philipp Tomsich
> Trust OS decode this info like this:
> https://github.com/ARM-software/arm-trusted-firmware/blob/master/plat/rockchip/common/drivers/parameter/ddr_parameter.c#L19
> We have to set a available value, or else we get error info from
> Trust OS like this:
> "ERROR:   over or zero region, nr=3145987, max=10"
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/include/asm/arch-rockchip/sdram_common.h |  4 
>  arch/arm/mach-rockchip/sdram_common.c | 21 +
>  2 files changed, 25 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,13/36] rockchip: rk3036: remove sys timer

2018-04-01 Thread Philipp Tomsich
> Use ARM arch timer instead.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rk3036_common.h | 4 
>  1 file changed, 4 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 02/36] rockchip: add common MACRO to enable sys arch timer

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


All rockchip SoCs can use ARM arch timer, let's enable it in
common header file


Please provide a commit message that is more descriptive of what actually 
happens... i.e. that COUNTER_FREQUENCY gets moved to a common header.  It 
would be great to document why this will always remain 24M.



Signed-off-by: Kever Yang 
Acked-by: Philipp Tomsich 


See below for requested changes.


---

include/configs/rk3368_common.h   | 2 --
include/configs/rk3399_common.h   | 2 --
include/configs/rockchip-common.h | 4 
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/configs/rk3368_common.h b/include/configs/rk3368_common.h
index 10f643f..a7fe4ca 100644
--- a/include/configs/rk3368_common.h
+++ b/include/configs/rk3368_common.h
@@ -22,8 +22,6 @@
#define CONFIG_SYS_CBSIZE   1024
#define CONFIG_SKIP_LOWLEVEL_INIT

-#define COUNTER_FREQUENCY   2400
-
#define CONFIG_SYS_NS16550_MEM32

#define CONFIG_SYS_INIT_SP_ADDR 0x0030
diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index d700bf2..fe8c675 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -17,8 +17,6 @@
#define CONFIG_SPL_SPI_LOAD
#endif

-#define COUNTER_FREQUENCY   2400
-
#define CONFIG_SYS_NS16550_MEM32

#define CONFIG_SYS_INIT_SP_ADDR 0x0030
diff --git a/include/configs/rockchip-common.h 
b/include/configs/rockchip-common.h
index 26d41b5..24651ce 100644
--- a/include/configs/rockchip-common.h
+++ b/include/configs/rockchip-common.h
@@ -8,6 +8,10 @@
#define _ROCKCHIP_COMMON_H_
#include 

+#define COUNTER_FREQUENCY   2400


Is this really safe for all past, current and future SOCs (after all: you 
are putting this into 'rockchip-common.h'?



+#define CONFIG_SYS_ARCH_TIMER


I don't agree with putting this here, as the CONFIG_SYS_ARCH_TIMER 
definition is only used on ARMv7, but this file is also included by ARMv8 
SOCs.



+#define CONFIG_SYS_HZ_CLOCK2400


You might want to have this refer back to COUNTER_FREQUENCY.


+
#ifndef CONFIG_SPL_BUILD

/* First try to boot from SD (index 0), then eMMC (index 1) */


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 15/36] rockchip: declare sdram_init() in common header

2018-04-01 Thread Philipp Tomsich
> We need a dedicate sdram_init() function for those SoCS not
> using SPL_FRAMEWORK.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/include/asm/arch-rockchip/sys_proto.h | 3 +++
>  1 file changed, 3 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 07/36] rockchip: rk3328: add BOOT_MODE_REG for rk3328

2018-04-01 Thread Philipp Tomsich
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 04/36] rockchip: defconfig: remove CONFIG_SYS_NS16550

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


We have enable NS16550 in Kconfig, do not need enable at defconfig


Did you generate this with moveconfig.py?



Signed-off-by: Kever Yang 
Acked-by: Philipp Tomsich 


Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 23/36] rockchip: rk3288: remove rockchip timer for sys timer

2018-04-01 Thread Philipp Tomsich
> Use ARM arch timer instead
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rk3288_common.h | 4 
>  1 file changed, 4 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 25/36] rockchip: rk3288: prepare to use common board file

2018-04-01 Thread Philipp Tomsich
> Use common board file and move SoC spec setting into rk3288.c
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk3288-board-spl.c  | 304 --
>  arch/arm/mach-rockchip/rk3288-board-tpl.c  |  84 -
>  arch/arm/mach-rockchip/rk3288-board.c  | 338 
> -
>  arch/arm/mach-rockchip/rk3288/rk3288.c | 304 +-
>  board/chipspark/popmetal_rk3288/popmetal-rk3288.c  |   9 +-
>  board/mqmaker/miqi_rk3288/miqi-rk3288.c|   7 -
>  board/phytec/phycore_rk3288/phycore-rk3288.c   |  45 ++-
>  board/rockchip/evb_rk3288/evb-rk3288.c |   7 -
>  .../rockchip/evb_rk3288_rk1608/evb-rk3288-rk1608.c |   8 +
>  board/rockchip/fennec_rk3288/fennec-rk3288.c   |   7 -
>  board/rockchip/tinker_rk3288/tinker-rk3288.c   |   2 +-
>  11 files changed, 357 insertions(+), 758 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/rk3288-board-spl.c
>  delete mode 100644 arch/arm/mach-rockchip/rk3288-board-tpl.c
>  delete mode 100644 arch/arm/mach-rockchip/rk3288-board.c
>  create mode 100644 board/rockchip/evb_rk3288_rk1608/evb-rk3288-rk1608.c
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 27/36] rockchip: rv1108: prepare to use common board file

2018-04-01 Thread Philipp Tomsich
> Remove functions will present at common board file.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rv1108/rv1108.c | 8 
>  board/rockchip/evb_rv1108/evb_rv1108.c | 6 --
>  2 files changed, 14 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 26/36] rockchip: rk1108: remove rockchip timer for sys timer

2018-04-01 Thread Philipp Tomsich
> We use ARM arch timer instead.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rv1108_common.h | 5 -
>  1 file changed, 5 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 29/36] rockchip: rk3368: prepare to use common board file

2018-04-01 Thread Philipp Tomsich
> Use common board file and move SoC spec setting into rk3368.c
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk3368-board-spl.c |  73 --
>  arch/arm/mach-rockchip/rk3368-board-tpl.c | 157 
> --
>  arch/arm/mach-rockchip/rk3368/rk3368.c| 116 ++--
>  board/geekbuying/geekbox/geekbox.c|   5 -
>  board/rockchip/evb_px5/evb-px5.c  |   5 -
>  board/rockchip/sheep_rk3368/sheep_rk3368.c|   5 -
>  board/theobroma-systems/lion_rk3368/lion_rk3368.c |   8 --
>  7 files changed, 106 insertions(+), 263 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/rk3368-board-spl.c
>  delete mode 100644 arch/arm/mach-rockchip/rk3368-board-tpl.c
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rockchip: clk: rk3288: add clk_enable function and support USB HOST0/HSIC

2018-04-01 Thread Philipp Tomsich
> The generic ehci-driver (ehci-generic.c) will try to enable the clocks
> listed in the DTSI. If this fails (e.g. due to clk_enable not being
> implemented in a driver and -ENOSYS being returned by the clk-uclass),
> the driver will bail our and print an error message.
> 
> This implements a minimal clk_enable for the RK3288 and supports the
> clocks mandatory for the EHCI controllers; as these are enabled by
> default we simply return success.
> 
> Signed-off-by: Wadim Egorov 
> ---
>  drivers/clk/rockchip/clk_rk3288.c | 13 +
>  1 file changed, 13 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 20/36] rockchip: rk3128: remove rockchip timer as systimer

2018-04-01 Thread Philipp Tomsich
> We use ARM arch timer instead.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rk3128_common.h | 4 
>  1 file changed, 4 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 30/36] rockchip: lion-rk3368: remove rockchip timer

2018-04-01 Thread Philipp Tomsich
> We use ARM generic timer.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  configs/lion-rk3368_defconfig | 4 
>  1 file changed, 4 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 33/36] rockchip: dts: rk3399-firefly: enable uart2 in spl

2018-04-01 Thread Philipp Tomsich
> pre-loader console in SPL needs UART.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/dts/rk3399-firefly.dts | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 31/36] rockchip: rk3399: prepare to use common board file

2018-04-01 Thread Philipp Tomsich
> Use common board file and move SoC spec setting into rk3399.c
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk3399-board-spl.c | 179 
> --
>  arch/arm/mach-rockchip/rk3399-board.c |  14 --
>  arch/arm/mach-rockchip/rk3399/rk3399.c|  86 +--
>  board/rockchip/evb_rk3399/evb-rk3399.c|  56 ---
>  board/theobroma-systems/puma_rk3399/puma-rk3399.c |  17 +-
>  5 files changed, 103 insertions(+), 249 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/rk3399-board-spl.c
>  delete mode 100644 arch/arm/mach-rockchip/rk3399-board.c
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 36/36] rockchip: add common board file for rockchip platform

2018-04-01 Thread Philipp Tomsich
> We use common board/spl/tpl file for all rockchip SoCs,
> - all the SoC spec setting should move into SoC file like rk3288.c;
> - tpl is option and only purpose to init DRAM, clock, uart(option);
> - spl do secure relate one time init, boot device select, boot into
>   U-Boot or trust or OS in falcon mode;
> - board do boot mode detect, enable regulator, usb init and so on.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/Makefile |  23 +
>  arch/arm/mach-rockchip/board.c  | 136 
>  arch/arm/mach-rockchip/spl.c| 195 
> 
>  arch/arm/mach-rockchip/tpl.c| 111 +++
>  4 files changed, 445 insertions(+), 20 deletions(-)
>  create mode 100644 arch/arm/mach-rockchip/board.c
>  create mode 100644 arch/arm/mach-rockchip/spl.c
>  create mode 100644 arch/arm/mach-rockchip/tpl.c
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 17/36] rockchip: sdram_common: add common dram_init_banksize

2018-04-01 Thread Philipp Tomsich
> dram_init_banksize() can be common used by all SoCs, move it into
> sdram_common.c
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/sdram_common.c | 63 
> ++-
>  1 file changed, 62 insertions(+), 1 deletion(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 22/36] rockchip: dts: rk3288: update spl-boot-order

2018-04-01 Thread Philipp Tomsich
> Use "uboot,spl-boot-orde" instead of "uboot,boot0".
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/dts/rk3288-phycore-rdk.dts | 6 +-
>  arch/arm/dts/rk3288-veyron.dtsi | 6 +-
>  2 files changed, 2 insertions(+), 10 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 28/36] rockchip: rk3328: prepare to use common board file

2018-04-01 Thread Philipp Tomsich
> Use common board file and move SoC spec setting into rk3328.c
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk3328/rk3328.c | 59 +-
>  board/rockchip/evb_rk3328/evb-rk3328.c | 66 
> --
>  2 files changed, 51 insertions(+), 74 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 12/36] rockchip: rk3036: sdram: use udelay instead of rockchip_udelay

2018-04-01 Thread Philipp Tomsich
> We are going to remove rockchip_udelay after enable arch timer.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk3036/sdram_rk3036.c | 19 +--
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 10/36] rockchip: rk322x: prepare to use common board file

2018-04-01 Thread Philipp Tomsich
> Move soc spec setting into rk322x.c and remove rk322x-board/board-spl.c
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk322x-board.c  | 155 
> -
>  arch/arm/mach-rockchip/rk322x/Makefile |   2 +-
>  .../{rk322x-board-spl.c => rk322x/rk322x.c}|  86 
>  3 files changed, 29 insertions(+), 214 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/rk322x-board.c
>  rename arch/arm/mach-rockchip/{rk322x-board-spl.c => rk322x/rk322x.c} (51%)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 19/36] rockchip: rk3188: prepare to use common board file

2018-04-01 Thread Philipp Tomsich
> Move SoC spec setting into rk3188.c
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk3188-board-spl.c | 226 
> --
>  arch/arm/mach-rockchip/rk3188-board.c |  82 ---
>  arch/arm/mach-rockchip/rk3188/Makefile|   1 +
>  arch/arm/mach-rockchip/rk3188/rk3188.c|  23 +++
>  4 files changed, 24 insertions(+), 308 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/rk3188-board-spl.c
>  delete mode 100644 arch/arm/mach-rockchip/rk3188-board.c
>  create mode 100644 arch/arm/mach-rockchip/rk3188/rk3188.c
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 14/36] rockchip: rk3036: prepare to use commong board file

2018-04-01 Thread Philipp Tomsich
> Move some soc spec setting into rk3036.c
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk3036-board.c  | 104 
> -
>  arch/arm/mach-rockchip/rk3036/Makefile |   2 +-
>  .../{rk3036-board-spl.c => rk3036/rk3036.c}|  41 ++--
>  arch/arm/mach-rockchip/rk3036/sdram_rk3036.c   |  14 +++
>  4 files changed, 24 insertions(+), 137 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/rk3036-board.c
>  rename arch/arm/mach-rockchip/{rk3036-board-spl.c => rk3036/rk3036.c} (50%)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 34/36] rockchip: spl-boot-order: do not enable with OF_PLATDATA

2018-04-01 Thread Philipp Tomsich
> The "fdt_*" functions may not enable even if the OF_CONTROL is enabled.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/spl-boot-order.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 24/36] armv8: add timer_get_boot_us() for generic timer

2018-04-01 Thread Philipp Tomsich
> We need timer_get_boot_us() for boot stage if we use generic timer only.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/cpu/armv8/generic_timer.c | 6 ++
>  1 file changed, 6 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 01/36] rockchip: rk3288: move configure_l2ctlr back to rk3288

2018-04-01 Thread Philipp Tomsich



On Tue, 27 Mar 2018, Kever Yang wrote:


The configure_l2ctlr() is used only by rk3288, do not need to
locate in sys_proto.h


Please elaborate on what the function does and why it is not needed by any 
of the other SOCs (after all: it has been available to all SOCs so far).



Signed-off-by: Kever Yang 
Acked-by: Philipp Tomsich 


This should be a standalone patch and doesn't need to be part of the
series it is in.  This series has way too many different things happening 
at once and needs to be broken up into individual series that do one 
well-defined thing each.


See below for requested changes.


---

arch/arm/include/asm/arch-rockchip/sys_proto.h | 22 --
arch/arm/mach-rockchip/rk3288/rk3288.c | 26 +-
2 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/sys_proto.h 
b/arch/arm/include/asm/arch-rockchip/sys_proto.h
index e428d59..3617ac2 100644
--- a/arch/arm/include/asm/arch-rockchip/sys_proto.h
+++ b/arch/arm/include/asm/arch-rockchip/sys_proto.h
@@ -7,27 +7,5 @@
#ifndef _ASM_ARCH_SYS_PROTO_H
#define _ASM_ARCH_SYS_PROTO_H

-#ifdef CONFIG_ROCKCHIP_RK3288
-#include 
-
-static void configure_l2ctlr(void)
-{
-   uint32_t l2ctlr;
-
-   l2ctlr = read_l2ctlr();
-   l2ctlr &= 0xfffc; /* clear bit0~bit17 */
-
-   /*
-   * Data RAM write latency: 2 cycles
-   * Data RAM read latency: 2 cycles
-   * Data RAM setup latency: 1 cycle
-   * Tag RAM write latency: 1 cycle
-   * Tag RAM read latency: 1 cycle
-   * Tag RAM setup latency: 1 cycle
-   */
-   l2ctlr |= (1 << 3 | 1 << 0);
-   write_l2ctlr(l2ctlr);
-}
-#endif /* CONFIG_ROCKCHIP_RK3288 */

#endif /* _ASM_ARCH_SYS_PROTO_H */
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c 
b/arch/arm/mach-rockchip/rk3288/rk3288.c
index acc3b79..1e1c6be 100644
--- a/arch/arm/mach-rockchip/rk3288/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
@@ -3,15 +3,39 @@
 *
 * SPDX-License-Identifier: GPL-2.0+
 */
+#include 
#include 
#include 

#define GRF_SOC_CON2 0xff77024c


Please make this a const-declaration in the function it is needed in.



+#ifdef CONFIG_SPL_BUILD


Should this really happen both for TPL and SPL?


+static void configure_l2ctlr(void)
+{
+   u32 l2ctlr;
+
+   l2ctlr = read_l2ctlr();
+   l2ctlr &= 0xfffc; /* clear bit0~bit17 */


What are bits 0...17?


+
+   /*
+* Data RAM write latency: 2 cycles
+* Data RAM read latency: 2 cycles
+* Data RAM setup latency: 1 cycle
+* Tag RAM write latency: 1 cycle
+* Tag RAM read latency: 1 cycle
+* Tag RAM setup latency: 1 cycle
+*/


Please add a symbolic way to assemble these (i.e. something that makes it 
easy for the casual reader to see what values you are writing to which 
bitfields).



+   l2ctlr |= (1 << 3 | 1 << 0);


From the "clear bit0 ~ bit17" and this, I assume you actually want to do a 
clrsetbits_le32...



+   write_l2ctlr(l2ctlr);
+}
+#endif
+
int arch_cpu_init(void)
{
/* We do some SoC one time setting here. */
-
+#ifdef CONFIG_SPL_BUILD
+   configure_l2ctlr();
+#else
/* Use rkpwm by default */
rk_setreg(GRF_SOC_CON2, 1 << 0);


Please use a symbolic way to write the (1 << 0), wo it is easy for the 
casual reader to see what gets enabled/disabled here.






___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,13/36] rockchip: rk3036: remove sys timer

2018-04-01 Thread Philipp Tomsich
> Use ARM arch timer instead.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rk3036_common.h | 4 
>  1 file changed, 4 deletions(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,32/36] rockchip: remove rk_timer

2018-04-01 Thread Philipp Tomsich
> We do not use rk_timer.c now, remove it.
> 
> Signed-off-by: Kever Yang 
> Acked-by: Philipp Tomsich 
> ---
> 
>  arch/arm/mach-rockchip/rk_timer.c | 48 
> ---
>  1 file changed, 48 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/rk_timer.c
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 34/36] rockchip: spl-boot-order: do not enable with OF_PLATDATA

2018-04-01 Thread Philipp Tomsich
> The "fdt_*" functions may not enable even if the OF_CONTROL is enabled.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/spl-boot-order.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 11/36] rockchip: defconfig enable sysreset for rk3229 spl

2018-04-01 Thread Philipp Tomsich
> We need CONFIG_SPL_DRIVERS_MISC_SUPPORT to enable sysreset driver,
> which will fix missing do_reset() error in SPL build.
> 
> Signed-off-by: Kever Yang 
> Acked-by: Philipp Tomsich 
> ---
> 
>  configs/evb-rk3229_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 22/36] rockchip: dts: rk3288: update spl-boot-order

2018-04-01 Thread Philipp Tomsich
> Use "uboot,spl-boot-orde" instead of "uboot,boot0".
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/dts/rk3288-phycore-rdk.dts | 6 +-
>  arch/arm/dts/rk3288-veyron.dtsi | 6 +-
>  2 files changed, 2 insertions(+), 10 deletions(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 09/36] rockchip: rk322x: sdram: use common udelay instead of rockchip_udelay

2018-04-01 Thread Philipp Tomsich
> Do not need to use rockchip_udelay after we can use systimer.
> 
> Signed-off-by: Kever Yang 
> Acked-by: Philipp Tomsich 
> ---
> 
>  drivers/ram/rockchip/sdram_rk322x.c | 29 ++---
>  1 file changed, 14 insertions(+), 15 deletions(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 11/36] rockchip: defconfig enable sysreset for rk3229 spl

2018-04-01 Thread Philipp Tomsich
> We need CONFIG_SPL_DRIVERS_MISC_SUPPORT to enable sysreset driver,
> which will fix missing do_reset() error in SPL build.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  configs/evb-rk3229_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,32/36] rockchip: remove rk_timer

2018-04-01 Thread Philipp Tomsich
> We do not use rk_timer.c now, remove it.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk_timer.c | 48 
> ---
>  1 file changed, 48 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/rk_timer.c
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 06/36] rockchip: add IRAM_START_ADDR for all SoCs

2018-04-01 Thread Philipp Tomsich
> We add this for get the location for boot device of bootrom.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/Kconfig | 17 +
>  1 file changed, 17 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 09/36] rockchip: rk322x: sdram: use common udelay instead of rockchip_udelay

2018-04-01 Thread Philipp Tomsich
> Do not need to use rockchip_udelay after we can use systimer.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  drivers/ram/rockchip/sdram_rk322x.c | 29 ++---
>  1 file changed, 14 insertions(+), 15 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 03/36] rockchip: enable SYS_NS16550 for all SoCs by default

2018-04-01 Thread Philipp Tomsich
> All rockchip SoCs can use ns16550 driver, enable it for all
> and set SYS_NS16550_MEM32 for all SoCs.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/Kconfig  | 1 +
>  arch/arm/mach-rockchip/Kconfig| 1 -
>  include/configs/rk3036_common.h   | 3 ---
>  include/configs/rk3128_common.h   | 2 --
>  include/configs/rk3188_common.h   | 2 --
>  include/configs/rk322x_common.h   | 1 -
>  include/configs/rk3288_common.h   | 2 --
>  include/configs/rk3328_common.h   | 2 --
>  include/configs/rk3368_common.h   | 2 --
>  include/configs/rk3399_common.h   | 2 --
>  include/configs/rockchip-common.h | 2 ++
>  include/configs/rv1108_common.h   | 3 ---
>  12 files changed, 3 insertions(+), 20 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,05/36] rockchip: add STIMER_BASE for all SoCs

2018-04-01 Thread Philipp Tomsich
> STIMER is can only access in secure mode if the SoCs supports trust,
> and it locate in alive power domain, as the source of ARM arch/generic
> timer, we add a base addr for all SoCs so that we can init with a common
> function.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/Kconfig | 19 +++
>  1 file changed, 19 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 04/36] rockchip: defconfig: remove CONFIG_SYS_NS16550

2018-04-01 Thread Philipp Tomsich
> We have enable NS16550 in Kconfig, do not need enable at defconfig
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  configs/evb-rk3128_defconfig  | 1 -
>  configs/evb-rk3229_defconfig  | 1 -
>  configs/evb-rk3288_defconfig  | 1 -
>  configs/evb-rk3328_defconfig  | 1 -
>  configs/evb-rk3399_defconfig  | 1 -
>  configs/fennec-rk3288_defconfig   | 1 -
>  configs/firefly-rk3288_defconfig  | 1 -
>  configs/firefly-rk3399_defconfig  | 1 -
>  configs/miqi-rk3288_defconfig | 1 -
>  configs/phycore-rk3288_defconfig  | 1 -
>  configs/popmetal-rk3288_defconfig | 1 -
>  configs/puma-rk3399_defconfig | 1 -
>  configs/tinker-rk3288_defconfig   | 1 -
>  configs/vyasa-rk3288_defconfig| 1 -
>  14 files changed, 14 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 02/36] rockchip: add common MACRO to enable sys arch timer

2018-04-01 Thread Philipp Tomsich
> All rockchip SoCs can use ARM arch timer, let's enable it in
> common header file
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rk3368_common.h   | 2 --
>  include/configs/rk3399_common.h   | 2 --
>  include/configs/rockchip-common.h | 4 
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 08/36] rockchip: rk322x: remove use rockchip timer as sys timer

2018-04-01 Thread Philipp Tomsich
> We can use arch timer instead of rockchip timer.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rk322x_common.h | 3 ---
>  1 file changed, 3 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 01/36] rockchip: rk3288: move configure_l2ctlr back to rk3288

2018-04-01 Thread Philipp Tomsich
> The configure_l2ctlr() is used only by rk3288, do not need to
> locate in sys_proto.h
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/include/asm/arch-rockchip/sys_proto.h | 22 --
>  arch/arm/mach-rockchip/rk3288/rk3288.c | 26 
> +-
>  2 files changed, 25 insertions(+), 23 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/2] Migrate CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig

2018-04-01 Thread Petr Vorel
Hi Alex,

> Convert CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig

> Signed-off-by: Alex Kiernan 
> Reviewed-by: Lukasz Majewski 
Reviewed-by: Petr Vorel 
> ---

> Changes in v2:
> - Rebase against master
> - Drop default in Kconfig to avoid over conversion by moveconfig
> - Resolve conflict in include/configs/am335x_igep003x.h


Kind regards,
Petr
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/2] Cleanup CONFIG_VERSION_VARIABLE migration

2018-04-01 Thread Petr Vorel
Hi Alex,

> CONFIG_VERSION_VARIABLE had already been mostly migrated to Kconfig,
> but two headers still referenced it. Also set defaults so that
> most of the defconfigs inherit the default rather than needing it
> to be set explicitly.

> Signed-off-by: Alex Kiernan 
Reviewed-by: Petr Vorel 
> ---

> Changes in v2:
> - Remove default from Kconfig to avoid over-conversion by moveconfig


Kind regards,
Petr
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/2] Migrate CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig

2018-04-01 Thread Alex Kiernan
Convert CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig

Signed-off-by: Alex Kiernan 
Reviewed-by: Lukasz Majewski 
---

Changes in v2:
- Rebase against master
- Drop default in Kconfig to avoid over conversion by moveconfig
- Resolve conflict in include/configs/am335x_igep003x.h

 README | 6 --
 configs/am335x_baltos_defconfig| 3 ++-
 configs/am335x_boneblack_defconfig | 3 ++-
 configs/am335x_boneblack_vboot_defconfig   | 3 ++-
 configs/am335x_evm_defconfig   | 3 ++-
 configs/am335x_evm_nor_defconfig   | 3 ++-
 configs/am335x_evm_norboot_defconfig   | 1 +
 configs/am335x_evm_spiboot_defconfig   | 3 ++-
 configs/am335x_evm_usbspl_defconfig| 3 ++-
 configs/am335x_hs_evm_defconfig| 3 ++-
 configs/am335x_hs_evm_uart_defconfig   | 3 ++-
 configs/am335x_igep003x_defconfig  | 3 ++-
 configs/am335x_shc_defconfig   | 3 ++-
 configs/am335x_shc_ict_defconfig   | 3 ++-
 configs/am335x_shc_netboot_defconfig   | 3 ++-
 configs/am335x_shc_prompt_defconfig| 3 ++-
 configs/am335x_shc_sdboot_defconfig| 3 ++-
 configs/am335x_shc_sdboot_prompt_defconfig | 3 ++-
 configs/am335x_sl50_defconfig  | 3 ++-
 configs/am43xx_evm_defconfig   | 3 ++-
 configs/am43xx_evm_ethboot_defconfig   | 3 ++-
 configs/am43xx_evm_qspiboot_defconfig  | 1 +
 configs/am43xx_evm_usbhost_boot_defconfig  | 3 ++-
 configs/am43xx_hs_evm_defconfig| 3 ++-
 configs/am57xx_evm_defconfig   | 3 ++-
 configs/am57xx_hs_evm_defconfig| 3 ++-
 configs/apalis_imx6_defconfig  | 3 ++-
 configs/apalis_imx6_nospl_com_defconfig| 1 +
 configs/apalis_imx6_nospl_it_defconfig | 1 +
 configs/birdland_bav335a_defconfig | 3 ++-
 configs/birdland_bav335b_defconfig | 3 ++-
 configs/cgtqmx6eval_defconfig  | 3 ++-
 configs/cl-som-am57x_defconfig | 3 ++-
 configs/cm_fx6_defconfig   | 3 ++-
 configs/cm_t43_defconfig   | 3 ++-
 configs/cm_t54_defconfig   | 3 ++-
 configs/colibri_imx6_defconfig | 3 ++-
 configs/colibri_imx6_nospl_defconfig   | 1 +
 configs/colibri_imx7_defconfig | 1 +
 configs/colibri_pxa270_defconfig   | 1 +
 configs/colibri_vf_defconfig   | 1 +
 configs/dra7xx_evm_defconfig   | 3 ++-
 configs/dra7xx_hs_evm_defconfig| 3 ++-
 configs/duovero_defconfig  | 3 ++-
 configs/imx6q_logic_defconfig  | 1 +
 configs/k2g_evm_defconfig  | 3 ++-
 configs/k2g_hs_evm_defconfig   | 1 +
 configs/mccmon6_nor_defconfig  | 3 ++-
 configs/mccmon6_sd_defconfig   | 3 ++-
 configs/mx6cuboxi_defconfig| 3 ++-
 configs/mx6sabreauto_defconfig | 3 ++-
 configs/mx6sabresd_defconfig   | 3 ++-
 configs/mx6sxsabresd_defconfig | 1 +
 configs/mx6sxsabresd_spl_defconfig | 3 ++-
 configs/mx6ul_14x14_evk_defconfig  | 3 ++-
 configs/mx6ul_9x9_evk_defconfig| 3 ++-
 configs/mx6ull_14x14_evk_defconfig | 1 +
 configs/mx6ull_14x14_evk_plugin_defconfig  | 1 +
 configs/odroid-xu3_defconfig   | 1 +
 configs/odroid_defconfig   | 1 +
 configs/omap4_panda_defconfig  | 3 ++-
 configs/omap5_uevm_defconfig   | 3 ++-
 configs/pcm051_rev1_defconfig  | 3 ++-
 configs/pcm051_rev3_defconfig  | 3 ++-
 configs/pengwyn_defconfig  | 3 ++-
 configs/pepper_defconfig   | 3 ++-
 configs/rpi_0_w_defconfig  | 1 +
 configs/rpi_2_defconfig| 1 +
 configs/rpi_3_32b_defconfig| 1 +
 configs/rpi_3_defconfig| 1 +
 configs/rpi_defconfig  | 1 +
 configs/s5p_goni_defconfig | 1 +
 configs/s5pc210_universal_defconfig| 1 +
 configs/sama5d36ek_cmp_mmc_defconfig   | 1 +
 configs/sama5d36ek_cmp_nandflash_defconfig | 1 +
 configs/sama5d36ek_cmp_spiflash_defconfig  | 1 +
 configs/sama5d3xek_mmc_defconfig   | 3 ++-
 configs/sama5d3xek_nandflash_defconfig | 3 ++-
 configs/sama5d3xek_spiflash_defconfig  | 3 ++-
 configs/ti814x_evm_defconfig   | 3 ++-
 configs/trats2_defconfig   | 1 +
 configs/trats_defconfig| 1 +
 configs/udoo_defconfig | 3 ++-
 configs/udoo_neo_defconfig | 3 ++-
 configs/vining_2000_defconfig  | 1 +
 configs/wandboard_defconfig| 3 ++-
 configs/wb50n_defconfig| 3 ++-
 configs/zc5202_defconfig   | 3 ++-
 configs/zc5601_defconfig   | 3 ++-
 env/Kconfig| 7 +++
 include/configs/am335x_evm.h   | 

[U-Boot] [PATCH v2 2/2] Cleanup CONFIG_VERSION_VARIABLE migration

2018-04-01 Thread Alex Kiernan
CONFIG_VERSION_VARIABLE had already been mostly migrated to Kconfig,
but two headers still referenced it. Also set defaults so that
most of the defconfigs inherit the default rather than needing it
to be set explicitly.

Signed-off-by: Alex Kiernan 
---

Changes in v2:
- Remove default from Kconfig to avoid over-conversion by moveconfig

 README  | 8 
 configs/apalis_imx6_defconfig   | 1 +
 configs/apalis_imx6_nospl_com_defconfig | 1 +
 configs/apalis_imx6_nospl_it_defconfig  | 1 +
 configs/colibri_imx6_defconfig  | 1 +
 configs/colibri_imx6_nospl_defconfig| 1 +
 include/configs/apalis_imx6.h   | 3 ---
 include/configs/colibri_imx6.h  | 3 ---
 8 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/README b/README
index a831585..f16a4f9 100644
--- a/README
+++ b/README
@@ -812,14 +812,6 @@ The following options need to be configured:
CONFIG_AT91_HW_WDT_TIMEOUT
specify the timeout in seconds. default 2 seconds.
 
-- U-Boot Version:
-   CONFIG_VERSION_VARIABLE
-   If this variable is defined, an environment variable
-   named "ver" is created by U-Boot showing the U-Boot
-   version as printed by the "version" command.
-   Any change to this variable will be reverted at the
-   next reset.
-
 - Real-Time Clock:
 
When CONFIG_CMD_DATE is selected, the type of the RTC
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index ff9b74b..18ae293 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -14,6 +14,7 @@ 
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_BOOTDELAY=1
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SUPPORT_RAW_INITRD=y
+CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_DMA_SUPPORT=y
diff --git a/configs/apalis_imx6_nospl_com_defconfig 
b/configs/apalis_imx6_nospl_com_defconfig
index 63cc86d..5c7bb83 100644
--- a/configs/apalis_imx6_nospl_com_defconfig
+++ b/configs/apalis_imx6_nospl_com_defconfig
@@ -9,6 +9,7 @@ 
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/toradex/apalis_imx6/apalis_imx6q.cfg,
 CONFIG_BOOTDELAY=1
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SUPPORT_RAW_INITRD=y
+CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/apalis_imx6_nospl_it_defconfig 
b/configs/apalis_imx6_nospl_it_defconfig
index 4d047c2..febb53d 100644
--- a/configs/apalis_imx6_nospl_it_defconfig
+++ b/configs/apalis_imx6_nospl_it_defconfig
@@ -9,6 +9,7 @@ 
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/toradex/apalis_imx6/apalis_imx6q.cfg,
 CONFIG_BOOTDELAY=1
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SUPPORT_RAW_INITRD=y
+CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 49c5bff..a9a6c0a 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -14,6 +14,7 @@ 
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6DL"
 CONFIG_BOOTDELAY=1
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SUPPORT_RAW_INITRD=y
+CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_DMA_SUPPORT=y
diff --git a/configs/colibri_imx6_nospl_defconfig 
b/configs/colibri_imx6_nospl_defconfig
index b74543d..a7f1424 100644
--- a/configs/colibri_imx6_nospl_defconfig
+++ b/configs/colibri_imx6_nospl_defconfig
@@ -9,6 +9,7 @@ 
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/toradex/colibri_imx6/colibri_imx6.cfg
 CONFIG_BOOTDELAY=1
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SUPPORT_RAW_INITRD=y
+CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index 780e6cf..bd8a6ee 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -39,9 +39,6 @@
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE   UART1_BASE
 
-/* Make the HW version stuff available in U-Boot env */
-#define CONFIG_VERSION_VARIABLE/* ver environment variable */
-
 /* I2C Configs */
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MXC
diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index 42396e8..ba7708c 100644
--- a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -37,9 +37,6 @@
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE   UART1_BASE
 
-/* Make the HW version stuff available in U-Boot env */
-#define CONFIG_VERSION_VARIABLE/* ver environment variable */
-
 /* I2C Configs */
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MXC
-- 
2.7.4


Re: [U-Boot] [PATCH 2/5] fdt_region: remove unneeded fdt_internal.h inclusion

2018-04-01 Thread Simon Glass
On 23 March 2018 at 22:30, Simon Glass  wrote:
> On 21 March 2018 at 03:03, Masahiro Yamada
>  wrote:
>> fdt_region.c does not depend on anything in libfdt_internal.h
>>
>> Signed-off-by: Masahiro Yamada 
>> ---
>>
>>  lib/libfdt/fdt_region.c | 2 --
>>  1 file changed, 2 deletions(-)
>
> Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/5] libfdt: move FDT_RAMDISK_OVERHEAD to image-fdt.c

2018-04-01 Thread Simon Glass
On 23 March 2018 at 22:30, Simon Glass  wrote:
> On 21 March 2018 at 03:03, Masahiro Yamada
>  wrote:
>> This macro is locally referenced in common/image-fdt.c
>>
>> Signed-off-by: Masahiro Yamada 
>> ---
>>
>>  common/image-fdt.c | 3 +++
>>  include/linux/libfdt.h | 3 ---
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] fs: cbfs: fix locating the cbfs header

2018-04-01 Thread Simon Glass
On 1 April 2018 at 22:19, Simon Glass  wrote:
> Hi,
>
> On 22 February 2018 at 08:08, Alexander Graf  wrote:
>>
>>
>> On 15.02.18 07:40, Andre Heider wrote:
>>> The value at the end of the rom is not a pointer, it is an offset
>>> relative to the end of rom.
>>
>> Do you have any documentation pointers to this? Even just pointing to a
>> specific line of code in coreboot would be helpful in case anyone wants
>> to read it up.
>>
>>>
>>> Signed-off-by: Andre Heider 
>>> ---
>>>  fs/cbfs/cbfs.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
>>> index 6e1107d751..46da8f134f 100644
>>> --- a/fs/cbfs/cbfs.c
>>> +++ b/fs/cbfs/cbfs.c
>>> @@ -168,9 +168,9 @@ static int file_cbfs_load_header(uintptr_t end_of_rom,
>>>struct cbfs_header *header)
>>>  {
>>>   struct cbfs_header *header_in_rom;
>>> + int32_t offset = *(u32 *)(end_of_rom - 3);
>>
>> Accessing a pointer that gets subtracted by 3 looks terribly wrong.
>> Unfortunately it's correct, because the pointer itself is unaligned.
>>
>> How about we change the logic so that we calculate an aligned pointer
>> (after_rom?) which we sanity check for alignment and base all
>> calculations on that instead?
>>
>> That way the next time someone comes around he's not getting puzzled why
>> we're subtracting 3 and adding 1 to the pointer ;).
>
> Either that or a comment would be nice. But since this has been
> sitting around for a while and fixes a bug I think it is best to take
> it. Please feel free to send a follow-up patch..
>
> We also have no tests for this code, so I'd really like to get some
> tests in there!
>
> Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/5] image.h: add forward declaration of struct fdt_region

2018-04-01 Thread Simon Glass
On 23 March 2018 at 22:30, Simon Glass  wrote:
> On 21 March 2018 at 03:03, Masahiro Yamada
>  wrote:
>> This header needs to know 'fdt_region' is a struct for the
>> fit_region_make_list() prototype.
>>
>> Signed-off-by: Masahiro Yamada 
>> ---
>>
>>  include/image.h | 1 +
>>  1 file changed, 1 insertion(+)
>
> Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible

2018-04-01 Thread Simon Glass
On 20 March 2018 at 08:56, Andy Yan  wrote:
> Hi Simon:
>
>
>
> On 2018年03月20日 01:58, Simon Glass wrote:
>>
>> Hi Andy,
>>
>> On 10 March 2018 at 23:58, Andy Yan  wrote:
>>>
>>> Hi Simon:
>>>
>>>
>>>
>>> On 2018年03月09日 05:03, Simon Glass wrote:

 Hi Andy.

 On 28 February 2018 at 23:08, Andy Yan  wrote:
>
> dm_scan_fdt_node can't work when live dt is active,
> we should use dm_scan_fdt_live instead.
>
> Signed-off-by: Andy Yan 
> ---
>
>drivers/core/root.c | 16 +++-
>1 file changed, 11 insertions(+), 5 deletions(-)
>
 Reviewed-by: Simon Glass 

 with change below

> diff --git a/drivers/core/root.c b/drivers/core/root.c
> index 36336b6..b437892 100644
> --- a/drivers/core/root.c
> +++ b/drivers/core/root.c
> @@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent,
> const void *blob,
>
>int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>{
> -   int node, ret;
> +   int ret;
> +   ofnode node;
>
>   ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
>   if (ret) {
> @@ -342,13 +343,18 @@ int dm_extended_scan_fdt(const void *blob, bool
> pre_reloc_only)
>   }
>
>   /* bind fixed-clock */
> -   node = ofnode_to_offset(ofnode_path("/clocks"));
> +   node = ofnode_path("/clocks");
>   /* if no DT "clocks" node, no need to go further */
> -   if (node < 0)
> +   if (!ofnode_valid(node))
>   return ret;
>
> -   ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
> -  pre_reloc_only);
> +#if CONFIG_IS_ENABLED(OF_LIVE)

 You should be able to drop this #if since of_live_active() takes care of
 it.
>>>
>>>
>>>  But I found function dm_scan_fdt_live is depends on #if
>>> CONFIG_IS_ENABLE(OF_LIVE)
>>
>> Yes, I wonder if that can be removed, if the above becomes an if() ?
>
>
> dm_scan_fdt_live only called in root.c, and the caller use
> if(of_live_active) as a check, so I think we can remove the #if
>
>>
>> If not, then what you have now is OK.
>>

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] core: ofnode: Fix translation for #size-cells == 0

2018-04-01 Thread Simon Glass
On 20 March 2018 at 01:58, Simon Glass  wrote:
> On 12 March 2018 at 07:53, Mario Six  wrote:
>> Commit 286ede6 ("drivers: core: Add translation in live tree case") made
>> dev_get_addr always use proper bus translations for addresses read from
>> the device tree. But this leads to problems with certain busses, e.g.
>> I2C busses, which run into an error during translation, and hence stop
>> working.
>>
>> It turns out that of_translate_address() and fdt_translate_address()
>> stop the address translation with an error when they're asked to
>> translate addresses for busses where #size-cells == 0 (comment from
>> drivers/core/of_addr.c):
>>
>>  * Note: We consider that crossing any level with #size-cells == 0 to mean
>>  * that translation is impossible (that is we are not dealing with a value
>>  * that can be mapped to a cpu physical address). This is not really 
>> specified
>>  * that way, but this is traditionally the way IBM at least do things
>>
>> To fix this case, we check in both the live-tree and non-live tree-case,
>> whether the bus of the device whose address is about to be translated
>> has size-cell size zero. If this is the case, we just read the address
>> as a plain integer and return it, and only apply bus translations if the
>> size-cell size if greater than zero.
>>
>> Signed-off-by: Mario Six 
>> Signed-off-by: Martin Fuzzey 
>> Reported-by: Martin Fuzzey 
>> Fixes: 286ede6 ("drivers: core: Add translation in live tree case")
>> ---
>>
>> v1 -> v2:
>> * Add unit tests for address translation as suggested by Simon Glass
>>
>> ---
>>  arch/sandbox/dts/test.dts | 48 
>> +++
>>  drivers/core/fdtaddr.c| 17 +++--
>>  drivers/core/ofnode.c |  5 -
>>  include/dm/uclass-id.h|  1 +
>>  test/dm/test-fdt.c| 43 ++
>>  5 files changed, 107 insertions(+), 7 deletions(-)
>>
>
> Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2, 2/2] pinctrl-uclass: convert to use live dt

2018-04-01 Thread Simon Glass
On 9 February 2018 at 18:15, Philipp Tomsich
 wrote:
>> Use live dt interface for pinctrl_select_state_full()
>>
>> Signed-off-by: Kever Yang 
>> ---
>>
>> Changes in v2: None
>>
>>  drivers/pinctrl/pinctrl-uclass.c | 20 +---
>>  1 file changed, 5 insertions(+), 15 deletions(-)
>>
>
> Reviewed-by: Philipp Tomsich 

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] cmd: cbfs: fix reading the end_of_rom pointer for 64bit archs

2018-04-01 Thread Simon Glass
On 22 February 2018 at 07:59, Alexander Graf  wrote:
>
>
> On 15.02.18 07:40, Andre Heider wrote:
>> The cast breaks the pointer on 64bit archs, so lets get rid of it.
>>
>> Signed-off-by: Andre Heider 
>
> Reviewed-by: Alexander Graf 

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/2] core: add uclass_get_device_by_phandle_id() api

2018-04-01 Thread Simon Glass
Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


  1   2   >