From patchwork Mon Oct 21 03:38:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1180285 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="XEgS65NJ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xNkp036Wz9sP6 for ; Mon, 21 Oct 2019 15:21:53 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9D82AC21C93; Mon, 21 Oct 2019 04:06:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id DDB23C21DB6; Mon, 21 Oct 2019 04:06:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E2745C21D8E; Mon, 21 Oct 2019 03:40:47 +0000 (UTC) Received: from mail-il1-f194.google.com (mail-il1-f194.google.com [209.85.166.194]) by lists.denx.de (Postfix) with ESMTPS id 65EA3C21DB6 for ; Mon, 21 Oct 2019 03:40:47 +0000 (UTC) Received: by mail-il1-f194.google.com with SMTP id c12so10720157ilm.1 for ; Sun, 20 Oct 2019 20:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zlmxj4H4DSTxnBaOscCOxHVu7dScxJCfLovk4difQmw=; b=XEgS65NJpiTPH7dpe7SfUG3Z7PTi32fLAvTDP0UNkBjAEHXajvI5prqff/q2WOh+iA +MKbLQEiKGHHYsqz8fRrYWkk5UmF0lLRNT4rjyZGWFMvyNNgTtxfOngOctKZ/cccvD1T 9hiJSWBoTDFylG7PdQXjZlRsJNfNVnrHwUZY0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zlmxj4H4DSTxnBaOscCOxHVu7dScxJCfLovk4difQmw=; b=l6x2l2piDc8WNU5B/7ikyaWj+ccOwJlJsuYHL1E8pepBisvB0HHyXXqWzkubE2WJJC I/0tM2S6kV3n0iUmnHHNJdLwueCYwO1m9wwNouDsW1k8J72gIsPskgCSQ0fP5OE0lN7w BIie2GW065pfBMH01ceK+luS0oUjRXUo96dkOJO20D03aKZ+ammjeOM29Ezn96vIkH3u eX/LbPp+F5V42qRkmMwoMCUf50dLpFIEBA/y8IRZXOy8j2tKOhcfdMTpO49PERvsKuAu KHoOMAWCkV6R1fbpEExwhEaOLNDi2gg9kntpqpi3u9FABZ2zbPlaAmmDftt0Znypi0K2 2E8A== X-Gm-Message-State: APjAAAWzKdj4TnpdA75BxbMFFa0CZTNFJrlQBHLHXJNpsLr+HMXTEdlC B8A8OMuzHQGoS0AfPOvv4Cv6OHfXdqzCzA== X-Google-Smtp-Source: APXvYqw3OiYpuqb0I+kv3yHPxLrlg3ySjH+l5yY9ZAETihQG6Jw8payC0X8LwGJcN6Qt3f/5HN4gMA== X-Received: by 2002:a92:255:: with SMTP id 82mr22264894ilc.61.1571629246111; Sun, 20 Oct 2019 20:40:46 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id x14sm1947028ion.67.2019.10.20.20.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2019 20:40:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 20 Oct 2019 21:38:53 -0600 Message-Id: <20191021033913.220758-83-sjg@chromium.org> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191021033913.220758-22-sjg@chromium.org> References: <20191021033913.220758-22-sjg@chromium.org> MIME-Version: 1.0 Cc: Jagannadha Sutradharudu Teki Subject: [U-Boot] [PATCH v3 088/108] mtd: spi: Export spi_flash_std_probe() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" With of-platdata we need to create drivers for particular chips, or at least drivers that are separate from the standard code, since C structures are created by dtoc which are private to that driver. To avoid duplicating the probing code, export this probe function for use by these drivers. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v3: None Changes in v2: None drivers/mtd/spi/sf_probe.c | 2 +- include/spi_flash.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 73297e1a0a5..755aba27116 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -137,7 +137,7 @@ static int spi_flash_std_get_sw_write_prot(struct udevice *dev) return spi_flash_cmd_get_sw_write_prot(flash); } -static int spi_flash_std_probe(struct udevice *dev) +int spi_flash_std_probe(struct udevice *dev) { struct spi_slave *slave = dev_get_parent_priv(dev); struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); diff --git a/include/spi_flash.h b/include/spi_flash.h index 55b4721813a..0b23f57a71b 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -102,6 +102,18 @@ int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len); */ int spl_flash_get_sw_write_prot(struct udevice *dev); +/** + * spi_flash_std_probe() - Probe a SPI flash device + * + * This is the standard internal method for probing a SPI flash device to + * determine its type. It can be used in chip-specific drivers which need to + * do this, typically with of-platdata + * + * @dev: SPI-flash device to probe + * @return 0 if OK, -ve on error + */ +int spi_flash_std_probe(struct udevice *dev); + int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs, unsigned int max_hz, unsigned int spi_mode, struct udevice **devp);