From patchwork Sun Sep 27 20:35:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 1372246 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C04nn3Tpmz9sSG for ; Mon, 28 Sep 2020 11:34:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4045382332; Mon, 28 Sep 2020 03:34:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 4ECDD82341; Sun, 27 Sep 2020 22:35:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C5B568233C for ; Sun, 27 Sep 2020 22:35:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 82001AC54 for ; Sun, 27 Sep 2020 20:35:31 +0000 (UTC) Date: Sun, 27 Sep 2020 22:35:30 +0200 From: Michal =?iso-8859-1?q?Such=E1nek?= To: u-boot@lists.denx.de Subject: SPI bus not probed Message-ID: <20200927203530.GL29778@kitsune.suse.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Mailman-Approved-At: Mon, 28 Sep 2020 03:34:33 +0200 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.102.3 at phobos.denx.de X-Virus-Status: Clean Hello, When I enable SPI support I do not get a SPI bus. Config: AFAICT the device tree compatible matches the one in the driver. How do I make u-boot run the driver? Thanks Michal --- a/configs/orangepi_zero_defconfig +++ b/configs/orangepi_zero_defconfig @@ -11,3 +11,21 @@ CONFIG_CONSOLE_MUX=y CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH=y +CONFIG_CMD_SPI=y +CONFIG_CMD_SF_TEST=y +CONFIG_SPI_FLASH_SFDP_SUPPORT=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_ISSI=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_XMC=y +CONFIG_SPI_FLASH_DATAFLASH=y DT (which lists the flash types so did not really have to enable them all) --- a/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts +++ b/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts @@ -163,10 +163,11 @@ }; &spi0 { - /* Disable SPI NOR by default: it optional on Orange Pi Zero boards */ - status = "disabled"; + /* Enable SPI NOR by default: it optional on Orange Pi Zero boards */ + status = "okay"; flash@0 { + status = "okay"; #address-cells = <1>; #size-cells = <1>; compatible = "mxicy,mx25l1606e", "winbond,w25q128"; The guide on debugging says to add dm_dump_all --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -328,6 +328,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, bool created = false; int ret; + dm_dump_all(); #if CONFIG_IS_ENABLED(OF_PLATDATA) ret = uclass_first_device_err(UCLASS_SPI, &bus); #else which prints Class Index Probed Driver Name ----------------------------------------------------------- root 0 [ + ] root_driver root_driver simple_bus 0 [ + ] simple_bus |-- soc mmc 0 [ + ] sunxi_mmc | |-- mmc@1c0f000 blk 0 [ ] mmc_blk | | `-- mmc@1c0f000.blk mmc 1 [ + ] sunxi_mmc | |-- mmc@1c10000 blk 1 [ ] mmc_blk | | `-- mmc@1c10000.blk phy 0 [ ] sun4i_usb_phy | |-- phy@1c19400 usb 0 [ ] ehci_generic | |-- usb@1c1a000 usb 1 [ ] ohci_generic | |-- usb@1c1a400 usb 2 [ ] ehci_generic | |-- usb@1c1b000 usb 3 [ ] ohci_generic | |-- usb@1c1b400 clk 0 [ + ] sun8i_h3_ccu | |-- clock@1c20000 reset 0 [ + ] sunxi_reset | | `-- reset gpio 0 [ + ] gpio_sunxi | |-- pinctrl@1c20800 gpio 1 [ + ] gpio_sunxi | | |-- PA gpio 2 [ + ] gpio_sunxi | | |-- PB gpio 3 [ + ] gpio_sunxi | | |-- PC gpio 4 [ + ] gpio_sunxi | | |-- PD gpio 5 [ + ] gpio_sunxi | | |-- PE gpio 6 [ + ] gpio_sunxi | | |-- PF gpio 7 [ + ] gpio_sunxi | | |-- PG gpio 8 [ + ] gpio_sunxi | | |-- PH gpio 9 [ + ] gpio_sunxi | | `-- PI eth 0 [ + ] eth_sun8i_emac | |-- ethernet@1c30000 spi 0 [ ] sun4i_spi | |-- spi@1c68000 serial 0 [ + ] ns16550_serial | |-- serial@1c28000 gpio 10 [ + ] gpio_sunxi | `-- pinctrl@1f02c00 gpio 11 [ + ] gpio_sunxi | `-- PL clk 1 [ + ] fixed_rate_clock |-- osc24M_clk clk 2 [ ] fixed_rate_clock `-- osc32k_clk Invalid bus 0 (err=-19) -19 means ENODEV according to my /usr/include/asm-generic/errno-base.h Debug prints added to sunxi driver are never printed: --- a/drivers/spi/spi-sunxi.c +++ b/drivers/spi/spi-sunxi.c @@ -305,6 +305,7 @@ static int sun4i_spi_claim_bus(struct udevice *dev) { struct sun4i_spi_priv *priv = dev_get_priv(dev->parent); int ret; + printf("sun4i_spi_claim_bus\n"); ret = sun4i_spi_set_clock(dev->parent, true); if (ret) @@ -487,6 +488,8 @@ static int sun4i_spi_probe(struct udevice *bus) struct sun4i_spi_priv *priv = dev_get_priv(bus); int ret; + printf("sun4i_spi_probe\n"); + ret = clk_get_by_name(bus, "ahb", &priv->clk_ahb); if (ret) { dev_err(dev, "failed to get ahb clock\n");