Message ID | 1439900811-22954-9-git-send-email-s.temerkhanov@gmail.com |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
On 18 August 2015 at 17:56, Sergey Temerkhanov <s.temerkhanov@gmail.com> wrote: > Change the dram_init() function on ThunderX to query ATF services for > the real installed DRAM size > > Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com> > Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> > --- > > Changes in v4: None > Changes in v3: None > Changes in v2: None > > board/cavium/thunderx/Makefile | 2 +- > board/cavium/thunderx/dram.c | 35 +++++++++++++++++++++++++++++++++++ > board/cavium/thunderx/thunderx.c | 12 ------------ > 3 files changed, 36 insertions(+), 13 deletions(-) > create mode 100644 board/cavium/thunderx/dram.c > > diff --git a/board/cavium/thunderx/Makefile b/board/cavium/thunderx/Makefile > index c78c414..9200dd6 100644 > --- a/board/cavium/thunderx/Makefile > +++ b/board/cavium/thunderx/Makefile > @@ -5,4 +5,4 @@ > # SPDX-License-Identifier: GPL-2.0+ > # > > -obj-y := thunderx.o atf.o > +obj-y := thunderx.o atf.o dram.o > diff --git a/board/cavium/thunderx/dram.c b/board/cavium/thunderx/dram.c > new file mode 100644 > index 0000000..858699d > --- /dev/null > +++ b/board/cavium/thunderx/dram.c Use the same board file where you tried on 6/8 and do dram_init, may not require to do an extra file for DDR initialization unless it a pure ddr driver. Skip dram_init on 6/8 and add this patch on board file. > @@ -0,0 +1,35 @@ > +/** > + * (C) Copyright 2014, Cavium Inc. > + * > + * SPDX-License-Identifier: GPL-2.0+ > +**/ > + > +#include <common.h> > +#include <cavium/atf.h> > + > +DECLARE_GLOBAL_DATA_PTR; > + > +int dram_init(void) > +{ > + ssize_t node_count = atf_node_count(); > + ssize_t dram_size; > + int node; > + > + printf("Initializing\nNodes in system: %zd\n", node_count); > + > + gd->ram_size = 0; > + > + for (node = 0; node < node_count; node++) { > + dram_size = atf_dram_size(node); > + printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20); > + gd->ram_size += dram_size; > + } > + > + gd->ram_size -= MEM_BASE; > + > + *(unsigned long *)CPU_RELEASE_ADDR = 0; > + > + puts("DRAM size:"); > + > + return 0; > +} > diff --git a/board/cavium/thunderx/thunderx.c b/board/cavium/thunderx/thunderx.c > index c478dd7..6d37e22 100644 > --- a/board/cavium/thunderx/thunderx.c > +++ b/board/cavium/thunderx/thunderx.c > @@ -43,18 +43,6 @@ int board_init(void) > return 0; > } > > -int dram_init(void) > -{ > - /* > - * Clear spin table so that secondary processors > - * observe the correct value after waken up from wfe. > - */ > - *(unsigned long *)CPU_RELEASE_ADDR = 0; > - > - gd->ram_size = PHYS_SDRAM_1_SIZE; > - return 0; > -} > - > int timer_init(void) > { > return 0; > -- > 2.2.0 > thanks!
On Tue, Aug 18, 2015 at 3:59 PM, Jagan Teki <jteki@openedev.com> wrote: > On 18 August 2015 at 17:56, Sergey Temerkhanov <s.temerkhanov@gmail.com> wrote: >> Change the dram_init() function on ThunderX to query ATF services for >> the real installed DRAM size >> >> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com> >> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> >> --- >> >> Changes in v4: None >> Changes in v3: None >> Changes in v2: None >> >> board/cavium/thunderx/Makefile | 2 +- >> board/cavium/thunderx/dram.c | 35 +++++++++++++++++++++++++++++++++++ >> board/cavium/thunderx/thunderx.c | 12 ------------ >> 3 files changed, 36 insertions(+), 13 deletions(-) >> create mode 100644 board/cavium/thunderx/dram.c >> >> diff --git a/board/cavium/thunderx/Makefile b/board/cavium/thunderx/Makefile >> index c78c414..9200dd6 100644 >> --- a/board/cavium/thunderx/Makefile >> +++ b/board/cavium/thunderx/Makefile >> @@ -5,4 +5,4 @@ >> # SPDX-License-Identifier: GPL-2.0+ >> # >> >> -obj-y := thunderx.o atf.o >> +obj-y := thunderx.o atf.o dram.o >> diff --git a/board/cavium/thunderx/dram.c b/board/cavium/thunderx/dram.c >> new file mode 100644 >> index 0000000..858699d >> --- /dev/null >> +++ b/board/cavium/thunderx/dram.c > > Use the same board file where you tried on 6/8 and do dram_init, may not > require to do an extra file for DDR initialization unless it a pure ddr driver. > > Skip dram_init on 6/8 and add this patch on board file. So, I just keep this patch and move dram_init() to thunderx.c? Or do I also merge patches 6 and 8? > >> @@ -0,0 +1,35 @@ >> +/** >> + * (C) Copyright 2014, Cavium Inc. >> + * >> + * SPDX-License-Identifier: GPL-2.0+ >> +**/ >> + >> +#include <common.h> >> +#include <cavium/atf.h> >> + >> +DECLARE_GLOBAL_DATA_PTR; >> + >> +int dram_init(void) >> +{ >> + ssize_t node_count = atf_node_count(); >> + ssize_t dram_size; >> + int node; >> + >> + printf("Initializing\nNodes in system: %zd\n", node_count); >> + >> + gd->ram_size = 0; >> + >> + for (node = 0; node < node_count; node++) { >> + dram_size = atf_dram_size(node); >> + printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20); >> + gd->ram_size += dram_size; >> + } >> + >> + gd->ram_size -= MEM_BASE; >> + >> + *(unsigned long *)CPU_RELEASE_ADDR = 0; >> + >> + puts("DRAM size:"); >> + >> + return 0; >> +} >> diff --git a/board/cavium/thunderx/thunderx.c b/board/cavium/thunderx/thunderx.c >> index c478dd7..6d37e22 100644 >> --- a/board/cavium/thunderx/thunderx.c >> +++ b/board/cavium/thunderx/thunderx.c >> @@ -43,18 +43,6 @@ int board_init(void) >> return 0; >> } >> >> -int dram_init(void) >> -{ >> - /* >> - * Clear spin table so that secondary processors >> - * observe the correct value after waken up from wfe. >> - */ >> - *(unsigned long *)CPU_RELEASE_ADDR = 0; >> - >> - gd->ram_size = PHYS_SDRAM_1_SIZE; >> - return 0; >> -} >> - >> int timer_init(void) >> { >> return 0; >> -- >> 2.2.0 >> > > thanks! > -- > Jagan | openedev. Regards, Sergey
On 18 August 2015 at 19:39, Sergei Temerkhanov <s.temerkhanov@gmail.com> wrote: > On Tue, Aug 18, 2015 at 3:59 PM, Jagan Teki <jteki@openedev.com> wrote: >> On 18 August 2015 at 17:56, Sergey Temerkhanov <s.temerkhanov@gmail.com> wrote: >>> Change the dram_init() function on ThunderX to query ATF services for >>> the real installed DRAM size >>> >>> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com> >>> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> >>> --- >>> >>> Changes in v4: None >>> Changes in v3: None >>> Changes in v2: None >>> >>> board/cavium/thunderx/Makefile | 2 +- >>> board/cavium/thunderx/dram.c | 35 +++++++++++++++++++++++++++++++++++ >>> board/cavium/thunderx/thunderx.c | 12 ------------ >>> 3 files changed, 36 insertions(+), 13 deletions(-) >>> create mode 100644 board/cavium/thunderx/dram.c >>> >>> diff --git a/board/cavium/thunderx/Makefile b/board/cavium/thunderx/Makefile >>> index c78c414..9200dd6 100644 >>> --- a/board/cavium/thunderx/Makefile >>> +++ b/board/cavium/thunderx/Makefile >>> @@ -5,4 +5,4 @@ >>> # SPDX-License-Identifier: GPL-2.0+ >>> # >>> >>> -obj-y := thunderx.o atf.o >>> +obj-y := thunderx.o atf.o dram.o >>> diff --git a/board/cavium/thunderx/dram.c b/board/cavium/thunderx/dram.c >>> new file mode 100644 >>> index 0000000..858699d >>> --- /dev/null >>> +++ b/board/cavium/thunderx/dram.c >> >> Use the same board file where you tried on 6/8 and do dram_init, may not >> require to do an extra file for DDR initialization unless it a pure ddr driver. >> >> Skip dram_init on 6/8 and add this patch on board file. > > So, I just keep this patch and move dram_init() to thunderx.c? Or do I > also merge > patches 6 and 8? Just remove dram_init from 6/8 and add the same to board file in this patch. > >> >>> @@ -0,0 +1,35 @@ >>> +/** >>> + * (C) Copyright 2014, Cavium Inc. >>> + * >>> + * SPDX-License-Identifier: GPL-2.0+ >>> +**/ >>> + >>> +#include <common.h> >>> +#include <cavium/atf.h> >>> + >>> +DECLARE_GLOBAL_DATA_PTR; >>> + >>> +int dram_init(void) >>> +{ >>> + ssize_t node_count = atf_node_count(); >>> + ssize_t dram_size; >>> + int node; >>> + >>> + printf("Initializing\nNodes in system: %zd\n", node_count); >>> + >>> + gd->ram_size = 0; >>> + >>> + for (node = 0; node < node_count; node++) { >>> + dram_size = atf_dram_size(node); >>> + printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20); >>> + gd->ram_size += dram_size; >>> + } >>> + >>> + gd->ram_size -= MEM_BASE; >>> + >>> + *(unsigned long *)CPU_RELEASE_ADDR = 0; >>> + >>> + puts("DRAM size:"); >>> + >>> + return 0; >>> +} >>> diff --git a/board/cavium/thunderx/thunderx.c b/board/cavium/thunderx/thunderx.c >>> index c478dd7..6d37e22 100644 >>> --- a/board/cavium/thunderx/thunderx.c >>> +++ b/board/cavium/thunderx/thunderx.c >>> @@ -43,18 +43,6 @@ int board_init(void) >>> return 0; >>> } >>> >>> -int dram_init(void) >>> -{ >>> - /* >>> - * Clear spin table so that secondary processors >>> - * observe the correct value after waken up from wfe. >>> - */ >>> - *(unsigned long *)CPU_RELEASE_ADDR = 0; >>> - >>> - gd->ram_size = PHYS_SDRAM_1_SIZE; >>> - return 0; >>> -} >>> - >>> int timer_init(void) >>> { >>> return 0; >>> -- >>> 2.2.0 >>> >> >> thanks! >> -- >> Jagan | openedev. > > Regards, > Sergey > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot
diff --git a/board/cavium/thunderx/Makefile b/board/cavium/thunderx/Makefile index c78c414..9200dd6 100644 --- a/board/cavium/thunderx/Makefile +++ b/board/cavium/thunderx/Makefile @@ -5,4 +5,4 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-y := thunderx.o atf.o +obj-y := thunderx.o atf.o dram.o diff --git a/board/cavium/thunderx/dram.c b/board/cavium/thunderx/dram.c new file mode 100644 index 0000000..858699d --- /dev/null +++ b/board/cavium/thunderx/dram.c @@ -0,0 +1,35 @@ +/** + * (C) Copyright 2014, Cavium Inc. + * + * SPDX-License-Identifier: GPL-2.0+ +**/ + +#include <common.h> +#include <cavium/atf.h> + +DECLARE_GLOBAL_DATA_PTR; + +int dram_init(void) +{ + ssize_t node_count = atf_node_count(); + ssize_t dram_size; + int node; + + printf("Initializing\nNodes in system: %zd\n", node_count); + + gd->ram_size = 0; + + for (node = 0; node < node_count; node++) { + dram_size = atf_dram_size(node); + printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20); + gd->ram_size += dram_size; + } + + gd->ram_size -= MEM_BASE; + + *(unsigned long *)CPU_RELEASE_ADDR = 0; + + puts("DRAM size:"); + + return 0; +} diff --git a/board/cavium/thunderx/thunderx.c b/board/cavium/thunderx/thunderx.c index c478dd7..6d37e22 100644 --- a/board/cavium/thunderx/thunderx.c +++ b/board/cavium/thunderx/thunderx.c @@ -43,18 +43,6 @@ int board_init(void) return 0; } -int dram_init(void) -{ - /* - * Clear spin table so that secondary processors - * observe the correct value after waken up from wfe. - */ - *(unsigned long *)CPU_RELEASE_ADDR = 0; - - gd->ram_size = PHYS_SDRAM_1_SIZE; - return 0; -} - int timer_init(void) { return 0;