From patchwork Thu Mar 21 08:50:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 182 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8FDC53F9BA for ; Thu, 21 Mar 2019 09:50:17 +0100 (CET) Received: by mail-pg1-f197.google.com with SMTP id m17sf5050831pgk.3 for ; Thu, 21 Mar 2019 01:50:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1553158215; cv=pass; d=google.com; s=arc-20160816; b=ioc5CyueKUIWzSZjiqJ7bL2oAMXwe7f1xQJLUsfq77iWn+YNidGRVPQ9VzgpIMHcCU WY82cjdjptBfAMil2PUkHIYKxBEll+rtqunRMggBPOol95Z6gEuXKEXpFU7XCIhVEPVd yPOHQ/wmQX5TJy1Z/QEHzYMKR8kISWGKOZ9BPoWKn8K6fzjvO7sDvQPh5Z3ImSeVgyxG i9ZARL+gd03pMRkPFSWZzIoY0iCA/wQZBKG+8acwfvgYX5Ek/kY/Ts2vM31Vx9xv5Pqu Q6NJ7tG9E+6DS+QyjtF61eIasc5RdZW398NwygBkVo1JeAxhNObCHIBV1wKPE5tWaCw3 d43g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=JNZOeKodTrQuEE/8u+UYAtGEQTQe73M7wp556677yho=; b=lNe7365DR7ukbINMQkvM6eJPYO6VuVfVIYl8MXWE+Yml6NGHVjfxnw6vy6dDDNTFgN 7yVY968adYaZcHIfhMOjPUajxRQs490RsfPsFktVEL00pLG0955M1/ueHWlEWDf/ycZT 3hicUkuneqICDHSm8MDk9TJ3H+v1M0nH2+/Zijq4sMZDZGKSCoLs6DHMe3kckrHpsDH+ 4g/fL9QdUjbffKXBLwlMz0n4un1B4JV+OU0NYFJtHXKGG05Mi4L+8GlTXoup3rqOMDww jMzQoR0alZX4GepfFKbGFZUPbyFJPoMqKtE2imjXpuQS99g0+mm0jxKSOV3e1Cl3LqtC N/Ow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Bavzh351; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=JNZOeKodTrQuEE/8u+UYAtGEQTQe73M7wp556677yho=; b=NslOhq/YS7y3+fueuGBDb+WOLX7+IxDKDyW0DF4/R4jKPr0OhXqghFJ0+6c+E1yDx2 2Bict9nBiUekJvW8ov+2POrRytZ3FwlkVRSDNx4wNar4V1X+PUyPazwPsoKKQ969lt4B ZSsJgYfgYHPIu+DwS5M14dRhrwTm9xOt/7qj4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=JNZOeKodTrQuEE/8u+UYAtGEQTQe73M7wp556677yho=; b=jjFbE8ztPPuKjY5xPZZweS1liQrOekkvAfratZWDyoeBmUA4cR4ifZxCAzmWM/myx7 8CtZpKzl+nitDodHFn9vv+SMoIWRp8yII4jS9/zNaxKMSred1l62090JpOh+e446Nawx txg5SWn3iQ4zgRLzpvArAwBW94g3co0AnAr0g3L6zMqdcMsvcD1wO5xriwHMgCRjhAo1 ZrpABCCVEtlI2de+/YZjNXGGEylZVOcbprsIasboUUjQd3S0eaRhTJTB1wcovYuxzK5T 6CAEwvu0RaAPtZWYbD3CkExIhtXfNzu4jcE37OOZfH6zrHNkHUaiMafjQmT6lXC/wEmi P3Rw== X-Gm-Message-State: APjAAAVKzwH6PYthznQqtZdkb1m3rweExgRJKWMrfMdf82cnsskNcY1L LcAtuc8lK9yUqHDFJkIlwYaQk70u X-Google-Smtp-Source: APXvYqy0Lo87RPVH1bfryDixwUVy/+zaUGWdiLxljCLGjPLbVg/aN/TVoYF6OEY/0lUn8BEqxM5aiA== X-Received: by 2002:a62:6fc6:: with SMTP id k189mr99498pfc.66.1553158215416; Thu, 21 Mar 2019 01:50:15 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:92d1:: with SMTP id k17ls2009365pfa.8.gmail; Thu, 21 Mar 2019 01:50:15 -0700 (PDT) X-Received: by 2002:a63:f412:: with SMTP id g18mr2298462pgi.444.1553158215053; Thu, 21 Mar 2019 01:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553158215; cv=none; d=google.com; s=arc-20160816; b=c4YXfhkYM3kcJqYABpaWixV86bOuwsHX8TSxQC677UPSHnJxPJpnOs5bIUwRgRC0MP ZSOgWObhagU9uubqSUVPxP1GoObJe4VRi4/81akdmRqTSSBsmfmV6VFjKm9vmgDiQkQb 95nA5gmu2tC0XwkbFfVll1NITj8ecjknV4MOrb75JIiUKOEVmZjf5iFhxxfzH8TyBDAr i0lcFiiwo+yW+btzBOSy9C8lovyLGM2oUJLyHRt8XNsiBgmIUmqmbpsEfXLCx5htd3Nl K/2v8eDuNS+ASxIQ0a7JuvNhv3AA8K2HmDSMmxxnZhWAJIPPgvJaB2PfNQf6Pnml9u04 Pz0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=ChBaxoByXNgJtUhVhBXxmlTapGx/52sqE7fJltwbea0=; b=DuPjeJB4pWZIr/XKjc4FWIqypsTQcueIk1mma+hCgfE01xXAnp0hiCarf+BUGxHeXG cbYuo3oM6q8zSFW+SkH3mxkakQTOK2Jenc6ais9pYd7+kRhY6SArjV8odu+WhI50bDEv +3mfjx/qRyHQgGfWqg0xmFUbTPZBUPlIVxRebkDZKx7tT/pXlEWIq8PpheFv4avbzca8 Za5XMEShAA7Wl62+qnMOVoeL1nz3lKkDsmGF1qGNMN1PGj+G8nhrxtwq93UdF9WurObc O3Z3i9NJ82ISYTokKbbYWKxUcyRn9XeiQRNR+dwJvfDGTtOVbh/OC9UM0qhUUsd0phhu JcRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Bavzh351; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w19sor6142290ply.45.2019.03.21.01.50.14 for (Google Transport Security); Thu, 21 Mar 2019 01:50:14 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:902:9341:: with SMTP id g1mr2407356plp.80.1553158214092; Thu, 21 Mar 2019 01:50:14 -0700 (PDT) Received: from localhost.localdomain ([49.206.202.234]) by smtp.gmail.com with ESMTPSA id n82sm9682663pfi.63.2019.03.21.01.50.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Mar 2019 01:50:13 -0700 (PDT) From: Jagan Teki To: Shyam Saini Cc: Michael Trimarchi , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 1/2] board: engicam: Handle mmc recovery partition, root Date: Thu, 21 Mar 2019 14:20:01 +0530 Message-Id: <20190321085002.21084-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Bavzh351; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Since i.CoreM6 support recovery boot via bootcount, update the mmcpart and mmcroot dynamically based on used mmc partition layout instead statically defined in include/configs. Signed-off-by: Jagan Teki --- board/engicam/common/board.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c index 7486f0ac2d..571d36fc63 100644 --- a/board/engicam/common/board.c +++ b/board/engicam/common/board.c @@ -19,12 +19,20 @@ static void mmc_late_init(void) { char cmd[32]; char mmcblk[32]; + unsigned long bootcount = bootcount_load() + 1; + unsigned long bootlimit = env_get_ulong("bootlimit", 10, 0); u32 dev_no = mmc_get_env_dev(); + u32 mmcpart = 1; env_set_ulong("mmcdev", dev_no); + if (bootlimit && bootcount > bootlimit) + mmcpart = 3; + + env_set_ulong("mmcpart", mmcpart); + /* Set mmcblk env */ - sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no); + sprintf(mmcblk, "/dev/mmcblk%dp%d rootwait rw", dev_no, mmcpart + 1); env_set("mmcroot", mmcblk); sprintf(cmd, "mmc dev %d", dev_no);