Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55038C433FE for ; Mon, 22 Nov 2021 07:33:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2DF9F83665; Mon, 22 Nov 2021 08:33:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="Bd4xBVD6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 29A398361E; Mon, 22 Nov 2021 08:33:43 +0100 (CET) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2DC1983680 for ; Mon, 22 Nov 2021 08:33:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=5960d79c8b=patrice.chotard@foss.st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1AM3kNru013732; Mon, 22 Nov 2021 08:33:39 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=ACYyu5GtWU8dErHCvv3ePZUIeqU2elrVjg2c9X4EDz0=; b=Bd4xBVD6nClbnpA3JwMMQNItCxPeyry+MqsCTDMY/AJBY9TBluN1RJUyFXdfeZvdB1Gz oKU/PAAMUB4QY/EuyYjUMc+3a0m5qkmQrj9X+M8urT/Y534JOipiIieydu23ewuW1zzg eTpu0YOpA3yoLGesrIm6IBZKhvVjRJ1vBn2UiiiF91RjzPdAlkP+TtqtWO7Ma6i6eFvE HJ6ozjSnQ3aXs9vXrOn+KabWc+ZQLzsW58BFjK5GtCoKKThzwK0Rfc+iQeOcbRfQwAp7 qBVBFILHHgxLbfe6xvuINgwyJnx2VSToJ29ptzqflWRJEdOp2yTC3SzyJ9QeuW+MD85h dA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3cfjepuwh0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Nov 2021 08:33:39 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2F81E10002A; Mon, 22 Nov 2021 08:33:35 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 268B52171DB; Mon, 22 Nov 2021 08:33:35 +0100 (CET) Received: from lmecxl0573.lme.st.com (10.75.127.46) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Mon, 22 Nov 2021 08:33:34 +0100 Subject: Re: [Uboot-stm32] [PATCH 5/7] common: add fdt_simplefb_enable_and_mem_rsv function To: Patrick Delaunay , CC: Marek Vasut , Simon Glass , U-Boot STM32 References: <20211115153223.563377-1-patrick.delaunay@foss.st.com> <20211115163155.5.I9d5be95eede5162b9b7b74778d8c7620e6762e56@changeid> From: Patrice CHOTARD Message-ID: <483d5052-c409-c106-b0a8-58bfa65fe2af@foss.st.com> Date: Mon, 22 Nov 2021 08:33:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211115163155.5.I9d5be95eede5162b9b7b74778d8c7620e6762e56@changeid> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG1NODE3.st.com (10.75.127.3) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-22_03,2021-11-22_01,2020-04-07_01 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Patrick On 11/15/21 4:32 PM, Patrick Delaunay wrote: > Add a new function to activate an existing simple frame buffer node > and add the associated reserved memory, with no-map properties. > > This device tree update is only done when the video device is active > and the video buffer is used. > > This patch uses '#if CONFIG_IS_ENABLED(DM_VIDEO)' because > gd->video_bottom and gd->video_top are only defined when CONFIG_DM_VIDEO > is activated. > > Signed-off-by: Patrick Delaunay > --- > > common/fdt_simplefb.c | 27 +++++++++++++++++++++++++++ > include/fdt_simplefb.h | 1 + > 2 files changed, 28 insertions(+) > > diff --git a/common/fdt_simplefb.c b/common/fdt_simplefb.c > index 32173030ab..c52846f4bc 100644 > --- a/common/fdt_simplefb.c > +++ b/common/fdt_simplefb.c > @@ -89,3 +89,30 @@ int fdt_simplefb_enable_existing_node(void *blob) > > return fdt_simplefb_configure_node(blob, off); > } > + > +#if CONFIG_IS_ENABLED(DM_VIDEO) > +int fdt_simplefb_enable_and_mem_rsv(void *blob) > +{ > + struct fdt_memory mem; > + int ret; > + > + /* nothing to do when video is not active */ > + if (!video_is_active()) > + return 0; > + > + ret = fdt_simplefb_enable_existing_node(blob); > + if (ret) > + return ret; > + > + /* nothing to do when the frame buffer is not defined */ > + if (gd->video_bottom == gd->video_top) > + return 0; > + > + /* reserved with no-map tag the video buffer */ > + mem.start = gd->video_bottom; > + mem.end = gd->video_top - 1; > + > + return fdtdec_add_reserved_memory(blob, "framebuffer", &mem, NULL, 0, NULL, > + FDTDEC_RESERVED_MEMORY_NO_MAP); > +} > +#endif > diff --git a/include/fdt_simplefb.h b/include/fdt_simplefb.h > index 7e54723591..41cd740ac0 100644 > --- a/include/fdt_simplefb.h > +++ b/include/fdt_simplefb.h > @@ -10,4 +10,5 @@ > #define _FDT_SIMPLEFB_H_ > int fdt_simplefb_add_node(void *blob); > int fdt_simplefb_enable_existing_node(void *blob); > +int fdt_simplefb_enable_and_mem_rsv(void *blob); > #endif > Reviewed-by: Patrice Chotard Thanks Patrice