Commit 3607e0f86f592a649948c940fd7acc4f51f1e000

Authored by Ladislav Michl
Committed by Tom Rini
1 parent a96c08f509

igep003x: UBIize

Convert IGEP board to use UBI volumes for U-Boot, its environment and
kernel. With exception of first four sectors read by SoC BootROM whole
NAND is UBI managed.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Heiko Schocher<hs@denx.de>
Tested-by: Pau Pajuelo <ppajuel@gmail.com>

Showing 3 changed files with 48 additions and 18 deletions Side-by-side Diff

board/isee/igep003x/board.c
... ... @@ -23,6 +23,9 @@
23 23 #include <i2c.h>
24 24 #include <miiphy.h>
25 25 #include <cpsw.h>
  26 +#include <fdt_support.h>
  27 +#include <mtd_node.h>
  28 +#include <jffs2/load_kernel.h>
26 29 #include "board.h"
27 30  
28 31 DECLARE_GLOBAL_DATA_PTR;
... ... @@ -103,6 +106,20 @@
103 106  
104 107 return 0;
105 108 }
  109 +
  110 +#ifdef CONFIG_OF_BOARD_SETUP
  111 +int ft_board_setup(void *blob, bd_t *bd)
  112 +{
  113 +#ifdef CONFIG_FDT_FIXUP_PARTITIONS
  114 + static struct node_info nodes[] = {
  115 + { "ti,omap2-nand", MTD_DEV_TYPE_NAND, },
  116 + };
  117 +
  118 + fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
  119 +#endif
  120 + return 0;
  121 +}
  122 +#endif
106 123  
107 124 #if defined(CONFIG_DRIVER_TI_CPSW)
108 125 static void cpsw_control(int enabled)
configs/am335x_igep0033_defconfig
... ... @@ -14,6 +14,7 @@
14 14 CONFIG_SPL_FAT_SUPPORT=y
15 15 CONFIG_SPL_POWER_SUPPORT=y
16 16 CONFIG_SPL_STACK_R_ADDR=0x82000000
  17 +CONFIG_OF_BOARD_SETUP=y
17 18 CONFIG_SYS_EXTRA_OPTIONS="MACH_TYPE=MACH_TYPE_IGEP0033"
18 19 CONFIG_SYS_CONSOLE_INFO_QUIET=y
19 20 CONFIG_VERSION_VARIABLE=y
20 21  
21 22  
... ... @@ -42,10 +43,13 @@
42 43 CONFIG_CMD_EXT4_WRITE=y
43 44 CONFIG_CMD_FAT=y
44 45 CONFIG_CMD_FS_GENERIC=y
  46 +CONFIG_CMD_UBI=y
45 47 CONFIG_ISO_PARTITION=y
46 48 CONFIG_EFI_PARTITION=y
47 49 CONFIG_MMC_OMAP_HS=y
  50 +CONFIG_MTD_UBI_FASTMAP=y
48 51 CONFIG_SYS_NS16550=y
49 52 CONFIG_OF_LIBFDT=y
  53 +CONFIG_FDT_FIXUP_PARTITIONS=y
50 54 # CONFIG_GENERATE_SMBIOS_TABLE is not set
include/configs/am335x_igep003x.h
... ... @@ -21,7 +21,7 @@
21 21 #define V_OSCK 24000000 /* Clock output from T2 */
22 22 #define V_SCLK (V_OSCK)
23 23  
24   -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */
  24 +#define CONFIG_ENV_SIZE (96 << 10) /* 96 KiB */
25 25  
26 26 /* Make the verbose messages from UBI stop printing */
27 27 #define CONFIG_UBI_SILENCE_MSG
28 28  
... ... @@ -67,11 +67,11 @@
67 67 "fi;\0" \
68 68 "mtdids=" MTDIDS_DEFAULT "\0" \
69 69 "mtdparts=" MTDPARTS_DEFAULT "\0" \
70   - "nandroot=ubi0:filesystem rw ubi.mtd=3,2048\0" \" \
  70 + "nandroot=ubi0:rootfs rw ubi.mtd=1\0" \" \
71 71 "nandrootfstype=ubifs rootwait\0" \
72   - "nandload=ubi part filesystem 2048; ubifsmount ubi0; " \
73   - "ubifsload ${loadaddr} ${bootdir}/${bootfile}; " \
74   - "ubifsload ${fdtaddr} ${bootdir}/${dtbfile} \0" \
  72 + "nandload=ubi part UBI; " \
  73 + "ubi read ${loadaddr} kernel; " \
  74 + "ubi read ${fdtaddr} dtb \0" \
75 75 "nandargs=setenv bootargs console=${console} " \
76 76 "${optargs} " \
77 77 "root=${nandroot} " \
... ... @@ -97,12 +97,6 @@
97 97 /* NAND support */
98 98 #define CONFIG_NAND_OMAP_ELM
99 99 #define CONFIG_SYS_NAND_ONFI_DETECTION 1
100   -#define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */
101   -#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
102   -#define CONFIG_ENV_IS_IN_NAND
103   -#define CONFIG_ENV_OFFSET 0x180000 /* environment starts here */
104   -#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_OFFSET + CONFIG_SYS_ENV_SECT_SIZE)
105   -#define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
106 100  
107 101 #define CONFIG_MTD_PARTITIONS
108 102 #define CONFIG_MTD_DEVICE
109 103  
... ... @@ -110,13 +104,32 @@
110 104 #define CONFIG_LZO
111 105  
112 106 #define MTDIDS_DEFAULT "nand0=omap2-nand.0"
113   -#define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:512k(spl),"\
114   - "1m(uboot),256k(environment),"\
115   - "-(filesystem)"
  107 +#define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:512k(SPL),-(UBI)"
116 108  
117 109 /* SPL */
118 110 #define CONFIG_SPL_LDSCRIPT "arch/arm/mach-omap2/am33xx/u-boot-spl.lds"
119 111  
  112 +/* UBI configuration */
  113 +#define CONFIG_SPL_UBI 1
  114 +#define CONFIG_SPL_UBI_MAX_VOL_LEBS 256
  115 +#define CONFIG_SPL_UBI_MAX_PEB_SIZE (256*1024)
  116 +#define CONFIG_SPL_UBI_MAX_PEBS 4096
  117 +#define CONFIG_SPL_UBI_VOL_IDS 8
  118 +#define CONFIG_SPL_UBI_LOAD_MONITOR_ID 0
  119 +#define CONFIG_SPL_UBI_LOAD_KERNEL_ID 3
  120 +#define CONFIG_SPL_UBI_LOAD_ARGS_ID 4
  121 +#define CONFIG_SPL_UBI_PEB_OFFSET 4
  122 +#define CONFIG_SPL_UBI_VID_OFFSET 512
  123 +#define CONFIG_SPL_UBI_LEB_START 2048
  124 +#define CONFIG_SPL_UBI_INFO_ADDR 0x88080000
  125 +
  126 +/* environment organization */
  127 +#define CONFIG_ENV_IS_IN_UBI 1
  128 +#define CONFIG_ENV_UBI_PART "UBI"
  129 +#define CONFIG_ENV_UBI_VOLUME "config"
  130 +#define CONFIG_ENV_UBI_VOLUME_REDUND "config_r"
  131 +
  132 +/* NAND config */
120 133 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
121 134 #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
122 135 CONFIG_SYS_NAND_PAGE_SIZE)
... ... @@ -135,10 +148,6 @@
135 148 #define CONFIG_SYS_NAND_ECCSIZE 512
136 149 #define CONFIG_SYS_NAND_ECCBYTES 14
137 150 #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
138   -
139   -#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
140   -
141   -#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000
142 151  
143 152 #endif /* ! __CONFIG_IGEP003X_H */