From: Vignesh Raghavendra <vigneshr@ti.com>
To: u-boot@lists.denx.de
Subject: [PATCH 02/31] mtd: spi-nor: Tidy up error handling / debug code
Date: Thu, 30 Jul 2020 14:49:55 +0530 [thread overview]
Message-ID: <be8d080f-012b-c5b6-062d-dd3790a74e48@ti.com> (raw)
In-Reply-To: <CAPnjgZ2c=eFWHPLo4iMXftr9fjhAnHW_oUQ6jsa-Fhy6OO+h8A@mail.gmail.com>
Hi,
On 26/07/20 8:24 pm, Simon Glass wrote:
> Hi Vignesh,
>
> On Mon, 20 Jul 2020 at 00:26, Vignesh Raghavendra <vigneshr@ti.com> wrote:
>>
>> Hi Simon,
>>
>> On 19/07/20 9:45 pm, Simon Glass wrote:
>>> The -ENODEV error value in spi_nor_read_id() is incorrect since there
>>> clearly is a device - it just cannot be supported.
>>
>> Description 's not entirely accurate... If there is no flash on the SPI
>> bus, then read ID would return all 0s or 0xFFs depending on the pullups
>> on the board which would fail to match any flash in the spi-nor-ids table.
>>
>> So its not just the case of device IDs not recognized or supported by
>> U-Boot, it maybe that flash is absent altogether.
>
> But struct udevice * exists, so there is a device. Whether it is
> connected to something is a separate issue.
>
> The problem is that -ENODEV means that the device should not be
> created or should not exist.
>
> What happens if an invalid ID is returned? Does it unbind the device?
There are two cases:
1. spi flash node is present in the DT but there is no device on the
board. In this case device is not unbound from DT node.
2. There is no flash device described as child of SPI bus but user
tries sf probe (Or some U-boot code calls spi_flash_probe_bus_cs()). In
this case a device is created on the fly and bound to sf driver and
probe is attempted (as part of which attempt is make to read Device ID).
If there is no flash found, then the device is unbound and removed (see
drivers/mtd/spi/sf-uclass.c::spi_flash_probe_bus_cs and
drivers/spi/spi-uclass.c::spi_get_bus_and_cs).
So at least in case 2 its U-boot which is creating device and try to
look for it which would fail if not present. IMO, -ENODEV makes sense
here since the intention is to dynamically find the device w/o an actual
DT node present.
[...]
Regards
Vignesh
next prev parent reply other threads:[~2020-07-30 9:19 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-19 16:15 [PATCH 00/31] dm: Avoid including dm.h in header files Simon Glass
2020-07-19 16:15 ` [PATCH 01/31] spi: Allow separate control of SPI_FLASH_TINY for SPL/TPL Simon Glass
2020-08-04 15:03 ` Tom Rini
2020-07-19 16:15 ` [PATCH 02/31] mtd: spi-nor: Tidy up error handling / debug code Simon Glass
2020-07-20 6:12 ` Vignesh Raghavendra
2020-07-26 14:54 ` Simon Glass
2020-07-30 9:19 ` Vignesh Raghavendra [this message]
2020-08-04 15:03 ` Tom Rini
2020-07-19 16:15 ` [PATCH 03/31] wdt: Drop dm.h header file Simon Glass
2020-08-04 15:03 ` Tom Rini
2020-07-19 16:15 ` [PATCH 04/31] mtd: spi-mem: " Simon Glass
2020-08-04 15:03 ` Tom Rini
2020-07-19 16:15 ` [PATCH 05/31] mtd: spi: Drop SPI_XFER_MMAP* Simon Glass
2020-08-04 15:03 ` Tom Rini
2020-07-19 16:15 ` [PATCH 06/31] dm: core: Drop dm.h header file from dm-demo.h Simon Glass
2020-08-04 15:03 ` Tom Rini
2020-07-19 16:15 ` [PATCH 07/31] dm: core: Drop header files from dm/test.h Simon Glass
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 08/31] fs: fs-loader: Drop dm.h header file Simon Glass
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 09/31] net: Drop dm.h header file from phy.h Simon Glass
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 10/31] sf: Drop dm.h header file from spi_flash.h Simon Glass
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 11/31] thermal: Drop dm.h header file Simon Glass
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 12/31] w1: " Simon Glass
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 13/31] efi: Tidy up header includes Simon Glass
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 14/31] power: Tidy up inclusion of regulator_common.h Simon Glass
2020-07-20 23:14 ` Jaehoon Chung
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 15/31] mmc: Drop duplicate dm.h inclusion Simon Glass
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 16/31] spi: " Simon Glass
2020-08-04 15:04 ` Tom Rini
2020-07-19 16:15 ` [PATCH 17/31] ti: am654: " Simon Glass
2020-08-04 15:05 ` Tom Rini
2020-07-19 16:15 ` [PATCH 18/31] liebherr: " Simon Glass
2020-08-04 15:05 ` Tom Rini
2020-07-19 16:15 ` [PATCH 19/31] pci: Drop dm.h inclusion from header file Simon Glass
2020-08-04 15:05 ` Tom Rini
2020-07-19 16:15 ` [PATCH 20/31] mediatek: Drop dm.h " Simon Glass
2020-08-04 15:05 ` Tom Rini
2020-07-19 16:15 ` [PATCH 21/31] mscc: " Simon Glass
2020-08-04 15:05 ` Tom Rini
2020-07-19 16:15 ` [PATCH 22/31] adc: " Simon Glass
2020-08-04 15:05 ` Tom Rini
2020-07-19 16:15 ` [PATCH 23/31] nand: " Simon Glass
2020-08-04 15:05 ` Tom Rini
2020-07-19 16:15 ` [PATCH 24/31] ufs: " Simon Glass
2020-08-04 15:05 ` Tom Rini
2020-07-19 16:15 ` [PATCH 25/31] usb: " Simon Glass
2020-08-04 15:05 ` Tom Rini
2020-07-19 16:15 ` [PATCH 26/31] clk: Drop dm.h header file in clk-provider.h Simon Glass
2020-07-19 16:54 ` Sean Anderson
2020-08-04 15:06 ` Tom Rini
2020-07-19 16:15 ` [PATCH 27/31] net: Drop dm.h header file in eth_phy.h Simon Glass
2020-08-04 15:06 ` Tom Rini
2020-07-19 16:15 ` [PATCH 28/31] net: Drop duplicate include of dm.h in pcnet.c Simon Glass
2020-08-04 15:06 ` Tom Rini
2020-07-19 16:15 ` [PATCH 29/31] dm: core: Guard against including dm.h in header files Simon Glass
2020-08-04 15:06 ` Tom Rini
2020-07-19 16:16 ` [PATCH 30/31] patman: Fix up the test comments Simon Glass
2020-08-04 15:06 ` Tom Rini
2020-07-19 16:16 ` [PATCH 31/31] checkpatch: Don't allow common.h and dm.h in headers Simon Glass
2020-08-04 15:06 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=be8d080f-012b-c5b6-062d-dd3790a74e48@ti.com \
--to=vigneshr@ti.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox