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 03B24C433F5 for ; Tue, 31 May 2022 23:10:13 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BFF2483E43; Wed, 1 Jun 2022 01:09:15 +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="WaLsNmFN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6394984166; Wed, 1 Jun 2022 01:08:55 +0200 (CEST) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 4533583F24 for ; Wed, 1 Jun 2022 01:08:52 +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=oleksandr.suvorov@foundries.io Received: by mail-wr1-x42b.google.com with SMTP id p10so20507240wrg.12 for ; Tue, 31 May 2022 16:08:52 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=G6A3bPmm4sFukIX0NKTBBYyuQLlMMyLbadPJJBwK4Qc=; b=WaLsNmFNACg7Urw64O2f7Vq+Pv9tm3l7aQG/XX8rcSUQXKk15MDtEueyMvSn4yZKF2 SFCck20NmMi/stDgH6pl3aLuSXNQHCpX0vmKPslVI2XOZIkls23G6I9QZBxxQCtwL3HA mLcU0LcOz25bN4rb2p1ifVZJkKBE/ZJTp6RnIgat8h6FA7la0WswVbBiJzQhOKnTDK0G kWe7lC5H5amN9yWiRAO7WgDyX2T2oeBWLPNo8vamrNoEmnvDQ6pwSz4fBpl793geo9Co cjN0rVhz4K//31xXjgoA46b6sx1v8wfyV3MQknvSjzEA80iz8c2cik9CnQS7hRWLrVlZ a+4Q== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=G6A3bPmm4sFukIX0NKTBBYyuQLlMMyLbadPJJBwK4Qc=; b=GqaUQnsjDB3DXdSPQ0bdg3mFqZESEicF59ghr5xulrslQJGiT/gu1ubugmPf8EpmrX fK/Qb5be15qqcolhtyIisB7AFw2mf6l099tsb52/hAd5vl4BvvBSa4ybkqcuODOfuQZO kLmgQlZp5z/b9N8kkGVV8kzgHoqufvCAfXrtM47K2h1MUwq1qSN3FXo+VDuamqWqn6Ky FEqxq+WwRABSQHAuX2p9+l+H5zGlArpVoDanCAOEiWeyoZNmSol44k/ZoHu1p2/UH0cQ 9A5bS57RO6u6eyDctIJ6+npLpjw5nM9aT0GSAbfFcgAYzGsb9prP3iUJDDvaUpAQnyMx hIXw== X-Gm-Message-State: AOAM53246ciGEE6sQqdeiiFW5Cp17ETEdIciNrz5DUQc9e70XnolP+GZ +FPFziG+4BBOAI+/1G3geI/zhKZX/mNYKQ== X-Google-Smtp-Source: ABdhPJxzqfhUIv6kxL/jIB8eC+CqpLKDRETEznVCtnhUN6dhx51Cugf7KV2YpfnpV0nMLdRMsizS9w== X-Received: by 2002:a05:6000:108c:b0:20e:6f3e:d891 with SMTP id y12-20020a056000108c00b0020e6f3ed891mr48938504wrw.38.1654038531640; Tue, 31 May 2022 16:08:51 -0700 (PDT) Received: from cryobook.. ([93.188.34.55]) by smtp.gmail.com with ESMTPSA id j12-20020a5d618c000000b002102f4ebf73sm7673539wru.31.2022.05.31.16.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 16:08:50 -0700 (PDT) From: Oleksandr Suvorov To: u-boot@lists.denx.de Cc: Michal Simek , Adrian Fiergolski , Ricardo Salveti , Jorge Ramirez-Ortiz , Igor Opaniuk , Oleksandr Suvorov , Michal Simek Subject: [PATCH v8 06/14] fpga: add fpga_compatible2flag Date: Wed, 1 Jun 2022 02:08:31 +0300 Message-Id: <20220531230839.183690-7-oleksandr.suvorov@foundries.io> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220531230839.183690-6-oleksandr.suvorov@foundries.io> References: <20220531230839.183690-1-oleksandr.suvorov@foundries.io> <20220531230839.183690-2-oleksandr.suvorov@foundries.io> <20220531230839.183690-3-oleksandr.suvorov@foundries.io> <20220531230839.183690-4-oleksandr.suvorov@foundries.io> <20220531230839.183690-5-oleksandr.suvorov@foundries.io> <20220531230839.183690-6-oleksandr.suvorov@foundries.io> MIME-Version: 1.0 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.5 at phobos.denx.de X-Virus-Status: Clean Add a "compatible" string to binary flag converter, which uses a callback str2flag() of given FPGA driver if available. Signed-off-by: Oleksandr Suvorov --- (no changes since v1) drivers/fpga/fpga.c | 26 ++++++++++++++++++++++++++ include/fpga.h | 1 + 2 files changed, 27 insertions(+) diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c index 3b0a44b2420..fbfdd406e3b 100644 --- a/drivers/fpga/fpga.c +++ b/drivers/fpga/fpga.c @@ -356,3 +356,29 @@ int fpga_info(int devnum) return fpga_dev_info(devnum); } + +int fpga_compatible2flag(int devnum, const char *compatible) +{ + const fpga_desc * const desc = fpga_get_desc(devnum); + + if (!desc) + return FPGA_FAIL; + + switch (desc->devtype) { + case fpga_xilinx: +#if defined(CONFIG_FPGA_XILINX) + { + xilinx_desc *xdesc = (xilinx_desc *)desc->devdesc; + + if (xdesc->operations->str2flag) + return xdesc->operations->str2flag(xdesc, compatible); + } +#else + return FPGA_FAIL; +#endif + default: + break; + } + + return 0; +} diff --git a/include/fpga.h b/include/fpga.h index ec5144334df..2172b0d015e 100644 --- a/include/fpga.h +++ b/include/fpga.h @@ -75,5 +75,6 @@ int fpga_dump(int devnum, const void *buf, size_t bsize); int fpga_info(int devnum); const fpga_desc *const fpga_validate(int devnum, const void *buf, size_t bsize, char *fn); +int fpga_compatible2flag(int devnum, const char *compatible); #endif /* _FPGA_H_ */ -- 2.36.1