Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 25B8FE00DF0; Tue, 19 Jul 2016 05:18:37 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.220.193 listed in list.dnswl.org] Received: from mail-qk0-f193.google.com (mail-qk0-f193.google.com [209.85.220.193]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id BA604E00CC4 for ; Tue, 19 Jul 2016 05:18:34 -0700 (PDT) Received: by mail-qk0-f193.google.com with SMTP id p126so1279337qke.1 for ; Tue, 19 Jul 2016 05:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ossystems-com-br.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ejHfgtFalE9FIQo9jX2RP6kzA/bTPZrM1Oi6KDFVFVg=; b=1pPc+qsQnLqmcd4lLIz7IgPYW8pK3zHTAa5ygw4Pd1ZTd7SqdgiH1O9po9KsQFg5fE 6RmbgSFY+1fMnU43AXL/TXePaPYNSjQpujf9kzg4fb3qosD2z/uqM/79k8BArq7GKHzI 4qrLBw5OgjQDaMEoB7tbjDQ2KZDHyxUxoxHYhoYtn0j43gl3V3kUBYlJHSQV/ii2+k+9 tA+/jnolbErgpDwxf1KEwYZg4yVu79SR3jY6xK1B4gVNMf8QIxZWTbLpF1GWLP8gv7I7 DUluWtGaab7vrrzi+4kUnmTk1K0pVCqPJcQp6Xuv+rmL0ap3MPkmAWrTCc/YF05qe5+m +gtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ejHfgtFalE9FIQo9jX2RP6kzA/bTPZrM1Oi6KDFVFVg=; b=MihSitwUpPsAXp70zg3EUcDjrq0xTnuAIeO1+cvLnXdm9oc/NCb2fG853wKrbf31Ct /bVZX4v2HHKvBeE4HmOxOuDKy2c47U8MCVhYK6sUw4/2/zpY58NkfKSui1WBJ9K/o+NO ZmJhjfjsXPkZzBEc93TNJ3kzFgScDOO49uWkOE9qoRa7VeC0ljs1r2sPEBbR9BamAB2A ISrXs18129R9oQLsQ9inzI3ppoAmjPyecVTVcveZAkRLGP+gIM1Py1Pv7I4egkf9fPfF +qHEaaho5YxseR541fCTydObWjGGZqVWFolaUiSiMmR0k+Gs/5Dtau1bYffF8WeEX3eC 75kA== X-Gm-Message-State: ALyK8tJE878c3k7lw4/vUs6S0LEYBhwG/3acAxkPKWQ1YGDvfFagIyXAYtaDCYWq3K1kaA== X-Received: by 10.55.203.74 with SMTP id d71mr1142762qkj.88.1468930713506; Tue, 19 Jul 2016 05:18:33 -0700 (PDT) Received: from monster.lab.ossystems.com.br ([177.100.227.79]) by smtp.gmail.com with ESMTPSA id 130sm908777qkf.4.2016.07.19.05.18.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 05:18:32 -0700 (PDT) From: Fabio Berton To: meta-freescale@yoctoproject.org Date: Tue, 19 Jul 2016 09:18:19 -0300 Message-Id: <1468930699-29791-1-git-send-email-fabio.berton@ossystems.com.br> X-Mailer: git-send-email 2.1.4 Subject: [PATCH] imx-kobs: Allow kobs-ng to flash the SPL on the 4.x kernel X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2016 12:18:37 -0000 Add function to check if kernel support raw_mode and fix function that calculates the geometry based on known info from the mtd partitionmtd geometry. These patches were copied from: https://github.com/Gateworks/openwrt/commit/379e87df4fb67198fe900ffe2a394e69fbd47801 Signed-off-by: Fabio Berton --- .../imx-kobs/imx-kobs/fix-cal_nfc_geometry.patch | 31 ++++++++++++++ recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch | 48 ++++++++++++++++++++++ recipes-bsp/imx-kobs/imx-kobs_5.4.bb | 2 + 3 files changed, 81 insertions(+) create mode 100644 recipes-bsp/imx-kobs/imx-kobs/fix-cal_nfc_geometry.patch create mode 100644 recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch diff --git a/recipes-bsp/imx-kobs/imx-kobs/fix-cal_nfc_geometry.patch b/recipes-bsp/imx-kobs/imx-kobs/fix-cal_nfc_geometry.patch new file mode 100644 index 0000000..dddb49a --- /dev/null +++ b/recipes-bsp/imx-kobs/imx-kobs/fix-cal_nfc_geometry.patch @@ -0,0 +1,31 @@ +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. + +Upstream-Status: Pending + +--- 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/recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch b/recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch new file mode 100644 index 0000000..76c2440 --- /dev/null +++ b/recipes-bsp/imx-kobs/imx-kobs/raw-mode.patch @@ -0,0 +1,48 @@ +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. + +Upstream-Status: Pending + +--- a/src/mtd.c ++++ b/src/mtd.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + #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/recipes-bsp/imx-kobs/imx-kobs_5.4.bb b/recipes-bsp/imx-kobs/imx-kobs_5.4.bb index 1d33d40..de396a1 100644 --- a/recipes-bsp/imx-kobs/imx-kobs_5.4.bb +++ b/recipes-bsp/imx-kobs/imx-kobs_5.4.bb @@ -7,6 +7,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" SRC_URI = "${FSL_MIRROR}/imx-kobs-${PV}.tar.gz \ file://fix-compile.patch \ + file://raw-mode.patch \ + file://fix-cal_nfc_geometry.patch \ " SRC_URI[md5sum] = "77467d834f858c2ec216841583e5f437" -- 2.1.4