public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] [ARM] Apollon UBI support
Date: Tue, 21 Oct 2008 12:20:33 +0200	[thread overview]
Message-ID: <20081021102033.GA29256@game.jcrosoft.org> (raw)
In-Reply-To: <20081021091908.GA29310@july>

On 18:19 Tue 21 Oct     , Kyungmin Park wrote:
> If you want to UBI on Apollon, uncomment the CONFIG_SYS_USE_UBI macro
> 
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  board/apollon/Makefile    |    4 ++-
>  board/apollon/ubi.c       |   55 +++++++++++++++++++++++++++++++++++++++++++++
>  include/configs/apollon.h |   27 +++++++++++++++++++--
>  3 files changed, 82 insertions(+), 4 deletions(-)
>  create mode 100644 board/apollon/ubi.c
> 
> 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 0000000..342569d
> --- /dev/null
> +++ b/board/apollon/ubi.c
> @@ -0,0 +1,55 @@
> +/*
> + * board/apollon/ubi.c
> + */
> +
> +#include <common.h>
> +#include <linux/mtd/mtd.h>
> +#include <linux/mtd/partitions.h>
> +#include <jffs2/load_kernel.h>
> +#include <ubi_uboot.h>
> +
> +/* common/cmd_jffs2.c */
> +extern int mtdparts_init(void);
> +extern int find_dev_and_part(const char *id, struct mtd_device **dev,
> +                u8 *part_num, struct part_info **part);
   ^^^^^^^^^^^^^^^^
   whitespace please fix
It will be better to have it in a header?
> +
> +/* drivers/mtd/ubi/build.c */
> +extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
> +extern int ubi_init(void);
It will be better to have it in a header?
> +
> +#ifdef CONFIG_CMD_UBI
please move this to the Makefile
> +
> +int ubi_board_scan(void)
> +{
> +        struct mtd_device *dev;
   ^^^^^^^^
   whitespace please fix
> +        struct part_info *part;
   ^^^^^^^^
   whitespace please fix
> +        struct mtd_partition mtd_part;
   whitespace please fix
   ^^^^^^^^
> +        char buffer[32];
   ^^^^^^^^
   whitespace please fix
> +        u8 pnum;
   ^^^^^^^^
   whitespace please fix
> +        int err;
   ^^^^^^^^
   whitespace please fix
> +
> +        if (mtdparts_init() !=0)
   ^^^^^^^^
   whitespace please fix
> +                return 1;
   ^^^^^^^^^^^^^^^^
   whitespace please fix
> +
> +        if (find_dev_and_part("onenand0,4", &dev, &pnum, &part) != 0)
   ^^^^^^^^
   whitespace please fix
> +                return 1;
   ^^^^^^^^^^^^^^^^
   whitespace please fix
> +
> +        printf("%s[%d] pnum %d\n", __func__, __LINE__, pnum);
   ^^^^^^^^
   whitespace please fix
> +        sprintf(buffer, "mtd=%d", pnum);
   ^^^^^^^^
   whitespace please fix
> +        mtd_part.name = buffer;
   ^^^^^^^^
   whitespace please fix
> +        mtd_part.size = part->size;
   ^^^^^^^^
   whitespace please fix
> +        mtd_part.offset = part->offset;
   ^^^^^^^^
   whitespace please fix
> +        add_mtd_partitions(&onenand_mtd, &mtd_part, 1);
   ^^^^^^^^
   whitespace please fix
> +
> +        err = ubi_mtd_param_parse(buffer, NULL);
   ^^^^^^^^
   whitespace please fix
> +        if (err)
   ^^^^^^^^
   whitespace please fix
> +                return err;
   whitespace please fix
> +
> +        err = ubi_init();
   ^^^^^^^^
   whitespace please fix
> +        if (err)
   ^^^^^^^^
   whitespace please fix
> +                return err;
   ^^^^^^^^^^^^^^^^
   whitespace please fix
> +
> +        return 0;
   ^^^^^^^^
   whitespace please fix
> +}
> +
> +#endif
> diff --git a/include/configs/apollon.h b/include/configs/apollon.h
> index d71ed44..3377f60 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 */
>  
>  #define	V_SCLK	12000000
> @@ -73,7 +76,7 @@
>   * Size of malloc() pool
>   */
>  #define	CONFIG_ENV_SIZE SZ_128K	/* Total Size of Environment Sector */
> -#define	CONFIG_SYS_MALLOC_LEN	(CONFIG_ENV_SIZE + SZ_128K)
> +#define	CONFIG_SYS_MALLOC_LEN	(CONFIG_ENV_SIZE + SZ_1M)
>  #define	CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for initial data */
>  
>  /*
> @@ -116,6 +119,12 @@
>  #define	CONFIG_CMD_DIAG
>  #define	CONFIG_CMD_ONENAND
>  
> +#ifdef CONFIG_SYS_USE_UBI
> +#define	CONFIG_CMD_JFFS2
> +#define	CONFIG_CMD_UBI
> +#define	CONFIG_RBTREE
> +#endif
> +
>  #undef	CONFIG_CMD_AUTOSCRIPT
>  
>  #ifndef	CONFIG_SYS_USE_NOR
> @@ -134,9 +143,9 @@
>  #define	CONFIG_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"
> +# 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"
too long please split
>  #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"
ditto
>  #endif
>  
>  #define	CONFIG_EXTRA_ENV_SETTINGS					\
> @@ -151,6 +160,7 @@
>  	"oneboot=onenand read 0x80008000 0x40000 0x200000; go 0x80008000\0"\
>  	"onesyncboot=run syncmode oneboot\0"				\
>  	"updateb=tftp 0x80180000 u-boot-onenand.bin; onenand erase 0x0 0x20000; onenand write 0x80180000 0x0 0x20000\0"					\
ditto
> +	"ubi=setenv bootargs ${bootargs} ubi.mtd=4 ${mtdparts}; run uImage\0" \
>  	"bootcmd=run uboot\0"
>  
>  /*
> @@ -228,4 +238,15 @@
>  #define	CONFIG_ENV_IS_IN_ONENAND	1
>  #define CONFIG_ENV_ADDR		0x00020000
>  
> +#ifdef CONFIG_SYS_USE_UBI
> +#define CONFIG_JFFS2_CMDLINE
> +#define MTDIDS_DEFAULT		"onenand0=onenand"
> +#define MTDPARTS_DEFAULT	"mtdparts=onenand:128k(bootloader),"	\
> +					"128k(params),"			\
> +					"2m(kernel),"			\
> +					"16m(rootfs),"			\
> +					"32m(fs),"			\
> +					"-(ubifs)"
> +#endif
> +
>  #endif /* __CONFIG_H */
> -- 
Best Regards,
J.

  reply	other threads:[~2008-10-21 10:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21  9:19 [U-Boot] [PATCH] [ARM] Apollon UBI support Kyungmin Park
2008-10-21 10:20 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2008-10-21 10:27 ` Wolfgang Denk
2008-10-22  0:17   ` Kyungmin Park
2008-10-22  0:30     ` Ben Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081021102033.GA29256@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox