From mboxrd@z Thu Jan 1 00:00:00 1970 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 4654DC433EF for ; Wed, 20 Jul 2022 16:02:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 81A1A8036F; Wed, 20 Jul 2022 18:02:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=herbrechtsmeier.net 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=herbrechtsmeier.net header.i=@herbrechtsmeier.net header.b="1rb1Vmav"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 909728036F; Wed, 20 Jul 2022 18:02:25 +0200 (CEST) Received: from dd43212.kasserver.com (dd43212.kasserver.com [85.13.165.135]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A11D280112 for ; Wed, 20 Jul 2022 18:02:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=herbrechtsmeier.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan@herbrechtsmeier.net Received: from [192.168.178.45] (unknown [83.135.241.55]) by dd43212.kasserver.com (Postfix) with ESMTPSA id D258943C0B05; Wed, 20 Jul 2022 18:02:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=herbrechtsmeier.net; s=kas202204262113; t=1658332925; bh=jeEZ4EELLbLclHZmBTkf1UnhmIEf0Bx6YiaNxg09EtQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=1rb1VmavGGBhuusRX+5SZsGHjHLEnOkZ0dozKPaVgQmCcSLTfYwo8FXsOe7qUjhf8 8Xwl80ID7VuClep9qIl+U5R098H8QWCjjd7jD+bvllm2IQ4zUebGeXPAqTJvABBakN RQCXGpikdkYjFqz81G81F5maw7SJKHHavwVL7JM6M7AS+YeRlKa9nWQ0BYgMMZsjia i/Klnl9oO+OpbWabGAqS4gNb2tf4scwSp0zrAeP5euJEZel9Hbvcoa1v7dcSQkybkZ 7QNRucYfeJPLE2HyDHWLrLMau35o+AZ2qVib0AXX8pJO+ReJIQbDeLqhDrCE1iJpYf C++2qMDOxbkQw== Message-ID: <8c280a40-453e-6ab3-89d4-22a3b7dfc45a@herbrechtsmeier.net> Date: Wed, 20 Jul 2022 18:02:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 2/5] firmware: zynqmp: Load config overlay for core0 to pmufw Content-Language: en-US To: "Soma, Ashok Reddy" , Stefan Herbrechtsmeier , "Simek, Michal" , Ashok Reddy Soma , "u-boot@lists.denx.de" Cc: "adrian.fiergolski@fastree3d.com" , "jh80.chung@samsung.com" , "sven@svenpeter.dev" , "kettenis@openbsd.org" , "sjg@chromium.org" , "git@xilinx.com" , "git (AMD-Xilinx)" References: <1657877964-16742-1-git-send-email-ashok.reddy.soma@xilinx.com> <1657877964-16742-3-git-send-email-ashok.reddy.soma@xilinx.com> <22a75fb0-51b8-7f88-1d45-fa33819156a5@amd.com> <18849dd4-eadc-415f-9e6f-28bf2c4cd2b9@weidmueller.com> From: Stefan Herbrechtsmeier In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Bar: / X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Hi, Am 19.07.22 um 06:44 schrieb Soma, Ashok Reddy: > Hi Stefan, > >> -----Original Message----- >> From: Stefan Herbrechtsmeier >> Sent: Saturday, July 16, 2022 4:48 PM >> To: Simek, Michal ; Ashok Reddy Soma ; u-boot@lists.denx.de >> Cc: adrian.fiergolski@fastree3d.com; jh80.chung@samsung.com; sven@svenpeter.dev; kettenis@openbsd.org; sjg@chromium.org; git@xilinx.com; git (AMD-Xilinx) >> Subject: Re: [PATCH 2/5] firmware: zynqmp: Load config overlay for core0 to pmufw >> >> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email. >> >> >> Am 15.07.2022 um 18:34 schrieb Michal Simek: >>> >>> >>> On 7/15/22 18:13, Stefan Herbrechtsmeier wrote: >>>> Am 15.07.2022 um 11:39 schrieb Ashok Reddy Soma: >>>>> Try loading pmufw config overlay for core0, if it doesn't return any >>>>> error it means pmufw is accepting nodes for other IP's. Otherwise >>>>> dont try to load config object for any other IP, just return from >>>>> zynqmp_pmufw_node function. >>>>> >>>>> Signed-off-by: Ashok Reddy Soma >>>>> --- >>>>> >>>>> drivers/firmware/firmware-zynqmp.c | 14 ++++++++++++++ >>>>> 1 file changed, 14 insertions(+) >>>>> >>>>> diff --git a/drivers/firmware/firmware-zynqmp.c >>>>> b/drivers/firmware/firmware-zynqmp.c >>>>> index 34d9b47003..288151533e 100644 >>>>> --- a/drivers/firmware/firmware-zynqmp.c >>>>> +++ b/drivers/firmware/firmware-zynqmp.c >>>>> @@ -68,8 +68,13 @@ int zynqmp_pmufw_config_close(void) >>>>> return 0; >>>>> } >>>>> +static bool config_enabled; >>>>> + >>>> >>>> Please move the variable inside the function. >>> >>> How can this work? When you move it to zynqmp_pmufw_node() then won't >>> be visible in zynqmp_power_probe() and vice-versa. > >> If you reuse the zynqmp_pmufw_node function in zynqmp_power_probe function you can check the id parameter to update the config_enabled variable in zynqmp_pmufw_node. > > are you suggesting to change like this ? this works fine for me. Shall i send V2 with this > > --- a/drivers/firmware/firmware-zynqmp.c > +++ b/drivers/firmware/firmware-zynqmp.c > @@ -29,6 +29,7 @@ struct zynqmp_power { > } zynqmp_power; > > #define NODE_ID_LOCATION 5 > +#define APU0_ID NODE_APU_0 Why don't you use the NODE_APU_0 define direct? > static unsigned int xpm_configobject[] = { > /**********************************************************************/ > @@ -68,18 +69,22 @@ int zynqmp_pmufw_config_close(void) > return 0; > } > > -static bool config_enabled; > > int zynqmp_pmufw_node(u32 id) > { > - if (!config_enabled) > + static bool config_enabled; I would invert the meaning from enabled to skip ... > + int ret; > + > + if (!config_enabled && id != APU0_ID) to simplify the check. if (skip) > return 0; > > /* Record power domain id */ > xpm_configobject[NODE_ID_LOCATION] = id; > > - zynqmp_pmufw_load_config_object(xpm_configobject, > - sizeof(xpm_configobject)); > + ret = zynqmp_pmufw_load_config_object(xpm_configobject, > + sizeof(xpm_configobject)); > + if(!ret && id == APU0_ID) > + config_enabled = true; if(ret && id == APU0_ID) skip = true; > > return 0; > } > @@ -272,14 +277,8 @@ static int zynqmp_power_probe(struct udevice *dev) > ret >> ZYNQMP_PM_VERSION_MAJOR_SHIFT, > ret & ZYNQMP_PM_VERSION_MINOR_MASK); > > - if (IS_ENABLED(CONFIG_ARCH_ZYNQMP)) { > - xpm_configobject[NODE_ID_LOCATION] = NODE_APU_0; > - > - ret = zynqmp_pmufw_load_config_object(xpm_configobject, > - sizeof(xpm_configobject)); > - if (!ret) > - config_enabled = true; > - } > + if (IS_ENABLED(CONFIG_ARCH_ZYNQMP)) > + zynqmp_pmufw_node(APU0_ID); > > return 0; > Regards Stefan