aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/kobs-ng/patches
diff options
context:
space:
mode:
Diffstat (limited to 'package/boot/kobs-ng/patches')
-rw-r--r--package/boot/kobs-ng/patches/001-compile.patch (renamed from package/boot/kobs-ng/patches/003-missing_include.patch)5
-rw-r--r--package/boot/kobs-ng/patches/001-fix-mtd-defines.patch76
-rw-r--r--package/boot/kobs-ng/patches/002-add-init-size-param.patch13
-rw-r--r--package/boot/kobs-ng/patches/003-raw-mode.patch45
-rw-r--r--package/boot/kobs-ng/patches/004-fix-cal_nfc_geometry.patch27
-rw-r--r--package/boot/kobs-ng/patches/004-gnu_source.patch10
6 files changed, 84 insertions, 92 deletions
diff --git a/package/boot/kobs-ng/patches/003-missing_include.patch b/package/boot/kobs-ng/patches/001-compile.patch
index b91c0509da..67da93a324 100644
--- a/package/boot/kobs-ng/patches/003-missing_include.patch
+++ b/package/boot/kobs-ng/patches/001-compile.patch
@@ -10,8 +10,11 @@
#include <errno.h>
--- a/src/mtd.h
+++ b/src/mtd.h
-@@ -27,6 +27,7 @@
+@@ -25,8 +25,10 @@
+ #ifndef MTD_H
+ #define MTD_H
++#define _GNU_SOURCE
#include <mtd/mtd-user.h>
#include <endian.h>
+#include <fcntl.h>
diff --git a/package/boot/kobs-ng/patches/001-fix-mtd-defines.patch b/package/boot/kobs-ng/patches/001-fix-mtd-defines.patch
deleted file mode 100644
index 6fdc735e06..0000000000
--- a/package/boot/kobs-ng/patches/001-fix-mtd-defines.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-From: Paul B. Henson <henson@acm.org>
-
-Newer kernel headers renamed mtd mode defines and no longer support
-MEMSETOOBSEL. Allow code to work with both older and newer kernel
-versions.
-
-Signed-off-by: Paul B. Henson <henson@acm.org>
----
-
-http://git.buildroot.net/buildroot/plain/package/kobs-ng/kobs-ng-fix-mtd-defines.patch
-
---- a/src/mtd.c
-+++ b/src/mtd.c
-@@ -852,8 +852,11 @@ void mtd_close(struct mtd_data *md)
- mp = &md->part[i];
-
- if (mp->fd != -1) {
-+/* Newer kernels dropped MEMSETOOBSEL */
-+#ifdef MEMSETOOBSEL
- (void)ioctl(mp->fd, MEMSETOOBSEL,
- &mp->old_oobinfo);
-+#endif
- close(mp->fd);
- }
-
-@@ -896,6 +899,8 @@ int mtd_set_ecc_mode(struct mtd_data *md
- continue;
- }
-
-+/* Newer kernels dropped MEMSETOOBSEL */
-+#ifdef MEMSETOOBSEL
- if (r == -ENOTTY) {
- r = ioctl(mp->fd, MEMSETOOBSEL, &mp->old_oobinfo);
- if (r != 0) {
-@@ -904,6 +909,7 @@ int mtd_set_ecc_mode(struct mtd_data *md
- }
- mp->oobinfochanged = 0;
- }
-+#endif
- } else {
- r = ioctl(mp->fd, MTDFILEMODE, (void *)MTD_MODE_RAW);
- if (r != 0 && r != -ENOTTY) {
-@@ -911,6 +917,8 @@ int mtd_set_ecc_mode(struct mtd_data *md
- continue;
- }
-
-+/* Newer kernels dropped MEMSETOOBSEL */
-+#ifdef MEMSETOOBSEL
- if (r == -ENOTTY) {
- r = ioctl(mp->fd, MEMSETOOBSEL, &none_oobinfo);
- if (r != 0) {
-@@ -920,6 +928,7 @@ int mtd_set_ecc_mode(struct mtd_data *md
- mp->oobinfochanged = 1;
- } else
- mp->oobinfochanged = 2;
-+#endif
- }
-
- mp->ecc = ecc;
---- a/src/mtd.h
-+++ b/src/mtd.h
-@@ -31,6 +31,14 @@
- #include "BootControlBlocks.h"
- #include "rom_nand_hamming_code_ecc.h"
-
-+// Newer kernel headers renamed define
-+#ifndef MTD_MODE_NORMAL
-+#define MTD_MODE_NORMAL MTD_FILE_MODE_NORMAL
-+#endif
-+#ifndef MTD_MODE_RAW
-+#define MTD_MODE_RAW MTD_FILE_MODE_RAW
-+#endif
-+
- //------------------------------------------------------------------------------
- // Re-definitions of true and false, because the standard ones aren't good
- // enough?
diff --git a/package/boot/kobs-ng/patches/002-add-init-size-param.patch b/package/boot/kobs-ng/patches/002-add-init-size-param.patch
index e0e89b2aec..8ad34e9e71 100644
--- a/package/boot/kobs-ng/patches/002-add-init-size-param.patch
+++ b/package/boot/kobs-ng/patches/002-add-init-size-param.patch
@@ -1,3 +1,6 @@
+Add --chip_0_size param to override the size of the mtd partition which is
+required if the SPL does not occupy the entire partition. For Gateworks
+Ventana boards the 'uboot' partition contains both the SPL and uboot.
--- a/src/main.c
+++ b/src/main.c
@@ -94,6 +94,7 @@ void usage(void)
@@ -10,7 +13,7 @@
" --data_hold_time=<value> ............. NCB field (default 60)\n"
--- a/src/mtd.c
+++ b/src/mtd.c
-@@ -716,6 +716,11 @@ struct mtd_data *mtd_open(const struct m
+@@ -876,6 +876,11 @@ struct mtd_data *mtd_open(const struct m
goto out;
}
@@ -20,9 +23,9 @@
+ }
+
/* verify it's a nand */
- if (miu->type != MTD_NANDFLASH) {
- fprintf(stderr, "mtd: device %s not NAND\n", mp->name);
-@@ -2914,7 +2919,7 @@ static const struct {
+ if (miu->type != MTD_NANDFLASH
+ && miu->type != MTD_MLCNANDFLASH) {
+@@ -3385,7 +3390,7 @@ static const struct {
} mtd_int_args[] = {
ARG_IGNORE(chip_count),
ARG_IGNORE(chip_0_offset),
@@ -31,7 +34,7 @@
ARG_IGNORE(chip_1_offset),
ARG_IGNORE(chip_1_size),
ARG(search_exponent),
-@@ -3107,7 +3112,7 @@ void mtd_cfg_dump(struct mtd_config *cfg
+@@ -3578,7 +3583,7 @@ void mtd_cfg_dump(struct mtd_config *cfg
// Pd(chip_count);
Ps(chip_0_device_path);
// Pd(chip_0_offset);
diff --git a/package/boot/kobs-ng/patches/003-raw-mode.patch b/package/boot/kobs-ng/patches/003-raw-mode.patch
new file mode 100644
index 0000000000..5a3be5f058
--- /dev/null
+++ b/package/boot/kobs-ng/patches/003-raw-mode.patch
@@ -0,0 +1,45 @@
+The downstream Freescale vendor kernel has a patch that allows determining
+if raw NAND flash mode is provided via a debugfs file. This is not present
+in upstream kernels, but the raw access support was added in the 3.19
+kernel, so we will check the kernel version if we can't find the file.
+--- a/src/mtd.c
++++ b/src/mtd.c
+@@ -34,6 +34,7 @@
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <sys/ioctl.h>
++#include <sys/utsname.h>
+
+ #include "mtd.h"
+ #include "rand.h"
+@@ -808,15 +809,27 @@ struct mtd_data *mtd_open(const struct m
+ md->cfg = *cfg;
+
+ /* check if use new raw access mode */
++ /* by looking for debugfs from fsl patch */
++ md->raw_mode_flag = 0;
+ fp = fopen("/sys/kernel/debug/gpmi-nand/raw_mode", "r");
+ if (!fp) {
+- md->raw_mode_flag = 0;
+- vp(md, "mtd: use legacy raw access mode\n");
++ /* fallback to kernel version: raw access added in 3.19 */
++ struct utsname uts;
++ if (!uname(&uts)) {
++ int major = 0, minor = 0;
++ sscanf(uts.release, "%d.%d", &major, &minor);
++ vp(md, "mtd: Linux %d.%d\n", major, minor);
++ if ((major << 8 | minor) > (3 << 8 | 18))
++ md->raw_mode_flag = 1;
++ }
+ } else {
+ fclose(fp);
+ md->raw_mode_flag = 1;
+- vp(md, "mtd: use new bch layout raw access mode\n");
+ }
++ if (md->raw_mode_flag)
++ vp(md, "mtd: use new bch layout raw access mode\n");
++ else
++ vp(md, "mtd: use legacy raw access mode\n");
+
+ if (plat_config_data->m_u32UseMultiBootArea) {
+
diff --git a/package/boot/kobs-ng/patches/004-fix-cal_nfc_geometry.patch b/package/boot/kobs-ng/patches/004-fix-cal_nfc_geometry.patch
new file mode 100644
index 0000000000..ebfd62345c
--- /dev/null
+++ b/package/boot/kobs-ng/patches/004-fix-cal_nfc_geometry.patch
@@ -0,0 +1,27 @@
+The Freescale downstream vendor kernel has a patch that exports the bch
+flash geometry via a debugfs file. This is not available in mainline linux
+kernels so the fallback method calculates the geometry based on known info
+from the mtd partition. A bug exists in this funcion where it fails to
+assume that block0 ECC is the same as the other blocks by default.
+--- a/src/mtd.c
++++ b/src/mtd.c
+@@ -610,7 +610,7 @@ static int cal_nfc_geometry(struct mtd_d
+ /* The two are fixed, please change them when the driver changes. */
+ geo->metadata_size_in_bytes = 10;
+ geo->gf_len = 13;
+- geo->ecc_chunkn_size_in_bytes = 512;
++ geo->ecc_chunkn_size_in_bytes = geo->ecc_chunk0_size_in_bytes = 512;
+
+ if (mtd->oobsize > geo->ecc_chunkn_size_in_bytes) {
+ geo->gf_len = 14;
+@@ -700,8 +700,9 @@ int parse_nfc_geometry(struct mtd_data *
+ unsigned int value;
+
+ if (!plat_config_data->m_u32UseNfcGeo) {
++ /* fsl kernel patch provides bch_geometry via debugfs */
+ if (!(node = fopen(dbg_geometry_node_path, "r"))) {
+- fprintf(stderr, "Cannot open BCH geometry node: \"%s\"",
++ fprintf(stderr, "Cannot open BCH geometry node: \"%s\"\n",
+ dbg_geometry_node_path);
+ return cal_nfc_geometry(md);
+ }
diff --git a/package/boot/kobs-ng/patches/004-gnu_source.patch b/package/boot/kobs-ng/patches/004-gnu_source.patch
deleted file mode 100644
index 3e94c92e1c..0000000000
--- a/package/boot/kobs-ng/patches/004-gnu_source.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/src/plat_boot_config.c
-+++ b/src/plat_boot_config.c
-@@ -18,6 +18,7 @@
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-+#define _GNU_SOURCE
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>