summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch')
-rw-r--r--recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch48
1 files changed, 0 insertions, 48 deletions
diff --git a/recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch b/recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch
deleted file mode 100644
index 76c2440..0000000
--- a/recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch
+++ /dev/null
@@ -1,48 +0,0 @@
1The downstream Freescale vendor kernel has a patch that allows determining
2if raw NAND flash mode is provided via a debugfs file. This is not present
3in upstream kernels, but the raw access support was added in the 3.19
4kernel, so we will check the kernel version if we can't find the file.
5
6Upstream-Status: Pending
7
8--- a/src/mtd.c
9+++ b/src/mtd.c
10@@ -34,6 +34,7 @@
11 #include <errno.h>
12 #include <sys/types.h>
13 #include <sys/ioctl.h>
14+#include <sys/utsname.h>
15
16 #include "mtd.h"
17 #include "rand.h"
18@@ -808,15 +809,27 @@ struct mtd_data *mtd_open(const struct m
19 md->cfg = *cfg;
20
21 /* check if use new raw access mode */
22+ /* by looking for debugfs from fsl patch */
23+ md->raw_mode_flag = 0;
24 fp = fopen("/sys/kernel/debug/gpmi-nand/raw_mode", "r");
25 if (!fp) {
26- md->raw_mode_flag = 0;
27- vp(md, "mtd: use legacy raw access mode\n");
28+ /* fallback to kernel version: raw access added in 3.19 */
29+ struct utsname uts;
30+ if (!uname(&uts)) {
31+ int major = 0, minor = 0;
32+ sscanf(uts.release, "%d.%d", &major, &minor);
33+ vp(md, "mtd: Linux %d.%d\n", major, minor);
34+ if ((major << 8 | minor) > (3 << 8 | 18))
35+ md->raw_mode_flag = 1;
36+ }
37 } else {
38 fclose(fp);
39 md->raw_mode_flag = 1;
40- vp(md, "mtd: use new bch layout raw access mode\n");
41 }
42+ if (md->raw_mode_flag)
43+ vp(md, "mtd: use new bch layout raw access mode\n");
44+ else
45+ vp(md, "mtd: use legacy raw access mode\n");
46
47 if (plat_config_data->m_u32UseMultiBootArea) {
48