HiSilicon v3xx SFC driver
Subsystems (4)
v2 cover HiSilicon v3xx SFC driver
This patchset introduces support for the HiSilicon SFC V3XX driver.
Whilst the kernel tree already includes support for a "HiSilicon SFC driver", that is for different HW. Indeed, as mentioned in patch #1, the naming for that driver could be better, as it should support more memory technologies than SPI NOR (as I have been told), and it is actually known internally as FMC. As such, maybe "hisi-fmc" would have been better, but we can't change that now.
I used V3XX in this driver name, as that is the unique versioning for this HW.
As for the driver itself, it is quite simple. Only ACPI firmware is supported, and we assume m25p80 compatible SPI NOR part will be used.
DMA is not supported, and we just use polling mode for operation completion notification. The driver uses the SPI MEM OPs.
Changes from v1:
- Add ACPI kconfig dependency
- Fix up header comment style
- Change macros naming style
- Try to enforce aligned accesses in hisi_sfc_v3xx_adjust_op_size()
John Garry (3):
mtd: spi-nor: hisi-sfc: Try to provide some clarity on which SFC we
are
spi: Add HiSilicon v3xx SPI NOR flash controller driver
MAINTAINERS: Add a maintainer for the HiSilicon v3xx SFC driver
MAINTAINERS | 6 + drivers/mtd/spi-nor/Kconfig | 4 +- drivers/mtd/spi-nor/hisi-sfc.c | 2 +- drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-hisi-sfc-v3xx.c | 284 ++++++++++++++++++++++++++++++++ 6 files changed, 303 insertions(+), 3 deletions(-) create mode 100644 drivers/spi/spi-hisi-sfc-v3xx.c
Signature · 1 line
2.17.1
PATCH v2 1/3 mtd: spi-nor: hisi-sfc: Try to provide some clarity on which SFC we are
The driver is for the HiSilicon FMC (Flash Memory Controller), which supports SPI NOR in addition other memory technologies, like SPI NAND.
Indeed, the naming in the driver is a little inappropriate, especially considering that there is already another HiSilicon SPI NOR flash controller (which I believe the FMC is derived from).
Since we now want to provide software support for this other HiSilicon controller, update code comments to at least try to make it clear that this driver is for the FMC.
--- drivers/mtd/spi-nor/Kconfig | 4 ++-- drivers/mtd/spi-nor/hisi-sfc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/spi-nor/Kconfig +2 -2
@@ -46,11 +46,11 @@ config SPI_CADENCE_QUADSPI Flash as an MTD device. config SPI_HISI_SFC - tristate "Hisilicon SPI-NOR Flash Controller(SFC)" + tristate "Hisilicon FMC SPI-NOR Flash Controller(SFC)" depends on ARCH_HISI || COMPILE_TEST depends on HAS_IOMEM help - This enables support for hisilicon SPI-NOR flash controller. + This enables support for HiSilicon FMC SPI-NOR flash controller. config SPI_MTK_QUADSPI tristate "MediaTek Quad SPI controller"
drivers/mtd/spi-nor/hisi-sfc.c +1 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-or-later /* -* HiSilicon SPI Nor Flash Controller Driver +* HiSilicon FMC SPI-NOR flash controller driver * * Copyright (c) 2015-2016 HiSilicon Technologies Co., Ltd. */
Signature · 1 line
2.17.1
[email protected]
AppliedRe: [PATCH v2 1/3] mtd: spi-nor: hisi-sfc: Try to provide some clarity on which SFC we are
Quoted 11 lines · EET John Garry
The driver is for the HiSilicon FMC (Flash Memory Controller), which supports SPI NOR in addition other memory technologies, like SPI NAND.
Indeed, the naming in the driver is a little inappropriate, especially considering that there is already another HiSilicon SPI NOR flash controller (which I believe the FMC is derived from).
Since we now want to provide software support for this other HiSilicon controller, update code comments to at least try to make it clear that this driver is for the FMC.
Quoted 6 lines
Signed-off-by John Garry <[email protected]>--- drivers/mtd/spi-nor/Kconfig | 4 ++-- drivers/mtd/spi-nor/hisi-sfc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Applied to spi-nor/next.
Thanks,
ta
PATCH v2 2/3 spi: Add HiSilicon v3xx SPI NOR flash controller driver
In reply to John GarryAdd the driver for the HiSilicon v3xx SPI NOR flash controller, commonly found in hi16xx chipsets.
This is a different controller than that in drivers/mtd/spi-nor/hisi-sfc.c; indeed, the naming for that driver is poor, since it is really known as FMC, and can support other memory technologies.
The driver module name is "hisi-sfc-v3xx", as recommended by HW designer, being an attempt to provide a distinct name - v3xx being the unique controller versioning.
Only ACPI firmware is supported.
DMA is not supported, and we just use polling mode for operation completion notification.
The driver uses the SPI MEM OPs.
--- drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-hisi-sfc-v3xx.c | 284 ++++++++++++++++++++++++++++++++ 3 files changed, 294 insertions(+) create mode 100644 drivers/spi/spi-hisi-sfc-v3xx.c
drivers/spi/Kconfig +9 -0
@@ -281,6 +281,15 @@ config SPI_FSL_QUADSPI This controller does not support generic SPI messages. It only supports the high-level SPI memory interface. +config SPI_HISI_SFC_V3XX + tristate "HiSilicon SPI-NOR Flash Controller for Hi16XX chipsets" + depends on (ARM64 && ACPI) || COMPILE_TEST + depends on HAS_IOMEM + select CONFIG_MTD_SPI_NOR + help + This enables support for HiSilicon v3xx SPI-NOR flash controller + found in hi16xx chipsets. + config SPI_NXP_FLEXSPI tristate "NXP Flex SPI controller" depends on ARCH_LAYERSCAPE || HAS_IOMEM
drivers/spi/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_SPI_FSL_LPSPI) += spi-fsl-lpspi.o obj-$(CONFIG_SPI_FSL_QUADSPI) += spi-fsl-qspi.o obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o obj-$(CONFIG_SPI_GPIO) += spi-gpio.o +obj-$(CONFIG_SPI_HISI_SFC_V3XX) += spi-hisi-sfc-v3xx.o obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o obj-$(CONFIG_SPI_IMX) += spi-imx.o obj-$(CONFIG_SPI_LANTIQ_SSC) += spi-lantiq-ssc.o
drivers/spi/spi-hisi-sfc-v3xx.c new file +284 -0
284 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 28 lines · John Garry
drivers/spi/spi-hisi-sfc-v3xx.c new file +28
-0+if (ret) +return ret; + +if (op->data.dir ==SPI_MEM_DATA_IN ) +hisi_sfc_v3xx_read_databuf (host, op->data.buf.in, len); + +return 0 ; +} + +static int hisi_sfc_v3xx_exec_op (struct spi_mem *mem, +const struct spi_mem_op *op) +{ +struct hisi_sfc_v3xx_host *host; +struct spi_device *spi = mem->spi; +u8 chip_select = spi->chip_select; + + host =spi_controller_get_devdata (spi->master); + +return hisi_sfc_v3xx_generic_exec_op (host, op, chip_select); +} + +static const struct spi_controller_mem_ops hisi_sfc_v3xx_mem_ops = { + .adjust_op_size = hisi_sfc_v3xx_adjust_op_size, + .exec_op = hisi_sfc_v3xx_exec_op, +}; + +static int hisi_sfc_v3xx_probe (struct platform_device *pdev) +{
drivers/spi/spi-hisi-sfc-v3xx.c line 221
Quoted 10 lines
drivers/spi/spi-hisi-sfc-v3xx.c new file +10
-0+struct device *dev = &pdev->dev; +struct hisi_sfc_v3xx_host *host; +struct spi_controller *ctlr; +u32 version; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*host)); +if (!ctlr) +return -ENOMEM ; +
Hi Mark,
drivers/spi/spi-hisi-sfc-v3xx.c line 223
Quoted 2 lines
drivers/spi/spi-hisi-sfc-v3xx.c new file +2
-0+ ctlr->mode_bits =SPI_RX_DUAL |SPI_RX_QUAD | +SPI_TX_DUAL |SPI_TX_QUAD ;
I have an issue with dual/quad support. I naively thought that setting these bits would give me the highest protocol available.
However, now I notice that spi_device.mode needs to be set for supported protocols for the slave - I'm using the generic spi mem ops to check if protocols are supported based on this value.
From checking acpi_spi_add_resource() or anywhere else, I cannot see how SPI_RX_DUAL or the others are set for spi_device.mode. What am I missing? Are these just not supported yet for ACPI? Or should the spi-nor code not be relying on this since we should be able to get this info from the SPI NOR part?
Cheers,
John
Quoted 10 lines
drivers/spi/spi-hisi-sfc-v3xx.c new file +10
-0+ + host =spi_controller_get_devdata (ctlr); + host->dev = dev; + +platform_set_drvdata (pdev, host); + + host->regbase =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (host->regbase)) { + ret =PTR_ERR (host->regbase); + goto err_put_master;
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 5 lines · John Garry
From checking
acpi_spi_add_resource()or anywhere else, I cannot see howSPI_RX_DUALor the others are set for spi_device.mode. What am I missing? Are these just not supported yet for ACPI? Or should the spi-nor code not be relying on this since we should be able to get this info from the SPI NOR part?
I'm not aware of any work on integrating this sort of stuff into ACPI platforms so I think it's just not yet supported in ACPI. I'm not really sure what would be idiomatic for ACPI, figuring it out from what the part supports might well be idiomatic there though I don't know how common it is for people not to wire up all the data lines even if both controller and device support wider transfers. I've got a horrible feeling that the idiomatic thing is a combination of that and a bunch of per-device quirks. There may be a spec I'm not aware of though I'd be a bit surprised.
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 8 lines · Mark Brown
Quoted 5 lines · John Garry
From checking
acpi_spi_add_resource()or anywhere else, I cannot see howSPI_RX_DUALor the others are set for spi_device.mode. What am I missing? Are these just not supported yet for ACPI? Or should the spi-nor code not be relying on this since we should be able to get this info from the SPI NOR part?
Hi Mark,
Quoted 6 lines
I'm not aware of any work on integrating this sort of stuff into ACPI platforms so I think it's just not yet supported in ACPI. I'm not really sure what would be idiomatic for ACPI, figuring it out from what the part supports might well be idiomatic there though I don't know how common it is for people not to wire up all the data lines even if both controller and device support wider transfers.
OK, so I guess that is why we require the width property from the FW and can't blindly rely on SFDP.
I've got a horrible
Quoted 4 lines
feeling that the idiomatic thing is a combination of that and a bunch of per-device quirks. There may be a spec I'm not aware of though I'd be a bit surprised.
I'm not sure on that. I don't see anything in the ACPI spec.
I will note that PRP0001+"jedec,spi-nor" compatible DSD seems to be the defacto method to describe the SPI NOR-compat part for ACPI - that's what I'm using. We could add properties there, but that seems improper.
I'll continue to look....
Thanks,
John
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 3 lines · John Garry
I will note that PRP0001+"jedec,spi-nor" compatible DSD seems to be the defacto method to describe the SPI NOR-compat part for ACPI - that's what I'm using. We could add properties there, but that seems improper.
OK, so that's just reusing the DT binding in which case everything that's valid for the DT binding should also be valid for ACPI - I thought that actually worked automatically without you having to do anything in the code but ICBW.
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
On 10/01/2020 14:07, Mark Brown wrote:
+ Mika, Andy
Quoted 1 line
On Fri, Jan 10, 2020 at 11:55:37AM +0000, John Garry wrote: >
Hi Mark,
Quoted 8 lines
Quoted 3 lines
I will note that PRP0001+"jedec,spi-nor" compatible DSD seems to be the defacto method to describe the SPI NOR-compat part for ACPI - that's what I'm using. We could add properties there, but that seems improper.
OK, so that's just reusing the DT binding in which case everything that's valid for the DT binding should also be valid for ACPI - I thought that actually worked automatically without you having to do anything in the code but ICBW.
I thought that it would be improper as we could be mixing ACPI methods to describe the serial bus (SPI Serial Bus Connection Resource Descriptor) and also DT properties which could conflict, like CS active high.
However I do see extra properties than "compatible" being added in DSD for PRP0001:
https://patchwork.ozlabs.org/patch/662813/ (see EEPROM part)
And if we were to do this, I think that we would need to add some device_property_read_u32("spi-rx-bus-width", ...), etc calls in the SPI FW parsing for ACPI path - I couldn't see that.
Thanks,
John
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 11 lines · John Garry
Quoted 6 lines · Mark Brown
On Fri, Jan 10, 2020 at 11:55:37AM +0000, John Garry wrote: >
OK, so that's just reusing the DT binding in which case everything that's valid for the DT binding should also be valid for ACPI - I thought that actually worked automatically without you having to do anything in the code but ICBW.
I thought that it would be improper as we could be mixing ACPI methods to describe the serial bus (SPI Serial Bus Connection Resource Descriptor) and also DT properties which could conflict, like CS active high.
Yes, that's one of the issues with importing bits of DT into ACPI unfortunately - you will get conflicts, it's not clear it's a good idea to be using PRP0001 for SPI stuff given that there's bus level bindings for both ACPI and SPI and they don't line up exactly.
Quoted 7 lines
However I do see extra properties than "compatible" being added in DSD for PRP0001:
https://patchwork.ozlabs.org/patch/662813/ (see EEPROM part)And if we were to do this, I think that we would need to add some
device_property_read_u32("spi-rx-bus-width", ...), etc calls in the SPI FW parsing for ACPI path - I couldn't see that.
You'd need parsing code, yes.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 4 lines · Mark Brown
Quoted 2 lines · John Garry
Quoted 1 line · Mark Brown
On Fri, Jan 10, 2020 at 11:55:37AM +0000, John Garry wrote: >
Hi Mark,
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
OK, so that's just reusing the DT binding in which case everything that's valid for the DT binding should also be valid for ACPI - I thought that actually worked automatically without you having to do anything in the code but ICBW.
Quoted 8 lines
Quoted 3 lines
I thought that it would be improper as we could be mixing ACPI methods to describe the serial bus (SPI Serial Bus Connection Resource Descriptor) and also DT properties which could conflict, like CS active high.
Yes, that's one of the issues with importing bits of DT into ACPI unfortunately - you will get conflicts, it's not clear it's a good idea to be using PRP0001 for SPI stuff given that there's bus level bindings for both ACPI and SPI and they don't line up exactly.
Yeah, I'm not entirely comfortable with this yet.
Quoted 11 lines
Quoted 8 lines
However I do see extra properties than "compatible" being added in DSD for PRP0001:
https://patchwork.ozlabs.org/patch/662813/ (see EEPROM part)And if we were to do this, I think that we would need to add some
device_property_read_u32("spi-rx-bus-width", ...), etc calls in the SPI FW parsing for ACPI path - I couldn't see that.You'd need parsing code, yes.
I'll continue to check the options.
Thanks,
john
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
In reply to John GarryQuoted 2 lines · John Garry
Quoted 1 line · Mark Brown
On Fri, Jan 10, 2020 at 11:55:37AM +0000, John Garry wrote: >
...
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I will note that PRP0001+"jedec,spi-nor" compatible DSD seems to be the defacto method to describe the SPI NOR-compat part for ACPI - that's what I'm using. We could add properties there, but that seems improper.
OK, so that's just reusing the DT binding in which case everything that's valid for the DT binding should also be valid for ACPI - I thought that actually worked automatically without you having to do anything in the code but ICBW.
Quoted 7 lines
I thought that it would be improper as we could be mixing ACPI methods to describe the serial bus (SPI Serial Bus Connection Resource Descriptor) and also DT properties which could conflict, like CS active high.
However I do see extra properties than "compatible" being added in DSD for PRP0001:
https://patchwork.ozlabs.org/patch/662813/ (see EEPROM part)
PRP method is only for vendors to *test* the hardware in ACPI environment. The proper method is to allocate correct ACPI ID.
Properties (_DSD in ACPI) may be used in the same way as for DT if we have no other means in ACPI specification for them.
Quoted 3 lines
And if we were to do this, I think that we would need to add some
device_property_read_u32("spi-rx-bus-width", ...), etc calls in the SPI FW parsing for ACPI path - I couldn't see that.
It's okay as long as you have ACPI ID.
P.S. Most of the sensor drivers were updated in order to support ACPI PRP method due to DIY hobbyist on IoT sector and embedded devices. This should not be an official way how we support hardware on ACPI-based platforms.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 15 lines · Andy Shevchenko
Quoted 2 lines · John Garry
Quoted 1 line · Mark Brown
On Fri, Jan 10, 2020 at 11:55:37AM +0000, John Garry wrote: >
...
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
I will note that PRP0001+"jedec,spi-nor" compatible DSD seems to be the defacto method to describe the SPI NOR-compat part for ACPI - that's what I'm using. We could add properties there, but that seems improper.
OK, so that's just reusing the DT binding in which case everything that's valid for the DT binding should also be valid for ACPI - I thought that actually worked automatically without you having to do anything in the code but ICBW.
Quoted 8 lines
Quoted 7 lines
I thought that it would be improper as we could be mixing ACPI methods to describe the serial bus (SPI Serial Bus Connection Resource Descriptor) and also DT properties which could conflict, like CS active high.
However I do see extra properties than "compatible" being added in DSD for PRP0001:
https://patchwork.ozlabs.org/patch/662813/ (see EEPROM part)
Hi Andy,
Quoted 2 lines
PRP method is only for vendors to *test* the hardware in ACPI environment. The proper method is to allocate correct ACPI ID.
Yes, that would seem the proper thing to do. So the SPI NOR driver is based on micron m25p80 and compatible string is "jedec,spi-nor", so I don't know who should or would do this registration.
Quoted 9 lines
Properties (
_DSDin ACPI) may be used in the same way as for DT if we have no other means in ACPI specification for them.Quoted 3 lines
And if we were to do this, I think that we would need to add some
device_property_read_u32("spi-rx-bus-width", ...), etc calls in the SPI FW parsing for ACPI path - I couldn't see that.It's okay as long as you have ACPI ID.
Well there is none AFAIK.
Quoted 4 lines
P.S. Most of the sensor drivers were updated in order to support ACPI PRP method due to DIY hobbyist on IoT sector and embedded devices. This should not be an official way how we support hardware on ACPI-based platforms.
Yeah, so we could do this. But, as I mentioned already, this could mean that we conflicting properties. For this the kernel driver prob should only pay attention to properties which ACPI cannot describe.
Even better would be to update the ACPI spec, especially for something general like SPI bus width
BTW, Do any of these sensors you mention have any ACPI standardization?
Thanks,
John
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 8 lines · John Garry
Quoted 2 lines · Andy Shevchenko
PRP method is only for vendors to *test* the hardware in ACPI environment. The proper method is to allocate correct ACPI ID.
Yes, that would seem the proper thing to do. So the SPI NOR driver is based on micron m25p80 and compatible string is "jedec,spi-nor", so I don't know who should or would do this registration.
The idiomatic approach appears to be for individual board vendors to allocate IDs, you do end up with multiple IDs from multiple vendors for the same thing.
Quoted 1 line
BTW, Do any of these sensors you mention have any ACPI standardization?
In general there's not really much standardizaiton for devices, the bindings that do exist aren't really centrally documented and the Windows standard is just to have the basic device registration in the firmware and do all properties based on quirking based on DMI information.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 10 lines · Mark Brown
Quoted 8 lines · John Garry
Quoted 2 lines · Andy Shevchenko
PRP method is only for vendors to *test* the hardware in ACPI environment. The proper method is to allocate correct ACPI ID.
Yes, that would seem the proper thing to do. So the SPI NOR driver is based on micron m25p80 and compatible string is "jedec,spi-nor", so I don't know who should or would do this registration.
Hi Mark,
Quoted 3 lines
The idiomatic approach appears to be for individual board vendors to allocate IDs, you do end up with multiple IDs from multiple vendors for the same thing.
So we see sort of approach a lot when vendors integrate 3rd party IP into a SoC and then assign some vendor specific ID for that.
But I am not sure how appropriate that same approach would be for some 3rd party memory part which we're simply wiring up on our board. Maybe it is.
Quoted 9 lines
Quoted 2 lines
BTW, Do any of these sensors you mention have any ACPI standardization?
In general there's not really much standardizaiton for devices, the bindings that do exist aren't really centrally documented and the Windows standard is just to have the basic device registration in the firmware and do all properties based on quirking based on DMI information.
OK, so there is always DMI. I hoped to avoid this sort of thing in the linux driver :)
Cheers,
John
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 8 lines · John Garry
Quoted 3 lines · Mark Brown
The idiomatic approach appears to be for individual board vendors to allocate IDs, you do end up with multiple IDs from multiple vendors for the same thing.
But I am not sure how appropriate that same approach would be for some 3rd party memory part which we're simply wiring up on our board. Maybe it is.
It seems to be quite common for Intel reference designs to assign Intel IDs to non-Intel parts on the board (which is where I became aware of this practice).
Quoted 8 lines
Quoted 5 lines
In general there's not really much standardizaiton for devices, the bindings that do exist aren't really centrally documented and the Windows standard is just to have the basic device registration in the firmware and do all properties based on quirking based on DMI information.
OK, so there is always DMI. I hoped to avoid this sort of thing in the linux driver :)
Yes, there are some merits to an approach like that.
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 7 lines · Mark Brown
Quoted 5 lines · John Garry
Quoted 3 lines · Mark Brown
The idiomatic approach appears to be for individual board vendors to allocate IDs, you do end up with multiple IDs from multiple vendors for the same thing.
Quoted 6 lines
Quoted 2 lines
But I am not sure how appropriate that same approach would be for some 3rd party memory part which we're simply wiring up on our board. Maybe it is.
It seems to be quite common for Intel reference designs to assign Intel IDs to non-Intel parts on the board (which is where I became aware of this practice).
Basically vendor of component in question is responsible for ID, but it seems they simple don't care.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Mark Brown
Quoted 8 lines · John Garry
Quoted 3 lines · Mark Brown
The idiomatic approach appears to be for individual board vendors to allocate IDs, you do end up with multiple IDs from multiple vendors for the same thing.
But I am not sure how appropriate that same approach would be for some 3rd party memory part which we're simply wiring up on our board. Maybe it is.
Quoted 6 lines
Quoted 3 lines
It seems to be quite common for Intel reference designs to assign Intel IDs to non-Intel parts on the board (which is where I became aware of this practice).
Basically vendor of component in question is responsible for ID, but it seems they simple don't care.
AFAICT a lot of the time it seems to be that whoever is writing the software ends up assigning an ID, that may not be the silicon vendor.
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 16 lines · Mark Brown
Quoted 14 lines · Andy Shevchenko
Quoted 13 lines · Mark Brown
Quoted 8 lines · John Garry
Quoted 3 lines · Mark Brown
The idiomatic approach appears to be for individual board vendors to allocate IDs, you do end up with multiple IDs from multiple vendors for the same thing.
But I am not sure how appropriate that same approach would be for some 3rd party memory part which we're simply wiring up on our board. Maybe it is.
It seems to be quite common for Intel reference designs to assign Intel IDs to non-Intel parts on the board (which is where I became aware of this practice).
Quoted 6 lines
Quoted 2 lines
Basically vendor of component in question is responsible for ID, but it seems they simple don't care.
AFAICT a lot of the time it seems to be that whoever is writing the software ends up assigning an ID, that may not be the silicon vendor.
...which is effectively abusing the ACPI ID allocation procedure.
(And yes, Intel itself did it in the past — see badly created ACPI IDs
in the drivers)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 20 lines · Andy Shevchenko
Quoted 19 lines · Mark Brown
Quoted 17 lines · Andy Shevchenko
Quoted 7 lines · Mark Brown
Quoted 5 lines · John Garry
Quoted 3 lines · Mark Brown
The idiomatic approach appears to be for individual board vendors to allocate IDs, you do end up with multiple IDs from multiple vendors for the same thing.
Quoted 6 lines
Quoted 2 lines
But I am not sure how appropriate that same approach would be for some 3rd party memory part which we're simply wiring up on our board. Maybe it is.
It seems to be quite common for Intel reference designs to assign Intel IDs to non-Intel parts on the board (which is where I became aware of this practice).
Basically vendor of component in question is responsible for ID, but it seems they simple don't care.
Quoted 9 lines
Quoted 3 lines
AFAICT a lot of the time it seems to be that whoever is writing the software ends up assigning an ID, that may not be the silicon vendor.
...which is effectively abusing the ACPI ID allocation procedure.
(And yes, Intel itself did it in the past — see badly created ACPI IDs
in the drivers)
Hi Mark,
About this topic of ACPI having no method to describe device buswidth in the resource descriptor, it may be an idea for me to raise a Tianocore feature request @ https://bugzilla.tianocore.org/
There seems to be an avenue there for raising new features for the spec. I (or my org) can't participate in AWSG.
I would have no concrete proposal for spec update for now, though. Hopefully others with more expertise could contribute.
In the meantime, I have an RFC for using DMI to quirk support for this on the driver - I can share when ready.
Thanks,
John
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 32 lines · John Garry
Quoted 20 lines · Andy Shevchenko
Quoted 19 lines · Mark Brown
Quoted 17 lines · Andy Shevchenko
Quoted 7 lines · Mark Brown
Quoted 5 lines · John Garry
Quoted 3 lines · Mark Brown
The idiomatic approach appears to be for individual board vendors to allocate IDs, you do end up with multiple IDs from multiple vendors for the same thing.
Quoted 6 lines
Quoted 2 lines
But I am not sure how appropriate that same approach would be for some 3rd party memory part which we're simply wiring up on our board. Maybe it is.
It seems to be quite common for Intel reference designs to assign Intel IDs to non-Intel parts on the board (which is where I became aware of this practice).
Basically vendor of component in question is responsible for ID, but it seems they simple don't care.
Quoted 9 lines
Quoted 3 lines
AFAICT a lot of the time it seems to be that whoever is writing the software ends up assigning an ID, that may not be the silicon vendor.
...which is effectively abusing the ACPI ID allocation procedure.
(And yes, Intel itself did it in the past — see badly created ACPI IDs
in the drivers)
Quoted 6 lines
Hi Mark,
About this topic of ACPI having no method to describe device buswidth in the resource descriptor, it may be an idea for me to raise a Tianocore feature request @ https://bugzilla.tianocore.org/
The 19.6.126 describes the SPI resource, in particular:
---8<---8<---
DataBitLength is the size, in bits, of the smallest transfer unit for this connection. _LEN is automatically
created to refer to this portion of the resource descriptor. ---8<---8<---
Is it what you are looking for? (As far as I know most of the firmwares simple abuse this field among others)
Quoted 2 lines
There seems to be an avenue there for raising new features for the spec. I (or my org) can't participate in AWSG.
But have you read 19.6.126?
Quoted 2 lines
I would have no concrete proposal for spec update for now, though. Hopefully others with more expertise could contribute.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 27 lines · Andy Shevchenko
Quoted 26 lines · John Garry
Quoted 24 lines · Andy Shevchenko
Quoted 22 lines · Mark Brown
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Mark Brown
Quoted 8 lines · John Garry
Quoted 3 lines · Mark Brown
The idiomatic approach appears to be for individual board vendors to allocate IDs, you do end up with multiple IDs from multiple vendors for the same thing.
But I am not sure how appropriate that same approach would be for some 3rd party memory part which we're simply wiring up on our board. Maybe it is.
Quoted 6 lines
Quoted 3 lines
It seems to be quite common for Intel reference designs to assign Intel IDs to non-Intel parts on the board (which is where I became aware of this practice).
Basically vendor of component in question is responsible for ID, but it seems they simple don't care.
AFAICT a lot of the time it seems to be that whoever is writing the software ends up assigning an ID, that may not be the silicon vendor.
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
...which is effectively abusing the ACPI ID allocation procedure.
(And yes, Intel itself did it in the past — see badly created ACPI IDs
in the drivers)Hi Mark,
Hi Andy,
Quoted 7 lines
Quoted 4 lines
About this topic of ACPI having no method to describe device buswidth in the resource descriptor, it may be an idea for me to raise a Tianocore feature request @ https://bugzilla.tianocore.org/
The 19.6.126 describes the SPI resource, in particular:
Quoted 8 lines
---8<---8<---
DataBitLength is the size, in bits, of the smallest transfer unit for this connection._LENis automatically
created to refer to this portion of the resource descriptor. ---8<---8<---Is it what you are looking for? (As far as I know most of the firmwares simple abuse this field among others)
I didn't think so - I thought that there was a distinction between width and length in SPI terms.
So how do you find that most firmwares abuse this field? AFAICS, linux kernel doesn't interpret this field at all.
Quoted 6 lines
Quoted 3 lines
There seems to be an avenue there for raising new features for the spec. I (or my org) can't participate in AWSG.
But have you read 19.6.126?
Maybe some clarification at least could be achieved :)
Cheers,
John
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 3 lines · John Garry
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · John Garry
On 13/01/2020 14:34, Andy Shevchenko wrote:
...
Quoted 13 lines
Quoted 13 lines
Quoted 4 lines
About this topic of ACPI having no method to describe device buswidth in the resource descriptor, it may be an idea for me to raise a Tianocore feature request @ https://bugzilla.tianocore.org/
The 19.6.126 describes the SPI resource, in particular:
---8<---8<---
DataBitLength is the size, in bits, of the smallest transfer unit for this connection._LENis automatically
created to refer to this portion of the resource descriptor. ---8<---8<---
Quoted 5 lines
Quoted 2 lines
Is it what you are looking for? (As far as I know most of the firmwares simple abuse this field among others)
I didn't think so - I thought that there was a distinction between width and length in SPI terms.
My interpretation of this field is a data width of the slave. Basically what we have as transfer->size inside SPI in the Linux kernel.
Quoted 4 lines
So how do you find that most firmwares abuse this field? AFAICS, linux kernel doesn't interpret this field at all.
From all tables I have this is the result of appearance (some of the
tables are like 10x times present in my data base, but nevertheless)
140 SpiSerialBusV2(0x0000,PolarityHigh,FourWireMode,0x08,
411 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x08,
1 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x08,
36 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x10,
35 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x18,
35 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x20,
1 SpiSerialBusV2(0x0000,PolarityLow,ThreeWireMode,0x10,
8 SpiSerialBusV2(0x0001,PolarityLow,FourWireMode,0x08,
1 SpiSerialBusV2(0x0001,PolarityLow,FourWireMode,0x10,So, it seems I stand corrected, the field is in right use, although cases like 0x10 and 0x20 should be carefully checked.
We may teach kernel to get something meaningful out of it.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 12 lines · Andy Shevchenko
Quoted 3 lines · John Garry
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · John Garry
On 13/01/2020 14:34, Andy Shevchenko wrote:
...
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
About this topic of ACPI having no method to describe device buswidth in the resource descriptor, it may be an idea for me to raise a Tianocore feature request @ https://bugzilla.tianocore.org/
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
The 19.6.126 describes the SPI resource, in particular:
---8<---8<---
DataBitLength is the size, in bits, of the smallest transfer unit for this connection._LENis automatically
created to refer to this portion of the resource descriptor. ---8<---8<---
Hi Andy,
Quoted 26 lines
Quoted 5 lines
Quoted 2 lines
Is it what you are looking for? (As far as I know most of the firmwares simple abuse this field among others)
I didn't think so - I thought that there was a distinction between width and length in SPI terms.
My interpretation of this field is a data width of the slave. Basically what we have as
transfer->sizeinside SPI in the Linux kernel.Quoted 4 lines
So how do you find that most firmwares abuse this field? AFAICS, linux kernel doesn't interpret this field at all.
From all tables I have this is the result of appearance (some of the
tables are like 10x times present in my data base, but nevertheless)
140 SpiSerialBusV2(0x0000,PolarityHigh,FourWireMode,0x08, 411 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x08, 1 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x08, 36 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x10, 35 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x18, 35 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x20, 1 SpiSerialBusV2(0x0000,PolarityLow,ThreeWireMode,0x10, 8 SpiSerialBusV2(0x0001,PolarityLow,FourWireMode,0x08, 1 SpiSerialBusV2(0x0001,PolarityLow,FourWireMode,0x10,
Quoted 5 lines
So, it seems I stand corrected, the field is in right use, although cases like
0x10and0x20should be carefully checked.We may teach kernel to get something meaningful out of it.
It seems that someone already had a go at that:
https://lore.kernel.org/lkml/20170317212143.bogj6efzyvvf24yd-GFdadSzt00ze9xe1eoZjHA@public.gmane.org/
Thanks,
John
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Quoted 9 lines · John Garry
Quoted 4 lines · Andy Shevchenko
So, it seems I stand corrected, the field is in right use, although cases like
0x10and0x20should be carefully checked.We may teach kernel to get something meaningful out of it.
It seems that someone already had a go at that:
https://lore.kernel.org/lkml/[email protected]/
This is a discussion about supporting DT bindings for bits-per-word which is a different thing again, that's the size of a data word which is not connected with the physical wiring.
Please include human readable descriptions of things like commits and issues being discussed in e-mail in your mails, this makes them much easier for humans to read especially when they have no internet access. I do frequently catch up on my mail on flights or while otherwise travelling so this is even more pressing for me than just being about making things a bit easier to read.
Mark Brown
maintainerRe: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
In reply to Andy ShevchenkoQuoted 10 lines · Andy Shevchenko
Quoted 8 lines · John Garry
Quoted 6 lines · Andy Shevchenko
DataBitLength is the size, in bits, of the smallest transfer unit for this connection.
_LENis automatically
created to refer to this portion of the resource descriptor.Is it what you are looking for? (As far as I know most of the firmwares simple abuse this field among others)
Quoted 6 lines
Quoted 2 lines
I didn't think so - I thought that there was a distinction between width and length in SPI terms.
My interpretation of this field is a data width of the slave. Basically what we have as
transfer->sizeinside SPI in the Linux kernel.
This discussion is about the number of data lines, SPI_TX_QUAD and friends.
Quoted 10 lines
1 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x08, 36 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x10, 35 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x18, 35 SpiSerialBusV2(0x0000,PolarityLow,FourWireMode,0x20, 1 SpiSerialBusV2(0x0000,PolarityLow,ThreeWireMode,0x10, 8 SpiSerialBusV2(0x0001,PolarityLow,FourWireMode,0x08, 1 SpiSerialBusV2(0x0001,PolarityLow,FourWireMode,0x10,So, it seems I stand corrected, the field is in right use, although cases like
0x10and0x20should be carefully checked.
Those look like they're mainly controlling SPI_3WIRE so it does look like a reasonable fit, yes.
Mark Brown
maintainerApplied "spi: Add HiSilicon v3xx SPI NOR flash controller driver" to the spi tree
In reply to John GarryThe patch
spi: Add HiSilicon v3xx SPI NOR flash controller driver
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.6
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
a2ca53b52e007de81752bbb443d828f5950d6d04Mon Sep 17 00:00:00 2001
From: John Garry <[email protected]>
Date: Mon, 9 Dec 2019 22:08:09 +0800
Subject: [PATCH] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Add the driver for the HiSilicon v3xx SPI NOR flash controller, commonly found in hi16xx chipsets.
This is a different controller than that in drivers/mtd/spi-nor/hisi-sfc.c; indeed, the naming for that driver is poor, since it is really known as FMC, and can support other memory technologies.
The driver module name is "hisi-sfc-v3xx", as recommended by HW designer, being an attempt to provide a distinct name - v3xx being the unique controller versioning.
Only ACPI firmware is supported.
DMA is not supported, and we just use polling mode for operation completion notification.
The driver uses the SPI MEM OPs.
--- drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-hisi-sfc-v3xx.c | 284 ++++++++++++++++++++++++++++++++ 3 files changed, 294 insertions(+) create mode 100644 drivers/spi/spi-hisi-sfc-v3xx.c
drivers/spi/Kconfig +9 -0
@@ -281,6 +281,15 @@ config SPI_FSL_QUADSPI This controller does not support generic SPI messages. It only supports the high-level SPI memory interface. +config SPI_HISI_SFC_V3XX + tristate "HiSilicon SPI-NOR Flash Controller for Hi16XX chipsets" + depends on (ARM64 && ACPI) || COMPILE_TEST + depends on HAS_IOMEM + select CONFIG_MTD_SPI_NOR + help + This enables support for HiSilicon v3xx SPI-NOR flash controller + found in hi16xx chipsets. + config SPI_NXP_FLEXSPI tristate "NXP Flex SPI controller" depends on ARCH_LAYERSCAPE || HAS_IOMEM
drivers/spi/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_SPI_FSL_LPSPI) += spi-fsl-lpspi.o obj-$(CONFIG_SPI_FSL_QUADSPI) += spi-fsl-qspi.o obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o obj-$(CONFIG_SPI_GPIO) += spi-gpio.o +obj-$(CONFIG_SPI_HISI_SFC_V3XX) += spi-hisi-sfc-v3xx.o obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o obj-$(CONFIG_SPI_IMX) += spi-imx.o obj-$(CONFIG_SPI_LANTIQ_SSC) += spi-lantiq-ssc.o
drivers/spi/spi-hisi-sfc-v3xx.c new file +284 -0
284 lines not on this page · raw message
Signature · 6 lines
2.20.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH v2 3/3 MAINTAINERS: Add a maintainer for the HiSilicon v3xx SFC driver
In reply to John GarrySet John Garry @ Huawei as the maintainer.
--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -7492,6 +7492,12 @@ S: Supported F: drivers/scsi/hisi_sas/ F: Documentation/devicetree/bindings/scsi/hisilicon-sas.txt +HISILICON V3XX SPI NOR FLASH Controller Driver +M: John Garry <[email protected]> +W: http://www.hisilicon.com +S: Maintained +F: drivers/spi/spi-hisi-sfc-v3xx.c + HISILICON QM AND ZIP Controller DRIVER M: Zhou Wang <[email protected]> L: [email protected]
Signature · 1 line
2.17.1
Mark Brown
maintainerApplied "MAINTAINERS: Add a maintainer for the HiSilicon v3xx SFC driver" to the spi tree
The patch
MAINTAINERS: Add a maintainer for the HiSilicon v3xx SFC driver
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.6
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
99eb0a1221ac1083b8c87932c438ef016abdaa05Mon Sep 17 00:00:00 2001
From: John Garry <[email protected]>
Date: Mon, 9 Dec 2019 22:08:10 +0800
Subject: [PATCH] MAINTAINERS: Add a maintainer for the HiSilicon v3xx SFC
driver
Set John Garry @ Huawei as the maintainer.
--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -7492,6 +7492,12 @@ S: Supported F: drivers/scsi/hisi_sas/ F: Documentation/devicetree/bindings/scsi/hisilicon-sas.txt +HISILICON V3XX SPI NOR FLASH Controller Driver +M: John Garry <[email protected]> +W: http://www.hisilicon.com +S: Maintained +F: drivers/spi/spi-hisi-sfc-v3xx.c + HISILICON QM AND ZIP Controller DRIVER M: Zhou Wang <wangzhou1-C8/M+/[email protected]> L: [email protected]
Signature · 1 line
2.20.1
Quoted 2 lines · John Garry
This patchset introduces support for the HiSilicon SFC V3XX driver.
Hi guys,
Just a friendly reminder on this series.
Thanks,
John
Quoted 37 lines
Whilst the kernel tree already includes support for a "HiSilicon SFC driver", that is for different HW. Indeed, as mentioned in patch #1, the naming for that driver could be better, as it should support more memory technologies than SPI NOR (as I have been told), and it is actually known internally as FMC. As such, maybe "hisi-fmc" would have been better, but we can't change that now.
I used V3XX in this driver name, as that is the unique versioning for this HW.
As for the driver itself, it is quite simple. Only ACPI firmware is supported, and we assume m25p80 compatible SPI NOR part will be used.
DMA is not supported, and we just use polling mode for operation completion notification. The driver uses the SPI MEM OPs.
Changes from v1:
- Add ACPI kconfig dependency
- Fix up header comment style
- Change macros naming style
- Try to enforce aligned accesses inhisi_sfc_v3xx_adjust_op_size()John Garry (3):
mtd: spi-nor: hisi-sfc: Try to provide some clarity on which SFC we
are
spi: Add HiSilicon v3xx SPI NOR flash controller driver
MAINTAINERS: Add a maintainer for the HiSilicon v3xx SFC driverMAINTAINERS | 6 + drivers/mtd/spi-nor/Kconfig | 4 +- drivers/mtd/spi-nor/hisi-sfc.c | 2 +- drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-hisi-sfc-v3xx.c | 284 ++++++++++++++++++++++++++++++++ 6 files changed, 303 insertions(+), 3 deletions(-)create mode 100644
drivers/spi/spi-hisi-sfc-v3xx.c
Mark Brown
maintainerQuoted 7 lines · John Garry
Quoted 2 lines · John Garry
This patchset introduces support for the HiSilicon SFC V3XX driver.
Hi guys,
Just a friendly reminder on this series.
Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. If there have been review comments then people may be waiting for those to be addressed.
Sending content free pings adds to the mail volume (if they are seen at all) which is often the problem and since they can't be reviewed directly if something has gone wrong you'll have to resend the patches anyway, so sending again is generally a better approach though there are some other maintainers who like them - if in doubt look at how patches for the subsystem are normally handled.