From 1d9800bc3d3d122d39e9a019f102852dc29dcf02 Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Wed, 16 Nov 2016 14:00:05 +1030 Subject: Fix pflash PNOR access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pflash changes: Move to latest upstream release of skiboot which includes the mtd erase patch we were carrying. Adds a patch to fix parsing of the longer mtd labels we have since updating the device tree bindings. dev: size erasesize name mtd0: 00060000 00001000 "u-boot" mtd1: 00020000 00001000 "u-boot-env" mtd2: 00280000 00001000 "kernel" mtd3: 001c0000 00001000 "initramfs" mtd4: 01740000 00001000 "rofs" mtd5: 00400000 00001000 "rwfs" mtd6: 02000000 00001000 "1e620000.flash-controller:flash@1" mtd7: 08000000 00001000 "1e630000.flash-controller:pnor@0" Linux kernel changes: Three of the patches move the comaptible string for the bt interface to match what we have sent upstream. There is also a dts change to the mtd nodes that add back the 'pnor' label to the PNOR mtd device, as required by pflash. Cédric Le Goater (2): ipmi/bt-bmc: change compatible node to 'aspeed, ast2400-ibt-bmc' ARM: dts: aspeed: fix flash module device nodes Joel Stanley (2): ipmi/bt-bmc: Add comaptible node for ast2500 arm: dts: aspeed: Use upstream comaptible string Fixes openbmc/openbmc#785 Change-Id: If2c293b85075edcf3078ef599e7b61f3a6d77c66 Signed-off-by: Joel Stanley --- .../common/recipes-bsp/skiboot/skiboot.inc | 6 +-- ...arm-Don-t-assume-mtd-partitions-are-short.patch | 52 ++++++++++++++++++++++ ...-common-Teach-ARM-code-to-erase-mtd-chips.patch | 50 --------------------- 3 files changed, 55 insertions(+), 53 deletions(-) create mode 100644 meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot/0002-arch_flash_arm-Don-t-assume-mtd-partitions-are-short.patch delete mode 100644 meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot/0002-external-common-Teach-ARM-code-to-erase-mtd-chips.patch (limited to 'meta-openbmc-machines') diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot.inc b/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot.inc index fa30f091e..702d86512 100644 --- a/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot.inc +++ b/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot.inc @@ -3,14 +3,14 @@ LICENSE = "Apache-2.0" SRC_URI += "git://github.com/open-power/skiboot.git;nobranch=1" SRC_URI += "file://0001-external-Use-more-standard-PREFIX-vs-prefix.patch" -SRC_URI += "file://0002-external-common-Teach-ARM-code-to-erase-mtd-chips.patch" +SRC_URI += "file://0002-arch_flash_arm-Don-t-assume-mtd-partitions-are-short.patch" FILESEXTRAPATHS_append := "${THISDIR}/skiboot:" LIC_FILES_CHKSUM = "file://${S}/LICENCE;md5=3b83ef96387f14655fc854ddc3c6bd57" -SRCREV = "skiboot-5.4.0-rc3" -PV = "5.4.0-rc3" +SRCREV = "skiboot-5.4.0" +PV = "5.4.0" S = "${WORKDIR}/git" diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot/0002-arch_flash_arm-Don-t-assume-mtd-partitions-are-short.patch b/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot/0002-arch_flash_arm-Don-t-assume-mtd-partitions-are-short.patch new file mode 100644 index 000000000..d05659ad2 --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot/0002-arch_flash_arm-Don-t-assume-mtd-partitions-are-short.patch @@ -0,0 +1,52 @@ +From 112b4eebe614ebc384dbb7806ae8508474b44212 Mon Sep 17 00:00:00 2001 +From: Joel Stanley +Date: Wed, 16 Nov 2016 13:33:32 +1030 +Subject: [PATCH] arch_flash_arm: Don't assume mtd labels are short +To: skiboot@lists.ozlabs.org, + Cyril Bur + +pflash relies on arch_flash_arm parsing /proc/mtd to discover the pnor +partition. It helpfully uses strcasestr so it can handle the string +changing, which is what has happened as we moved to upstream compliant +mtd device tree bindings. + +We currently have a string like this: + +dev: size erasesize name +mtd0: 00060000 00001000 "u-boot" +mtd1: 00020000 00001000 "u-boot-env" +mtd2: 00280000 00001000 "kernel" +mtd3: 001c0000 00001000 "initramfs" +mtd4: 01740000 00001000 "rofs" +mtd5: 00400000 00001000 "rwfs" +mtd6: 02000000 00001000 "1e620000.flash-controller:flash@1" +mtd7: 08000000 00001000 "1e630000.flash-controller:pnor@0" + +Unfortunately arch_flash_arm assumes the string will be at most 50 +characters. That's right before the label we're looking for starts so +we ignore that line and keep searching. + +Fix it by allowing for a 255 character line. + +Fixes: 48ab7ce09504 (external/pflash: Add --mtd) +Signed-off-by: Joel Stanley +--- + external/common/arch_flash_arm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/external/common/arch_flash_arm.c b/external/common/arch_flash_arm.c +index bb8800ff556d..3cdd41ded0a9 100644 +--- a/external/common/arch_flash_arm.c ++++ b/external/common/arch_flash_arm.c +@@ -241,7 +241,7 @@ static char *get_dev_mtd(enum flash_access access) + { + FILE *f; + char *ret = NULL, *pos = NULL; +- char line[50]; ++ char line[255]; + + if (access != BMC_MTD && access != PNOR_MTD) + return NULL; +-- +2.10.2 + diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot/0002-external-common-Teach-ARM-code-to-erase-mtd-chips.patch b/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot/0002-external-common-Teach-ARM-code-to-erase-mtd-chips.patch deleted file mode 100644 index 3ed951993..000000000 --- a/meta-openbmc-machines/meta-openpower/common/recipes-bsp/skiboot/skiboot/0002-external-common-Teach-ARM-code-to-erase-mtd-chips.patch +++ /dev/null @@ -1,50 +0,0 @@ -From patchwork Mon Nov 7 06:28:49 2016 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [1/3] external/common: Teach ARM code to erase 'mtd chips' -From: Cyril Bur -X-Patchwork-Id: 691765 -Message-Id: <20161107062851.1016-1-cyril.bur@au1.ibm.com> -To: skiboot@lists.ozlabs.org -Date: Mon, 7 Nov 2016 17:28:49 +1100 - -Currently the arch flash code for all architectures can only perform -chip erases if there is a real flash driver attached. - -With increasing use of MTD on both host and BMC this code needs to know -how to behave of the backend of blocklevel is MTD. - -This patch teaches the ARM specific code to pass an erase for the full -size of the chip down the stack. This can be optimised into a chip erase -within the kernel. - -Signed-off-by: Cyril Bur ---- - external/common/arch_flash_arm.c | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/external/common/arch_flash_arm.c b/external/common/arch_flash_arm.c -index 697609d..bb8800f 100644 ---- a/external/common/arch_flash_arm.c -+++ b/external/common/arch_flash_arm.c -@@ -300,8 +300,17 @@ int arch_flash_erase_chip(struct blocklevel_device *bl) - if (!arch_data.init_bl || arch_data.init_bl != bl) - return -1; - -- if (!arch_data.flash_chip) -- return -1; -+ if (!arch_data.flash_chip) { -+ /* Just assume its a regular erase */ -+ int rc; -+ uint64_t total_size; -+ -+ rc = blocklevel_get_info(bl, NULL, &total_size, NULL); -+ if (rc) -+ return rc; -+ -+ return blocklevel_erase(bl, 0, total_size); -+ } - - return flash_erase_chip(arch_data.flash_chip); - } -- cgit v1.2.1