From patchwork Tue Jan 23 11:34:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 125499 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1699743ljf; Tue, 23 Jan 2018 03:35:11 -0800 (PST) X-Google-Smtp-Source: AH8x225QnlRw5n7IONkuSczsqm9ajqshkempMEwVUts03NwXrWiVp8hbNHZQt5r7UBSZT/NdE6Kf X-Received: by 10.99.95.4 with SMTP id t4mr8351800pgb.291.1516707310995; Tue, 23 Jan 2018 03:35:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516707310; cv=none; d=google.com; s=arc-20160816; b=KVN2JVKvGW+KVvHLd2M0tlmQIglCtS7ntVdp4eYthI7V+0wLKcA3jnDFN7InlfKzoL 4Kjwgo4xlh5U8NFd6uarbOu1fwhKJE2rXAUSynnjGZrfbl5aZA2XilO5RcSrpCXRa1Gz wzs/b+6keFi5XJ1TAASM0fqk7ukCTxkXhq74+oa74O0YaxbMIQ86a8hprsNqtrzmdohL 1u2rtx9CmQaXGFuQ1QcbmiaPYjOGK2f1r/CVRA/brHgnwZAx/JANYxFczNzcvMdsW0zV nzHRvDR6iQ4mFKeiAuyZ6g3zybZh8ApJywTNpgGF9bmlPoVgeWABjXprMzeLrhT5mKdA DR5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=auXjfgf+69h/w/uA1LUUIMcCthBoC7431ia0LT0oEwo=; b=HvdZoYQQ8Zy24W/xhIFgSrJ9ohd5JJAjPWnvfCC4hCcJXVzQwMKZory+WRIq4alxbm /p2e8QNuz08towf/X1XVL3p3v/jmS9/RkYem6cKw7aR8SIWHh5CcE/T81zWVuD5autLt 0hsMswkM6VPdfi1/PT3X7E5QNGWG3SLqbuldqJvBBfLqaxq/FQL1W8OhCkrkQEOCgbAL CvRi3xJcAHIS+2jnabpjg3SuQtnRFhYgJKqPd97QHWZcsCwi+uNbh980YuY32ogNbliQ /mNQ1ku2V/6Qyy/tczxlYhCGx/4rJ228+BvImYKkx0eo633EFHRJz714UWNOptrg1m86 sVoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-fbdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-fbdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b59-v6si4598158plc.302.2018.01.23.03.35.10; Tue, 23 Jan 2018 03:35:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-fbdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-fbdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-fbdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751737AbeAWLfK (ORCPT + 2 others); Tue, 23 Jan 2018 06:35:10 -0500 Received: from mx.socionext.com ([202.248.49.38]:58392 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751334AbeAWLfJ (ORCPT ); Tue, 23 Jan 2018 06:35:09 -0500 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 23 Jan 2018 20:35:08 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 47DDD600D0; Tue, 23 Jan 2018 20:35:08 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Tue, 23 Jan 2018 20:35:15 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id F1FE71A0DED; Tue, 23 Jan 2018 20:35:07 +0900 (JST) From: Kunihiko Hayashi To: Hans de Goede , Bartlomiej Zolnierkiewicz Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi Subject: [PATCH] fbdev: simplefb: add support for 'memory-region' property on DT node Date: Tue, 23 Jan 2018 20:34:56 +0900 Message-Id: <1516707296-23667-1-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Enables 'memory-region' property referring to the memory description on the reserved-memory node in case of devicetree use. If there is no 'reg' property that specifies the address and size of the framebuffer, the address and size written in the memory description on the reserved-memory node can be used for the framebuffer. Furthermore, the reserved-memory node needs to have "no-map" attributes because simplefb driver maps the region by ioremap_wc(). Signed-off-by: Kunihiko Hayashi --- .../bindings/display/simple-framebuffer.txt | 3 ++ drivers/video/fbdev/simplefb.c | 32 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Hans de Goede diff --git a/Documentation/devicetree/bindings/display/simple-framebuffer.txt b/Documentation/devicetree/bindings/display/simple-framebuffer.txt index 5a9ce51..be5139f 100644 --- a/Documentation/devicetree/bindings/display/simple-framebuffer.txt +++ b/Documentation/devicetree/bindings/display/simple-framebuffer.txt @@ -56,6 +56,9 @@ Optional properties: framebuffer remains active. - display : phandle pointing to the primary display hardware node +- memory-region: phandle to a node describing memory region as framebuffer + memory instead of reg property. The node should include + 'no-map'. Example: diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index a3c44ec..aefc4b1 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -294,6 +295,35 @@ static void simplefb_clocks_enable(struct simplefb_par *par, static void simplefb_clocks_destroy(struct simplefb_par *par) { } #endif +#if defined CONFIG_OF +static struct resource *simplefb_parse_dt_reserved_mem(struct device *dev) +{ + static struct resource res; + struct device_node *np; + int ret; + + np = of_parse_phandle(dev->of_node, "memory-region", 0); + if (!np) + return NULL; + + ret = of_address_to_resource(np, 0, &res); + if (ret < 0) + return NULL; + + if (!of_find_property(np, "no-map", NULL)) { + dev_err(dev, "Can't apply mapped reserved-memory\n"); + return NULL; + } + + return &res; +} +#else +static struct resource *simplefb_parse_dt_reserved_mem(struct device *dev) +{ + return NULL; +} +#endif + #if defined CONFIG_OF && defined CONFIG_REGULATOR #define SUPPLY_SUFFIX "-supply" @@ -428,6 +458,8 @@ static int simplefb_probe(struct platform_device *pdev) return ret; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!mem) + mem = simplefb_parse_dt_reserved_mem(&pdev->dev); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); return -EINVAL;