On 2021/3/18 17:24, Michael Walle wrote:
Add support to show the name and JEDEC identifier as well as to dump the
SFDP table. Not all flashes list their SFDP table contents in their
datasheet. So having that is useful. It might also be helpful in bug
reports from users.
The idea behind the sysfs module is also to have raw access to the SPI
NOR flash device registers, which can also be useful for debugging.
I like the idea to dump the sfdp data,it will make debug easier.
should it go in debugfs?
we already have debugfs files for partname and partid of the flash.
+static ssize_t name_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct spi_device *spi = to_spi_device(dev);
+ struct spi_mem *spimem = spi_get_drvdata(spi);
+ struct spi_nor *nor = spi_mem_get_drvdata(spimem);
+
+ return sprintf(buf, "%s\n", nor->info->name);
perhaps sysfs_emit() instead if we go sysfs? as suggested by [1].