Re: [U-Boot] U-Boot and UBI

2008-08-12 Thread Kyungmin Park
Hi,

On Tue, Aug 12, 2008 at 8:11 PM, Stefan Roese [EMAIL PROTECTED] wrote:
 On Tuesday 12 August 2008, Kyungmin Park wrote:
  On Monday 11 August 2008, Kyungmin Park wrote:
  Actually the Samsung implemented the UBI support on U-boot already and
  has used it internally. The big difference is the code base. It's
  based on kernel UBI code. Yes it's not fit well to u-boot ecosystem so
  it created the ubi wrapper for u-boot.
 
  And how does NAND/OneNAND booting with UBI support fit into this? I
  assume that you have some size restrictions for the IPL/SPL on your
  platforms as well.

 It's not yet covered. it's TODO

 I see.


Yes, we should make a u-boot within one block size since flash only
guarantees the first one block as bad block free. e.g., exactly
(128KiB - 2KiB) size if OneNAND case.
For this, we need to code or size optimization.
If this is solved, we can use flash as bad block free device with UBI.

Also there are some issues related with ubi partitioning.

It's just rough ideas. For make a system as reasonable it creates two
UBI devices, one for boot-loader and another for kernel. If we make
only one UBI device, we should read whole flash blocks to read kernel.
but it's not reasonable.

1. UBI image for bootloader.
boot params (rw), kernel(ro), [Optional] initrd (ro)

Even though it has r/w area, we regards it as static volume for
performance since boot params almost read only. I think If UBI has
only static volumes we can optimize it more. we don't need to mirror
layout volume. no wear leveling and so on. For this, of course, we
need special handling for boot params.

2. UBI image for kernel.
rootfs(ro/rw), datafs(rw), and others(??)

Feel free, you make it for your purposes.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Fix OneNAND read_oob/write_oob functions compatability (take #2)

2008-08-18 Thread Kyungmin Park
Also sync with kernel OneNAND codes with adrian contribution credits

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
index 5e2062b..8d87b78 100644
--- a/common/cmd_onenand.c
+++ b/common/cmd_onenand.c
@@ -85,15 +85,25 @@ int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
ulong addr = simple_strtoul(argv[2], NULL, 16);
ulong ofs = simple_strtoul(argv[3], NULL, 16);
size_t len = simple_strtoul(argv[4], NULL, 16);
-   size_t retlen = 0;
int oob = strncmp(argv[1], read.oob, 8) ? 0 : 1;
+   struct mtd_oob_ops ops;
+
+   ops.mode = MTD_OOB_PLACE;
+
+   if (oob) {
+   ops.len = 0;
+   ops.datbuf = NULL;
+   ops.ooblen = len;
+   ops.oobbuf = (u_char *) addr;
+   } else {
+   ops.len = len;
+   ops.datbuf = (u_char *) addr;
+   ops.ooblen = 0;
+   ops.oobbuf = NULL;
+   }
+   ops.retlen = ops.oobretlen = 0;
 
-   if (oob)
-   onenand_read_oob(onenand_mtd, ofs, len,
-retlen, (u_char *) addr);
-   else
-   onenand_read(onenand_mtd, ofs, len, retlen,
-(u_char *) addr);
+   onenand_mtd.read_oob(onenand_mtd, ofs, ops);
printf(Done\n);
 
return 0;
@@ -117,9 +127,12 @@ int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
ulong block = simple_strtoul(argv[3], NULL, 10);
ulong page = simple_strtoul(argv[4], NULL, 10);
size_t len = simple_strtol(argv[5], NULL, 10);
-   size_t retlen = 0;
ulong ofs;
int oob = strncmp(argv[1], block.oob, 9) ? 0 : 1;
+   struct mtd_oob_ops ops;
+
+   ops.mode = MTD_OOB_PLACE;
+
 
ofs = block  onenand_chip.erase_shift;
if (page)
@@ -127,17 +140,21 @@ int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, 
char *argv[])
 
if (!len) {
if (oob)
-   len = 64;
+   ops.ooblen = 64;
else
-   len = 512;
+   ops.len = 512;
+   }
+
+   if (oob) {
+   ops.datbuf = NULL;
+   ops.oobbuf = (u_char *) addr;
+   } else {
+   ops.datbuf = (u_char *) addr;
+   ops.oobbuf = NULL;
}
+   ops.retlen = ops.oobretlen = 0;
 
-   if (oob)
-   onenand_read_oob(onenand_mtd, ofs, len,
-retlen, (u_char *) addr);
-   else
-   onenand_read(onenand_mtd, ofs, len, retlen,
-(u_char *) addr);
+   onenand_read_oob(onenand_mtd, ofs, ops);
return 0;
}
 
diff --git a/drivers/mtd/onenand/onenand_base.c 
b/drivers/mtd/onenand/onenand_base.c
index 9ce68e1..67901bb 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -4,6 +4,11 @@
  *  Copyright (C) 2005-2007 Samsung Electronics
  *  Kyungmin Park [EMAIL PROTECTED]
  *
+ *  Credits:
+ *  Adrian Hunter [EMAIL PROTECTED]:
+ *  auto-placement support, read-while load support, various fixes
+ *  Copyright (C) Nokia Corporation, 2007
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -526,83 +531,269 @@ static void onenand_release_device(struct mtd_info *mtd)
 }
 
 /**
- * onenand_read_ecc - [MTD Interface] Read data with ECC
+ * onenand_transfer_auto_oob - [Internal] oob auto-placement transfer
+ * @param mtd  MTD device structure
+ * @param buf  destination address
+ * @param column   oob offset to read from
+ * @param thislen  oob length to read
+ */
+static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf,
+   int

[U-Boot] [PATCH] JFFS2 command support on OneNAND

2008-08-26 Thread Kyungmin Park
JFFS2 command support on OneNAND

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]

diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index c031d80..c6920c9 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -51,7 +51,7 @@
  * mtdids=idmap[,idmap,...]
  *
  * idmap:= dev-id=mtd-id
- * dev-id   := 'nand'|'nor'dev-num
+ * dev-id   := 'nand'|'nor'|'onenand'dev-num
  * dev-num  := mtd device number, 0...
  * mtd-id   := unique device tag used by linux kernel to find mtd device 
(mtd-name)
  *
@@ -103,6 +103,13 @@
 #include nand.h
 #endif /* !CONFIG_NAND_LEGACY */
 #endif
+
+#if defined(CONFIG_CMD_ONENAND)
+#include linux/mtd/mtd.h
+#include linux/mtd/onenand.h
+#include onenand_uboot.h
+#endif
+
 /* enable/disable debugging messages */
 #defineDEBUG_JFFS
 #undef DEBUG_JFFS
@@ -401,6 +408,43 @@ static int part_validate_nand(struct mtdids *id, struct 
part_info *part)
 }
 
 /**
+ * Performs sanity check for supplied OneNAND flash partition.
+ * Table of existing OneNAND flash devices is searched and partition device
+ * is located. Alignment with the granularity of nand erasesize is verified.
+ *
+ * @param id of the parent device
+ * @param part partition to validate
+ * @return 0 if partition is valid, 1 otherwise
+ */
+static int part_validate_onenand(struct mtdids *id, struct part_info *part)
+{
+#if defined(CONFIG_CMD_ONENAND)
+   /* info for OneNAND chips */
+   struct mtd_info *mtd;
+
+   mtd = onenand_mtd;
+
+   if ((unsigned long)(part-offset) % mtd-erasesize) {
+   printf(%s%d: partition (%s) start offset
+   alignment incorrect\n,
+   MTD_DEV_TYPE(id-type), id-num, part-name);
+   return 1;
+   }
+
+   if (part-size % mtd-erasesize) {
+   printf(%s%d: partition (%s) size alignment incorrect\n,
+   MTD_DEV_TYPE(id-type), id-num, part-name);
+   return 1;
+   }
+
+   return 0;
+#else
+   return 1;
+#endif
+}
+
+
+/**
  * Performs sanity check for supplied partition. Offset and size are verified
  * to be within valid range. Partition type is checked and either
  * parts_validate_nor() or parts_validate_nand() is called with the argument
@@ -436,6 +480,8 @@ static int part_validate(struct mtdids *id, struct 
part_info *part)
return part_validate_nand(id, part);
else if (id-type == MTD_DEV_TYPE_NOR)
return part_validate_nor(id, part);
+   else if (id-type == MTD_DEV_TYPE_ONENAND)
+   return part_validate_onenand(id, part);
else
DEBUGF(part_validate: invalid dev type\n);
 
@@ -755,7 +801,15 @@ static int device_validate(u8 type, u8 num, u32 *size)
 #else
printf(support for NAND devices not present\n);
 #endif
-   }
+   } else if (type == MTD_DEV_TYPE_ONENAND) {
+#if defined(CONFIG_CMD_ONENAND)
+   *size = onenand_mtd.size;
+   return 0;
+#else
+   printf(support for OneNAND devices not present\n);
+#endif
+   } else
+   printf(Unknown defice type %d\n, type);
 
return 1;
 }
@@ -1065,8 +1119,8 @@ static struct mtdids* id_find_by_mtd_id(const char 
*mtd_id, unsigned int mtd_id_
 #endif /* #ifdef CONFIG_JFFS2_CMDLINE */
 
 /**
- * Parse device id string dev-id := 'nand'|'nor'dev-num, return device
- * type and number.
+ * Parse device id string dev-id := 'nand'|'nor'|'onenand'dev-num,
+ * return device type and number.
  *
  * @param id string describing device id
  * @param ret_id output pointer to next char after parse completes (output)
@@ -1085,6 +1139,9 @@ int id_parse(const char *id, const char **ret_id, u8 
*dev_type, u8 *dev_num)
} else if (strncmp(p, nor, 3) == 0) {
*dev_type = MTD_DEV_TYPE_NOR;
p += 3;
+   } else if (strncmp(p, onenand, 7) == 0) {
+   *dev_type = MTD_DEV_TYPE_ONENAND;
+   p += 7;
} else {
printf(incorrect device type in %s\n, id);
return 1;
@@ -1489,7 +1546,7 @@ static int parse_mtdids(const char *const ids)
while(p  (*p != '\0')) {
 
ret = 1;
-   /* parse 'nor'|'nand'dev-num */
+   /* parse 'nor'|'nand'|'onenand'dev-num */
if (id_parse(p, p, type, num) != 0)
break;
 
@@ -2181,7 +2238,7 @@ U_BOOT_CMD(
'mtdids' - linux kernel mtd device id - u-boot device id mapping\n\n
mtdids=idmap[,idmap,...]\n\n
idmap:= dev-id=mtd-id\n
-   dev-id   := 'nand'|'nor'dev-num\n
+   dev-id   := 'nand'|'nor'|'onenand'dev-num\n
dev-num  := mtd device number, 0...\n
mtd-id   := unique device tag used by linux kernel to find mtd 
device (mtd-name)\n\n
'mtdparts' - partition list\n\n
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index b5e7ab8..65ae819 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2

[U-Boot] [PATCH] Add MTD core partition

2008-08-29 Thread Kyungmin Park
It's preparation for UBI codes.
UBI uses partition and get  put mtd devices

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 6538f7a..d225a68 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB:= $(obj)libmtd.a
 
+COBJS-$(CONFIG_CMD_UBI) += mtdcore.o mtdpart.o
 COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o
 COBJS-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
 COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.o
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
new file mode 100644
index 000..2fb6099
--- /dev/null
+++ b/drivers/mtd/mtdcore.c
@@ -0,0 +1,142 @@
+/*
+ * $Id: mtdcore.c,v 1.47 2005/11/07 11:14:20 gleixner Exp $
+ *
+ * Core registration and callback routines for MTD
+ * drivers and users.
+ */
+
+#include linux/mtd/mtd.h
+#include mtd_uboot.h
+#include ubi_uboot.h
+
+struct mtd_info *mtd_table[MAX_MTD_DEVICES];
+
+int add_mtd_device(struct mtd_info *mtd)
+{
+   int i;
+
+   BUG_ON(mtd-writesize == 0);
+
+   for (i=0; i  MAX_MTD_DEVICES; i++)
+   if (!mtd_table[i]) {
+   mtd_table[i] = mtd;
+   mtd-index = i;
+   mtd-usecount = 0;
+
+   printf(mtd: Giving out device %d to %s\n,i, 
mtd-name);
+   /* No need to get a refcount on the module containing
+  the notifier, since we hold the mtd_table_mutex */
+
+   /* We _know_ we aren't being removed, because
+  our caller is still holding us here. So none
+  of this try_ nonsense, and no bitching about it
+  either. :) */
+   return 0;
+   }
+
+   return 1;
+}
+
+/**
+ *  del_mtd_device - unregister an MTD device
+ *  @mtd: pointer to MTD device info structure
+ *
+ *  Remove a device from the list of MTD devices present in the system,
+ *  and notify each currently active MTD 'user' of its departure.
+ *  Returns zero on success or 1 on failure, which currently will happen
+ *  if the requested device does not appear to be present in the list.
+ */
+int del_mtd_device (struct mtd_info *mtd)
+{
+   int ret;
+
+   if (mtd_table[mtd-index] != mtd) {
+   ret = -ENODEV;
+   } else if (mtd-usecount) {
+   printk(KERN_NOTICE Removing MTD device #%d (%s) with use count 
%d\n,
+   mtd-index, mtd-name, mtd-usecount);
+   ret = -EBUSY;
+   } else {
+   /* No need to get a refcount on the module containing
+*the notifier, since we hold the 
mtd_table_mutex */
+   mtd_table[mtd-index] = NULL;
+
+   ret = 0;
+   }
+
+   return ret;
+}
+
+/**
+ * get_mtd_device - obtain a validated handle for an MTD device
+ * @mtd: last known address of the required MTD device
+ * @num: internal device number of the required MTD device
+ *
+ * Given a number and NULL address, return the num'th entry in the device
+ *  table, if any.  Given an address and num == -1, search the device table
+ *  for a device with that address and return if it's still present. Given
+ *  both, return the num'th driver only if its address matches. Return
+ *  error code if not.
+ */
+struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
+{
+   struct mtd_info *ret = NULL;
+   int i, err = -ENODEV;
+
+   if (num == -1) {
+   for (i=0; i MAX_MTD_DEVICES; i++)
+   if (mtd_table[i] == mtd)
+   ret = mtd_table[i];
+   } else if (num  MAX_MTD_DEVICES) {
+   ret = mtd_table[num];
+   if (mtd  mtd != ret)
+   ret = NULL;
+   }
+
+   if (!ret)
+   goto out_unlock;
+
+   ret-usecount++;
+   return ret;
+
+out_unlock:
+   return ERR_PTR(err);
+}
+
+/**
+ *  get_mtd_device_nm - obtain a validated handle for an MTD device by
+ *  device name
+ *  @name: MTD device name to open
+ *
+ *  This function returns MTD device description structure in case of
+ *  success and an error code in case of failure.
+ */
+struct mtd_info *get_mtd_device_nm(const char *name)
+{
+   int i, err = -ENODEV;
+   struct mtd_info *mtd = NULL;
+
+   for (i = 0; i  MAX_MTD_DEVICES; i++) {
+   if (mtd_table[i]  !strcmp(name, mtd_table[i]-name)) {
+   mtd = mtd_table[i];
+   break;
+   }
+   }
+
+   if (!mtd)
+   goto out_unlock;
+
+   mtd-usecount++;
+   return mtd;
+
+out_unlock:
+   return ERR_PTR(err);
+}
+
+void put_mtd_device(struct mtd_info *mtd)
+{
+   int c;
+
+   c = --mtd-usecount;
+   BUG_ON(c  0);
+}
diff --git a/drivers/mtd

Re: [U-Boot] [PATCH] Flex-OneNAND driver

2008-09-25 Thread Kyungmin Park
Hi,

In u-boot, I only comment the u-boot part only. others are same at mtd
mailing list.

generally looks good to me. except minor ones.

Thank you,
Kyungmin Park

 --- a/common/cmd_onenand.c
 +++ b/common/cmd_onenand.c
 @@ -20,9 +20,64 @@

  extern struct mtd_info onenand_mtd;
  extern struct onenand_chip onenand_chip;
 +loff_t flexonenand_get_addr(int block)

Should be static. maybe you use this one for drviers/mtd/onenand. but
it's not good idea.
I want to separate onenand command and driver codes.

 +{
 +   struct mtd_info *mtd = onenand_mtd;
 +   struct onenand_chip *this = mtd-priv;
 +   loff_t ofs;
 +   int die = 0, boundary;
 +
 +   ofs = 0;
 +   if (this-dies == 2  block = this-density_mask) {
 +   block -= this-density_mask;
 +   die = 1;
 +   ofs = this-diesize[0];
 +   }
 +   boundary = this-boundary[die];
 +   ofs += block  (this-erase_shift - 1);
 +   if (block  (boundary + 1))
 +   ofs += (block - boundary - 1)  (this-erase_shift - 1);
 +   return ofs;
 +}
 +
 +static int do_erase(ulong start, ulong end)
 +{
 +   struct mtd_info *mtd = onenand_mtd;
 +   struct onenand_chip *this = mtd-priv;
 +   struct erase_info instr = {
 +   .callback   = NULL,
 +   };
 +   int i, ret;
 +   ulong block;
 +
 +   printf(Erase block from %lu to %lu\n, start, end);
 +
 +   for (block = start; block = end; block++) {
 +   if (FLEXONENAND(this))
 +   instr.addr = flexonenand_get_addr(block);
 +   else
 +   instr.addr = block  onenand_chip.erase_shift;
 +
 +   if (FLEXONENAND(this)  (mtd-numeraseregions  1)) {
 +   for (i = 0; i  mtd-numeraseregions 
 +   mtd-eraseregions[i].offset = instr.addr;
 i++)
 +   ;
 +   i--;
 +   instr.len =
 +   mtd-eraseregions[i].erasesize;
 +   } else
 +   instr.len = mtd-erasesize;
 +   ret = onenand_erase(onenand_mtd, instr);
 +   if (ret)
 +   printf(erase failed %lu\n, block);
 +   }
 +   return 0;
 +}

  int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  {
 +   struct mtd_info *mtd = onenand_mtd;
 +   struct onenand_chip *this = mtd-priv;
int ret = 0;

switch (argc) {
 @@ -42,11 +97,7 @@
default:
/* At least 4 args */
if (strncmp(argv[1], erase, 5) == 0) {
 -   struct erase_info instr = {
 -   .callback   = NULL,
 -   };
ulong start, end;
 -   ulong block;
char *endtail;

if (strncmp(argv[2], block, 5) == 0) {
 @@ -57,28 +108,18 @@
start = simple_strtoul(argv[2], NULL, 10);
end = simple_strtoul(argv[3], NULL, 10);

 -   start = onenand_chip.erase_shift;
 -   end = onenand_chip.erase_shift;
 +   start = onenand_get_block(onenand_mtd,
 +   start, NULL);
 +   end = onenand_get_block(onenand_mtd,
 +   end, NULL);
/* Don't include the end block */
 -   end--;
 +   if (end  0)
 +   end--;
}

if (!end || end  0)
end = start;
 -
 -   printf(Erase block from %lu to %lu\n, start, end);
 -
 -   for (block = start; block = end; block++) {
 -   instr.addr = block 
 onenand_chip.erase_shift;
 -   instr.len = 1  onenand_chip.erase_shift;
 -   ret = onenand_erase(onenand_mtd, instr);
 -   if (ret) {
 -   printf(erase failed %lu\n, block);
 -   break;
 -   }
 -   }
 -
 -   return 0;
 +   return do_erase(start, end);
}

if (strncmp(argv[1], read, 4) == 0) {
 @@ -134,15 +175,18 @@
ops.mode = MTD_OOB_PLACE;


 -   ofs = block  onenand_chip.erase_shift;
 +   if (FLEXONENAND(this))
 +   ofs = flexonenand_get_addr(block);
 +   else
 +   ofs = block  onenand_chip.erase_shift

[U-Boot] [PATCH] Red Black Tree support

2008-10-05 Thread Kyungmin Park
RB-tree support on U-Boot 
Now it's used at UBI module. Of course other modules can use it.

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
new file mode 100644
index 000..a4956c4
--- /dev/null
+++ b/include/linux/rbtree.h
@@ -0,0 +1,160 @@
+/*
+  Red Black Trees
+  (C) 1999  Andrea Arcangeli [EMAIL PROTECTED]
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+  linux/include/linux/rbtree.h
+
+  To use rbtrees you'll have to implement your own insert and search cores.
+  This will avoid us to use callbacks and to drop drammatically performances.
+  I know it's not the cleaner way,  but in C (not in C++) to get
+  performances and genericity...
+
+  Some example of insert and search follows here. The search is a plain
+  normal search over an ordered tree. The insert instead must be implemented
+  int two steps: as first thing the code must insert the element in
+  order as a red leaf in the tree, then the support library function
+  rb_insert_color() must be called. Such function will do the
+  not trivial work to rebalance the rbtree if necessary.
+
+---
+static inline struct page * rb_search_page_cache(struct inode * inode,
+unsigned long offset)
+{
+   struct rb_node * n = inode-i_rb_page_cache.rb_node;
+   struct page * page;
+
+   while (n)
+   {
+   page = rb_entry(n, struct page, rb_page_cache);
+
+   if (offset  page-offset)
+   n = n-rb_left;
+   else if (offset  page-offset)
+   n = n-rb_right;
+   else
+   return page;
+   }
+   return NULL;
+}
+
+static inline struct page * __rb_insert_page_cache(struct inode * inode,
+  unsigned long offset,
+  struct rb_node * node)
+{
+   struct rb_node ** p = inode-i_rb_page_cache.rb_node;
+   struct rb_node * parent = NULL;
+   struct page * page;
+
+   while (*p)
+   {
+   parent = *p;
+   page = rb_entry(parent, struct page, rb_page_cache);
+
+   if (offset  page-offset)
+   p = (*p)-rb_left;
+   else if (offset  page-offset)
+   p = (*p)-rb_right;
+   else
+   return page;
+   }
+
+   rb_link_node(node, parent, p);
+
+   return NULL;
+}
+
+static inline struct page * rb_insert_page_cache(struct inode * inode,
+unsigned long offset,
+struct rb_node * node)
+{
+   struct page * ret;
+   if ((ret = __rb_insert_page_cache(inode, offset, node)))
+   goto out;
+   rb_insert_color(node, inode-i_rb_page_cache);
+ out:
+   return ret;
+}
+---
+*/
+
+#ifndef_LINUX_RBTREE_H
+#define_LINUX_RBTREE_H
+
+#include linux/stddef.h
+
+struct rb_node
+{
+   unsigned long  rb_parent_color;
+#defineRB_RED  0
+#defineRB_BLACK1
+   struct rb_node *rb_right;
+   struct rb_node *rb_left;
+} __attribute__((aligned(sizeof(long;
+/* The alignment might seem pointless, but allegedly CRIS needs it */
+
+struct rb_root
+{
+   struct rb_node *rb_node;
+};
+
+
+#define rb_parent(r)   ((struct rb_node *)((r)-rb_parent_color  ~3))
+#define rb_color(r)   ((r)-rb_parent_color  1)
+#define rb_is_red(r)   (!rb_color(r))
+#define rb_is_black(r) rb_color(r)
+#define rb_set_red(r)  do { (r)-rb_parent_color = ~1; } while (0)
+#define rb_set_black(r)  do { (r)-rb_parent_color |= 1; } while (0)
+
+static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
+{
+   rb-rb_parent_color = (rb-rb_parent_color  3) | (unsigned long)p;
+}
+static inline void rb_set_color(struct rb_node *rb, int color)
+{
+   rb-rb_parent_color = (rb-rb_parent_color  ~1) | color;
+}
+
+#define RB_ROOT(struct rb_root) { NULL, }
+#definerb_entry(ptr, type, member) container_of(ptr, type, member)
+
+#define RB_EMPTY_ROOT

[U-Boot] [PATCH] Use correct kzalloc

2008-10-05 Thread Kyungmin Park
I'm not sure calloc returns all zero values.
Actually the calloc uses the __libc_alloc.

Instead of ambiguity, it uses the correct kzalloc.

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
diff --git a/include/linux/mtd/compat.h b/include/linux/mtd/compat.h
index 9036b74..840de4c 100644
--- a/include/linux/mtd/compat.h
+++ b/include/linux/mtd/compat.h
@@ -18,7 +18,12 @@
 #define KERN_DEBUG
 
 #define kmalloc(size, flags)   malloc(size)
-#define kzalloc(size, flags)   calloc(size, 1)
+#define kzalloc(size, flags)   ({  \
+   void *__ret = malloc(size); \
+   if (__ret)  \
+   memset(__ret, 0, size); \
+   __ret;  \
+})
 #define vmalloc(size)  malloc(size)
 #define kfree(ptr) free(ptr)
 #define vfree(ptr) free(ptr)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Red Black Tree support

2008-10-07 Thread Kyungmin Park
On Mon, Oct 6, 2008 at 4:26 PM, Wolfgang Denk [EMAIL PROTECTED] wrote:
 Dear Kyungmin Park,

 In message [EMAIL PROTECTED] you wrote:
 RB-tree support on U-Boot
 Now it's used at UBI module. Of course other modules can use it.
 ...

 I understand the code is a verbatim copy from the LInux kernel?
 Otherwise the coding style violations would not be acceptable.

Yes it's from kernel. I just removed EXPORT_SYMBOL.


 diff --git a/lib_generic/Makefile b/lib_generic/Makefile
 index 7df5a2c..83b41ca 100644
 --- a/lib_generic/Makefile
 +++ b/lib_generic/Makefile
 @@ -45,6 +45,7 @@ COBJS-y += string.o
  COBJS-y  += strmhz.o
  COBJS-y += vsprintf.o
  COBJS-y += zlib.o
 +COBJS-y += rbtree.o

 I expect that only few systems will actually use this, so it must be
 configurable. It makes no sense to build this for ALL systems. Please
 add a config option.

Agreed, I will add CONFIG_RBTREE.

I will re-send the updated patch.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Red Black Tree support v2

2008-10-07 Thread Kyungmin Park
RB-tree support on U-Boot 
Now it's used at UBI module. Of course other modules can use it.
If you want to use it, please define CONFIG_RBTREE

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
new file mode 100644
index 000..a4956c4
--- /dev/null
+++ b/include/linux/rbtree.h
@@ -0,0 +1,160 @@
+/*
+  Red Black Trees
+  (C) 1999  Andrea Arcangeli [EMAIL PROTECTED]
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+  linux/include/linux/rbtree.h
+
+  To use rbtrees you'll have to implement your own insert and search cores.
+  This will avoid us to use callbacks and to drop drammatically performances.
+  I know it's not the cleaner way,  but in C (not in C++) to get
+  performances and genericity...
+
+  Some example of insert and search follows here. The search is a plain
+  normal search over an ordered tree. The insert instead must be implemented
+  int two steps: as first thing the code must insert the element in
+  order as a red leaf in the tree, then the support library function
+  rb_insert_color() must be called. Such function will do the
+  not trivial work to rebalance the rbtree if necessary.
+
+---
+static inline struct page * rb_search_page_cache(struct inode * inode,
+unsigned long offset)
+{
+   struct rb_node * n = inode-i_rb_page_cache.rb_node;
+   struct page * page;
+
+   while (n)
+   {
+   page = rb_entry(n, struct page, rb_page_cache);
+
+   if (offset  page-offset)
+   n = n-rb_left;
+   else if (offset  page-offset)
+   n = n-rb_right;
+   else
+   return page;
+   }
+   return NULL;
+}
+
+static inline struct page * __rb_insert_page_cache(struct inode * inode,
+  unsigned long offset,
+  struct rb_node * node)
+{
+   struct rb_node ** p = inode-i_rb_page_cache.rb_node;
+   struct rb_node * parent = NULL;
+   struct page * page;
+
+   while (*p)
+   {
+   parent = *p;
+   page = rb_entry(parent, struct page, rb_page_cache);
+
+   if (offset  page-offset)
+   p = (*p)-rb_left;
+   else if (offset  page-offset)
+   p = (*p)-rb_right;
+   else
+   return page;
+   }
+
+   rb_link_node(node, parent, p);
+
+   return NULL;
+}
+
+static inline struct page * rb_insert_page_cache(struct inode * inode,
+unsigned long offset,
+struct rb_node * node)
+{
+   struct page * ret;
+   if ((ret = __rb_insert_page_cache(inode, offset, node)))
+   goto out;
+   rb_insert_color(node, inode-i_rb_page_cache);
+ out:
+   return ret;
+}
+---
+*/
+
+#ifndef_LINUX_RBTREE_H
+#define_LINUX_RBTREE_H
+
+#include linux/stddef.h
+
+struct rb_node
+{
+   unsigned long  rb_parent_color;
+#defineRB_RED  0
+#defineRB_BLACK1
+   struct rb_node *rb_right;
+   struct rb_node *rb_left;
+} __attribute__((aligned(sizeof(long;
+/* The alignment might seem pointless, but allegedly CRIS needs it */
+
+struct rb_root
+{
+   struct rb_node *rb_node;
+};
+
+
+#define rb_parent(r)   ((struct rb_node *)((r)-rb_parent_color  ~3))
+#define rb_color(r)   ((r)-rb_parent_color  1)
+#define rb_is_red(r)   (!rb_color(r))
+#define rb_is_black(r) rb_color(r)
+#define rb_set_red(r)  do { (r)-rb_parent_color = ~1; } while (0)
+#define rb_set_black(r)  do { (r)-rb_parent_color |= 1; } while (0)
+
+static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
+{
+   rb-rb_parent_color = (rb-rb_parent_color  3) | (unsigned long)p;
+}
+static inline void rb_set_color(struct rb_node *rb, int color)
+{
+   rb-rb_parent_color = (rb-rb_parent_color  ~1) | color;
+}
+
+#define RB_ROOT(struct rb_root) { NULL, }
+#definerb_entry(ptr, type, member

Re: [U-Boot] [UBI] git pull request

2008-10-21 Thread Kyungmin Park
Dear all,

On Tue, Oct 21, 2008 at 3:47 PM, Wolfgang Denk [EMAIL PROTECTED] wrote:
 Dear Kyungmin Park,

 In message [EMAIL PROTECTED] you wrote:

 Now you can use the latest UBI u-boot tree at
 http://git.denx.de/?p=u-boot/u-boot-ubi.git;a=summary

 Please use  the  git-request-pull  command  to  generate  the  pull
 requests.  Also, please make sure to include information which branch
 to pull from (please include this information even if  you  mean  the
 master branch - just to be sure).

To use the git-request-pull command, it supports the git protocol.
however in the company I can't use the git protocol so I can't post
the git-request-pull output.

 I am sorry, but none of this stuff has been posted before here on the
 mailing list, so I cannot pull it.

It's too big to post here. Instead I use the gitweb URL

http://git.denx.de/?p=u-boot/u-boot-ubi.git;a=commitdiff;h=67ae3bde6711697fb6cd54beee725bbdacc984a5

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [UBI] UBI command support

2008-10-21 Thread Kyungmin Park
UBI command support

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
 common/Makefile  |1 +
 common/cmd_ubi.c |  535 ++
 2 files changed, 536 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_ubi.c

diff --git a/common/Makefile b/common/Makefile
index f00cbd9..b02a541 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -139,6 +139,7 @@ COBJS-$(CONFIG_CMD_SETEXPR) += cmd_setexpr.o
 COBJS-$(CONFIG_CMD_SPI) += cmd_spi.o
 COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o
 COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o
+COBJS-$(CONFIG_CMD_UBI) += cmd_ubi.o
 COBJS-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o
 ifdef CONFIG_CMD_USB
 COBJS-y += cmd_usb.o
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
new file mode 100644
index 000..795805e
--- /dev/null
+++ b/common/cmd_ubi.c
@@ -0,0 +1,535 @@
+/*
+ * Unsorted Block Image commands
+ */
+
+#include common.h
+#include command.h
+
+#include linux/mtd/mtd.h
+#include linux/mtd/partitions.h
+#include ubi_uboot.h
+#include asm/errno.h
+
+/* board/\*\/ubi.c */
+extern int ubi_board_scan(void);
+
+/* drivers/mtd/ubi/build.c */
+extern struct ubi_device *ubi_devices[];
+
+/* Private own data */
+static struct ubi_device *ubi;
+static int ubi_initialized;
+
+static void ubi_dump_vol_info(const struct ubi_volume *vol)
+{
+   dbg_msg(volume information dump:);
+   dbg_msg(vol_id  %d, vol-vol_id);
+   dbg_msg(reserved_pebs   %d, vol-reserved_pebs);
+   dbg_msg(alignment   %d, vol-alignment);
+   dbg_msg(data_pad%d, vol-data_pad);
+   dbg_msg(vol_type%d, vol-vol_type);
+   dbg_msg(name_len%d, vol-name_len);
+   dbg_msg(usable_leb_size %d, vol-usable_leb_size);
+   dbg_msg(used_ebs%d, vol-used_ebs);
+   dbg_msg(used_bytes  %lld, vol-used_bytes);
+   dbg_msg(last_eb_bytes   %d, vol-last_eb_bytes);
+   dbg_msg(corrupted   %d, vol-corrupted);
+   dbg_msg(upd_marker  %d, vol-upd_marker);
+
+   if (vol-name_len = UBI_VOL_NAME_MAX 
+   strnlen(vol-name, vol-name_len + 1) == vol-name_len) {
+   dbg_msg(name%s, vol-name);
+   } else {
+   dbg_msg(the 1st 5 characters of the name: %c%c%c%c%c,
+   vol-name[0], vol-name[1], vol-name[2],
+   vol-name[3], vol-name[4]);
+   }
+   printf(\n);
+}
+
+static void display_volume_info(struct ubi_device *ubi)
+{
+   int i;
+
+   for (i = 0; i  (ubi-vtbl_slots + 1); i++) {
+   if (!ubi-volumes[i])
+   continue;   /* Empty record */
+   ubi_dump_vol_info(ubi-volumes[i]);
+   }
+}
+
+static void display_ubi_info(struct ubi_device *ubi)
+{
+   ubi_msg(MTD device name:\%s\, ubi-mtd-name);
+   ubi_msg(MTD device size:%llu MiB, ubi-flash_size  20);
+   ubi_msg(physical eraseblock size:   %d bytes (%d KiB),
+   ubi-peb_size, ubi-peb_size  10);
+   ubi_msg(logical eraseblock size:%d bytes, ubi-leb_size);
+   ubi_msg(number of good PEBs:%d, ubi-good_peb_count);
+   ubi_msg(number of bad PEBs: %d, ubi-bad_peb_count);
+   ubi_msg(smallest flash I/O unit:%d, ubi-min_io_size);
+   ubi_msg(VID header offset:  %d (aligned %d),
+   ubi-vid_hdr_offset, ubi-vid_hdr_aloffset);
+   ubi_msg(data offset:%d, ubi-leb_start);
+   ubi_msg(max. allowed volumes:   %d, ubi-vtbl_slots);
+   ubi_msg(wear-leveling threshold:%d, CONFIG_MTD_UBI_WL_THRESHOLD);
+   ubi_msg(number of internal volumes: %d, UBI_INT_VOL_COUNT);
+   ubi_msg(number of user volumes: %d,
+   ubi-vol_count - UBI_INT_VOL_COUNT);
+   ubi_msg(available PEBs: %d, ubi-avail_pebs);
+   ubi_msg(total number of reserved PEBs: %d, ubi-rsvd_pebs);
+   ubi_msg(number of PEBs reserved for bad PEB handling: %d,
+   ubi-beb_rsvd_pebs);
+   ubi_msg(max/mean erase counter: %d/%d, ubi-max_ec, ubi-mean_ec);
+}
+
+static int ubi_info(int layout)
+{
+   if (layout)
+   display_volume_info(ubi);
+   else
+   display_ubi_info(ubi);
+
+   return 0;
+}
+
+static int ustrtoul(const char *cp, char **endp, unsigned int base)
+{
+unsigned long result = simple_strtoul(cp, endp, base);
+switch (**endp) {
+case 'G' :
+result *= 1024;
+case 'M':
+result *= 1024;
+case 'K':
+case 'k':
+result *= 1024;
+if ((*endp)[1] == 'i') {
+if ((*endp)[2] == 'B')
+(*endp) += 3;
+else
+(*endp) += 2;
+}
+}
+return result;
+}
+
+static int parse_num(size_t *num, const char *token

Re: [U-Boot] [UBI] git pull request

2008-10-21 Thread Kyungmin Park
Dear all,


 http://git.denx.de/?p=u-boot/u-boot-ubi.git;a=commitdiff;h=67ae3bde6711697fb6cd54beee725bbdacc984a5
Its' obsoleted

Or
1. 
http://git.denx.de/?p=u-boot/u-boot-ubi.git;a=commitdiff;h=26b6d6c714f2c4fba4a9a601be5713c4e18291f1
2. 
http://git.denx.de/?p=u-boot/u-boot-ubi.git;a=commitdiff;h=b7164bcf27dc8a738dab90b28920119c3270502c
3. 
http://git.denx.de/?p=u-boot/u-boot-ubi.git;a=commitdiff;h=5deff5b22c8b132d51e003bd3536d03376e6c33c

Here's git-request-pull summary

The following changes since commit 67ae3bde6711697fb6cd54beee725bbdacc984a5:
  Kyungmin Park (1):
[UBI] Add initial Unsorted Block Image (UBI) support

are available in the git repository at:

  git://git.denx.de/u-boot-ubi master

Kyungmin Park (3):
  Basic Unsorted Block Image (UBI) support
  [UBI] UBI command support
  [ARM] Apollon UBI support

 Makefile   |1 +
 board/apollon/Makefile |4 +-
 board/apollon/ubi.c|   55 ++
 common/Makefile|1 +
 common/cmd_ubi.c   |  535 +
 drivers/mtd/Makefile   |1 +
 drivers/mtd/mtdcore.c  |  142 
 drivers/mtd/mtdpart.c  |  531 +
 drivers/mtd/ubi/Makefile   |   48 ++
 drivers/mtd/ubi/build.c| 1182 
 drivers/mtd/ubi/crc32.c|  514 
 drivers/mtd/ubi/crc32defs.h|   32 +
 drivers/mtd/ubi/crc32table.h   |  136 
 drivers/mtd/ubi/debug.c|  192 +
 drivers/mtd/ubi/debug.h|  152 
 drivers/mtd/ubi/eba.c  | 1256 ++
 drivers/mtd/ubi/io.c   | 1274 ++
 drivers/mtd/ubi/kapi.c |  638 +++
 drivers/mtd/ubi/misc.c |  106 +++
 drivers/mtd/ubi/scan.c | 1361 
 drivers/mtd/ubi/scan.h |  165 
 drivers/mtd/ubi/ubi-media.h|  372 +
 drivers/mtd/ubi/ubi.h  |  641 +++
 drivers/mtd/ubi/upd.c  |  441 +++
 drivers/mtd/ubi/vmt.c  |  862 +
 drivers/mtd/ubi/vtbl.c |  837 
 drivers/mtd/ubi/wl.c   | 1670 
 include/configs/apollon.h  |   27 +-
 include/linux/crc32.h  |   27 +
 include/linux/mtd/mtd.h|1 +
 include/linux/mtd/partitions.h |   84 ++
 include/linux/mtd/ubi.h|  186 +
 include/linux/types.h  |   24 +
 include/mtd/ubi-header.h   |  372 +
 include/mtd/ubi-user.h |  268 +++
 include/ubi_uboot.h|  209 +
 36 files changed, 14343 insertions(+), 4 deletions(-)
 create mode 100644 board/apollon/ubi.c
 create mode 100644 common/cmd_ubi.c
 create mode 100644 drivers/mtd/mtdcore.c
 create mode 100644 drivers/mtd/mtdpart.c
 create mode 100644 drivers/mtd/ubi/Makefile
 create mode 100644 drivers/mtd/ubi/build.c
 create mode 100644 drivers/mtd/ubi/crc32.c
 create mode 100644 drivers/mtd/ubi/crc32defs.h
 create mode 100644 drivers/mtd/ubi/crc32table.h
 create mode 100644 drivers/mtd/ubi/debug.c
 create mode 100644 drivers/mtd/ubi/debug.h
 create mode 100644 drivers/mtd/ubi/eba.c
 create mode 100644 drivers/mtd/ubi/io.c
 create mode 100644 drivers/mtd/ubi/kapi.c
 create mode 100644 drivers/mtd/ubi/misc.c
 create mode 100644 drivers/mtd/ubi/scan.c
 create mode 100644 drivers/mtd/ubi/scan.h
 create mode 100644 drivers/mtd/ubi/ubi-media.h
 create mode 100644 drivers/mtd/ubi/ubi.h
 create mode 100644 drivers/mtd/ubi/upd.c
 create mode 100644 drivers/mtd/ubi/vmt.c
 create mode 100644 drivers/mtd/ubi/vtbl.c
 create mode 100644 drivers/mtd/ubi/wl.c
 create mode 100644 include/linux/crc32.h
 create mode 100644 include/linux/mtd/partitions.h
 create mode 100644 include/linux/mtd/ubi.h
 create mode 100644 include/mtd/ubi-header.h
 create mode 100644 include/mtd/ubi-user.h
 create mode 100644 include/ubi_uboot.h

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


Re: [U-Boot] [PATCH] [ARM] Apollon UBI support

2008-10-21 Thread Kyungmin Park
Dear Wolfgang,

 -# define CONFIG_BOOTARGS root=/dev/nfs rw mem=64M 
 console=ttyS0,115200n8 
 ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
 nfsroot=/tftpboot/nfsroot profile=2
 +# define CONFIG_BOOTARGS root=/dev/nfs rw mem=64M 
 console=ttyS0,115200n8 
 ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
 nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4
  #else
 -# define CONFIG_BOOTARGS root=/dev/nfs rw mem=128M 
 console=ttyS0,115200n8 
 ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
 nfsroot=/tftpboot/nfsroot profile=2
 +# define CONFIG_BOOTARGS root=/dev/nfs rw mem=128M 
 console=ttyS0,115200n8 
 ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
 nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4

 Maximum line length exceeded.


Fixed all commented except one.
I run the checkpatch.pl and passed.

 And please do not hard-code network parameters into U-Boot.


Then how to define the network IP at bootargs? please give some example?

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [UBI] UBI command support

2008-10-21 Thread Kyungmin Park
Dear Wolfgang,

On Tue, Oct 21, 2008 at 7:24 PM, Wolfgang Denk [EMAIL PROTECTED] wrote:
 Dear Kyungmin Park,

 In message [EMAIL PROTECTED] you wrote:
 UBI command support

 Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
 ...
 +++ b/common/cmd_ubi.c
 @@ -0,0 +1,535 @@
 +/*
 + * Unsorted Block Image commands
 + */
 +
 +#include common.h
 +#include command.h

 GPL header missing.

Okay I added.


 +/* board/\*\/ubi.c */

 What's the '\'s there?

 +extern int ubi_board_scan(void);

 Please move the prototypes to some header file.

 +/* drivers/mtd/ubi/build.c */
 +extern struct ubi_device *ubi_devices[];

Moved to proper header files.

 +
 +/* Private own data */
 +static struct ubi_device *ubi;
 +static int ubi_initialized;
 +
 +static void ubi_dump_vol_info(const struct ubi_volume *vol)
 +{
 + dbg_msg(volume information dump:);
 + dbg_msg(vol_id  %d, vol-vol_id);
 + dbg_msg(reserved_pebs   %d, vol-reserved_pebs);
 + dbg_msg(alignment   %d, vol-alignment);
 + dbg_msg(data_pad%d, vol-data_pad);
 + dbg_msg(vol_type%d, vol-vol_type);
 + dbg_msg(name_len%d, vol-name_len);
 + dbg_msg(usable_leb_size %d, vol-usable_leb_size);
 + dbg_msg(used_ebs%d, vol-used_ebs);
 + dbg_msg(used_bytes  %lld, vol-used_bytes);
 + dbg_msg(last_eb_bytes   %d, vol-last_eb_bytes);
 + dbg_msg(corrupted   %d, vol-corrupted);
 + dbg_msg(upd_marker  %d, vol-upd_marker);

 Please use the standard  debug()  macro.

It's not debug message, it's ubi msg. I fixed.


 +static int ustrtoul(const char *cp, char **endp, unsigned int base)

 Maybe we should add this to some global place, like lib_generic ?

Move to lib_generic/vsprintf.c


 +unsigned long result = simple_strtoul(cp, endp, base);
 +switch (**endp) {
 +case 'G' :
 +result *= 1024;

 Please add a
/* fall through */
 comment to make clkear that it is intentional not to have a break;
 here.

 +case 'M':
 +result *= 1024;

 Ditto.

Did


 +static int verify_mkvol_req(const struct ubi_device *ubi,
 + const struct ubi_mkvol_req *req)
 +{
 ...
 +bad:
 + printf(bad volume creation request);
 +//  ubi_dbg_dump_mkvol_req(req);
 + return err;

 No C++ comments, please. And please don;t add dead code either.

Yes I remove it


 + tbuf = vmalloc(tbuf_size);

 Why do we need new alloc() stuff?

 +
 + vfree(tbuf);

 Ditto?

Use malloc  free.


 +static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 +{
 + size_t size = 0;
 + ulong addr = 0;
 + int err = 0;
 +
 + if (!ubi_initialized) {
 + err = ubi_board_scan();
 + if (err) {
 + printf(ubi initialize error %d\n, err);

 UBI init error -- maybe we can decode the error number into some
 string?

 + /* E.g., create volume size type */
 + if (argc == 5) {
 + if (strncmp(argv[4], s, 1) == 0)
 + dynamic = 0;
 + else if (strncmp(argv[4], d, 1) != 0) {
 + printf(You give wrong type\n);

 Incorrect type. It would also be helpful if the incorrect parameter
 gets printed, so the user sees what he passed.

 + return 1;
 + }
 + argc--;
 + }
 + /* E.g., create volume size */
 + if (argc == 4) {
 + err = parse_num(size, argv[3]);
 + if (err) {
 + printf(You give correct size\n);

 Incorrect size. Please also print incorrect argument value.

 + if (strncmp(argv[1], write, 5) == 0) {
 + if (argc  5) {
 + printf(You give wrong parameters\n);

 Print usage message instead.

 + }
 +
 + addr = simple_strtoul(argv[2], NULL, 16);
 + err = parse_num(size, argv[4]);
 + if (err) {
 + printf(You give wrong size\n);

 See above.

 + if (err) {
 + printf(You give wrong size\n);

 Ditto.

 + printf(Unknown UBI command or invalid number of arguments\n);

 Print usage message instead.


How to display usage?

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [UBI] Basic Unsorted Block Image (UBI) support (part 1)

2008-10-21 Thread Kyungmin Park
Dear Wolfgang and Stefan,

On Tue, Oct 21, 2008 at 10:16 PM, Wolfgang Denk [EMAIL PROTECTED] wrote:
 Dear Stefan Roese,

 In message [EMAIL PROTECTED] you wrote:

 That's directly imported from the Linux source. Most of your comments below
 also deal with this Linux code copying. I personally think it is a good idea
 to clone the code from Linux instead of writing a U-Boot specific UBI driver.
 We have done this before on other occasions and it makes perfect sense here
 too from my point of view. It makes porting easier and faster and less error
 prone and even more important, it makes porting of new versions, fixes etc
 easier.

 We agree on that. So maybe we should send coding style cleanup patches
 for the Linux kenrel?


   + * Core registration and callback routines for MTD
   + * drivers and users.
   + */
 
  GPL header missing - here and in many other files.

I added the GPL.


 This *is* a serious issue. And I don;t care  wether  the  code  comes
 from  Linux or not, but I will not accept any code without absolutley
 clear licensing conditions.

  Need {...} for multi-line statements.

 Again from the Linux original source. When we start changing this code 
 because
 of coding-style issue, it will get very hard to compare those versions and
 add fixes in the future. So I vote for keeping the code as is. It's not that
 ugly, at least from my understanding.

 It is a clear violation of Linux Coding Style requirements.

 If we don;t want to fix it here, I suggest to fixit at the origin,
 i.e. in Linux.

   +++ b/drivers/mtd/mtdpart.c
   @@ -0,0 +1,531 @@
   +/*
   + * Simple MTD partitioning layer
 
  Hm... We were talking about UBI support.
 
  Do we really have to pull in the whole MTD layer from Linux for this?
 ...

  Please do not add dead code.

It's needed. almost flash related code except the NOR, are based on
MTD and uses.
Event though it's only compiled UBI command, it will be changed.
Now partition codes use own implementation at u-boot, I think it's
better MTD partition code.


 Here I'm not sure which version I prefer. The one Kyungmin used, disabling  
 the
 not needed code via #if 0 (or something else, like #if UBI_LINUX), or
 completely removing it. Both has some advantages. But again for comparison
 with the original Linux source it's perhaps better to just disable the code 
 .
 An #if UBI_LINIX is probably better than on #if 0 though.

I change to use UBI_LINUX instead of if 0.


 There is two things I am concerned about:

 1) Do we really need all these files?
 2) Do we really need all of this code?

 Lots of the code that was left in was obviously dealing with features
 we don;t have in U-Boot, and will not have: concepts like  user  IDs,
 file permissions, major and minor numbers, etc.

 Of course we haven't. But it's hard to draw the line *if* you decide to
 include the Linux source. Most OS functions (like spin_lock()...) are defin 
 ed
 to no-ops in ubi_uboot.h. So it doesn't really increase the code size for
 U-Boot. It just keeps the source in-line with the Linux version.

 On the other hand it makes it semi-impossible to review the  code  in
 U-Boot  context,  or  even to get an understanding of flow of control
 etc.


Basically I think if we use the imported code. we don't modify code
itself. Instead we give some adaptation layer or wrapper. In this case
I use the latter. ubi_uboot.h wrapped the UBI kernel code and can run
it on u-boot. Of course it disables the some linux specific kernel if
can't wrap.

Meanwhile who is the main users of this modules? It's linux kernel. It
means users can familiar with kernel UBI code and they can use it more
easily. They don't need to understand the UBI code at u-boot.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [ARM] Move machine specific code to board at s3c64xx

2008-10-21 Thread Kyungmin Park
Move machine specific code to smdk6400.
Some board use OneNAND instead of NAND.

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
diff --git a/board/samsung/smdk6400/lowlevel_init.S 
b/board/samsung/smdk6400/lowlevel_init.S
index e0119a7..53d9125 100644
--- a/board/samsung/smdk6400/lowlevel_init.S
+++ b/board/samsung/smdk6400/lowlevel_init.S
@@ -104,6 +104,13 @@ lowlevel_init:
bl nand_asm_init
 #endif
 
+   /* Memory subsystem address 0x7e00f120 */
+   ldr r0, =ELFIN_MEM_SYS_CFG
+
+   /* Xm0CSn2 = NFCON CS0, Xm0CSn3 = NFCON CS1 */
+   mov r1, #0xd
+   str r1, [r0]
+
bl  mem_ctrl_asm_init
 
 /* Wakeup support. Don't know if it's going to be used, untested. */
diff --git a/cpu/arm1176/s3c64xx/cpu_init.S b/cpu/arm1176/s3c64xx/cpu_init.S
index 08bda99..32bb467 100644
--- a/cpu/arm1176/s3c64xx/cpu_init.S
+++ b/cpu/arm1176/s3c64xx/cpu_init.S
@@ -28,13 +28,6 @@
 
.globl mem_ctrl_asm_init
 mem_ctrl_asm_init:
-   /* Memory subsystem address 0x7e00f120 */
-   ldr r0, =ELFIN_MEM_SYS_CFG
-
-   /* Xm0CSn2 = NFCON CS0, Xm0CSn3 = NFCON CS1 */
-   mov r1, #0xd
-   str r1, [r0]
-
/* DMC1 base address 0x7e001000 */
ldr r0, =ELFIN_DMC1_BASE
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [ARM] Apollon UBI support (take #2)

2008-10-22 Thread Kyungmin Park
Now you can use the UBI at apollon board

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
diff --git a/board/apollon/Makefile b/board/apollon/Makefile
index 9bac9a6..4c3e57f 100644
--- a/board/apollon/Makefile
+++ b/board/apollon/Makefile
@@ -25,9 +25,11 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  := apollon.o mem.o sys_info.o
+COBJS-y:= apollon.o mem.o sys_info.o
+COBJS-$(CONFIG_CMD_UBI) += ubi.o
 SOBJS  := lowlevel_init.o
 
+COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
 SOBJS  := $(addprefix $(obj),$(SOBJS))
diff --git a/board/apollon/ubi.c b/board/apollon/ubi.c
new file mode 100644
index 000..10dd6e7
--- /dev/null
+++ b/board/apollon/ubi.c
@@ -0,0 +1,48 @@
+/*
+ * board/apollon/ubi.c
+ *
+ *  Copyright (C) 2008 Samsung Electronics
+ *  Kyungmin Park [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include common.h
+#include linux/mtd/mtd.h
+#include linux/mtd/partitions.h
+#include jffs2/load_kernel.h
+#include ubi_uboot.h
+
+int ubi_board_scan(void)
+{
+   struct mtd_device *dev;
+   struct part_info *part;
+   struct mtd_partition mtd_part;
+   char buffer[32];
+   u8 pnum;
+   int err;
+
+   if (mtdparts_init() != 0)
+   return 1;
+
+   if (find_dev_and_part(onenand0,4, dev, pnum, part) != 0)
+   return 1;
+
+   sprintf(buffer, mtd=%d, pnum);
+   mtd_part.name = buffer;
+   mtd_part.size = part-size;
+   mtd_part.offset = part-offset;
+   add_mtd_partitions(onenand_mtd, mtd_part, 1);
+
+   err = ubi_mtd_param_parse(buffer, NULL);
+   if (err)
+   return err;
+
+   err = ubi_init();
+   if (err)
+   return err;
+
+   return 0;
+}
diff --git a/include/configs/apollon.h b/include/configs/apollon.h
index d71ed44..dff47fc 100644
--- a/include/configs/apollon.h
+++ b/include/configs/apollon.h
@@ -53,6 +53,9 @@
 #define CONFIG_SYS_USE_NOR 1
 #endif
 
+/* uncommnet if you want to use UBI */
+#define CONFIG_SYS_USE_UBI
+
 #include asm/arch/omap2420.h /* get chip and board defs */
 
 #defineV_SCLK  1200
@@ -73,8 +76,9 @@
  * Size of malloc() pool
  */
 #defineCONFIG_ENV_SIZE SZ_128K /* Total Size of Environment Sector */
-#defineCONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_128K)
-#defineCONFIG_SYS_GBL_DATA_SIZE128 /* bytes reserved for 
initial data */
+#defineCONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_1M)
+/* bytes reserved for initial data */
+#defineCONFIG_SYS_GBL_DATA_SIZE128
 
 /*
  * Hardware drivers
@@ -116,6 +120,13 @@
 #defineCONFIG_CMD_DIAG
 #defineCONFIG_CMD_ONENAND
 
+#ifdef CONFIG_SYS_USE_UBI
+#defineCONFIG_CMD_JFFS2
+#defineCONFIG_CMD_UBI
+#defineCONFIG_RBTREE
+#define CONFIG_MTD_PARTITIONS
+#endif
+
 #undef CONFIG_CMD_AUTOSCRIPT
 
 #ifndefCONFIG_SYS_USE_NOR
@@ -133,24 +144,39 @@
 #defineCONFIG_BOOTFILE uImage
 #defineCONFIG_ETHADDR  00:0E:99:00:24:20
 
-#ifdef CONFIG_APOLLON_PLUS
-# define   CONFIG_BOOTARGS root=/dev/nfs rw mem=64M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2
+#ifdef CONFIG_APOLLON_PLUS
+#define CONFIG_SYS_MEM mem=64M
+#else
+#define CONFIG_SYS_MEM mem=128
+#endif
+
+#ifdef CONFIG_SYS_USE_UBI
+#define CONFIG_SYS_UBI ubi.mtd=4
 #else
-# define   CONFIG_BOOTARGS root=/dev/nfs rw mem=128M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2
+#define CONFIG_SYS_UBI 
 #endif
 
+#define CONFIG_BOOTARGS root=/dev/nfs rw  CONFIG_SYS_MEM \
+console=ttyS0,115200n8 \
+ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0: \
+   apollon:eth0:off nfsroot=/tftpboot/nfsroot profile=2  \
+   CONFIG_SYS_UBI
+
 #defineCONFIG_EXTRA_ENV_SETTINGS   
\
Image=tftp 0x80008000 Image; go 0x80008000\0  \
zImage=tftp 0x8018 zImage; go 0x8018\0\
uImage=tftp 0x8018 uImage; bootm 0x8018\0 \
uboot=tftp 0x80008000 u-boot.bin; go 0x80008000\0 \
-   xloader=tftp 0x8018 x-load.bin; cp.w 0x8018 0x0400 0x1000; 
go 0x0400\0\
+   xloader=tftp 0x8018 x-load.bin;   \
+cp.w 0x8018 0x0400 0x1000; go 0x0400\0   \
syncmode50=mw.w 0x1e442 0xc0c4; mw 0x6800a060 0xe30d1201\0\
syncmode=mw.w 0x1e442 0xe0f4; mw 0x6800a060 0xe30d1201\0  \
norboot=cp32 0x1804 0x80008000 0x20; go 0x80008000\0  \
-   oneboot

[U-Boot] [PATCH] [UBI] UBI command support (take #2)

2008-10-22 Thread Kyungmin Park
It supports basic operation such as create, remove, read, and write.

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
diff --git a/common/Makefile b/common/Makefile
index f00cbd9..b02a541 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -139,6 +139,7 @@ COBJS-$(CONFIG_CMD_SETEXPR) += cmd_setexpr.o
 COBJS-$(CONFIG_CMD_SPI) += cmd_spi.o
 COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o
 COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o
+COBJS-$(CONFIG_CMD_UBI) += cmd_ubi.o
 COBJS-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o
 ifdef CONFIG_CMD_USB
 COBJS-y += cmd_usb.o
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
new file mode 100644
index 000..657003e
--- /dev/null
+++ b/common/cmd_ubi.c
@@ -0,0 +1,516 @@
+/*
+ * Unsorted Block Image commands
+ *
+ *  Copyright (C) 2008 Samsung Electronics
+ *  Kyungmin Park [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include common.h
+#include command.h
+#include exports.h
+
+#include linux/mtd/mtd.h
+#include linux/mtd/partitions.h
+#include ubi_uboot.h
+#include asm/errno.h
+
+/* Private own data */
+static struct ubi_device *ubi;
+static int ubi_initialized;
+
+static void ubi_dump_vol_info(const struct ubi_volume *vol)
+{
+   ubi_msg(volume information dump:);
+   ubi_msg(vol_id  %d, vol-vol_id);
+   ubi_msg(reserved_pebs   %d, vol-reserved_pebs);
+   ubi_msg(alignment   %d, vol-alignment);
+   ubi_msg(data_pad%d, vol-data_pad);
+   ubi_msg(vol_type%d, vol-vol_type);
+   ubi_msg(name_len%d, vol-name_len);
+   ubi_msg(usable_leb_size %d, vol-usable_leb_size);
+   ubi_msg(used_ebs%d, vol-used_ebs);
+   ubi_msg(used_bytes  %lld, vol-used_bytes);
+   ubi_msg(last_eb_bytes   %d, vol-last_eb_bytes);
+   ubi_msg(corrupted   %d, vol-corrupted);
+   ubi_msg(upd_marker  %d, vol-upd_marker);
+
+   if (vol-name_len = UBI_VOL_NAME_MAX 
+   strnlen(vol-name, vol-name_len + 1) == vol-name_len) {
+   ubi_msg(name%s, vol-name);
+   } else {
+   ubi_msg(the 1st 5 characters of the name: %c%c%c%c%c,
+   vol-name[0], vol-name[1], vol-name[2],
+   vol-name[3], vol-name[4]);
+   }
+   printf(\n);
+}
+
+static void display_volume_info(struct ubi_device *ubi)
+{
+   int i;
+
+   for (i = 0; i  (ubi-vtbl_slots + 1); i++) {
+   if (!ubi-volumes[i])
+   continue;   /* Empty record */
+   ubi_dump_vol_info(ubi-volumes[i]);
+   }
+}
+
+static void display_ubi_info(struct ubi_device *ubi)
+{
+   ubi_msg(MTD device name:\%s\, ubi-mtd-name);
+   ubi_msg(MTD device size:%llu MiB, ubi-flash_size  20);
+   ubi_msg(physical eraseblock size:   %d bytes (%d KiB),
+   ubi-peb_size, ubi-peb_size  10);
+   ubi_msg(logical eraseblock size:%d bytes, ubi-leb_size);
+   ubi_msg(number of good PEBs:%d, ubi-good_peb_count);
+   ubi_msg(number of bad PEBs: %d, ubi-bad_peb_count);
+   ubi_msg(smallest flash I/O unit:%d, ubi-min_io_size);
+   ubi_msg(VID header offset:  %d (aligned %d),
+   ubi-vid_hdr_offset, ubi-vid_hdr_aloffset);
+   ubi_msg(data offset:%d, ubi-leb_start);
+   ubi_msg(max. allowed volumes:   %d, ubi-vtbl_slots);
+   ubi_msg(wear-leveling threshold:%d, CONFIG_MTD_UBI_WL_THRESHOLD);
+   ubi_msg(number of internal volumes: %d, UBI_INT_VOL_COUNT);
+   ubi_msg(number of user volumes: %d,
+   ubi-vol_count - UBI_INT_VOL_COUNT);
+   ubi_msg(available PEBs: %d, ubi-avail_pebs);
+   ubi_msg(total number of reserved PEBs: %d, ubi-rsvd_pebs);
+   ubi_msg(number of PEBs reserved for bad PEB handling: %d,
+   ubi-beb_rsvd_pebs);
+   ubi_msg(max/mean erase counter: %d/%d, ubi-max_ec, ubi-mean_ec);
+}
+
+static int ubi_info(int layout)
+{
+   if (layout)
+   display_volume_info(ubi);
+   else
+   display_ubi_info(ubi);
+
+   return 0;
+}
+
+static int parse_num(size_t *num, const char *token)
+{
+   char *endp;
+   size_t n;
+
+   n = (size_t) ustrtoul(token, endp, 0);
+   if (*endp)
+   return -EINVAL;
+
+   *num = n;
+   return 0;
+}
+
+static int verify_mkvol_req(const struct ubi_device *ubi,
+   const struct ubi_mkvol_req *req)
+{
+   int n, err = -EINVAL;
+
+   if (req-bytes  0 || req-alignment  0 || req-vol_type  0 ||
+   req-name_len  0)
+   goto bad;
+
+   if ((req-vol_id  0 || req-vol_id = ubi-vtbl_slots) 
+   req-vol_id != UBI_VOL_NUM_AUTO)
+   goto bad

Re: [U-Boot] [PATCH v2 0/4] Add SMDK5250 board support

2012-01-09 Thread Kyungmin Park
On 1/10/12, Chander Kashyap chander.kash...@linaro.org wrote:
 Dear Simon,

 On 9 January 2012 23:25, Simon Glass s...@chromium.org wrote:
 Hi Chander,

 On Sun, Jan 8, 2012 at 10:40 PM, Chander Kashyap
 chander.kash...@linaro.org wrote:
 This patchset add support for Samsung's SMDK5250 board based on
 EXYNOS5250 based SoC. It also adds support for MMC SPL booting.

 The porting is done by Samsung engineers at HQ in System LSI Team.
 I am contributing in upstreaming the code for the board.

 Based upon discussions following patches are dropped in this version:
 Exynos: Add CONFIG_EXYNOS4 Macro to EXYNOS4 based boards
 Exynos: Clock.c: Replace exynos4 prefix with exynos

 SMDK5250: enable device tree support is squashed with
 EXYNOS: Add SMDK5250 board support

 Chander Kashyap (4):
  Exynos: Clock.c: Use CONFIG_SYS_CLK_FREQ macro
  ARM: EXYNOS: Add support for Exynos5 based SoCs
  EXYNOS: Add SMDK5250 board support
  EXYNOS: SMDK5250: Add MMC SPL support

  MAINTAINERS   |1 +
  arch/arm/cpu/armv7/exynos/clock.c |  215 +-
  arch/arm/include/asm/arch-exynos/clock.h  |  326 ++
  arch/arm/include/asm/arch-exynos/cpu.h|   53 ++-
  arch/arm/include/asm/arch-exynos/gpio.h   |   32 ++
  board/samsung/smdk5250/Makefile   |   64 +++
  board/samsung/smdk5250/lowlevel_init.S|  528
 ++
  board/samsung/smdk5250/mem_setup.S|  600
 +

 Are you planning to reimplement most of these two files in C as per
 Wolfgang's comments on the TRATS board, or is that a separate issue?
 Not as of now. We have 14K for spl.  Using C style it might not fit into
 that.
In case of trats implemented by C. it's not big. and I think it can
fit SPL size limitation.

Thank you,
Kyungmin Park

 Regards,
 Simon

  board/samsung/smdk5250/mmc_boot.c |   58 +++
  board/samsung/smdk5250/smdk5250.c |  125 +
  board/samsung/smdk5250/smdk5250_setup.h   |  589
 
  board/samsung/smdk5250/tools/mkexynos_image.c |  117 +
  boards.cfg|1 +
  include/configs/s5pc210_universal.h   |1 +
  include/configs/smdk5250.h|  188 
  15 files changed, 2878 insertions(+), 20 deletions(-)
  create mode 100644 board/samsung/smdk5250/Makefile
  create mode 100644 board/samsung/smdk5250/lowlevel_init.S
  create mode 100644 board/samsung/smdk5250/mem_setup.S
  create mode 100644 board/samsung/smdk5250/mmc_boot.c
  create mode 100644 board/samsung/smdk5250/smdk5250.c
  create mode 100644 board/samsung/smdk5250/smdk5250_setup.h
  create mode 100644 board/samsung/smdk5250/tools/mkexynos_image.c
  create mode 100644 include/configs/smdk5250.h

 --
 1.7.5.4

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



 --
 with warm regards,
 Chander Kashyap

 ___
 linaro-dev mailing list
 linaro-...@lists.linaro.org
 http://lists.linaro.org/mailman/listinfo/linaro-dev

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


Re: [U-Boot] [PATCH 2/2] usb: gadget: Use unaligned access for wMaxPacketSize

2013-05-13 Thread Kyungmin Park
On Mon, May 13, 2013 at 7:23 PM, Vivek Gautam gautam.vi...@samsung.comwrote:

 Use get_unaligned() while fetching wMaxPacketSize to avoid
 voilating any alignment rules.


It's another story, can we get performance gain with unaligned access
feature? In case of kernel, we got some gains.

Anyway, good job!

Acked-by: Kyungmin Park kyungmin.p...@samsung.com


 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Piotr Wilczek p.wilc...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Lukasz Dalek luk0...@gmail.com
 Cc: Marek Vasut ma...@denx.de
 ---

 Just did a build test on u-boot-usb/master branch.
 Need to be tested further.

 Based on u-boot-usb/next.

  drivers/usb/gadget/f_mass_storage.c |3 ++-
  drivers/usb/gadget/pxa25x_udc.c |   13 +++--
  2 files changed, 9 insertions(+), 7 deletions(-)

 diff --git a/drivers/usb/gadget/f_mass_storage.c
 b/drivers/usb/gadget/f_mass_storage.c
 index c28866f..45bc132 100644
 --- a/drivers/usb/gadget/f_mass_storage.c
 +++ b/drivers/usb/gadget/f_mass_storage.c
 @@ -2261,7 +2261,8 @@ reset:
 if (rc)
 goto reset;
 fsg-bulk_out_enabled = 1;
 -   common-bulk_out_maxpacket = le16_to_cpu(d-wMaxPacketSize);
 +   common-bulk_out_maxpacket =
 +
 le16_to_cpu(get_unaligned(d-wMaxPacketSize));
 clear_bit(IGNORE_BULK_OUT, fsg-atomic_bitflags);

 /* Allocate the requests */
 diff --git a/drivers/usb/gadget/pxa25x_udc.c
 b/drivers/usb/gadget/pxa25x_udc.c
 index 9ce98f0..085503d 100644
 --- a/drivers/usb/gadget/pxa25x_udc.c
 +++ b/drivers/usb/gadget/pxa25x_udc.c
 @@ -314,7 +314,8 @@ static int pxa25x_ep_enable(struct usb_ep *_ep,
 if (!_ep || !desc || ep-desc || _ep-name == ep0name
 || desc-bDescriptorType != USB_DT_ENDPOINT
 || ep-bEndpointAddress != desc-bEndpointAddress
 -   || ep-fifo_size 
 le16_to_cpu(desc-wMaxPacketSize)) {
 +   || ep-fifo_size 
 +
  le16_to_cpu(get_unaligned(desc-wMaxPacketSize))) {
 printf(%s, bad ep or descriptor\n, __func__);
 return -EINVAL;
 }
 @@ -329,9 +330,9 @@ static int pxa25x_ep_enable(struct usb_ep *_ep,

 /* hardware _could_ do smaller, but driver doesn't */
 if ((desc-bmAttributes == USB_ENDPOINT_XFER_BULK
 -le16_to_cpu(desc-wMaxPacketSize)
 +   
 le16_to_cpu(get_unaligned(desc-wMaxPacketSize))
 != BULK_FIFO_SIZE)
 -   || !desc-wMaxPacketSize) {
 +   || !get_unaligned(desc-wMaxPacketSize)) {
 printf(%s, bad %s maxpacket\n, __func__, _ep-name);
 return -ERANGE;
 }
 @@ -345,7 +346,7 @@ static int pxa25x_ep_enable(struct usb_ep *_ep,
 ep-desc = desc;
 ep-stopped = 0;
 ep-pio_irqs = 0;
 -   ep-ep.maxpacket = le16_to_cpu(desc-wMaxPacketSize);
 +   ep-ep.maxpacket =
 le16_to_cpu(get_unaligned(desc-wMaxPacketSize));

 /* flush fifo (mostly for OUT buffers) */
 pxa25x_ep_fifo_flush(_ep);
 @@ -485,7 +486,7 @@ write_fifo(struct pxa25x_ep *ep, struct pxa25x_request
 *req)
  {
 unsigned max;

 -   max = le16_to_cpu(ep-desc-wMaxPacketSize);
 +   max = le16_to_cpu(get_unaligned(ep-desc-wMaxPacketSize));
 do {
 unsigned count;
 int is_last, is_short;
 @@ -766,7 +767,7 @@ pxa25x_ep_queue(struct usb_ep *_ep, struct usb_request
 *_req, gfp_t gfp_flags)
  */
 if (unlikely(ep-bmAttributes == USB_ENDPOINT_XFER_ISOC
  req-req.length 
 -   le16_to_cpu(ep-desc-wMaxPacketSize)))
 +
 le16_to_cpu(get_unaligned(ep-desc-wMaxPacketSize
 return -EMSGSIZE;

 debug_cond(NOISY, %s queue req %p, len %d buf %p\n,
 --
 1.7.6.5

 ___
 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 2/2] SPL: ONENAND: Support SPL to boot u-boot from OneNAND.

2013-02-05 Thread Kyungmin Park
Hi,

On Tue, Feb 5, 2013 at 6:23 PM, Enric Balletbo i Serra
eballe...@gmail.com wrote:
 From: Enric Balletbo i Serra eballe...@iseebcn.com

 This patch will allow use SPL to boot an u-boot from the OneNAND.

 Tested with IGEPv2 board with a OneNAND from Numonyx.

 Signed-off-by: Enric Balletbo i Serra eballe...@iseebcn.com
 ---
  arch/arm/cpu/armv7/omap3/board.c |2 +-
It's not related with OneNAND SPL patch, can you split it two patches?
  common/spl/Makefile  |1 +
  common/spl/spl.c |5 +
  common/spl/spl_onenand.c |   45 
 ++
  4 files changed, 52 insertions(+), 1 deletion(-)
  create mode 100644 common/spl/spl_onenand.c

 diff --git a/arch/arm/cpu/armv7/omap3/board.c 
 b/arch/arm/cpu/armv7/omap3/board.c
 index 89c587e..63063c8 100644
 --- a/arch/arm/cpu/armv7/omap3/board.c
 +++ b/arch/arm/cpu/armv7/omap3/board.c
 @@ -110,7 +110,7 @@ int board_mmc_init(bd_t *bis)

  void spl_board_init(void)
  {
 -#ifdef CONFIG_SPL_NAND_SUPPORT
 +#if defined(CONFIG_SPL_NAND_SUPPORT) || defined(CONFIG_SPL_ONENAND_SUPPORT)
 gpmc_init();
  #endif
  #ifdef CONFIG_SPL_I2C_SUPPORT
 diff --git a/common/spl/Makefile b/common/spl/Makefile
 index 5698a23..da2afc1 100644
 --- a/common/spl/Makefile
 +++ b/common/spl/Makefile
 @@ -18,6 +18,7 @@ COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
  COBJS-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
  COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
  COBJS-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
 +COBJS-$(CONFIG_SPL_ONENAND_SUPPORT) += spl_onenand.o
  COBJS-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
  endif

 diff --git a/common/spl/spl.c b/common/spl/spl.c
 index ff9ba7b..c584247 100644
 --- a/common/spl/spl.c
 +++ b/common/spl/spl.c
 @@ -197,6 +197,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 spl_nand_load_image();
 break;
  #endif
 +#ifdef CONFIG_SPL_ONENAND_SUPPORT
 +   case BOOT_DEVICE_ONE_NAND:
ONE_NAND? It should be ONENAND.
 +   spl_onenand_load_image();
 +   break;
 +#endif
  #ifdef CONFIG_SPL_NOR_SUPPORT
 case BOOT_DEVICE_NOR:
 spl_nor_load_image();
 diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c
 new file mode 100644
 index 000..247f97b
 --- /dev/null
 +++ b/common/spl/spl_onenand.c
 @@ -0,0 +1,45 @@
 +/*
 + * Copyright (C) 2011
 + * Corscience GmbH  Co. KG - Simon Schwarz schw...@corscience.de
 + *
 + * See file CREDITS for list of people who contributed to this
 + * project.
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 + * MA 02111-1307 USA
 + */
 +#include common.h
 +#include config.h
 +#include spl.h
 +#include asm/io.h
 +#include onenand_uboot.h
 +
 +void spl_onenand_load_image(void)
 +{
 +   struct image_header *header;
 +   int *src __attribute__((unused));
 +   int *dst __attribute__((unused));
why these are needed? just remove these.

Thank you,
Kyungmin Park
 +
 +   debug(spl: onenand\n);
 +
 +   /*use CONFIG_SYS_TEXT_BASE as temporary storage area */
 +   header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
 +   /* Load u-boot */
 +   onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
 +   CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header);
 +   spl_parse_image_header(header);
 +   onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
 +   spl_image.size, (void *)spl_image.load_addr);
 +}
 --
 1.7.10.4

 ___
 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 3/4] EXYNOS: additional Exynos4 SoC series support

2012-08-28 Thread Kyungmin Park
);
 + break;
 + default:
 + debug(%s: invalid peripheral %d, __func__, peripheral);
 + return -1;
 + }
 +
 + return 0;
 +}
 +
  static void exynos5_uart_config(int peripheral)
  {
   struct exynos5_gpio_part1 *gpio1 =
 @@ -269,6 +508,8 @@ int exynos_pinmux_config(int peripheral, int flags)
  {
   if (cpu_is_exynos5())
   return exynos5_pinmux_config(peripheral, flags);
 + else if (cpu_is_exynos4())
 + return exynos4_pinmux_config(peripheral, flags);
   else {
   debug(pinmux functionality not supported\n);
   return -1;
 diff --git a/arch/arm/include/asm/arch-exynos/clock.h
 b/arch/arm/include/asm/arch-exynos/clock.h
 index fce38ef..e238810 100644
 --- a/arch/arm/include/asm/arch-exynos/clock.h
 +++ b/arch/arm/include/asm/arch-exynos/clock.h
 @@ -57,10 +57,20 @@ struct exynos4_clock {
   unsigned char   res16[0xec];
   unsigned intepll_con0;
   unsigned intepll_con1;
 +#ifdef CONFIG_EXYNOS4210
like above, how about to define 4412 specific clock? e.g., exynos4412_clock?
   unsigned char   res17[0x8];
 +#else
 + unsigned intepll_con2;
 + unsigned char   res17[0x4];
 +#endif
   unsigned intvpll_con0;
   unsigned intvpll_con1;
 +#ifdef CONFIG_EXYNOS4210
   unsigned char   res18[0xe8];
 +#else
 + unsigned intvpll_con2;
 + unsigned char   res18[0xe4];
 +#endif
   unsigned intsrc_top0;
   unsigned intsrc_top1;
   unsigned char   res19[0x8];
 @@ -161,7 +171,16 @@ struct exynos4_clock {
   unsigned char   res38[0x8c];
   unsigned intclkout_cmu_top;
   unsigned intclkout_cmu_top_div_stat;
 +#ifdef CONFIG_EXYNOS4210
   unsigned char   res39[0x37f8];
 +#else
 + unsigned char   res39[0x3600];
 + unsigned intmpll_lock;
 + unsigned char   res3a[0xfc];
 + unsigned intmpll_con0;
 + unsigned intmpll_con1;
 + unsigned char   res3b[0xf0];
 +#endif
   unsigned intsrc_dmc;
   unsigned char   res40[0xfc];
   unsigned intsrc_mask_dmc;
 @@ -195,14 +214,22 @@ struct exynos4_clock {
   unsigned intmaxperf;
   unsigned char   res51[0x2f78];
   unsigned intapll_lock;
 +#ifdef CONFIG_EXYNOS4210
   unsigned char   res52[0x4];
   unsigned intmpll_lock;
 +#else
 + unsigned char   res52[0x8];
 +#endif
   unsigned char   res53[0xf4];
   unsigned intapll_con0;
   unsigned intapll_con1;
 +#ifdef CONFIG_EXYNOS4210
   unsigned intmpll_con0;
   unsigned intmpll_con1;
   unsigned char   res54[0xf0];
 +#else
 + unsigned char   res54[0xf8];
 +#endif
   unsigned intsrc_cpu;
   unsigned char   res55[0x1fc];
   unsigned intmux_stat_cpu;
 diff --git a/arch/arm/include/asm/arch-exynos/cpu.h
 b/arch/arm/include/asm/arch-exynos/cpu.h
 index 2cd4ae1..d1117c0 100644
 --- a/arch/arm/include/asm/arch-exynos/cpu.h
 +++ b/arch/arm/include/asm/arch-exynos/cpu.h
 @@ -55,7 +55,11 @@
  #define EXYNOS4_MODEM_BASE   0x13A0
  #define EXYNOS4_USBPHY_CONTROL   0x10020704

 +#ifdef CONFIG_EXYNOS4412
 +#define EXYNOS4_GPIO_PART4_BASE  0x106E
 +#else
  #define EXYNOS4_GPIO_PART4_BASE  DEVICE_NOT_AVAILABLE
 +#endif
if it's only valid at exynos4412, then make it variable and configure
it at runtime
e.g.,

#define EXYNOS4412_GPIO_PART4_BASE  0x106E
#define EXYNOS4_GPIO_PART4_BASE DEVICE_NOT_AVAILABLE

int exynos4_get_gpio_part4_base(void)
{
if (cpu_is_exynos4412())
return EXYNOS4412_GPIO_PART4_BASE;
return EXYNOS4_GPIO_PART4_BASE;
}

Thank you,
Kyungmin Park
  #define EXYNOS4_DP_BASE  DEVICE_NOT_AVAILABLE

  /* EXYNOS5 */
 diff --git a/arch/arm/include/asm/arch-exynos/gpio.h
 b/arch/arm/include/asm/arch-exynos/gpio.h
 index 97be4ea..9539aa0 100644
 --- a/arch/arm/include/asm/arch-exynos/gpio.h
 +++ b/arch/arm/include/asm/arch-exynos/gpio.h
 @@ -49,6 +49,9 @@ struct exynos4_gpio_part1 {
   struct s5p_gpio_bank f1;
   struct s5p_gpio_bank f2;
   struct s5p_gpio_bank f3;
 + struct s5p_gpio_bank res1[2];
 + struct s5p_gpio_bank j0;
 + struct s5p_gpio_bank j1;
  };

  struct exynos4_gpio_part2 {
 @@ -68,7 +71,13 @@ struct exynos4_gpio_part2 {
   struct s5p_gpio_bank y4;
   struct s5p_gpio_bank y5;
   struct s5p_gpio_bank y6;
 - struct s5p_gpio_bank res1[80];
 + struct s5p_gpio_bank res1[3];
 + struct s5p_gpio_bank m0;
 + struct s5p_gpio_bank m1;
 + struct s5p_gpio_bank m2;
 + struct s5p_gpio_bank m3;
 + struct s5p_gpio_bank m4;
 + struct s5p_gpio_bank res2[72];
   struct s5p_gpio_bank x0;
   struct s5p_gpio_bank x1;
   struct s5p_gpio_bank x2;
 @@ -79,6 +88,16 @@ struct exynos4_gpio_part3 {
   struct s5p_gpio_bank z;
  };

 +struct exynos4_gpio_part4 {
 + struct s5p_gpio_bank v0;
 + struct s5p_gpio_bank v1

Re: [U-Boot] [PATCH] disk: generate GUID Partiton Tables

2012-08-09 Thread Kyungmin Park
On 8/10/12, Wolfgang Denk w...@denx.de wrote:
 Dear Donghwa Lee,

 In message 4fa08f0a.6040...@samsung.com you wrote:
 This patch manipulates GUID Papartition Tables.
 I send this patch on behalf of Gwuieon Jin.

 Signed-off-by: Gwuieon Jin  ge@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  disk/part_efi.c |  107
 +++
  disk/part_efi.h |2 +
  include/part.h  |2 +
  3 files changed, 111 insertions(+), 0 deletions(-)

 diff --git a/disk/part_efi.c b/disk/part_efi.c
 index b6cda57..ce25ad5 100644
 --- a/disk/part_efi.c
 +++ b/disk/part_efi.c
 @@ -433,4 +433,111 @@ static int is_pte_valid(gpt_entry * pte)
  return 1;
  }
  }
 +
 +void set_gpt_table(block_dev_desc_t *dev_desc,  unsigned int
 part_start_lba,
 +int parts, unsigned int *blocks, unsigned int *part_offset)

 Is there any code anywhere that actually calls this function?

 I cannot see it, and we don't add dead code...

It used at generating partition when new partition information
downloaded by USB.
and it's preperation patch for it.
However, as you concerns thses codes are not yet posted. it will send
patches together next time.

Thank you,
Kyungmin Park


 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
 If a computer can't directly address all the RAM you can  use,  it's
 just a toy. - anonymous comp.sys.amiga posting, non-sequitir
 ___
 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 1/2] EXYNOS5: Add pinmux for VBus

2012-12-03 Thread Kyungmin Park
On Mon, Dec 3, 2012 at 10:18 PM, Rajeshwari Shinde
rajeshwar...@samsung.com wrote:
 This patch sets pinmux for VBus of USB.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
 ---
  arch/arm/cpu/armv7/exynos/pinmux.c|   10 ++
  arch/arm/include/asm/arch-exynos/periph.h |1 +
  2 files changed, 11 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c 
 b/arch/arm/cpu/armv7/exynos/pinmux.c
 index f9f6911..d65ffc7 100644
 --- a/arch/arm/cpu/armv7/exynos/pinmux.c
 +++ b/arch/arm/cpu/armv7/exynos/pinmux.c
 @@ -285,6 +285,14 @@ void exynos5_spi_config(int peripheral)
 }
  }

 +void exynos5_usb20_config(void)
 +{
 +   struct exynos5_gpio_part1 *gpio1 =
 +   (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
 +   /* Enable VBUS power switch */
 +   s5p_gpio_direction_output(gpio1-x2,6, 1);
it seems to be board specific GPIO value. doesn't it?

Thank you,
Kyungmin Park
 +}
 +
  static int exynos5_pinmux_config(int peripheral, int flags)
  {
 switch (peripheral) {
 @@ -322,6 +330,8 @@ static int exynos5_pinmux_config(int peripheral, int 
 flags)
 case PERIPH_ID_SPI4:
 exynos5_spi_config(peripheral);
 break;
 +   case PERIPH_ID_USB20:
 +   exynos5_usb20_config();
 default:
 debug(%s: invalid peripheral %d, __func__, peripheral);
 return -1;
 diff --git a/arch/arm/include/asm/arch-exynos/periph.h 
 b/arch/arm/include/asm/arch-exynos/periph.h
 index 783b77c..84593f6 100644
 --- a/arch/arm/include/asm/arch-exynos/periph.h
 +++ b/arch/arm/include/asm/arch-exynos/periph.h
 @@ -46,6 +46,7 @@ enum periph_id {
 PERIPH_ID_SPI0 = 68,
 PERIPH_ID_SPI1,
 PERIPH_ID_SPI2,
 +   PERIPH_ID_USB20,
 PERIPH_ID_SDMMC0 = 75,
 PERIPH_ID_SDMMC1,
 PERIPH_ID_SDMMC2,
 --
 1.7.4.4

 ___
 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 1/2] EXYNOS5: Add pinmux for VBus

2012-12-03 Thread Kyungmin Park
On Mon, Dec 3, 2012 at 10:38 PM, Rajeshwari Birje
rajeshwari.bi...@gmail.com wrote:
 Hi Kyungmin Park,

 On Mon, Dec 3, 2012 at 7:00 PM, Kyungmin Park kmp...@infradead.org wrote:
 On Mon, Dec 3, 2012 at 10:18 PM, Rajeshwari Shinde
 rajeshwar...@samsung.com wrote:
 This patch sets pinmux for VBus of USB.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
 ---
  arch/arm/cpu/armv7/exynos/pinmux.c|   10 ++
  arch/arm/include/asm/arch-exynos/periph.h |1 +
  2 files changed, 11 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c 
 b/arch/arm/cpu/armv7/exynos/pinmux.c
 index f9f6911..d65ffc7 100644
 --- a/arch/arm/cpu/armv7/exynos/pinmux.c
 +++ b/arch/arm/cpu/armv7/exynos/pinmux.c
 @@ -285,6 +285,14 @@ void exynos5_spi_config(int peripheral)
 }
  }

 +void exynos5_usb20_config(void)
 +{
 +   struct exynos5_gpio_part1 *gpio1 =
 +   (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
 +   /* Enable VBUS power switch */
 +   s5p_gpio_direction_output(gpio1-x2,6, 1);
 it seems to be board specific GPIO value. doesn't it?
 Yes it is smdk5250 specific.
So it's not proper place to add.
 Thank you,
 Kyungmin Park
 +}
 +
  static int exynos5_pinmux_config(int peripheral, int flags)
  {
 switch (peripheral) {
 @@ -322,6 +330,8 @@ static int exynos5_pinmux_config(int peripheral, int 
 flags)
 case PERIPH_ID_SPI4:
 exynos5_spi_config(peripheral);
 break;
 +   case PERIPH_ID_USB20:
 +   exynos5_usb20_config();
 default:
 debug(%s: invalid peripheral %d, __func__, peripheral);
 return -1;
 diff --git a/arch/arm/include/asm/arch-exynos/periph.h 
 b/arch/arm/include/asm/arch-exynos/periph.h
 index 783b77c..84593f6 100644
 --- a/arch/arm/include/asm/arch-exynos/periph.h
 +++ b/arch/arm/include/asm/arch-exynos/periph.h
 @@ -46,6 +46,7 @@ enum periph_id {
 PERIPH_ID_SPI0 = 68,
 PERIPH_ID_SPI1,
 PERIPH_ID_SPI2,
 +   PERIPH_ID_USB20,
 PERIPH_ID_SDMMC0 = 75,
 PERIPH_ID_SDMMC1,
 PERIPH_ID_SDMMC2,
 --
 1.7.4.4

 ___
 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

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


Re: [U-Boot] [PATCH 2/2] EXYNOS5: Add gpio pin numbering feature

2012-12-12 Thread Kyungmin Park
Hi,

On Wed, Dec 12, 2012 at 8:33 PM, Rajeshwari Shinde
rajeshwar...@samsung.com wrote:
 This patch adds support for gpio pin numbering support on EXYNOS5
 pinmux.

We already know that each exynos5 SoCs has different GPIO name and offsets.
So it's good time to use proper soc prefix. e.g., EXYNOS5250_*.
Since only exynos5250 is mainlined at this time.

Thank you,
Kyungmin Park


 Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
 Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
 ---
  arch/arm/cpu/armv7/exynos/pinmux.c  |  148 +
  arch/arm/include/asm/arch-exynos/gpio.h |  360 
 ++-
  2 files changed, 413 insertions(+), 95 deletions(-)

 diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c 
 b/arch/arm/cpu/armv7/exynos/pinmux.c
 index f02f441..9b4355a 100644
 --- a/arch/arm/cpu/armv7/exynos/pinmux.c
 +++ b/arch/arm/cpu/armv7/exynos/pinmux.c
 @@ -28,89 +28,77 @@

  static void exynos5_uart_config(int peripheral)
  {
 -   struct exynos5_gpio_part1 *gpio1 =
 -   (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
 -   struct s5p_gpio_bank *bank;
 int i, start, count;

 switch (peripheral) {
 case PERIPH_ID_UART0:
 -   bank = gpio1-a0;
 -   start = 0;
 +   start = GPIO_A00;
 count = 4;
 break;
 case PERIPH_ID_UART1:
 -   bank = gpio1-d0;
 -   start = 0;
 +   start = GPIO_D00;
 count = 4;
 break;
 case PERIPH_ID_UART2:
 -   bank = gpio1-a1;
 -   start = 0;
 +   start = GPIO_A10;
 count = 4;
 break;
 case PERIPH_ID_UART3:
 -   bank = gpio1-a1;
 -   start = 4;
 +   start = GPIO_A14;
 count = 2;
 break;
 }
 for (i = start; i  start + count; i++) {
 -   s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
 -   s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
 +   gpio_set_pull(i, GPIO_PULL_NONE);
 +   gpio_cfg_pin(i, GPIO_FUNC(0x2));
 }
  }

  static int exynos5_mmc_config(int peripheral, int flags)
  {
 -   struct exynos5_gpio_part1 *gpio1 =
 -   (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
 -   struct s5p_gpio_bank *bank, *bank_ext;
 -   int i, start = 0, gpio_func = 0;
 +   int i, start, start_ext, gpio_func = 0;

 switch (peripheral) {
 case PERIPH_ID_SDMMC0:
 -   bank = gpio1-c0;
 -   bank_ext = gpio1-c1;
 -   start = 0;
 +   start = GPIO_C00;
 +   start_ext = GPIO_C10;
 gpio_func = GPIO_FUNC(0x2);
 break;
 case PERIPH_ID_SDMMC1:
 -   bank = gpio1-c2;
 -   bank_ext = NULL;
 +   start = GPIO_C20;
 +   start_ext = 0;
 break;
 case PERIPH_ID_SDMMC2:
 -   bank = gpio1-c3;
 -   bank_ext = gpio1-c4;
 -   start = 3;
 +   start = GPIO_C30;
 +   start_ext = GPIO_C43;
 gpio_func = GPIO_FUNC(0x3);
 break;
 case PERIPH_ID_SDMMC3:
 -   bank = gpio1-c4;
 -   bank_ext = NULL;
 +   start = GPIO_C40;
 +   start_ext = 0;
 break;
 }
 -   if ((flags  PINMUX_FLAG_8BIT_MODE)  !bank_ext) {
 +   if ((flags  PINMUX_FLAG_8BIT_MODE)  !start_ext) {
 debug(SDMMC device %d does not support 8bit mode,
 peripheral);
 return -1;
 }
 if (flags  PINMUX_FLAG_8BIT_MODE) {
 -   for (i = start; i = (start + 3); i++) {
 -   s5p_gpio_cfg_pin(bank_ext, i, gpio_func);
 -   s5p_gpio_set_pull(bank_ext, i, GPIO_PULL_UP);
 -   s5p_gpio_set_drv(bank_ext, i, GPIO_DRV_4X);
 +   for (i = start_ext; i = (start_ext + 3); i++) {
 +   gpio_cfg_pin(i, gpio_func);
 +   gpio_set_pull(i, GPIO_PULL_UP);
 +   gpio_set_drv(i, GPIO_DRV_4X);
 }
 }
 for (i = 0; i  2; i++) {
 -   s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
 -   s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
 -   s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);
 +   gpio_cfg_pin(start + i, GPIO_FUNC(0x2));
 +   gpio_set_pull(start + i, GPIO_PULL_NONE);
 +   gpio_set_drv(start + i, GPIO_DRV_4X);
 }
 for (i = 3; i = 6; i++) {
 -   s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
 -   s5p_gpio_set_pull(bank, i, GPIO_PULL_UP);
 -   s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);
 +   gpio_cfg_pin

Re: [U-Boot] [PATCH 2/5] EXYNOS5: Add pinmux for LCD

2012-12-12 Thread Kyungmin Park
Hi,

On Tue, Dec 11, 2012 at 8:01 PM, Ajay Kumar ajaykumar...@samsung.com wrote:
 This patch adds pinmux configuration for backlight, LCD reset
 and HPD for DP panel on Exynos5 SMDK.

 Signed-off-by: Ajay Kumar ajaykumar...@samsung.com
 ---
  arch/arm/cpu/armv7/exynos/pinmux.c|   20 
  arch/arm/include/asm/arch-exynos/periph.h |1 +
  2 files changed, 21 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c 
 b/arch/arm/cpu/armv7/exynos/pinmux.c
 index f02f441..84f52ea 100644
 --- a/arch/arm/cpu/armv7/exynos/pinmux.c
 +++ b/arch/arm/cpu/armv7/exynos/pinmux.c
 @@ -284,6 +284,23 @@ void exynos5_spi_config(int peripheral)
 }
  }

 +void exynos5_lcd_config()
missing void
 +{
 +   struct exynos5_gpio_part1 *gpio1 =
 +   (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
 +
 +   /* For Backlight */
 +   s5p_gpio_cfg_pin(gpio1-b2, 0, GPIO_OUTPUT);
 +   s5p_gpio_set_value(gpio1-b2, 0, 1);
 +
 +   /* LCD power on */
 +   s5p_gpio_cfg_pin(gpio1-x1, 5, GPIO_OUTPUT);
 +   s5p_gpio_set_value(gpio1-x1, 5, 1);
 +
 +   /* Set Hotplug detect for DP */
 +   s5p_gpio_cfg_pin(gpio1-x0, 7, GPIO_FUNC(0x3));
It should be SMDK5250 specific codes, it can't located at common file.

Thank you,
Kyungmin Park
 +}
 +
  static int exynos5_pinmux_config(int peripheral, int flags)
  {
 switch (peripheral) {
 @@ -321,6 +338,9 @@ static int exynos5_pinmux_config(int peripheral, int 
 flags)
 case PERIPH_ID_SPI4:
 exynos5_spi_config(peripheral);
 break;
 +   case PERIPH_ID_LCD:
 +   exynos5_lcd_config();
 +   break;
 default:
 debug(%s: invalid peripheral %d, __func__, peripheral);
 return -1;
 diff --git a/arch/arm/include/asm/arch-exynos/periph.h 
 b/arch/arm/include/asm/arch-exynos/periph.h
 index 13abd2d..446f5c9 100644
 --- a/arch/arm/include/asm/arch-exynos/periph.h
 +++ b/arch/arm/include/asm/arch-exynos/periph.h
 @@ -54,6 +54,7 @@ enum periph_id {
 PERIPH_ID_UART1,
 PERIPH_ID_UART2,
 PERIPH_ID_UART3,
 +   PERIPH_ID_LCD,

 PERIPH_ID_COUNT,
 PERIPH_ID_NONE = -1,
 --
 1.7.1

 ___
 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 V4 4/4] EXYNOS5: Add support for FIMD and DP

2012-12-21 Thread Kyungmin Park
On Friday, December 21, 2012, Rajeshwari Birje wrote:

 Hi Ajay

 On Fri, Dec 21, 2012 at 4:05 PM, Ajay Kumar 
 ajaykumar...@samsung.comjavascript:;
 wrote:

  Add panel_info structure required by LCD driver
  and DP panel platdata for SMDK5250.
  Add GPIO configuration for LCD.
  Enable FIMD and DP support on SMDK5250.
  DP Panel size: 2560x1600.
  We use 16BPP resolution to get LCD console.
 
  Signed-off-by: Ajay Kumar ajaykumar...@samsung.com javascript:;
  Acked-by: Simon Glass s...@chomium.org javascript:;
  ---
   board/samsung/smdk5250/smdk5250.c |   97
  +
   include/configs/smdk5250.h|8 +++
   2 files changed, 105 insertions(+), 0 deletions(-)
 
  diff --git a/board/samsung/smdk5250/smdk5250.c
  b/board/samsung/smdk5250/smdk5250.c
  index 4c50342..46fd2a5 100644
  --- a/board/samsung/smdk5250/smdk5250.c
  +++ b/board/samsung/smdk5250/smdk5250.c
  @@ -24,12 +24,15 @@
   #include asm/io.h
   #include i2c.h
   #include netdev.h
  +#include lcd.h
   #include spi.h
   #include asm/arch/cpu.h
   #include asm/arch/gpio.h
   #include asm/arch/mmc.h
  +#include asm/arch/power.h
   #include asm/arch/pinmux.h
   #include asm/arch/sromc.h
  +#include asm/arch/dp_info.h
   #include pmic.h
 
   DECLARE_GLOBAL_DATA_PTR;
  @@ -181,6 +184,100 @@ static int board_uart_init(void)
  return 0;
   }
 
  +void cfg_lcd_gpio(void)
  +{
  +   struct exynos5_gpio_part1 *gpio1 =
  +   (struct exynos5_gpio_part1 *)
  samsung_get_base_gpio_part1();
  +
  +   /* For Backlight */
  +   s5p_gpio_cfg_pin(gpio1-b2, 0, GPIO_OUTPUT);
  +   s5p_gpio_set_value(gpio1-b2, 0, 1);
  +
  +   /* LCD power on */
  +   s5p_gpio_cfg_pin(gpio1-x1, 5, GPIO_OUTPUT);
  +   s5p_gpio_set_value(gpio1-x1, 5, 1);
  +
  +   /* Set Hotplug detect for DP */
  +   s5p_gpio_cfg_pin(gpio1-x0, 7, GPIO_FUNC(0x3));
  +}
 
 Cant this GPIO changes go to pinmux  file?


 No it's smdk5250 specific. Other board has different GPIOs.

Thank you,



Kyungmin Park

  +
  +vidinfo_t panel_info = {
  +   .vl_freq= 60,
  +   .vl_col = 2560,
  +   .vl_row = 1600,
  +   .vl_width   = 2560,
  +   .vl_height  = 1600,
  +   .vl_clkp= CONFIG_SYS_LOW,
  +   .vl_hsp = CONFIG_SYS_LOW,
  +   .vl_vsp = CONFIG_SYS_LOW,
  +   .vl_dp  = CONFIG_SYS_LOW,
  +   .vl_bpix= 4,/* LCD_BPP = 2^4, for output conosle on
  LCD */
  +
  +   /* wDP panel timing infomation */
  +   .vl_hspw= 32,
  +   .vl_hbpd= 80,
  +   .vl_hfpd= 48,
  +
  +   .vl_vspw= 6,
  +   .vl_vbpd= 37,
  +   .vl_vfpd= 3,
  +   .vl_cmd_allow_len = 0xf,
  +
  +   .win_id = 3,
  +   .cfg_gpio   = cfg_lcd_gpio,
  +   .backlight_on   = NULL,
  +   .lcd_power_on   = NULL,
  +   .reset_lcd  = NULL,
  +   .dual_lcd_enabled = 0,
  +
  +   .init_delay = 0,
  +   .power_on_delay = 0,
  +   .reset_delay= 0,
  +   .interface_mode = FIMD_RGB_INTERFACE,
  +   .dp_enabled = 1,
  +};
  +
  +static struct edp_device_info edp_info = {
  +   .disp_info = {
  +   .h_res = 2560,
  +   .h_sync_width = 32,
  +   .h_back_porch = 80,
  +   .h_front_porch = 48,
  +   .v_res = 1600,
  +   .v_sync_width  = 6,
  +   .v_back_porch = 37,
  +   .v_front_porch = 3,
  +   .v_sync_rate = 60,
  +   },
  +   .lt_info = {
  +   .lt_status = DP_LT_NONE,
  +   },
  +   .video_info = {
  +   .master_mode = 0,
  +   .bist_mode = DP_DISABLE,
  +   .bist_pattern = NO_PATTERN,
  +   .h_sync_polarity = 0,
  +   .v_sync_polarity = 0,
  +   .interlaced = 0,
  +   .color_space = COLOR_RGB,
  +   .dynamic_range = VESA,
  +   .ycbcr_coeff = COLOR_YCBCR601,
  +   .color_depth = COLOR_8,
  +   },
  +};
  +
  +static struct exynos_dp_platform_data dp_platform_data = {
  +   .phy_enable = set_dp_phy_ctrl,
  +   .edp_dev_info   = edp_info,
  +};
  +
  +void init_panel_info(vidinfo_t *vid)
  +{
  +   vid-rgb_mode   = MODE_RGB_P,
  +
  +   exynos_set_dp_platform_data(dp_platform_data);
  +}
  +
   #ifdef CONFIG_SYS_I2C_INIT_BOARD
   static int board_i2c_init(void)
   {
  diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h
  index e412da8..a9b3b8b 100644
  --- a/inc--
 Regards,
 Rajeshwari Shinde

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


Re: [U-Boot] [PATCH 1/4] SMDK5250: Convert lowlevel_init.S to lowlevel_init_c.c

2012-12-31 Thread Kyungmin Park
 r1, r2  /* compare r1, r2 */
 -   beq 1f  /* r0 == r1 then skip sdram init */
 -
 -   /* init system clock */
 -   bl  system_clock_init
 -
 -   /* Memory initialize */
 -   bl  mem_ctrl_init
 -
 -1:
 -   bl  tzpc_init
 -   ldmia   r13!, {ip,pc}
 -
 -wakeup_reset:
 -   bl  system_clock_init
 -   bl  mem_ctrl_init
 -   bl  tzpc_init
 -
 -exit_wakeup:
 -   /* Load return address and jump to kernel */
 -   ldr r0, =(EXYNOS5_POWER_BASE + INFORM0_OFFSET)
 -
 -   /* r1 = physical address of exynos5_cpu_resume function*/
 -   ldr r1, [r0]
 -
 -   /* Jump to kernel */
 -   mov pc, r1
 -   nop
 -   nop
 +   ldr sp, =CONFIG_IRAM_STACK
 +   mov pc, lr
 diff --git a/board/samsung/smdk5250/lowlevel_init_c.c 
 b/board/samsung/smdk5250/lowlevel_init_c.c
 new file mode 100644
 index 000..fdb98cf
 --- /dev/null
 +++ b/board/samsung/smdk5250/lowlevel_init_c.c
lowlevel_init.c?
 @@ -0,0 +1,70 @@
 +/*
 + * Lowlevel setup for SMDK5250 board based on S5PC520
 + *
 + * Copyright (C) 2012 Samsung Electronics
 + * Copyright (c) 2012 The Chromium OS Authors.
 + *
 + * See file CREDITS for list of people who contributed to this
 + * project.
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 + * MA 02111-1307 USA
 + */
 +
 +#include common.h
 +#include config.h
 +#include asm/arch/cpu.h
 +#include asm/arch/dmc.h
 +#include asm/arch/power.h
 +#include asm/arch/tzpc.h
 +#include setup.h
 +
 +/* These are the things we can do during low-level init */
 +enum {
 +   DO_WAKEUP   = 1  0,
 +   DO_CLOCKS   = 1  1,
 +   DO_MEM_RESET= 1  2,
 +};
 +
 +int lowlevel_init_subsystems(void)
 +{
 +   uint32_t reset_status;
 +   int actions = 0;
 +
 +   arch_cpu_init();
 +
 +   reset_status = power_read_reset_status();
 +
 +   switch (reset_status) {
 +   case EXYNOS_CHECK_SLEEP:
 +   actions = DO_CLOCKS | DO_WAKEUP;
 +   break;
 +   case EXYNOS_CHECK_DIDLE:
 +   case EXYNOS_CHECK_LPA:
 +   actions = DO_WAKEUP;
 +   break;
 +   default:
 +   /* This is a normal boot (not a wake from sleep) */
 +   actions = DO_CLOCKS | DO_MEM_RESET;
 +   }
 +
 +   if (actions  DO_CLOCKS) {
 +   system_clock_init();
 +   mem_ctrl_init(actions  DO_MEM_RESET);
 +   tzpc_init();
 +   }
 +
 +   return actions  DO_WAKEUP;
 +}
 diff --git a/board/samsung/smdk5250/setup.h b/board/samsung/smdk5250/setup.h
 index a159601..d64e385 100644
 --- a/board/samsung/smdk5250/setup.h
 +++ b/board/samsung/smdk5250/setup.h
 @@ -28,6 +28,11 @@
  #include config.h
  #include asm/arch/dmc.h

 +/* Power Down Modes */
 +#define EXYNOS_CHECK_SLEEP 0x0BAD
 +#define EXYNOS_CHECK_DIDLE 0xBAD0
 +#define EXYNOS_CHECK_LPA   0xABAD
These can be uses other exynos5250 series. so can you place it common
header file?
 +
  /* TZPC : Register Offsets */
  #define TZPC0_BASE 0x1010
  #define TZPC1_BASE 0x1011
 @@ -539,7 +544,8 @@ enum {
   * accesses; may vary across boards.
   * @return 0 if ok, SETUP_ERR_... if there is a problem
   */
 -int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long mem_iv_size);
 +int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long mem_iv_size,
 +   int mem_reset);

  /*
   * Configure ZQ I/O interface
 @@ -588,7 +594,14 @@ void dmc_config_memory(struct mem_timings *mem, struct 
 exynos5_dmc *dmc);
  void update_reset_dll(struct exynos5_dmc *, enum ddr_mode);

  void sdelay(unsigned long);
 -void mem_ctrl_init(void);
 +void mem_ctrl_init(int mem_reset);
  void system_clock_init(void);
  void tzpc_init(void);
 +
 +/**
 + * Init subsystems according to the reset status
 + *
 + * @return 0 for a normal boot, non-zero for a resume
 + */
 +int lowlevel_init_subsystems(void);
do_lowlevle_init?

Thank you,
Kyungmin Park
  #endif
 diff --git a/board/samsung/smdk5250/spl_boot.c 
 b/board/samsung/smdk5250/spl_boot.c
 index d8f3c1e..66bce5b 100644
 --- a/board/samsung/smdk5250/spl_boot.c
 +++ b/board/samsung/smdk5250/spl_boot.c
 @@ -20,18 +20,16 @@
   * MA 02111-1307 USA

Re: [U-Boot] [PATCH V3 1/9] FDT: Add compatible string for DWMMC

2012-12-31 Thread Kyungmin Park
Hi,


On Mon, Dec 31, 2012 at 7:58 PM, Amar amarendra...@samsung.com wrote:
 Add required compatible information for DWMMC driver.

 Changes from V1:
 No change.

 Changes from V2:
 1)Updation of commit message and resubmition of proper patch set.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Signed-off-by: Amar amarendra...@samsung.com
 Acked-by: Simon Glass s...@chromium.org
 ---
  include/fdtdec.h | 1 +
  lib/fdtdec.c | 1 +
  2 files changed, 2 insertions(+)

 diff --git a/include/fdtdec.h b/include/fdtdec.h
 index ce10bf4..dcd4142 100644
 --- a/include/fdtdec.h
 +++ b/include/fdtdec.h
 @@ -76,6 +76,7 @@ enum fdt_compat_id {
 COMPAT_SAMSUNG_EXYNOS5_SOUND,   /* Exynos Sound */
 COMPAT_WOLFSON_WM8994_CODEC,/* Wolfson WM8994 Sound Codec */
 COMPAT_SAMSUNG_EXYNOS_SPI,  /* Exynos SPI */
 +   COMPAT_SAMSUNG_EXYNOS5_DWMMC,   /* Exynos5 DWMMC controller */

You already know that exynos4 series also have DWMMC controller and
it's strange to use this value at exynos4 series.
so can you use 'SAMSUNG_EXYNOS_DWMMC'?

Thank you,
Kyungmin Park

 COMPAT_COUNT,
  };
 diff --git a/lib/fdtdec.c b/lib/fdtdec.c
 index aa75710..646d5d6 100644
 --- a/lib/fdtdec.c
 +++ b/lib/fdtdec.c
 @@ -51,6 +51,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
 COMPAT(SAMSUNG_EXYNOS5_SOUND, samsung,exynos-sound),
 COMPAT(WOLFSON_WM8994_CODEC, wolfson,wm8994-codec),
 COMPAT(SAMSUNG_EXYNOS_SPI, samsung,exynos-spi),
 +   COMPAT(SAMSUNG_EXYNOS5_DWMMC, samsung,exynos5250-dwmmc),
  };

  const char *fdtdec_get_compatible(enum fdt_compat_id id)
 --
 1.8.0

 ___
 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 1/4] SMDK5250: Convert lowlevel_init.S to lowlevel_init_c.c

2013-01-01 Thread Kyungmin Park
Hi,

On 1/2/13, Rajeshwari Birje rajeshwari.bi...@gmail.com wrote:
 Hi Kyungmin Park,

 Thank you for comments.

 On Mon, Dec 31, 2012 at 6:02 PM, Kyungmin Park kmp...@infradead.org
 wrote:
 On Fri, Dec 28, 2012 at 9:08 PM, Rajeshwari Shinde
 rajeshwar...@samsung.com wrote:
 This patch converts lowlevel_init.S to lowlevel_init_c.c for
 SMDK5250.

 Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
 ---
  board/samsung/smdk5250/Makefile  |1 +
  board/samsung/smdk5250/dmc_common.c  |4 +-
  board/samsung/smdk5250/dmc_init_ddr3.c   |6 ++-
  board/samsung/smdk5250/lowlevel_init.S   |   69
 ++---
  board/samsung/smdk5250/lowlevel_init_c.c |   70
 ++
  board/samsung/smdk5250/setup.h   |   17 ++-
  board/samsung/smdk5250/spl_boot.c|   52 ++
  spl/Makefile |4 ++
  8 files changed, 142 insertions(+), 81 deletions(-)
  create mode 100644 board/samsung/smdk5250/lowlevel_init_c.c

 diff --git a/board/samsung/smdk5250/Makefile
 b/board/samsung/smdk5250/Makefile
 index 47c6a5a..b99ac7f 100644
 --- a/board/samsung/smdk5250/Makefile
 +++ b/board/samsung/smdk5250/Makefile
 @@ -37,6 +37,7 @@ endif

  ifdef CONFIG_SPL_BUILD
  COBJS  += spl_boot.o
 +COBJS  += lowlevel_init_c.o
  endif

  SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 diff --git a/board/samsung/smdk5250/dmc_common.c
 b/board/samsung/smdk5250/dmc_common.c
 index 109602a..6a26822 100644
 --- a/board/samsung/smdk5250/dmc_common.c
 +++ b/board/samsung/smdk5250/dmc_common.c
 @@ -175,7 +175,7 @@ void dmc_config_memory(struct mem_timings *mem,
 struct exynos5_dmc *dmc)
 writel(DMC_MEMBASECONFIG1_VAL, dmc-membaseconfig1);
  }

 -void mem_ctrl_init()
 +void mem_ctrl_init(int mem_reset)
 does 'reset' is enough?
 - OK
  {
 struct spl_machine_param *param = spl_get_machine_params();
 struct mem_timings *mem;
 @@ -185,7 +185,7 @@ void mem_ctrl_init()

 /* If there are any other memory variant, add their init call
 below */
 if (param-mem_type == DDR_MODE_DDR3) {
 -   ret = ddr3_mem_ctrl_init(mem, param-mem_iv_size);
 +   ret = ddr3_mem_ctrl_init(mem, param-mem_iv_size,
 mem_reset);
 if (ret) {
 /* will hang if failed to init memory control */
 while (1)
 diff --git a/board/samsung/smdk5250/dmc_init_ddr3.c
 b/board/samsung/smdk5250/dmc_init_ddr3.c
 index e050790..4e0693d 100644
 --- a/board/samsung/smdk5250/dmc_init_ddr3.c
 +++ b/board/samsung/smdk5250/dmc_init_ddr3.c
 @@ -40,7 +40,8 @@ static void reset_phy_ctrl(void)
 writel(DDR3PHY_CTRL_PHY_RESET, clk-lpddr3phy_ctrl);
  }

 -int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long
 mem_iv_size)
 +int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long
 mem_iv_size,
 +   int mem_reset)
 ditto
 -OK
  {
 unsigned int val;
 struct exynos5_phy_control *phy0_ctrl, *phy1_ctrl;
 @@ -51,7 +52,8 @@ int ddr3_mem_ctrl_init(struct mem_timings *mem,
 unsigned long mem_iv_size)
 phy1_ctrl = (struct exynos5_phy_control *)EXYNOS5_DMC_PHY1_BASE;
 dmc = (struct exynos5_dmc *)EXYNOS5_DMC_CTRL_BASE;

 -   reset_phy_ctrl();
 +   if (mem_reset)
 if (reset)
 +   reset_phy_ctrl();

 /* Set Impedance Output Driver */
 val = (mem-impedance  CA_CK_DRVR_DS_OFFSET) |
 diff --git a/board/samsung/smdk5250/lowlevel_init.S
 b/board/samsung/smdk5250/lowlevel_init.S
 index bc6cb6f..469126d 100644
 --- a/board/samsung/smdk5250/lowlevel_init.S
 +++ b/board/samsung/smdk5250/lowlevel_init.S
 @@ -23,74 +23,13 @@
   */

  #include config.h
 -#include version.h
  #include asm/arch/cpu.h

 -_TEXT_BASE:
 -   .word   CONFIG_SYS_TEXT_BASE
 -
 .globl lowlevel_init
  lowlevel_init:
 -
 -   /* use iRAM stack in bl2 */
 -   ldr sp, =CONFIG_IRAM_STACK
 -   stmdb   r13!, {ip,lr}
 -
 -   /* check reset status */
 -   ldr r0, =(EXYNOS5_POWER_BASE + INFORM1_OFFSET)
 -   ldr r1, [r0]
 -
 -   /* AFTR wakeup reset */
 -   ldr r2, =S5P_CHECK_DIDLE
 -   cmp r1, r2
 -   beq exit_wakeup
 -
 -   /* LPA wakeup reset */
 -   ldr r2, =S5P_CHECK_LPA
 -   cmp r1, r2
 -   beq exit_wakeup
 -
 -   /* Sleep wakeup reset */
 -   ldr r2, =S5P_CHECK_SLEEP
 -   cmp r1, r2
 -   beq wakeup_reset
 -
 /*
 -* If U-boot is already running in RAM, no need to relocate
 U-Boot.
 -* Memory controller must be configured before relocating U-Boot
 -* in ram.
 +* Set the stack pointer, although it will be overwriten by the
 caller
 +* It seems we will not boot if this function is empty.
  */
 -   ldr r0, =0x0ff  /* r0 - Mask Bits*/
 -   bic r1, pc, r0  /* pc - current addr of code

Re: [U-Boot] [PATCH 1/4] SMDK5250: Convert lowlevel_init.S to lowlevel_init_c.c

2013-01-01 Thread Kyungmin Park
On 1/2/13, Rajeshwari Birje rajeshwari.bi...@gmail.com wrote:
 Hi Kyungmin Park,

 On Wed, Jan 2, 2013 at 11:48 AM, Kyungmin Park kmp...@infradead.org
 wrote:
 Hi,

 On 1/2/13, Rajeshwari Birje rajeshwari.bi...@gmail.com wrote:
 Hi Kyungmin Park,

 Thank you for comments.

 On Mon, Dec 31, 2012 at 6:02 PM, Kyungmin Park kmp...@infradead.org
 wrote:
 On Fri, Dec 28, 2012 at 9:08 PM, Rajeshwari Shinde
 rajeshwar...@samsung.com wrote:
 This patch converts lowlevel_init.S to lowlevel_init_c.c for
 SMDK5250.

 Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com
 ---
  board/samsung/smdk5250/Makefile  |1 +
  board/samsung/smdk5250/dmc_common.c  |4 +-
  board/samsung/smdk5250/dmc_init_ddr3.c   |6 ++-
  board/samsung/smdk5250/lowlevel_init.S   |   69
 ++---
  board/samsung/smdk5250/lowlevel_init_c.c |   70
 ++
  board/samsung/smdk5250/setup.h   |   17 ++-
  board/samsung/smdk5250/spl_boot.c|   52
 ++
  spl/Makefile |4 ++
  8 files changed, 142 insertions(+), 81 deletions(-)
  create mode 100644 board/samsung/smdk5250/lowlevel_init_c.c

 diff --git a/board/samsung/smdk5250/Makefile
 b/board/samsung/smdk5250/Makefile
 index 47c6a5a..b99ac7f 100644
 --- a/board/samsung/smdk5250/Makefile
 +++ b/board/samsung/smdk5250/Makefile
 @@ -37,6 +37,7 @@ endif

  ifdef CONFIG_SPL_BUILD
  COBJS  += spl_boot.o
 +COBJS  += lowlevel_init_c.o
  endif

  SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 diff --git a/board/samsung/smdk5250/dmc_common.c
 b/board/samsung/smdk5250/dmc_common.c
 index 109602a..6a26822 100644
 --- a/board/samsung/smdk5250/dmc_common.c
 +++ b/board/samsung/smdk5250/dmc_common.c
 @@ -175,7 +175,7 @@ void dmc_config_memory(struct mem_timings *mem,
 struct exynos5_dmc *dmc)
 writel(DMC_MEMBASECONFIG1_VAL, dmc-membaseconfig1);
  }

 -void mem_ctrl_init()
 +void mem_ctrl_init(int mem_reset)
 does 'reset' is enough?
 - OK
  {
 struct spl_machine_param *param = spl_get_machine_params();
 struct mem_timings *mem;
 @@ -185,7 +185,7 @@ void mem_ctrl_init()

 /* If there are any other memory variant, add their init call
 below */
 if (param-mem_type == DDR_MODE_DDR3) {
 -   ret = ddr3_mem_ctrl_init(mem, param-mem_iv_size);
 +   ret = ddr3_mem_ctrl_init(mem, param-mem_iv_size,
 mem_reset);
 if (ret) {
 /* will hang if failed to init memory control
 */
 while (1)
 diff --git a/board/samsung/smdk5250/dmc_init_ddr3.c
 b/board/samsung/smdk5250/dmc_init_ddr3.c
 index e050790..4e0693d 100644
 --- a/board/samsung/smdk5250/dmc_init_ddr3.c
 +++ b/board/samsung/smdk5250/dmc_init_ddr3.c
 @@ -40,7 +40,8 @@ static void reset_phy_ctrl(void)
 writel(DDR3PHY_CTRL_PHY_RESET, clk-lpddr3phy_ctrl);
  }

 -int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long
 mem_iv_size)
 +int ddr3_mem_ctrl_init(struct mem_timings *mem, unsigned long
 mem_iv_size,
 +   int mem_reset)
 ditto
 -OK
  {
 unsigned int val;
 struct exynos5_phy_control *phy0_ctrl, *phy1_ctrl;
 @@ -51,7 +52,8 @@ int ddr3_mem_ctrl_init(struct mem_timings *mem,
 unsigned long mem_iv_size)
 phy1_ctrl = (struct exynos5_phy_control
 *)EXYNOS5_DMC_PHY1_BASE;
 dmc = (struct exynos5_dmc *)EXYNOS5_DMC_CTRL_BASE;

 -   reset_phy_ctrl();
 +   if (mem_reset)
 if (reset)
 +   reset_phy_ctrl();

 /* Set Impedance Output Driver */
 val = (mem-impedance  CA_CK_DRVR_DS_OFFSET) |
 diff --git a/board/samsung/smdk5250/lowlevel_init.S
 b/board/samsung/smdk5250/lowlevel_init.S
 index bc6cb6f..469126d 100644
 --- a/board/samsung/smdk5250/lowlevel_init.S
 +++ b/board/samsung/smdk5250/lowlevel_init.S
 @@ -23,74 +23,13 @@
   */

  #include config.h
 -#include version.h
  #include asm/arch/cpu.h

 -_TEXT_BASE:
 -   .word   CONFIG_SYS_TEXT_BASE
 -
 .globl lowlevel_init
  lowlevel_init:
 -
 -   /* use iRAM stack in bl2 */
 -   ldr sp, =CONFIG_IRAM_STACK
 -   stmdb   r13!, {ip,lr}
 -
 -   /* check reset status */
 -   ldr r0, =(EXYNOS5_POWER_BASE + INFORM1_OFFSET)
 -   ldr r1, [r0]
 -
 -   /* AFTR wakeup reset */
 -   ldr r2, =S5P_CHECK_DIDLE
 -   cmp r1, r2
 -   beq exit_wakeup
 -
 -   /* LPA wakeup reset */
 -   ldr r2, =S5P_CHECK_LPA
 -   cmp r1, r2
 -   beq exit_wakeup
 -
 -   /* Sleep wakeup reset */
 -   ldr r2, =S5P_CHECK_SLEEP
 -   cmp r1, r2
 -   beq wakeup_reset
 -
 /*
 -* If U-boot is already running in RAM, no need to relocate
 U-Boot.
 -* Memory controller must be configured before relocating
 U-Boot
 -* in ram.
 +* Set the stack pointer, although it will be overwriten by
 the
 caller
 +* It seems we will not boot if this function is empty

Re: [U-Boot] [PATCH] OneNAND: S5PC100 OneNAND IPL support

2009-07-23 Thread Kyungmin Park
On Fri, Jul 24, 2009 at 7:42 AM, Jean-Christophe
PLAGNIOL-VILLARDplagn...@jcrosoft.com wrote:
 On 09:55 Tue 21 Jul     , Kyungmin Park wrote:
 S5PC100 has own OneNAND controller and has different interface.
 OneNAND IPL use it to S5PC100 board.

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 is there any better than put soc specific code in generic implementatioN


I hope so. only s3c64xx series and s5pc100 use own OneNAND controller.
I also don't understand why need these controller. The OneNAND has its
own controller at chips already.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ubi attaching error (UBI error: ubi_read_volume_table)

2009-07-24 Thread Kyungmin Park
Hi,

I'm not sure you did proper operation.
In current configuration:
onenand:2...@256k(u-boot),256k(params),2m(kernel),16m(rootfs),32m(fs),-(ubifs)

you should select the ubi partition I think it's ubifs

So as followings

# onenand erase ${start of ubifs} ${size of ubifs} instead of 0x4 0x20
# ubi part ubifs

Thank you,
Kyungmin Park


On Thu, Jul 23, 2009 at 11:57 PM, naveen yadavyad.nav...@gmail.com wrote:
 Hi All,



 I am using flex-onenand for my u-boot. i have added the patch for
 flex-onenand and UBI and UBIFS published by kyungmin park.

 I have done following steps:

 1. first command
 # onenand erase 0x4 0x20

 2. second command
  # mtdparts default
 3. third commad
 # mtdparts
 4. forth command
 # ubi part u-boot
 (i got error
 UBI error: ubi_read_volume_table:
  the layout volume was not found
 attach_by_scanning-4
 UBI error: ubi_init: cannot attach mtd1
 UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
 UBI init error -22 )


 a) first command out put
 1. # mtdparts default

 ---mtdparts_init---
 last_ids  : onenand0=onenand
 env_ids   : onenand0=onenand
 last_parts: 
 mtdparts=onenand:2...@256k(u-boot),256k(params),2m(kernel),16m(rootfs)
 ,32m(fs),-(ubifs)
 env_parts : 
 mtdparts=onenand:2...@256k(u-boot),256k(params),2m(kernel),16m(rootfs)
 ,32m(fs),-(ubifs)

 last_partition : onenand0,0
 env_partition  : NULL
 no partition variable set, setting...
 --- current_save ---
 = partition onenand0,0
 --- index partitions ---

 --- mtd_part_info: partition number 0 for device onenand0 (onenand)
 = mtddevnum 0,
 = mtddevname u-boot

 2. second command output
 # mtdparts

 ---mtdparts_init---
 last_ids  : onenand0=onenand
 env_ids   : onenand0=onenand
 last_parts: 
 mtdparts=onenand:2...@256k(u-boot),256k(params),2m(kernel),16m(rootfs)
 ,32m(fs),-(ubifs)
 env_parts : 
 mtdparts=onenand:2...@256k(u-boot),256k(params),2m(kernel),16m(rootfs)
 ,32m(fs),-(ubifs)

 last_partition : onenand0,0
 env_partition  : onenand0,0

 ---list_partitions---

 device onenand0 onenand, # parts = 6
  #: name                size            offset          mask_flags
  0: u-boot              0x0020      0x0004      0
  1: params              0x0004      0x0024      0
  2: kernel              0x0020      0x0028      0
  3: rootfs              0x0100      0x0048      0
  4: fs                  0x0200      0x0148      0
  5: ubifs               0x3c48      0x0348      0

 --- mtd_part_info: partition number 0 for device onenand0 (onenand)

 active partition: onenand0,0 - (u-boot) 0x0020 @ 0x0004

 defaults:
 mtdids  : onenand0=onenand
 mtdparts: 
 mtdparts=onenand:2...@256k(u-boot),256k(params),2m(kernel),16m(rootfs),3
 2m(fs),-(ubifs)

 3. Third command output
 # ubi part u-boot

 ---mtdparts_init---
 last_ids  : onenand0=onenand
 env_ids   : onenand0=onenand
 last_parts: 
 mtdparts=onenand:2...@256k(u-boot),256k(params),2m(kernel),16m(rootfs)
 ,32m(fs),-(ubifs)
 env_parts : 
 mtdparts=onenand:2...@256k(u-boot),256k(params),2m(kernel),16m(rootfs)
 ,32m(fs),-(ubifs)

 last_partition : onenand0,0
 env_partition  : onenand0,0
 448 do_ubi -1454 do_ubi -2466 do_ubi -5--- find_dev_and_part ---
 id = u-boot
 --- find_dev_and_part ---
 id = u-boot
 Creating 1 MTD partitions on onenand0:
 0x%lx-0x%lx :  
 UBI: attaching mtd1 to ubi0 ubi_attach_mtd_dev
 UBI: min_io_size      2048
 UBI: hdrs_min_io_size 512
 UBI: ec_hdr_alsize    512
 UBI: vid_hdr_alsize   512
 UBI: vid_hdr_offset   512
 UBI: vid_hdr_aloffset 512
 UBI: vid_hdr_shift    0
 UBI: leb_start        2048
 UBI: physical eraseblock size:   131072 bytes (128 KiB)
 UBI: logical eraseblock size:    129024 bytes
 UBI: smallest flash I/O unit:    2048
 UBI: sub-page size:              512
 UBI: VID header offset:          512 (aligned 512)
 UBI: data offset:                2048
 UBI error: ubi_read_volume_table:
  the layout volume was not found
 attach_by_scanning-4
 UBI error: ubi_init: cannot attach mtd1
 UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
 UBI init error -22
 ___
 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] OneNAND: S5PC100 OneNAND IPL support

2009-07-27 Thread Kyungmin Park
On Tue, Jul 28, 2009 at 5:09 AM, Jean-Christophe
PLAGNIOL-VILLARDplagn...@jcrosoft.com wrote:
 On 14:28 Fri 24 Jul     , Kyungmin Park wrote:
 On Fri, Jul 24, 2009 at 7:42 AM, Jean-Christophe
 PLAGNIOL-VILLARDplagn...@jcrosoft.com wrote:
  On 09:55 Tue 21 Jul     , Kyungmin Park wrote:
  S5PC100 has own OneNAND controller and has different interface.
  OneNAND IPL use it to S5PC100 board.
 
  Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
  ---
  is there any better than put soc specific code in generic implementatioN
 

 I hope so. only s3c64xx series and s5pc100 use own OneNAND controller.
 I also don't understand why need these controller. The OneNAND has its
 own controller at chips already.
 I known
 so what do you propose?


just commit the patch I sent. It's difficult to remove the ifdef since
size limitation.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] OneNAND: S5PC100 OneNAND IPL support

2009-07-28 Thread Kyungmin Park
On Tue, Jul 28, 2009 at 10:42 PM, Jean-Christophe
PLAGNIOL-VILLARDplagn...@jcrosoft.com wrote:
 On 07:58 Tue 28 Jul     , Kyungmin Park wrote:
 On Tue, Jul 28, 2009 at 5:09 AM, Jean-Christophe
 PLAGNIOL-VILLARDplagn...@jcrosoft.com wrote:
  On 14:28 Fri 24 Jul     , Kyungmin Park wrote:
  On Fri, Jul 24, 2009 at 7:42 AM, Jean-Christophe
  PLAGNIOL-VILLARDplagn...@jcrosoft.com wrote:
   On 09:55 Tue 21 Jul     , Kyungmin Park wrote:
   S5PC100 has own OneNAND controller and has different interface.
   OneNAND IPL use it to S5PC100 board.
  
   Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
   ---
   is there any better than put soc specific code in generic implementatioN
  
 
  I hope so. only s3c64xx series and s5pc100 use own OneNAND controller.
  I also don't understand why need these controller. The OneNAND has its
  own controller at chips already.
  I known
  so what do you propose?
 

 just commit the patch I sent. It's difficult to remove the ifdef since
 size limitation.
 I understand your problem of size but is there any otherway to do ti without
 the onenand soc controler ?

No, no way we should use soc controller.


 I'll prefer we find a way to not put soc specific code in the generic code
 maybe we can crete a header which will be soc specific or a generic that we
 will include depending on the soc

something like weak alias?

The new problem is now I want to support S5PC100  S5PC110 Samsung SoC
simultaneously.
But these has different interface. c100 has CMD_MAP method, c110 has
similar generic but different.
At runtime it detects the cpu id and determine which read function is used.
At this case, s5pc100/c110 has no size limitation because of internal
ROM code. At boot it loads 16KiB and 8KiB data to internal RAM
respectively.

Okay I will try to make it generic and resend it after finishing the
port s5pc110 works

Thank you,
Kyungmin Park


 Best Regards,
 J.

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


Re: [U-Boot] [PATCH 6/6] S5PC100: Add onenand_ipl for SMDKC100 support

2009-07-31 Thread Kyungmin Park
hi

On Sat, Aug 1, 2009 at 7:19 AM, Scott Woodscottw...@freescale.com wrote:
 On Thu, Jun 25, 2009 at 05:21:45PM +0900, HeungJun Kim wrote:
 +#ifdef CONFIG_S5PC1XX
 +     unsigned int *p = (unsigned int *) buf;
 +     int mem_addr, i;
 +
 +     mem_addr = MEM_ADDR(block, page, 0);
 +
 +     pagesize = 2;
 +
 +     for (i = 0; i  pagesize; i++)
 +             *p++ = *(volatile unsigned int *)(CMD_MAP_01(mem_addr));
 +#else        /* CONFIG_S5PC1XX */
 +
       unsigned long *base;

  #ifndef __HAVE_ARCH_MEMCPY32
 @@ -85,6 +99,7 @@ static inline int onenand_read_page(ulong block, ulong 
 page,
               *p++ = value;
       }
  #endif
 +#endif       /* CONFIG_S5PC1XX */

It should be S5PC100, not used at S5PC110. it uses generic interface
with DMA support.

 Please put each controller implementation in a separate file, with an
 appropriate name.  Do not make anything which is SoC-specific look
 generic.

No problem,
One question, how to use use generic  s5pc100 read function simultaneously.
Since our test board use two cpu, s5pc100  s5pc110. but each cpu has
different read function.
I want to use it both with only one u-boot image. In this case we have
to distinguish and use it properly.
Now I add the function pointer and assign it based on cpu id.


 If onenand_read_block() is not controller-specific (looks like everything
 except the read of ONENAND_REG_TECHNOLOGY is generic), move it to
 onenand_boot.c.

 @@ -114,6 +129,9 @@ int onenand_read_block(unsigned char *buf)

       erasesize = ONENAND_PAGES_PER_BLOCK * pagesize;
       nblocks = (CONFIG_SYS_MONITOR_LEN + erasesize - 1)  erase_shift;
 +#ifdef CONFIG_S5PC1XX
 +     nblocks = 1;
 +#endif

 Why?


It's developer's mistake, no reason to use 1 block. actually internal
ROM read 16KiB data to internal RAM in case of s5pc100.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support

2009-08-28 Thread Kyungmin Park
Some CPU has internal OneNAND controller and use it for access OneNAND

To support these CPU, we provide the onenand_board_init
Also we can override the onenand_read_page.

Some minor fixed:
- Remove unnecessary header file
- Fix wrong access at read interrupt
- The recent OneNAND has 4KiB pagesize

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/onenand_ipl/onenand_boot.c b/onenand_ipl/onenand_boot.c
index 63995ce..22baebb 100644
--- a/onenand_ipl/onenand_boot.c
+++ b/onenand_ipl/onenand_boot.c
@@ -24,7 +24,6 @@
  */
 
 #include common.h
-#include version.h
 
 #include onenand_ipl.h
 
diff --git a/onenand_ipl/onenand_ipl.h b/onenand_ipl/onenand_ipl.h
index 412572a..2257063 100644
--- a/onenand_ipl/onenand_ipl.h
+++ b/onenand_ipl/onenand_ipl.h
@@ -29,7 +29,14 @@
 #define THIS_ONENAND(a) (CONFIG_SYS_ONENAND_BASE + (a))
 
 #define READ_INTERRUPT()\
-   onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
+   onenand_readw(ONENAND_REG_INTERRUPT)
 
+enum {
+   ONENAND_USE_DEFAULT,
+   ONENAND_USE_GENERIC,
+};
+
+extern int (*onenand_read_page)(ulong block, ulong page,
+   u_char *buf, int pagesize);
 extern int onenand_read_block(unsigned char *buf);
 #endif
diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index d1a842d..7fc0c62 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2005-2008 Samsung Electronis
+ * (C) Copyright 2005-2009 Samsung Electronics
  * Kyungmin Park kyungmin.p...@samsung.com
  *
  * See file CREDITS for list of people who contributed to this
@@ -37,8 +37,11 @@
 extern void *memcpy32(void *dest, void *src, int size);
 #endif
 
+int (*onenand_read_page)(ulong block, ulong page,
+   u_char *buf, int pagesize);
+
 /* read a page with ECC */
-static inline int onenand_read_page(ulong block, ulong page,
+static int generic_onenand_read_page(ulong block, ulong page,
u_char * buf, int pagesize)
 {
unsigned long *base;
@@ -89,9 +92,29 @@ static inline int onenand_read_page(ulong block, ulong page,
return 0;
 }
 
-#define ONENAND_START_PAGE 1
+#ifndef CONFIG_ONENAND_START_PAGE
+#define CONFIG_ONENAND_START_PAGE  1
+#endif
 #define ONENAND_PAGES_PER_BLOCK64
 
+#ifndef CONFIG_ONENAND_BOARD_INIT
+static int onenand_generic_init(int *page_is_4KiB, int *page)
+{
+   int dev_id, density;
+
+   if (onenand_readw(ONENAND_REG_TECHNOLOGY))
+   *page_is_4KiB = 1;
+   dev_id = onenand_readw(ONENAND_REG_DEVICE_ID);
+   density = dev_id  ONENAND_DEVICE_DENSITY_SHIFT;
+   density = ONENAND_DEVICE_DENSITY_MASK;
+   if (density = ONENAND_DEVICE_DENSITY_4Gb 
+   !(dev_id  ONENAND_DEVICE_IS_DDP))
+   *page_is_4KiB = 1;
+
+   return ONENAND_USE_DEFAULT;
+}
+#endif
+
 /**
  * onenand_read_block - Read CONFIG_SYS_MONITOR_LEN from begining
  *  of OneNAND, skipping bad blocks
@@ -99,24 +122,31 @@ static inline int onenand_read_page(ulong block, ulong 
page,
  */
 int onenand_read_block(unsigned char *buf)
 {
-   int block;
-   int page = ONENAND_START_PAGE, offset = 0;
-   int pagesize = 0, erase_shift = 0;
-   int erasesize = 0, nblocks = 0;
+   int block, nblocks;
+   int page = CONFIG_ONENAND_START_PAGE, offset = 0;
+   int pagesize, erasesize, erase_shift;
+   int page_is_4KiB = 0, ret;
+
+   pagesize = 2048; /* OneNAND has 2KiB pagesize */
+   erase_shift = 17;
+   onenand_read_page = generic_onenand_read_page;
+
+#ifdef CONFIG_ONENAND_BOARD_INIT
+   onenand_board_init(page_is_4KiB, page);
+#else
+   onenand_generic_init(page_is_4KiB, page);
+#endif
 
-   if (onenand_readw(ONENAND_REG_TECHNOLOGY)) {
-   pagesize = 4096; /* MLC OneNAND has 4KiB pagesize */
+   if (page_is_4KiB) {
+   pagesize = 4096; /* OneNAND has 4KiB pagesize */
erase_shift = 18;
-   } else {
-   pagesize = 2048;
-   erase_shift = 17;
}
 
-   erasesize = ONENAND_PAGES_PER_BLOCK * pagesize;
+   erasesize = (1  erase_shift);
nblocks = (CONFIG_SYS_MONITOR_LEN + erasesize - 1)  erase_shift;
 
/* NOTE: you must read page from page 1 of block 0 */
-   /* read the block page by page*/
+   /* read the block page by page */
for (block = 0; block  nblocks; block++) {
for (; page  ONENAND_PAGES_PER_BLOCK; page++) {
if (onenand_read_page(block, page, buf + offset,
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [OneNAND] Board can override OneNAND IPL image

2009-09-02 Thread Kyungmin Park
Some board use more then 2KiB OneNAND IPL.
E.G., S5PC100 loads 16KiB OneNAND IPL

diff --git a/Makefile b/Makefile
index c9727f8..1af42ce 100644
--- a/Makefile
+++ b/Makefile
@@ -285,6 +285,7 @@ endif
 ifeq ($(CONFIG_ONENAND_U_BOOT),y)
 ONENAND_IPL = onenand_ipl
 U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
+ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
 endif
 
 __OBJS := $(subst $(obj),,$(OBJS))
@@ -374,8 +375,7 @@ $(ONENAND_IPL): $(TIMESTAMP_FILE) $(VERSION_FILE) 
$(obj)include/autoconf.mk
$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
 
 $(U_BOOT_ONENAND): $(ONENAND_IPL) $(obj)u-boot.bin
-   cat $(obj)onenand_ipl/onenand-ipl-2k.bin $(obj)u-boot.bin  
$(obj)u-boot-onenand.bin
-   cat $(obj)onenand_ipl/onenand-ipl-4k.bin $(obj)u-boot.bin  
$(obj)u-boot-flexonenand.bin
+   cat $(ONENAND_BIN) $(obj)u-boot.bin  $(obj)u-boot-onenand.bin
 
 $(VERSION_FILE):
@( printf '#define U_BOOT_VERSION U-Boot %s%s\n' 
$(U_BOOT_VERSION) \
@@ -3229,8 +3229,6 @@ zylonite_config :
 #
 
 apollon_config : unconfig
-   @mkdir -p $(obj)include
-   @mkdir -p $(obj)onenand_ipl/board/apollon
@echo #define CONFIG_ONENAND_U_BOOT  $(obj)include/config.h
@$(MKCONFIG) $(@:_config=) arm arm1136 apollon NULL omap24xx
@echo CONFIG_ONENAND_U_BOOT = y  $(obj)include/config.mk
@@ -3716,7 +3714,8 @@ clean:
   $(obj)cpu/blackfin/bootrom-asm-offsets.[chs]
@rm -f $(obj)include/bmp_logo.h
@rm -f $(obj)nand_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,System.map}
-   @rm -f 
$(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl-2k.bin,ipl-4k.bin,ipl.map}
+   @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
+   @rm -f $(ONENAND_BIN)
@rm -f $(obj)onenand_ipl/u-boot.lds
@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
@find $(OBJTREE) -type f \
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm_cortexa8: support cache flush to other soc

2009-09-04 Thread Kyungmin Park
Hi,

As he goes to home, I reply it instead.

On Fri, Sep 4, 2009 at 5:43 PM, Dirk Behmedirk.be...@googlemail.com wrote:
 Dear Minkyu Kang,

 Minkyu Kang wrote:
 Current code is supported only omap3 soc.
 this patch will support s5pc1xx(s5pc100 and s5pc110) soc also.

 Thanks for this patch!

 How is this patch related to

 http://lists.denx.de/pipermail/u-boot/2009-August/058492.html


It's not good idea to move invalidate_cache to omap directory. we need it.


 Signed-off-by: Minkyu Kang mk7.k...@samsung.com
 ---
  cpu/arm_cortexa8/cpu.c |   24 +++-
  1 files changed, 11 insertions(+), 13 deletions(-)

 diff --git a/cpu/arm_cortexa8/cpu.c b/cpu/arm_cortexa8/cpu.c
 index 5a5981e..3d430b1 100644
 --- a/cpu/arm_cortexa8/cpu.c
 +++ b/cpu/arm_cortexa8/cpu.c
 @@ -35,9 +35,6 @@
  #include command.h
  #include asm/system.h
  #include asm/cache.h
 -#ifndef CONFIG_L2_OFF
 -#include asm/arch/sys_proto.h
 -#endif

  static void cache_flush(void);

 @@ -61,17 +58,18 @@ int cleanup_before_linux(void)
       cache_flush();

  #ifndef CONFIG_L2_OFF
 -     /* turn off L2 cache */
 -     l2_cache_disable();
 -     /* invalidate L2 cache also */
 -     v7_flush_dcache_all(get_device_type());
 -#endif
 -     i = 0;
 -     /* mem barrier to sync up things */
 -     asm(mcr p15, 0, %0, c7, c10, 4: :r(i));
 +     if (get_device_type() != 0xC100) {

 Hmm, what is this 0xC100 ?

Now we got two cpu, s5pc100 and s5pc110. In case of s5pc100 we don't
need to turn off l2 cache. but s5pc110 needs it.
So first check the device type, actually cpu type. then determine turn
off l2 cache or not.


 +             /* turn off L2 cache */
 +             l2_cache_disable();
 +             /* invalidate L2 cache also */
 +             v7_flush_dcache_all(get_device_type());

 -#ifndef CONFIG_L2_OFF
 -     l2_cache_enable();
 +             i = 0;
 +             /* mem barrier to sync up things */
 +             asm(mcr p15, 0, %0, c7, c10, 4: :r(i));
 +
 +             l2_cache_enable();
 +     }
  #endif

 What's about the order of #ifndef CONFIG_L2_OFF?

 While we had before


 #ifndef CONFIG_L2_OFF
        /* turn off L2 cache */
        l2_cache_disable();
        /* invalidate L2 cache also */
        v7_flush_dcache_all(get_device_type());
 #endif
        i = 0;
        /* mem barrier to sync up things */
        asm(mcr p15, 0, %0, c7, c10, 4: :r(i));

 #ifndef CONFIG_L2_OFF
        l2_cache_enable();
 #endif


 after this patch we would have


 #ifndef CONFIG_L2_OFF
        if (get_device_type() != 0xC100) {
                /* turn off L2 cache */
                l2_cache_disable();
                /* invalidate L2 cache also */
                v7_flush_dcache_all(get_device_type());
                i = 0;
                /* mem barrier to sync up things */
                asm(mcr p15, 0, %0, c7, c10, 4: :r(i));

                l2_cache_enable();
        }
 #endif

 Is this intended?

maybe not. now we only tested the smdkc100 but actual use is internal
board for s5pc100  s5pc110.
He will be modify it.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm_cortexa8: support cache flush to other soc

2009-09-04 Thread Kyungmin Park
On Fri, Sep 4, 2009 at 7:45 PM, Dirk Behmedirk.be...@googlemail.com wrote:
 Kyungmin Park wrote:

 Hi,

 As he goes to home, I reply it instead.

 Nice weekend then :)

 On Fri, Sep 4, 2009 at 5:43 PM, Dirk Behmedirk.be...@googlemail.com
 wrote:

 Dear Minkyu Kang,

 Minkyu Kang wrote:

 Current code is supported only omap3 soc.
 this patch will support s5pc1xx(s5pc100 and s5pc110) soc also.

 Thanks for this patch!

 How is this patch related to

 http://lists.denx.de/pipermail/u-boot/2009-August/058492.html


 It's not good idea to move invalidate_cache to omap directory. we need it.

 Well, yes and no ;)

 Most probably you (== Samsung) can't use the invalidate_dcache version we
 move in above patch to omap directory, because the version we move above is
 OMAP3 specific (it has calls to OMAP3 ROM code). So no, it's a good idea to
 move OMAP3 specific code to omap directory.

 But yes, you might need DCache flush (*). So the idea of above patch was to
 have your own (or generic) implementation, but let OMAP3 use the custom one
 where needed.

 (*) Do you really need DCache flush? It always was Jean-Christophe's
 argument that U-Boot doesn't use any DCache at all.

Yes, We really want it. At first development time, we don't know why
the kernel is boot. almost same as s5pc100 but s5pc110 required cache
flush.


 Signed-off-by: Minkyu Kang mk7.k...@samsung.com
 ---
  cpu/arm_cortexa8/cpu.c |   24 +++-
  1 files changed, 11 insertions(+), 13 deletions(-)

 diff --git a/cpu/arm_cortexa8/cpu.c b/cpu/arm_cortexa8/cpu.c
 index 5a5981e..3d430b1 100644
 --- a/cpu/arm_cortexa8/cpu.c
 +++ b/cpu/arm_cortexa8/cpu.c
 @@ -35,9 +35,6 @@
  #include command.h
  #include asm/system.h
  #include asm/cache.h
 -#ifndef CONFIG_L2_OFF
 -#include asm/arch/sys_proto.h
 -#endif

  static void cache_flush(void);

 @@ -61,17 +58,18 @@ int cleanup_before_linux(void)
      cache_flush();

  #ifndef CONFIG_L2_OFF
 -     /* turn off L2 cache */
 -     l2_cache_disable();
 -     /* invalidate L2 cache also */
 -     v7_flush_dcache_all(get_device_type());
 -#endif
 -     i = 0;
 -     /* mem barrier to sync up things */
 -     asm(mcr p15, 0, %0, c7, c10, 4: :r(i));
 +     if (get_device_type() != 0xC100) {

 Hmm, what is this 0xC100 ?

 Now we got two cpu, s5pc100 and s5pc110. In case of s5pc100 we don't
 need to turn off l2 cache. but s5pc110 needs it.
 So first check the device type, actually cpu type. then determine turn
 off l2 cache or not.

 0xC100 is the device type of s5pc100 then? So it should be

 if (get_device_type() != S5PC100_DEVICE)

 ? I hear some people crying please use macro ;)

Agreed. DONT_NEED_CACHE_FLUSH?


 But I don't like this selection here. When we get additional similar SoCs,
 we will end with something like

 if (get_device_type() != 0xC100) ||
  (get_device_type() != FOO) ||
  (get_device_type() != BAR))  ||
  ... {

 modifying each time cpu/arm_cortexa8/cpu.c.

 I would like more that we are able to compile the functionality based on the
 config file we use for compilation. E.g. provide emtpy l2_cache_disable();
 function for SoCs that don't need it, but have functionality behind it where
 needed.

 With above patch, this would then become something like

 cpu/arm_cortexa8/s5pcxxx/dcache.S

 - Implements invalidate_dcache() (or implement a Cortex A8 generic one in
 cpu/arm_cortexa8/cache.S)

 cpu/arm_cortexa8/s5pcxxx/cache_110.S

 - Implements l2_cache_enable()/disable()

 cpu/arm_cortexa8/s5pcxxx/cache_100.S

 - Implements *empty* l2_cache_enable()/disable()

 In cpu/arm_cortexa8/s5pcxxx/Makefile you then could have

 SOBJS-y += dcache.o
 SOBJS-$(CONFIG_S5PC100) += cache_100.o
 SOBJS-$(CONFIG_S5PC110) += cache_110.o

 What do you think about this?


Basically agreed, of course we can think weak attribute but now we
have to support both cpu simultaneously.
with this reason. we check the device_type at here.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] s5pc1xx: support onenand driver

2009-09-04 Thread Kyungmin Park
Hi,

On Fri, Sep 4, 2009 at 7:44 PM, Wolfgang Denkw...@denx.de wrote:
 Dear Minkyu Kang,

 In message 4aa0ce3f.60...@samsung.com you wrote:
 This patch includes the onenand driver for s5pc1xx

 Signed-off-by: Minkyu Kang mk7.k...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ...
 +static int s3c_read_reg(int offset)
 +{
 +     return readl(onenand-base + offset);
 +}
 +
 +static void s3c_write_reg(int value, int offset)
 +{
 +     writel(value, onenand-base + offset);
 +}
 +
 +static int s3c_read_cmd(unsigned int cmd)
 +{
 +     return readl(onenand-ahb_addr + cmd);
 +}
 +
 +static void s3c_write_cmd(int value, unsigned int cmd)
 +{
 +     writel(value, onenand-ahb_addr + cmd);
 +}

 PLease see comments to previous patch about usage of register plus
 offset versus using proper C structures.

I have different opinion. How much register map is required? I mean in
case of read/write cmd, it has about 256MiB range. then how do you
cast is as C structures.
Only some small range for example. 1K or less. C structures possible.
but more than this. it's too huge to case it.


 Please change this code to use structs, too.

 +static unsigned int s5pc100_mem_addr(int fba, int fpa, int fsa)
 +{
 +     return (fba  13) | (fpa  7) | (fsa  5);
 +}

 This function needs explanation. Please add a comment what it does,
 and how.

It's mandatory. no need to shift. It's fixed. with this reason. we
covers alomst 256MiB memory range.


 ...
 +static int s3c_onenand_bbt_wait(struct mtd_info *mtd, int state)
 +{
 +     unsigned int flags = INT_ACT | LOAD_CMP;
 +     unsigned int stat;
 +     unsigned long timeout = 0x1;
 +
 +     while (1  timeout--) {

 Please do not add bogus code. Remove the 1 

Agreed.


 ...
 +void s3c_onenand_init(struct mtd_info *mtd)
 +{
 +     struct onenand_chip *this = mtd-priv;
 +
 +     onenand = malloc(sizeof(struct s3c_onenand));
 +     if (!onenand)
 +             return;
 +
 +     onenand-page_buf = malloc(SZ_4K * sizeof(char));
 +     if (!onenand-page_buf)
 +             return;
 +     memset(onenand-page_buf, 0xFF, SZ_4K);
 +
 +     onenand-oob_buf = malloc(128 * sizeof(char));
 +     if (!onenand-oob_buf)
 +             return;
 +     memset(onenand-oob_buf, 0xFF, 128);
 +
 +     onenand-mtd = mtd;
 +
 +#ifdef CONFIG_S5PC1XX
 +     /* S5PC100 specific values */
 +     onenand-base = (void *) 0xE710;
 +     onenand-ahb_addr = (void *) 0xB000;
 +     onenand-mem_addr = s5pc100_mem_addr;
 +#else
 +#error Please fix it at s3c6410
 +#endif

 What does this mean?

Now we got two version of samsung.c one for s3c6410, another is this
one. No problem to add it for s3c6410


 diff --git a/include/samsung_onenand.h b/include/samsung_onenand.h
 new file mode 100644
 index 000..91b40e1
 --- /dev/null
 +++ b/include/samsung_onenand.h
 ...
 +/*
 + * OneNAND Controller
 + */
 +#define MEM_CFG_OFFSET               0x
 +#define BURST_LEN_OFFSET     0x0010
 +#define MEM_RESET_OFFSET     0x0020
 +#define INT_ERR_STAT_OFFSET  0x0030
 +#define INT_ERR_MASK_OFFSET  0x0040
 +#define INT_ERR_ACK_OFFSET   0x0050

 Please use a C struct instead.

The end address is 0x400. Are you really need it to cast? I don't think so.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] RFC: split ARM repo and distribute workload

2009-09-06 Thread Kyungmin Park
On Sat, Sep 5, 2009 at 6:57 AM, Wolfgang Denkw...@denx.de wrote:
 Hello everybody,

 ARM has always been one of the architectures that generated a big
 number of different processors and SoCs, but recently the activitiy in
 this area is literally exploding.  This is partially due to the fact
 that ARM is currently used in many designs, so many new ARM based
 processors and SoCs and even more new ARM boards show up, but another
 and at least as important change is that some silicon and board
 vendors have started to actively pushing their products into the
 U-Boot (and Linux) mainline source trees (and *welcome* they all
 are!).

 It has become evident that this growing complexity has become way too
 massive to be shouldered by a single custodian, even a very active one
 like Jean-Christophe.

 I think we have no other choice but to add more manpower to this task,
 i. e. split the ARM respository and distribute the workload across a
 few more custodians.

 Unline with the Power architecture, where the split can be easily
 defined by processor lines, with ARM it seems more logical to me to
 differentiate by silicon vendors.

 After much thinking I therefor suggest to implement the following
 change for the ARM architecture:


 master ARM repository:          Tom Rix

 Atmel (AT91):                   Jean-Christophe Plagniol-Villard

 Freescale (i.MX)                Magnus Lilja?
                                Or are there any volunteers at Freescale?

 Marvell (PXA + IXP):            Jean-Christophe Plagniol-Villard

 Marvell (all other):            Prafulla Wadaskar

 Samsung (s3c, s5pc):            Are there any volunteers at Samsung?


I recommended the Minky Kang. He's working for several years for
u-boot from pxa, omap3, s3c6410 and s5pc1xx series.

But with our internal security policy it's hard to use ssh on u-boot
git. so we want to use u-boot-arm as base.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Flashing images bigger than ram

2009-09-15 Thread Kyungmin Park
Hi,

On Wed, Sep 16, 2009 at 6:39 AM, Ben Goska gos...@onid.oregonstate.edu wrote:
 Is there a standard way to have U-Boot flash really large images? I
 want to setup rootfs flashing from U-Boot but this requires flashing
 an image that is bigger than the ram of my system. I thought about
 breaking the image into chunks, but when flashing to NAND with bad
 blocks it is difficult to handle skipping the bad blocks.

 I know I could make this happen with a custom command added to U-Boot
 but I was wondering if someone else had solved the problem already.

 My hardware: OMAP3530, 128MB Ram, 256MB NAND.
 Trying to flash from MMC (fat, or ext2) to NAND.


Please see the common/cmd_onenand.c

First it got the 32MiB data from USB or others. and then write it's
data to OneNAND.
Of course if it meets the bad blocks, just skip it and write again. I
called it skip write method.
Next time it adjust the start offset. of course upper layer don't know
it. Upper layer assume it write it exactly it sent.

In read side it's similar.
If it encounters the bad block. it also skip and read again. (skip read).

With this method. we can program flash even though we can't enough memory.

you can see the code. it's better to understand.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [OneNAND] Board can override OneNAND IPL image

2009-09-18 Thread Kyungmin Park
On Sat, Sep 19, 2009 at 4:37 AM, Scott Wood scottw...@freescale.com wrote:
 On Wed, Sep 02, 2009 at 06:05:03PM +0900, Kyungmin Park wrote:
 Some board use more then 2KiB OneNAND IPL.
 E.G., S5PC100 loads 16KiB OneNAND IPL

 Why do we need a different image name based on how large the loader is?


Actually, S5PC100 has no problem to use 1KiB IPL. Internal boot ROM
code read first 16KiB at OneNAND.
We it's enough to use 1KiB.
However, S5PC110 is different. It checks the 16KIB checksum located at
latest 16KiB - 4 bytes.

In compatible issue, we conclude that use 16KiB for both cpus.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support

2009-09-18 Thread Kyungmin Park
On Sat, Sep 19, 2009 at 4:26 AM, Scott Wood scottw...@freescale.com wrote:
 On Sat, Aug 29, 2009 at 01:00:59PM +0900, Kyungmin Park wrote:
  #define READ_INTERRUPT()                                                \
 -     onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
 +                             onenand_readw(ONENAND_REG_INTERRUPT)

 You could get rid of the newline now...

It exceeds the 80 columns.


 +enum {
 +     ONENAND_USE_DEFAULT,
 +     ONENAND_USE_GENERIC,
 +};

 What is this?  Add a comment, and possibly more specific names.

I see redefine the specific names and comments.


 +extern int (*onenand_read_page)(ulong block, ulong page,
 +                             u_char *buf, int pagesize);

 Maybe use a weak function instead?  Or an #ifdef
 CONFIG_SYS_ONENAND_BOARD_READ_PAGE that will keep the code for the
 generic version from being in the image (it'd be nice if we could
 optimize out replaced weak functions).  It seems especially odd that you
 use one method for init and another for read page.

I tried to use weak function but it produces more than expected. as
you know it got size limitation.
When use the weak function. the apollon board will be broken.
and I don't want to use #ifdef. since Now we support two different
CPUs, s5pc100, s5pc110. these accesses different way. s5pc100 use own
OneNAND controller. but s5pc110 use generic OneNAND method.
That's reason to define the function pointer.


  /* read a page with ECC */
 -static inline int onenand_read_page(ulong block, ulong page,
 +static int generic_onenand_read_page(ulong block, ulong page,
                               u_char * buf, int pagesize)

 Is the generic code really generic, or is it just one specific
 controller?

The 'generic' means the original OneNAND access method. Use NOR
interface and use OneNAND registers.
Most and Most generic method.

Only Samsung SoCs, s3c64xx series, and s5pc100 uses their own OneNAND
controller.


 +#ifdef CONFIG_ONENAND_BOARD_INIT

 This should probably be CONFIG_SYS_ONENAND_BOARD_INIT -- it's not
 tweakable by the end user.

 How is this different from the existing CONFIG_USE_ONENAND_BOARD_INIT?

Okay l try to consider how to use same configurations.


 +     onenand_board_init(page_is_4KiB, page);
 +#else
 +     onenand_generic_init(page_is_4KiB, page);
 +#endif

 -     if (onenand_readw(ONENAND_REG_TECHNOLOGY)) {
 -             pagesize = 4096; /* MLC OneNAND has 4KiB pagesize */
 +     if (page_is_4KiB) {
 +             pagesize = 4096; /* OneNAND has 4KiB pagesize */
               erase_shift = 18;
 -     } else {
 -             pagesize = 2048;
 -             erase_shift = 17;
       }

 I don't understand why you move the pagesize/erase_shift init before
 onenand_board_init, suggesting that the init code change it if it needs
 changing -- but then leave the page_is_4KiB stuff in the generic code.

 This should probably just be filled in by the init code without anything
 here.

No different. basically I assume OneNAND has 2KiB pagesize and
In special case, MLC, and 4KiB pagesize OneNAND set the 4KiB pagesize.

If you want to leave as before. no problem.

Please consider the code size and don't want to break exsiting board support.
That's reason I can't use weak function and use #ifdef at onenand_board_init.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support

2009-09-21 Thread Kyungmin Park
On Tue, Sep 22, 2009 at 1:15 AM, Scott Wood scottw...@freescale.com wrote:
 On Sat, Sep 19, 2009 at 10:32:30AM +0900, Kyungmin Park wrote:
 On Sat, Sep 19, 2009 at 4:26 AM, Scott Wood scottw...@freescale.com wrote:
  On Sat, Aug 29, 2009 at 01:00:59PM +0900, Kyungmin Park wrote:
   #define READ_INTERRUPT()                                                \
  -     onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
  +                             onenand_readw(ONENAND_REG_INTERRUPT)
 
  You could get rid of the newline now...

 It exceeds the 80 columns.

 No it doesn't, anymore.  You'll note that the start of onenand_readw() in to
 the right of the end of READ_INTERRUPT, so you're not saving any horizontal
 space with the newline.

Right, change it.


  +enum {
  +     ONENAND_USE_DEFAULT,
  +     ONENAND_USE_GENERIC,
  +};
 
  What is this?  Add a comment, and possibly more specific names.

 I see redefine the specific names and comments.

At this time no need to it. remove it.


 
  +extern int (*onenand_read_page)(ulong block, ulong page,
  +                             u_char *buf, int pagesize);
 
  Maybe use a weak function instead?  Or an #ifdef
  CONFIG_SYS_ONENAND_BOARD_READ_PAGE that will keep the code for the
  generic version from being in the image (it'd be nice if we could
  optimize out replaced weak functions).  It seems especially odd that you
  use one method for init and another for read page.

 I tried to use weak function but it produces more than expected.

 More than compiling both functions and choosing with a function pointer?

Weak function itself. when using the weak function. it create more
than function pointer.


 as you know it got size limitation. When use the weak function. the
 apollon board will be broken.

 Broken how?  Size?

Yes, I'm under pressure of size limitation.


 and I don't want to use #ifdef. since Now we support two different CPUs,
 s5pc100, s5pc110. these accesses different way. s5pc100 use own OneNAND
 controller. but s5pc110 use generic OneNAND method. That's reason to
 define the function pointer.

 Function pointers make sense if you want to override on a per-device basis
 (i.e. multiple controller types in the same system) or dynamically
 (different hardware handled by the same binary).  Are you trying to generate
 one image that works on both s5pc100 and s5pc110?  That sounds pretty
 luxurious for a space-constrained NAND bootstrap. :-)

Now I used the two different CPUs. s5pc100 and s5pc110. also these
cpus have different interface. Own controller and generic,
respectively. Of course Now it supports both at one image.
That's reason to introduce the onenand_board_init at onenand IPL.
Right. it's some luxurious but need to maintain several boards. It requires it.


   /* read a page with ECC */
  -static inline int onenand_read_page(ulong block, ulong page,
  +static int generic_onenand_read_page(ulong block, ulong page,
                                u_char * buf, int pagesize)
 
  Is the generic code really generic, or is it just one specific
  controller?

 The 'generic' means the original OneNAND access method. Use NOR
 interface and use OneNAND registers.
 Most and Most generic method.

 OK, good; it was never clear to me just which hardware the existing onenand
 code has been targeting; I had gotten the impression that it was for one of
 the chips with a custom controller.

 Better, though, would be to still have good separation between that
 implementation and the infrastructure that is truly generic even when you
 have a special controller.  This is something I don't like about the current
 NAND code.

  +     onenand_board_init(page_is_4KiB, page);
  +#else
  +     onenand_generic_init(page_is_4KiB, page);
  +#endif
 
  -     if (onenand_readw(ONENAND_REG_TECHNOLOGY)) {
  -             pagesize = 4096; /* MLC OneNAND has 4KiB pagesize */
  +     if (page_is_4KiB) {
  +             pagesize = 4096; /* OneNAND has 4KiB pagesize */
                erase_shift = 18;
  -     } else {
  -             pagesize = 2048;
  -             erase_shift = 17;
        }
 
  I don't understand why you move the pagesize/erase_shift init before
  onenand_board_init, suggesting that the init code change it if it needs
  changing -- but then leave the page_is_4KiB stuff in the generic code.
 
  This should probably just be filled in by the init code without anything
  here.

 No different. basically I assume OneNAND has 2KiB pagesize and
 In special case, MLC, and 4KiB pagesize OneNAND set the 4KiB pagesize.

 If you want to leave as before. no problem.

 Please consider the code size

 It seems to me that just having the replaceable init function fill in the
 page size would be smaller than having non-replaceable code that passes a
 pointer in and then decides on the basis what was written there.

 and don't want to break exsiting board support.

 I don't see how this additional bit of refactoring would put other boards at
 higher risk of breaking that what

[U-Boot] [PATCH] [OneNAND IPL] Refactor OneNAND IPL code

2009-09-21 Thread Kyungmin Park
Refactoring the OneNAND IPL code

and some minor fixed:
- Remove unnecessary header file
- Fix wrong access at read interrupt
- The recent OneNAND has 4KiB pagesize

Also Board can override OneNAND IPL image

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com

diff --git a/Makefile b/Makefile
index 0b61d05..961c007 100644
--- a/Makefile
+++ b/Makefile
@@ -285,6 +285,7 @@ endif
 ifeq ($(CONFIG_ONENAND_U_BOOT),y)
 ONENAND_IPL = onenand_ipl
 U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
+ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
 endif
 
 __OBJS := $(subst $(obj),,$(OBJS))
@@ -378,8 +379,7 @@ $(ONENAND_IPL): $(TIMESTAMP_FILE) $(VERSION_FILE) 
$(obj)include/autoconf.mk
$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
 
 $(U_BOOT_ONENAND): $(ONENAND_IPL) $(obj)u-boot.bin
-   cat $(obj)onenand_ipl/onenand-ipl-2k.bin $(obj)u-boot.bin  
$(obj)u-boot-onenand.bin
-   cat $(obj)onenand_ipl/onenand-ipl-4k.bin $(obj)u-boot.bin  
$(obj)u-boot-flexonenand.bin
+   cat $(ONENAND_BIN) $(obj)u-boot.bin  $(obj)u-boot-onenand.bin
 
 $(VERSION_FILE):
@( printf '#define U_BOOT_VERSION U-Boot %s%s\n' 
$(U_BOOT_VERSION) \
@@ -3259,8 +3259,6 @@ zylonite_config :
 #
 
 apollon_config : unconfig
-   @mkdir -p $(obj)include
-   @mkdir -p $(obj)onenand_ipl/board/apollon
@echo #define CONFIG_ONENAND_U_BOOT  $(obj)include/config.h
@$(MKCONFIG) $(@:_config=) arm arm1136 apollon NULL omap24xx
@echo CONFIG_ONENAND_U_BOOT = y  $(obj)include/config.mk
@@ -3742,7 +3740,8 @@ clean:
   $(obj)cpu/blackfin/bootrom-asm-offsets.[chs]
@rm -f $(obj)include/bmp_logo.h
@rm -f $(obj)nand_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,System.map}
-   @rm -f 
$(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl-2k.bin,ipl-4k.bin,ipl.map}
+   @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
+   @rm -f $(ONENAND_BIN)
@rm -f $(obj)onenand_ipl/u-boot.lds
@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
@find $(OBJTREE) -type f \
diff --git a/onenand_ipl/onenand_boot.c b/onenand_ipl/onenand_boot.c
index 63995ce..22baebb 100644
--- a/onenand_ipl/onenand_boot.c
+++ b/onenand_ipl/onenand_boot.c
@@ -24,7 +24,6 @@
  */
 
 #include common.h
-#include version.h
 
 #include onenand_ipl.h
 
diff --git a/onenand_ipl/onenand_ipl.h b/onenand_ipl/onenand_ipl.h
index 412572a..7ebb3e3 100644
--- a/onenand_ipl/onenand_ipl.h
+++ b/onenand_ipl/onenand_ipl.h
@@ -28,8 +28,9 @@
 
 #define THIS_ONENAND(a) (CONFIG_SYS_ONENAND_BASE + (a))
 
-#define READ_INTERRUPT()\
-   onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
+#define READ_INTERRUPT()   onenand_readw(ONENAND_REG_INTERRUPT)
 
+extern int (*onenand_read_page)(ulong block, ulong page,
+   u_char *buf, int pagesize);
 extern int onenand_read_block(unsigned char *buf);
 #endif
diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index d1a842d..8d0df81 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2005-2008 Samsung Electronis
+ * (C) Copyright 2005-2009 Samsung Electronics
  * Kyungmin Park kyungmin.p...@samsung.com
  *
  * See file CREDITS for list of people who contributed to this
@@ -37,8 +37,10 @@
 extern void *memcpy32(void *dest, void *src, int size);
 #endif
 
+int (*onenand_read_page)(ulong block, ulong page, u_char *buf, int pagesize);
+
 /* read a page with ECC */
-static inline int onenand_read_page(ulong block, ulong page,
+static int generic_onenand_read_page(ulong block, ulong page,
u_char * buf, int pagesize)
 {
unsigned long *base;
@@ -89,9 +91,25 @@ static inline int onenand_read_page(ulong block, ulong page,
return 0;
 }
 
-#define ONENAND_START_PAGE 1
+#ifndef CONFIG_ONENAND_START_PAGE
+#define CONFIG_ONENAND_START_PAGE  1
+#endif
 #define ONENAND_PAGES_PER_BLOCK64
 
+static void onenand_generic_init(int *page_is_4KiB, int *page)
+{
+   int dev_id, density;
+
+   if (onenand_readw(ONENAND_REG_TECHNOLOGY))
+   *page_is_4KiB = 1;
+   dev_id = onenand_readw(ONENAND_REG_DEVICE_ID);
+   density = dev_id  ONENAND_DEVICE_DENSITY_SHIFT;
+   density = ONENAND_DEVICE_DENSITY_MASK;
+   if (density = ONENAND_DEVICE_DENSITY_4Gb 
+   !(dev_id  ONENAND_DEVICE_IS_DDP))
+   *page_is_4KiB = 1;
+}
+
 /**
  * onenand_read_block - Read CONFIG_SYS_MONITOR_LEN from begining
  *  of OneNAND, skipping bad blocks
@@ -99,24 +117,28 @@ static inline int onenand_read_page(ulong block, ulong 
page,
  */
 int onenand_read_block(unsigned char *buf)
 {
-   int block;
-   int page = ONENAND_START_PAGE, offset = 0;
-   int pagesize = 0, erase_shift = 0;
-   int

[U-Boot] How to use the NEON instruction at u-boot?

2010-11-10 Thread Kyungmin Park
Hi,

Now I'm trying to use the NEON instruction at u-boot. but it's failed
and got the data abort.
Are there any way to use the NEON instruction at u-boot?

The main purpose is to use the neon memcpy as below.

bge 1f
// copies 4 bytes, destination 32-bits aligned
vld4.8  {d0[0], d1[0], d2[0], d3[0]}, [r1]!
vst4.8  {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
1:  bcc 2f

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] How to use the NEON instruction at u-boot?

2010-11-11 Thread Kyungmin Park
2010/11/11 Måns Rullgård m...@mansr.com:
 Kyungmin Park kmp...@infradead.org writes:

 Hi,

 Now I'm trying to use the NEON instruction at u-boot. but it's failed
 and got the data abort.
 Are there any way to use the NEON instruction at u-boot?

 No, just like you can't use floating-point.

I don't use the floating-point just use the 64 or 128 registers for memcpy.

 The main purpose is to use the neon memcpy as below.

         bge         1f
         // copies 4 bytes, destination 32-bits aligned
         vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
         vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
 1:      bcc         2f

 Plain LDR/STR will be just as fast as that.

I saw you patches and the result using neon is better than ARM optimized memcpy.
Now I used the ARM optimized memcpy. and try to find a better solution as NEON.

Thank you,
Kyungmin Park

 --
 Måns Rullgård
 m...@mansr.com

 ___
 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] How to use the NEON instruction at u-boot?

2010-11-11 Thread Kyungmin Park
On Thu, Nov 11, 2010 at 5:58 PM, V, Aneesh ane...@ti.com wrote:
 Hi Kyungmin Park,

 -Original Message-
 From: u-boot-boun...@lists.denx.de [mailto:u-boot-
 boun...@lists.denx.de] On Behalf Of Kyungmin Park
 Sent: Thursday, November 11, 2010 11:05 AM
 To: u-boot@lists.denx.de
 Cc: Minkyu Kang
 Subject: [U-Boot] How to use the NEON instruction at u-boot?

 Hi,

 Now I'm trying to use the NEON instruction at u-boot. but it's
 failed
 and got the data abort.
 Are there any way to use the NEON instruction at u-boot?

 The main purpose is to use the neon memcpy as below.

         bge         1f
         // copies 4 bytes, destination 32-bits aligned
         vld4.8      {d0[0], d1[0], d2[0], d3[0]}, [r1]!
         vst4.8      {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
 1:      bcc         2f


 I am not sure if there is a valid use-case for this. But if you
 are keen on using Neon you will have to enable the co-processor first.
 Here is a piece of code I wrote for doing this in another bootloader.

 #define VMSR_FPSCR_r0 dcd 0xeee80a10
 #define VMRS_r0_FPSCR dcd 0xeef80a10
 __asm uint32 enable_neon(void)
 {
    ldr r0, =0x00F0
    MCR p15,0,r0,c1,c0,2 // CP15 Coprocessor Access Control Register
    ldr r0, =0x4000
    VMSR_FPSCR_r0
    VMRS_r0_FPSCR
    bx r14
 }

Thanks
NEON instruction is working but need to debug to use it correctly.

I used it as below.
ldr r0, =0x00F0
mcr p15, 0, r0, c1, c0, 2
ldr r0, =0x4000
.word   0xeee80a10
.word   0xeef80a10

Thank you,
Kyungmin Park


 This is written for RVCT tool chain. So you may have to convert it
 for GCC. Also, my assembler didn't allow ARMv7 instructions. So, I
 used DCD. You can either use .word in gcc or use the real instructions
 if your assembler understands those instructions.

 Thank you,
 Kyungmin Park
 ___
 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] apollon: Fix a OBJCFLAGS typo

2009-06-10 Thread Kyungmin Park
Acked-by: Kyungmin Park kyungmin.p...@samsung.com

 -Original Message-
 From: Shinya Kuribayashi [mailto:skuri...@ruby.dti.ne.jp]
 Sent: Sunday, June 07, 2009 9:45 PM
 To: kyungmin.p...@samsung.com
 Cc: u-boot@lists.denx.de
 Subject: apollon: Fix a OBJCFLAGS typo
 
 Signed-off-by: Shinya Kuribayashi skuri...@pobox.com
 ---
 Hi,
 
 I happened to find this typo with the help of vim highlight.
 
  onenand_ipl/board/apollon/Makefile |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/onenand_ipl/board/apollon/Makefile
 b/onenand_ipl/board/apollon/Makefile
 index 1f996a4..f6c36ec 100644
 --- a/onenand_ipl/board/apollon/Makefile
 +++ b/onenand_ipl/board/apollon/Makefile
 @@ -6,7 +6,7 @@ LDSCRIPT= $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/u-
 boot.onenand.lds
  LDFLAGS  = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE)
 $(PLATFORM_LDFLAGS)
  AFLAGS   += -DCONFIG_ONENAND_IPL
  CFLAGS   += -DCONFIG_ONENAND_IPL
 -OBJCLFAGS += --gap-fill=0x00
 +OBJCFLAGS += --gap-fill=0x00
 
  SOBJS:= low_levelinit.o
  SOBJS+= start.o

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


Re: [U-Boot] [PATCH 5/6] S5PC100: MTD: change env_address type

2009-06-25 Thread Kyungmin Park
On Thu, Jun 25, 2009 at 5:18 PM, HeungJun Kimriverful@gmail.com wrote:
 This patch changed the type from unsigned long to loff_t in the
 common/env_onenand.c.

 The address type is changed from unsigned long to loff_t,
 but common/env_onenand.c is not yet. So, this patch is needed
 to get the accurate value of env_addr.

 Signed-off-by: HeungJun, Kim riverful@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/6] S5PC100: onenand driver for SMDKC100 support

2009-06-27 Thread Kyungmin Park
Hi,

On Sat, Jun 27, 2009 at 2:54 AM, Scott Woodscottw...@freescale.com wrote:
 On Thu, Jun 25, 2009 at 05:10:37PM +0900, HeungJun Kim wrote:
 This patch includes the onenand driver for SMDKC100 Board.

 Signed-off-by: HeungJun, Kim riverful@samsung.com

 ---

  drivers/mtd/onenand/Makefile      |    8 +-
  drivers/mtd/onenand/s5p_onenand.c | 2034 
 +
  include/linux/mtd/onenand_regs.h  |    5 +
  include/linux/mtd/s5p_onenand.h   |  425 

 Please try to refactor the existing onenand code to support controller
 variations, rather than duplicating parts of it.

 Or if you can find absolutely no common ground (but I hope you can), at
 least change the names so they don't conflict.  Are you planning on
 supporting this in Linux?  What is it going to look like there?

 Kyungmin, any thoughts?  Why do we have a specific controller
 implementation in something generically named onenand_base.c?  Or is
 this different because of a different type of onenand chip?

Right, I wrote the OneNAND drivers for s3c64xx/s5pc100 but now only
interface part are release at mtd  arm list.

The current status of this patch only *working* version. So I NAKed
this patch. next time Mr Kim will post the new OneNAND drivers

Thank you,
Kyungmin Park


 I don't understand OneNAND very well (and google doesn't turn up much but
 marketing), which makes including it under the same custodianship as NAND
 somewhat awkward. :-(

 diff --git a/drivers/mtd/onenand/Makefile b/drivers/mtd/onenand/Makefile
 index 1d35a57..aad1362 100644
 --- a/drivers/mtd/onenand/Makefile
 +++ b/drivers/mtd/onenand/Makefile
 @@ -25,7 +25,13 @@ include $(TOPDIR)/config.mk

  LIB  := $(obj)libonenand.a

 -COBJS-$(CONFIG_CMD_ONENAND)  := onenand_uboot.o onenand_base.o onenand_bbt.o
 +COBJS-$(CONFIG_CMD_ONENAND)  := onenand_uboot.o
 +
 +ifdef CONFIG_S5PC1XX
 +COBJS-$(CONFIG_CMD_ONENAND)  += s5p_onenand.o
 +else
 +COBJS-$(CONFIG_CMD_ONENAND)  += onenand_base.o onenand_bbt.o
 +endif

 Why no bbt?

This driver checks the bad block at runtime at every access. :)


 +/**
 + * onenand_read_burst
 + *
 + * 16 Burst read: performance is improved up to 40%.
 + */
 +static void onenand_read_burst(void *dest, const void *src, size_t len)
 +{
 +     int count;
 +
 +     if (len % 16 != 0)
 +             return;
 +
 +     count = len / 16;
 +
 +     __asm__ __volatile__(
 +                    stmdb   r13!, {r0-r3,r9-r12}\n
 +                    mov     r2, %0\n
 +             1:\n
 +                    ldmia   r1, {r9-r12}\n
 +                    stmia   r0!, {r9-r12}\n
 +                    subs    r2, r2, #0x1\n
 +                    bne     1b\n
 +                    ldmia   r13!, {r0-r3,r9-r12}\n::r (count));
 +}

 What is this doing that we couldn't generically make memcpy do?

Even though It looks some strange. it has some performance gain. but
not general.


 -Scott
 ___
 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


[U-Boot] [PATCH] MTD: OneNAND: Increase the environment size to 4KiB

2009-07-11 Thread Kyungmin Park
Also use mtd operatoin instead of onenand functions

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/common/env_onenand.c b/common/env_onenand.c
index 48089a9..476fdbc 100644
--- a/common/env_onenand.c
+++ b/common/env_onenand.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2005-2007 Samsung Electronics
+ * (C) Copyright 2005-2009 Samsung Electronics
  * Kyungmin Park kyungmin.p...@samsung.com
  *
  * See file CREDITS for list of people who contributed to this
@@ -37,15 +37,16 @@ extern struct onenand_chip onenand_chip;
 /* References to names in env_common.c */
 extern uchar default_environment[];
 
-#define ONENAND_ENV_SIZE(mtd)  (mtd.writesize - ENV_HEADER_SIZE)
-
 char *env_name_spec = OneNAND;
 
+#define ONENAND_MAX_ENV_SIZE   4096
+#define ONENAND_ENV_SIZE(mtd)  (ONENAND_MAX_ENV_SIZE - ENV_HEADER_SIZE)
+
 #ifdef ENV_IS_EMBEDDED
 extern uchar environment[];
 env_t *env_ptr = (env_t *) (environment[0]);
 #else /* ! ENV_IS_EMBEDDED */
-static unsigned char onenand_env[MAX_ONENAND_PAGESIZE];
+static unsigned char onenand_env[ONENAND_MAX_ENV_SIZE];
 env_t *env_ptr = (env_t *) onenand_env;
 #endif /* ENV_IS_EMBEDDED */
 
@@ -58,6 +59,7 @@ uchar env_get_char_spec(int index)
 
 void env_relocate_spec(void)
 {
+   struct mtd_info *mtd = onenand_mtd;
loff_t env_addr;
int use_default = 0;
size_t retlen;
@@ -65,22 +67,21 @@ void env_relocate_spec(void)
env_addr = CONFIG_ENV_ADDR;
 
/* Check OneNAND exist */
-   if (onenand_mtd.writesize)
+   if (mtd-writesize)
/* Ignore read fail */
-   onenand_read(onenand_mtd, env_addr, onenand_mtd.writesize,
+   mtd-read(mtd, env_addr, ONENAND_MAX_ENV_SIZE,
 retlen, (u_char *) env_ptr);
else
-   onenand_mtd.writesize = MAX_ONENAND_PAGESIZE;
+   mtd-writesize = MAX_ONENAND_PAGESIZE;
 
-   if (crc32(0, env_ptr-data, ONENAND_ENV_SIZE(onenand_mtd)) !=
-   env_ptr-crc)
+   if (crc32(0, env_ptr-data, ONENAND_ENV_SIZE(mtd)) != env_ptr-crc)
use_default = 1;
 
if (use_default) {
memcpy(env_ptr-data, default_environment,
-  ONENAND_ENV_SIZE(onenand_mtd));
+  ONENAND_ENV_SIZE(mtd));
env_ptr-crc =
-   crc32(0, env_ptr-data, ONENAND_ENV_SIZE(onenand_mtd));
+   crc32(0, env_ptr-data, ONENAND_ENV_SIZE(mtd));
}
 
gd-env_addr = (ulong)  env_ptr-data;
@@ -89,7 +90,8 @@ void env_relocate_spec(void)
 
 int saveenv(void)
 {
-   unsigned long env_addr = CONFIG_ENV_ADDR;
+   struct mtd_info *mtd = onenand_mtd;
+   loff_t env_addr = CONFIG_ENV_ADDR;
struct erase_info instr = {
.callback   = NULL,
};
@@ -97,17 +99,16 @@ int saveenv(void)
 
instr.len = CONFIG_ENV_SIZE;
instr.addr = env_addr;
-   instr.mtd = onenand_mtd;
-   if (onenand_erase(onenand_mtd, instr)) {
+   instr.mtd = mtd;
+   if (mtd-erase(mtd, instr)) {
printf(OneNAND: erase failed at 0x%08lx\n, env_addr);
return 1;
}
 
/* update crc */
-   env_ptr-crc =
-   crc32(0, env_ptr-data, ONENAND_ENV_SIZE(onenand_mtd));
+   env_ptr-crc = crc32(0, env_ptr-data, ONENAND_ENV_SIZE(mtd));
 
-   if (onenand_write(onenand_mtd, env_addr, onenand_mtd.writesize, 
retlen,
+   if (mtd-write(mtd, env_addr, ONENAND_MAX_ENV_SIZE, retlen,
 (u_char *) env_ptr)) {
printf(OneNAND: write failed at 0x%llx\n, instr.addr);
return 2;
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] OneNAND IPL: Move u-boot-onenand linker script to common use

2009-07-11 Thread Kyungmin Park
Use the common OneNAND linker script.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/onenand_ipl/board/apollon/u-boot.onenand.lds 
b/onenand_ipl/u-boot-onenand.lds
similarity index 100%
rename from onenand_ipl/board/apollon/u-boot.onenand.lds
rename to onenand_ipl/u-boot-onenand.lds
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Apollon board use common OneNAND IPL linker

2009-07-11 Thread Kyungmin Park
Use common OneNAND IPL linker script.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/onenand_ipl/board/apollon/Makefile 
b/onenand_ipl/board/apollon/Makefile
index 49a8e90..f0744f6 100644
--- a/onenand_ipl/board/apollon/Makefile
+++ b/onenand_ipl/board/apollon/Makefile
@@ -2,7 +2,7 @@
 include $(TOPDIR)/config.mk
 include $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/config.mk
 
-LDSCRIPT= $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/u-boot.onenand.lds
+LDSCRIPT= $(TOPDIR)/onenand_ipl/u-boot-onenand.lds
 LDFLAGS= -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) 
$(PLATFORM_LDFLAGS)
 AFLAGS += -DCONFIG_PRELOADER -DCONFIG_ONENAND_IPL
 CFLAGS += -DCONFIG_PRELOADER -DCONFIG_ONENAND_IPL
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] OneNAND IPL: Move u-boot-onenand linker script to common use

2009-07-12 Thread Kyungmin Park
Hi,

On Sun, Jul 12, 2009 at 9:58 PM, Jean-Christophe
PLAGNIOL-VILLARDplagn...@jcrosoft.com wrote:
 On 17:10 Sat 11 Jul     , Kyungmin Park wrote:
 Use the common OneNAND linker script.

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 diff --git a/onenand_ipl/board/apollon/u-boot.onenand.lds 
 b/onenand_ipl/u-boot-onenand.lds
 similarity index 100%
 rename from onenand_ipl/board/apollon/u-boot.onenand.lds
 rename to onenand_ipl/u-boot-onenand.lds
 this is arch specific
 please move it to lib_arm/

Basically I agree your opinion, however do see the other arch OneNAND
usage? I mean I can't see the other arch patches.

I think until other arch uses it, I want to place it at onenand_ipl directory.
How do you think?

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [OneNAND] Fix compiler warnings after loff_t change

2009-07-19 Thread Kyungmin Park
Now 'env_addr' type is loff_t so use correct field type.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/common/env_onenand.c b/common/env_onenand.c
index 476fdbc..dcf09de 100644
--- a/common/env_onenand.c
+++ b/common/env_onenand.c
@@ -101,7 +101,7 @@ int saveenv(void)
instr.addr = env_addr;
instr.mtd = mtd;
if (mtd-erase(mtd, instr)) {
-   printf(OneNAND: erase failed at 0x%08lx\n, env_addr);
+   printf(OneNAND: erase failed at 0x%08llx\n, env_addr);
return 1;
}
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] env_onenand compiler warning

2009-07-19 Thread Kyungmin Park
Hi,

Thank you for pointing compiler warning.

I post the patch.

Thank you,
Kyungmin Park

On Sun, Jul 19, 2009 at 3:47 PM, Dirk Behmedirk.be...@googlemail.com wrote:

 Testing recent mainline git head for omap3_evm_config I get compiler
 warning

 env_onenand.c: In function 'saveenv':
 env_onenand.c:104: warning: format '%08lx' expects type 'long unsigned
 int', but argument 2 has type 'loff_t'

 Is there already a fix available?

 Thanks

 Dirk
 ___
 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] ARM Cortex A8: Move OMAP3 specific reset handler

2009-07-19 Thread Kyungmin Park
Hi,

It's already discussed. Actually it's required for adding new S5PC1xx
series based on arm cortext8.
Please apply it.

Thank you,
Kyungmin Park

On Mon, Jul 20, 2009 at 11:40 AM, Minkyu Kangmk7.k...@samsung.com wrote:
 Because of the reset_cpu is soc specific, should be move to soc

 Cc: Dirk Behme dirk.be...@googlemail.com
 Signed-off-by: Minkyu Kang mk7.k...@samsung.com
 ---
  cpu/arm_cortexa8/omap3/Makefile |    1 +
  cpu/arm_cortexa8/omap3/reset.S  |   36 
  cpu/arm_cortexa8/start.S        |   14 --
  3 files changed, 37 insertions(+), 14 deletions(-)
  create mode 100644 cpu/arm_cortexa8/omap3/reset.S

 diff --git a/cpu/arm_cortexa8/omap3/Makefile b/cpu/arm_cortexa8/omap3/Makefile
 index 1fbd0dc..eef165c 100644
 --- a/cpu/arm_cortexa8/omap3/Makefile
 +++ b/cpu/arm_cortexa8/omap3/Makefile
 @@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
  LIB    =  $(obj)lib$(SOC).a

  SOBJS  := lowlevel_init.o
 +SOBJS  += reset.o

  COBJS  += board.o
  COBJS  += cache.o
 diff --git a/cpu/arm_cortexa8/omap3/reset.S b/cpu/arm_cortexa8/omap3/reset.S
 new file mode 100644
 index 000..a53c408
 --- /dev/null
 +++ b/cpu/arm_cortexa8/omap3/reset.S
 @@ -0,0 +1,36 @@
 +/*
 + * Copyright (c) 2009 Samsung Electronics.
 + * Minkyu Kang mk7.k...@samsung.com
 + *
 + * See file CREDITS for list of people who contributed to this
 + * project.
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 + * MA 02111-1307 USA
 + */
 +
 +#include config.h
 +
 +.global reset_cpu
 +reset_cpu:
 +       ldr     r1, rstctl                      @ get addr for global reset
 +                                               @ reg
 +       mov     r3, #0x2                        @ full reset pll + mpu
 +       str     r3, [r1]                        @ force reset
 +       mov     r0, r0
 +_loop_forever:
 +       b       _loop_forever
 +rstctl:
 +       .word   PRM_RSTCTRL
 diff --git a/cpu/arm_cortexa8/start.S b/cpu/arm_cortexa8/start.S
 index 66b4820..6bd6552 100644
 --- a/cpu/arm_cortexa8/start.S
 +++ b/cpu/arm_cortexa8/start.S
 @@ -500,17 +500,3 @@ finished_inval:
                                                @ but we compile with armv5

        ldmfd   r13!, {r0 - r5, r7, r9 - r12, pc}
 -
 -
 -       .align  5
 -.global reset_cpu
 -reset_cpu:
 -       ldr     r1, rstctl                      @ get addr for global reset
 -                                               @ reg
 -       mov     r3, #0x2                        @ full reset pll + mpu
 -       str     r3, [r1]                        @ force reset
 -       mov     r0, r0
 -_loop_forever:
 -       b       _loop_forever
 -rstctl:
 -       .word   PRM_RSTCTRL
 --
 1.5.4.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 6/6] S5PC100: Add onenand_ipl for SMDKC100 support

2009-07-19 Thread Kyungmin Park
Hi,

On Mon, Jul 20, 2009 at 5:04 AM, Wolfgang Denkw...@denx.de wrote:
 Dear HeungJun Kim,

 In message 350d1ec30906250121q4e860812s35054aaee8c20...@mail.gmail.com you 
 wrote:
 The SMDKC100 Board has 256MB onenand.
 So, It's bootable, if this patch is adapted thus the board use onenand_ipl.

 Signed-off-by: HeungJun, Kim riverful@samsung.com

 ---

 This patch support onenand boot on SMDKC100 Board.
 ...
 diff --git a/onenand_ipl/board/samsung/smdkc100/Makefile
 b/onenand_ipl/board/samsung/smdkc100/Makefile
 new file mode 100644
 index 000..4301938
 --- /dev/null
 +++ b/onenand_ipl/board/samsung/smdkc100/Makefile
 ...
 +ALL  = $(onenandobj)onenand-ipl $(onenandobj)onenand-ipl.bin
 $(onenandobj)onenand-ipl-2k.bin $(onenandobj)onenand-ipl-4k.bin

 This patch is white-space corrupted. I gues this happened here because
 the line was way too long.

 --- a/onenand_ipl/onenand_read.c
 +++ b/onenand_ipl/onenand_read.c
 @@ -37,10 +37,24 @@
  extern void *memcpy32(void *dest, void *src, int size);
  #endif

 +
 +

 Please do not arbitrary empty lines.

  /* read a page with ECC */
  static inline int onenand_read_page(ulong block, ulong page,
                               u_char * buf, int pagesize)
  {
 +#ifdef CONFIG_S5PC1XX
 +     unsigned int *p = (unsigned int *) buf;
 +     int mem_addr, i;
 +
 +     mem_addr = MEM_ADDR(block, page, 0);
 +
 +     pagesize = 2;
 +
 +     for (i = 0; i  pagesize; i++)
 +             *p++ = *(volatile unsigned int *)(CMD_MAP_01(mem_addr));
 +#else        /* CONFIG_S5PC1XX */
 +
       unsigned long *base;

 I don't like to see such board specific code in global files.

I think it's not board specific code. S3C64XX and S5PC1XX series have
own OneNAND controller and to access the OneNAND, it should use the
this controller.

If you don't like the ifdef. we can separate the function but I'm not
sure it's really required.


 Also, please use I/O accessor functions instead of register accesses.

readl(...)? If yes, I agree it.

 @@ -114,6 +129,9 @@ int onenand_read_block(unsigned char *buf)

       erasesize = ONENAND_PAGES_PER_BLOCK * pagesize;
       nblocks = (CONFIG_SYS_MONITOR_LEN + erasesize - 1)  erase_shift;
 +#ifdef CONFIG_S5PC1XX
 +     nblocks = 1;
 +#endif

 Again: why do we need such board specific code here?


It should be fixed.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] OneNAND IPL: Move u-boot-onenand linker script to common use

2009-07-20 Thread Kyungmin Park
Hi,

On Sun, Jul 12, 2009 at 9:58 PM, Jean-Christophe
PLAGNIOL-VILLARDplagn...@jcrosoft.com wrote:
 On 17:10 Sat 11 Jul     , Kyungmin Park wrote:
 Use the common OneNAND linker script.

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 diff --git a/onenand_ipl/board/apollon/u-boot.onenand.lds 
 b/onenand_ipl/u-boot-onenand.lds
 similarity index 100%
 rename from onenand_ipl/board/apollon/u-boot.onenand.lds
 rename to onenand_ipl/u-boot-onenand.lds
 this is arch specific
 please move it to lib_arm/


 I want to make a conclusion. Don't you change your mind? Please give
your opinion.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] OneNAND: S5PC100 OneNAND IPL support

2009-07-20 Thread Kyungmin Park
S5PC100 has own OneNAND controller and has different interface.
OneNAND IPL use it to S5PC100 board.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/onenand_ipl/onenand_ipl.h b/onenand_ipl/onenand_ipl.h
index 412572a..b43ddfb 100644
--- a/onenand_ipl/onenand_ipl.h
+++ b/onenand_ipl/onenand_ipl.h
@@ -31,5 +31,14 @@
 #define READ_INTERRUPT()\
onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
 
+#ifdef CONFIG_S5PC1XX
+#define AHB_ADDR   0xB000
+#define MEM_ADDR(fba, fpa, fsa)((fba)  13 | (fpa)  7 | 
(fsa)  5)
+#define CMD_MAP_01(mem_addr)   (AHB_ADDR | (1  26) | (mem_addr))
+#define CMD_MAP_11(addr)   (AHB_ADDR | (3  26) | ((addr)  2))
+#undef onenand_readw
+#define onenand_readw(a)   (readl(CMD_MAP_11((a)  1))  0x)
+#endif
+
 extern int onenand_read_block(unsigned char *buf);
 #endif
diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index d1a842d..7ffc9a9 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -37,6 +37,23 @@
 extern void *memcpy32(void *dest, void *src, int size);
 #endif
 
+#ifdef CONFIG_S5PC1XX
+static inline int onenand_read_page(ulong block, ulong page,
+   u_char * buf, int pagesize)
+{
+   unsigned int *p = (unsigned int *) buf;
+   int mem_addr, i;
+
+   mem_addr = MEM_ADDR(block, page, 0);
+
+   pagesize = 2;
+
+   for (i = 0; i  pagesize; i++)
+   *p++ = readl(CMD_MAP_01(mem_addr));
+
+   return 0;
+}
+#else
 /* read a page with ECC */
 static inline int onenand_read_page(ulong block, ulong page,
u_char * buf, int pagesize)
@@ -88,6 +105,7 @@ static inline int onenand_read_page(ulong block, ulong page,
 
return 0;
 }
+#endif
 
 #define ONENAND_START_PAGE 1
 #define ONENAND_PAGES_PER_BLOCK64
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] S5PC100: Add onenand_ipl for SMDKC100 support

2009-07-20 Thread Kyungmin Park
On Tue, Jul 21, 2009 at 6:18 AM, Wolfgang Denkw...@denx.de wrote:
 Dear Kyungmin Park,

 In message 9c9fda240907192016i32c7312dh490629f2f2bb3...@mail.gmail.com you 
 wrote:

   /* read a page with ECC */
   static inline int onenand_read_page(ulong block, ulong page,
                                u_char * buf , int pagesize)
   {
  +#ifdef CONFIG_S5PC1XX
  +     unsigned int *p = (unsigned int *) buf;
  +     int mem_addr, i;
  +
  +     mem_addr = MEM_ADDR(block, page, 0);
  +
  +     pagesize = 2;
  +
  +     for (i = 0; i  pagesize; i++)
  +             *p++ = *(volatile unsigned int *)(CMD_MAP_01 (mem_addr));
  +#else        /* CONFIG_S5PC1XX */
  +
        unsigned long *base;
 
  I don't like to see such board specific code in global files.

 I think it's not board specific code. S3C64XX and S5PC1XX series have
 own OneNAND controller and to access the OneNAND, it should use the
 this controller.

 OK, so it is SoC specific code in a common file - that's just
 marginally better.

 If you don't like the ifdef. we can separate the function but I'm not
 sure it's really required.

 It would be great if we can get rid of the #ifdef.

As you know, OneNAND IPL has size limitation, 1KiB. So it's difficult
to co-exist two different function.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] OneNAND: Remove unused read_spareram

2009-07-20 Thread Kyungmin Park
Remove unused read_spareram and add unlock_all as kernel does

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/drivers/mtd/onenand/onenand_base.c 
b/drivers/mtd/onenand/onenand_base.c
index d482437..368fa6e 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1010,7 +1010,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t 
from,
if (ret)
break;
 
-   this-read_spareram(mtd, 0, ONENAND_SPARERAM, buf, column, 
thislen);
+   this-read_bufferram(mtd, 0, ONENAND_SPARERAM, buf, column, 
thislen);
read += thislen;
if (read == len)
break;
@@ -2104,8 +2104,6 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
 
if (!this-read_bufferram)
this-read_bufferram = onenand_read_bufferram;
-   if (!this-read_spareram)
-   this-read_spareram = onenand_read_bufferram;
if (!this-write_bufferram)
this-write_bufferram = onenand_write_bufferram;
 
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 2597e34..06f7baf 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -83,10 +83,9 @@ struct onenand_chip {
size_t len);
int (*wait) (struct mtd_info *mtd, int state);
int (*bbt_wait) (struct mtd_info *mtd, int state);
+   void (*unlock_all)(struct mtd_info *mtd);
int (*read_bufferram) (struct mtd_info *mtd, loff_t addr, int area,
   unsigned char *buffer, int offset, size_t count);
-   int (*read_spareram) (struct mtd_info *mtd, loff_t addr, int area,
-  unsigned char *buffer, int offset, size_t count);
int (*write_bufferram) (struct mtd_info *mtd, loff_t addr, int area,
const unsigned char *buffer, int offset,
size_t count);
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] OneNAND: Runtime badblock support

2009-07-21 Thread Kyungmin Park
At bootloader, we don't need to read full page. It takes too long time.
Instead it only read pages required for boot.
Of course, this patch reduces the boot time

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/drivers/mtd/onenand/onenand_bbt.c 
b/drivers/mtd/onenand/onenand_bbt.c
index c4bdb57..8bc9e8a 100644
--- a/drivers/mtd/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
@@ -48,6 +48,43 @@ static int check_short_pattern(uint8_t * buf, int len, int 
paglen,
return 0;
 }
 
+static int read_page_oob(struct mtd_info *mtd, loff_t from, u_char *buf)
+{
+   struct onenand_chip *this = mtd-priv;
+   struct bbm_info *bbm = this-bbm;
+   struct nand_bbt_descr *bd = bbm-badblock_pattern;
+   struct mtd_oob_ops ops;
+   int ret, scanlen, block, j, res;
+
+   scanlen = 0;
+
+   ops.mode = MTD_OOB_PLACE;
+   ops.ooblen = 16;
+   ops.oobbuf = buf;
+   ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0;
+
+   /* Get block number * 2 */
+   block = (int)(from  (bbm-bbt_erase_shift - 1));
+
+   /* Set as normal block */
+   res = 0x00;
+   bbm-bbt[block  3] |= 0x00  (block  0x6);
+
+   for (j = 0; j  2; j++) {
+   ret = onenand_bbt_read_oob(mtd, from + j * mtd-writesize + 
bd-offs, ops);
+   if (ret || check_short_pattern(buf[j * scanlen], scanlen, 
mtd-writesize, bd)) {
+   bbm-bbt[block  3] |= 0x03  (block  0x6);
+   res = 0x03;
+   printk(KERN_WARNING Bad eraseblock %d at 0x%08x\n,
+   block  1, (unsigned int) from);
+   mtd-ecc_stats.badblocks++;
+   break;
+   }
+   }
+
+   return ret;
+}
+
 /**
  * create_bbt - [GENERIC] Create a bad block table by scanning the device
  * @param mtd  MTD device structure
@@ -155,6 +192,11 @@ static int onenand_isbad_bbt(struct mtd_info *mtd, loff_t 
offs, int allowbbt)
block = (int)(offs  (bbm-bbt_erase_shift - 1));
res = (bbm-bbt[block  3]  (block  0x06))  0x03;
 
+   if (this-options  ONENAND_RUNTIME_BADBLOCK_CHECK) {
+   if (res == 0x02)
+   res = read_page_oob(mtd, offs, this-oob_buf);
+   }
+
MTDDEBUG (MTD_DEBUG_LEVEL2,
onenand_isbad_bbt: bbt info for offs 0x%08x: (block %d) 
0x%02x\n,
(unsigned int)offs, block  1, res);
@@ -210,6 +252,12 @@ int onenand_scan_bbt(struct mtd_info *mtd, struct 
nand_bbt_descr *bd)
if (!bbm-isbad_bbt)
bbm-isbad_bbt = onenand_isbad_bbt;
 
+   if (this-options  ONENAND_RUNTIME_BADBLOCK_CHECK) {
+   printk(KERN_INFO Scanning device for bad blocks (skipped)\n);
+   memset(bbm-bbt, 0xaa, len);
+   return 0;
+   }
+
/* Scan the device to build a memory based bad block table */
if ((ret = onenand_memory_bbt(mtd, bd))) {
printk(KERN_ERR
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 4b0c923..76dfce4 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -135,6 +135,7 @@ struct onenand_chip {
 #define ONENAND_HAS_CONT_LOCK  (0x0001)
 #define ONENAND_HAS_UNLOCK_ALL (0x0002)
 #define ONENAND_HAS_2PLANE (0x0004)
+#define ONENAND_RUNTIME_BADBLOCK_CHECK (0x0200)
 #define ONENAND_PAGEBUF_ALLOC  (0x1000)
 #define ONENAND_OOBBUF_ALLOC   (0x2000)
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] OneNAND: Runtime badblock support

2009-07-21 Thread Kyungmin Park
Hi,

On Tue, Jul 21, 2009 at 7:50 PM, Wolfgang Denkw...@denx.de wrote:
 Dear Kyungmin Park,

 In message 20090721095528.ga23...@july you wrote:
 At bootloader, we don't need to read full page. It takes too long time.
 Instead it only read pages required for boot.
 Of course, this patch reduces the boot time

 What does don't need to read full page mean?
It means all blocks at scanning time.
 when we read pages, we always read fullpages, don't we?

 @@ -155,6 +192,11 @@ static int onenand_isbad_bbt(struct mtd_info *mtd, 
 loff_t offs, int allowbbt)
       block = (int)(offs  (bbm-bbt_erase_shift - 1));
       res = (bbm-bbt[block  3]  (block  0x06))  0x03;

 +     if (this-options  ONENAND_RUNTIME_BADBLOCK_CHECK) {
 +             if (res == 0x02)
 +                     res = read_page_oob(mtd, offs, this-oob_buf);
 +     }
 +

 ONENAND_RUNTIME_BADBLOCK_CHECK is a new #define, right? It should be
 documented (for example in the README, or even better in
 doc/README.OneNand or so).

It's OneNAND specific option. Umm I'll try to describe it

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4 v3] s5pc1xx: add support SMDKC100 board

2009-09-23 Thread Kyungmin Park
On Wed, Sep 23, 2009 at 9:05 PM, Tom tom@windriver.com wrote:
 Minkyu Kang wrote:
 Dear Tom

 2009/9/23 Tom tom@windriver.com:
 Minkyu Kang wrote:
 Adds new board SMDKC100 that uses s5pc100 SoC

 Signed-off-by: Minkyu Kang mk7.k...@samsung.com
 Signed-off-by: HeungJun, Kim riverful@samsung.com
 ---

 snip

 +#ifndef CONFIG_ONENAND_IPL
 +     /* setting SRAM */
 +     ldr     r0, =S5PC100_SROMC_BASE
 +     ldr     r1, =0x9
 +     str     r1, [r0]
 +#endif
 Where is CONFIG_ONENAND_IPL defined ?
 If it is not being used, the #ifndef logic should be reduced.

 Kyungmin Park sent the patch that is supported onenand_ipl for s5pc1xx.
 but not yet applied onenand_ipl patch for s5pc1xx.
 When that patch is applied, we need these logic.
 If necessary, I'll delete these logic until apply the patch.


 If the patch already exits, it would be better if it was in this
 patchset.  Can we get the onenand_ipl patch ?

To support the s5pc1xx OneNAND IPL. It needs to refactor the current
OneNAND IPL.

Now I refactor the OneNAND IPL code first and then I will send a
OneNAND IPL codes for s5pc1xx.

I want to leave current patch as is. Since If we delete the OneNAND
IPL codes. No one can refer the codes. I mean OneNAND IPL parts
contains clock and memory configuration. These are helpful to someone
who use NAND or NOR.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4 v3] s5pc1xx: support onenand driver

2009-09-23 Thread Kyungmin Park
On Wed, Sep 23, 2009 at 7:49 PM, Minkyu Kang proms...@gmail.com wrote:
 Dear Tom.

 2009/9/22 Tom tom@windriver.com:
 Minkyu Kang wrote:
 This patch includes the onenand driver for s5pc100

 Signed-off-by: Minkyu Kang mk7.k...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 Changes since v1:
 - move samsung_onenand.h to include/linux/mtd/
 - make C struct instead of base+offset
 - Remove the 1  in while loop

 Changes since v2:
 - drop blank lines
 - adds some comments
 - modify to lower case letter in C struct

  drivers/mtd/onenand/Makefile        |    1 +
  drivers/mtd/onenand/samsung.c       |  622 
 +++
  include/linux/mtd/onenand.h         |    1 +
  include/linux/mtd/onenand_regs.h    |    4 +
  include/linux/mtd/samsung_onenand.h |  131 
  5 files changed, 759 insertions(+), 0 deletions(-)
  create mode 100644 drivers/mtd/onenand/samsung.c
  create mode 100644 include/linux/mtd/samsung_onenand.h

 diff --git a/drivers/mtd/onenand/Makefile b/drivers/mtd/onenand/Makefile
 index 1d35a57..2571df0 100644
 --- a/drivers/mtd/onenand/Makefile
 +++ b/drivers/mtd/onenand/Makefile
 @@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
  LIB  := $(obj)libonenand.a

  COBJS-$(CONFIG_CMD_ONENAND)  := onenand_uboot.o onenand_base.o 
 onenand_bbt.o
 +COBJS-$(CONFIG_SAMSUNG_ONENAND)      += samsung.o

  COBJS        := $(COBJS-y)
  SRCS := $(COBJS:.o=.c)
 diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
 new file mode 100644
 index 000..5433f19
 --- /dev/null
 +++ b/drivers/mtd/onenand/samsung.c
 @@ -0,0 +1,622 @@
 +/*
 + * S3C64XX/S5PC100 OneNAND driver at U-Boot
 + *
 + *  Copyright (C) 2008-2009 Samsung Electronics
 + *  Kyungmin Park kyungmin.p...@samsung.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.

 Add full GPL 2 copyright.

 Ok, thanks


 + *
 + * Implementation:
 + *   Emulate the pseudo BufferRAM
 + */
 +
 snip

 +
 +#if defined(CONFIG_S3C64XX)
 +#define MAP_00                               (0x0  24)
 +#define MAP_01                               (0x1  24)
 +#define MAP_10                               (0x2  24)
 +#define MAP_11                               (0x3  24)
 +#elif defined(CONFIG_S5PC1XX)
 +#define MAP_00                               (0x0  26)
 +#define MAP_01                               (0x1  26)
 +#define MAP_10                               (0x2  26)
 +#define MAP_11                               (0x3  26)
 +#endif

 This and other struct, #defines may be better handled in a H file.
 Why did you include them all here?

 It will be moved H file thanks

No, No. Please leave it. User must know that which MAP bit are used.
Later I will remove #ifdef.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support

2009-10-06 Thread Kyungmin Park
Some Samsung SoCs, s3c64xx, s5pc100 has own OneNAND controller
and different OneNAND access method.
To support this, each board has own init and set onenand_read_page for it.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index 8d0df81..47b60b3 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -110,6 +110,14 @@ static void onenand_generic_init(int *page_is_4KiB, int 
*page)
*page_is_4KiB = 1;
 }
 
+static int __onenand_board_init(int *page_is_4KiB, int *page)
+{
+   return 0;
+}
+
+int onenand_board_init(int *page_is_4KiB, int *page)
+   __attribute__((weak, alias(__onenand_board_init)));
+
 /**
  * onenand_read_block - Read CONFIG_SYS_MONITOR_LEN from begining
  *  of OneNAND, skipping bad blocks
@@ -120,11 +128,13 @@ int onenand_read_block(unsigned char *buf)
int block, nblocks;
int page = CONFIG_ONENAND_START_PAGE, offset = 0;
int pagesize, erasesize, erase_shift;
-   int page_is_4KiB = 0;
+   int page_is_4KiB = 0, ret;
 
onenand_read_page = generic_onenand_read_page;
 
-   onenand_generic_init(page_is_4KiB, page);
+   ret = onenand_board_init(page_is_4KiB, page);
+   if (ret)
+   onenand_generic_init(page_is_4KiB, page);
 
if (page_is_4KiB) {
pagesize = 4096; /* OneNAND has 4KiB pagesize */
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [OneNAND IPL] OneNAND board init support

2009-10-06 Thread Kyungmin Park
Sorry, there's typo.

Here's fixed patch.

diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index 8d0df81..47b60b3 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -110,6 +110,14 @@ static void onenand_generic_init(int
*page_is_4KiB, int *page)
*page_is_4KiB = 1;
 }

+static int __onenand_board_init(int *page_is_4KiB, int *page)
+{
+   return 0;
+}
+
+int onenand_board_init(int *page_is_4KiB, int *page)
+   __attribute__((weak, alias(__onenand_board_init)));
+
 /**
  * onenand_read_block - Read CONFIG_SYS_MONITOR_LEN from begining
  *  of OneNAND, skipping bad blocks
@@ -120,11 +128,13 @@ int onenand_read_block(unsigned char *buf)
int block, nblocks;
int page = CONFIG_ONENAND_START_PAGE, offset = 0;
int pagesize, erasesize, erase_shift;
-   int page_is_4KiB = 0;
+   int page_is_4KiB = 0, ret;

onenand_read_page = generic_onenand_read_page;

-   onenand_generic_init(page_is_4KiB, page);
+   ret = onenand_board_init(page_is_4KiB, page);
+   if (!ret)
+   onenand_generic_init(page_is_4KiB, page);

if (page_is_4KiB) {
pagesize = 4096; /* OneNAND has 4KiB pagesize */


On Wed, Oct 7, 2009 at 10:24 AM, Kyungmin Park kmp...@infradead.org wrote:
 Some Samsung SoCs, s3c64xx, s5pc100 has own OneNAND controller
 and different OneNAND access method.
 To support this, each board has own init and set onenand_read_page for it.

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
 index 8d0df81..47b60b3 100644
 --- a/onenand_ipl/onenand_read.c
 +++ b/onenand_ipl/onenand_read.c
 @@ -110,6 +110,14 @@ static void onenand_generic_init(int *page_is_4KiB, int 
 *page)
                *page_is_4KiB = 1;
  }

 +static int __onenand_board_init(int *page_is_4KiB, int *page)
 +{
 +       return 0;
 +}
 +
 +int onenand_board_init(int *page_is_4KiB, int *page)
 +       __attribute__((weak, alias(__onenand_board_init)));
 +
  /**
  * onenand_read_block - Read CONFIG_SYS_MONITOR_LEN from begining
  *                      of OneNAND, skipping bad blocks
 @@ -120,11 +128,13 @@ int onenand_read_block(unsigned char *buf)
        int block, nblocks;
        int page = CONFIG_ONENAND_START_PAGE, offset = 0;
        int pagesize, erasesize, erase_shift;
 -       int page_is_4KiB = 0;
 +       int page_is_4KiB = 0, ret;

        onenand_read_page = generic_onenand_read_page;

 -       onenand_generic_init(page_is_4KiB, page);
 +       ret = onenand_board_init(page_is_4KiB, page);
 +       if (ret)
 +               onenand_generic_init(page_is_4KiB, page);

        if (page_is_4KiB) {
                pagesize = 4096; /* OneNAND has 4KiB pagesize */
 ___
 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] OneNAND operations.

2009-10-09 Thread Kyungmin Park
Sorry for late reply.

At current implementation. only block write supported. Of course, I
wrote the partial write.

I will post the latest patches.

Sorry. Please wait until next Monday

Thank you,
Kyungmin Park

On Thu, Oct 8, 2009 at 6:10 PM, Tuma chernigovs...@spb.gs.ru wrote:
 Hello, All!
 My next question is about OneNAND U-Boot operations.
 I use U-Boot 2009.08.rc2. There is onenand command:

 onenand read[.oob] addr off size
    read/write 'size' bytes starting at offset 'off'
    to/from memory address 'addr', skipping bad blocks.


 Can someone explain me how should I use it please?
 I try:
 onenand read 0x8000 0x0024 1000
 0x8000 - is the address where data will be put?
 off (I use 0x0024 becouse I want to read OMAP3's environments)
 size is 0x1000 - just for example.

 And I get:

 OneNAND read: offset 0x24, size 0x1000
  0 bytes read: OK

 What is wrong?
 And what is [.oob]?

 Thank you!


 --
 Software Developer
 General Satellite Corp.
 ___
 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


[U-Boot] [PATCH] OneNAND partial read/write support

2009-10-12 Thread Kyungmin Park
Now OneNAND handles block operation only.
With this patch OneNAND handles all read/write size.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
index 9090940..2b8f01b 100644
--- a/common/cmd_onenand.c
+++ b/common/cmd_onenand.c
@@ -36,7 +36,7 @@ static inline int str2long(char *p, ulong *num)
return (*p != '\0'  *endptr == '\0') ? 1 : 0;
 }
 
-static int arg_off_size(int argc, char *argv[], ulong *off, size_t *size)
+static int arg_off_size(int argc, char *argv[], ulong *off, ssize_t *size)
 {
if (argc = 1) {
if (!(str2long(argv[0], off))) {
@@ -69,61 +69,65 @@ static int arg_off_size(int argc, char *argv[], ulong *off, 
size_t *size)
return 0;
 }
 
-static int onenand_block_read(loff_t from, size_t len,
- size_t *retlen, u_char *buf, int oob)
+static int onenand_block_read(loff_t from, ssize_t len,
+ ssize_t *retlen, u_char *buf, int oob)
 {
struct onenand_chip *this = mtd-priv;
-   int blocks = (int) len  this-erase_shift;
int blocksize = (1  this-erase_shift);
loff_t ofs = from;
struct mtd_oob_ops ops = {
.retlen = 0,
};
+   ssize_t thislen;
int ret;
 
-   if (oob)
-   ops.ooblen = blocksize;
-   else
-   ops.len = blocksize;
+   while (len  0) {
+   thislen = min_t(ssize_t, len, blocksize);
+   thislen = ALIGN(thislen, mtd-writesize);
 
-   while (blocks) {
ret = mtd-block_isbad(mtd, ofs);
if (ret) {
printk(Bad blocks %d at 0x%x\n,
   (u32)(ofs  this-erase_shift), (u32)ofs);
-   ofs += blocksize;
+   ofs += thislen;
continue;
}
 
-   if (oob)
+   if (oob) {
ops.oobbuf = buf;
-   else
+   ops.ooblen = thislen;
+   } else {
ops.datbuf = buf;
+   ops.len = thislen;
+   }
 
ops.retlen = 0;
ret = mtd-read_oob(mtd, ofs, ops);
if (ret) {
printk(Read failed 0x%x, %d\n, (u32)ofs, ret);
-   ofs += blocksize;
+   ofs += thislen;
continue;
}
-   ofs += blocksize;
-   buf += blocksize;
-   blocks--;
+   ofs += thislen;
+   buf += thislen;
+   len -= thislen;
*retlen += ops.retlen;
}
 
return 0;
 }
 
-static int onenand_block_write(loff_t to, size_t len,
-  size_t *retlen, const u_char * buf)
+static int onenand_block_write(loff_t to, ssize_t len,
+  ssize_t *retlen, const u_char * buf)
 {
struct onenand_chip *this = mtd-priv;
-   int blocks = len  this-erase_shift;
int blocksize = (1  this-erase_shift);
+   struct mtd_oob_ops ops = {
+   .retlen = 0,
+   .oobbuf = NULL,
+   };
loff_t ofs;
-   size_t _retlen = 0;
+   ssize_t thislen;
int ret;
 
if (to == next_ofs) {
@@ -135,27 +139,34 @@ static int onenand_block_write(loff_t to, size_t len,
}
ofs = to;
 
-   while (blocks) {
+   while (len  0) {
+   thislen = min_t(ssize_t, len, blocksize);
+   thislen = ALIGN(thislen, mtd-writesize);
+
ret = mtd-block_isbad(mtd, ofs);
if (ret) {
printk(Bad blocks %d at 0x%x\n,
   (u32)(ofs  this-erase_shift), (u32)ofs);
-   skip_ofs += blocksize;
+   skip_ofs += thislen;
goto next;
}
 
-   ret = mtd-write(mtd, ofs, blocksize, _retlen, buf);
+
+   ops.datbuf = (u_char *) buf;
+   ops.len = thislen;
+   ops.retlen = 0;
+   ret = mtd-write_oob(mtd, ofs, ops);
if (ret) {
printk(Write failed 0x%x, %d, (u32)ofs, ret);
-   skip_ofs += blocksize;
+   skip_ofs += thislen;
goto next;
}
 
-   buf += blocksize;
-   blocks--;
-   *retlen += _retlen;
+   buf += thislen;
+   len -= thislen;
+   *retlen += ops.retlen;
 next:
-   ofs += blocksize;
+   ofs += thislen;
}
 
return 0;
@@ -234,7 +245,7 @@ static int onenand_block_test(u32 start, u32 size)
end_block = mtd-size  this-erase_shift;
 
blocks = start_block

Re: [U-Boot] [PATCH] Reduce apollon OneNAND IPL code

2009-10-12 Thread Kyungmin Park
On Tue, Oct 13, 2009 at 1:48 AM, Scott Wood scottw...@freescale.com wrote:
 On Mon, Oct 12, 2009 at 09:17:49AM +0900, Kyungmin Park wrote:
 After OneNAND IPL updated, apollon boot code exceeds 1KiB size,

 This patch reduces the apollon boot code

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com

 Should this go through NAND or ARM?

anyone, but ARM is proper I think

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] OneNAND partial read/write support

2009-10-12 Thread Kyungmin Park
Hi,

If you use the gmail, Select the raw message, and copy and paste
Others are similar.
Don't copy html format to your text file.

Thank you,
Kyungmin Park

On Mon, Oct 12, 2009 at 5:51 PM, Tuma chernigovs...@spb.gs.ru wrote:
 Hi, Kyungmin Park!
 Thank you for patch!
 But I have a question - how should I apply it?
 Sorry, I'm not very skilled in UNIX/Linux.
 I've saved all code from:

 diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
 index 9090940..2b8f01b 100644

 to:

                        if (arg_off_size(argc - o, argv + o, ofs, len) != 0)

 into 1.patch file. Tryed to
    patch -p1  /1.patch
 from U-Boot directory, and get:

 patching file common/cmd_onenand.c
 patch:  malformed patch at line 6: return (*p != '\0' 
 *endptr== '\0') ? 1 : 0;

 I use U-Boot2009.08.rc2.

 What is wrong?
 Or maybe you could send me your full /common/cmd_onenand.c ?


 On Monday 12 October 2009 11:27:10 Kyungmin Park wrote:
 Now OneNAND handles block operation only.
 With this patch OneNAND handles all read/write size.

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
 index 9090940..2b8f01b 100644
 --- a/common/cmd_onenand.c
 +++ b/common/cmd_onenand.c
 @@ -36,7 +36,7 @@ static inline int str2long(char *p, ulong *num)
       return (*p != '\0'  *endptr == '\0') ? 1 : 0;
  }

 -static int arg_off_size(int argc, char *argv[], ulong *off, size_t *size)
 +static int arg_off_size(int argc, char *argv[], ulong *off, ssize_t *size)
  {
       if (argc = 1) {
               if (!(str2long(argv[0], off))) {
 @@ -69,61 +69,65 @@ static int arg_off_size(int argc, char *argv[], ulong
 *off, size_t *size) return 0;
  }

 -static int onenand_block_read(loff_t from, size_t len,
 -                           size_t *retlen, u_char *buf, int oob)
 +static int onenand_block_read(loff_t from, ssize_t len,
 +                           ssize_t *retlen, u_char *buf, int oob)
  {
       struct onenand_chip *this = mtd-priv;
 -     int blocks = (int) len  this-erase_shift;
       int blocksize = (1  this-erase_shift);
       loff_t ofs = from;
       struct mtd_oob_ops ops = {
               .retlen         = 0,
       };
 +     ssize_t thislen;
       int ret;

 -     if (oob)
 -             ops.ooblen = blocksize;
 -     else
 -             ops.len = blocksize;
 +     while (len  0) {
 +             thislen = min_t(ssize_t, len, blocksize);
 +             thislen = ALIGN(thislen, mtd-writesize);

 -     while (blocks) {
               ret = mtd-block_isbad(mtd, ofs);
               if (ret) {
                       printk(Bad blocks %d at 0x%x\n,
                              (u32)(ofs  this-erase_shift), (u32)ofs);
 -                     ofs += blocksize;
 +                     ofs += thislen;
                       continue;
               }

 -             if (oob)
 +             if (oob) {
                       ops.oobbuf = buf;
 -             else
 +                     ops.ooblen = thislen;
 +             } else {
                       ops.datbuf = buf;
 +                     ops.len = thislen;
 +             }

               ops.retlen = 0;
               ret = mtd-read_oob(mtd, ofs, ops);
               if (ret) {
                       printk(Read failed 0x%x, %d\n, (u32)ofs, ret);
 -                     ofs += blocksize;
 +                     ofs += thislen;
                       continue;
               }
 -             ofs += blocksize;
 -             buf += blocksize;
 -             blocks--;
 +             ofs += thislen;
 +             buf += thislen;
 +             len -= thislen;
               *retlen += ops.retlen;
       }

       return 0;
  }

 -static int onenand_block_write(loff_t to, size_t len,
 -                            size_t *retlen, const u_char * buf)
 +static int onenand_block_write(loff_t to, ssize_t len,
 +                            ssize_t *retlen, const u_char * buf)
  {
       struct onenand_chip *this = mtd-priv;
 -     int blocks = len  this-erase_shift;
       int blocksize = (1  this-erase_shift);
 +     struct mtd_oob_ops ops = {
 +             .retlen         = 0,
 +             .oobbuf         = NULL,
 +     };
       loff_t ofs;
 -     size_t _retlen = 0;
 +     ssize_t thislen;
       int ret;

       if (to == next_ofs) {
 @@ -135,27 +139,34 @@ static int onenand_block_write(loff_t to, size_t len,
       }
       ofs = to;

 -     while (blocks) {
 +     while (len  0) {
 +             thislen = min_t(ssize_t, len, blocksize);
 +             thislen = ALIGN(thislen, mtd-writesize);
 +
               ret = mtd-block_isbad(mtd, ofs);
               if (ret) {
                       printk(Bad blocks %d at 0x%x\n,
                              (u32)(ofs  this-erase_shift), (u32)ofs);
 -                     skip_ofs += blocksize;
 +                     skip_ofs += thislen;
                       goto next;
               }

 -             ret = mtd-write(mtd, ofs, blocksize, _retlen, buf

Re: [U-Boot] [PATCH] OneNAND partial read/write support

2009-10-20 Thread Kyungmin Park
On Wed, Oct 21, 2009 at 7:48 AM, Scott Wood scottw...@freescale.com wrote:
 On Mon, Oct 12, 2009 at 04:27:10PM +0900, Kyungmin Park wrote:
 Now OneNAND handles block operation only.
 With this patch OneNAND handles all read/write size.

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
 index 9090940..2b8f01b 100644
 --- a/common/cmd_onenand.c
 +++ b/common/cmd_onenand.c
 @@ -36,7 +36,7 @@ static inline int str2long(char *p, ulong *num)
       return (*p != '\0'  *endptr == '\0') ? 1 : 0;
  }

 -static int arg_off_size(int argc, char *argv[], ulong *off, size_t *size)
 +static int arg_off_size(int argc, char *argv[], ulong *off, ssize_t *size)
  {
       if (argc = 1) {
               if (!(str2long(argv[0], off))) {

 Are you expecting negative sizes?

I don't know why these are implemented. it's existing one.


 @@ -69,61 +69,65 @@ static int arg_off_size(int argc, char *argv[], ulong 
 *off, size_t *size)
       return 0;
  }

 -static int onenand_block_read(loff_t from, size_t len,
 -                           size_t *retlen, u_char *buf, int oob)
 +static int onenand_block_read(loff_t from, ssize_t len,
 +                           ssize_t *retlen, u_char *buf, int oob)
  {

 Is it still onenand_block_read if you don't have to read a whole block?

       struct onenand_chip *this = mtd-priv;
 -     int blocks = (int) len  this-erase_shift;
       int blocksize = (1  this-erase_shift);
       loff_t ofs = from;
       struct mtd_oob_ops ops = {
               .retlen         = 0,
       };
 +     ssize_t thislen;
       int ret;

 -     if (oob)
 -             ops.ooblen = blocksize;
 -     else
 -             ops.len = blocksize;
 +     while (len  0) {
 +             thislen = min_t(ssize_t, len, blocksize);
 +             thislen = ALIGN(thislen, mtd-writesize);

 -     while (blocks) {
               ret = mtd-block_isbad(mtd, ofs);
               if (ret) {
                       printk(Bad blocks %d at 0x%x\n,
                              (u32)(ofs  this-erase_shift), (u32)ofs);
 -                     ofs += blocksize;
 +                     ofs += thislen;
                       continue;
               }

 -             if (oob)
 +             if (oob) {
                       ops.oobbuf = buf;
 -             else
 +                     ops.ooblen = thislen;
 +             } else {
                       ops.datbuf = buf;
 +                     ops.len = thislen;

 thislen can be greater than len, in which case you'll be overflowing buf.

No, len is unsigned int, but thislen is int. and can't overflow since.
it's size down with blocksize at min macro.


 If you want to allow partial page reads, you need to allocate a temporary
 buffer at some point.  If not (I don't see a huge need), the ALIGN()
 should be an error check instead.



 Does this code handle being given an offset that is not at a block (or
 page) boundary?  It doesn't look like it (it will try to read across
 block boundaries).

Basically it reads/writes data based on block. but last or first
partial read/writes support.


 @@ -265,9 +276,10 @@ static int onenand_block_test(u32 start, u32 size)
                       goto next;
               }

 -             if (memcmp(buf, verify_buf, blocksize))
 +             if (memcmp(buf, verify_buf, blocksize)) {
                       printk(\nRead/Write test failed at 0x%x\n, (u32)ofs);
 -
 +                     break;
 +             }
 @@ -322,6 +334,7 @@ static int onenand_dump(struct mtd_info *mtd, ulong off, 
 int only_oob)
               p += 16;
       }
       puts(OOB:\n);
 +     p = oobbuf;
       i = mtd-oobsize  3;
       while (i--) {
               printf(\t%02x %02x %02x %02x %02x %02x %02x %02x\n,
 @@ -339,7 +352,7 @@ int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, 
 char *argv[])
       struct onenand_chip *this;
       int blocksize;
       ulong addr, ofs;
 -     size_t len, retlen = 0;
 +     ssize_t len, retlen = 0;
       int ret = 0;
       char *cmd, *s;

 @@ -385,7 +398,8 @@ int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, 
 char *argv[])
                       int erase;

                       erase = strcmp(cmd, erase) == 0; /* 1 = erase, 0 = 
 test */
 -                     printf(\nOneNAND %s: , erase ? erase : test);
 +                     printf(\nOneNAND %s %s: , erase ? erase : test,
 +                             force ? force : );

 These seem to be unrelated changes.

Right, but it's for exact display for user.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] [OneNAND] Flex-OneNAND driver support

2009-11-04 Thread Kyungmin Park
H Scott,

If you you don't mind, I'm okay to this patch. Can you merge it?

Thank you,
Kyungmin Park

On Wed, Nov 4, 2009 at 2:00 PM, Amul Kumar Saha amul.s...@samsung.com wrote:
 Hi Scott,

 +static loff_t flexonenand_addr(struct onenand_chip *this, int block)
 +{
 + loff_t ofs = 0;
 + int die = 0, boundary;
 +
 + if (ONENAND_IS_DDP(this)  block = this-density_mask) {
 + block -= this-density_mask;
 + die = 1;
 + ofs = this-diesize[0];
 + }
 +
 + boundary = this-boundary[die];
 + ofs += block  (this-erase_shift - 1);
 + if (block  (boundary + 1))
 + ofs += (block - boundary - 1)  (this-erase_shift - 1);
 + return ofs;

 You're missing some (loff_t) casts that are in Linux, here and elsewhere.


 Accepted and corrected

 +inline loff_t onenand_addr(struct onenand_chip *this, int block)

 This is not a header file; let GCC decide when to inline.  Note that this
 function is not specified as inline in Linux.


 Accepted and corrected

 There are some other fairly significant differences with Linux later in
 the patch -- is this due to missing functionality that u-boot doesn't
 need, or something else?


 Yes, there are certain functionalities that OneNAND doesn't need in U-Boot.
 Sending the updated patches.

 Regards,
 Amul Kumar Saha


 ___
 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] [ARM] Move machine specific code to board at s3c64xx (v2)

2009-04-01 Thread Kyungmin Park
Hi,

If there's no objection, could you apply this patch to ARM git tree?

Thank you,
Kyungmin Park

On Wed, Nov 26, 2008 at 10:18 AM, Kyungmin Park kmp...@infradead.org wrote:
 Move machine specific code to smdk6400.
 Some board use OneNAND instead of NAND.

 Some register MP0_CS_CFG[5:0] are controled by both h/w and s/w.
 So it's better to use macro instead of hard-coded value.

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 diff --git a/board/samsung/smdk6400/lowlevel_init.S 
 b/board/samsung/smdk6400/lowlevel_init.S
 index e0119a7..47f72f6 100644
 --- a/board/samsung/smdk6400/lowlevel_init.S
 +++ b/board/samsung/smdk6400/lowlevel_init.S
 @@ -104,6 +104,13 @@ lowlevel_init:
        bl nand_asm_init
  #endif

 +       /* Memory subsystem address 0x7e00f120 */
 +       ldr     r0, =ELFIN_MEM_SYS_CFG
 +
 +       /* Xm0CSn2 = NFCON CS0, Xm0CSn3 = NFCON CS1 */
 +       mov     r1, #S3C64XX_MEM_SYS_CFG_NAND
 +       str     r1, [r0]
 +
        bl      mem_ctrl_asm_init

  /* Wakeup support. Don't know if it's going to be used, untested. */
 diff --git a/cpu/arm1176/s3c64xx/cpu_init.S b/cpu/arm1176/s3c64xx/cpu_init.S
 index 08bda99..32bb467 100644
 --- a/cpu/arm1176/s3c64xx/cpu_init.S
 +++ b/cpu/arm1176/s3c64xx/cpu_init.S
 @@ -28,13 +28,6 @@

        .globl mem_ctrl_asm_init
  mem_ctrl_asm_init:
 -       /* Memory subsystem address 0x7e00f120 */
 -       ldr     r0, =ELFIN_MEM_SYS_CFG
 -
 -       /* Xm0CSn2 = NFCON CS0, Xm0CSn3 = NFCON CS1 */
 -       mov     r1, #0xd
 -       str     r1, [r0]
 -
        /* DMC1 base address 0x7e001000 */
        ldr     r0, =ELFIN_DMC1_BASE

 diff --git a/include/s3c6400.h b/include/s3c6400.h
 index fd3e99b..d3f136d 100644
 --- a/include/s3c6400.h
 +++ b/include/s3c6400.h
 @@ -380,6 +380,11 @@
  */
  #define ELFIN_MEM_SYS_CFG      0x7e00f120

 +#define S3C64XX_MEM_SYS_CFG_16BIT      (1  12)
 +
 +#define S3C64XX_MEM_SYS_CFG_NAND       0x0008
 +#define S3C64XX_MEM_SYS_CFG_ONENAND    S3C64XX_MEM_SYS_CFG_16BIT
 +
  #define GPACON         (ELFIN_GPIO_BASE + GPACON_OFFSET)
  #define GPADAT         (ELFIN_GPIO_BASE + GPADAT_OFFSET)
  #define GPAPUD         (ELFIN_GPIO_BASE + GPAPUD_OFFSET)
 ___
 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] [ARM] Move machine specific code to board at s3c64xx (v2)

2009-04-02 Thread Kyungmin Park
On Thu, Apr 2, 2009 at 2:18 PM, Jean-Christophe PLAGNIOL-VILLARD
plagn...@jcrosoft.com wrote:
 On 13:43 Thu 02 Apr     , Kyungmin Park wrote:
 Hi,

 If there's no objection, could you apply this patch to ARM git tree?
 Just one question
 is the OneNand always 16bits?


Sure as I know, there's no exception.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] Fix OneNAND ipl to read CONFIG_SYS_MONITOR_LEN

2009-04-23 Thread Kyungmin Park
Hi,

On Fri, Apr 24, 2009 at 2:28 PM, AYYANARPONNUSAMY GANGHEYAMOORTHY
moorthy@samsung.com wrote:
 Hi  Scott,
 On  Apr 24, 2009 07:39 (GMT+09:00) Scott Woodscottw...@freescale.com wrote

apgmoorthy wrote:
 This is done by the Post : [U-Boot] [PATCH 2/2] Fix OneNAND ipl to read 
 CONFIG_SYS_MONITOR_LEN

 What do you feel about getting this one inside u-boot-nand-flash ?

Such a change should go through the board maintainer, who knows better
what the actual length is.
        - Correct  , I got your point.

 Hi Kyungmin,
       Can you please make a call on this , for apollon and get 
 CONFIG_SYS_MONITOR_LEN in.


Actually, I don't like the CONFIG_SYS_MONITOR_LEN approaches, now you
are consider the bad block at 1.
But we can also consider the bad block 2, if there two consecutive 2
bad block at block 1, 2, we should define the CONFIG_SYS_MONITOR_LEN
as 128KiB * 4 and reserved block block 4 always even though we use 2
blocks.

Right, we should consider bad block at IPL, so my recommendation is
IPL + u-boot should be fit at block 0
128KiB at OneNAND, 256KiB at Flex-OneNAND. In case of apollon. we
should reduce the size as 128KiB for OneNAND side. If the IPL + u-boot
size under 128KiB, Flex-OneNAND also can boot it.

For simplicity How about to use block scheme? we always use block 0
for boot (IPL + u-boot) whatever block size.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] Fix OneNAND ipl to read CONFIG_SYS_MONITOR_LEN

2009-05-06 Thread Kyungmin Park
Hi,

Please apply this patch for fixing broken apollon build.

Acked-by: Kyungmin Park kyungmin.p...@samsung.com

On Mon, Mar 9, 2009 at 11:15 PM, Rohit Hagargundgi h.ro...@samsung.com wrote:
 Add CONFIG_SYS_MONITOR_LEN macro to apollon board config.
 CONFIG_SYS_MONITOR_LEN defines the U-Boot image size.
 and is used by OneNAND ipl when reading U-Boot image.

 Signed-off-by: Rohit Hagargundgi h.rohit at samsung.com
 ---
  include/configs/apollon.h |    1 +
  1 file changed, 1 insertion(+)
 diff --git a/include/configs/apollon.h b/include/configs/apollon.h
 index dff47fc..2e8198f 100644
 --- a/include/configs/apollon.h
 +++ b/include/configs/apollon.h
 @@ -254,6 +254,7 @@

  /* OneNAND boot, OneNAND has CS0, NOR boot ONeNAND has CS2 */
  #define        CONFIG_SYS_ONENAND_BASE 0x
 +#define CONFIG_SYS_MONITOR_LEN         SZ_256K /* U-Boot image size */
  #define        CONFIG_ENV_IS_IN_ONENAND        1
  #define CONFIG_ENV_ADDR                0x0002

 ___
 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] RFC: U-Boot OneNAND IPL TEXT_BASE

2010-05-01 Thread Kyungmin Park
Hi,

Which CPU do you use? In most ARM cpu, CPU load the IPL into its
internal SRAM, and runs at here.
But in your case it's not. So you maybe redefine IPL address.

Instead of modifying the config.mk, how about to define IPL_TEXT_BASE.

e.g.,

In OneNAND IPL code,

#ifndef BOARD_IPL_TEXT_BASE
#define ONENAND_IPL_TEXT_BASE BOARD_IPL_TEXT_BASE
#endif

load IPL code ONENAND_IPL_TEXT_BASE instead of current code.

Thank you,
Kyungmin Park

On Sat, May 1, 2010 at 11:48 AM, Marek Vasut marek.va...@gmail.com wrote:
 Hey,

 I've been tinkering with OneNAND IPL in uboot. I found out it wan't to load
 itself to the address specified in board/$(BOARDDIR)/config.mk . That's fine 
 in
 most cases, but in my case that wasn't possible.

 In my case, SDRAM init didn't fit into the IPL, so I had to copy U-Boot into
 SRAM, then execute it and let it relocate itself into SDRAM. One more time:
 IPL: OneNAND-SRAM
 U-Boot: SRAM-SDRAM

 It all works fine, but when compiling the IPL, I had to alter TEXT_BASE not to
 point into SDRAM but SRAM too (because of stack). I introduced a variable 
 called
 IPL which allows using config.mk from (for example) onenand-
 ipl/board/$(BOARDDIR)/config.mk rather than the board/$(BOARDDIR)/config.mk 
 one,
 which is in my opinion a correct behaviour.

 Any opinions?

 Thanks in advance.

 diff --git a/config.mk b/config.mk
 index 73b5195..8639580 100644
 --- a/config.mk
 +++ b/config.mk
 @@ -130,9 +130,13 @@ BOARDDIR = $(VENDOR)/$(BOARD)
  else
  BOARDDIR = $(BOARD)
  endif
 +ifdef  IPL
 +sinclude $(TOPDIR)/$(IPL)/board/$(BOARDDIR)/config.mk  # include IPL specific
 rules
 +else
  ifdef  BOARD
  sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules
  endif
 +endif

  #

 ___
 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] RFC: U-Boot OneNAND IPL TEXT_BASE

2010-05-02 Thread Kyungmin Park
On Sun, May 2, 2010 at 3:39 PM, Marek Vasut marek.va...@gmail.com wrote:
 Dne Ne 2. května 2010 05:54:41 Kyungmin Park napsal(a):
 Hi,

 Which CPU do you use? In most ARM cpu, CPU load the IPL into its
 internal SRAM, and runs at here.
 PXA270 ... the BootRAM is mapped to 0x0 and the code runs from there.
 But in your case it's not. So you maybe redefine IPL address.

 Instead of modifying the config.mk, how about to define IPL_TEXT_BASE.

 e.g.,

 In OneNAND IPL code,

 #ifndef BOARD_IPL_TEXT_BASE
 #define ONENAND_IPL_TEXT_BASE BOARD_IPL_TEXT_BASE
 #endif

 That won't help -- TEXT_BASE is used while compiling start.S (to setup stack
 under TEXT_BASE) and the config.mk prepares the gcc options for start.S (the
 TEXT_BASE is defined in the gcc options).So modifying config.mk is 
 unavoidable I
 fear.

Sorry my mistake. It's already supported at current drivers. Now I
works on s5pc100 and s5pc110 and each define it's TEXT_BASE at
onenand_ipl/board/samsung/${board_name}/config.mk. and it's used at
start.S

No need to modify config.mk and Makefile. If you need I can't send a
sample files to you.

Thank you,
Kyungmin Park


 The thing we can do is define STACK_TOP_BASE and that'd certainly do the 
 trick!
 This would allow me to point stack into SRAM, while running the IPL code from
 BootRAM. Of course, in case STACK_TOP_BASE wasn't defined, it'd fall back to 
 the
 old code in start.S. This would of course work without modifying config.mk 
 and I
 start to like such a solution.

 Hm?


 load IPL code ONENAND_IPL_TEXT_BASE instead of current code.

 Thank you,
 Kyungmin Park

 Thanks!

 On Sat, May 1, 2010 at 11:48 AM, Marek Vasut marek.va...@gmail.com wrote:
  Hey,
 
  I've been tinkering with OneNAND IPL in uboot. I found out it wan't to
  load itself to the address specified in board/$(BOARDDIR)/config.mk .
  That's fine in most cases, but in my case that wasn't possible.
 
  In my case, SDRAM init didn't fit into the IPL, so I had to copy U-Boot
  into SRAM, then execute it and let it relocate itself into SDRAM. One
  more time: IPL: OneNAND-SRAM
  U-Boot: SRAM-SDRAM
 
  It all works fine, but when compiling the IPL, I had to alter TEXT_BASE
  not to point into SDRAM but SRAM too (because of stack). I introduced a
  variable called IPL which allows using config.mk from (for example)
  onenand-
  ipl/board/$(BOARDDIR)/config.mk rather than the
  board/$(BOARDDIR)/config.mk one, which is in my opinion a correct
  behaviour.
 
  Any opinions?
 
  Thanks in advance.
 
  diff --git a/config.mk b/config.mk
  index 73b5195..8639580 100644
  --- a/config.mk
  +++ b/config.mk
  @@ -130,9 +130,13 @@ BOARDDIR = $(VENDOR)/$(BOARD)
   else
   BOARDDIR = $(BOARD)
   endif
  +ifdef  IPL
  +sinclude $(TOPDIR)/$(IPL)/board/$(BOARDDIR)/config.mk  # include IPL
  specific rules
  +else
   ifdef  BOARD
   sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific
  rules endif
  +endif
 
   
  #
 
  ___
  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] Support similar boards at same board file?

2010-05-25 Thread Kyungmin Park
Hi,

My bet is goni. Since it's new GPIO based board.

Thank you,
Kyungmin Park

 -Original Message-
 From: Minkyu Kang [mailto:proms...@gmail.com]
 Sent: Tuesday, May 25, 2010 12:38 PM
 To: Wolfgang Denk
 Cc: u-boot@lists.denx.de; 박경민
 Subject: Re: Support similar boards at same board file?
 
 Dear Wolfgang Denk,
 
 On 25 May 2010 05:50, Wolfgang Denk w...@denx.de wrote:
  Dear Minkyu Kang,
 
  In message AANLkTinxDyzb6NiN8KBFl9V_lmu7mW0G8Kv-
 c6qga...@mail.gmail.com you wrote:
 
   I will post two boards aquila and goni. (s5pc110 soc)
   These board are very similar and can detect the board by gpio. (at
 runtime)
   So, I want to support these two boards at same board file.
   Thus, I will use same binary at two boards.
  ...
 
  Question...
  How I can configure the board directory?
  board/samsung/aquila or board/samsung/goni?
  or need another naming for two boards?
 
  Use either name (but don't invent a third one). Which one to use -
  that's your choice. I cannot answer this. If one of the two boards is
  more general or more popular than the other, then use this one.
 
 OK.
 Thanks.
 
 Minkyu Kang
 --
 from. prom.
 www.promsoft.net

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


Re: [U-Boot] U-boot: Beagle board as a USB Mass Storage Device Class

2010-06-11 Thread Kyungmin Park
Hi,

On Fri, Jun 11, 2010 at 10:13 PM, Gupta, Ajay Kumar ajay.gu...@ti.com wrote:
 Hi,

  Thanks for your response. I want to tell few more things about our
  implementation.
 
  Actually we are planning to simulate (but not implement) the file
 system
  and implement the SCSI transparent command set decoder. When ever a
 file
  You can also use USB DFU for this where you can transfer files to RAM or
  NAND partitions. DFU is not yet supported in Denx's uboot tree but is
  Available in openmoko's tree
  [http://git.openmoko.org/?p=u-boot.git;a=summary].
  You will have to port back DFU feature from openmoko to Denx's tree.

 Thanks for the hint Ajay.  Let me add that DFU is also a standard
 protocol: http://www.usb.org/developers/devclass_docs/DFU_1.1.pdf

 So many people will be able to enjoy this in addition to solving this
 very specific problem of Yogesh.

 Detlev,

 Actually I have ported DFU from openmoko to Denx tree and used it on
 OMAP3EVM. I hope it should work just fine on Beagle as well.

 Will it be ok if I submit those patches to Denx's tree? Is there anyone
 Already working on this?

Good news, can you post it? we just start to implement it s5pc110. we
hope to use it.

Thank you,
Kyungmin Park

 I have seen below page with the same proposal from Mike.
 http://elinux.org/CELF_Project_Proposal/Add_DFU_support_to_U-Boot

 Mike, Are you working on this?

 Regards,
 Ajay

 Cheers
   Detlev

 --
 It's very important  that you sleep because that's  when your brain is
 garbage  collecting.  And a  dream is  if you  are interrupted  in the
 middle and have junk left in the registers.
                                           -- Gerald Sussman
 --
 DENX Software Engineering GmbH,      MD: Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
 ___
 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] UBI: initialise update marker

2010-06-11 Thread Kyungmin Park
Deal all,

Sent.

Thank you,
Kyungmin Park

On Sat, Jun 12, 2010 at 4:32 AM, Wolfgang Denk w...@denx.de wrote:
 Dear Kyungmin  Stefan,K

 In message aanlktikrmmd7hb6j8veb5xycp5rfy7rswpxxcbp3n...@mail.gmail.com 
 Karl Beldan wrote:

 I suggest someone apply commit ff99879 from Linux.

 I think this is a good idea. If you ACK, I can pull in this directly.

 Thanks.

 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
 He had quite a powerful intellect, but it  was  as  powerful  like  a
 locomotive,  and  ran on rails and was therefore almost impossible to
 steer.                          - Terry Pratchett, _Lords and Ladies_

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


[U-Boot] [PATCH] UBI: initialise update marker

2010-06-11 Thread Kyungmin Park
 From: Peter Horton z...@colonel-panic.org

UBI: initialise update marker

The in kernel copy of a volume's update marker is not initialised from the
volume table. This means that volumes where an update was unfinnished will
not be treated as forbidden to use. This is basically that the update
functionality was broken.

Signed-off-by: Peter Horton z...@colonel-panic.org
Signed-off-by: Artem Bityutskiy artem.bityuts...@nokia.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 1afc61e..4004402 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -566,6 +566,7 @@ static int init_volumes(struct ubi_device *ubi, const 
struct ubi_scan_info *si,
vol-reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs);
vol-alignment = be32_to_cpu(vtbl[i].alignment);
vol-data_pad = be32_to_cpu(vtbl[i].data_pad);
+   vol-upd_marker = vtbl[i].upd_marker;
vol-vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ?
UBI_DYNAMIC_VOLUME : UBI_STATIC_VOLUME;
vol-name_len = be16_to_cpu(vtbl[i].name_len);
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] UBI: initialise update marker

2010-06-11 Thread Kyungmin Park
From: Peter Horton z...@colonel-panic.org

UBI: initialise update marker

The in kernel copy of a volume's update marker is not initialised from the
volume table. This means that volumes where an update was unfinnished will
not be treated as forbidden to use. This is basically that the update
functionality was broken.

Signed-off-by: Peter Horton z...@colonel-panic.org
Signed-off-by: Artem Bityutskiy artem.bityuts...@nokia.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 1afc61e..4004402 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -566,6 +566,7 @@ static int init_volumes(struct ubi_device *ubi, const 
struct ubi_scan_info *si,
vol-reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs);
vol-alignment = be32_to_cpu(vtbl[i].alignment);
vol-data_pad = be32_to_cpu(vtbl[i].data_pad);
+   vol-upd_marker = vtbl[i].upd_marker;
vol-vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ?
UBI_DYNAMIC_VOLUME : UBI_STATIC_VOLUME;
vol-name_len = be16_to_cpu(vtbl[i].name_len);
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Fix OneNAND ipl to read 256KB

2009-02-26 Thread Kyungmin Park
Hi,

In the previous mail, I also solve this issue. multi-block read for IPL

http://www.mail-archive.com/u-boot@lists.denx.de/msg04641.html

Of course, it's not consider the Flex-OneNAND, please apply this one
first and then fix it for Flex-OneNAND.

How do you think?

Thank you,
Kyungmin Park

On Thu, Feb 26, 2009 at 5:23 PM, Wolfgang Denk w...@denx.de wrote:
 Dear Rohit Hagargundgi,

 In message 49a645e0.9060...@samsung.com you wrote:
 Currently OneNAND initial program loader (ipl) reads only block 0.
 However, u-boot image for apollon board is 195KB making the board
 unbootable with OneNAND.
 Fix ipl to read 256KB.

 What if there is a board that enables additional features and the size
 grows above 256 kB?

   #include linux/mtd/onenand_regs.h

   #define ONENAND_BLOCK_SIZE              2048
 +#define ONENAND_BOOTLOADER_SIZE              0x4

 Why do we need a new #define here. CONFIG_SYS_MONITOR_LEN already
 contains the U-Boot image size, and is configurable for each board.

 Please drop this #define here and substitute ONENAND_BOOTLOADER_SIZE
 by CONFIG_SYS_MONITOR_LEN in the rest of the patch.

 Thanks.

 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
 It's not an optical illusion, it just looks like one.   -- Phil White
 ___
 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


[U-Boot] [PATCH] Can build with only jffs2 cmdline support

2009-02-27 Thread Kyungmin Park
Some program such as UBI only used the mtdpart only.
however current jffs2 cmdline has dependent with jffs2 cmd
This patch make a build only jffs2 cmdline without jffs2 cmd dependency.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/common/Makefile b/common/Makefile
index f13cd11..18d76fa 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -98,6 +98,7 @@ COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o
 COBJS-$(CONFIG_CMD_IRQ) += cmd_irq.o
 COBJS-$(CONFIG_CMD_ITEST) += cmd_itest.o
 COBJS-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o
+COBJS-$(CONFIG_JFFS2_CMDLINE) += cmd_jffs2.o
 COBJS-$(CONFIG_CMD_LICENSE) += cmd_license.o
 COBJS-y += cmd_load.o
 COBJS-$(CONFIG_LOGBUFFER) += cmd_log.o
diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index d0a7cea..3af1bff 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -2005,6 +2005,7 @@ static struct part_info* jffs2_part_info(struct 
mtd_device *dev, unsigned int pa
 /* U-boot commands*/
 /***/
 
+#ifdef CONFIG_CMD_JFFS2
 /**
  * Routine implementing fsload u-boot command. This routine tries to load
  * a requested file from jffs2/cramfs filesystem on a current partition.
@@ -2144,6 +2145,7 @@ int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, 
char *argv[])
}
return 1;
 }
+#endif /* CONFIG_CMD_JFFS2 */
 
 /* command line only */
 #ifdef CONFIG_JFFS2_CMDLINE
@@ -2295,6 +2297,7 @@ int do_jffs2_mtdparts(cmd_tbl_t *cmdtp, int flag, int 
argc, char *argv[])
 #endif /* #ifdef CONFIG_JFFS2_CMDLINE */
 
 /***/
+#ifdef CONFIG_CMD_JFFS2
 U_BOOT_CMD(
fsload, 3,  0,  do_jffs2_fsload,
load binary file from a filesystem image,
@@ -2314,6 +2317,7 @@ U_BOOT_CMD(
print information about filesystems,
- print information about filesystems\n
 );
+#endif
 
 #ifdef CONFIG_JFFS2_CMDLINE
 U_BOOT_CMD(
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Can build with only jffs2 cmdline support

2009-02-27 Thread Kyungmin Park
Hi Stefan,

On Fri, Feb 27, 2009 at 6:24 PM, Stefan Roese s...@denx.de wrote:
 Hi Kyungmin,

 On Friday 27 February 2009, Kyungmin Park wrote:
 Some program such as UBI only used the mtdpart only.
 however current jffs2 cmdline has dependent with jffs2 cmd
 This patch make a build only jffs2 cmdline without jffs2 cmd dependency.

 Even though I like the idea of this patch, I would prefer if we could really
 split the mtdparts commandset from the jffs2 commandset. Meaning creating a
 new file (e.g. common/cmd_mtdparts) that can be enabled by
 CONFIG_CMD_MTDPARTS.

 What do you think? Could you find the time to create such a patch?


Yes it's better, however there's some combination between jffs2 cmd
and cmdline. it's some complicated.
So I choose the simple method like this.

Okay I will try it but maybe I will start next week. since it's night at here.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Reduce OneNAND IPL common code (v3)

2009-03-02 Thread Kyungmin Park
OneNAND IPL has common codes for RAM init, load data, and jump to 2nd
bootloader, but it's common code used about 300~400 bytes. So board
specific codes, such as lowlevel_init, can't has enough code. It make
a difficult to implement OneNAND IPL.

his patch make this common code as small as possible. and give
lowlevel_init can have more codes.

Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
diff --git a/cpu/arm1136/start.S b/cpu/arm1136/start.S
index e622338..c115003 100644
--- a/cpu/arm1136/start.S
+++ b/cpu/arm1136/start.S
@@ -33,23 +33,7 @@
 .globl _start
 _start: b  reset
 #ifdef CONFIG_ONENAND_IPL
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-
-_hang:
-   .word   do_hang
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678  /* now 16*4=64 */
+   .   = _start + 64
 #else
ldr pc, _undefined_instruction
ldr pc, _software_interrupt
@@ -362,12 +346,7 @@ cpu_init_crit:
 /*
  * exception handlers
  */
-#ifdef CONFIG_ONENAND_IPL
-   .align  5
-do_hang:
-   ldr sp, _TEXT_BASE  /* use 32 words about stack */
-   bl  hang/* hang and never return */
-#else  /* !CONFIG_ONENAND IPL */
+#ifndef CONFIG_ONENAND_IPL
.align  5
 undefined_instruction:
get_bad_stack
diff --git a/onenand_ipl/onenand_boot.c b/onenand_ipl/onenand_boot.c
index aff62d2..04735e7 100644
--- a/onenand_ipl/onenand_boot.c
+++ b/onenand_ipl/onenand_boot.c
@@ -28,54 +28,17 @@
 
 #include onenand_ipl.h
 
-#ifdef CONFIG_SYS_PRINTF
-int print_info(void)
-{
-   printf(XLOADER_VERSION);
-
-   return 0;
-}
-#endif
-
 typedef int (init_fnc_t)(void);
 
-init_fnc_t *init_sequence[] = {
-   board_init, /* basic board dependent setup */
-#ifdef CONFIG_SYS_PRINTF
-   serial_init,/* serial communications setup */
-   print_info,
-#endif
-   NULL,
-};
-
 void start_oneboot(void)
 {
-   init_fnc_t **init_fnc_ptr;
uchar *buf;
 
-   for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
-   if ((*init_fnc_ptr)() != 0)
-   hang();
-   }
-
buf = (uchar *) CONFIG_SYS_LOAD_ADDR;
 
-   if (!onenand_read_block0(buf))
-   buf += ONENAND_BLOCK_SIZE;
-
-   if (buf == (uchar *)CONFIG_SYS_LOAD_ADDR)
-   hang();
+   onenand_read_block0(buf);
 
-   /* go run U-Boot and never return */
-   printf(Starting OS Bootloader...\n);
((init_fnc_t *)CONFIG_SYS_LOAD_ADDR)();
 
/* should never come here */
 }
-
-void hang(void)
-{
-   /* if board_hang() returns, hange here */
-   printf(X-Loader hangs\n);
-   for (;;);
-}
diff --git a/onenand_ipl/onenand_ipl.h b/onenand_ipl/onenand_ipl.h
index 3387998..57e54f5 100644
--- a/onenand_ipl/onenand_ipl.h
+++ b/onenand_ipl/onenand_ipl.h
@@ -23,12 +23,6 @@
 
 #include linux/mtd/onenand_regs.h
 
-#define ONENAND_BLOCK_SIZE  2048
-
-#ifndef CONFIG_SYS_PRINTF
-#define printf(format, args...)
-#endif
-
 #define onenand_readw(a)readw(a)
 #define onenand_writew(v, a)writew(v, a)
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Can build with only jffs2 cmdline support

2009-03-02 Thread Kyungmin Park
On Sat, Feb 28, 2009 at 11:20 PM, Wolfgang Denk w...@denx.de wrote:
 Dear Kyungmin Park,

 In message 20090227085736.ga5...@july you wrote:
 Some program such as UBI only used the mtdpart only.
 however current jffs2 cmdline has dependent with jffs2 cmd
 This patch make a build only jffs2 cmdline without jffs2 cmd dependency.

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 diff --git a/common/Makefile b/common/Makefile
 index f13cd11..18d76fa 100644
 --- a/common/Makefile
 +++ b/common/Makefile
 @@ -98,6 +98,7 @@ COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o
  COBJS-$(CONFIG_CMD_IRQ) += cmd_irq.o
  COBJS-$(CONFIG_CMD_ITEST) += cmd_itest.o
  COBJS-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o
 +COBJS-$(CONFIG_JFFS2_CMDLINE) += cmd_jffs2.o

 I think both the patch descriptin and the new CONFIG_JFFS2_CMDLINE
 variable name are misleading - additionally, CONFIG_JFFS2_CMDLINE
 needs to be documented in  the READMe.


Yes it's right. the name is misleading. however I just leaved as
before and generate patch at this time.
Since I don't want to break the existing configurations.

Now I separate mtdpart command from jffs2. I will post it.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Fix OneNAND ipl to read 256KB

2009-03-04 Thread Kyungmin Park
On Thu, Mar 5, 2009 at 12:09 AM, Rohit Hagargundgi h.ro...@samsung.com wrote:
 Hi,

 Here is the updated patch.

 Thanks,
 Rohit

 Signed-off-by: Rohit Hagargundgi h.ro...@samsung.com
 ---
  include/configs/apollon.h  |    1 +
  onenand_ipl/onenand_read.c |   27 ---
  2 files changed, 21 insertions(+), 7 deletions(-)

 diff --git a/include/configs/apollon.h b/include/configs/apollon.h
 index dff47fc..2e8198f 100644
 --- a/include/configs/apollon.h
 +++ b/include/configs/apollon.h
 @@ -254,6 +254,7 @@

  /* OneNAND boot, OneNAND has CS0, NOR boot ONeNAND has CS2 */
  #define       CONFIG_SYS_ONENAND_BASE 0x
 +#define CONFIG_SYS_MONITOR_LEN         SZ_256K /* U-Boot image size */
  #define       CONFIG_ENV_IS_IN_ONENAND        1
  #define CONFIG_ENV_ADDR               0x0002

 diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
 index 6d04943..6782eac 100644
 --- a/onenand_ipl/onenand_read.c
 +++ b/onenand_ipl/onenand_read.c
 @@ -72,6 +72,10 @@ static inline int onenand_read_page(ulong block, ulong 
 page,
        while (!(READ_INTERRUPT()  ONENAND_INT_READ))
                continue;

 +       /* Check for invalid block mark*/
 +       if (page  2  (onenand_readw(THIS_ONENAND(ONENAND_SPARERAM)) != 
 0x))
 +               return 1;
 +

No need to check invalid block. Note that block 0 is always good
block. no exception.
Now you assume block 1 can be invalid block. If true just skip it.
when update bootloader at u-boot or kernel.
there's bad block at block 1. it will skip write. it means bootloader
are located at block 0 and block 2.

  #ifdef __HAVE_ARCH_MEMCPY32
        /* 32 bytes boundary memory copy */
        memcpy32(buf, base, pagesize);
 @@ -94,20 +98,29 @@ static inline int onenand_read_page(ulong block, ulong 
 page,
   */
  int onenand_read_block0(unsigned char *buf)
  {
 -       int page, offset = 0;
 +       int block = 0, page, offset = 0;
        int pagesize = ONENAND_PAGE_SIZE;
 +       int nblocks = CONFIG_SYS_MONITOR_LEN / (ONENAND_PAGES_PER_BLOCK * 
 ONENAND_PAGE_SIZE);

        /* MLC OneNAND has 4KiB page size */
 -       if (onenand_readw(THIS_ONENAND(ONENAND_REG_TECHNOLOGY)))
 +       if (onenand_readw(THIS_ONENAND(ONENAND_REG_TECHNOLOGY))) {
                pagesize = 1;
 +               nblocks = (nblocks + 1)  1;
 +       }

        /* NOTE: you must read page from page 1 of block 0 */
        /* read the block page by page*/
 -       for (page = ONENAND_START_PAGE;
 -           page  ONENAND_PAGES_PER_BLOCK; page++) {
 -
 -               onenand_read_page(0, page, buf + offset, pagesize);
 -               offset += pagesize;
 +       page = ONENAND_START_PAGE;
 +       for (; block  nblocks; block++) {
 +               for (; page  ONENAND_PAGES_PER_BLOCK; page++) {
 +                       if (onenand_read_page(block, page, buf + offset, 
 pagesize)) {
 +                               /* This block is bad. Skip it and read next 
 block */
 +                               nblocks++;
 +                               break;
 +                       }
 +                       offset += pagesize;
 +               }
 +               page = 0;
        }

        return 0;

NAK, please use previous one as I sent.
In Flex-OneNAND block 0 has 256KiB. need to handle at here how many
blocks are needed.
I also want to use CONFIG_ONENAND_END_BLOCK since we don't know which
OneNAND or Flex-OneNAND are attached to apollon board.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Seperate mtdpart command from jffs2

2009-03-08 Thread Kyungmin Park
On Fri, Mar 6, 2009 at 10:13 PM, Stefan Roese s...@denx.de wrote:
 Hi Kyungmin,

 On Tuesday 03 March 2009, Kyungmin Park wrote:
 Some program such as UBI only used the mtdpart only.
 however current jffs2 cmdline has dependent with jffs2 cmd
 This patch make a build only jffs2 cmdline without jffs2 cmd dependency.

 I tried to rephrase this description a little bit:

 
 Currently the mtdparts commands are included in the jffs2 command support.
 This doesn't make sense anymore since other commands (e.g. UBI) use this
 infrastructure as well now. This patch separates the mtdparts commands from
 the jffs2 commands making it possible to only select mtdparts when no JFFS2
 support is needed.
 

 If you don't have any objections I suggest to use this description in your
 next patch version.

 Please find some more comments below.

 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 diff --git a/common/Makefile b/common/Makefile
 index f13cd11..53ca648 100644
 --- a/common/Makefile
 +++ b/common/Makefile
 @@ -98,6 +98,7 @@ COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o
  COBJS-$(CONFIG_CMD_IRQ) += cmd_irq.o
  COBJS-$(CONFIG_CMD_ITEST) += cmd_itest.o
  COBJS-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o
 +COBJS-$(CONFIG_JFFS2_CMDLINE) += cmd_mtdparts.o

 Shouldn't we change this define (CONFIG_JFFS2_CMDLINE) to something else now,
 since it's not really JFFS2 specific anymore? I suggest to change it to
 CONFIG_CMD_MTDPARTS. This seems more logical to me.

 What do you think?

It's already done by Jean-Christophe PLAGNIOL-VILLARD. Isn't it?


 This patch also breaks (at least some) boards with JFFS2 support:

 [ste...@kubuntu u-boot (master)]$ ./MAKEALL fx12mm
 Configuring for fx12mm board...
 cmd_jffs2.c:164: warning: 'device_validate' defined but not used
 cmd_jffs2.c:220: warning: 'id_parse' defined but not used
 common/libcommon.a(cmd_flash.o): In function `do_protect':
 /home/stefan/git/u-boot/u-boot/common/cmd_flash.c:568: undefined reference to
 `id_parse'
 common/libcommon.a(cmd_flash.o): In function `do_flerase':
 /home/stefan/git/u-boot/u-boot/common/cmd_flash.c:362: undefined reference to
 `id_parse'
 make: *** [u-boot] Error 1
 ppc_4xx-size: './u-boot': No such file


 I didn't try to solve this problem (yet). Perhaps you have an idea?

In both case jffs2 and mtdpart, have id_parse as changed to static, so
one of both should be non-static. I think remove static at cmd_jffs2.c

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [ONENAND] Reduce OneNAND IPL code size

2008-10-22 Thread Kyungmin Park
To give more code at lowlevel_init at each boards

Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
---
diff --git a/cpu/arm1136/start.S b/cpu/arm1136/start.S
index e622338..132cc4a 100644
--- a/cpu/arm1136/start.S
+++ b/cpu/arm1136/start.S
@@ -33,23 +33,7 @@
 .globl _start
 _start: b  reset
 #ifdef CONFIG_ONENAND_IPL
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-   ldr pc, _hang
-
-_hang:
-   .word   do_hang
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678
-   .word   0x12345678  /* now 16*4=64 */
+   . = _start + 64 /* now 16*4=64 */
 #else
ldr pc, _undefined_instruction
ldr pc, _software_interrupt
@@ -362,12 +346,7 @@ cpu_init_crit:
 /*
  * exception handlers
  */
-#ifdef CONFIG_ONENAND_IPL
-   .align  5
-do_hang:
-   ldr sp, _TEXT_BASE  /* use 32 words about stack */
-   bl  hang/* hang and never return */
-#else  /* !CONFIG_ONENAND IPL */
+#ifndef CONFIG_ONENAND_IPL
.align  5
 undefined_instruction:
get_bad_stack
diff --git a/onenand_ipl/onenand_boot.c b/onenand_ipl/onenand_boot.c
index aff62d2..2440d8b 100644
--- a/onenand_ipl/onenand_boot.c
+++ b/onenand_ipl/onenand_boot.c
@@ -39,6 +39,7 @@ int print_info(void)
 
 typedef int (init_fnc_t)(void);
 
+#ifdef CONFIG_USE_ONENAND_INIT
 init_fnc_t *init_sequence[] = {
board_init, /* basic board dependent setup */
 #ifdef CONFIG_SYS_PRINTF
@@ -47,24 +48,23 @@ init_fnc_t *init_sequence[] = {
 #endif
NULL,
 };
+#endif
 
 void start_oneboot(void)
 {
-   init_fnc_t **init_fnc_ptr;
uchar *buf;
+#ifdef CONFIG_USE_ONENAND_INIT
+   init_fnc_t **init_fnc_ptr;
 
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0)
hang();
}
+#endif
 
buf = (uchar *) CONFIG_SYS_LOAD_ADDR;
 
-   if (!onenand_read_block0(buf))
-   buf += ONENAND_BLOCK_SIZE;
-
-   if (buf == (uchar *)CONFIG_SYS_LOAD_ADDR)
-   hang();
+   onenand_read_block0(buf);
 
/* go run U-Boot and never return */
printf(Starting OS Bootloader...\n);
@@ -73,9 +73,11 @@ void start_oneboot(void)
/* should never come here */
 }
 
+#ifdef CONFIG_USE_ONENAND_INIT
 void hang(void)
 {
/* if board_hang() returns, hange here */
printf(X-Loader hangs\n);
for (;;);
 }
+#endif
diff --git a/onenand_ipl/onenand_ipl.h b/onenand_ipl/onenand_ipl.h
index 3387998..438e58c 100644
--- a/onenand_ipl/onenand_ipl.h
+++ b/onenand_ipl/onenand_ipl.h
@@ -23,7 +23,7 @@
 
 #include linux/mtd/onenand_regs.h
 
-#define ONENAND_BLOCK_SIZE  2048
+#define ONENAND_BLOCK_SIZE  0x2
 
 #ifndef CONFIG_SYS_PRINTF
 #define printf(format, args...)
@@ -39,5 +39,5 @@
 
 #define ONENAND_PAGE_SIZE   2048
 
-extern int onenand_read_block0(unsigned char *buf);
+extern void onenand_read_block0(unsigned char *buf);
 #endif
diff --git a/onenand_ipl/onenand_read.c b/onenand_ipl/onenand_read.c
index 6d04943..38703fb 100644
--- a/onenand_ipl/onenand_read.c
+++ b/onenand_ipl/onenand_read.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2005-2008 Samsung Electronis
+ * (C) Copyright 2005-2008 Samsung Electronics
  * Kyungmin Park [EMAIL PROTECTED]
  *
  * See file CREDITS for list of people who contributed to this
@@ -87,14 +87,16 @@ static inline int onenand_read_page(ulong block, ulong page,
 
 #define ONENAND_START_PAGE 1
 #define ONENAND_PAGES_PER_BLOCK64
+#ifndef CONFIG_ONENAND_END_BLOCK
+#define CONFIG_ONENAND_END_BLOCK   1
+#endif
 
 /**
  * onenand_read_block - Read a block data to buf
- * @return 0 on success
  */
-int onenand_read_block0(unsigned char *buf)
+void onenand_read_block0(unsigned char *buf)
 {
-   int page, offset = 0;
+   int block, page, offset = 0;
int pagesize = ONENAND_PAGE_SIZE;
 
/* MLC OneNAND has 4KiB page size */
@@ -103,12 +105,12 @@ int onenand_read_block0(unsigned char *buf)
 
/* NOTE: you must read page from page 1 of block 0 */
/* read the block page by page*/
-   for (page = ONENAND_START_PAGE;
-   page  ONENAND_PAGES_PER_BLOCK; page++) {
-
-   onenand_read_page(0, page, buf + offset, pagesize);
-   offset += pagesize;
+   page = ONENAND_START_PAGE;
+   for (block = 0; block  CONFIG_ONENAND_END_BLOCK; block++) {
+   for (; page  ONENAND_PAGES_PER_BLOCK; page++) {
+   onenand_read_page(block, page, buf + offset, pagesize);
+   offset += pagesize;
+   }
+   page = 0;
}
-
-   return 0

Re: [U-Boot] [PATCH] [ARM] Move machine specific code to board at s3c64xx

2008-10-23 Thread Kyungmin Park
On Thu, Oct 23, 2008 at 4:39 PM, Guennadi Liakhovetski [EMAIL PROTECTED] 
wrote:
 On Wed, 22 Oct 2008, Kyungmin Park wrote:

 Move machine specific code to smdk6400.
 Some board use OneNAND instead of NAND.

 Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
 ---
 diff --git a/board/samsung/smdk6400/lowlevel_init.S 
 b/board/samsung/smdk6400/lowlevel_init.S
 index e0119a7..53d9125 100644
 --- a/board/samsung/smdk6400/lowlevel_init.S
 +++ b/board/samsung/smdk6400/lowlevel_init.S
 @@ -104,6 +104,13 @@ lowlevel_init:
   bl nand_asm_init
  #endif

 + /* Memory subsystem address 0x7e00f120 */
 + ldr r0, =ELFIN_MEM_SYS_CFG
 +
 + /* Xm0CSn2 = NFCON CS0, Xm0CSn3 = NFCON CS1 */
 + mov r1, #0xd
 + str r1, [r0]
 +

 Hm, no, I don't quite agree. In principle, yes, this configuration can be
 considered platform-specific and moving it this way of course works. But:

 1. The patch comment is not correct. This code doesn't select between NAND
   and OneNAND. It selects between (one of) NANDs and SROMs.

Yes I just move to platform since it's board specific.


 2. While at it, we could fix the value being written to the MEM_SYS_CFG
   register too. Currently it writes 0xd =

  (1  0) - ignored, default 0, so, better set it to 0
 | (0  1) - set Xm0CSn[2] to OneNANDC CS0 or NFCON CS0
 | (1  2) - ignored, default 0, so, better set it to 0
 | (1  3) - set Xm0CSn[3] to SROMC CS3

 So, we should just write an 8 in it:

 +   mov r1, #0x8
 +   str r1, [r0]

 3. The comment in the code doesn't look right. According to the above it
   should read

 +   /* Xm0CSn[2] = OneNANDC CS0 or NFCON CS0, Xm0CSn[3] = SROMC CS3 */

Right, and also add OneNAND  NFCON is depends on XNANDSEL.

As you know mem_ctrl_asm_init is common code and other boards can use
it without board specific codes.

In OneNAND board, it should be set as 0x1002


 The only thing that confuses me, is why the author, belonging to the
 manufacturer of the chip, hasn't done this. Maybe the documentation is
 wrong?


Maybe he missed it. Document is right.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [ONENAND] Reduce OneNAND IPL code size

2008-10-23 Thread Kyungmin Park
On Thu, Oct 23, 2008 at 5:09 PM, Wolfgang Denk [EMAIL PROTECTED] wrote:
 Dear Kyungmin Park,

 In message [EMAIL PROTECTED] you wrote:
 To give more code at lowlevel_init at each boards

 Can you please describe exactly what thgis patch is supposed to do and
 what problem it is supposed to fix?

 I cannot make heads nor tails from your descritpion, sorry.

OneNAND IPL has common codes for RAM init, load data, and jump to 2nd
bootloader, but it's common code used about 300~400 bytes. So board
specific codes, such as lowlevel_init, can't has enough code. It make
a difficult to implement OneNAND IPL.

This patch make this common code as small as possible. and give
lowlevel_init can have more codes.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [ARM] Move machine specific code to board at s3c64xx

2008-10-23 Thread Kyungmin Park
On Thu, Oct 23, 2008 at 5:42 PM, Guennadi Liakhovetski [EMAIL PROTECTED] 
wrote:
 On Thu, 23 Oct 2008, Kyungmin Park wrote:

  In OneNAND board, it should be set as 0x1002
 
  Sorry, do not understand what it. If you mean the MEM_SYS_CFG then I
  also don't understand this. As I quoted from the datasheet above, bit 1
  set to 0 (0  1) is for _both_ - NAND or OneNAND. You suggest to set it
  to 1, which is SROMC CS2. And (1  12) is the data bus width, which also
  doesn't seem to be directly related to the NAND / OneNAND selection. Or
  did you mean another register?
 

 Right, I write wrong value, MEM_SYS_CFG has 0x1000. In OneNAND booting
 mode, MP0_CS_CFG[1] and MP0_CS_CFG[3] are ignored.

 It's not easy to describe since it depends on hardware configuration.
 However, there are not too much configurations

 S3C64XX_MEM_SYS_CFG_NAND0x0008
 S3C64XX_MEM_SYS_CFG_ONENAND 0x1000

 ? I asked above what the bus width has to do with OneNAND selection,
 you didn't reply.

OneNAND has always 16-bit butwidth. there's no exception.


 S3C64XX_MEM_SYS_CFG_MOVINAND 0x

I don't tested boot from MMC. So I don't know which value is right

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   >