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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B7CCC433F5 for ; Fri, 15 Oct 2021 09:15:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 77AA960FF2 for ; Fri, 15 Oct 2021 09:15:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 77AA960FF2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE22B83689; Fri, 15 Oct 2021 11:15:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io 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=foundries.io header.i=@foundries.io header.b="itgUfM5I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 68C2683692; Fri, 15 Oct 2021 11:15:16 +0200 (CEST) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 15D38831C6 for ; Fri, 15 Oct 2021 11:15:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jorge@foundries.io Received: by mail-wm1-x32c.google.com with SMTP id p21so1927350wmq.1 for ; Fri, 15 Oct 2021 02:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cTspl6FEv3nWGYCEFTI3Ty9wI6j5xvRDEm70gj5sApk=; b=itgUfM5I+Dlp7zUHXGfqKP9BckpZoNTCS4raD5zan9rhNs5VoI3rW5Dqc/rJXRjwsk w2IcqFoW5oD0d3MTW2c9OllCexQKKbja7aE7rbv2G05n+g1mx7knVSSvyKtAAe61YsZ5 zAHpa+oqT7kfmWH/OrG9IhXSJozZ6/r2T/sBh0EOZMW1ce4vdOYqsa1yvZkGo+OZJokM UCa3S+yHU2/1Ore6adLb2gyvVMhWvBWvzEXhc3OrHfFeYvkYnxp/MpEuitT9U95mAxHD F6Gdy0x/BzpBCClmGXz+7L+8tCw5s3uqkw3E6mbeavFsSG+88lWH0v04BcxX/9hovMHc Re+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cTspl6FEv3nWGYCEFTI3Ty9wI6j5xvRDEm70gj5sApk=; b=ouOsSxmPJnPhhQB73Yqj47bn2ePzeMuFm4g/LEQtl222us2pDogU5nxn5SfJzfUMwF vYtkjV2ZlXqxKKzr955plvNVfkRTdtrBjbbvHRhOiOOpS6bHkcAL6JzyBrcjSMKYPLVJ xI0DghocZBnNgQBpGpgQ1325yMChNwCUZrSq2OSSeTN9oFSc5F2Dh9PdxXWQoZ9uJkEM Ybhd06tCd8pTySS7qGihXd0VhU/8KlLZn2/FZCpQdoVfxUZWvCfg6sGQyUASojiGDltM Ow/ZqHQAAN39t/wsQBTfaacwSNQ5t4hDQoi6ZsOAIYVqjC28nC5iPDpfQT3DoeyyAtqN 7Qcg== X-Gm-Message-State: AOAM53356D+8B/XaL1ASKP8dfYZjkqWprWAi+fEa8LqCbZvn4wysddLE dHFsB73PvZXGBtI5G6s07KM6LA== X-Google-Smtp-Source: ABdhPJxS2AsbeQkV6sCN/ocz193oRluWpGkwxWt+bCetBY5aCH/lAtd8mwxKEqMudX7W1BihO1bMMQ== X-Received: by 2002:a1c:14b:: with SMTP id 72mr25496960wmb.188.1634289310613; Fri, 15 Oct 2021 02:15:10 -0700 (PDT) Received: from localhost.localdomain (60.red-83-35-113.dynamicip.rima-tde.net. [83.35.113.60]) by smtp.gmail.com with ESMTPSA id r9sm4232230wrn.95.2021.10.15.02.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 02:15:10 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, sjg@chromium.org, oleksandr.suvorov@foundries.io Cc: michal.simek@xilinx.com, trini@konsulko.com, mr.nuke.me@gmail.com, u-boot@lists.denx.de, ricardo@foundries.io, mike@foundries.io, igor.opaniuk@foundries.io Subject: [PATCHv2] fpga_load: pass compatible string Date: Fri, 15 Oct 2021 11:15:06 +0200 Message-Id: <20211015091506.2602-1-jorge@foundries.io> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Instead of ignoring the mandatory fpga compatible string, let the different implementations decide how to handle it Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Simon Glass --- RFC v1->v2: added function comment cmd/fpga.c | 8 ++++---- common/image.c | 4 ++-- common/spl/spl_fit.c | 4 +--- drivers/fpga/fpga.c | 14 +++++++++++--- include/fpga.h | 3 ++- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/cmd/fpga.c b/cmd/fpga.c index 3fdd0b35e8..f3ed1fcdff 100644 --- a/cmd/fpga.c +++ b/cmd/fpga.c @@ -178,7 +178,7 @@ static int do_fpga_load(struct cmd_tbl *cmdtp, int flag, int argc, if (ret) return ret; - return fpga_load(dev, (void *)fpga_data, data_size, BIT_FULL); + return fpga_load(dev, (void *)fpga_data, data_size, BIT_FULL, NULL); } static int do_fpga_loadb(struct cmd_tbl *cmdtp, int flag, int argc, @@ -209,7 +209,7 @@ static int do_fpga_loadp(struct cmd_tbl *cmdtp, int flag, int argc, if (ret) return ret; - return fpga_load(dev, (void *)fpga_data, data_size, BIT_PARTIAL); + return fpga_load(dev, (void *)fpga_data, data_size, BIT_PARTIAL, NULL); } #endif @@ -315,7 +315,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc, data_size = image_get_data_size(hdr); } return fpga_load(dev, (void *)data, data_size, - BIT_FULL); + BIT_FULL, NULL); } #endif #if defined(CONFIG_FIT) @@ -355,7 +355,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_FAILURE; } - return fpga_load(dev, fit_data, data_size, BIT_FULL); + return fpga_load(dev, fit_data, data_size, BIT_FULL, NULL); } #endif default: diff --git a/common/image.c b/common/image.c index e199d61a4c..97f3deda24 100644 --- a/common/image.c +++ b/common/image.c @@ -1516,14 +1516,14 @@ int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images, img_len, BIT_FULL); if (err) err = fpga_load(devnum, (const void *)img_data, - img_len, BIT_FULL); + img_len, BIT_FULL, NULL); } else { name = "partial"; err = fpga_loadbitstream(devnum, (char *)img_data, img_len, BIT_PARTIAL); if (err) err = fpga_load(devnum, (const void *)img_data, - img_len, BIT_PARTIAL); + img_len, BIT_PARTIAL, NULL); } if (err) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index f41abca0cc..4db22efd8c 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -566,11 +566,9 @@ static int spl_fit_upload_fpga(struct spl_fit_info *ctx, int node, compatible = fdt_getprop(ctx->fit, node, "compatible", NULL); if (!compatible) warn_deprecated("'fpga' image without 'compatible' property"); - else if (strcmp(compatible, "u-boot,fpga-legacy")) - printf("Ignoring compatible = %s property\n", compatible); ret = fpga_load(0, (void *)fpga_image->load_addr, fpga_image->size, - BIT_FULL); + BIT_FULL, compatible); if (ret) { printf("%s: Cannot load the image to the FPGA\n", __func__); return ret; diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c index fe3dfa1233..0b03ebbbef 100644 --- a/drivers/fpga/fpga.c +++ b/drivers/fpga/fpga.c @@ -250,9 +250,11 @@ int fpga_loads(int devnum, const void *buf, size_t size, #endif /* - * Generic multiplexing code + * Generic multiplexing code: + * Each architecture must handle the mandatory FPGA DT compatible property. */ -int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype) +int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype, + const char *compatible) { int ret_val = FPGA_FAIL; /* assume failure */ const fpga_desc *desc = fpga_validate(devnum, buf, bsize, @@ -263,13 +265,16 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype) case fpga_xilinx: #if defined(CONFIG_FPGA_XILINX) ret_val = xilinx_load(desc->devdesc, buf, bsize, - bstype); + bstype, compatible); #else fpga_no_sup((char *)__func__, "Xilinx devices"); #endif break; case fpga_altera: #if defined(CONFIG_FPGA_ALTERA) + if (strcmp(compatible, "u-boot,fpga-legacy")) + printf("Ignoring compatible = %s property\n", + compatible); ret_val = altera_load(desc->devdesc, buf, bsize); #else fpga_no_sup((char *)__func__, "Altera devices"); @@ -277,6 +282,9 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype) break; case fpga_lattice: #if defined(CONFIG_FPGA_LATTICE) + if (strcmp(compatible, "u-boot,fpga-legacy")) + printf("Ignoring compatible = %s property\n", + compatible); ret_val = lattice_load(desc->devdesc, buf, bsize); #else fpga_no_sup((char *)__func__, "Lattice devices"); diff --git a/include/fpga.h b/include/fpga.h index ec5144334d..e351097ae5 100644 --- a/include/fpga.h +++ b/include/fpga.h @@ -63,8 +63,9 @@ int fpga_add(fpga_type devtype, void *desc); int fpga_count(void); const fpga_desc *const fpga_get_desc(int devnum); int fpga_is_partial_data(int devnum, size_t img_len); +/* the DT compatible property must be handled by the different FPGA archs */ int fpga_load(int devnum, const void *buf, size_t bsize, - bitstream_type bstype); + bitstream_type bstype, const char *compatible); int fpga_fsload(int devnum, const void *buf, size_t size, fpga_fs_info *fpga_fsinfo); int fpga_loads(int devnum, const void *buf, size_t size, -- 2.31.1