From patchwork Tue Oct 10 05:34:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 115335 Delivered-To: patches@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3355595qgn; Mon, 9 Oct 2017 22:34:33 -0700 (PDT) X-Received: by 10.99.176.79 with SMTP id z15mr11040539pgo.230.1507613673129; Mon, 09 Oct 2017 22:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507613673; cv=none; d=google.com; s=arc-20160816; b=geuhBadV2m1OEmAqUykjL0kaqhrkG5CZfBN/w/nX7H+DEUWK4KSEUjrQ0A9BMnRJjf cFpG0luqx6xV49eexq8KrehyCEX3Puun1M9CcttQYi2aE2Hd7yBWlHuZm+7iem2Co/ZJ 8BWhu5HR0jY0TDuJFuLwY4KlGCgw0ui8Z4F/QzBH2rUCP7G6z3gTtCpiua+TIIQCRtE/ tMR5grdbcJmMHq576IldJU/bZI61SU/Ww2TPnckBhfBQFZe/Pl2itSueVJZv3h7Gabas V7qIP/yJS5GTmyTIfGGUZOq1uTMR7RThORITj4nacITDO21JLajpYhGZJpfUbVRSPeX+ 3IWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=oyBGrreuEehOIgRBjcmGcyWNneK5HzR45wbuPAHHq78=; b=JXMGO9h48eIC2LU5VrtkLt8ftu7Aht7uZjlF0aG0Q32EiVRKvivCiibjoyLCwVZ2Ma g3ulK9wZ7Wg/faHRsaCoLTsKryVAtB4IygSxD0ec+0RFofcolpwS/N+xbITEywWYuDjX N95dZTAjR95IAy74jH8cXsfIHo7Pi3t4lxoeEFVHgFWiyaOvidIx3P31KVOk4pr7b8n6 n7lMCZ2zfwJO458EhN257jnLJXy73qb/d2+jaCUtSck+LVXY4zVFZPNkPSFFTQF+NB+f HbiaaEWgI8N9wpd+pmySDKVMsJ95pTlszl3aOUx4uBf+X+umxuvrbvKfFdrg09fE7ZNS tc+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hVTCr6cS; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id v6sor1413230plp.52.2017.10.09.22.34.33 for (Google Transport Security); Mon, 09 Oct 2017 22:34:33 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hVTCr6cS; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oyBGrreuEehOIgRBjcmGcyWNneK5HzR45wbuPAHHq78=; b=hVTCr6cSuxoKfdfXxtz2BCov0jyBbRZXNWsqQV1BYJRArbykNr/olgsut6aWyZxSfE sFi6CRHmOQ1v0/zQs4O0lD3ZOyT8PbvE/7+36T1ikGAZx6zA6cVftodeZViz+ZGxod3b wsB7AZgu3ew4TQAmEXxNYjXAjZ+T0FArFQa70= 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:in-reply-to :references; bh=oyBGrreuEehOIgRBjcmGcyWNneK5HzR45wbuPAHHq78=; b=sLrsTZVSoY8V0SXslig1XqAPbuZoXQ90e+5Hquu8lT7wrcYFy1j/e4Wv3pJH4rBryA rKsQVLvkoDBnjHmEexbpktotZqQXHjzl63a4JD0EMEJX/IP6dXvbyDnSno0pVp+p3X4h zngJ4TdlYc+HdTUTFypLug04qYTHJiKCgDml6l1t/OLVnFYP0R9nCRoAhZm5LY0CrLRc ZKzqzAKjDhZX8aVnlxQB02FQv8XmTDp5Zq1KyIbmq1JXPIj6rIT9/o0rdUqSUsCqIWm7 2k/sjk+yL2H1fRTKd4YUqDZaQ9FhD/A2qdbfhawkYYP2ue/c/qxUO/aLPC2wzBiNWAXi CyUg== X-Gm-Message-State: AMCzsaUz8Q3uv2oWJ4dNHUYeRAZBpbW7qzuQHfo1jd7iOGTV/BOfHqx9 BvFIV7IPIXF+ZCHmxfYimQYyy3ZM X-Google-Smtp-Source: AOwi7QCRBkH6o91T4+GjgCRW/A4r/WLs2HtGOTD5LjUN+95Y/F7A/5Q966MRi0sLfDvdtQA9R0ogxA== X-Received: by 10.84.234.2 with SMTP id m2mr11219791plk.391.1507613672803; Mon, 09 Oct 2017 22:34:32 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id b16sm9603595pfe.58.2017.10.09.22.34.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 22:34:31 -0700 (PDT) From: John Stultz To: lkml Cc: Dmitry Shmidt , Rob Herring , Mark Rutland , Frank Rowand , devicetree@vger.kernel.org, John Stultz Subject: [RFC][PATCH 1/3] of: overlay_mgr: Add overlay manager driver Date: Mon, 9 Oct 2017 22:34:18 -0700 Message-Id: <1507613660-27236-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507613660-27236-1-git-send-email-john.stultz@linaro.org> References: <1507613660-27236-1-git-send-email-john.stultz@linaro.org> From: Dmitry Shmidt This patch adds a driver to manage applying pre-defined DT overlay fragments at bootup. The pre-defined DT fragments are specified via the main overlay_mng entry which includes all the possible HW config setups. Then kernel command line option is used to choose between them. These entries are specified on kernel boot arguments as follows: overlay_mgr.overlay_dt_entry=hardware_cfg_0 Example DT entry: overlay_mgr { compatible = "linux,overlay_manager"; hardware_cfg_0 { overlay@0 { fragment@0 { __overlay__ { }; }; }; overlay@1 { fragment@0 { __overlay__ { }; }; }; }; }; Cc: Rob Herring Cc: Mark Rutland Cc: Frank Rowand Cc: Dmitry Shmidt Cc: devicetree@vger.kernel.org Signed-off-by: Dmitry Shmidt [jstultz: Reworded commit message] Signed-off-by: John Stultz --- .../devicetree/bindings/of/overlay_mgr.txt | 32 ++++++++ drivers/of/Kconfig | 10 +++ drivers/of/Makefile | 1 + drivers/of/overlay_mgr.c | 90 ++++++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 Documentation/devicetree/bindings/of/overlay_mgr.txt create mode 100644 drivers/of/overlay_mgr.c -- 2.7.4 diff --git a/Documentation/devicetree/bindings/of/overlay_mgr.txt b/Documentation/devicetree/bindings/of/overlay_mgr.txt new file mode 100644 index 0000000..5f3ce4c --- /dev/null +++ b/Documentation/devicetree/bindings/of/overlay_mgr.txt @@ -0,0 +1,32 @@ +overlay_mgr + +Required properties: +- compatible: "linux,overlay_manager"; + +Optional properties: +- starts from the word "hardware": hardware_cfg_0 + +These properties can be chosen from kernel command line: +overlay_mgr.overlay_dt_entry=hardware_cfg_0 +DT contains main overlay_mng entry with all possible +HW config setups. And then kernel command line option +will allow to choose between them. + +Example: + overlay_mgr { + compatible = "linux,overlay_manager"; + hardware_cfg_0 { + overlay@0 { + fragment@0 { + __overlay__ { + }; + }; + }; + overlay@1 { + fragment@0 { + __overlay__ { + }; + }; + }; + }; + }; diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index ba7b034..5132e41 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -112,4 +112,14 @@ config OF_OVERLAY config OF_NUMA bool +config OF_OVERLAY_MGR + bool "Enable Overlay manager" + default n + depends on OF_OVERLAY + help + Enables Overlay manager - it accepts DT entry from command line + overlay_mgr.overlay_dt_entry= and applies all overlays in + it to current DT. It is also possible to apply predefined DT + entry on the fly by writing it to 'current_overlay' sysfs entry. + endif # OF diff --git a/drivers/of/Makefile b/drivers/of/Makefile index 97dc01c..e2b8afa 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -14,5 +14,6 @@ obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o obj-$(CONFIG_OF_RESOLVE) += resolver.o obj-$(CONFIG_OF_OVERLAY) += overlay.o obj-$(CONFIG_OF_NUMA) += of_numa.o +obj-$(CONFIG_OF_OVERLAY_MGR) += overlay_mgr.o obj-$(CONFIG_OF_UNITTEST) += unittest-data/ diff --git a/drivers/of/overlay_mgr.c b/drivers/of/overlay_mgr.c new file mode 100644 index 0000000..1fdeb0a --- /dev/null +++ b/drivers/of/overlay_mgr.c @@ -0,0 +1,90 @@ +/* + * Overlay manager that allows to apply list of overlays from DT entry + * + * Copyright (C) 2016 Google, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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 +#include +#include +#include +#include + +static char *of_overlay_dt_entry; +module_param_named(overlay_dt_entry, of_overlay_dt_entry, charp, 0644); + +static int of_overlay_mgr_apply_overlay(struct device_node *onp) +{ + int ret; + + ret = of_overlay_create(onp); + if (ret < 0) { + pr_err("overlay_mgr: fail to create overlay: %d\n", ret); + of_node_put(onp); + return ret; + } + pr_info("overlay_mgr: %s overlay applied\n", onp->name); + return 0; +} + +static int of_overlay_mgr_apply_dt(struct device *dev, char *dt_entry) +{ + struct device_node *enp = dev->of_node; + struct device_node *next; + struct device_node *prev = NULL; + + if (!enp) { + pr_err("overlay_mgr: no dt entry\n"); + return -ENODEV; + } + + enp = of_get_child_by_name(enp, dt_entry); + if (!enp) { + pr_err("overlay_mgr: dt entry %s not found\n", dt_entry); + return -ENODEV; + } + pr_info("overlay_mgr: apply %s dt entry\n", enp->name); + while ((next = of_get_next_available_child(enp, prev)) != NULL) { + if (strncmp(next->name, "overlay", 7) == 0) + of_overlay_mgr_apply_overlay(next); + prev = next; + } + return 0; +} + +static int of_overlay_mgr_probe(struct platform_device *pdev) +{ + if (!of_overlay_dt_entry) + return 0; + of_overlay_mgr_apply_dt(&pdev->dev, of_overlay_dt_entry); + return 0; +} + +static const struct of_device_id of_overlay_mgr_match[] = { + { .compatible = "linux,overlay_manager", }, + {} +}; + +static struct platform_driver of_overlay_mgr_driver = { + .probe = of_overlay_mgr_probe, + .driver = { + .name = "overlay_manager", + .of_match_table = of_match_ptr(of_overlay_mgr_match), + }, +}; + +static int __init of_overlay_mgr_init(void) +{ + return platform_driver_register(&of_overlay_mgr_driver); +} + +postcore_initcall(of_overlay_mgr_init); From patchwork Tue Oct 10 05:34:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 115336 Delivered-To: patches@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3355631qgn; Mon, 9 Oct 2017 22:34:35 -0700 (PDT) X-Received: by 10.101.78.5 with SMTP id r5mr6747609pgt.94.1507613675593; Mon, 09 Oct 2017 22:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507613675; cv=none; d=google.com; s=arc-20160816; b=iZ+CMvREBi3mViyGOVIxSv8ruKaGPCbPJWHftzIfZOExOuhzI+B6CdBSpR9Yh/s/RC M2SXF4tjHGc+JKYCpZJgEFBcW2uACJ9DwO/ZbmxDlVM63O9Lh3HaV73kuBzyq+wKBjuW HZ01jg1P8MoOcrwRSL0xfp90kyhEvaHkXhfBEmmGQZtrR+i/hFSINlH0/+6lmceMdS4Q 2fvRQIomJhs/bYCpEmU4HkKexXE4hfOSlv9NG+y9Gnig3nnM4u6QGnHVS5nL/YxRLvZx +DPng+R3vtdghcfChCPHe/4PgcGt8+LZNIbKBj4bEwobKo1IrP0EPScrzrfl4fA0p7kx LSWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=O4yjzLdC+7aZu4JokVh8d7qW7Hg1i4eWnODOmX7qS/0=; b=I959niU2tz0vyHjSiS7PiI2/3fsSiANxCLNoUU+QgGi4qTPQoFiteX1uIgsiM5EwJm dhqjaQWCkYqeKvaznLXUOQBaCZHiXNdSQb4OTGBs+8BzQOhOKpdu9Ufb37G/f1qxH/GQ ig6Rc4s7GTV1ZqbGtvdFKe4NwEmNP2wHlhO9h4VAPh+cES913z6q7pXzsFB3lV1MrGxw vETPSvu2P5vBXjU5+BRDY0pYXz1h8Ag4hPlrhe77hovEy3T9BSpv1y0xWPYWTwjk4Q8e JZg0HbJLX0+ozHmsV7R+9w1G7qdE2UyL5uF00xhH5lb2WKidM21v2UASCZDLh2t8J10J U7iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyDLGW/y; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 61sor1496058plb.119.2017.10.09.22.34.35 for (Google Transport Security); Mon, 09 Oct 2017 22:34:35 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyDLGW/y; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=O4yjzLdC+7aZu4JokVh8d7qW7Hg1i4eWnODOmX7qS/0=; b=NyDLGW/yj8b2fAw+j4e61uW0p6h5/BRrbyxc9wYfPbDCQ9zT/CQJ8JMtzaiW0qxrLD 63/Z+qIr01HavR799nOltero7gLhOngXwIOfiDwd+6kT+12kfDhVYbeyuSmYsqrJh/WW 0MUdHqeTFHxqGq7IysQHNITm5dKw7/358RBsY= 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:in-reply-to :references; bh=O4yjzLdC+7aZu4JokVh8d7qW7Hg1i4eWnODOmX7qS/0=; b=oFHxcD2MBTVRagzpE/EZW4HcVxUwstDGd5ySNI5oVlMwWim5S+MfidwDT+3s7L9t9j TH8ygbc7PmVLpvsDdOeiJOrlvGoN7+7rikY83Pv+33gNtSWEDr1+mlm1AjFMeMMX/sfK 36fGleOeS66K1kOsKjUZAC1/d7aiEQyhYykN+R+W2UwTkb9HWxkj5Yow2AM589RHsJPU gUwAKirvXT1ZqBF69tTxe+SEt1FuZlTaCTA+5rqMZLbvEv5v56sGkvAZ7WPbil2qkvFn N4yLfs5cGx8uIaPrbX0sGI8cMRb5oiEu9knIDOz0DmSV4c6BHqLql2fgws11JurrhqjJ mE6A== X-Gm-Message-State: AMCzsaWy6dc0Yn+D3CECBf7jEKcwsHrlyry6pRuNMsPTKBWTiOozxjvO JGk03cRe5yZl3tcF0lGHaCEAAM+2 X-Google-Smtp-Source: AOwi7QBTmcC0cRbzSOod498ivx3ysT4WxMJ8hh+k46L1aioldIdpq3MvWyqCsTaBc1x06G+V9232Lw== X-Received: by 10.84.241.201 with SMTP id t9mr11117237plm.154.1507613675287; Mon, 09 Oct 2017 22:34:35 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id b16sm9603595pfe.58.2017.10.09.22.34.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 22:34:34 -0700 (PDT) From: John Stultz To: lkml Cc: Dmitry Shmidt , Rob Herring , Mark Rutland , Frank Rowand , devicetree@vger.kernel.org, John Stultz Subject: [RFC][PATCH 2/3] of: overlay_mgr: Add ability to apply through sysfs entry Date: Mon, 9 Oct 2017 22:34:19 -0700 Message-Id: <1507613660-27236-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507613660-27236-1-git-send-email-john.stultz@linaro.org> References: <1507613660-27236-1-git-send-email-john.stultz@linaro.org> From: Dmitry Shmidt Allow pre-defined overlay_mgr DT fragments to be enabled on the fly by writing to: /sys/devices/platform/overlay_mgr/current_overlay Cc: Rob Herring Cc: Mark Rutland Cc: Frank Rowand Cc: Dmitry Shmidt Cc: devicetree@vger.kernel.org Signed-off-by: Dmitry Shmidt [jstultz: Slightly reworded commit message] Signed-off-by: John Stultz --- drivers/of/overlay_mgr.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) -- 2.7.4 diff --git a/drivers/of/overlay_mgr.c b/drivers/of/overlay_mgr.c index 1fdeb0a..5a082be 100644 --- a/drivers/of/overlay_mgr.c +++ b/drivers/of/overlay_mgr.c @@ -18,10 +18,14 @@ #include #include #include +#include static char *of_overlay_dt_entry; module_param_named(overlay_dt_entry, of_overlay_dt_entry, charp, 0644); +static char *of_overlay_dt_apply; +DEFINE_MUTEX(of_overlay_mgr_mutex); + static int of_overlay_mgr_apply_overlay(struct device_node *onp) { int ret; @@ -61,8 +65,56 @@ static int of_overlay_mgr_apply_dt(struct device *dev, char *dt_entry) return 0; } +static ssize_t current_overlay_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + size_t len; + + mutex_lock(&of_overlay_mgr_mutex); + if (!of_overlay_dt_apply) { + mutex_unlock(&of_overlay_mgr_mutex); + return 0; + } + len = strlen(of_overlay_dt_apply); + if (len >= PAGE_SIZE) + len = PAGE_SIZE - 1; + memcpy(buf, of_overlay_dt_apply, len + 1); + mutex_unlock(&of_overlay_mgr_mutex); + return len; +} + +static ssize_t current_overlay_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t size) +{ + mutex_lock(&of_overlay_mgr_mutex); + kfree(of_overlay_dt_apply); + of_overlay_dt_apply = kmalloc(size, GFP_KERNEL); + if (!of_overlay_dt_apply) { + pr_err("overlay_mgr: fail to allocate memory\n"); + mutex_unlock(&of_overlay_mgr_mutex); + return 0; + } + memcpy(of_overlay_dt_apply, buf, size); + of_overlay_dt_apply[size - 1] = '\0'; + + if (of_overlay_mgr_apply_dt(dev, of_overlay_dt_apply)) { + kfree(of_overlay_dt_apply); + of_overlay_dt_apply = NULL; + size = 0; + } + mutex_unlock(&of_overlay_mgr_mutex); + return size; +} + +static DEVICE_ATTR(current_overlay, 0644, current_overlay_show, + current_overlay_store); + static int of_overlay_mgr_probe(struct platform_device *pdev) { + if (device_create_file(&pdev->dev, &dev_attr_current_overlay)) + pr_err("overlay_mgr: fail to register apply entry\n"); + if (!of_overlay_dt_entry) return 0; of_overlay_mgr_apply_dt(&pdev->dev, of_overlay_dt_entry); From patchwork Tue Oct 10 05:34:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 115337 Delivered-To: patches@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3355664qgn; Mon, 9 Oct 2017 22:34:38 -0700 (PDT) X-Received: by 10.99.181.25 with SMTP id y25mr11075458pge.270.1507613677926; Mon, 09 Oct 2017 22:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507613677; cv=none; d=google.com; s=arc-20160816; b=JsEJ+NCxjTc6mm38+YaYLcdkBDdy4Xf04RGIC8Vln4mzs8XWaShn11voWP6hwyZVcM PQ9sHLnaMlHHf5+GUNpQDqf+UOfa4DjctFooIqjSgLoc6Sd1a6aBNsa00NNwfO1y50QF RhK9Uu5KMWKzSP0wfu5IHQyXIV6ncvKA4wD+A60EeIuh02f0RAJ7Y7jZrKoad1vtL9zR bD4ZFPqWhK9iJlSj3TZWYedB5KFNEB9NynvmEJTqf35WBjAsdjTfYcM9BhJ9kpoEitbW IBe0pdsBOYjfLvX7xuF+oCzSRo43n/Gxynj/aMRaOtuQ6/0Y5aOkL5qjbESZfAe4wn5L 0wDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=2Q6cXyfCDrGFlAhwU1Jx9SMHXa+2PtIyt4p1xzkoch0=; b=eJumgFohzcxXgkgubJzWqpxsFDR2dAMJD/RcAIlJuYFM6ndg3TpkSqxdTCcMA0gm0n GNLvnlmg7FZ11mU2kma+zuzHAa1aEJ2F74p9Ykd4EUTOjhEKBRfzPhlg9QQksIa/ru2x KyV1TxzvK3bHwreBZlagxwiu2AYpqNVvy4nouQmU9IbAeoKEvdCuS0nMUBjEoWuvExLf YBH/yTOjckVaoBQm/WKf6d6r2oR1ybuzINgmxd9v1cpwKIUn30T7HG9ckKxCBji5f20H VAZyE4iKVaCIqy5sXPqwj88gHAgDiEAq+Gfc8fMqwosbA0HDaB0aH4tGjDvTdEg1upxS QvaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b0uR82z8; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id x10sor1576517plv.65.2017.10.09.22.34.37 for (Google Transport Security); Mon, 09 Oct 2017 22:34:37 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b0uR82z8; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2Q6cXyfCDrGFlAhwU1Jx9SMHXa+2PtIyt4p1xzkoch0=; b=b0uR82z8Fi+lKa+inshttDusahdKtUkX4jEUd/qBGQgvOvUFxO5Duoqmyev9czBocU MWE1shkobK6rX+XvtfU4RrByi2s0d/jRUEk4ulS+bRgYGnQq/ogzSmNMuESB9HBVEZz1 TCSO+RdKrHF7UVdkyUDsYTR4qKOOOvfrbv+kA= 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:in-reply-to :references; bh=2Q6cXyfCDrGFlAhwU1Jx9SMHXa+2PtIyt4p1xzkoch0=; b=qFJffRfFs6HkGmrB3bNHaMCYEhmRKqFpuOmoJCOgsEXjrssScamG+X5tzBSNlmUJkV w3Qe1LPWPbur+He2v5s1yzbHMMO2lJic0mSBFh70QHdrW8bINkdhAvtTL35wxIYsOzyg JzZadeFCu13zjZTN5Qs16A8ebSHUt1uQqPUxGAdTDCKt18EFPehvYniHcP6R/fFgO45j BcU3llp01uPahJhh/Ah0yhGLiLMvZBeKTUvckW0bQTELkaYlGoW9GDi4BvXuHFzYOpEz 2Ilpp6277QWk/XLfJltMgsmGkxi43TZPS2IqQPGfDyeR+a9B2ziF05LtAbnM+HYQamhK YggQ== X-Gm-Message-State: AMCzsaVGhYv6BFLx3yoL6FvC3hdBA7MUJuFDoHeRApWXU1giPXlQUoEN Owj3R4WgK959A1iGkZR9Uzvbrqtl X-Google-Smtp-Source: AOwi7QCDKqS2eymj9MPMECvLB9XBr7FeGskBMnAVWlDWKy97bt/37b2vW5ga0sjg0SSE/EbIPNJu9g== X-Received: by 10.84.209.238 with SMTP id y101mr11058828plh.211.1507613677663; Mon, 09 Oct 2017 22:34:37 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id b16sm9603595pfe.58.2017.10.09.22.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 22:34:36 -0700 (PDT) From: John Stultz To: lkml Cc: Dmitry Shmidt , Rob Herring , Mark Rutland , Frank Rowand , devicetree@vger.kernel.org, John Stultz Subject: [RFC][PATCH 3/3] of: overlay_mgr: Add ability to apply several hardware configurations Date: Mon, 9 Oct 2017 22:34:20 -0700 Message-Id: <1507613660-27236-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507613660-27236-1-git-send-email-john.stultz@linaro.org> References: <1507613660-27236-1-git-send-email-john.stultz@linaro.org> From: Dmitry Shmidt This adds the ability to specify multiple DT overlay configurations, which are predefined in the overlay_mgr entry, at once via the boot arguments. Example: overlay_mgr.overlay_dt_entry=hardware_cfg_0,hardware_cfg_1,... Cc: Rob Herring Cc: Mark Rutland Cc: Frank Rowand Cc: Dmitry Shmidt Cc: devicetree@vger.kernel.org Signed-off-by: Dmitry Shmidt [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/of/overlay_mgr.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/of/overlay_mgr.c b/drivers/of/overlay_mgr.c index 5a082be..6b15f7c 100644 --- a/drivers/of/overlay_mgr.c +++ b/drivers/of/overlay_mgr.c @@ -112,12 +112,22 @@ static DEVICE_ATTR(current_overlay, 0644, current_overlay_show, static int of_overlay_mgr_probe(struct platform_device *pdev) { + char *cur_entry; + char *next_entry; + if (device_create_file(&pdev->dev, &dev_attr_current_overlay)) pr_err("overlay_mgr: fail to register apply entry\n"); if (!of_overlay_dt_entry) return 0; - of_overlay_mgr_apply_dt(&pdev->dev, of_overlay_dt_entry); + next_entry = of_overlay_dt_entry; + do { + cur_entry = next_entry; + next_entry = strchr(cur_entry, ','); + if (next_entry) + *next_entry++ = '\0'; + of_overlay_mgr_apply_dt(&pdev->dev, cur_entry); + } while (next_entry); return 0; }