Re: [U-Boot] [PATCH][v2] powerpc/T1040EMU: Add T1040 emulator support

2013-11-19 Thread York Sun
On 11/10/2013 09:25 PM, Jain Priyanka-B32167 wrote:
> Hi,
> 
> Dependency of below patch marked under --- 
> [U-Boot] powerpc/t1040qds: Add DDR Raw Timing support
>   http://patchwork.ozlabs.org/patch/286112/
> no longer holds true as thi patch has been deferred. 
> 
> But below emulator patch will work as it is with SPD method.
> No changes required.
> 
> Regards
> Priyanka
> 
>> -Original Message-
>> From: Jain Priyanka-B32167
>> Sent: Monday, October 28, 2013 3:53 PM
>> To: u-boot@lists.denx.de; w...@denx.de
>> Cc: sun york-R58495; Jain Priyanka-B32167; Aggrwal Poonam-B10812;
>> Kushwaha Prabhakar-B32579
>> Subject: [PATCH][v2] powerpc/T1040EMU: Add T1040 emulator support
>>
>> Add emulator support for T1040. Emulator has limited peripherals and
>> interfaces.
>> Difference between T1040QDS and emulator includes:
>> -ECC for DDR is disabled due to procedure to load images -Depends on raw
>> timing for DDR initialization -No board FPGA (Qixis) -No PCI -No SPI -No
>> flash support
>>
>> Signed-off-by: Poonam Aggrwal 
>> Signed-off-by: Prabhakar Kushwaha 
>> Signed-off-by: Priyanka Jain 
>> ---
>> Changes for v2: Incorporated Wolfgang Denk's review comments
>>
>> Based on u-boot-mpc85xx/next branch.
>>  This patch depends upon following patches:
>>  1)[U-Boot] powerpc/t1040qds: Add DDR Raw Timing support
>>  http://patchwork.ozlabs.org/patch/286112/
>>  2)[U-Boot] powerpc/t1040qds: Correct Maintainer name in boards.cfg
>>  http://patchwork.ozlabs.org/patch/286113/
>>
>>  board/freescale/t1040qds/Makefile   |3 +-
>>  board/freescale/t1040qds/ddr.c  |3 +
>>  board/freescale/t1040qds/ddr.h  |   13 ++
>>  board/freescale/t1040qds/t1040emu.c |   75 
>>  board/freescale/t1040qds/tlb.c  |4 +
>>  boards.cfg  |1 +
>>  include/configs/T1040EMU.h  |  344

This T1040EMU.h should merge with T1040QDS.h and only host the
difference, like the way we did for T4240QDS and T4240EMU.


>> +++
>>  7 files changed, 442 insertions(+), 1 deletions(-)  create mode 100644
>> board/freescale/t1040qds/t1040emu.c
>>  create mode 100644 include/configs/T1040EMU.h
>>
>> diff --git a/board/freescale/t1040qds/Makefile
>> b/board/freescale/t1040qds/Makefile
>> index 8f0057b..4bd7103 100644
>> --- a/board/freescale/t1040qds/Makefile
>> +++ b/board/freescale/t1040qds/Makefile
>> @@ -8,7 +8,8 @@ include $(TOPDIR)/config.mk
>>
>>  LIB = $(obj)lib$(BOARD).o
>>
>> -COBJS-y += $(BOARD).o
>> +COBJS-$(CONFIG_T1040QDS) += t1040qds.o
>> +COBJS-$(CONFIG_T1040EMU) += t1040emu.o
>>  COBJS-y += ddr.o
>>  COBJS-$(CONFIG_PCI) += pci.o
>>  COBJS-y += law.o
>> diff --git a/board/freescale/t1040qds/ddr.c
>> b/board/freescale/t1040qds/ddr.c index 16ab829..d46021b 100644
>> --- a/board/freescale/t1040qds/ddr.c
>> +++ b/board/freescale/t1040qds/ddr.c
>> @@ -123,6 +123,9 @@ phys_size_t initdram(int board_type)
>>  puts("Initializingusing SPD\n");
>>
>>  dram_size = fsl_ddr_sdram();
>> +#ifdef CONFIG_T1040EMU
>> +dram_size = CONFIG_SYS_SDRAM_SIZE * 1024 * 1024; #endif

Why do you set the size to a fixed value if using SPD?

York

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


Re: [U-Boot] [PATCH][v2] powerpc/T1040EMU: Add T1040 emulator support

2013-11-11 Thread Priyanka Jain
Hi,

Dependency of below patch marked under --- 
[U-Boot] powerpc/t1040qds: Add DDR Raw Timing support
http://patchwork.ozlabs.org/patch/286112/
no longer holds true as thi patch has been deferred. 

But below emulator patch will work as it is with SPD method.
No changes required.

Regards
Priyanka

> -Original Message-
> From: Jain Priyanka-B32167
> Sent: Monday, October 28, 2013 3:53 PM
> To: u-boot@lists.denx.de; w...@denx.de
> Cc: sun york-R58495; Jain Priyanka-B32167; Aggrwal Poonam-B10812;
> Kushwaha Prabhakar-B32579
> Subject: [PATCH][v2] powerpc/T1040EMU: Add T1040 emulator support
> 
> Add emulator support for T1040. Emulator has limited peripherals and
> interfaces.
> Difference between T1040QDS and emulator includes:
> -ECC for DDR is disabled due to procedure to load images -Depends on raw
> timing for DDR initialization -No board FPGA (Qixis) -No PCI -No SPI -No
> flash support
> 
> Signed-off-by: Poonam Aggrwal 
> Signed-off-by: Prabhakar Kushwaha 
> Signed-off-by: Priyanka Jain 
> ---
> Changes for v2: Incorporated Wolfgang Denk's review comments
> 
> Based on u-boot-mpc85xx/next branch.
>  This patch depends upon following patches:
>  1)[U-Boot] powerpc/t1040qds: Add DDR Raw Timing support
>   http://patchwork.ozlabs.org/patch/286112/
>  2)[U-Boot] powerpc/t1040qds: Correct Maintainer name in boards.cfg
>   http://patchwork.ozlabs.org/patch/286113/
> 
>  board/freescale/t1040qds/Makefile   |3 +-
>  board/freescale/t1040qds/ddr.c  |3 +
>  board/freescale/t1040qds/ddr.h  |   13 ++
>  board/freescale/t1040qds/t1040emu.c |   75 
>  board/freescale/t1040qds/tlb.c  |4 +
>  boards.cfg  |1 +
>  include/configs/T1040EMU.h  |  344
> +++
>  7 files changed, 442 insertions(+), 1 deletions(-)  create mode 100644
> board/freescale/t1040qds/t1040emu.c
>  create mode 100644 include/configs/T1040EMU.h
> 
> diff --git a/board/freescale/t1040qds/Makefile
> b/board/freescale/t1040qds/Makefile
> index 8f0057b..4bd7103 100644
> --- a/board/freescale/t1040qds/Makefile
> +++ b/board/freescale/t1040qds/Makefile
> @@ -8,7 +8,8 @@ include $(TOPDIR)/config.mk
> 
>  LIB  = $(obj)lib$(BOARD).o
> 
> -COBJS-y  += $(BOARD).o
> +COBJS-$(CONFIG_T1040QDS) += t1040qds.o
> +COBJS-$(CONFIG_T1040EMU) += t1040emu.o
>  COBJS-y  += ddr.o
>  COBJS-$(CONFIG_PCI) += pci.o
>  COBJS-y  += law.o
> diff --git a/board/freescale/t1040qds/ddr.c
> b/board/freescale/t1040qds/ddr.c index 16ab829..d46021b 100644
> --- a/board/freescale/t1040qds/ddr.c
> +++ b/board/freescale/t1040qds/ddr.c
> @@ -123,6 +123,9 @@ phys_size_t initdram(int board_type)
>   puts("Initializingusing SPD\n");
> 
>   dram_size = fsl_ddr_sdram();
> +#ifdef CONFIG_T1040EMU
> + dram_size = CONFIG_SYS_SDRAM_SIZE * 1024 * 1024; #endif
> 
>   dram_size = setup_ddr_tlbs(dram_size / 0x10);
>   dram_size *= 0x10;
> diff --git a/board/freescale/t1040qds/ddr.h
> b/board/freescale/t1040qds/ddr.h index 4a4f76a..5e0a078 100644
> --- a/board/freescale/t1040qds/ddr.h
> +++ b/board/freescale/t1040qds/ddr.h
> @@ -54,6 +54,18 @@ struct board_specific_parameters {
>   * for each n_ranks group.
>   */
> 
> +#ifdef CONFIG_T1040EMU
> +static const struct board_specific_parameters udimm0[] = {
> + /*
> +  * memory controller 0
> +  *   num|  hi| rank|  clk| wrlvl |   wrlvl   |  wrlvl | cpo
> |wrdata|2T
> +  * ranks| mhz| GB  |adjst| start |   ctl2|  ctl3  |  |delay
> |
> +  */
> + {2,  2140,  4,  4,   8, 0x0, 0x0,   0xff,2,  0},
> + {1,  2140,  4,  4,   8, 0x0, 0x0,   0xff,2,  0},
> + {}
> +};
> +#else
>  static const struct board_specific_parameters udimm0[] = {
>   /*
>* memory controller 0
> @@ -72,6 +84,7 @@ static const struct board_specific_parameters udimm0[]
> = {
>   {1,  2140, 0, 4, 8, 0x090a0b0c, 0x0e0f100b,   0xff,2,  0},
>   {}
>  };
> +#endif
> 
>  static const struct board_specific_parameters *udimms[] = {
>   udimm0,
> diff --git a/board/freescale/t1040qds/t1040emu.c
> b/board/freescale/t1040qds/t1040emu.c
> new file mode 100644
> index 000..e9362d6
> --- /dev/null
> +++ b/board/freescale/t1040qds/t1040emu.c
> @@ -0,0 +1,75 @@
> +/*
> + * Copyright 2013 Freescale Semiconductor, Inc.
> + *
> + * SPDX-License-Identifier:  GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +int checkboard(void)
> +{
> + struct cpu_type *cpu = gd->arch.cpu;
> + printf("Board: %sEMU\n", cpu->name);
> + return 0;
> +}
> +
> +int board_early_init_r(void)
> +{
> + const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
> + const u8 flash_esel = find_tlb_idx((void *)flashbase, 1);
> +
> + /*
> +  * Remap Boot flash + PROMJET region to caching-in

[U-Boot] [PATCH][v2] powerpc/T1040EMU: Add T1040 emulator support

2013-10-28 Thread Priyanka Jain
Add emulator support for T1040. Emulator has limited peripherals
and interfaces.
Difference between T1040QDS and emulator includes:
-ECC for DDR is disabled due to procedure to load images
-Depends on raw timing for DDR initialization
-No board FPGA (Qixis)
-No PCI
-No SPI
-No flash support

Signed-off-by: Poonam Aggrwal 
Signed-off-by: Prabhakar Kushwaha 
Signed-off-by: Priyanka Jain 
---
Changes for v2: Incorporated Wolfgang Denk's review comments 

Based on u-boot-mpc85xx/next branch.
 This patch depends upon following patches:
 1)[U-Boot] powerpc/t1040qds: Add DDR Raw Timing support
http://patchwork.ozlabs.org/patch/286112/
 2)[U-Boot] powerpc/t1040qds: Correct Maintainer name in boards.cfg
http://patchwork.ozlabs.org/patch/286113/

 board/freescale/t1040qds/Makefile   |3 +-
 board/freescale/t1040qds/ddr.c  |3 +
 board/freescale/t1040qds/ddr.h  |   13 ++
 board/freescale/t1040qds/t1040emu.c |   75 
 board/freescale/t1040qds/tlb.c  |4 +
 boards.cfg  |1 +
 include/configs/T1040EMU.h  |  344 +++
 7 files changed, 442 insertions(+), 1 deletions(-)
 create mode 100644 board/freescale/t1040qds/t1040emu.c
 create mode 100644 include/configs/T1040EMU.h

diff --git a/board/freescale/t1040qds/Makefile 
b/board/freescale/t1040qds/Makefile
index 8f0057b..4bd7103 100644
--- a/board/freescale/t1040qds/Makefile
+++ b/board/freescale/t1040qds/Makefile
@@ -8,7 +8,8 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
 
-COBJS-y+= $(BOARD).o
+COBJS-$(CONFIG_T1040QDS) += t1040qds.o
+COBJS-$(CONFIG_T1040EMU) += t1040emu.o
 COBJS-y+= ddr.o
 COBJS-$(CONFIG_PCI) += pci.o
 COBJS-y+= law.o
diff --git a/board/freescale/t1040qds/ddr.c b/board/freescale/t1040qds/ddr.c
index 16ab829..d46021b 100644
--- a/board/freescale/t1040qds/ddr.c
+++ b/board/freescale/t1040qds/ddr.c
@@ -123,6 +123,9 @@ phys_size_t initdram(int board_type)
puts("Initializingusing SPD\n");
 
dram_size = fsl_ddr_sdram();
+#ifdef CONFIG_T1040EMU
+   dram_size = CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
+#endif
 
dram_size = setup_ddr_tlbs(dram_size / 0x10);
dram_size *= 0x10;
diff --git a/board/freescale/t1040qds/ddr.h b/board/freescale/t1040qds/ddr.h
index 4a4f76a..5e0a078 100644
--- a/board/freescale/t1040qds/ddr.h
+++ b/board/freescale/t1040qds/ddr.h
@@ -54,6 +54,18 @@ struct board_specific_parameters {
  * for each n_ranks group.
  */
 
+#ifdef CONFIG_T1040EMU
+static const struct board_specific_parameters udimm0[] = {
+   /*
+* memory controller 0
+*   num|  hi| rank|  clk| wrlvl |   wrlvl   |  wrlvl | cpo  |wrdata|2T
+* ranks| mhz| GB  |adjst| start |   ctl2|  ctl3  |  |delay |
+*/
+   {2,  2140,  4,  4,   8, 0x0, 0x0,   0xff,2,  0},
+   {1,  2140,  4,  4,   8, 0x0, 0x0,   0xff,2,  0},
+   {}
+};
+#else
 static const struct board_specific_parameters udimm0[] = {
/*
 * memory controller 0
@@ -72,6 +84,7 @@ static const struct board_specific_parameters udimm0[] = {
{1,  2140, 0, 4, 8, 0x090a0b0c, 0x0e0f100b,   0xff,2,  0},
{}
 };
+#endif
 
 static const struct board_specific_parameters *udimms[] = {
udimm0,
diff --git a/board/freescale/t1040qds/t1040emu.c 
b/board/freescale/t1040qds/t1040emu.c
new file mode 100644
index 000..e9362d6
--- /dev/null
+++ b/board/freescale/t1040qds/t1040emu.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int checkboard(void)
+{
+   struct cpu_type *cpu = gd->arch.cpu;
+   printf("Board: %sEMU\n", cpu->name);
+   return 0;
+}
+
+int board_early_init_r(void)
+{
+   const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
+   const u8 flash_esel = find_tlb_idx((void *)flashbase, 1);
+
+   /*
+* Remap Boot flash + PROMJET region to caching-inhibited
+* so that flash can be erased properly.
+*/
+
+   /* Flush d-cache and invalidate i-cache of any FLASH data */
+   flush_dcache();
+   invalidate_icache();
+
+   /* invalidate existing TLB entry for flash + promjet */
+   disable_tlb(flash_esel);
+
+   set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,
+   MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+   0, flash_esel, BOOKE_PAGESZ_256M, 1);
+   set_liodns();
+#ifdef CONFIG_SYS_DPAA_QBMAN
+   setup_portals();
+#endif
+
+   return 0;
+}
+
+
+int misc_init_r(void)
+{
+   return 0;
+}
+
+void ft_board_setup(void *blob, bd_t *bd)
+{
+   phys_addr_t base;
+   phys_size_t size;
+
+   ft_cpu_setup(blob, bd);
+   base = getenv_bootm_low();
+   size = getenv_bootm