Message ID | 20220608061455.365123-1-clg@kaod.org |
---|---|
State | New |
Headers | show |
Series | [1/2] spi: aspeed: Use "jedec,spi-nor" compatible to count devices | expand |
On Wed, 8 Jun 2022 at 06:15, Cédric Le Goater <clg@kaod.org> wrote: > > The SoC device trees use the "jedec,spi-nor" compatible property to > describe the flash devices and the board device trees override this > property with "spi-flash", "sst,w25q256". This comes from the initial > driver which was first written when spi-nor support had not been > merged in U-boot yet. > > "jedec,spi-nor" should be preferred since it is used by Linux and the > latest U-boot. Use it to count devices. We will clean up the board > device trees later. > > Cc: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com> > Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Joel Stanley <joel@jms.id.au> > --- > drivers/spi/aspeed_spi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/spi/aspeed_spi.c b/drivers/spi/aspeed_spi.c > index 65d69105e8e8..45f6a8dd6850 100644 > --- a/drivers/spi/aspeed_spi.c > +++ b/drivers/spi/aspeed_spi.c > @@ -1241,7 +1241,8 @@ static int aspeed_spi_count_flash_devices(struct udevice *bus) > > dev_for_each_subnode(node, bus) { > if (ofnode_is_available(node) && > - ofnode_device_is_compatible(node, "spi-flash")) > + (ofnode_device_is_compatible(node, "spi-flash") || > + ofnode_device_is_compatible(node, "jedec,spi-nor"))) > count++; > } > > -- > 2.35.3 >
diff --git a/drivers/spi/aspeed_spi.c b/drivers/spi/aspeed_spi.c index 65d69105e8e8..45f6a8dd6850 100644 --- a/drivers/spi/aspeed_spi.c +++ b/drivers/spi/aspeed_spi.c @@ -1241,7 +1241,8 @@ static int aspeed_spi_count_flash_devices(struct udevice *bus) dev_for_each_subnode(node, bus) { if (ofnode_is_available(node) && - ofnode_device_is_compatible(node, "spi-flash")) + (ofnode_device_is_compatible(node, "spi-flash") || + ofnode_device_is_compatible(node, "jedec,spi-nor"))) count++; }
The SoC device trees use the "jedec,spi-nor" compatible property to describe the flash devices and the board device trees override this property with "spi-flash", "sst,w25q256". This comes from the initial driver which was first written when spi-nor support had not been merged in U-boot yet. "jedec,spi-nor" should be preferred since it is used by Linux and the latest U-boot. Use it to count devices. We will clean up the board device trees later. Cc: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com> Signed-off-by: Cédric Le Goater <clg@kaod.org> --- drivers/spi/aspeed_spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)