Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-05 Thread Anup Patel
On Tue, Feb 5, 2019 at 8:30 PM Andreas Schwab  wrote:
>
> On Feb 05 2019, Anup Patel  wrote:
>
> > Ahh, looks like it is not picking up "CC" set by Makefile. This might
> > be because you have removed "-R" from MAKEFLAGS.
>
> Nope.  That fixed it.

Cool, I had already approved your PR on OpenSBI Github.

Most of us just do cross-compilation so thanks for trying
native compilation.

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-05 Thread Andreas Schwab
On Feb 05 2019, Anup Patel  wrote:

> Ahh, looks like it is not picking up "CC" set by Makefile. This might
> be because you have removed "-R" from MAKEFLAGS.

Nope.  That fixed it.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-05 Thread Anup Patel
On Tue, Feb 5, 2019 at 8:09 PM Andreas Schwab  wrote:
>
> mkdir -p `dirname 
> /net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep`;
>  echo " AS-DEPplatform/sifive/fu540/firmware/fw_payload.dep"; echo -n 
> `dirname 
> /net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep`/
>  > 
> /net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep
>  &&  -g -Wall -nostdlib -D__ASSEMBLY__ -fno-omit-frame-pointer 
> -fno-optimize-sibling-calls -mno-save-restore -mstrict-align 
> -I/net/hawking/daten/src/riscv/opensbi/platform/sifive/fu540/include 
> -I/net/hawking/daten/src/riscv/opensbi/platform/common/include 
> -I/net/hawking/daten/src/riscv/opensbi/include 
> -I/net/hawking/daten/src/riscv/opensbi/platform/common/libfdt/   
> -DFW_TEXT_START=0x8000 -DFW_JUMP_ADDR=0x8020 
> -DFW_JUMP_FDT_ADDR=0x8220 
> -DFW_PAYLOAD_PATH=/boot/Image-5.0.0-rc5-00011-gcf1db34127ee 
> -DFW_PAYLOAD_OFFSET=0x20 -DFW_PAYLOAD_FDT_ADDR=0x8220 -mabi=lp64 
> -march=rv64imafdc -mcmodel=medany  
> -I/net/hawking/daten/src/riscv/opensbi/firmware -D__OBJNAME__=fw_payload.dep 
> -MM /net/hawking/daten/src/riscv/opensbi/firmware/fw_payload.S >> 
> /net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep
>  || rm -f 
> /net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep

Ahh, looks like it is not picking up "CC" set by Makefile. This might
be because you have removed "-R" from MAKEFLAGS.

CC should be either "$(CROSS_COMPILE)gcc" or "gcc".

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-05 Thread Andreas Schwab
mkdir -p `dirname 
/net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep`;
 echo " AS-DEPplatform/sifive/fu540/firmware/fw_payload.dep"; echo -n 
`dirname 
/net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep`/
 > 
/net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep
 &&  -g -Wall -nostdlib -D__ASSEMBLY__ -fno-omit-frame-pointer 
-fno-optimize-sibling-calls -mno-save-restore -mstrict-align 
-I/net/hawking/daten/src/riscv/opensbi/platform/sifive/fu540/include 
-I/net/hawking/daten/src/riscv/opensbi/platform/common/include 
-I/net/hawking/daten/src/riscv/opensbi/include 
-I/net/hawking/daten/src/riscv/opensbi/platform/common/libfdt/   
-DFW_TEXT_START=0x8000 -DFW_JUMP_ADDR=0x8020 
-DFW_JUMP_FDT_ADDR=0x8220 
-DFW_PAYLOAD_PATH=/boot/Image-5.0.0-rc5-00011-gcf1db34127ee 
-DFW_PAYLOAD_OFFSET=0x20 -DFW_PAYLOAD_FDT_ADDR=0x8220 -mabi=lp64 
-march=rv64imafdc -mcmodel=medany  
-I/net/hawking/daten/src/riscv/opensbi/firmware -D__OBJNAME__=fw_payload.dep 
-MM /net/hawking/daten/src/riscv/opensbi/firmware/fw_payload.S >> 
/net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep
 || rm -f 
/net/hawking/daten/src/riscv/opensbi/build/platform/sifive/fu540/firmware/fw_payload.dep

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-05 Thread Anup Patel
On Tue, Feb 5, 2019 at 7:10 PM Andreas Schwab  wrote:
>
> On Feb 05 2019, Anup Patel  wrote:
>
> > Okay, if you are doing native compilation then
> > make sure CROSS_COMPILE is not set so that
> > makefile will take native compiler instead of
> > cross-compiler.
>
>  AS-DEPplatform/sifive/fu540/firmware/fw_payload.dep
> /bin/sh: -g: command not found

Can you share output of make with "V=1" parameter?

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-05 Thread Andreas Schwab
On Feb 05 2019, Anup Patel  wrote:

> Okay, if you are doing native compilation then
> make sure CROSS_COMPILE is not set so that
> makefile will take native compiler instead of
> cross-compiler.

 AS-DEPplatform/sifive/fu540/firmware/fw_payload.dep
/bin/sh: -g: command not found

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-05 Thread Anup Patel
On Tue, Feb 5, 2019 at 6:21 PM Andreas Schwab  wrote:
>
> On Feb 05 2019, Anup Patel  wrote:
>
> > The OpenSBI build is similar to Linux and U-Boot. We expect
> > CROSS_COMPILE environment variable to be set.
>
> Why?  That doesn't make sense.

Use of CROSS_COMPILE environment variable is
pretty common across open-source projects to support
cross compilation.

>
> > Example, if you cross-compiler
>
> I don't have a cross compiler.

Okay, if you are doing native compilation then
make sure CROSS_COMPILE is not set so that
makefile will take native compiler instead of
cross-compiler.

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-05 Thread Andreas Schwab
On Feb 05 2019, Anup Patel  wrote:

> The OpenSBI build is similar to Linux and U-Boot. We expect
> CROSS_COMPILE environment variable to be set.

Why?  That doesn't make sense.

> Example, if you cross-compiler

I don't have a cross compiler.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-05 Thread Anup Patel
On Mon, Feb 4, 2019 at 6:40 PM Andreas Schwab  wrote:
>
> On Feb 04 2019, Atish Patra  wrote:
>
> > Probably your cross compilation is not set. Can you try this ?
> >
> > export ARCH=riscv
> > export CROSS_COMPILE= 
>
> There is no cross compile prefix.
>

The OpenSBI build is similar to Linux and U-Boot. We expect
CROSS_COMPILE environment variable to be set.

Make sure, CROSS_COMPILE environment variable is set and
exported before running make.

Example, if you cross-compiler is riscv64-unknown-linux-gnu-gcc
then do:
# export CROSS_COMPILE=riscv64-unknown-linux-gnu-

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-04 Thread Andreas Schwab
On Feb 04 2019, Atish Patra  wrote:

> Probably your cross compilation is not set. Can you try this ?
>
> export ARCH=riscv
> export CROSS_COMPILE= 

There is no cross compile prefix.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-04 Thread Atish Patra
Probably your cross compilation is not set. Can you try this ?

export ARCH=riscv
export CROSS_COMPILE= 

Sent from my iPhone

> On Feb 4, 2019, at 11:17 AM, Andreas Schwab  wrote:
> 
>> On Feb 03 2019, Anup Patel  wrote:
>> 
>> Can try with https://github.com/riscv/opensbi.git ?
> 
> AS-DEPplatform/sifive/fu540/firmware/fw_payload.dep
> /bin/sh: -g: command not found
> 
> Andreas.
> 
> -- 
> Andreas Schwab, SUSE Labs, sch...@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-04 Thread Andreas Schwab
On Feb 03 2019, Anup Patel  wrote:

> Can try with https://github.com/riscv/opensbi.git ?

 AS-DEPplatform/sifive/fu540/firmware/fw_payload.dep
/bin/sh: -g: command not found

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-02-02 Thread Anup Patel
On Thu, Jan 24, 2019 at 7:27 PM Andreas Schwab  wrote:
>
> On Jan 24 2019, Alexander Graf  wrote:
>
> > On 24.01.19 14:38, Andreas Schwab wrote:
> >> On Jan 24 2019, Alexander Graf  wrote:
> >>
> >>> Board_init() is too late. This needs to go into early_board_init_f().
> >>
> >> I don't think we can modify the DT that early.
> >
> > I'm sure we can. Worst case we have to copy it over to RAM first.
>
> reserve_fdt is only called much later.

OpenSBI is public now.

Can try with https://github.com/riscv/opensbi.git ?

There is README for SiFive FU540 at
/docs/platform/sifive_fu540.md

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-24 Thread Andreas Schwab
On Jan 24 2019, Alexander Graf  wrote:

> On 24.01.19 14:38, Andreas Schwab wrote:
>> On Jan 24 2019, Alexander Graf  wrote:
>> 
>>> Board_init() is too late. This needs to go into early_board_init_f().
>> 
>> I don't think we can modify the DT that early.
>
> I'm sure we can. Worst case we have to copy it over to RAM first.

reserve_fdt is only called much later.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-24 Thread Alexander Graf


On 24.01.19 14:38, Andreas Schwab wrote:
> On Jan 24 2019, Alexander Graf  wrote:
> 
>> Board_init() is too late. This needs to go into early_board_init_f().
> 
> I don't think we can modify the DT that early.

I'm sure we can. Worst case we have to copy it over to RAM first.

What obstacle exactly did you run into? Did you try to prototype the
change in a QEMU environment first to get some better debugging insights?


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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-24 Thread Andreas Schwab
On Jan 24 2019, Alexander Graf  wrote:

> Board_init() is too late. This needs to go into early_board_init_f().

I don't think we can modify the DT that early.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-24 Thread Anup Patel
On Thu, Jan 24, 2019 at 4:48 PM Alexander Graf  wrote:
>
>
>
> On 24.01.19 12:05, Anup Patel wrote:
> > On Thu, Jan 24, 2019 at 4:16 PM Alexander Graf  wrote:
> >>
> >>
> >>
> >> On 24.01.19 11:43, Anup Patel wrote:
> >>>
> >>>
> >>>> -Original Message-
> >>>> From: Andreas Schwab [mailto:sch...@suse.de]
> >>>> Sent: Thursday, January 24, 2019 3:24 PM
> >>>> To: Atish Patra 
> >>>> Cc: Anup Patel ; Anup Patel ;
> >>>> Joe Hershberger ; U-Boot Mailing List  >>>> b...@lists.denx.de>; Palmer Dabbelt ; Alexander Graf
> >>>> ; Christoph Hellwig ; Paul Walmsley
> >>>> 
> >>>> Subject: Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board 
> >>>> support
> >>>>
> >>>> On Jan 23 2019, Atish Patra  wrote:
> >>>>
> >>>>> or you can try to edit the DT directly and update the FSBL if you are
> >>>>> comfortable with it.
> >>>>
> >>>> I think it would make sense to add the node in the board init function.
> >>>> That way it would work whether or not the FSBL is updated.
> >>>
> >>> Best way is to either fix in DTS itself or BBL/OpenSBI.
> >>>
> >>> For BBL it is difficult due to lack of matured FDT manipulation APIs.
> >>> My bad for previous misinformation about BBL. I thought Atish had
> >>> hacked this in BBL but he had hacked U-Boot.
> >>>
> >>> We already have taken care of this in OpenSBI using LibFDT so with
> >>> OpenSBI no hacks would be required.
> >>>
> >>> We are just few days away from OpenSBI being made public so no point
> >>> of adding work-around for "stdout-path" in U-Boot as well.
> >>
> >> I disagree. We want people to easily use this code, and not use it as a
> >> means to push for the OpenSBI vs BBL discussion.
> >>
> >> So IMHO a quirk that adds the stdout-path property in an early board
> >> init function is the best way to move forward here. That way the "good"
> >> case keeps behaving the same, but we stay compatible to current,
> >> existing previous stage firmware.
> >>
> >> Please, don't *ever* consider DT something that you "just modify". If
> >> anything worked with a DT before, you are required to keep it that way.
> >> Otherwise you break the compatibility contract between your firmware 
> >> layers.
> >
> > No issues, I will try to add it board_init().
>
> Board_init() is too late. This needs to go into early_board_init_f().
> IIUC Andreas is prototyping that approach right now.

Thanks Alex and Andreas.

My latest patches are in riscv_sifive_fu540_v4 branch of
https://github.com/avpatel/u-boot

I can include Andreas's patch in my v5. If he is fine with it.

Regards,
Anup

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-24 Thread Alexander Graf


On 24.01.19 12:05, Anup Patel wrote:
> On Thu, Jan 24, 2019 at 4:16 PM Alexander Graf  wrote:
>>
>>
>>
>> On 24.01.19 11:43, Anup Patel wrote:
>>>
>>>
>>>> -Original Message-
>>>> From: Andreas Schwab [mailto:sch...@suse.de]
>>>> Sent: Thursday, January 24, 2019 3:24 PM
>>>> To: Atish Patra 
>>>> Cc: Anup Patel ; Anup Patel ;
>>>> Joe Hershberger ; U-Boot Mailing List >>> b...@lists.denx.de>; Palmer Dabbelt ; Alexander Graf
>>>> ; Christoph Hellwig ; Paul Walmsley
>>>> 
>>>> Subject: Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board 
>>>> support
>>>>
>>>> On Jan 23 2019, Atish Patra  wrote:
>>>>
>>>>> or you can try to edit the DT directly and update the FSBL if you are
>>>>> comfortable with it.
>>>>
>>>> I think it would make sense to add the node in the board init function.
>>>> That way it would work whether or not the FSBL is updated.
>>>
>>> Best way is to either fix in DTS itself or BBL/OpenSBI.
>>>
>>> For BBL it is difficult due to lack of matured FDT manipulation APIs.
>>> My bad for previous misinformation about BBL. I thought Atish had
>>> hacked this in BBL but he had hacked U-Boot.
>>>
>>> We already have taken care of this in OpenSBI using LibFDT so with
>>> OpenSBI no hacks would be required.
>>>
>>> We are just few days away from OpenSBI being made public so no point
>>> of adding work-around for "stdout-path" in U-Boot as well.
>>
>> I disagree. We want people to easily use this code, and not use it as a
>> means to push for the OpenSBI vs BBL discussion.
>>
>> So IMHO a quirk that adds the stdout-path property in an early board
>> init function is the best way to move forward here. That way the "good"
>> case keeps behaving the same, but we stay compatible to current,
>> existing previous stage firmware.
>>
>> Please, don't *ever* consider DT something that you "just modify". If
>> anything worked with a DT before, you are required to keep it that way.
>> Otherwise you break the compatibility contract between your firmware layers.
> 
> No issues, I will try to add it board_init().

Board_init() is too late. This needs to go into early_board_init_f().
IIUC Andreas is prototyping that approach right now.


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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-24 Thread Anup Patel
On Thu, Jan 24, 2019 at 4:16 PM Alexander Graf  wrote:
>
>
>
> On 24.01.19 11:43, Anup Patel wrote:
> >
> >
> >> -Original Message-
> >> From: Andreas Schwab [mailto:sch...@suse.de]
> >> Sent: Thursday, January 24, 2019 3:24 PM
> >> To: Atish Patra 
> >> Cc: Anup Patel ; Anup Patel ;
> >> Joe Hershberger ; U-Boot Mailing List  >> b...@lists.denx.de>; Palmer Dabbelt ; Alexander Graf
> >> ; Christoph Hellwig ; Paul Walmsley
> >> 
> >> Subject: Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board 
> >> support
> >>
> >> On Jan 23 2019, Atish Patra  wrote:
> >>
> >>> or you can try to edit the DT directly and update the FSBL if you are
> >>> comfortable with it.
> >>
> >> I think it would make sense to add the node in the board init function.
> >> That way it would work whether or not the FSBL is updated.
> >
> > Best way is to either fix in DTS itself or BBL/OpenSBI.
> >
> > For BBL it is difficult due to lack of matured FDT manipulation APIs.
> > My bad for previous misinformation about BBL. I thought Atish had
> > hacked this in BBL but he had hacked U-Boot.
> >
> > We already have taken care of this in OpenSBI using LibFDT so with
> > OpenSBI no hacks would be required.
> >
> > We are just few days away from OpenSBI being made public so no point
> > of adding work-around for "stdout-path" in U-Boot as well.
>
> I disagree. We want people to easily use this code, and not use it as a
> means to push for the OpenSBI vs BBL discussion.
>
> So IMHO a quirk that adds the stdout-path property in an early board
> init function is the best way to move forward here. That way the "good"
> case keeps behaving the same, but we stay compatible to current,
> existing previous stage firmware.
>
> Please, don't *ever* consider DT something that you "just modify". If
> anything worked with a DT before, you are required to keep it that way.
> Otherwise you break the compatibility contract between your firmware layers.

No issues, I will try to add it board_init().

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-24 Thread Alexander Graf


On 24.01.19 11:43, Anup Patel wrote:
> 
> 
>> -Original Message-
>> From: Andreas Schwab [mailto:sch...@suse.de]
>> Sent: Thursday, January 24, 2019 3:24 PM
>> To: Atish Patra 
>> Cc: Anup Patel ; Anup Patel ;
>> Joe Hershberger ; U-Boot Mailing List > b...@lists.denx.de>; Palmer Dabbelt ; Alexander Graf
>> ; Christoph Hellwig ; Paul Walmsley
>> 
>> Subject: Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support
>>
>> On Jan 23 2019, Atish Patra  wrote:
>>
>>> or you can try to edit the DT directly and update the FSBL if you are
>>> comfortable with it.
>>
>> I think it would make sense to add the node in the board init function.
>> That way it would work whether or not the FSBL is updated.
> 
> Best way is to either fix in DTS itself or BBL/OpenSBI.
> 
> For BBL it is difficult due to lack of matured FDT manipulation APIs.
> My bad for previous misinformation about BBL. I thought Atish had
> hacked this in BBL but he had hacked U-Boot.
> 
> We already have taken care of this in OpenSBI using LibFDT so with
> OpenSBI no hacks would be required.
> 
> We are just few days away from OpenSBI being made public so no point
> of adding work-around for "stdout-path" in U-Boot as well.

I disagree. We want people to easily use this code, and not use it as a
means to push for the OpenSBI vs BBL discussion.

So IMHO a quirk that adds the stdout-path property in an early board
init function is the best way to move forward here. That way the "good"
case keeps behaving the same, but we stay compatible to current,
existing previous stage firmware.

Please, don't *ever* consider DT something that you "just modify". If
anything worked with a DT before, you are required to keep it that way.
Otherwise you break the compatibility contract between your firmware layers.


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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-24 Thread Anup Patel


> -Original Message-
> From: Andreas Schwab [mailto:sch...@suse.de]
> Sent: Thursday, January 24, 2019 3:24 PM
> To: Atish Patra 
> Cc: Anup Patel ; Anup Patel ;
> Joe Hershberger ; U-Boot Mailing List  b...@lists.denx.de>; Palmer Dabbelt ; Alexander Graf
> ; Christoph Hellwig ; Paul Walmsley
> 
> Subject: Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support
> 
> On Jan 23 2019, Atish Patra  wrote:
> 
> > or you can try to edit the DT directly and update the FSBL if you are
> > comfortable with it.
> 
> I think it would make sense to add the node in the board init function.
> That way it would work whether or not the FSBL is updated.

Best way is to either fix in DTS itself or BBL/OpenSBI.

For BBL it is difficult due to lack of matured FDT manipulation APIs.
My bad for previous misinformation about BBL. I thought Atish had
hacked this in BBL but he had hacked U-Boot.

We already have taken care of this in OpenSBI using LibFDT so with
OpenSBI no hacks would be required.

We are just few days away from OpenSBI being made public so no point
of adding work-around for "stdout-path" in U-Boot as well.

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-24 Thread Andreas Schwab
On Jan 23 2019, Atish Patra  wrote:

> or you can try to edit the DT directly and update the FSBL if you are
> comfortable with it.

I think it would make sense to add the node in the board init function.
That way it would work whether or not the FSBL is updated.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-23 Thread Atish Patra

On 1/22/19 1:30 AM, Andreas Schwab wrote:

On Jan 21 2019, Anup Patel  wrote:


On Mon, Jan 21, 2019 at 10:40 PM Andreas Schwab  wrote:


On Jan 21 2019, Anup Patel  wrote:


There is a fix required in BBL for real board. We have not send
this fix to riscv-pk.




Just to clarify, we hacked U-boot to add the serial driver not BBL.
Later, we modified the DT directly in OpenSBI to add the required node.


Where can I find the patch?


The fix is to set following DT prop in /chosen DT node:
stdout-path = "/soc/serial@1001:115200"


How can I do that?I cannot find any function in fdt.c to add new
nodes.
  


There are several ways to do the hack.

BBL doesn't have libfdt included by default. Libfdt is included in 
u-boot. You can try adding that node in u-boot.


or
Here is another hack in U-boot until the OpenSBI is available (Early 
next week).


diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index ffcd6d15..aa5ee2cc 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -54,6 +54,16 @@ static int serial_check_stdout(const void *blob, 
struct udevice **devp)

}
if (node < 0)
node = fdt_path_offset(blob, "console");
+
+   if (node < 0) {
+   const char *sname;
+   sname = fdt_get_alias(blob, "serial0");
+   printf("sname = [%s]\n", sname);
+   if (sname)
+   node = fdt_path_offset(blob, sname);
+   printf("node = [%d]\n", node);
+   }
+
if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node, devp))
return 0;


or you can try to edit the DT directly and update the FSBL if you are 
comfortable with it.


Apologies, for the inconvenience. Sending these patches to U-boot 
doesn't make any sense its very board specific. In an ideal world, DT 
should be fixed directly to address these issues.


Regards,
Atish

Andreas.



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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-22 Thread Andreas Schwab
On Jan 21 2019, Anup Patel  wrote:

> On Mon, Jan 21, 2019 at 10:40 PM Andreas Schwab  wrote:
>>
>> On Jan 21 2019, Anup Patel  wrote:
>>
>> > There is a fix required in BBL for real board. We have not send
>> > this fix to riscv-pk.
>>
>> Where can I find the patch?
>
> The fix is to set following DT prop in /chosen DT node:
> stdout-path = "/soc/serial@1001:115200"

How can I do that?  I cannot find any function in fdt.c to add new
nodes.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-21 Thread Bin Meng
On Fri, Jan 18, 2019 at 7:19 PM Anup Patel  wrote:
>
> This patch adds SiFive FU540 board support. For now, only
> SiFive serial, SiFive PRCI, and Cadance MACB drivers are
> only enabled. The SiFive FU540 defconfig by default builds
> U-Boot for S-Mode because U-Boot on SiFive FU540 will run
> in S-Mode as payload of BBL or OpenSBI.
>
> Signed-off-by: Atish Patra 
> Signed-off-by: Anup Patel 
> Reviewed-by: Alexander Graf 
> ---
>  arch/riscv/Kconfig |  4 
>  board/sifive/fu540/Kconfig | 42 +
>  board/sifive/fu540/MAINTAINERS |  9 +++
>  board/sifive/fu540/Makefile|  5 
>  board/sifive/fu540/fu540.c | 17 ++
>  configs/sifive_fu540_defconfig | 11 +
>  include/configs/sifive-fu540.h | 43 ++
>  7 files changed, 131 insertions(+)
>  create mode 100644 board/sifive/fu540/Kconfig
>  create mode 100644 board/sifive/fu540/MAINTAINERS
>  create mode 100644 board/sifive/fu540/Makefile
>  create mode 100644 board/sifive/fu540/fu540.c
>  create mode 100644 configs/sifive_fu540_defconfig
>  create mode 100644 include/configs/sifive-fu540.h
>

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-21 Thread Anup Patel
On Mon, Jan 21, 2019 at 10:40 PM Andreas Schwab  wrote:
>
> On Jan 21 2019, Anup Patel  wrote:
>
> > There is a fix required in BBL for real board. We have not send
> > this fix to riscv-pk.
>
> Where can I find the patch?

The fix is to set following DT prop in /chosen DT node:
stdout-path = "/soc/serial@1001:115200"

As we can see, the "stdout-path" is specific to SiFive
FU540 board so setting it in BBL is a nasty hack
hence we did not push it anywhere.

Ideally, we should set above mentioned stdout-path
DT prop in SiFive FU540 DTS passed by FSBL.

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-21 Thread Andreas Schwab
On Jan 21 2019, Anup Patel  wrote:

> There is a fix required in BBL for real board. We have not send
> this fix to riscv-pk.

Where can I find the patch?

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-21 Thread Anup Patel
On Mon, Jan 21, 2019 at 10:06 PM Andreas Schwab  wrote:
>
> On Jan 21 2019, Anup Patel  wrote:
>
> > On real board, we generally boot OpenSBI+U-Boot. We will
> > try and share log of BBL+U-Boot on real board but the log will
> > look exactly like above.
>
> Nothing is seen on the real board.

There is a fix required in BBL for real board. We have not send
this fix to riscv-pk.

BBL does not set "stdout-path" in /chosen DT node so you are not
seeing any output from U-Boot on real board. On QEMU, "stdout-path"
is set in DTB by QEMU itself so we don't see any issue on QEMU.

We typically run OpenSBI+U-Boot on real board and OpenSBI sets
"stdout-path" properly before jumping to next stage (i.e. U-Boot) so
even we don't see this issue at our end.

You can easily hack BBL for above fix at your end.

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-21 Thread Andreas Schwab
On Jan 21 2019, Anup Patel  wrote:

> On real board, we generally boot OpenSBI+U-Boot. We will
> try and share log of BBL+U-Boot on real board but the log will
> look exactly like above.

Nothing is seen on the real board.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-21 Thread Anup Patel
On Mon, Jan 21, 2019 at 7:26 PM Andreas Schwab  wrote:
>
> On Jan 18 2019, Anup Patel  wrote:
>
> > This patch adds SiFive FU540 board support. For now, only
> > SiFive serial, SiFive PRCI, and Cadance MACB drivers are
> > only enabled. The SiFive FU540 defconfig by default builds
> > U-Boot for S-Mode because U-Boot on SiFive FU540 will run
> > in S-Mode as payload of BBL or OpenSBI.
>
> What am I expected to see when started with BBL?  All I see is the logo,
> then nothing.
>

Here's the log of BBL+U-Boot on QEMU sifive_u machine:

anup@anup-ubuntu64:~/Work/riscv-test$ qemu-system-riscv64 -M sifive_u
-m 256M -display none -serial stdio -kernel build-riscv-pk-uboot/bbl
bbl loader


U-Boot 2019.01-00018-gc3a9211ebc (Jan 21 2019 - 21:36:12 +0530)

CPU:   rv64imafdcsu
Model: ucbbar,spike-bare,qemu
DRAM:  256 MiB
In:uart@10013000
Out:   uart@10013000
Err:   uart@10013000
Net:
Warning: ethernet@100900fc (eth0) using random MAC address - 02:4a:de:c3:c8:80
eth0: ethernet@100900fc
Hit any key to stop autoboot:  0
ethernet@100900fc: PHY present at 0
ethernet@100900fc: link up, 1000Mbps full-duplex (lpa: 0x7c00)
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (2 ms)
Using ethernet@100900fc device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'boot.scr.uimg'.
Load address: 0x8230
Loading: *
TFTP error: 'Access violation' (2)
Not retrying...
ethernet@100900fc: PHY present at 0
ethernet@100900fc: link up, 1000Mbps full-duplex (lpa: 0x7c00)
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (0 ms)
Using ethernet@100900fc device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'boot.scr.uimg'.
Load address: 0x8060
Loading: *
TFTP error: 'Access violation' (2)
Not retrying...
=> ping 10.0.2.2
ethernet@100900fc: PHY present at 0
ethernet@100900fc: link up, 1000Mbps full-duplex (lpa: 0x7c00)
Using ethernet@100900fc device
host 10.0.2.2 is alive
=>
ethernet@100900fc: PHY present at 0
ethernet@100900fc: link up, 1000Mbps full-duplex (lpa: 0x7c00)
Using ethernet@100900fc device
host 10.0.2.2 is alive
=> qemu-system-riscv64: terminating on signal 2


On real board, we generally boot OpenSBI+U-Boot. We will
try and share log of BBL+U-Boot on real board but the log will
look exactly like above.

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


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-21 Thread Andreas Schwab
On Jan 18 2019, Anup Patel  wrote:

> This patch adds SiFive FU540 board support. For now, only
> SiFive serial, SiFive PRCI, and Cadance MACB drivers are
> only enabled. The SiFive FU540 defconfig by default builds
> U-Boot for S-Mode because U-Boot on SiFive FU540 will run
> in S-Mode as payload of BBL or OpenSBI.

What am I expected to see when started with BBL?  All I see is the logo,
then nothing.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-21 Thread Auer, Lukas
On Sun, 2019-01-20 at 17:22 -0800, Atish Patra wrote:
> On 1/20/19 12:26 PM, Auer, Lukas wrote:
> > Hi Anup,
> > 
> > On Fri, 2019-01-18 at 11:19 +, Anup Patel wrote:
> > > This patch adds SiFive FU540 board support. For now, only
> > > SiFive serial, SiFive PRCI, and Cadance MACB drivers are
> > > only enabled. The SiFive FU540 defconfig by default builds
> > > U-Boot for S-Mode because U-Boot on SiFive FU540 will run
> > > in S-Mode as payload of BBL or OpenSBI.
> > > 
> > > Signed-off-by: Atish Patra 
> > > Signed-off-by: Anup Patel 
> > > Reviewed-by: Alexander Graf 
> > > ---
> > >   arch/riscv/Kconfig |  4 
> > >   board/sifive/fu540/Kconfig | 42
> > > +
> > >   board/sifive/fu540/MAINTAINERS |  9 +++
> > >   board/sifive/fu540/Makefile|  5 
> > >   board/sifive/fu540/fu540.c | 17 ++
> > >   configs/sifive_fu540_defconfig | 11 +
> > >   include/configs/sifive-fu540.h | 43
> > > ++
> > >   7 files changed, 131 insertions(+)
> > >   create mode 100644 board/sifive/fu540/Kconfig
> > >   create mode 100644 board/sifive/fu540/MAINTAINERS
> > >   create mode 100644 board/sifive/fu540/Makefile
> > >   create mode 100644 board/sifive/fu540/fu540.c
> > >   create mode 100644 configs/sifive_fu540_defconfig
> > >   create mode 100644 include/configs/sifive-fu540.h
> > > 
> > 
> > Reviewed-by: Lukas Auer 
> > 
> > Can you add a short README on how to flash and use U-Boot on the
> > HiFive
> > Unleashed?
> > 
> 
> Thanks for the review. Sure. We will add a README document.
> 
> > Please also see one more comment below.
> > 
> > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > > index 6879047ff7..36512a8995 100644
> > > --- a/arch/riscv/Kconfig
> > > +++ b/arch/riscv/Kconfig
> > > @@ -14,11 +14,15 @@ config TARGET_AX25_AE350
> > >   config TARGET_QEMU_VIRT
> > >   bool "Support QEMU Virt Board"
> > >   
> > > +config TARGET_SIFIVE_FU540
> > > + bool "Support SiFive FU540 Board"
> > > +
> > >   endchoice
> > >   
> > >   # board-specific options below
> > >   source "board/AndesTech/ax25-ae350/Kconfig"
> > >   source "board/emulation/qemu-riscv/Kconfig"
> > > +source "board/sifive/fu540/Kconfig"
> > >   
> > >   # platform-specific options below
> > >   source "arch/riscv/cpu/ax25/Kconfig"
> > > diff --git a/board/sifive/fu540/Kconfig
> > > b/board/sifive/fu540/Kconfig
> > > new file mode 100644
> > > index 00..6be3d88144
> > > --- /dev/null
> > > +++ b/board/sifive/fu540/Kconfig
> > > @@ -0,0 +1,42 @@
> > > +if TARGET_SIFIVE_FU540
> > > +
> > > +config SYS_BOARD
> > > + default "fu540"
> > > +
> > > +config SYS_VENDOR
> > > + default "sifive"
> > > +
> > > +config SYS_CPU
> > > + default "generic"
> > > +
> > > +config SYS_CONFIG_NAME
> > > + default "sifive-fu540"
> > > +
> > > +config SYS_TEXT_BASE
> > > + default 0x8000 if !RISCV_SMODE
> > > + default 0x8020 if RISCV_SMODE
> > > +
> > > +config BOARD_SPECIFIC_OPTIONS # dummy
> > > + def_bool y
> > > + select GENERIC_RISCV
> > > + imply CMD_DHCP
> > > + imply CMD_EXT2
> > > + imply CMD_EXT4
> > > + imply CMD_FAT
> > > + imply CMD_FS_GENERIC
> > > + imply CMD_NET
> > > + imply CMD_PING
> > > + imply CLK_SIFIVE
> > > + imply CLK_SIFIVE_FU540_PRCI
> > > + imply DOS_PARTITION
> > > + imply EFI_PARTITION
> > > + imply IP_DYN
> > > + imply ISO_PARTITION
> > > + imply MACB
> > > + imply MII
> > > + imply NET_RANDOM_ETHADDR
> > > + imply PHY_LIB
> > > + imply PHY_MSCC
> > > + imply SIFIVE_SERIAL
> > > +
> > > +endif
> > > diff --git a/board/sifive/fu540/MAINTAINERS
> > > b/board/sifive/fu540/MAINTAINERS
> > > new file mode 100644
> > > index 00..702d803ad8
> > > --- /dev/null
> > > +++ b/board/sifive/fu540/MAINTAINERS
> > > @@ -0,0 +1,9 @@
> > > +SiFive FU540 BOARD
> > > +M:   Paul Walmsley 
> > > +M:   Palmer Dabbelt 
> > > +M:   Anup Patel 
> > > +M:   Atish Patra 
> > > +S:   Maintained
> > > +F:   board/sifive/fu540/
> > > +F:   include/configs/sifive-fu540.h
> > > +F:   configs/sifive_fu540_defconfig
> > > diff --git a/board/sifive/fu540/Makefile
> > > b/board/sifive/fu540/Makefile
> > > new file mode 100644
> > > index 00..6e1862c475
> > > --- /dev/null
> > > +++ b/board/sifive/fu540/Makefile
> > > @@ -0,0 +1,5 @@
> > > +# SPDX-License-Identifier: GPL-2.0+
> > > +#
> > > +# Copyright (c) 2019 Western Digital Corporation or its
> > > affiliates.
> > > +
> > > +obj-y+= fu540.o
> > > diff --git a/board/sifive/fu540/fu540.c
> > > b/board/sifive/fu540/fu540.c
> > > new file mode 100644
> > > index 00..5adc4a3d4a
> > > --- /dev/null
> > > +++ b/board/sifive/fu540/fu540.c
> > > @@ -0,0 +1,17 @@
> > > +// SPDX-License-Identifier: GPL-2.0+
> > > +/*
> > > + * Copyright (c) 2019 Western Digital Corporation or its
> > > affiliates.
> > > + *
> > > + * Authors:
> > > + *   Anup Patel 
> > > + */
> > > +
> > > +#include 
> > > +#include 
> > > +
> > > +int 

Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-20 Thread Atish Patra

On 1/20/19 12:26 PM, Auer, Lukas wrote:

Hi Anup,

On Fri, 2019-01-18 at 11:19 +, Anup Patel wrote:

This patch adds SiFive FU540 board support. For now, only
SiFive serial, SiFive PRCI, and Cadance MACB drivers are
only enabled. The SiFive FU540 defconfig by default builds
U-Boot for S-Mode because U-Boot on SiFive FU540 will run
in S-Mode as payload of BBL or OpenSBI.

Signed-off-by: Atish Patra 
Signed-off-by: Anup Patel 
Reviewed-by: Alexander Graf 
---
  arch/riscv/Kconfig |  4 
  board/sifive/fu540/Kconfig | 42
+
  board/sifive/fu540/MAINTAINERS |  9 +++
  board/sifive/fu540/Makefile|  5 
  board/sifive/fu540/fu540.c | 17 ++
  configs/sifive_fu540_defconfig | 11 +
  include/configs/sifive-fu540.h | 43
++
  7 files changed, 131 insertions(+)
  create mode 100644 board/sifive/fu540/Kconfig
  create mode 100644 board/sifive/fu540/MAINTAINERS
  create mode 100644 board/sifive/fu540/Makefile
  create mode 100644 board/sifive/fu540/fu540.c
  create mode 100644 configs/sifive_fu540_defconfig
  create mode 100644 include/configs/sifive-fu540.h



Reviewed-by: Lukas Auer 

Can you add a short README on how to flash and use U-Boot on the HiFive
Unleashed?



Thanks for the review. Sure. We will add a README document.


Please also see one more comment below.


diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 6879047ff7..36512a8995 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -14,11 +14,15 @@ config TARGET_AX25_AE350
  config TARGET_QEMU_VIRT
bool "Support QEMU Virt Board"
  
+config TARGET_SIFIVE_FU540

+   bool "Support SiFive FU540 Board"
+
  endchoice
  
  # board-specific options below

  source "board/AndesTech/ax25-ae350/Kconfig"
  source "board/emulation/qemu-riscv/Kconfig"
+source "board/sifive/fu540/Kconfig"
  
  # platform-specific options below

  source "arch/riscv/cpu/ax25/Kconfig"
diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig
new file mode 100644
index 00..6be3d88144
--- /dev/null
+++ b/board/sifive/fu540/Kconfig
@@ -0,0 +1,42 @@
+if TARGET_SIFIVE_FU540
+
+config SYS_BOARD
+   default "fu540"
+
+config SYS_VENDOR
+   default "sifive"
+
+config SYS_CPU
+   default "generic"
+
+config SYS_CONFIG_NAME
+   default "sifive-fu540"
+
+config SYS_TEXT_BASE
+   default 0x8000 if !RISCV_SMODE
+   default 0x8020 if RISCV_SMODE
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+   def_bool y
+   select GENERIC_RISCV
+   imply CMD_DHCP
+   imply CMD_EXT2
+   imply CMD_EXT4
+   imply CMD_FAT
+   imply CMD_FS_GENERIC
+   imply CMD_NET
+   imply CMD_PING
+   imply CLK_SIFIVE
+   imply CLK_SIFIVE_FU540_PRCI
+   imply DOS_PARTITION
+   imply EFI_PARTITION
+   imply IP_DYN
+   imply ISO_PARTITION
+   imply MACB
+   imply MII
+   imply NET_RANDOM_ETHADDR
+   imply PHY_LIB
+   imply PHY_MSCC
+   imply SIFIVE_SERIAL
+
+endif
diff --git a/board/sifive/fu540/MAINTAINERS
b/board/sifive/fu540/MAINTAINERS
new file mode 100644
index 00..702d803ad8
--- /dev/null
+++ b/board/sifive/fu540/MAINTAINERS
@@ -0,0 +1,9 @@
+SiFive FU540 BOARD
+M: Paul Walmsley 
+M: Palmer Dabbelt 
+M: Anup Patel 
+M: Atish Patra 
+S: Maintained
+F: board/sifive/fu540/
+F: include/configs/sifive-fu540.h
+F: configs/sifive_fu540_defconfig
diff --git a/board/sifive/fu540/Makefile
b/board/sifive/fu540/Makefile
new file mode 100644
index 00..6e1862c475
--- /dev/null
+++ b/board/sifive/fu540/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2019 Western Digital Corporation or its affiliates.
+
+obj-y  += fu540.o
diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c
new file mode 100644
index 00..5adc4a3d4a
--- /dev/null
+++ b/board/sifive/fu540/fu540.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2019 Western Digital Corporation or its affiliates.
+ *
+ * Authors:
+ *   Anup Patel 
+ */
+
+#include 
+#include 
+
+int board_init(void)
+{
+   /* For now nothing to do here. */
+
+   return 0;
+}
diff --git a/configs/sifive_fu540_defconfig
b/configs/sifive_fu540_defconfig
new file mode 100644
index 00..2f8cca9de0
--- /dev/null
+++ b/configs/sifive_fu540_defconfig
@@ -0,0 +1,11 @@
+CONFIG_RISCV=y
+CONFIG_TARGET_SIFIVE_FU540=y
+CONFIG_RISCV_SMODE=y
+CONFIG_ARCH_RV64I=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_FIT=y
+CONFIG_DISPLAY_CPUINFO=y
+CONFIG_DISPLAY_BOARDINFO=y
+CONFIG_CMD_MII=y
+CONFIG_OF_PRIOR_STAGE=y
diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-
fu540.h
new file mode 100644
index 00..7007b5f6af
--- /dev/null
+++ b/include/configs/sifive-fu540.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2019 Western Digital Corporation or 

Re: [U-Boot] [PATCH v2 11/11] riscv: Add SiFive FU540 board support

2019-01-20 Thread Auer, Lukas
Hi Anup,

On Fri, 2019-01-18 at 11:19 +, Anup Patel wrote:
> This patch adds SiFive FU540 board support. For now, only
> SiFive serial, SiFive PRCI, and Cadance MACB drivers are
> only enabled. The SiFive FU540 defconfig by default builds
> U-Boot for S-Mode because U-Boot on SiFive FU540 will run
> in S-Mode as payload of BBL or OpenSBI.
> 
> Signed-off-by: Atish Patra 
> Signed-off-by: Anup Patel 
> Reviewed-by: Alexander Graf 
> ---
>  arch/riscv/Kconfig |  4 
>  board/sifive/fu540/Kconfig | 42
> +
>  board/sifive/fu540/MAINTAINERS |  9 +++
>  board/sifive/fu540/Makefile|  5 
>  board/sifive/fu540/fu540.c | 17 ++
>  configs/sifive_fu540_defconfig | 11 +
>  include/configs/sifive-fu540.h | 43
> ++
>  7 files changed, 131 insertions(+)
>  create mode 100644 board/sifive/fu540/Kconfig
>  create mode 100644 board/sifive/fu540/MAINTAINERS
>  create mode 100644 board/sifive/fu540/Makefile
>  create mode 100644 board/sifive/fu540/fu540.c
>  create mode 100644 configs/sifive_fu540_defconfig
>  create mode 100644 include/configs/sifive-fu540.h
> 

Reviewed-by: Lukas Auer 

Can you add a short README on how to flash and use U-Boot on the HiFive
Unleashed?

Please also see one more comment below.

> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 6879047ff7..36512a8995 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -14,11 +14,15 @@ config TARGET_AX25_AE350
>  config TARGET_QEMU_VIRT
>   bool "Support QEMU Virt Board"
>  
> +config TARGET_SIFIVE_FU540
> + bool "Support SiFive FU540 Board"
> +
>  endchoice
>  
>  # board-specific options below
>  source "board/AndesTech/ax25-ae350/Kconfig"
>  source "board/emulation/qemu-riscv/Kconfig"
> +source "board/sifive/fu540/Kconfig"
>  
>  # platform-specific options below
>  source "arch/riscv/cpu/ax25/Kconfig"
> diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig
> new file mode 100644
> index 00..6be3d88144
> --- /dev/null
> +++ b/board/sifive/fu540/Kconfig
> @@ -0,0 +1,42 @@
> +if TARGET_SIFIVE_FU540
> +
> +config SYS_BOARD
> + default "fu540"
> +
> +config SYS_VENDOR
> + default "sifive"
> +
> +config SYS_CPU
> + default "generic"
> +
> +config SYS_CONFIG_NAME
> + default "sifive-fu540"
> +
> +config SYS_TEXT_BASE
> + default 0x8000 if !RISCV_SMODE
> + default 0x8020 if RISCV_SMODE
> +
> +config BOARD_SPECIFIC_OPTIONS # dummy
> + def_bool y
> + select GENERIC_RISCV
> + imply CMD_DHCP
> + imply CMD_EXT2
> + imply CMD_EXT4
> + imply CMD_FAT
> + imply CMD_FS_GENERIC
> + imply CMD_NET
> + imply CMD_PING
> + imply CLK_SIFIVE
> + imply CLK_SIFIVE_FU540_PRCI
> + imply DOS_PARTITION
> + imply EFI_PARTITION
> + imply IP_DYN
> + imply ISO_PARTITION
> + imply MACB
> + imply MII
> + imply NET_RANDOM_ETHADDR
> + imply PHY_LIB
> + imply PHY_MSCC
> + imply SIFIVE_SERIAL
> +
> +endif
> diff --git a/board/sifive/fu540/MAINTAINERS
> b/board/sifive/fu540/MAINTAINERS
> new file mode 100644
> index 00..702d803ad8
> --- /dev/null
> +++ b/board/sifive/fu540/MAINTAINERS
> @@ -0,0 +1,9 @@
> +SiFive FU540 BOARD
> +M:   Paul Walmsley 
> +M:   Palmer Dabbelt 
> +M:   Anup Patel 
> +M:   Atish Patra 
> +S:   Maintained
> +F:   board/sifive/fu540/
> +F:   include/configs/sifive-fu540.h
> +F:   configs/sifive_fu540_defconfig
> diff --git a/board/sifive/fu540/Makefile
> b/board/sifive/fu540/Makefile
> new file mode 100644
> index 00..6e1862c475
> --- /dev/null
> +++ b/board/sifive/fu540/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright (c) 2019 Western Digital Corporation or its affiliates.
> +
> +obj-y+= fu540.o
> diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c
> new file mode 100644
> index 00..5adc4a3d4a
> --- /dev/null
> +++ b/board/sifive/fu540/fu540.c
> @@ -0,0 +1,17 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (c) 2019 Western Digital Corporation or its affiliates.
> + *
> + * Authors:
> + *   Anup Patel 
> + */
> +
> +#include 
> +#include 
> +
> +int board_init(void)
> +{
> + /* For now nothing to do here. */
> +
> + return 0;
> +}
> diff --git a/configs/sifive_fu540_defconfig
> b/configs/sifive_fu540_defconfig
> new file mode 100644
> index 00..2f8cca9de0
> --- /dev/null
> +++ b/configs/sifive_fu540_defconfig
> @@ -0,0 +1,11 @@
> +CONFIG_RISCV=y
> +CONFIG_TARGET_SIFIVE_FU540=y
> +CONFIG_RISCV_SMODE=y
> +CONFIG_ARCH_RV64I=y
> +CONFIG_DISTRO_DEFAULTS=y
> +CONFIG_NR_DRAM_BANKS=1
> +CONFIG_FIT=y
> +CONFIG_DISPLAY_CPUINFO=y
> +CONFIG_DISPLAY_BOARDINFO=y
> +CONFIG_CMD_MII=y
> +CONFIG_OF_PRIOR_STAGE=y
> diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-
> fu540.h
> new file mode 100644
> index 00..7007b5f6af
> --- /dev/null
> +++