From patchwork Sun Oct 27 15:53:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1185070 X-Patchwork-Delegate: trini@ti.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="bctBq7Yk"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 471N7m73pVz9sPK for ; Mon, 28 Oct 2019 03:08:52 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A7FFDC21D56; Sun, 27 Oct 2019 15:57:19 +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 92CD9C21E0F; Sun, 27 Oct 2019 15:55:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3111BC21DA6; Sun, 27 Oct 2019 15:55:05 +0000 (UTC) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by lists.denx.de (Postfix) with ESMTPS id D9F59C21DA6 for ; Sun, 27 Oct 2019 15:54:32 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id 18so757386ion.6 for ; Sun, 27 Oct 2019 08:54:32 -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=sZswZ4HVTp/gy5q1eU+1RgEuTOOyfERYKLxlh32RAMY=; b=bctBq7Ykn5aXOjsqdADhPJ9hO84viHVTMxzqux4mrSCfKaMRvuplMPqlLCVEW0WKjj RFbF80RjGRtmqlSaolcuHl2UX6b+H2grKU7zyNUIfAquY9a9W3rlUl75EQCgQGRKCARo Z9Ym2TC5bxw7EW2FR2od7fEWKVcwTWm0psE/4= 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=sZswZ4HVTp/gy5q1eU+1RgEuTOOyfERYKLxlh32RAMY=; b=hDp4A7VeW7xf6HXMk86lq7sQTlfjE16ARAFNaNred11uX5944c4wJdv137sGkxG7HH cFNbeoy5n0FVXgNSQZxzU0avMiW1GkqykmECrRfeyIPWaYMs83bQ2ErSvSEyp+sxixYa elxtNfZQ460kPgcp0kC+ayx+Om+9JeF/6T9rj2r1JpH4OEIgagwWR1zNL7C9Br+zkO6M BaDzZVHY1P+iKtr8fqg3vqtIUZW2+kLLLWIonf3eNyOE+30qSG5NA+MR/AZjyY0jBoBu +ypUVuLC/+wHhPLvbiL0OamPuh9Y457nM4e5O1ceGi5MJw+l4jS79uftzYZsZ7FVPnvd fjrg== X-Gm-Message-State: APjAAAWHCY8gYq4tiA18UgZUatlAUKA12910tSczfoR/CAr58OMDcO/v 64mF5faF/w1I6tAGxVbVJWLPm+i9xQCfSg== X-Google-Smtp-Source: APXvYqyJTdNdQ1u3KCiVKPLip0gRtDOlTlc956XNeCauvG703AGEw3cLYrALsa8nWhHWk2Wm3S4YlA== X-Received: by 2002:a02:c855:: with SMTP id r21mr9650050jao.120.1572191671738; Sun, 27 Oct 2019 08:54:31 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id n3sm1215070ilm.8.2019.10.27.08.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2019 08:54:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 27 Oct 2019 09:53:44 -0600 Message-Id: <20191027155410.187957-4-sjg@chromium.org> X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog In-Reply-To: <20191027155410.187957-1-sjg@chromium.org> References: <20191027155410.187957-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini , Jagannadha Sutradharudu Teki Subject: [U-Boot] [PATCH 04/30] 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 --- 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 277241d6f6..7ab8b69c2b 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 55b4721813..0b23f57a71 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);