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 45DB5C64EC7 for ; Sat, 25 Feb 2023 09:50:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A3F885B6B; Sat, 25 Feb 2023 10:50:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="eNPoWN27"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDBFF857C1; Sat, 25 Feb 2023 10:50:13 +0100 (CET) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 24F6885B6B for ; Sat, 25 Feb 2023 10:50:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ed1-x52e.google.com with SMTP id s26so6645999edw.11 for ; Sat, 25 Feb 2023 01:50:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=JsIwK5YSBKY6SlvfjmGLQAiK65KqPyPJcU6UfsmHa1U=; b=eNPoWN27ckitv1JTj4bmRnjevBybxptVmMM5VqKn+K3wyNpaga4nvaK0+tqskVCBfv ZuY5qP6hzeJAOpKF5ObWuaLIJtLnC/B8x2v+hjICRp2ESDym0rPvZ5sg3hpR4lMtwxu7 fHKAig0vGKubyK0CU9m/1c9+txI/kQnWjtWT9gcINuvLIgReoGmQM/Z6Jmg9a27NTLDq 2mGwWjGak6A4S0O97hGv5FG0TG6ra0+KaHrLY/cNMmF32HTleFIZ5AFGDMLrel/3WyAZ yf4vxEm9wH9EmsmzEL3dZIyqADVLvytlVr5Tp0w7wYXdT9DDxgeDGPSPV2j6D74Oj3m5 j0uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JsIwK5YSBKY6SlvfjmGLQAiK65KqPyPJcU6UfsmHa1U=; b=LLtxvypZW9Nt44s/JGkNxCx2MSExxthg71mkbrCZ1x9BltgY7SO3ylZG/FUUKra9aB ihABwPnbxCEQqjuCWQt/Bvtvy4yhbLAta2j7hOL6DVqXfHbmLg0cNr++awrWbpIye5IM ArlRecGoRoBM30NFeU7Z37rGfchgwDJFD2GBw1iLHMSXcg3w4qr5PoFK15yjdjiogiZ8 t0M+k8VmM5MlHFr0Nr7h4pIAL+gurPg+0uFh9eRe7tKgr/AR0BlN3gdiBYEIHppH08YR x50MXwf29/zw4HO2V6qK6lv5IoI9sVzy1FMuGwHT9JZI7V1YzJCTXrk3xnIIa4IXJPtf 7hog== X-Gm-Message-State: AO0yUKVCrRverOBSwlxUBPq2wJmHee9WfepbQDM4FeQjbZpn7ll6HcXb qagi5R0uvB3l5HA3i1rkEO0= X-Google-Smtp-Source: AK7set91bLN1r1cI6U9FfJou4HkG+1/BW0VtU9ajDcp4/kWeZ3QkwQUEq4hoXo21lJLlCE8bCX29lw== X-Received: by 2002:aa7:c444:0:b0:4af:60c1:1961 with SMTP id n4-20020aa7c444000000b004af60c11961mr12786979edr.23.1677318607529; Sat, 25 Feb 2023 01:50:07 -0800 (PST) Received: from [192.168.2.1] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id h23-20020a50cdd7000000b004af64086a0esm662986edj.35.2023.02.25.01.50.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Feb 2023 01:50:06 -0800 (PST) Message-ID: <21d1b028-c50c-856a-e74a-8aa7684338ee@gmail.com> Date: Sat, 25 Feb 2023 10:50:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v1] spi: spi-aspeed-smc: convert devfdt_get_addr_index output to phys_addr_t Content-Language: en-US To: Michael Nazzareno Trimarchi Cc: chin-ting_kuo@aspeedtech.com, clg@kaod.org, sjg@chromium.org, kever.yang@rock-chips.com, BMC-SW@aspeedtech.com, jagan@amarulasolutions.com, ryan_chen@aspeedtech.com, chiawei_wang@aspeedtech.com, joel@jms.id.au, dario.binacchi@amarulasolutions.com, philipp.tomsich@vrull.eu, u-boot@lists.denx.de, yifeng.zhao@rock-chips.com References: <49d0321c-72e4-429f-335e-8f23ff866d39@rock-chips.com> <7464e0b2-77f1-7208-50b7-8fc63ee7baa1@gmail.com> From: Johan Jonker In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 On 2/25/23 10:26, Michael Nazzareno Trimarchi wrote: > Hi Johan > > On Thu, Feb 23, 2023 at 3:06 PM Johan Jonker wrote: >> >> The fdt_addr_t and phys_addr_t size have been decoupled. >> A 32bit CPU can expect 64-bit data from the device tree parser, >> so convert devfdt_get_addr_index output to phys_addr_t in the >> spi-aspeed-smc.c file. Also fix dev_dbg to be able to handle >> both sizes. >> >> Signed-off-by: Johan Jonker >> --- >> >> Note: >> >> This is needed for a Rockchip patch serie to pass the test and >> must be merged before by Rockchip maintainers: >> >> [PATCH v4 00/11] Fixes for Rockchip NFC driver part 1 >> https://lore.kernel.org/u-boot/f3dba231-4a55-0a94-dfab-5cab1419d132@gmail.com/ >> >> Request for hardware test by Aspeed people. >> --- >> drivers/spi/spi-aspeed-smc.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c >> index a3c96333..17696441 100644 >> --- a/drivers/spi/spi-aspeed-smc.c >> +++ b/drivers/spi/spi-aspeed-smc.c >> @@ -1125,14 +1125,14 @@ static int apseed_spi_of_to_plat(struct udevice *bus) >> int ret; >> struct clk hclk; >> >> - priv->regs = (void __iomem *)devfdt_get_addr_index(bus, 0); >> + priv->regs = (void __iomem *)((phys_addr_t)devfdt_get_addr_index(bus, 0)); > > devfdt_get_addr_index_ptr is not the right way? That may work. > >> if ((u32)priv->regs == FDT_ADDR_T_NONE) { >> dev_err(bus, "wrong ctrl base\n"); >> return -ENODEV; >> } >> >> plat->ahb_base = >> - (void __iomem *)devfdt_get_addr_size_index(bus, 1, &plat->ahb_sz); >> + (void __iomem *)((phys_addr_t)devfdt_get_addr_size_index(bus, 1, &plat->ahb_sz)); > > devfdt_get_addr_index_ptr, same here fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index, fdt_size_t *size) vs void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index) === devfdt_get_addr_index_ptr does not offer the ahb_sz size. https://elixir.bootlin.com/u-boot/latest/source/drivers/core/fdtaddr.c#L112 This function is used for that in devfdt_get_addr_size_index: fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev_of_offset(dev), "reg", index, size, false); What would you suggest? Keep the cast or use fdtdec_get_addr_size_auto_noparent ? I'm a little bit "reluctant" to poke in code that I don't have hardware for. Johan > >> if ((u32)plat->ahb_base == FDT_ADDR_T_NONE) { >> dev_err(bus, "wrong AHB base\n"); >> return -ENODEV; >> @@ -1151,8 +1151,8 @@ static int apseed_spi_of_to_plat(struct udevice *bus) >> plat->hclk_rate = clk_get_rate(&hclk); >> clk_free(&hclk); >> >> - dev_dbg(bus, "ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n", >> - (u32)priv->regs, plat->ahb_base, plat->ahb_sz); >> + dev_dbg(bus, "ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%llx\n", >> + (u32)priv->regs, plat->ahb_base, (fdt64_t)plat->ahb_sz); >> dev_dbg(bus, "hclk = %dMHz, max_cs = %d\n", >> plat->hclk_rate / 1000000, plat->max_cs); >> >> -- > > Michael > >> 2.20.1 >> > >