diff options
author | Andrea Adami <andrea.adami@gmail.com> | 2018-08-13 10:11:40 +0200 |
---|---|---|
committer | Paul Eggleton <paul.eggleton@linux.intel.com> | 2018-08-21 11:18:12 +1200 |
commit | 3ee3cbfbc09953021cd41ddf8434227ff0633ec7 (patch) | |
tree | 3d838ad00466d4928cc19a700b2ec289a78bc4f0 | |
parent | 4ef8f82e5db28f50901ce87f7ce786675aee6adf (diff) | |
download | meta-handheld-3ee3cbfbc09953021cd41ddf8434227ff0633ec7.tar.gz |
linux-handheld(-kexecboot)_4.4: upgrade to 4.4.147
Get latest fixes for gcc8 builds:
4.4.145 0ca85fc310e8c ARM: fix put_user() for gcc-8
and more warning fixes.
Remove patches upstreamed in 4.4.146
While there, backport the upstreamed (4.16) version of sharpslpart for 4.4.
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
14 files changed, 954 insertions, 689 deletions
diff --git a/recipes-kernel/linux/linux-handheld-4.4/ASoC-pxa-fix-module-autoload-for-platform-drivers.patch b/recipes-kernel/linux/linux-handheld-4.4/ASoC-pxa-fix-module-autoload-for-platform-drivers.patch deleted file mode 100644 index b4cf2c6..0000000 --- a/recipes-kernel/linux/linux-handheld-4.4/ASoC-pxa-fix-module-autoload-for-platform-drivers.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 25b3edd15fef06d8828b70a38b0420d569edc26e Mon Sep 17 00:00:00 2001 -From: Andrea Adami <andrea.adami@gmail.com> -Date: Fri, 6 May 2016 14:27:02 +0200 -Subject: [PATCH 1/1] ASoC: pxa: Fix module autoload for platform drivers - -These platform drivers are lacking MODULE_ALIAS so module autoloading -doesn't work. Tested on corgi and poodle with kernel 4.4. - -Signed-off-by: Andrea Adami <andrea.adami@gmail.com> ---- - sound/soc/pxa/brownstone.c | 1 + - sound/soc/pxa/mioa701_wm9713.c | 1 + - sound/soc/pxa/mmp-pcm.c | 1 + - sound/soc/pxa/mmp-sspa.c | 1 + - sound/soc/pxa/palm27x.c | 1 + - sound/soc/pxa/pxa-ssp.c | 1 + - sound/soc/pxa/pxa2xx-ac97.c | 1 + - sound/soc/pxa/pxa2xx-pcm.c | 1 + - 8 files changed, 8 insertions(+) - -diff --git a/sound/soc/pxa/brownstone.c b/sound/soc/pxa/brownstone.c -index ec522e9..b6cb995 100644 ---- a/sound/soc/pxa/brownstone.c -+++ b/sound/soc/pxa/brownstone.c -@@ -133,3 +133,4 @@ module_platform_driver(mmp_driver); - MODULE_AUTHOR("Leo Yan <leoy@marvell.com>"); - MODULE_DESCRIPTION("ALSA SoC Brownstone"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:brownstone-audio"); -diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c -index 5c8f9db..d1661fa 100644 ---- a/sound/soc/pxa/mioa701_wm9713.c -+++ b/sound/soc/pxa/mioa701_wm9713.c -@@ -207,3 +207,4 @@ module_platform_driver(mioa701_wm9713_driver); - MODULE_AUTHOR("Robert Jarzmik (rjarzmik@free.fr)"); - MODULE_DESCRIPTION("ALSA SoC WM9713 MIO A701"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:mioa701-wm9713"); -diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c -index 51e790d..96df9b2 100644 ---- a/sound/soc/pxa/mmp-pcm.c -+++ b/sound/soc/pxa/mmp-pcm.c -@@ -248,3 +248,4 @@ module_platform_driver(mmp_pcm_driver); - MODULE_AUTHOR("Leo Yan <leoy@marvell.com>"); - MODULE_DESCRIPTION("MMP Soc Audio DMA module"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:mmp-pcm-audio"); -diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c -index eca60c2..ca8b23f 100644 ---- a/sound/soc/pxa/mmp-sspa.c -+++ b/sound/soc/pxa/mmp-sspa.c -@@ -482,3 +482,4 @@ module_platform_driver(asoc_mmp_sspa_driver); - MODULE_AUTHOR("Leo Yan <leoy@marvell.com>"); - MODULE_DESCRIPTION("MMP SSPA SoC Interface"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:mmp-sspa-dai"); -diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c -index 4e74d95..bcc81e9 100644 ---- a/sound/soc/pxa/palm27x.c -+++ b/sound/soc/pxa/palm27x.c -@@ -161,3 +161,4 @@ module_platform_driver(palm27x_wm9712_driver); - MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); - MODULE_DESCRIPTION("ALSA SoC Palm T|X, T5 and LifeDrive"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:palm27x-asoc"); -diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c -index da03fad..3cad990 100644 ---- a/sound/soc/pxa/pxa-ssp.c -+++ b/sound/soc/pxa/pxa-ssp.c -@@ -833,3 +833,4 @@ module_platform_driver(asoc_ssp_driver); - MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); - MODULE_DESCRIPTION("PXA SSP/PCM SoC Interface"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:pxa-ssp-dai"); -diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c -index f3de615..9615e6d 100644 ---- a/sound/soc/pxa/pxa2xx-ac97.c -+++ b/sound/soc/pxa/pxa2xx-ac97.c -@@ -287,3 +287,4 @@ module_platform_driver(pxa2xx_ac97_driver); - MODULE_AUTHOR("Nicolas Pitre"); - MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:pxa2xx-ac97"); -diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c -index 9f39039..410d48b 100644 ---- a/sound/soc/pxa/pxa2xx-pcm.c -+++ b/sound/soc/pxa/pxa2xx-pcm.c -@@ -117,3 +117,4 @@ module_platform_driver(pxa_pcm_driver); - MODULE_AUTHOR("Nicolas Pitre"); - MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:pxa-pcm-audio"); --- -1.9.1 - diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0001-mtd-sharpsl-add-sharpslpart-MTD-partition-parser.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0001-mtd-sharpsl-add-sharpslpart-MTD-partition-parser.patch deleted file mode 100644 index 23406c1..0000000 --- a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0001-mtd-sharpsl-add-sharpslpart-MTD-partition-parser.patch +++ /dev/null @@ -1,510 +0,0 @@ -From a1a11c67f538d1c8bc58506cdba5c5cac6b7477e Mon Sep 17 00:00:00 2001 -From: Andrea Adami <andrea.adami@gmail.com> -Date: Sat, 13 May 2017 01:16:21 +0200 -Subject: [PATCH 1/3] mtd: sharpsl: add sharpslpart MTD partition parser - -The Sharp SL Series (Zaurus) PXA handhelds have 16/64/128M of NAND flash -and share the same layout of the first 7M partition, managed by Sharp FTL. - -The purpose of this self-contained patch is to add a common parser and -remove the hardcoded sizes in the board files (these devices are not yet -converted to devicetree). -Users will have benefits because the mtdparts= tag will not be necessary -anymore and they will be free to repartition the little sized flash. - -The obsolete bootloader can not pass the partitioning info to modern -kernels anymore so it has to be read from flash at known logical addresses. -(see http://www.h5.dion.ne.jp/~rimemoon/zaurus/memo_006.htm ) - -In kernel, under arch/arm/mach-pxa we have already 8 machines: -MACH_POODLE, MACH_CORGI, MACH_SHEPERD, MACH_HUSKY, MACH_AKITA, MACH_SPITZ, -MACH_BORZOI, MACH_TOSA. -Lost after the 2.4 vendor kernel are MACH_BOXER and MACH_TERRIER. - -Almost every model has different factory partitioning: add to this the -units can be repartitioned by users with userspace tools (nandlogical) -and installers for popular (back then) linux distributions. - -The Parameter Area in the first (boot) partition extends from 0x00040000 to -0x0007bfff (176k) and contains two copies of the partition table: -... -0x00060000: Partition Info1 16k -0x00064000: Partition Info2 16k -0x00668000: Model 16k -... - -The first 7M partition is managed by the Sharp FTL reserving 5% + 1 blocks -for wear-leveling: some blocks are remapped and one layer of translation -(logical to physical) is necessary. - -There isn't much documentation about this FTL in the 2.4 sources, just the -MTD methods for reading and writing using logical addresses and the block -management (wear-leveling, use counter). -For the purpose of the MTD parser only the read part of the code was taken. - -The NAND drivers that can use this parser are sharpsl.c and tmio_nand.c. - -Signed-off-by: Andrea Adami <andrea.adami@gmail.com> ---- - drivers/mtd/Kconfig | 8 ++ - drivers/mtd/Makefile | 2 + - drivers/mtd/sharpsl_ftl.c | 219 ++++++++++++++++++++++++++++++++++++++++++++++ - drivers/mtd/sharpsl_ftl.h | 34 +++++++ - drivers/mtd/sharpslpart.c | 146 +++++++++++++++++++++++++++++++ - 5 files changed, 409 insertions(+) - create mode 100644 drivers/mtd/sharpsl_ftl.c - create mode 100644 drivers/mtd/sharpsl_ftl.h - create mode 100644 drivers/mtd/sharpslpart.c - -diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig -index a03ad29..6989bf0 100644 ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -155,6 +155,14 @@ config MTD_BCM47XX_PARTS - This provides partitions parser for devices based on BCM47xx - boards. - -+config MTD_SHARPSL_PARTS -+ tristate "Sharp SL Series NAND flash partition parser" -+ depends on MTD_NAND_SHARPSL || MTD_NAND_TMIO -+ help -+ This provides the read-only FTL logic necessary to read the partition -+ table from the NAND flash of Sharp SL Series (Zaurus) and the MTD -+ partition parser using this code. -+ - comment "User Modules And Translation Layers" - - # -diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile -index 99bb9a1..89f707b 100644 ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -13,6 +13,8 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o -+obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpsl-part.o -+sharpsl-part-objs := sharpsl_ftl.o sharpslpart.o - - # 'Users' - code which presents functionality to userspace. - obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o -diff --git a/drivers/mtd/sharpsl_ftl.c b/drivers/mtd/sharpsl_ftl.c -new file mode 100644 -index 0000000..6b82144 ---- /dev/null -+++ b/drivers/mtd/sharpsl_ftl.c -@@ -0,0 +1,219 @@ -+/* -+ * MTD method for NAND accessing via logical address (SHARP FTL) -+ * -+ * Copyright (C) 2017 Andrea Adami <andrea.adami@gmail.com> -+ * -+ * Based on 2.4 sources: drivers/mtd/nand/sharp_sl_logical.c -+ * Copyright (C) 2002 SHARP -+ * -+ * 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. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/slab.h> -+#include <linux/module.h> -+#include <linux/init.h> -+#include <linux/mtd/mtd.h> -+#include <linux/mtd/partitions.h> -+#include "sharpsl_ftl.h" -+ -+/* oob structure */ -+#define NAND_NOOB_LOGADDR_00 8 -+#define NAND_NOOB_LOGADDR_01 9 -+#define NAND_NOOB_LOGADDR_10 10 -+#define NAND_NOOB_LOGADDR_11 11 -+#define NAND_NOOB_LOGADDR_20 12 -+#define NAND_NOOB_LOGADDR_21 13 -+ -+/* Logical Table */ -+struct mtd_logical { -+ u32 size; /* size of the handled partition */ -+ int index; /* mtd->index */ -+ u_int phymax; /* physical blocks */ -+ u_int logmax; /* logical blocks */ -+ u_int *log2phy; /* the logical-to-physical table */ -+}; -+ -+static struct mtd_logical *sharpsl_mtd_logical; -+ -+/* wrapper */ -+static int sharpsl_nand_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, -+ uint8_t *buf) -+{ -+ loff_t mask = mtd->writesize - 1; -+ struct mtd_oob_ops ops; -+ int ret; -+ -+ ops.mode = MTD_OPS_PLACE_OOB; -+ ops.ooboffs = offs & mask; -+ ops.ooblen = len; -+ ops.oobbuf = buf; -+ ops.datbuf = NULL; -+ -+ ret = mtd_read_oob(mtd, offs & ~mask, &ops); -+ if (ret != 0 || len != ops.oobretlen) -+ return -1; -+ -+ return 0; -+} -+ -+/* utility */ -+static u_int sharpsl_nand_get_logical_num(u_char *oob) -+{ -+ u16 us; -+ int good0, good1; -+ -+ if (oob[NAND_NOOB_LOGADDR_00] == oob[NAND_NOOB_LOGADDR_10] && -+ oob[NAND_NOOB_LOGADDR_01] == oob[NAND_NOOB_LOGADDR_11]) { -+ good0 = NAND_NOOB_LOGADDR_00; -+ good1 = NAND_NOOB_LOGADDR_01; -+ } else if (oob[NAND_NOOB_LOGADDR_10] == oob[NAND_NOOB_LOGADDR_20] && -+ oob[NAND_NOOB_LOGADDR_11] == oob[NAND_NOOB_LOGADDR_21]) { -+ good0 = NAND_NOOB_LOGADDR_10; -+ good1 = NAND_NOOB_LOGADDR_11; -+ } else if (oob[NAND_NOOB_LOGADDR_20] == oob[NAND_NOOB_LOGADDR_00] && -+ oob[NAND_NOOB_LOGADDR_21] == oob[NAND_NOOB_LOGADDR_01]) { -+ good0 = NAND_NOOB_LOGADDR_20; -+ good1 = NAND_NOOB_LOGADDR_21; -+ } else { -+ return UINT_MAX; -+ } -+ -+ us = oob[good0] | oob[good1] << 8; -+ -+ /* parity check */ -+ if (hweight16(us) & 1) -+ return (UINT_MAX - 1); -+ -+ /* reserved */ -+ if (us == 0xffff) -+ return 0xffff; -+ else -+ return (us & 0x07fe) >> 1; -+} -+ -+int sharpsl_nand_init_logical(struct mtd_info *mtd, u32 partition_size) -+{ -+ struct mtd_logical *logical = NULL; -+ u_int block_num, log_num; -+ loff_t block_adr; -+ u_char *oob = NULL; -+ int i, readretry; -+ -+ logical = kzalloc(sizeof(*logical), GFP_KERNEL); -+ if (!logical) -+ return -ENOMEM; -+ -+ oob = kzalloc(mtd->oobsize, GFP_KERNEL); -+ if (!oob) { -+ kfree(logical); -+ return -ENOMEM; -+ } -+ -+ /* initialize management structure */ -+ logical->size = partition_size; -+ logical->index = mtd->index; -+ logical->phymax = (partition_size / mtd->erasesize); -+ -+ /* FTL reserves 5% of the blocks + 1 spare */ -+ logical->logmax = ((logical->phymax * 95) / 100) - 1; -+ -+ logical->log2phy = NULL; -+ logical->log2phy = kcalloc(logical->logmax, sizeof(u_int), GFP_KERNEL); -+ if (!logical->log2phy) { -+ kfree(logical); -+ kfree(oob); -+ return -ENOMEM; -+ } -+ -+ /* initialize logical->log2phy */ -+ for (i = 0; i < logical->logmax; i++) -+ logical->log2phy[i] = UINT_MAX; -+ -+ /* create physical-logical table */ -+ for (block_num = 0; block_num < logical->phymax; block_num++) { -+ block_adr = block_num * mtd->erasesize; -+ -+ if (mtd_block_isbad(mtd, block_adr)) -+ continue; -+ -+ readretry = 3; -+read_retry: -+ if (sharpsl_nand_read_oob(mtd, block_adr, mtd->oobsize, oob)) -+ continue; -+ -+ /* get logical block */ -+ log_num = sharpsl_nand_get_logical_num(oob); -+ -+ /* skip out of range and not unique values */ -+ if ((int)log_num >= 0 && (log_num < logical->logmax)) { -+ if (logical->log2phy[log_num] == UINT_MAX) -+ logical->log2phy[log_num] = block_num; -+ } else { -+ readretry--; -+ if (readretry) -+ goto read_retry; -+ } -+ } -+ kfree(oob); -+ sharpsl_mtd_logical = logical; -+ -+ pr_info("Sharp SL FTL: %d blocks used (%d logical, %d reserved)\n", -+ logical->phymax, logical->logmax, -+ logical->phymax - logical->logmax); -+ -+ return 0; -+} -+ -+void sharpsl_nand_cleanup_logical(void) -+{ -+ struct mtd_logical *logical = sharpsl_mtd_logical; -+ -+ sharpsl_mtd_logical = NULL; -+ -+ kfree(logical->log2phy); -+ logical->log2phy = NULL; -+ kfree(logical); -+ logical = NULL; -+} -+ -+/* MTD METHOD */ -+int sharpsl_nand_read_laddr(struct mtd_info *mtd, -+ loff_t from, -+ size_t len, -+ u_char *buf) -+{ -+ struct mtd_logical *logical; -+ u_int log_num, log_new; -+ u_int block_num; -+ loff_t block_adr; -+ loff_t block_ofs; -+ size_t retlen; -+ int ret; -+ -+ logical = sharpsl_mtd_logical; -+ log_num = (u32)from / mtd->erasesize; -+ log_new = ((u32)from + len - 1) / mtd->erasesize; -+ -+ if (len <= 0 || log_num >= logical->logmax || log_new > log_num) -+ return -EINVAL; -+ -+ block_num = logical->log2phy[log_num]; -+ block_adr = block_num * mtd->erasesize; -+ block_ofs = (u32)from % mtd->erasesize; -+ -+ ret = mtd_read(mtd, block_adr + block_ofs, len, &retlen, buf); -+ if (ret != 0 || len != retlen) -+ return -EINVAL; -+ -+ return 0; -+} -diff --git a/drivers/mtd/sharpsl_ftl.h b/drivers/mtd/sharpsl_ftl.h -new file mode 100644 -index 0000000..2880cbe ---- /dev/null -+++ b/drivers/mtd/sharpsl_ftl.h -@@ -0,0 +1,34 @@ -+/* -+ * Header file for NAND accessing via logical address (SHARP FTL) -+ * -+ * Copyright (C) 2017 Andrea Adami <andrea.adami@gmail.com> -+ * -+ * Based on 2.4 sources: linux/include/asm-arm/sharp_nand_logical.h -+ * Copyright (C) 2002 SHARP -+ * -+ * 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. -+ * -+ */ -+ -+#ifndef __SHARPSL_NAND_LOGICAL_H__ -+#define __SHARPSL_NAND_LOGICAL_H__ -+ -+#include <linux/types.h> -+#include <linux/mtd/mtd.h> -+ -+int sharpsl_nand_init_logical(struct mtd_info *mtd, u32 partition_size); -+ -+void sharpsl_nand_cleanup_logical(void); -+ -+int sharpsl_nand_read_laddr(struct mtd_info *mtd, loff_t from, size_t len, -+ u_char *buf); -+ -+#endif -diff --git a/drivers/mtd/sharpslpart.c b/drivers/mtd/sharpslpart.c -new file mode 100644 -index 0000000..2448b00 ---- /dev/null -+++ b/drivers/mtd/sharpslpart.c -@@ -0,0 +1,146 @@ -+/* -+ * MTD partition parser for NAND flash on Sharp SL Series -+ * -+ * Copyright (C) 2017 Andrea Adami <andrea.adami@gmail.com> -+ * -+ * 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. -+ * -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/slab.h> -+#include <linux/module.h> -+#include <linux/mtd/mtd.h> -+#include <linux/mtd/partitions.h> -+#include "sharpsl_ftl.h" -+ -+/* factory defaults */ -+#define SHARPSL_NAND_PARTS 3 -+#define SHARPSL_FTL_PARTITION_SIZE (7 * 1024 * 1024) -+#define PARAM_BLOCK_PARTITIONINFO1 0x00060000 -+#define PARAM_BLOCK_PARTITIONINFO2 0x00064000 -+ -+#define BOOT_MAGIC be32_to_cpu(0x424f4f54) /* BOOT */ -+#define FSRO_MAGIC be32_to_cpu(0x4653524f) /* FSRO */ -+#define FSRW_MAGIC be32_to_cpu(0x46535257) /* FSRW */ -+ -+/* -+ * Sample values read from SL-C860 -+ * -+ * # cat /proc/mtd -+ * dev: size erasesize name -+ * mtd0: 006d0000 00020000 "Filesystem" -+ * mtd1: 00700000 00004000 "smf" -+ * mtd2: 03500000 00004000 "root" -+ * mtd3: 04400000 00004000 "home" -+ * -+ * PARTITIONINFO1 -+ * 0x00060000: 00 00 00 00 00 00 70 00 42 4f 4f 54 00 00 00 00 ......p.BOOT.... -+ * 0x00060010: 00 00 70 00 00 00 c0 03 46 53 52 4f 00 00 00 00 ..p.....FSRO.... -+ * 0x00060020: 00 00 c0 03 00 00 00 04 46 53 52 57 00 00 00 00 ........FSRW.... -+ * 0x00060030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ -+ * -+ */ -+ -+struct sharpsl_nand_partitioninfo { -+ u32 start; -+ u32 end; -+ u32 magic; -+ u32 reserved; -+}; -+ -+static int sharpsl_parse_mtd_partitions(struct mtd_info *master, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct sharpsl_nand_partitioninfo buf1[SHARPSL_NAND_PARTS]; -+ struct sharpsl_nand_partitioninfo buf2[SHARPSL_NAND_PARTS]; -+ struct mtd_partition *sharpsl_nand_parts; -+ -+ /* init logical mgmt (FTL) */ -+ if (sharpsl_nand_init_logical(master, SHARPSL_FTL_PARTITION_SIZE)) -+ return -EINVAL; -+ -+ /* read the two partition tables */ -+ if (sharpsl_nand_read_laddr(master, -+ PARAM_BLOCK_PARTITIONINFO1, -+ sizeof(buf1), (u_char *)&buf1) || -+ sharpsl_nand_read_laddr(master, -+ PARAM_BLOCK_PARTITIONINFO2, -+ sizeof(buf2), (u_char *)&buf2)) -+ return -EINVAL; -+ -+ /* cleanup logical mgmt (FTL) */ -+ sharpsl_nand_cleanup_logical(); -+ -+ /* compare the two buffers */ -+ if (memcmp(&buf1, &buf2, sizeof(buf1))) { -+ pr_err("sharpslpart: PARTITIONINFO 1,2 differ. Quit parser.\n"); -+ return -EINVAL; -+ } -+ -+ /* check for magics (just in the first) */ -+ if (buf1[0].magic != BOOT_MAGIC || -+ buf1[1].magic != FSRO_MAGIC || -+ buf1[2].magic != FSRW_MAGIC) { -+ pr_err("sharpslpart: magic values mismatch. Quit parser.\n"); -+ return -EINVAL; -+ } -+ -+ sharpsl_nand_parts = kzalloc(sizeof(*sharpsl_nand_parts) * -+ SHARPSL_NAND_PARTS, GFP_KERNEL); -+ if (!sharpsl_nand_parts) -+ return -ENOMEM; -+ -+ /* original names */ -+ sharpsl_nand_parts[0].name = "smf"; -+ sharpsl_nand_parts[0].offset = buf1[0].start; -+ sharpsl_nand_parts[0].size = buf1[0].end - buf1[0].start; -+ sharpsl_nand_parts[0].mask_flags = 0; -+ -+ sharpsl_nand_parts[1].name = "root"; -+ sharpsl_nand_parts[1].offset = buf1[1].start; -+ sharpsl_nand_parts[1].size = buf1[1].end - buf1[1].start; -+ sharpsl_nand_parts[1].mask_flags = 0; -+ -+ sharpsl_nand_parts[2].name = "home"; -+ sharpsl_nand_parts[2].offset = buf1[2].start; -+ /* discard buf1[2].end, was for older models with 64M flash */ -+ sharpsl_nand_parts[2].size = master->size - buf1[2].start; -+ sharpsl_nand_parts[2].mask_flags = 0; -+ -+ *pparts = sharpsl_nand_parts; -+ return SHARPSL_NAND_PARTS; -+} -+ -+static struct mtd_part_parser sharpsl_mtd_parser = { -+ .owner = THIS_MODULE, -+ .parse_fn = sharpsl_parse_mtd_partitions, -+ .name = "sharpslpart", -+}; -+ -+static int __init sharpsl_mtd_parser_init(void) -+{ -+ register_mtd_parser(&sharpsl_mtd_parser); -+ return 0; -+} -+ -+static void __exit sharpsl_mtd_parser_exit(void) -+{ -+ deregister_mtd_parser(&sharpsl_mtd_parser); -+} -+ -+module_init(sharpsl_mtd_parser_init); -+module_exit(sharpsl_mtd_parser_exit); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Andrea Adami <andrea.adami@gmail.com>"); -+MODULE_DESCRIPTION("MTD partitioning for NAND flash on Sharp SL Series"); --- -2.7.4 - diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0001-mtd-sharpslpart-Add-sharpslpart-partition-parser.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0001-mtd-sharpslpart-Add-sharpslpart-partition-parser.patch new file mode 100644 index 0000000..e22e94f --- /dev/null +++ b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0001-mtd-sharpslpart-Add-sharpslpart-partition-parser.patch @@ -0,0 +1,521 @@ +From b8c466c9fd91870918a4e82eca2acc007bf0ab04 Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Thu, 31 Aug 2017 22:44:04 +0200 +Subject: [PATCH] mtd: sharpslpart: Add sharpslpart partition parser + +The Sharp SL Series (Zaurus) PXA handhelds have 16/64/128M of NAND flash +and share the same layout of the first 7M partition, managed by Sharp FTL. + +GPL 2.4 sources: http://support.ezaurus.com/developer/source/source_dl.asp + +The purpose of this self-contained patch is to add a common parser and +remove the hardcoded sizes in the board files (these devices are not yet +converted to devicetree). +Users will have benefits because the mtdparts= tag will not be necessary +anymore and they will be free to repartition the little sized flash. + +The obsolete bootloader can not pass the partitioning info to modern +kernels anymore so it has to be read from flash at known logical addresses. +(see http://www.h5.dion.ne.jp/~rimemoon/zaurus/memo_006.htm ) + +In kernel, under arch/arm/mach-pxa we have already 8 machines: +MACH_POODLE, MACH_CORGI, MACH_SHEPERD, MACH_HUSKY, MACH_AKITA, MACH_SPITZ, +MACH_BORZOI, MACH_TOSA. +Lost after the 2.4 vendor kernel are MACH_BOXER and MACH_TERRIER. + +Almost every model has different factory partitioning: add to this the +units can be repartitioned by users with userspace tools (nandlogical) +and installers for popular (back then) linux distributions. + +The Parameter Area in the first (boot) partition extends from 0x00040000 to +0x0007bfff (176k) and contains two copies of the partition table: +... +0x00060000: Partition Info1 16k +0x00064000: Partition Info2 16k +0x00668000: Model 16k +... + +The first 7M partition is managed by the Sharp FTL reserving 5% + 1 blocks +for wear-leveling: some blocks are remapped and one layer of translation +(logical to physical) is necessary. + +There isn't much documentation about this FTL in the 2.4 sources, just the +MTD methods for reading and writing using logical addresses and the block +management (wear-leveling, use counter). +It seems this FTL was tailored with 16KiB eraesize in mind so to fit one +param block exactly, to have two copies of the partition table on two +blocks. +Later pxa27x devices have same size but 128KiB erasesize and less blocks +(56 vs. 448) but the same schema was adopted, even if the two tables are +now in the same eraseblock. + +For the purpose of the MTD parser only the read part of the code was taken. + +The NAND drivers that can use this parser are sharpsl.c and tmio_nand.c. + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> +--- + drivers/mtd/Kconfig | 8 + + drivers/mtd/Makefile | 1 + + drivers/mtd/sharpslpart.c | 417 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 426 insertions(+) + create mode 100644 drivers/mtd/sharpslpart.c + +diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig +index a03ad29..4594925 100644 +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -155,6 +155,14 @@ config MTD_BCM47XX_PARTS + This provides partitions parser for devices based on BCM47xx + boards. + ++config MTD_SHARPSL_PARTS ++ tristate "Sharp SL Series NAND flash partition parser" ++ depends on MTD_NAND_SHARPSL || MTD_NAND_TMIO || COMPILE_TEST ++ help ++ This provides the read-only FTL logic necessary to read the partition ++ table from the NAND flash of Sharp SL Series (Zaurus) and the MTD ++ partition parser using this code. ++ + comment "User Modules And Translation Layers" + + # +diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile +index 99bb9a1..e5ef07f 100644 +--- a/drivers/mtd/Makefile ++++ b/drivers/mtd/Makefile +@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o + obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o + obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o ++obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o + + # 'Users' - code which presents functionality to userspace. + obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o +diff --git a/drivers/mtd/sharpslpart.c b/drivers/mtd/sharpslpart.c +new file mode 100644 +index 0000000..b03772b +--- /dev/null ++++ b/drivers/mtd/sharpslpart.c +@@ -0,0 +1,417 @@ ++/* ++ * sharpslpart.c - MTD partition parser for NAND flash using the SHARP FTL ++ * for logical addressing, as used on the PXA models of the SHARP SL Series. ++ * ++ * Copyright (C) 2017 Andrea Adami <andrea.adami@gmail.com> ++ * ++ * Based on SHARP GPL 2.4 sources: ++ * http://support.ezaurus.com/developer/source/source_dl.asp ++ * drivers/mtd/nand/sharp_sl_logical.c ++ * linux/include/asm-arm/sharp_nand_logical.h ++ * ++ * Copyright (C) 2002 SHARP ++ * ++ * 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. ++ * ++ */ ++ ++/* init/exit modified for kernel 4.4 - disable sharpsl_nand_check_ooblayout */ ++ ++#include <linux/kernel.h> ++#include <linux/slab.h> ++#include <linux/module.h> ++#include <linux/types.h> ++#include <linux/bitops.h> ++#include <linux/sizes.h> ++#include <linux/mtd/mtd.h> ++#include <linux/mtd/partitions.h> ++ ++/* oob structure */ ++#define NAND_NOOB_LOGADDR_00 8 ++#define NAND_NOOB_LOGADDR_01 9 ++#define NAND_NOOB_LOGADDR_10 10 ++#define NAND_NOOB_LOGADDR_11 11 ++#define NAND_NOOB_LOGADDR_20 12 ++#define NAND_NOOB_LOGADDR_21 13 ++ ++#define BLOCK_IS_RESERVED 0xffff ++#define BLOCK_UNMASK_COMPLEMENT 1 ++ ++/* factory defaults */ ++#define SHARPSL_NAND_PARTS 3 ++#define SHARPSL_FTL_PART_SIZE (7 * SZ_1M) ++#define SHARPSL_PARTINFO1_LADDR 0x00060000 ++#define SHARPSL_PARTINFO2_LADDR 0x00064000 ++ ++#define BOOT_MAGIC 0x424f4f54 ++#define FSRO_MAGIC 0x4653524f ++#define FSRW_MAGIC 0x46535257 ++ ++/** ++ * struct sharpsl_ftl - Sharp FTL Logical Table ++ * @logmax: number of logical blocks ++ * @log2phy: the logical-to-physical table ++ * ++ * Structure containing the logical-to-physical translation table ++ * used by the SHARP SL FTL. ++ */ ++struct sharpsl_ftl { ++ unsigned int logmax; ++ unsigned int *log2phy; ++}; ++ ++/* verify that the OOB bytes 8 to 15 are free and available for the FTL */ ++/* ++static int sharpsl_nand_check_ooblayout(struct mtd_info *mtd) ++{ ++ u8 freebytes = 0; ++ int section = 0; ++ ++ while (true) { ++ struct mtd_oob_region oobfree = { }; ++ int ret, i; ++ ++ ret = mtd_ooblayout_free(mtd, section++, &oobfree); ++ if (ret) ++ break; ++ ++ if (!oobfree.length || oobfree.offset > 15 || ++ (oobfree.offset + oobfree.length) < 8) ++ continue; ++ ++ i = oobfree.offset >= 8 ? oobfree.offset : 8; ++ for (; i < oobfree.offset + oobfree.length && i < 16; i++) ++ freebytes |= BIT(i - 8); ++ ++ if (freebytes == 0xff) ++ return 0; ++ } ++ ++ return -ENOTSUPP; ++} ++*/ ++static int sharpsl_nand_read_oob(struct mtd_info *mtd, loff_t offs, u8 *buf) ++{ ++ struct mtd_oob_ops ops = { }; ++ int ret; ++ ++ ops.mode = MTD_OPS_PLACE_OOB; ++ ops.ooblen = mtd->oobsize; ++ ops.oobbuf = buf; ++ ++ ret = mtd_read_oob(mtd, offs, &ops); ++ if (ret != 0 || mtd->oobsize != ops.oobretlen) ++ return -1; ++ ++ return 0; ++} ++ ++/* ++ * The logical block number assigned to a physical block is stored in the OOB ++ * of the first page, in 3 16-bit copies with the following layout: ++ * ++ * 01234567 89abcdef ++ * -------- -------- ++ * ECC BB xyxyxy ++ * ++ * When reading we check that the first two copies agree. ++ * In case of error, matching is tried using the following pairs. ++ * Reserved values 0xffff mean the block is kept for wear leveling. ++ * ++ * 01234567 89abcdef ++ * -------- -------- ++ * ECC BB xyxy oob[8]==oob[10] && oob[9]==oob[11] -> byte0=8 byte1=9 ++ * ECC BB xyxy oob[10]==oob[12] && oob[11]==oob[13] -> byte0=10 byte1=11 ++ * ECC BB xy xy oob[12]==oob[8] && oob[13]==oob[9] -> byte0=12 byte1=13 ++ */ ++static int sharpsl_nand_get_logical_num(u8 *oob) ++{ ++ u16 us; ++ int good0, good1; ++ ++ if (oob[NAND_NOOB_LOGADDR_00] == oob[NAND_NOOB_LOGADDR_10] && ++ oob[NAND_NOOB_LOGADDR_01] == oob[NAND_NOOB_LOGADDR_11]) { ++ good0 = NAND_NOOB_LOGADDR_00; ++ good1 = NAND_NOOB_LOGADDR_01; ++ } else if (oob[NAND_NOOB_LOGADDR_10] == oob[NAND_NOOB_LOGADDR_20] && ++ oob[NAND_NOOB_LOGADDR_11] == oob[NAND_NOOB_LOGADDR_21]) { ++ good0 = NAND_NOOB_LOGADDR_10; ++ good1 = NAND_NOOB_LOGADDR_11; ++ } else if (oob[NAND_NOOB_LOGADDR_20] == oob[NAND_NOOB_LOGADDR_00] && ++ oob[NAND_NOOB_LOGADDR_21] == oob[NAND_NOOB_LOGADDR_01]) { ++ good0 = NAND_NOOB_LOGADDR_20; ++ good1 = NAND_NOOB_LOGADDR_21; ++ } else { ++ return -EINVAL; ++ } ++ ++ us = oob[good0] | oob[good1] << 8; ++ ++ /* parity check */ ++ if (hweight16(us) & BLOCK_UNMASK_COMPLEMENT) ++ return -EINVAL; ++ ++ /* reserved */ ++ if (us == BLOCK_IS_RESERVED) ++ return BLOCK_IS_RESERVED; ++ ++ return (us >> 1) & GENMASK(9, 0); ++} ++ ++static int sharpsl_nand_init_ftl(struct mtd_info *mtd, struct sharpsl_ftl *ftl) ++{ ++ unsigned int block_num, log_num, phymax; ++ loff_t block_adr; ++ u8 *oob; ++ int i, ret; ++ ++ oob = kzalloc(mtd->oobsize, GFP_KERNEL); ++ if (!oob) ++ return -ENOMEM; ++ ++ phymax = mtd_div_by_eb(SHARPSL_FTL_PART_SIZE, mtd); ++ ++ /* FTL reserves 5% of the blocks + 1 spare */ ++ ftl->logmax = ((phymax * 95) / 100) - 1; ++ ++ ftl->log2phy = kmalloc_array(ftl->logmax, sizeof(*ftl->log2phy), ++ GFP_KERNEL); ++ if (!ftl->log2phy) { ++ ret = -ENOMEM; ++ goto exit; ++ } ++ ++ /* initialize ftl->log2phy */ ++ for (i = 0; i < ftl->logmax; i++) ++ ftl->log2phy[i] = UINT_MAX; ++ ++ /* create physical-logical table */ ++ for (block_num = 0; block_num < phymax; block_num++) { ++ block_adr = (loff_t)block_num * mtd->erasesize; ++ ++ if (mtd_block_isbad(mtd, block_adr)) ++ continue; ++ ++ if (sharpsl_nand_read_oob(mtd, block_adr, oob)) ++ continue; ++ ++ /* get logical block */ ++ log_num = sharpsl_nand_get_logical_num(oob); ++ ++ /* cut-off errors and skip the out-of-range values */ ++ if (log_num > 0 && log_num < ftl->logmax) { ++ if (ftl->log2phy[log_num] == UINT_MAX) ++ ftl->log2phy[log_num] = block_num; ++ } ++ } ++ ++ pr_info("Sharp SL FTL: %d blocks used (%d logical, %d reserved)\n", ++ phymax, ftl->logmax, phymax - ftl->logmax); ++ ++ ret = 0; ++exit: ++ kfree(oob); ++ return ret; ++} ++ ++static void sharpsl_nand_cleanup_ftl(struct sharpsl_ftl *ftl) ++{ ++ kfree(ftl->log2phy); ++} ++ ++static int sharpsl_nand_read_laddr(struct mtd_info *mtd, ++ loff_t from, ++ size_t len, ++ void *buf, ++ struct sharpsl_ftl *ftl) ++{ ++ unsigned int log_num, final_log_num; ++ unsigned int block_num; ++ loff_t block_adr; ++ loff_t block_ofs; ++ size_t retlen; ++ int err; ++ ++ log_num = mtd_div_by_eb((u32)from, mtd); ++ final_log_num = mtd_div_by_eb(((u32)from + len - 1), mtd); ++ ++ if (len <= 0 || log_num >= ftl->logmax || final_log_num > log_num) ++ return -EINVAL; ++ ++ block_num = ftl->log2phy[log_num]; ++ block_adr = (loff_t)block_num * mtd->erasesize; ++ block_ofs = mtd_mod_by_eb((u32)from, mtd); ++ ++ err = mtd_read(mtd, block_adr + block_ofs, len, &retlen, buf); ++ /* Ignore corrected ECC errors */ ++ if (mtd_is_bitflip(err)) ++ err = 0; ++ ++ if (!err && retlen != len) ++ err = -EIO; ++ ++ if (err) ++ pr_err("sharpslpart: error, read failed at %#llx\n", ++ block_adr + block_ofs); ++ ++ return err; ++} ++ ++/* ++ * MTD Partition Parser ++ * ++ * Sample values read from SL-C860 ++ * ++ * # cat /proc/mtd ++ * dev: size erasesize name ++ * mtd0: 006d0000 00020000 "Filesystem" ++ * mtd1: 00700000 00004000 "smf" ++ * mtd2: 03500000 00004000 "root" ++ * mtd3: 04400000 00004000 "home" ++ * ++ * PARTITIONINFO1 ++ * 0x00060000: 00 00 00 00 00 00 70 00 42 4f 4f 54 00 00 00 00 ......p.BOOT.... ++ * 0x00060010: 00 00 70 00 00 00 c0 03 46 53 52 4f 00 00 00 00 ..p.....FSRO.... ++ * 0x00060020: 00 00 c0 03 00 00 00 04 46 53 52 57 00 00 00 00 ........FSRW.... ++ */ ++struct sharpsl_nand_partinfo { ++ __le32 start; ++ __le32 end; ++ __be32 magic; ++ u32 reserved; ++}; ++ ++static int sharpsl_nand_read_partinfo(struct mtd_info *master, ++ loff_t from, ++ size_t len, ++ struct sharpsl_nand_partinfo *buf, ++ struct sharpsl_ftl *ftl) ++{ ++ int ret; ++ ++ ret = sharpsl_nand_read_laddr(master, from, len, buf, ftl); ++ if (ret) ++ return ret; ++ ++ /* check for magics */ ++ if (be32_to_cpu(buf[0].magic) != BOOT_MAGIC || ++ be32_to_cpu(buf[1].magic) != FSRO_MAGIC || ++ be32_to_cpu(buf[2].magic) != FSRW_MAGIC) { ++ pr_err("sharpslpart: magic values mismatch\n"); ++ return -EINVAL; ++ } ++ ++ /* fixup for hardcoded value 64 MiB (for older models) */ ++ buf[2].end = cpu_to_le32(master->size); ++ ++ /* extra sanity check */ ++ if (le32_to_cpu(buf[0].end) <= le32_to_cpu(buf[0].start) || ++ le32_to_cpu(buf[1].start) < le32_to_cpu(buf[0].end) || ++ le32_to_cpu(buf[1].end) <= le32_to_cpu(buf[1].start) || ++ le32_to_cpu(buf[2].start) < le32_to_cpu(buf[1].end) || ++ le32_to_cpu(buf[2].end) <= le32_to_cpu(buf[2].start)) { ++ pr_err("sharpslpart: partition sizes mismatch\n"); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int sharpsl_parse_mtd_partitions(struct mtd_info *master, ++ struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ struct sharpsl_ftl ftl; ++ struct sharpsl_nand_partinfo buf[SHARPSL_NAND_PARTS]; ++ struct mtd_partition *sharpsl_nand_parts; ++ int err; ++ ++ /* check that OOB bytes 8 to 15 used by the FTL are actually free */ ++/* ++ err = sharpsl_nand_check_ooblayout(master); ++ if (err) ++ return err; ++*/ ++ /* init logical mgmt (FTL) */ ++ err = sharpsl_nand_init_ftl(master, &ftl); ++ if (err) ++ return err; ++ ++ /* read and validate first partition table */ ++ pr_info("sharpslpart: try reading first partition table\n"); ++ err = sharpsl_nand_read_partinfo(master, ++ SHARPSL_PARTINFO1_LADDR, ++ sizeof(buf), buf, &ftl); ++ if (err) { ++ /* fallback: read second partition table */ ++ pr_warn("sharpslpart: first partition table is invalid, retry using the second\n"); ++ err = sharpsl_nand_read_partinfo(master, ++ SHARPSL_PARTINFO2_LADDR, ++ sizeof(buf), buf, &ftl); ++ } ++ ++ /* cleanup logical mgmt (FTL) */ ++ sharpsl_nand_cleanup_ftl(&ftl); ++ ++ if (err) { ++ pr_err("sharpslpart: both partition tables are invalid\n"); ++ return err; ++ } ++ ++ sharpsl_nand_parts = kcalloc(SHARPSL_NAND_PARTS, ++ sizeof(*sharpsl_nand_parts), ++ GFP_KERNEL); ++ if (!sharpsl_nand_parts) ++ return -ENOMEM; ++ ++ /* original names */ ++ sharpsl_nand_parts[0].name = "smf"; ++ sharpsl_nand_parts[0].offset = le32_to_cpu(buf[0].start); ++ sharpsl_nand_parts[0].size = le32_to_cpu(buf[0].end) - ++ le32_to_cpu(buf[0].start); ++ ++ sharpsl_nand_parts[1].name = "root"; ++ sharpsl_nand_parts[1].offset = le32_to_cpu(buf[1].start); ++ sharpsl_nand_parts[1].size = le32_to_cpu(buf[1].end) - ++ le32_to_cpu(buf[1].start); ++ ++ sharpsl_nand_parts[2].name = "home"; ++ sharpsl_nand_parts[2].offset = le32_to_cpu(buf[2].start); ++ sharpsl_nand_parts[2].size = le32_to_cpu(buf[2].end) - ++ le32_to_cpu(buf[2].start); ++ ++ *pparts = sharpsl_nand_parts; ++ return SHARPSL_NAND_PARTS; ++} ++ ++static struct mtd_part_parser sharpsl_mtd_parser = { ++ .owner = THIS_MODULE, ++ .parse_fn = sharpsl_parse_mtd_partitions, ++ .name = "sharpslpart", ++}; ++ ++static int __init sharpsl_mtd_parser_init(void) ++{ ++ register_mtd_parser(&sharpsl_mtd_parser); ++ return 0; ++} ++ ++static void __exit sharpsl_mtd_parser_exit(void) ++{ ++ deregister_mtd_parser(&sharpsl_mtd_parser); ++} ++ ++module_init(sharpsl_mtd_parser_init); ++module_exit(sharpsl_mtd_parser_exit); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Andrea Adami <andrea.adami@gmail.com>"); ++MODULE_DESCRIPTION("MTD partitioning for NAND flash on Sharp SL Series"); +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0002-mtd-nand-sharpsl-Add-partition-parsers-platform-data.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0002-mtd-nand-sharpsl-Add-partition-parsers-platform-data.patch new file mode 100644 index 0000000..8bd46b0 --- /dev/null +++ b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0002-mtd-nand-sharpsl-Add-partition-parsers-platform-data.patch @@ -0,0 +1,31 @@ +From acf7218ab5733bd74fe34ba65884831acc6efe8b Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Mon, 14 Aug 2017 16:20:16 +0200 +Subject: [PATCH v5 2/9] mtd: nand: sharpsl: Add partition parsers platform data + +With the introduction of sharpslpart partition parser we can now read the +offsets from NAND: we specify the list of the parsers as platform data, with +cmdlinepart and ofpart parsers first allowing to override the part. table +written in NAND. This is done in the board files using this driver. + +Thus, we need to extend sharpsl_nand_platform_data to consider the partition +parsers. + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + include/linux/mtd/sharpsl.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/linux/mtd/sharpsl.h b/include/linux/mtd/sharpsl.h +index 65e91d0..6381a7d 100644 +--- a/include/linux/mtd/sharpsl.h ++++ b/include/linux/mtd/sharpsl.h +@@ -17,4 +17,5 @@ struct sharpsl_nand_platform_data { + struct nand_ecclayout *ecc_layout; + struct mtd_partition *partitions; + unsigned int nr_partitions; ++ const char *const *part_parsers; + }; +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0002-mtd-nand-sharpsl.c-prefer-sharpslpart-MTD-partition-.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0002-mtd-nand-sharpsl.c-prefer-sharpslpart-MTD-partition-.patch deleted file mode 100644 index 7f47c82..0000000 --- a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0002-mtd-nand-sharpsl.c-prefer-sharpslpart-MTD-partition-.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 888060fb9aa78dee4b103dd241f3058a2b69f93e Mon Sep 17 00:00:00 2001 -From: Andrea Adami <andrea.adami@gmail.com> -Date: Sat, 13 May 2017 00:16:29 +0200 -Subject: [PATCH 2/3] mtd: nand: sharpsl.c: prefer sharpslpart MTD partition - parser - -This is the specific parser for Sharp SL Series (Zaurus). - -Signed-off-by: Andrea Adami <andrea.adami@gmail.com> ---- - drivers/mtd/nand/sharpsl.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c -index 082b600..9a515c6 100644 ---- a/drivers/mtd/nand/sharpsl.c -+++ b/drivers/mtd/nand/sharpsl.c -@@ -106,6 +106,8 @@ static int sharpsl_nand_calculate_ecc(struct mtd_info *mtd, const u_char * dat, - /* - * Main initialization routine - */ -+static const char * const probes[] = { "sharpslpart", NULL }; -+ - static int sharpsl_nand_probe(struct platform_device *pdev) - { - struct nand_chip *this; -@@ -180,7 +182,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev) - /* Register the partitions */ - sharpsl->mtd.name = "sharpsl-nand"; - -- err = mtd_device_parse_register(&sharpsl->mtd, NULL, NULL, -+ err = mtd_device_parse_register(&sharpsl->mtd, probes, NULL, - data->partitions, data->nr_partitions); - if (err) - goto err_add; --- -2.7.4 - diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0003-mfd-tmio-Add-partition-parsers-platform-data.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0003-mfd-tmio-Add-partition-parsers-platform-data.patch new file mode 100644 index 0000000..c72a98d --- /dev/null +++ b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0003-mfd-tmio-Add-partition-parsers-platform-data.patch @@ -0,0 +1,32 @@ +From e33500e0391f27b39f38ff98923672e218ee9ebe Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Mon, 14 Aug 2017 16:23:26 +0200 +Subject: [PATCH v5 3/9] mfd: tmio: Add partition parsers platform data + +With the introduction of sharpslpart partition parser we can now read the +offsets from NAND: we specify the list of the parsers as platform data, with +cmdlinepart and ofpart parsers first allowing to override the part. table +written in NAND. This is done in the board files using this driver. + +Thus, we need to extend tmio_nand_data to consider the partition parsers. + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + include/linux/mfd/tmio.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h +index 26e8f8c..357b6cfd 100644 +--- a/include/linux/mfd/tmio.h ++++ b/include/linux/mfd/tmio.h +@@ -139,6 +139,7 @@ struct tmio_nand_data { + struct nand_bbt_descr *badblock_pattern; + struct mtd_partition *partition; + unsigned int num_partitions; ++ const char *const *part_parsers; + }; + + #define FBIO_TMIO_ACC_WRITE 0x7C639300 +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0003-mtd-nand-tmio_nand.c-prefer-sharpslpart-MTD-partitio.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0003-mtd-nand-tmio_nand.c-prefer-sharpslpart-MTD-partitio.patch deleted file mode 100644 index 6388348..0000000 --- a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0003-mtd-nand-tmio_nand.c-prefer-sharpslpart-MTD-partitio.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b91aeb1f3caf962389ddef2a4cb362c8183f8d9f Mon Sep 17 00:00:00 2001 -From: Andrea Adami <andrea.adami@gmail.com> -Date: Sat, 13 May 2017 00:18:56 +0200 -Subject: [PATCH 3/3] mtd: nand: tmio_nand.c: prefer sharpslpart MTD partition - parser - -This is the specific parser for Sharp SL Series (Zaurus) - -Signed-off-by: Andrea Adami <andrea.adami@gmail.com> ---- - drivers/mtd/nand/tmio_nand.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c -index befddf0..9f77f96 100644 ---- a/drivers/mtd/nand/tmio_nand.c -+++ b/drivers/mtd/nand/tmio_nand.c -@@ -355,6 +355,8 @@ static void tmio_hw_stop(struct platform_device *dev, struct tmio_nand *tmio) - cell->disable(dev); - } - -+static const char * const probes[] = { "sharpslpart", NULL }; -+ - static int tmio_probe(struct platform_device *dev) - { - struct tmio_nand_data *data = dev_get_platdata(&dev->dev); -@@ -439,7 +441,7 @@ static int tmio_probe(struct platform_device *dev) - goto err_irq; - } - /* Register the partitions */ -- retval = mtd_device_parse_register(mtd, NULL, NULL, -+ retval = mtd_device_parse_register(mtd, probes, NULL, - data ? data->partition : NULL, - data ? data->num_partitions : 0); - if (!retval) --- -2.7.4 - diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0004-mtd-nand-sharpsl-Register-partitions-using-the-parse.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0004-mtd-nand-sharpsl-Register-partitions-using-the-parse.patch new file mode 100644 index 0000000..b32aba4 --- /dev/null +++ b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0004-mtd-nand-sharpsl-Register-partitions-using-the-parse.patch @@ -0,0 +1,33 @@ +From 18ff95a881a6148972b19daaa6b815e9cd388ea6 Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Mon, 14 Aug 2017 16:30:03 +0200 +Subject: [PATCH v5 4/9] mtd: nand: sharpsl: Register partitions using the parsers + +With the introduction of sharpslpart partition parser we can now read the +offsets from NAND: we specify the list of the parsers as platform data, with +cmdlinepart and ofpart parsers first allowing to override the part. table +written in NAND. This is done in the board files using this driver. + +Use now these parsers. + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + drivers/mtd/nand/sharpsl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c +index 082b600..47a9e0b 100644 +--- a/drivers/mtd/nand/sharpsl.c ++++ b/drivers/mtd/nand/sharpsl.c +@@ -180,7 +180,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev) + /* Register the partitions */ + sharpsl->mtd.name = "sharpsl-nand"; + +- err = mtd_device_parse_register(&sharpsl->mtd, NULL, NULL, ++ err = mtd_device_parse_register(&sharpsl->mtd, data->part_parsers, NULL, + data->partitions, data->nr_partitions); + if (err) + goto err_add; +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0005-mtd-nand-tmio-Register-partitions-using-the-parsers.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0005-mtd-nand-tmio-Register-partitions-using-the-parsers.patch new file mode 100644 index 0000000..e1d3835 --- /dev/null +++ b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0005-mtd-nand-tmio-Register-partitions-using-the-parsers.patch @@ -0,0 +1,35 @@ +From e75122abc6568d2f7f4663f3621e427ea0663d0c Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Mon, 14 Aug 2017 16:34:21 +0200 +Subject: [PATCH v5 5/9] mtd: nand: tmio: Register partitions using the parsers + +With the introduction of sharpslpart partition parser we can now read the +offsets from NAND: we specify the list of the parsers as platform data, with +cmdlinepart and ofpart parsers first allowing to override the part. table +written in NAND. This is done in the board files using this driver. + +Use now these parsers. + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + drivers/mtd/nand/tmio_nand.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c +index befddf0..142c99d 100644 +--- a/drivers/mtd/nand/tmio_nand.c ++++ b/drivers/mtd/nand/tmio_nand.c +@@ -439,7 +439,9 @@ static int tmio_probe(struct platform_device *dev) + goto err_irq; + } + /* Register the partitions */ +- retval = mtd_device_parse_register(mtd, NULL, NULL, ++ retval = mtd_device_parse_register(mtd, ++ data ? data->part_parsers : NULL, ++ NULL, + data ? data->partition : NULL, + data ? data->num_partitions : 0); + if (!retval) +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0006-ARM-pxa-corgi-Remove-hardcoded-partitioning-use-shar.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0006-ARM-pxa-corgi-Remove-hardcoded-partitioning-use-shar.patch new file mode 100644 index 0000000..cee6355 --- /dev/null +++ b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0006-ARM-pxa-corgi-Remove-hardcoded-partitioning-use-shar.patch @@ -0,0 +1,77 @@ +From a5cac163d4821abe5b5cb7e9453e34084f1bc9ab Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Mon, 14 Aug 2017 16:43:46 +0200 +Subject: [PATCH v5 6/9] ARM: pxa/corgi: Remove hardcoded partitioning, use + sharpslpart parser + +With the introduction of sharpslpart partition parser we can now read the +offsets from NAND: we specify the list of the parsers as platform data, with +cmdlinepart and ofpart parsers first allowing to override the part. table +written in NAND. This is done here in the board file. + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + arch/arm/mach-pxa/corgi.c | 31 ++++++++----------------------- + 1 file changed, 8 insertions(+), 23 deletions(-) + +diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c +index 7270f0d..9546452 100644 +--- a/arch/arm/mach-pxa/corgi.c ++++ b/arch/arm/mach-pxa/corgi.c +@@ -606,24 +606,6 @@ static void __init corgi_init_spi(void) + static inline void corgi_init_spi(void) {} + #endif + +-static struct mtd_partition sharpsl_nand_partitions[] = { +- { +- .name = "System Area", +- .offset = 0, +- .size = 7 * 1024 * 1024, +- }, +- { +- .name = "Root Filesystem", +- .offset = 7 * 1024 * 1024, +- .size = 25 * 1024 * 1024, +- }, +- { +- .name = "Home Filesystem", +- .offset = MTDPART_OFS_APPEND, +- .size = MTDPART_SIZ_FULL, +- }, +-}; +- + static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; + + static struct nand_bbt_descr sharpsl_bbt = { +@@ -633,10 +615,16 @@ static struct nand_bbt_descr sharpsl_bbt = { + .pattern = scan_ff_pattern + }; + ++static const char * const probes[] = { ++ "cmdlinepart", ++ "ofpart", ++ "sharpslpart", ++ NULL, ++}; ++ + static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = { + .badblock_pattern = &sharpsl_bbt, +- .partitions = sharpsl_nand_partitions, +- .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions), ++ .part_parsers = probes, + }; + + static struct resource sharpsl_nand_resources[] = { +@@ -750,9 +738,6 @@ static void __init corgi_init(void) + + platform_scoop_config = &corgi_pcmcia_config; + +- if (machine_is_husky()) +- sharpsl_nand_partitions[1].size = 53 * 1024 * 1024; +- + platform_add_devices(devices, ARRAY_SIZE(devices)); + + regulator_has_full_constraints(); +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0007-ARM-pxa-tosa-Remove-hardcoded-partitioning-use-sharp.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0007-ARM-pxa-tosa-Remove-hardcoded-partitioning-use-sharp.patch new file mode 100644 index 0000000..99eaddc --- /dev/null +++ b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0007-ARM-pxa-tosa-Remove-hardcoded-partitioning-use-sharp.patch @@ -0,0 +1,67 @@ +From b602bc99fe20719124cbea076c62bc1365886973 Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Mon, 14 Aug 2017 16:48:06 +0200 +Subject: [PATCH v5 7/9] ARM: pxa/tosa: Remove hardcoded partitioning, use + sharpslpart parser + +With the introduction of sharpslpart partition parser we can now read the +offsets from NAND: we specify the list of the parsers as platform data, with +cmdlinepart and ofpart parsers first allowing to override the part. table +written in NAND. This is done here in the board file. + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + arch/arm/mach-pxa/tosa.c | 28 ++++++++-------------------- + 1 file changed, 8 insertions(+), 20 deletions(-) + +diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c +index 13de660..b90560b 100644 +--- a/arch/arm/mach-pxa/tosa.c ++++ b/arch/arm/mach-pxa/tosa.c +@@ -673,24 +673,6 @@ static int tosa_tc6393xb_suspend(struct platform_device *dev) + return 0; + } + +-static struct mtd_partition tosa_nand_partition[] = { +- { +- .name = "smf", +- .offset = 0, +- .size = 7 * 1024 * 1024, +- }, +- { +- .name = "root", +- .offset = MTDPART_OFS_APPEND, +- .size = 28 * 1024 * 1024, +- }, +- { +- .name = "home", +- .offset = MTDPART_OFS_APPEND, +- .size = MTDPART_SIZ_FULL, +- }, +-}; +- + static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; + + static struct nand_bbt_descr tosa_tc6393xb_nand_bbt = { +@@ -700,10 +682,16 @@ static struct nand_bbt_descr tosa_tc6393xb_nand_bbt = { + .pattern = scan_ff_pattern + }; + ++static const char * const probes[] = { ++ "cmdlinepart", ++ "ofpart", ++ "sharpslpart", ++ NULL, ++}; ++ + static struct tmio_nand_data tosa_tc6393xb_nand_config = { +- .num_partitions = ARRAY_SIZE(tosa_nand_partition), +- .partition = tosa_nand_partition, + .badblock_pattern = &tosa_tc6393xb_nand_bbt, ++ .part_parsers = probes, + }; + + static int tosa_tc6393xb_setup(struct platform_device *dev) +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0008-ARM-pxa-spitz-Remove-hardcoded-partitioning-use-shar.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0008-ARM-pxa-spitz-Remove-hardcoded-partitioning-use-shar.patch new file mode 100644 index 0000000..5d18c98 --- /dev/null +++ b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0008-ARM-pxa-spitz-Remove-hardcoded-partitioning-use-shar.patch @@ -0,0 +1,79 @@ +From 069e1f02815874f9c825f110c9dad63848c55638 Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Mon, 14 Aug 2017 17:00:41 +0200 +Subject: [PATCH v5 9/9] ARM: pxa/poodle: Remove hardcoded partitioning, use + sharpslpart parser + +With the introduction of sharpslpart partition parser we can now read the +offsets from NAND: we specify the list of the parsers as platform data, with +cmdlinepart and ofpart parsers first allowing to override the part. table +written in NAND. This is done here in the board file. + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + arch/arm/mach-pxa/spitz.c | 33 +++++++++------------------------ + 1 file changed, 9 insertions(+), 24 deletions(-) + +diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c +index f4e2e27..5204a3a 100644 +--- a/arch/arm/mach-pxa/spitz.c ++++ b/arch/arm/mach-pxa/spitz.c +@@ -739,20 +739,6 @@ static inline void spitz_lcd_init(void) {} + * NAND Flash + ******************************************************************************/ + #if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE) +-static struct mtd_partition spitz_nand_partitions[] = { +- { +- .name = "System Area", +- .offset = 0, +- .size = 7 * 1024 * 1024, +- }, { +- .name = "Root Filesystem", +- .offset = 7 * 1024 * 1024, +- }, { +- .name = "Home Filesystem", +- .offset = MTDPART_OFS_APPEND, +- .size = MTDPART_SIZ_FULL, +- }, +-}; + + static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; + +@@ -773,10 +759,16 @@ static struct nand_ecclayout akita_oobinfo = { + }, + }; + ++static const char * const probes[] = { ++ "cmdlinepart", ++ "ofpart", ++ "sharpslpart", ++ NULL, ++}; ++ + static struct sharpsl_nand_platform_data spitz_nand_pdata = { + .badblock_pattern = &spitz_nand_bbt, +- .partitions = spitz_nand_partitions, +- .nr_partitions = ARRAY_SIZE(spitz_nand_partitions), ++ .part_parsers = probes, + }; + + static struct resource spitz_nand_resources[] = { +@@ -799,14 +791,7 @@ static struct platform_device spitz_nand_device = { + + static void __init spitz_nand_init(void) + { +- if (machine_is_spitz()) { +- spitz_nand_partitions[1].size = 5 * 1024 * 1024; +- } else if (machine_is_akita()) { +- spitz_nand_partitions[1].size = 58 * 1024 * 1024; +- spitz_nand_bbt.len = 1; +- spitz_nand_pdata.ecc_layout = &akita_oobinfo; +- } else if (machine_is_borzoi()) { +- spitz_nand_partitions[1].size = 32 * 1024 * 1024; ++ if (machine_is_akita() || machine_is_borzoi()) { + spitz_nand_bbt.len = 1; + spitz_nand_pdata.ecc_layout = &akita_oobinfo; + } +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0009-ARM-pxa-poodle-Remove-hardcoded-partitioning-use-sha.patch b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0009-ARM-pxa-poodle-Remove-hardcoded-partitioning-use-sha.patch new file mode 100644 index 0000000..9fa40a7 --- /dev/null +++ b/recipes-kernel/linux/linux-handheld-4.4/sharpslpart/0009-ARM-pxa-poodle-Remove-hardcoded-partitioning-use-sha.patch @@ -0,0 +1,67 @@ +From 9358ef85dce8971a198ad931cdeee8b43696a0f8 Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Mon, 14 Aug 2017 17:00:41 +0200 +Subject: [PATCH v5 9/9] ARM: pxa/poodle: Remove hardcoded partitioning, use + sharpslpart parser + +With the introduction of sharpslpart partition parser we can now read the +offsets from NAND: we specify the list of the parsers as platform data, with +cmdlinepart and ofpart parsers first allowing to override the part. table +written in NAND. This is done here in the board file. + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + arch/arm/mach-pxa/poodle.c | 28 ++++++++-------------------- + 1 file changed, 8 insertions(+), 20 deletions(-) + +diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c +index 62a1191..fd01d6b 100644 +--- a/arch/arm/mach-pxa/poodle.c ++++ b/arch/arm/mach-pxa/poodle.c +@@ -333,24 +333,6 @@ static struct pxafb_mach_info poodle_fb_info = { + .lcd_conn = LCD_COLOR_TFT_16BPP, + }; + +-static struct mtd_partition sharpsl_nand_partitions[] = { +- { +- .name = "System Area", +- .offset = 0, +- .size = 7 * 1024 * 1024, +- }, +- { +- .name = "Root Filesystem", +- .offset = 7 * 1024 * 1024, +- .size = 22 * 1024 * 1024, +- }, +- { +- .name = "Home Filesystem", +- .offset = MTDPART_OFS_APPEND, +- .size = MTDPART_SIZ_FULL, +- }, +-}; +- + static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; + + static struct nand_bbt_descr sharpsl_bbt = { +@@ -360,10 +342,16 @@ static struct nand_bbt_descr sharpsl_bbt = { + .pattern = scan_ff_pattern + }; + ++static const char * const probes[] = { ++ "cmdlinepart", ++ "ofpart", ++ "sharpslpart", ++ NULL, ++}; ++ + static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = { + .badblock_pattern = &sharpsl_bbt, +- .partitions = sharpsl_nand_partitions, +- .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions), ++ .part_parsers = probes, + }; + + static struct resource sharpsl_nand_resources[] = { +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux-handheld_4.4.bb b/recipes-kernel/linux/linux-handheld_4.4.bb index 5a8f963..421003f 100644 --- a/recipes-kernel/linux/linux-handheld_4.4.bb +++ b/recipes-kernel/linux/linux-handheld_4.4.bb @@ -6,19 +6,23 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" COMPATIBLE_MACHINE = "akita|c7x0|collie|h3600|hx4700|poodle|spitz|tosa" SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/v4.x/linux-${PV}.tar.xz;name=kernel \ - ${KERNELORG_MIRROR}/linux/kernel/v4.x/patch-${PV}.141.xz;apply=yes;name=stablepatch \ + ${KERNELORG_MIRROR}/linux/kernel/v4.x/patch-${PV}.147.xz;apply=yes;name=stablepatch \ " SRC_URI[kernel.md5sum] = "9a78fa2eb6c68ca5a40ed5af08142599" SRC_URI[kernel.sha256sum] = "401d7c8fef594999a460d10c72c5a94e9c2e1022f16795ec51746b0d165418b2" -SRC_URI[stablepatch.md5sum] = "079f0e943c94f48a5d77e5e5bcd2a297" -SRC_URI[stablepatch.sha256sum] = "2432aeb37c478eee030685303f718e747c21c98a4a7a09c6dca630b6eebe3c5b" +SRC_URI[stablepatch.md5sum] = "a38b9535d049266b3eb81d5b89335d61" +SRC_URI[stablepatch.sha256sum] = "a03aca2026bd12dab45b5405482c1e2abe565c99f621825c834a131cc582093f" SRC_URI += "\ - file://ASoC-pxa-fix-module-autoload-for-platform-drivers.patch \ - \ - file://sharpslpart/0001-mtd-sharpsl-add-sharpslpart-MTD-partition-parser.patch \ - file://sharpslpart/0002-mtd-nand-sharpsl.c-prefer-sharpslpart-MTD-partition-.patch \ - file://sharpslpart/0003-mtd-nand-tmio_nand.c-prefer-sharpslpart-MTD-partitio.patch \ + file://sharpslpart/0001-mtd-sharpslpart-Add-sharpslpart-partition-parser.patch \ + file://sharpslpart/0002-mtd-nand-sharpsl-Add-partition-parsers-platform-data.patch \ + file://sharpslpart/0003-mfd-tmio-Add-partition-parsers-platform-data.patch \ + file://sharpslpart/0004-mtd-nand-sharpsl-Register-partitions-using-the-parse.patch \ + file://sharpslpart/0005-mtd-nand-tmio-Register-partitions-using-the-parsers.patch \ + file://sharpslpart/0006-ARM-pxa-corgi-Remove-hardcoded-partitioning-use-shar.patch \ + file://sharpslpart/0007-ARM-pxa-tosa-Remove-hardcoded-partitioning-use-sharp.patch \ + file://sharpslpart/0008-ARM-pxa-spitz-Remove-hardcoded-partitioning-use-shar.patch \ + file://sharpslpart/0009-ARM-pxa-poodle-Remove-hardcoded-partitioning-use-sha.patch \ " LOCOMO_PATCHES = "\ |