Add eSPI device driver (flash channel)
v2 cover Add eSPI device driver (flash channel)
Hello everyone,
I'm presenting a revised version of the eSPI device driver patch series found at the following link:
https://lore.kernel.org/openbmc/[email protected]/
This update addresses the issues identified during the review process.
While the previous patch series attempted to incorporate support for all four different channels of eSPI using the ioctl interface , this new series focuses on upstreaming the flash channel (using the mtd interface) initially, ensuring that all review comments are duly addressed, before progressing further.
Diff between PACTH v1-v2:
1. The commit is split into multiple commits as per the review comments.
2. Explicity renamed the driver to indicate that it only support master attached flash storage (mafs).
3. Added new kconfig options to enable/disable eSPI mafs support.
Results:
Successfully conducted a flash update via eSPI.
Manojkiran Eda (4):
Add eSPI device driver (flash channel)
mtd: Replace module_init with subsys_initcall
ARM: dts: aspeed: Add eSPI node
dt-bindings: aspeed: Add eSPI controller
.../bindings/soc/aspeed/aspeed,espi.yaml | 94 ++++ arch/arm/boot/dts/aspeed/aspeed-g5.dtsi | 19 + arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 20 + drivers/mtd/mtdcore.c | 2 +- drivers/soc/aspeed/Kconfig | 38 ++ drivers/soc/aspeed/Makefile | 2 + drivers/soc/aspeed/aspeed-espi-ctrl.c | 197 ++++++++ drivers/soc/aspeed/aspeed-espi-ctrl.h | 169 +++++++ drivers/soc/aspeed/aspeed-espi-flash-mafs.c | 467 ++++++++++++++++++ drivers/soc/aspeed/aspeed-espi-flash.h | 71 +++ 10 files changed, 1078 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml create mode 100644 drivers/soc/aspeed/aspeed-espi-ctrl.c create mode 100644 drivers/soc/aspeed/aspeed-espi-ctrl.h create mode 100644 drivers/soc/aspeed/aspeed-espi-flash-mafs.c create mode 100644 drivers/soc/aspeed/aspeed-espi-flash.h
Signature · 1 line
2.40.1
PATCH v2 1/4 Add eSPI device driver (flash channel)
This patch adds the driver support for the eSPI controller of Aspeed 5/6th generation SoCs. This controller is a slave device communicating with a master over Enhanced Serial Peripheral Interface (eSPI).
eSPI supports 4 channels, namely peripheral, virtual wire, out-of-band, and flash, and operates at max frequency of 66MHz.
But at the moment, this patch set only supports the mafs mode (master attached flash sharing mode) in the flash channel.
--- drivers/soc/aspeed/Kconfig | 38 ++ drivers/soc/aspeed/Makefile | 2 + drivers/soc/aspeed/aspeed-espi-ctrl.c | 197 +++++++++ drivers/soc/aspeed/aspeed-espi-ctrl.h | 169 +++++++ drivers/soc/aspeed/aspeed-espi-flash-mafs.c | 467 ++++++++++++++++++++ drivers/soc/aspeed/aspeed-espi-flash.h | 71 +++ 6 files changed, 944 insertions(+) create mode 100644 drivers/soc/aspeed/aspeed-espi-ctrl.c create mode 100644 drivers/soc/aspeed/aspeed-espi-ctrl.h create mode 100644 drivers/soc/aspeed/aspeed-espi-flash-mafs.c create mode 100644 drivers/soc/aspeed/aspeed-espi-flash.h
drivers/soc/aspeed/Kconfig +38 -0
@@ -52,6 +52,44 @@ config ASPEED_SOCINFO help Say yes to support decoding of ASPEED BMC information. +menu "ASPEED eSPI Support" + +config ASPEED_ESPI + bool "ASPEED eSPI slave driver" + select REGMAP + select MFD_SYSCON + depends on ASPEED_ESPI_FLASH + default n + help + Enable driver support for the Aspeed eSPI engine. The eSPI engine + plays as a slave device in BMC to communicate with the Host over + the eSPI interface. + +menu "ASPEED eSPI Flash channel support" + +config ASPEED_ESPI_FLASH + bool "ASPEED eSPI flash channel support" + default n + depends on ASPEED_ESPI_FLASH_MAFS + select ASPEED_ESPI + help + Enable eSPI flash channel support. + +menu "ASPEED eSPI flash modes" + +config ASPEED_ESPI_FLASH_MAFS + bool "Master attached flash sharing (MAFS) support in eSPI" + default n + select ASPEED_ESPI_FLASH + help + Select this option if you have a Master attached flash connected to + the eSPI controller. + +endmenu # eSPI Flash Modes +endmenu # eSPI Flash Channel support +endmenu # eSPI Support + + endmenu endif
drivers/soc/aspeed/Makefile +2 -0
@@ -4,3 +4,5 @@ obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o obj-$(CONFIG_ASPEED_UART_ROUTING) += aspeed-uart-routing.o obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o obj-$(CONFIG_ASPEED_SOCINFO) += aspeed-socinfo.o +obj-$(CONFIG_ASPEED_ESPI) += aspeed-espi-ctrl.o +obj-$(CONFIG_ASPEED_ESPI_FLASH_MAFS) += aspeed-espi-flash-mafs.o
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +197 -0
197 lines not on this page · raw message
drivers/soc/aspeed/aspeed-espi-ctrl.h new file +169 -0
169 lines not on this page · raw message
drivers/soc/aspeed/aspeed-espi-flash-mafs.c new file +467 -0
467 lines not on this page · raw message
drivers/soc/aspeed/aspeed-espi-flash.h new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.40.1
Quoted 30 lines · Manojkiran Eda
This patch adds the driver support for the eSPI controller of Aspeed 5/6th generation SoCs. This controller is a slave device communicating with a master over Enhanced Serial Peripheral Interface (eSPI).
eSPI supports 4 channels, namely peripheral, virtual wire, out-of-band, and flash, and operates at max frequency of 66MHz.
But at the moment, this patch set only supports the mafs mode (master attached flash sharing mode) in the flash channel.
Signed-off-by Manojkiran Eda <[email protected]>--- drivers/soc/aspeed/Kconfig | 38 ++ drivers/soc/aspeed/Makefile | 2 + drivers/soc/aspeed/aspeed-espi-ctrl.c | 197 +++++++++ drivers/soc/aspeed/aspeed-espi-ctrl.h | 169 +++++++ drivers/soc/aspeed/aspeed-espi-flash-mafs.c | 467 ++++++++++++++++++++ drivers/soc/aspeed/aspeed-espi-flash.h | 71 +++ 6 files changed, 944 insertions(+) create mode 100644 drivers/soc/aspeed/aspeed-espi-ctrl.c create mode 100644 drivers/soc/aspeed/aspeed-espi-ctrl.h create mode 100644 drivers/soc/aspeed/aspeed-espi-flash-mafs.c create mode 100644 drivers/soc/aspeed/aspeed-espi-flash.hdrivers/soc/aspeed/Kconfig +0
-0
drivers/soc/aspeed/Kconfig config ASPEED_SOCINFO · line 58
Quoted 7 lines
drivers/soc/aspeed/Kconfig +4
-0@@ -52,6 +52,44 @@ config ASPEED_SOCINFO help Say yes to support decoding of ASPEED BMC information. +menu "ASPEED eSPI Support" + +config ASPEED_ESPI + bool "ASPEED eSPI slave driver"
Why this is not tristate?
drivers/soc/aspeed/Kconfig config ASPEED_SOCINFO · line 68
Quoted 10 lines
drivers/soc/aspeed/Kconfig +10
-0+ select REGMAP + select MFD_SYSCON + depends on ASPEED_ESPI_FLASH + default n + help + Enable driver support for the Aspeed eSPI engine. The eSPI engine + plays as a slave device in BMC to communicate with the Host over + the eSPI interface. + +menu "ASPEED eSPI Flash channel support"
You have way too many menus...
drivers/soc/aspeed/Kconfig config ASPEED_SOCINFO · line 70
Quoted 2 lines
drivers/soc/aspeed/Kconfig +2
-0+ +config ASPEED_ESPI_FLASH
This is not used, drop.
drivers/soc/aspeed/Kconfig config ASPEED_SOCINFO · line 81
Quoted 11 lines
drivers/soc/aspeed/Kconfig +11
-0+ bool "ASPEED eSPI flash channel support" + default n + depends on ASPEED_ESPI_FLASH_MAFS + select ASPEED_ESPI + help + Enable eSPI flash channel support. + +menu "ASPEED eSPI flash modes" + +config ASPEED_ESPI_FLASH_MAFS + bool "Master attached flash sharing (MAFS) support in eSPI"
Why this is not tristate?
Quoted 19 lines
drivers/soc/aspeed/Kconfig +11
-0+ default n + select ASPEED_ESPI_FLASH + help + Select this option if you have a Master attached flash connected to + the eSPI controller. + +endmenu # eSPI Flash Modes +endmenu # eSPI Flash Channel support +endmenu # eSPI Support + + endmenu endifdrivers/soc/aspeed/Makefile +0
-0
drivers/soc/aspeed/Makefile obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o · line 8
Quoted 5 lines
drivers/soc/aspeed/Makefile +2
-0@@ -4,3 +4,5 @@ obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o obj-$(CONFIG_ASPEED_UART_ROUTING) += aspeed-uart-routing.o obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o obj-$(CONFIG_ASPEED_SOCINFO) += aspeed-socinfo.o +obj-$(CONFIG_ASPEED_ESPI) += aspeed-espi-ctrl.o +obj-$(CONFIG_ASPEED_ESPI_FLASH_MAFS) += aspeed-espi-flash-mafs.o
Why did you put spi drivers in soc? SPI drivers usually go to spi, don't they?
Quoted 18 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +12
-0@@ -0,0 +1,197 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2024 Aspeed Technology Inc. +*/ +#include <linux/io.h> +#include <linux/irq.h> +#include <linux/clk.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/miscdevice.h>
drivers/soc/aspeed/aspeed-espi-ctrl.c line 22
Quoted 10 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +10
-0+#include <linux/dma-mapping.h> +#include <linux/mfd/syscon.h> +#include <linux/regmap.h> +#include <linux/uaccess.h> +#include <linux/vmalloc.h> + +#include "aspeed-espi-ctrl.h" +#include "aspeed-espi-flash.h" + +/**
No need for kerneldoc for private functions.
Quoted 40 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +40
-0+* aspeed_espi_ctrl_isr - function to handle various interrupts +* @irq: interrupt line +* @arg: pointer to access device registers +* +* Returns IRQ_HANDLED +*/ +static irqreturn_t aspeed_espi_ctrl_isr (int irq,void *arg) +{ +uint32_t sts; +struct aspeed_espi_ctrl *espi_ctrl = (struct aspeed_espi_ctrl *)arg; + +regmap_read (espi_ctrl->map,ESPI_INT_STS , &sts); + +if (sts &ESPI_INT_STS_FLASH_BITS ) { +aspeed_espi_flash_event (sts, espi_ctrl->flash); +regmap_write (espi_ctrl->map,ESPI_INT_STS , + sts &ESPI_INT_STS_FLASH_BITS ); + } + +if (sts &ESPI_INT_STS_HW_RST_DEASSERT ) { +aspeed_espi_flash_enable (espi_ctrl->flash); + +regmap_write (espi_ctrl->map,ESPI_SYSEVT_INT_T0 ,0x0 ); +regmap_write (espi_ctrl->map,ESPI_SYSEVT_INT_T1 ,0x0 ); +regmap_write (espi_ctrl->map,ESPI_SYSEVT_INT_EN ,0xffffffff ); + +regmap_write (espi_ctrl->map,ESPI_SYSEVT1_INT_T0 ,0x1 ); +regmap_write (espi_ctrl->map,ESPI_SYSEVT1_INT_EN ,0x1 ); + +regmap_update_bits (espi_ctrl->map,ESPI_INT_EN , +ESPI_INT_EN_HW_RST_DEASSERT , +ESPI_INT_EN_HW_RST_DEASSERT ); + +regmap_update_bits ( + espi_ctrl->map,ESPI_SYSEVT , +ESPI_SYSEVT_SLV_BOOT_STS |ESPI_SYSEVT_SLV_BOOT_DONE , +ESPI_SYSEVT_SLV_BOOT_STS |ESPI_SYSEVT_SLV_BOOT_DONE ); + +regmap_write (espi_ctrl->map,ESPI_INT_STS , +ESPI_INT_STS_HW_RST_DEASSERT );
drivers/soc/aspeed/aspeed-espi-ctrl.c line 72
Quoted 10 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +10
-0+ } + +return IRQ_HANDLED ; +} + +/** +* aspeed_espi_ctrl_probe - function to probe the platform driver +* @pdev: platform device +* +* Returns 0 on success, -ENOMEM on error
Drop useless kerneldoc / entire function comment. That's just probe...
Quoted 7 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +7
-0+*/ +static int aspeed_espi_ctrl_probe (struct platform_device *pdev) +{ +int rc =0 ; +struct aspeed_espi_ctrl *espi_ctrl; +struct device *dev = &pdev->dev; +
drivers/soc/aspeed/aspeed-espi-ctrl.c line 89
Quoted 10 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +10
-0+ espi_ctrl =devm_kzalloc (dev,sizeof (*espi_ctrl),GFP_KERNEL ); +if (!espi_ctrl) +return -ENOMEM ; + + espi_ctrl->model =of_device_get_match_data (dev); + + espi_ctrl->map =syscon_node_to_regmap (dev->parent->of_node); +if (IS_ERR (espi_ctrl->map)) { +dev_err (dev,"cannot get remap\n" ); +return PTR_ERR (espi_ctrl->map);
return dev_err_probe
drivers/soc/aspeed/aspeed-espi-ctrl.c line 99
Quoted 10 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +10
-0+ } + + espi_ctrl->irq =platform_get_irq (pdev,0 ); +if (espi_ctrl->irq <0 ) +return espi_ctrl->irq; + + espi_ctrl->clk =devm_clk_get (dev,NULL ); +if (IS_ERR (espi_ctrl->clk)) { +dev_err (dev,"cannot get clock\n" ); +return PTR_ERR (espi_ctrl->clk);
return dev_err_probe
Quoted 7 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +7
-0+ } + + rc =clk_prepare_enable (espi_ctrl->clk); +if (rc) { +dev_err (dev,"cannot enable clock\n" ); +return rc; + }
drivers/soc/aspeed/aspeed-espi-ctrl.c line 116
Quoted 10 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +10
-0+ +/* +* This takes care of deferred probe , incase the mtd core +* subsystem is not probed yet. +*/ + espi_ctrl->flash =aspeed_espi_flash_alloc (dev, espi_ctrl); +if (IS_ERR (espi_ctrl->flash)) { +dev_err (dev,"failed to allocate flash channel\n" ); +pr_info ("flash alloc failed with return code %ld\n" , +PTR_ERR (espi_ctrl->flash));
Please clean up the code. Drop.
Quoted 15 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +15
-0+return PTR_ERR (espi_ctrl->flash); + } + +regmap_write (espi_ctrl->map,ESPI_SYSEVT_INT_T0 ,0x0 ); +regmap_write (espi_ctrl->map,ESPI_SYSEVT_INT_T1 ,0x0 ); +regmap_write (espi_ctrl->map,ESPI_SYSEVT_INT_EN ,0xffffffff ); + +regmap_write (espi_ctrl->map,ESPI_SYSEVT1_INT_T0 ,0x1 ); +regmap_write (espi_ctrl->map,ESPI_SYSEVT1_INT_EN ,0x1 ); + + rc =devm_request_irq (dev, espi_ctrl->irq, aspeed_espi_ctrl_isr,0 , +DEVICE_NAME , espi_ctrl); +if (rc) { +dev_err (dev,"failed to request IRQ\n" ); +return rc;
drivers/soc/aspeed/aspeed-espi-ctrl.c line 141
Quoted 10 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +10
-0+ } + +// clear the interrupt enable register +regmap_write (espi_ctrl->map,ESPI_INT_EN_CLR ,0x7fffffff ); + +// Disable the interrupts in all channels except flash channel +regmap_update_bits (espi_ctrl->map,ESPI_INT_EN , +ESPI_INT_EN_FLASH_BITS |ESPI_INT_EN_HW_RST_DEASSERT , +ESPI_INT_EN_FLASH_BITS | +ESPI_INT_STS_HW_RST_DEASSERT );
Why do you first request interrupt and then disable them? What if it fires earlier?
drivers/soc/aspeed/aspeed-espi-ctrl.c line 145
Quoted 4 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +4
-0+ +dev_set_drvdata (dev, espi_ctrl); + +dev_info (dev,"module loaded\n" );
No, drop such simple function success statements.
drivers/soc/aspeed/aspeed-espi-ctrl.c line 155
Quoted 10 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +10
-0+ +return 0 ; +} + +/** +* aspeed_espi_ctrl_remove - Release the driver +* @pdev: the platform device +* +* Returns 0 +*/
Drop entire comment, useless.
...
drivers/soc/aspeed/aspeed-espi-ctrl.c line 168
Quoted 13 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +13
-0+ +void *aspeed_espi_flash_alloc (struct device *dev, +struct aspeed_espi_ctrl *espi_ctrl) +{ +int ret, index; +struct aspeed_espi_flash_dma *dma; +struct mtd_info *mtd; +struct aspeed_espi_flash *espi_flash; +struct resource res; +u32 reg; + + espi_flash = +devm_kzalloc (dev,sizeof (struct aspeed_espi_flash ),GFP_KERNEL );
sizeof(*)
Quoted 6 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +6
-0+if (!espi_flash) +return ERR_PTR (-ENOMEM ); + + espi_flash->ctrl = espi_ctrl; + +/* Bus lock */
drivers/soc/aspeed/aspeed-espi-ctrl.c line 184
Quoted 10 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +10
-0+mutex_init (&espi_flash->lock); + +init_waitqueue_head (&espi_flash->wq); + +spin_lock_init (&espi_flash->spinlock); + + dma = &espi_flash->dma; + + dma->tx_virt = +dma_alloc_coherent (dev,PAGE_SIZE , &dma->tx_addr,GFP_KERNEL );
Wrong wrapping.
drivers/soc/aspeed/aspeed-espi-ctrl.c line 186
Quoted 2 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +2
-0+if (!dma->tx_virt) { +dev_err (dev,"cannot allocate DMA TX buffer\n" );
Do not print anything on allocation failures.
drivers/soc/aspeed/aspeed-espi-ctrl.c line 193
Quoted 7 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +7
-0+return ERR_PTR (-ENOMEM ); + } + + dma->rx_virt = +dma_alloc_coherent (dev,PAGE_SIZE , &dma->rx_addr,GFP_KERNEL ); +if (!dma->rx_virt) { +dev_err (dev,"cannot allocate DMA RX buffer\n" );
Drop
drivers/soc/aspeed/aspeed-espi-ctrl.c
Quoted 5 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +5
-0+return ERR_PTR (-ENOMEM ); + } + index =of_property_match_string (dev->of_node,"reg-names" , +"espi_flash" ); + ret =of_address_to_resource (dev->of_node, index, &res);
Why such unusual code? Why you cannot just map the io space?
Quoted 43 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +43
-0+if (ret <0 ) { +dev_err (dev, +"Could not find espi_flash resource block size in devtree\n" ); +return ERR_PTR (-ENODEV ); + } + reg =resource_size (&res); + mtd = &espi_flash->mtd; + mtd->dev.parent = dev; + mtd->size = reg; + mtd->flags =MTD_CAP_NORFLASH ; + mtd->_erase = aspeed_espi_flash_erase; + mtd->_read = aspeed_espi_flash_read; + mtd->_write = aspeed_espi_flash_write; + mtd->type =MTD_NORFLASH ; + mtd->name ="espi-flash-mafs" ; + +regmap_read (espi_ctrl->map,ESPI_CH3_CAP_N_CONF , ®); + reg = (reg &ESPI_CH3_CAP_N_CONF_ERASE_MASK ) >> +ESPI_CH3_CAP_N_CONF_ERASE_SHIFT ; + espi_flash->erase_mask = reg; +switch (reg) { +case ESPI_CH3_CAP_N_CONF_ERASE_SIZE_4KB : +case ESPI_CH3_CAP_N_CONF_ERASE_SIZE_4KB_64KB : + mtd->erasesize =0x1000 ; + espi_flash->erase_mask =1 ; +break ; +case ESPI_CH3_CAP_N_CONF_ERASE_SIZE_64KB : + mtd->erasesize =0x10000 ; +break ; +case ESPI_CH3_CAP_N_CONF_ERASE_SIZE_128KB : + mtd->erasesize =0x20000 ; +break ; +case ESPI_CH3_CAP_N_CONF_ERASE_SIZE_256KB : + mtd->erasesize =0x40000 ; +break ; +default : +dev_notice (dev,"Unknown erase size %x\n" , reg); +return ERR_PTR (-ENODEV ); + } + + mtd->writesize =1 ; + mtd->owner =THIS_MODULE ; + mtd->priv = espi_flash;
drivers/soc/aspeed/aspeed-espi-ctrl.c
Quoted 10 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +10
-0+ + ret =mtd_device_register (mtd,NULL ,0 ); +if (ret) { +dev_notice (dev,"aspeed-espi-mtd: Failed to register mtd device\n" ); +return ERR_PTR (ret); + } + +aspeed_espi_flash_enable (espi_flash); +return espi_flash; +}
Missing export as GPL
drivers/soc/aspeed/aspeed-espi-ctrl.c
Quoted 11 lines
drivers/soc/aspeed/aspeed-espi-ctrl.c new file +11
-0+ +void aspeed_espi_flash_free (struct device *dev, +struct aspeed_espi_flash *espi_flash) +{ +struct aspeed_espi_flash_dma *dma = &espi_flash->dma; + +dma_free_coherent (dev,PAGE_SIZE , dma->tx_virt, dma->tx_addr); +dma_free_coherent (dev,PAGE_SIZE , dma->rx_virt, dma->rx_addr); + +mtd_device_unregister (&espi_flash->mtd); +}
Missing export as GPL
Best regards,
Krzysztof
PATCH v2 2/4 mtd: Replace module_init with subsys_initcall
In reply to Manojkiran EdaWhile engaged in development on the espi kernel device driver[1], I noticed that the espi flash driver, utilizing the mtd subsystem, appears to initialize before the mtdcore subsystem registers the mtd_class. As a result, although the mtd device for espi is created, it does not populate within the /sys/class/mtd hierarchy.
Given that mtd serves as a subsystem upon which numerous other drivers rely for infrastructure, it appears logical to adjust the module_init() call to an alternative priority initcall, subsys_initcall(), thereby ensuring that the mtd core subsystem is probed prior to the drivers utilizing its infrastructure.
Although this adjustment alters the initialization ordering, there exists a slight risk of uncovering implicit initialization ordering issues. However, I believe it is preferable to prioritize it reasonably rather than having module_init() in order to maintain the exact old ordering.
--- drivers/mtd/mtdcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/mtdcore.c +1 -1
@@ -2560,7 +2560,7 @@ static void __exit cleanup_mtd(void)idr_destroy (&mtd_idr); } -module_init (init_mtd); +subsys_initcall (init_mtd);module_exit (cleanup_mtd);MODULE_LICENSE ("GPL" );
Signature · 1 line
2.40.1
Re: [PATCH v2 2/4] mtd: Replace module_init with subsys_initcall
Quoted 3 lines · Manojkiran Eda
While engaged in development on the espi kernel device driver[1], I noticed that the espi flash driver, utilizing the mtd subsystem, appears to initialize before the mtdcore subsystem registers the
NAK
You incorrectly ordered your call, so now to fix this you incorrectly re-order rest of kernel. No. Fix your code to handle modules, probe deferrals and device links.
Best regards,
Krzysztof
Miquel Raynal
maintainerRe: [PATCH v2 2/4] mtd: Replace module_init with subsys_initcall
Hi,
krzysztof.kozlowski at linaro.org wrote on Tue, 19 Mar 2024 10:51:00 +0100:
Quoted 10 lines · Manojkiran Eda
Quoted 3 lines
While engaged in development on the espi kernel device driver[1], I noticed that the espi flash driver, utilizing the mtd subsystem, appears to initialize before the mtdcore subsystem registers the
NAK
You incorrectly ordered your call, so now to fix this you incorrectly re-order rest of kernel. No. Fix your code to handle modules, probe deferrals and device links.
Agreed. You shall not need this. Maybe just moving the driver to the right location (spi) might fix it.
Thanks,
Miqu?l
PATCH v2 3/4 ARM: dts: aspeed: Add eSPI node
In reply to Manojkiran EdaThis commit adds eSPI to the device tree for aspeed 5/6th generation SoCs.
--- arch/arm/boot/dts/aspeed/aspeed-g5.dtsi | 19 +++++++++++++++++++ arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+)
arch/arm/boot/dts/aspeed/aspeed-g5.dtsi +19 -0
@@ -343,6 +343,25 @@ sdhci1: sdhci@200 { status = "disabled"; }; }; + espi: espi@1e6ee000 { + compatible = "aspeed,ast2500-espi", "simple-mfd", "syscon"; + reg = <0x1e6ee000 0x1000>; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x1e6ee000 0x1000>; + + espi_ctrl: espi-ctrl@0 { + compatible = "aspeed,ast2500-espi-ctrl"; + reg = <0x0 0x800>,<0x0 0x4000000>; + reg-names = "espi_ctrl","espi_flash"; + interrupts = <23>; + clocks = <&syscon ASPEED_CLK_GATE_ESPICLK>; + status = "disabled"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_espi_default>; + }; + }; gpio: gpio@1e780000 { #gpio-cells = <2>;
arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +20 -0
@@ -454,6 +454,26 @@ video: video@1e700000 { status = "disabled"; }; + espi: espi@1e6ee000 { + compatible = "aspeed,ast2500-espi", "simple-mfd", "syscon"; + reg = <0x1e6ee000 0x1000>; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x1e6ee000 0x1000>; + + espi_ctrl: espi-ctrl@0 { + compatible = "aspeed,ast2500-espi-ctrl"; + reg = <0x0 0x800>,<0x0 0x4000000>; + reg-names = "espi_ctrl","espi_flash"; + interrupts = <23>; + clocks = <&syscon ASPEED_CLK_GATE_ESPICLK>; + status = "disabled"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_espi_default>; + }; + }; + gpio0: gpio@1e780000 { #gpio-cells = <2>; gpio-controller;
Signature · 1 line
2.40.1
Re: [PATCH v2 3/4] ARM: dts: aspeed: Add eSPI node
Quoted 14 lines · Manojkiran Eda
This commit adds eSPI to the device tree for aspeed 5/6th generation SoCs.
Signed-off-by Manojkiran Eda <[email protected]>--- arch/arm/boot/dts/aspeed/aspeed-g5.dtsi | 19 +++++++++++++++++++ arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+)arch/arm/boot/dts/aspeed/aspeed-g5.dtsi +0
-0
arch/arm/boot/dts/aspeed/aspeed-g5.dtsi sdhci1: sdhci at 200 { · line 346
Quoted 4 lines
arch/arm/boot/dts/aspeed/aspeed-g5.dtsi +1
-0@@ -343,6 +343,25 @@ sdhci1: sdhci at 200 { status = "disabled"; }; }; + espi: espi at 1e6ee000 {
spi or syscon
Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
arch/arm/boot/dts/aspeed/aspeed-g5.dtsi sdhci1: sdhci@200 {
Quoted 8 lines
arch/arm/boot/dts/aspeed/aspeed-g5.dtsi +8
-0+ compatible = "aspeed,ast2500-espi", "simple-mfd", "syscon"; + reg = <0x1e6ee000 0x1000>; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x1e6ee000 0x1000>; + + espi_ctrl: espi-ctrl at 0 {
What is this device? If parent is espi, then what is this?
Where is the binding?
Best regards,
Krzysztof
PATCH v2 4/4 dt-bindings: aspeed: Add eSPI controller
In reply to Manojkiran EdaThis commit adds the device tree bindings for aspeed eSPI controller.
Although aspeed eSPI hardware supports 4 different channels, this commit only adds the support for flash channel, the bindings for other channels could be upstreamed when the driver support for those are added.
--- .../bindings/soc/aspeed/aspeed,espi.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +94 -0
@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# # Copyright (c) 2024 IBM Corporation. +# # Copyright (c) 2021 Aspeed Technology Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/aspeed/aspeed,espi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Aspeed eSPI Controller + +maintainers: + - Manojkiran Eda <[email protected]> + - Patrick Rudolph <[email protected]> + - Chia-Wei Wang <[email protected]> + - Ryan Chen <[email protected]> + +description: + Aspeed eSPI controller implements a device side eSPI endpoint device + supporting the flash channel. + +properties: + compatible: + items: + - enum: + - aspeed,ast2500-espi + - aspeed,ast2600-espi + - const: simple-mfd + - const: syscon + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + + ranges: true + +patternProperties: + "^espi-ctrl@[0-9a-f]+$": + type: object + + description: Controls the flash channel of eSPI hardware + + properties: + compatible: + items: + - enum: + - aspeed,ast2500-espi-ctrl + - aspeed,ast2600-espi-ctrl + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + required: + - compatible + - interrupts + - clocks + +required: + - compatible + - reg + - "#address-cells" + - "#size-cells" + - ranges + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/ast2600-clock.h> + + espi: espi@1e6ee000 { + compatible = "aspeed,ast2600-espi", "simple-mfd", "syscon"; + reg = <0x1e6ee000 0x1000>; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x1e6ee000 0x1000>; + + espi_ctrl: espi-ctrl@0 { + compatible = "aspeed,ast2600-espi-ctrl"; + reg = <0x0 0x800>,<0x0 0x4000000>; + reg-names = "espi_ctrl","espi_flash"; + interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&syscon ASPEED_CLK_GATE_ESPICLK>; + }; + };
Signature · 1 line
2.40.1
Re: [PATCH v2 4/4] dt-bindings: aspeed: Add eSPI controller
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml
Quoted 19 lines · Manojkiran Eda
This commit adds the device tree bindings for aspeed eSPI controller.
Although aspeed eSPI hardware supports 4 different channels, this commit only adds the support for flash channel, the bindings for other channels could be upstreamed when the driver support for those are added.
Signed-off-by Manojkiran Eda <[email protected]>--- .../bindings/soc/aspeed/aspeed,espi.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yamlDocumentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +0
-0
Why Rob's comments got ignored?
This is not a soc component.
Quoted 10 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +9
-0@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# # Copyright (c) 2024 IBM Corporation. +# # Copyright (c) 2021 Aspeed Technology Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/aspeed/aspeed,espi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Aspeed eSPI Controller
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 19
Quoted 10 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +10
-0+ +maintainers: + - Manojkiran Eda <[email protected]> + - Patrick Rudolph <[email protected]> + - Chia-Wei Wang <[email protected]> + - Ryan Chen <[email protected]> + +description: + Aspeed eSPI controller implements a device side eSPI endpoint device + supporting the flash channel.
Explain what is eSPI.
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 27
Quoted 8 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +8
-0+ +properties: + compatible: + items: + - enum: + - aspeed,ast2500-espi + - aspeed,ast2600-espi + - const: simple-mfd
That's not simple-mfd. You have driver for this. Drop.
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 28
Quoted 1 line
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +1
-0+ - const: syscon
That's not syscon. Why do you have ranges then? Where is any explanation of hardware which would justify such combination?
Quoted 7 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +7
-0+ + reg: + maxItems: 1 + + "#address-cells": + const: 1 +
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 45
Quoted 10 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +10
-0+ "#size-cells": + const: 1 + + ranges: true + +patternProperties: + "^espi-ctrl@[0-9a-f]+$": + type: object + + description: Controls the flash channel of eSPI hardware
That explains nothing. Unless you wanted to use here MTD bindings.
This binding did not improve much. I don't understand why this is not SPI (nothing in commit msg, nothing in description), what is eSPI, why do you need child device, what are other children (commit msg is quite vague here). Why there is no MTD bindings here?
All this looks like crafted for your driver, instead of using existing DT bindings like SPI or MTD/NAND. This is a strong no-go.
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +4
-0+ + properties: + compatible: + items:
No items, just use enum.
Quoted 30 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +30
-0+ - enum: + - aspeed,ast2500-espi-ctrl + - aspeed,ast2600-espi-ctrl + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + required: + - compatible + - interrupts + - clocks + +required: + - compatible + - reg + - "#address-cells" + - "#size-cells" + - ranges + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/ast2600-clock.h> + + espi: espi at 1e6ee000 {
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 89
Quoted 10 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +10
-0+ compatible = "aspeed,ast2600-espi", "simple-mfd", "syscon"; + reg = <0x1e6ee000 0x1000>; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x1e6ee000 0x1000>; + + espi_ctrl: espi-ctrl at 0 { + compatible = "aspeed,ast2600-espi-ctrl"; + reg = <0x0 0x800>,<0x0 0x4000000>;
Fix your style in DTS. There is always a space after ','.
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 94
Quoted 5 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +5
-0+ reg-names = "espi_ctrl","espi_flash"; + interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&syscon ASPEED_CLK_GATE_ESPICLK>; + }; + };
Best regards,
Krzysztof
PATCH v2 4/4 dt-bindings: aspeed: Add eSPI controller
Quoted 15 lines · Krzysztof Kozlowski
Quoted 14 lines · Manojkiran Eda
This commit adds the device tree bindings for aspeed eSPI controller.
Although aspeed eSPI hardware supports 4 different channels, this commit only adds the support for flash channel, the bindings for other channels could be upstreamed when the driver support for those are added.
Signed-off-by Manojkiran Eda<[email protected]>--- .../bindings/soc/aspeed/aspeed,espi.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+)create mode 100644
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml
Quoted 8 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml
Quoted 5 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +0
-0Why Rob's comments got ignored?
This is not a soc component.
I did not mean to ignore, i have few reasons listed below that provides information on why i felt this belongs into soc.
Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +12
-0@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# # Copyright (c) 2024 IBM Corporation. +# # Copyright (c) 2021 Aspeed Technology Inc. +%YAML 1.2 +--- +$id:http://devicetree.org/schemas/soc/aspeed/aspeed,espi.yaml# +$schema:http://devicetree.org/meta-schemas/core.yaml# + +title: Aspeed eSPI Controller + +maintainers: + - Manojkiran Eda<[email protected]>
Quoted 8 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 19
Quoted 7 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +7
-0+ - Patrick Rudolph<[email protected]> + - Chia-Wei Wang<[email protected]> + - Ryan Chen<[email protected]> + +description: + Aspeed eSPI controller implements a device side eSPI endpoint device + supporting the flash channel.Explain what is eSPI.
eSPI is a serial bus interface for client and server platforms that is based on SPI,? using the same master and slave topology but operates with a different protocol to meet new requirements. For instance, eSPI uses I/O, or input/output, communication, instead of MOSI/MISO used in SPI. It also includes a transaction layer on top of the SPI protocol, defining packets such as command and response packets that allow both the master and slave to initiate alert and reset signals. eSPI supports communication between Embedded Controller (EC), Baseboard Management Controller (BMC), Super-I/O (SIO) and Port-80 debug cards. I could add this to the commit message as well in the next patchset.
Quoted 35 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 27
Quoted 9 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +8
-0+ +properties: + compatible: + items: + - enum: + - aspeed,ast2500-espi + - aspeed,ast2600-espi + - const: simple-mfdThat's not simple-mfd. You have driver for this. Drop.
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 28
Quoted 1 line
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +1
-0+ - const: sysconThat's not syscon. Why do you have ranges then? Where is any explanation of hardware which would justify such combination?
Quoted 7 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +7
-0+ + reg: + maxItems: 1 + + "#address-cells": + const: 1 +Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 45
Quoted 10 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +10
-0+ "#size-cells": + const: 1 + + ranges: true + +patternProperties: + "^espi-ctrl@[0-9a-f]+$": + type: object + + description: Controls the flash channel of eSPI hardwareThat explains nothing. Unless you wanted to use here MTD bindings.
Quoted 2 lines
This binding did not improve much. I don't understand why this is not SPI (nothing in commit msg, nothing in description), what is eSPI,
eSPI uses Peripheral, Virtual Wire, Out of Band, and Flash Access channels to communicate different sets of data.
* The *Peripheral* Channel is used for communication between eSPI host bridge located on the master side and eSPI endpoints located on the slave side. LPC Host and LPC Peripherals are an example of eSPI host bridge and eSPI endpoints respectively.
* *Virtual Wire* Channel: The Virtual Wire channel is used to communicate the state of sideband pins or GPIO tunneled through eSPI as in-band messages. Serial IRQ interrupts are communicated through this channel as in-band messages.
* *OOB* Channel: The SMBus packets are tunneled through eSPI as Out-Of-Band (OOB) messages. The whole SMBus packet is embedded inside the eSPI OOB message as data.
* *Flash Access* Channel: The Flash Access channel provides a path allowing the flash components to be shared run-time between chipset and the eSPI slaves that require flash accesses such as EC (Embedded Controller) and BMC.
Although , eSPI reuses the timing and electrical specification of Serial Peripheral Interface (SPI) but it runs an entirely different protocol to meet a set of different requirements. Which is why i felt probably placing this in soc was a better choice rather than spi. Do you think otherwise ?
Quoted 5 lines
why
do you need child device, what are other children (commit msg is quite vague here). Why there is no MTD bindings here?All this looks like crafted for your driver,
Apologies, this was not my intention. I wanted this to be as generic as possible. But i don't really have much knowledge on what's the right way to model things in kernel at the moment. Still trying to learn and understand by looking at various other drivers. Appreciate all the feedback.
Quoted 8 lines
instead of using existing
DT bindings like SPI or MTD/NAND. This is a strong no-go.Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +4
-0+ + properties: + compatible: + items:No items, just use enum.
sure, will fix it.
Quoted 33 lines
Quoted 33 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +33
-0+ - enum: + - aspeed,ast2500-espi-ctrl + - aspeed,ast2600-espi-ctrl + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + required: + - compatible + - interrupts + - clocks + +required: + - compatible + - reg + - "#address-cells" + - "#size-cells" + - ranges + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/ast2600-clock.h> + + espi: espi at 1e6ee000 { + compatible = "aspeed,ast2600-espi", "simple-mfd", "syscon"; + reg = <0x1e6ee000 0x1000>; +
Quoted 8 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 89
Quoted 7 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +7
-0+ #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x1e6ee000 0x1000>; + + espi_ctrl: espi-ctrl at 0 { + compatible = "aspeed,ast2600-espi-ctrl"; + reg = <0x0 0x800>,<0x0 0x4000000>;Fix your style in DTS. There is always a space after ','.
sure , will fix that. Is there a link that could help me understand various styling requirements on the DTS files. Also is there any formatting tool available currently ? that could fix the styling in the DTS files automatically rather than manual inspection/modification. Did i accidentally missed running some tool check ?
Quoted 10 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 94
Quoted 6 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +5
-0+ reg-names = "espi_ctrl","espi_flash"; + interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&syscon ASPEED_CLK_GATE_ESPICLK>; + }; + };Best regards,
Krzysztof
Krzysztof,Thanks for the review comments. I am still figuring out few of the
review comments (would need a little more time, since its my first
attempt into kernel development) , but mean while I wanted to make sure
if the direction of choosing "soc" vs "spi" was correct, so that i could
re-work on the comments.So i have selectively answered to few of your
comments. Could you let me know if the reasoning that was provided in
reply to your comments help ? Thanks, Manoj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20240320/f2a0be08/attachment-0001.htm>
Re: [PATCH v2 4/4] dt-bindings: aspeed: Add eSPI controller
Quoted 24 lines · Manojkiran Eda
Quoted 22 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml
Quoted 19 lines · Manojkiran Eda
This commit adds the device tree bindings for aspeed eSPI controller.
Although aspeed eSPI hardware supports 4 different channels, this commit only adds the support for flash channel, the bindings for other channels could be upstreamed when the driver support for those are added.
Signed-off-by Manojkiran Eda<[email protected]>--- .../bindings/soc/aspeed/aspeed,espi.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+)create mode 100644
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yamlDocumentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +0
-0Why Rob's comments got ignored?
Quoted 3 lines
Quoted 1 line
This is not a soc component.
I did not mean to ignore, i have few reasons listed below that provides information on why i felt this belongs into soc.
soc is dumping ground of things which are purely SoC specific, not covered by existing hardware structure in bindings. Maybe indeed this does not have any other place, but did you actually look?
Anyway, please CC SPI maintainers on future submission.
Quoted 22 lines
Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +12
-0@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# # Copyright (c) 2024 IBM Corporation. +# # Copyright (c) 2021 Aspeed Technology Inc. +%YAML 1.2 +--- +$id:http://devicetree.org/schemas/soc/aspeed/aspeed,espi.yaml# +$schema:http://devicetree.org/meta-schemas/core.yaml# + +title: Aspeed eSPI Controller + +maintainers: + - Manojkiran Eda<[email protected]>Quoted 8 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 19
Quoted 7 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +7
-0+ - Patrick Rudolph<[email protected]> + - Chia-Wei Wang<[email protected]> + - Ryan Chen<[email protected]> + +description: + Aspeed eSPI controller implements a device side eSPI endpoint device + supporting the flash channel.Explain what is eSPI.
Quoted 1 line
eSPI is a serial bus interface for client and server platforms that is
Explain in description of the hardware.
Quoted 44 lines
based on SPI,? using the same master and slave topology but operates with a different protocol to meet new requirements. For instance, eSPI uses I/O, or input/output, communication, instead of MOSI/MISO used in SPI. It also includes a transaction layer on top of the SPI protocol, defining packets such as command and response packets that allow both the master and slave to initiate alert and reset signals. eSPI supports communication between Embedded Controller (EC), Baseboard Management Controller (BMC), Super-I/O (SIO) and Port-80 debug cards. I could add this to the commit message as well in the next patchset.
Quoted 35 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 27
Quoted 9 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +8
-0+ +properties: + compatible: + items: + - enum: + - aspeed,ast2500-espi + - aspeed,ast2600-espi + - const: simple-mfdThat's not simple-mfd. You have driver for this. Drop.
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 28
Quoted 1 line
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +1
-0+ - const: sysconThat's not syscon. Why do you have ranges then? Where is any explanation of hardware which would justify such combination?
Quoted 7 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +7
-0+ + reg: + maxItems: 1 + + "#address-cells": + const: 1 +Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 45
Quoted 10 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +10
-0+ "#size-cells": + const: 1 + + ranges: true + +patternProperties: + "^espi-ctrl@[0-9a-f]+$": + type: object + + description: Controls the flash channel of eSPI hardwareThat explains nothing. Unless you wanted to use here MTD bindings.
Quoted 5 lines
Quoted 2 lines
This binding did not improve much. I don't understand why this is not SPI (nothing in commit msg, nothing in description), what is eSPI,
eSPI uses Peripheral, Virtual Wire, Out of Band, and Flash Access channels to communicate different sets of data.
And what are these channels? What does it mean a "channel"? Is it just how you organize transfers and classes of devices? Or some sort of addressable instance on the bus?
The channels feel like some sort of software or logical concept, not physical. Physical would be endpoint with peripheral. Or flash memory. How do they fit here?
Quoted 16 lines
* The *Peripheral* Channel is used for communication between eSPI host bridge located on the master side and eSPI endpoints located on the slave side. LPC Host and LPC Peripherals are an example of eSPI host bridge and eSPI endpoints respectively.
* *Virtual Wire* Channel: The Virtual Wire channel is used to communicate the state of sideband pins or GPIO tunneled through eSPI as in-band messages. Serial IRQ interrupts are communicated through this channel as in-band messages.
* *OOB* Channel: The SMBus packets are tunneled through eSPI as Out-Of-Band (OOB) messages. The whole SMBus packet is embedded inside the eSPI OOB message as data.
* *Flash Access* Channel: The Flash Access channel provides a path allowing the flash components to be shared run-time between chipset and the eSPI slaves that require flash accesses such as EC (Embedded Controller) and BMC.
Please make binding complete, so define all of the channels.
Quoted 6 lines
Although , eSPI reuses the timing and electrical specification of Serial Peripheral Interface (SPI) but it runs an entirely different protocol to meet a set of different requirements. Which is why i felt probably placing this in soc was a better choice rather than spi. Do you think otherwise ?
soc is dumping ground for things do not fit other places. Are there any other buses / IP blocks similar to this one?
Best regards,
Krzysztof
Re: [PATCH v2 4/4] dt-bindings: aspeed: Add eSPI controller
Quoted 25 lines · Krzysztof Kozlowski
Quoted 24 lines · Manojkiran Eda
Quoted 22 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml
Quoted 19 lines · Manojkiran Eda
This commit adds the device tree bindings for aspeed eSPI controller.
Although aspeed eSPI hardware supports 4 different channels, this commit only adds the support for flash channel, the bindings for other channels could be upstreamed when the driver support for those are added.
Signed-off-by Manojkiran Eda<[email protected]>--- .../bindings/soc/aspeed/aspeed,espi.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+)create mode 100644
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yamlDocumentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +0
-0Why Rob's comments got ignored?
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
This is not a soc component.
I did not mean to ignore, i have few reasons listed below that provides information on why i felt this belongs into soc.
soc is dumping ground of things which are purely SoC specific, not covered by existing hardware structure in bindings. Maybe indeed this does not have any other place, but did you actually look?
Yes, i did look at existing hardware bindings, and cannot seem to find out any other suitable place. I can definitely look again.
Quoted 1 line
Anyway, please CC SPI maintainers on future submission.
Sure, will add them.
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 12 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +9
-0@@ -0,0 +1,94 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# # Copyright (c) 2024 IBM Corporation. +# # Copyright (c) 2021 Aspeed Technology Inc. +%YAML 1.2 +--- +$id:http://devicetree.org/schemas/soc/aspeed/aspeed,espi.yaml# +$schema:http://devicetree.org/meta-schemas/core.yaml# + +title: Aspeed eSPI ControllerDocumentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 19
Quoted 10 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +10
-0+ +maintainers: + - Manojkiran Eda<[email protected]> + - Patrick Rudolph<[email protected]> + - Chia-Wei Wang<[email protected]> + - Ryan Chen<[email protected]> + +description: + Aspeed eSPI controller implements a device side eSPI endpoint device + supporting the flash channel.Explain what is eSPI.
Quoted 3 lines
Quoted 1 line
eSPI is a serial bus interface for client and server platforms that is
Explain in description of the hardware.
Sure, i will add this description in the binding document in the future submission.
Quoted 48 lines
Quoted 48 lines
based on SPI, using the same master and slave topology but operates with a different protocol to meet new requirements. For instance, eSPI uses I/O, or input/output, communication, instead of MOSI/MISO used in SPI. It also includes a transaction layer on top of the SPI protocol, defining packets such as command and response packets that allow both the master and slave to initiate alert and reset signals. eSPI supports communication between Embedded Controller (EC), Baseboard Management Controller (BMC), Super-I/O (SIO) and Port-80 debug cards. I could add this to the commit message as well in the next patchset.
Quoted 37 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 27
Quoted 9 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +8
-0+ +properties: + compatible: + items: + - enum: + - aspeed,ast2500-espi + - aspeed,ast2600-espi + - const: simple-mfdThat's not simple-mfd. You have driver for this. Drop.
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 28
Quoted 1 line
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +1
-0+ - const: sysconThat's not syscon. Why do you have ranges then? Where is any explanation of hardware which would justify such combination?
Quoted 7 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +7
-0+ + reg: + maxItems: 1 + + "#address-cells": + const: 1 +Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml line 45
Quoted 10 lines
Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +10
-0+ "#size-cells": + const: 1 + + ranges: true + +patternProperties: + "^espi-ctrl@[0-9a-f]+$": + type: object + + description: Controls the flash channel of eSPI hardwareThat explains nothing. Unless you wanted to use here MTD bindings.
This binding did not improve much. I don't understand why this is not SPI (nothing in commit msg, nothing in description), what is eSPI,
Quoted 7 lines
Quoted 2 lines
eSPI uses Peripheral, Virtual Wire, Out of Band, and Flash Access channels to communicate different sets of data.
And what are these channels? What does it mean a "channel"? Is it just how you organize transfers and classes of devices? Or some sort of addressable instance on the bus?
Yes, an espi channel provides a means to allow multiple independent flows of traffic to share the same physical bus. Each of the channels has its own dedicated resources such as queue and flow control.
Quoted 2 lines
The channels feel like some sort of software or logical concept, not physical. Physical would be endpoint with peripheral. Or flash memory.
A channel is a logical communication pathway or interface between the chipset and peripheral devices. The concept of channels in the ESPI protocol helps organize and manage different types of communication between the chipset and peripherals. Each channel may have its own set of protocols, data transfer rates, and supported features, tailored to the requirements of the devices it serves.
Quoted 1 line
How do they fit here?
I am not sure I understand, can you please elaborate ?
Quoted 17 lines
Quoted 16 lines
* The *Peripheral* Channel is used for communication between eSPI host bridge located on the master side and eSPI endpoints located on the slave side. LPC Host and LPC Peripherals are an example of eSPI host bridge and eSPI endpoints respectively.
* *Virtual Wire* Channel: The Virtual Wire channel is used to communicate the state of sideband pins or GPIO tunneled through eSPI as in-band messages. Serial IRQ interrupts are communicated through this channel as in-band messages.
* *OOB* Channel: The SMBus packets are tunneled through eSPI as Out-Of-Band (OOB) messages. The whole SMBus packet is embedded inside the eSPI OOB message as data.
* *Flash Access* Channel: The Flash Access channel provides a path allowing the flash components to be shared run-time between chipset and the eSPI slaves that require flash accesses such as EC (Embedded Controller) and BMC.
Quoted 1 line
Please make binding complete, so define all of the channels.
I would like to inquire about the rationale behind this request. Based on previous feedback received from the upstream efforts [https://lore.kernel.org/openbmc/HK0PR06MB37798462D17443C697433D7191D09@HK0PR06MB3779.apcprd06.prod.outlook.com/], suggestions were made to model the flash channel by utilizing the mtd subsystem, the virtual wire channel by utilizing the GPIO subsystem, and to consider the OOB channel as a type of i2c device, thereby allowing it to be utilized by the existing in-kernel MCTP subsystem, among others. My intention was to prioritize upstreaming the flash channel binding, along with its driver code, before proceeding to address other channels. I am curious to understand if it is a strict requirement to have the complete binding upstreamed before addressing the device drivers code.
Quoted 8 lines
Quoted 7 lines
Although , eSPI reuses the timing and electrical specification of Serial Peripheral Interface (SPI) but it runs an entirely different protocol to meet a set of different requirements. Which is why i felt probably placing this in soc was a better choice rather than spi. Do you think otherwise ?
Quoted 7 lines
soc is dumping ground for things do not fit other places. Are there any other buses / IP blocks similar to this one?
Best regards,
Krzysztof
Thanks,
Manoj
Re: [PATCH v2 4/4] dt-bindings: aspeed: Add eSPI controller
Quoted 9 lines · Manojkiran Eda
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
+ description: Controls the flash channel of eSPI hardware
That explains nothing. Unless you wanted to use here MTD bindings.
This binding did not improve much. I don't understand why this is not SPI (nothing in commit msg, nothing in description), what is eSPI,
eSPI uses Peripheral, Virtual Wire, Out of Band, and Flash Access channels to communicate different sets of data.
Quoted 8 lines
Quoted 4 lines
And what are these channels? What does it mean a "channel"? Is it just how you organize transfers and classes of devices? Or some sort of addressable instance on the bus?
Yes, an espi channel provides a means to allow multiple independent flows of traffic to share the same physical bus. Each of the channels has its own dedicated resources such as queue and flow control.
Resources as queue and flow-control? Where are they defined in Devicetree? Which binding?
Quoted 11 lines
Quoted 3 lines
The channels feel like some sort of software or logical concept, not physical. Physical would be endpoint with peripheral. Or flash memory.
A channel is a logical communication pathway or interface between the chipset and peripheral devices. The concept of channels in the ESPI protocol helps organize and manage different types of communication between the chipset and peripherals. Each channel may have its own set of protocols, data transfer rates, and supported features, tailored to the requirements of the devices it serves.
Quoted 3 lines
Quoted 1 line
How do they fit here?
I am not sure I understand, can you please elaborate ?
All this suggests channel is programming aspect of your device thus does not have to be represented in DT. I don't know, come with any DT property to back up your case...
So far I see only interrupts and clocks, but then I would claim these could be part of parent node.
Rob said it last time: your split of nodes looks artificial and it all looks like one node.
Your DTS reg like:
reg = <0x0 0x800>,<0x0 0x4000000>;
proves it. I don't know if this is just bug in your code or some silly DTS just to create fake children. :/
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
* The *Peripheral* Channel is used for communication between eSPI host bridge located on the master side and eSPI endpoints located on the slave side. LPC Host and LPC Peripherals are an example of eSPI host bridge and eSPI endpoints respectively.
* *Virtual Wire* Channel: The Virtual Wire channel is used to communicate the state of sideband pins or GPIO tunneled through eSPI as in-band messages. Serial IRQ interrupts are communicated through this channel as in-band messages.
* *OOB* Channel: The SMBus packets are tunneled through eSPI as Out-Of-Band (OOB) messages. The whole SMBus packet is embedded inside the eSPI OOB message as data.
* *Flash Access* Channel: The Flash Access channel provides a path allowing the flash components to be shared run-time between chipset and the eSPI slaves that require flash accesses such as EC (Embedded Controller) and BMC.
Quoted 4 lines
Quoted 1 line
Please make binding complete, so define all of the channels.
I would like to inquire about the rationale behind this request. Based
Rationale - writing bindings document.
https://elixir.bootlin.com/linux/v6.9-rc1/source/Documentation/devicetree/bindings/writing-bindings.rst#L17
Quoted 8 lines
on previous feedback received from the upstream efforts
[https://lore.kernel.org/openbmc/HK0PR06MB37798462D17443C697433D7191D09 at HK0PR06MB3779.apcprd06.prod.outlook.com/], suggestions were made to model the flash channel by utilizing the mtd
subsystem, the virtual wire channel by utilizing the GPIO subsystem, and
to consider the OOB channel as a type of i2c device, thereby allowing it
to be utilized by the existing in-kernel MCTP subsystem, among others.
My intention was to prioritize upstreaming the flash channel binding,
along with its driver code, before proceeding to address other channels.
Just to clarify: I don't care about drivers and we do not talk about them here.
Quoted 2 lines
I am curious to understand if it is a strict requirement to have the complete binding upstreamed before addressing the device drivers code.
What if your other "devices" or "channels" are entirely different and binding would just not work? Or how can we understand the design if you upstream only part of it?
Best regards,
Krzysztof
Rob Herring
maintainerRe: [PATCH v2 4/4] dt-bindings: aspeed: Add eSPI controller
In reply to Manojkiran EdaQuoted 26 lines · Manojkiran Eda
On 19/03/24 3:26 pm, Krzysztof Kozlowski wrote:
On 19/03/2024 10:34, Manojkiran Eda wrote:
This commit adds the device tree bindings for aspeed eSPI controller.
Although aspeed eSPI hardware supports 4 different channels, this commit only adds the support for flash channel, the bindings for other channels could be upstreamed when the driver support for those are added.
Signed-off-by Manojkiran Eda [1]<[email protected]>--- .../bindings/soc/aspeed/aspeed,espi.yaml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml
Doc renamed from Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml +0
-0
umentation/devicetree/bindings/soc/aspeed/aspeed,espi.yamlnew file mode 100644
index 000000000000..3d3ad528e3b3Documentation/devicetree/bindings/soc/aspeed/aspeed,espi.yaml new file +0
-0
Quoted 6 lines
Why Rob's comments got ignored?
This is not a soc component.
I did not mean to ignore, i have few reasons listed below that provides information on why i felt this belongs into soc.
Fix you email program to not send multi-part (txt plus html) emails. Plain text only on maillists.
Rob