Re: [U-Boot] [PATCH] fs/ext4: caculate log2blksz from blksz, other its value = 0

2013-07-19 Thread Dennis Lan (dlan)
On Fri, Jun 28, 2013 at 9:47 AM, Dennis Lan (dlan)
dennis.y...@gmail.com wrote:
 Hi Albert, Eich

 On Thu, Jun 27, 2013 at 6:17 PM, Albert ARIBAUD
 albert.u.b...@aribaud.net wrote:
 Hi Lan,

 On Thu, 27 Jun 2013 17:42:31 +0800, Lan Yixun (dlan)
 dennis.y...@gmail.com wrote:

 From: Lan Yixun (dlan) dennis.y...@gmail.com

 err:
 lt703a # ext4ls nand 3:0
 Failed to mount ext2 filesystem...
 ** Unrecognized filesystem type **

 bug may introduced by commit:

 commit 50ce4c07df1c98aabf4630b35152ed95a87242f7
 Author: Egbert Eich e...@suse.com
 Date:   Wed May 1 01:13:19 2013 +

 fs/ext4: Support device block sizes != 512 bytes

 Please make the commit summary a description of what is wrong and how
 it is fixed, and move the context (how the bug was found, console
 output, etc) after the commit message separator '---' below.

 Also, fix probably typo in the commit summary (first commit message
 line) (other for otherwise).

 Thanks for your comments
 I'm sending this patch mainly for pre-review, Eich, Can you have a look?
 Since you are original patch author.

 The problem here is that uboot can't mount ext4 filesystem with
 commit 50ce4c07df1 applied. As I looking into the code,
  we use hard-coded SECTOR_SIZE(512) previously,
  but now we introduce (block_dev_desc_t *)-log2blksz,
 and problem here is that I couldn't find where/when this value been set.
 And after calling do_ls()-fs_set_blk_dev(), the value of log2blksz
 we got is still 0 (initialized value), which I think it's not correct.
 As I haven't dig too much into the code, and just cook this as a quick fix..

 I'm trying to solve this by calculating log2blksz from blksz.



 Signed-off-by: Lan Yixun (dlan) dennis.y...@gmail.com
 ---
  disk/part.c | 4 
  1 file changed, 4 insertions(+)

 diff --git a/disk/part.c b/disk/part.c
 index fc8404d..dbc94c4 100644
 --- a/disk/part.c
 +++ b/disk/part.c
 @@ -551,6 +551,8 @@ int get_device_and_partition(const char *ifname, const 
 char *dev_part_str,
   goto cleanup;
   }

 + (*dev_desc)-log2blksz = LOG2((*dev_desc)-blksz);
 +
   info-start = 0;
   info-size = (*dev_desc)-lba;
   info-blksz = (*dev_desc)-blksz;
 @@ -634,6 +636,8 @@ int get_device_and_partition(const char *ifname, const 
 char *dev_part_str,
   goto cleanup;
   }

 + (*dev_desc)-log2blksz = LOG2((*dev_desc)-blksz);
 +
   ret = part;
   goto cleanup;



 Amicalement,
 --
 Albert.

hi Eich, Albert:

ping, any comments? or should I send another patch as v2?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] fs/ext4: caculate log2blksz from blksz, other its value = 0

2013-06-27 Thread Dennis Lan (dlan)
Hi Albert, Eich

On Thu, Jun 27, 2013 at 6:17 PM, Albert ARIBAUD
albert.u.b...@aribaud.net wrote:
 Hi Lan,

 On Thu, 27 Jun 2013 17:42:31 +0800, Lan Yixun (dlan)
 dennis.y...@gmail.com wrote:

 From: Lan Yixun (dlan) dennis.y...@gmail.com

 err:
 lt703a # ext4ls nand 3:0
 Failed to mount ext2 filesystem...
 ** Unrecognized filesystem type **

 bug may introduced by commit:

 commit 50ce4c07df1c98aabf4630b35152ed95a87242f7
 Author: Egbert Eich e...@suse.com
 Date:   Wed May 1 01:13:19 2013 +

 fs/ext4: Support device block sizes != 512 bytes

 Please make the commit summary a description of what is wrong and how
 it is fixed, and move the context (how the bug was found, console
 output, etc) after the commit message separator '---' below.

 Also, fix probably typo in the commit summary (first commit message
 line) (other for otherwise).

Thanks for your comments
I'm sending this patch mainly for pre-review, Eich, Can you have a look?
Since you are original patch author.

The problem here is that uboot can't mount ext4 filesystem with
commit 50ce4c07df1 applied. As I looking into the code,
 we use hard-coded SECTOR_SIZE(512) previously,
 but now we introduce (block_dev_desc_t *)-log2blksz,
and problem here is that I couldn't find where/when this value been set.
And after calling do_ls()-fs_set_blk_dev(), the value of log2blksz
we got is still 0 (initialized value), which I think it's not correct.
As I haven't dig too much into the code, and just cook this as a quick fix..

I'm trying to solve this by calculating log2blksz from blksz.



 Signed-off-by: Lan Yixun (dlan) dennis.y...@gmail.com
 ---
  disk/part.c | 4 
  1 file changed, 4 insertions(+)

 diff --git a/disk/part.c b/disk/part.c
 index fc8404d..dbc94c4 100644
 --- a/disk/part.c
 +++ b/disk/part.c
 @@ -551,6 +551,8 @@ int get_device_and_partition(const char *ifname, const 
 char *dev_part_str,
   goto cleanup;
   }

 + (*dev_desc)-log2blksz = LOG2((*dev_desc)-blksz);
 +
   info-start = 0;
   info-size = (*dev_desc)-lba;
   info-blksz = (*dev_desc)-blksz;
 @@ -634,6 +636,8 @@ int get_device_and_partition(const char *ifname, const 
 char *dev_part_str,
   goto cleanup;
   }

 + (*dev_desc)-log2blksz = LOG2((*dev_desc)-blksz);
 +
   ret = part;
   goto cleanup;



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


[U-Boot] About fixup_memory_node()

2013-01-11 Thread Dennis Lan (dlan)
HI Forks:
  I have question about why memory info from fdt (memory size) will be
overwritten by
 those come from u-boot source code.

 function fixup_memory_node() in bootm.c
when CONFIG_OF_LIBFDT is defined, then memory node information will be
updated
says that, if I set memory 2G in fdt file, then 512M in uboot config.h,
then final fdt info will show 512M
 (you may wonder why we set 512M in uboot, but others in fdt file, because
we may have differnet boards with differnet memory size)
  Thanks

fixup_memory_node() - fdt_fixup_memory_banks()

int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
{
   .
for (bank = 0, len = 0; bank  banks; bank++) {
write_cell(tmp + len, start[bank], addr_cell_len);
len += addr_cell_len;

write_cell(tmp + len, size[bank], size_cell_len);
len += size_cell_len;
}

err = fdt_setprop(blob, nodeoffset, reg, tmp, len);


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


Re: [U-Boot] About fixup_memory_node()

2013-01-10 Thread Dennis Lan (dlan)
HI ALL:
Also we notice that following comment in arch/arm/dts/skeleton.dtsi
it says memory info will be polulated by bootloader,
is this kind of design policy/philosophy?

/*
 * Skeleton device tree; the bare minimum needed to boot; just include and
 * add a compatible value.  The bootloader will typically populate the
memory
 * node.
 */

/ {
#address-cells = 1;
#size-cells = 1;
chosen { };
aliases { };
memory { device_type = memory; reg = 0 0; };
};


On Fri, Jan 11, 2013 at 3:44 PM, Dennis Lan (dlan) dennis.y...@gmail.comwrote:

 HI Forks:
   I have question about why memory info from fdt (memory size) will be
 overwritten by
  those come from u-boot source code.

  function fixup_memory_node() in bootm.c
 when CONFIG_OF_LIBFDT is defined, then memory node information will be
 updated
 says that, if I set memory 2G in fdt file, then 512M in uboot config.h,
 then final fdt info will show 512M
  (you may wonder why we set 512M in uboot, but others in fdt file, because
 we may have differnet boards with differnet memory size)
   Thanks

 fixup_memory_node() - fdt_fixup_memory_banks()

 int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
 {
.
 for (bank = 0, len = 0; bank  banks; bank++) {
 write_cell(tmp + len, start[bank], addr_cell_len);
 len += addr_cell_len;

 write_cell(tmp + len, size[bank], size_cell_len);
 len += size_cell_len;
 }

 err = fdt_setprop(blob, nodeoffset, reg, tmp, len);


 Dennis

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


Re: [U-Boot] [PATCH resend] armv7/ltimer: Add support for local timer on armv7 cpus

2012-12-15 Thread Dennis Lan (dlan)
Hi


On Sat, Dec 15, 2012 at 6:20 AM, Wolfgang Denk w...@denx.de wrote:

 Dear Vipin Kumar,

 In message 50caf0cb.1050...@st.com you wrote:
  ping again

 pong ;-)

  On 12/6/2012 2:52 PM, Vipin KUMAR wrote:
   Certain ARMV7 cpus eg. CortexA9 contains a local and a global timer
 within the
   CPU core itself.  This patch adds generic support for local timer.

 What would be the use of such timer support?  Is there any code that
 actually needs it, and why does it need anything beyond the existing
 timer support we have?

Hi wolfgang:
  I think vipin here is trying to provide a generic timer support for ARMV7
architecture,
which contains private(local) and global timer. It's general a good thing
which means we can maximize the code usage..
  Actually I was planing to test the code, but haven't find the time yet ;-)

Hi vipin:
  why you only support local timer(private)? shouldn't it different to
support global timer too?


 Best regards,

 Wolfgang Denk

 --
 DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
 There is a time in the tides of men, Which, taken at its flood, leads
 on to success. On the other hand, don't count on it.   - T. K. Lawson
 ___
 U-Boot mailing list
 U-Boot@lists.denx.de
 http://lists.denx.de/mailman/listinfo/u-boot

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


Re: [U-Boot] [PATCH 14/14] fdt: Set kernaddr if fdt indicates a kernel is present

2012-11-28 Thread Dennis Lan (dlan)
hi simon:
  found a small bug?(not sure) which introduced by this commit.

this line not inldue FDT option
#if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST) ||
defined(CONFIG_CMDLINE_EDITING)
DECLARE_GLOBAL_DATA_PTR;
#endif


main.c: In function 'process_fdt_options':
main.c:341:31: error: 'gd' undeclared (first use in this function)
main.c:341:31: note: each undeclared identifier is reported only once for
each function it appears in
main.c: In function 'main_loop':
main.c:464:33: error: 'gd' undeclared (first use in this function)
make[2]: *** [main.o] Error 1
make[2]: *** Waiting for unfinished jobs
make[1]: *** [common/libcommon.o] Error 2
make[1]: *** Waiting for unfinished jobs
make: *** [lt703a] Error 2



On Fri, Oct 26, 2012 at 10:31 AM, Simon Glass s...@chromium.org wrote:

 If kernel-offset is specified in the fdt, set an environment variable
 so that scripts can access the attached kernel.

 This can be used by a packaging program to tell U-Boot about a kernel
 that has been downloaded alongside U-Boot. The value in the fdt is
 the offset of the kernel from the start of the U-Boot image, so we can
 find it just by adding CONFIG_SYS_TEXT_BASE.

 It is then fairly easy to put something like this in the environment
 variables in the board header file:

 if test ${kernaddr} != \\; then \
 echo \Using bundled kernel\; \
 bootm ${kernaddr}; \
 fi; \
 /* rest of boot sequence follows here */

 Signed-off-by: Simon Glass s...@chromium.org
 ---
  common/main.c |   16 
  1 files changed, 16 insertions(+), 0 deletions(-)

 diff --git a/common/main.c b/common/main.c
 index 03c63b4..3137b75 100644
 --- a/common/main.c
 +++ b/common/main.c
 @@ -333,6 +333,20 @@ err:
 hang();
  }

 +static void process_fdt_options(const void *blob)
 +{
 +   ulong addr;
 +
 +   /* Add an env variable to point to a kernel payload, if available
 */
 +   addr = fdtdec_get_config_int(gd-fdt_blob, kernel-offset, 0);
 +   if (addr)
 +   setenv_addr(kernaddr, (void *)(CONFIG_SYS_TEXT_BASE +
 addr));
 +
 +   /* Add an env variable to point to a root disk, if available */
 +   addr = fdtdec_get_config_int(gd-fdt_blob, rootdisk-offset, 0);
 +   if (addr)
 +   setenv_addr(rootaddr, (void *)(CONFIG_SYS_TEXT_BASE +
 addr));
 +}
  #endif /* CONFIG_OF_CONTROL */


 @@ -451,6 +465,8 @@ void main_loop (void)
 if (env)
 s = env;

 +   process_fdt_options(gd-fdt_blob);
 +
 /*
  * If the bootsecure option was chosen, use secure_boot_cmd().
  * Always use 'env' in this case, since bootsecure requres that the
 --
 1.7.7.3

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

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


Re: [U-Boot] [PATCH v7 09/16] arm: Add control over cachability of memory regions

2012-11-04 Thread Dennis Lan (dlan)
HI Simon:
This patch still not go to the master branch,
but I actually found it useful, like interact with peripheral buffer
(not only just LCD here), then I can set special attribute.

  One question here, can I use mmu_set_region_dcache_behaviour following malloc,
what about if I allocate small buffer (less than 1MBytes), since that
current default Page Size is 1MByes (the granularity), then much more
memory area will be affected?



On Thu, Oct 18, 2012 at 7:24 AM, Simon Glass s...@chromium.org wrote:
 Add support for adjusting the L1 cache behavior by updating the MMU
 configuration. The mmu_set_region_dcache_behaviour() function allows
 drivers to make these changes after the MMU is set up.

 It is implemented only for ARMv7 at present.

 This is needed for LCD support, where we want to make the LCD frame buffer
 write-through (or off) rather than write-back.

 Signed-off-by: Simon Glass s...@chromium.org
 ---
 Changes in v7:
 - Rename mmu_set_region_dcache() to mmu_set_region_dcache_behaviour()

 Changes in v4:
 - Use system bit values for enum dcache_option instead of arbitrary numbers

  arch/arm/cpu/armv7/cache_v7.c |   11 +
  arch/arm/include/asm/system.h |   31 +
  arch/arm/lib/cache-cp15.c |   51 
 -
  3 files changed, 82 insertions(+), 11 deletions(-)

 diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c
 index 1b4e808..5f6d039 100644
 --- a/arch/arm/cpu/armv7/cache_v7.c
 +++ b/arch/arm/cpu/armv7/cache_v7.c
 @@ -297,6 +297,12 @@ void arm_init_before_mmu(void)
 v7_inval_tlb();
  }

 +void mmu_page_table_flush(unsigned long start, unsigned long stop)
 +{
 +   flush_dcache_range(start, stop);
 +   v7_inval_tlb();
 +}
 +
  /*
   * Flush range from all levels of d-cache/unified-cache used:
   * Affects the range [start, start + size - 1]
 @@ -329,6 +335,11 @@ void arm_init_before_mmu(void)
  void  flush_cache(unsigned long start, unsigned long size)
  {
  }
 +
 +void mmu_page_table_flush(unsigned long start, unsigned long stop)
 +{
 +}
 +
  #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */

  #ifndef CONFIG_SYS_ICACHE_OFF
 diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
 index 2b28a26..78ca8e0 100644
 --- a/arch/arm/include/asm/system.h
 +++ b/arch/arm/include/asm/system.h
 @@ -75,6 +75,37 @@ static inline void set_cr(unsigned int val)
 isb();
  }

 +/* options available for data cache on each page */
 +enum dcache_option {
 +   DCACHE_OFF = 0x12,
 +   DCACHE_WRITETHROUGH = 0x1a,
 +   DCACHE_WRITEBACK = 0x1e,
 +};
 +
 +/* Size of an MMU section */
 +enum {
 +   MMU_SECTION_SHIFT   = 20,
 +   MMU_SECTION_SIZE= 1  MMU_SECTION_SHIFT,
 +};
 +
 +/**
 + * Change the cache settings for a region.
 + *
 + * \param startstart address of memory region to change
 + * \param size size of memory region to change
 + * \param option   dcache option to select
 + */
 +void mmu_set_region_dcache_behaviour(u32 start, int size,
 +enum dcache_option option);
 +
 +/**
 + * Register an update to the page tables, and flush the TLB
 + *
 + * \param startstart address of update in page table
 + * \param stop stop address of update in page table
 + */
 +void mmu_page_table_flush(unsigned long start, unsigned long stop);
 +
  #endif /* __ASSEMBLY__ */

  #define arch_align_stack(x) (x)
 diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
 index 939de10..6edf815 100644
 --- a/arch/arm/lib/cache-cp15.c
 +++ b/arch/arm/lib/cache-cp15.c
 @@ -26,12 +26,6 @@

  #if !(defined(CONFIG_SYS_ICACHE_OFF)  defined(CONFIG_SYS_DCACHE_OFF))

 -#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
 -#define CACHE_SETUP0x1a
 -#else
 -#define CACHE_SETUP0x1e
 -#endif
 -
  DECLARE_GLOBAL_DATA_PTR;

  void __arm_init_before_mmu(void)
 @@ -50,9 +44,41 @@ static void cp_delay (void)
 asm volatile( : : : memory);
  }

 -static inline void dram_bank_mmu_setup(int bank)
 +void set_section_dcache(int section, enum dcache_option option)
  {
 u32 *page_table = (u32 *)gd-tlb_addr;
 +   u32 value;
 +
 +   value = (section  MMU_SECTION_SHIFT) | (3  10);
 +   value |= option;
 +   page_table[section] = value;
 +}
 +
 +void __mmu_page_table_flush(unsigned long start, unsigned long stop)
 +{
 +   debug(%s: Warning: not implemented\n, __func__);
 +}
 +
 +void mmu_page_table_flush(unsigned long start, unsigned long stop)
 +   __attribute__((weak, alias(__mmu_page_table_flush)));
 +
 +void mmu_set_region_dcache_behaviour(u32 start, int size,
 +enum dcache_option option)
 +{
 +   u32 *page_table = (u32 *)gd-tlb_addr;
 +   u32 upto, end;
 +
 +   end = ALIGN(start + size, MMU_SECTION_SIZE)  MMU_SECTION_SHIFT;
 +   start = start  MMU_SECTION_SHIFT;
 +   debug(%s: start=%x, size=%x, option=%d\n, 

[U-Boot] Access IO register with writel/readl?

2012-10-17 Thread Dennis Lan (dlan)
HI ALL:
   Is it just conventional to access IO register with wriltel, readl?
or is there any specific reason here.
what's the difference with direct access? writel has few arch releated
operation to guarantee hardware access?


  for example:

struct base_gpt {
unsigned int control;
unsigned int prescaler;
};

#define GPT1_BASE_ADDR GPTCR_SWR
volatile struct base_gpt *cur_gpt = (struct base_gpt *)GPT1_BASE_ADDR;

A) acess with writel
__raw_writel(GPTCR_SWR, cur_gpt-control);

B) direct access
   cur_gpt-control = GPTCR_SWR;

(Note I define the structure with volatile )

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