ufs: Add support for AMD Versal Gen2 UFS
Subsystems (6)
Ajay Neeli
maintainerv2 cover ufs: Add support for AMD Versal Gen2 UFS
This patch series adds support for the UFS driver on the AMD Versal Gen 2 SoC. It includes:
- Device tree bindings and driver implementation.
- Secure read support for the secure retrieval of UFS calibration values.
The UFS host driver is based upon the Synopsis DesignWare (DWC) UFS architecture, utilizing the existing UFSHCD_DWC and UFSHCD_PLATFORM drivers.
---
Changes in v1->v2:
- Address review comments from v1:
Rewritten commit message to clarify this as UFS driver for AMD Versal Gen 2 SoC. Removed patch that utilized reserved bits for vendor-specific interrupts. Moved the PHY reset logic to ufs-host-init to prevent unhandled interrupts.
v1 link: https://lore.kernel.org/linux-scsi/[email protected]/
---
Ajay Neeli (1):
firmware: xilinx: Add APIs for UFS PHY initialization
Izhar Ameer Shaikh (1):
firmware: xilinx: Add support for secure read/write ioctl interface
Sai Krishna Potthuri (2):
dt-bindings: ufs: amd-versal2: Add UFS Host Controller for AMD Versal
Gen 2 SoC
ufs: amd-versal2: Add UFS support for AMD Versal Gen 2 SoC
.../devicetree/bindings/ufs/amd,versal2-ufs.yaml | 61 +++ MAINTAINERS | 7 + drivers/firmware/xilinx/Makefile | 2 +- drivers/firmware/xilinx/zynqmp-ufs.c | 118 +++++ drivers/firmware/xilinx/zynqmp.c | 46 ++ drivers/ufs/host/Kconfig | 13 + drivers/ufs/host/Makefile | 1 + drivers/ufs/host/ufs-amd-versal2.c | 564 +++++++++++++++++++++ drivers/ufs/host/ufshcd-dwc.h | 46 ++ include/linux/firmware/xlnx-zynqmp-ufs.h | 38 ++ include/linux/firmware/xlnx-zynqmp.h | 16 + include/ufs/unipro.h | 1 + 12 files changed, 912 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml create mode 100644 drivers/firmware/xilinx/zynqmp-ufs.c create mode 100644 drivers/ufs/host/ufs-amd-versal2.c create mode 100644 include/linux/firmware/xlnx-zynqmp-ufs.h
Signature · 1 line
1.8.3.1
Ajay Neeli
maintainerPATCH v2 1/4 dt-bindings: ufs: amd-versal2: Add UFS Host Controller for AMD Versal Gen 2 SoC
From: Sai Krishna Potthuri <[email protected]>
Add devicetree document for UFS Host Controller on AMD Versal Gen 2 SoC. This includes clocks and clock-names as mandated by UFS common bindings.
---
Changes in v1->v2:
Rewritten commit message to clarify this as UFS driver for AMD Versal Gen 2 SoC
--- .../devicetree/bindings/ufs/amd,versal2-ufs.yaml | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml
Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml new file +61 -0
@@ -0,0 +1,61 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/ufs/amd,versal2-ufs.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Versal Gen 2 UFS Host Controller + +maintainers: + - Sai Krishna Potthuri <[email protected]> + +allOf: + - $ref: ufs-common.yaml + +properties: + compatible: + const: amd,versal2-ufs + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: core + + power-domains: + maxItems: 1 + + resets: + maxItems: 2 + + reset-names: + items: + - const: host + - const: phy + +required: + - reg + - clocks + - clock-names + - resets + - reset-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + ufs@f10b0000 { + compatible = "amd,versal2-ufs"; + reg = <0xf10b0000 0x1000>; + clocks = <&ufs_core_clk>; + clock-names = "core"; + resets = <&scmi_reset 4>, <&scmi_reset 35>; + reset-names = "host", "phy"; + interrupts = <GIC_SPI 234 IRQ_TYPE_LEVEL_HIGH>; + freq-table-hz = <0 0>; + };
Signature · 1 line
1.8.3.1
Re: [PATCH v2 1/4] dt-bindings: ufs: amd-versal2: Add UFS Host Controller for AMD Versal Gen 2 SoC
Quoted 8 lines · Ajay Neeli
From: Sai Krishna Potthuri <[email protected]>
Add devicetree document for UFS Host Controller on AMD Versal Gen 2 SoC. This includes clocks and clock-names as mandated by UFS common bindings.
Signed-off-by Sai Krishna Potthuri <[email protected]>Co-developed-by Ajay Neeli <[email protected]>Signed-off-by Ajay Neeli <[email protected]>
pw-bot: not-applicable
Ajay Neeli
maintainerPATCH v2 2/4 firmware: xilinx: Add support for secure read/write ioctl interface
In reply to Ajay NeeliFrom: Izhar Ameer Shaikh <[email protected]>
Add support for a generic ioctl read/write interface using which users can request firmware to perform read/write operations on a protected and secure address space.
The functionality is introduced through the means of two new IOCTL IDs which extend the existing PM_IOCTL EEMI API:
- IOCTL_READ_REG
- IOCTL_MASK_WRITE_REG
The caller only passes the node id of the given device and an offset. The base address is not exposed to the caller and internally retrieved by the firmware. Firmware will enforce an access policy on the incoming read/write request.
---
Changes in v1->v2: None
--- drivers/firmware/xilinx/zynqmp.c | 46 ++++++++++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 15 ++++++++++++ 2 files changed, 61 insertions(+)
drivers/firmware/xilinx/zynqmp.c +46 -0
@@ -1617,6 +1617,52 @@ int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, }/** +* zynqmp_pm_sec_read_reg - PM call to securely read from given offset +* of the node +* @node_id: Node Id of the device +* @offset: Offset to be used (20-bit) +* @ret_value: Output data read from the given offset after +* firmware access policy is successfully enforced +* +* Return: Returns 0 on success or error value on failure +*/ +int zynqmp_pm_sec_read_reg (u32 node_id,u32 offset,u32 *ret_value) +{ +u32 ret_payload[PAYLOAD_ARG_CNT ]; +u32 count =1 ; +int ret; + +if (!ret_value) +return -EINVAL ; + + ret =zynqmp_pm_invoke_fn (PM_IOCTL , ret_payload,4 , node_id,IOCTL_READ_REG , + offset, count); + + *ret_value = ret_payload[1 ]; + +return ret; +} +EXPORT_SYMBOL_GPL (zynqmp_pm_sec_read_reg); + +/** +* zynqmp_pm_sec_mask_write_reg - PM call to securely write to given offset +* of the node +* @node_id: Node Id of the device +* @offset: Offset to be used (20-bit) +* @mask: Mask to be used +* @value: Value to be written +* +* Return: Returns 0 on success or error value on failure +*/ +int zynqmp_pm_sec_mask_write_reg (const u32 node_id,const u32 offset,u32 mask, +u32 value) +{ +return zynqmp_pm_invoke_fn (PM_IOCTL ,NULL ,5 , node_id,IOCTL_MASK_WRITE_REG , + offset, mask, value); +} +EXPORT_SYMBOL_GPL (zynqmp_pm_sec_mask_write_reg); + +/** * zynqmp_pm_set_sd_config - PM call to set value of SD config registers * @node: SD node ID * @config: The config type of SD registers
include/linux/firmware/xlnx-zynqmp.h +15 -0
@@ -241,6 +241,7 @@ enum pm_ioctl_id {IOCTL_GET_FEATURE_CONFIG =27 ,/* IOCTL for Secure Read/Write Interface */ IOCTL_READ_REG =28 , +IOCTL_MASK_WRITE_REG =29 ,/* Dynamic SD/GEM configuration */ IOCTL_SET_SD_CONFIG =30 , IOCTL_SET_GEM_CONFIG = 31,
@@ -620,6 +621,9 @@ int zynqmp_pm_register_notifier(const u32 node, const u32 event,int zynqmp_pm_is_function_supported (const u32 api_id,const u32 id);int zynqmp_pm_set_feature_config (enum pm_feature_config_id id,u32 value);int zynqmp_pm_get_feature_config (enum pm_feature_config_id id,u32 *payload); +int zynqmp_pm_sec_read_reg (u32 node_id,u32 offset,u32 *ret_value); +int zynqmp_pm_sec_mask_write_reg (const u32 node_id,const u32 offset, +u32 mask,u32 value);int zynqmp_pm_register_sgi (u32 sgi_num,u32 reset);int zynqmp_pm_force_pwrdwn (const u32 target,const enum zynqmp_pm_request_ack ack);
@@ -922,6 +926,17 @@ static inline int zynqmp_pm_request_wake(const u32 node,return -ENODEV ; } +static inline int zynqmp_pm_sec_read_reg (u32 node_id,u32 offset,u32 *ret_value) +{ +return -ENODEV ; +} + +static inline int zynqmp_pm_sec_mask_write_reg (const u32 node_id,const u32 offset, +u32 mask,u32 value) +{ +return -ENODEV ; +} +static inline int zynqmp_pm_get_rpu_mode (u32 node_id,enum rpu_oper_mode *rpu_mode) {return -ENODEV ;
Signature · 1 line
1.8.3.1
Re: [PATCH v2 2/4] firmware: xilinx: Add support for secure read/write ioctl interface
Quoted 115 lines · Ajay Neeli
From: Izhar Ameer Shaikh <[email protected]>
Add support for a generic ioctl read/write interface using which users can request firmware to perform read/write operations on a protected and secure address space.
The functionality is introduced through the means of two new IOCTL IDs which extend the existing
PM_IOCTLEEMI API:
-IOCTL_READ_REG
-IOCTL_MASK_WRITE_REGThe caller only passes the node id of the given device and an offset. The base address is not exposed to the caller and internally retrieved by the firmware. Firmware will enforce an access policy on the incoming read/write request.
Signed-off-by Izhar Ameer Shaikh <[email protected]>Reviewed-by Tanmay Shah <[email protected]>Signed-off-by Radhey Shyam Pandey <[email protected]>Signed-off-by Ajay Neeli <[email protected]>---
Changes inv1->v2: None--- drivers/firmware/xilinx/zynqmp.c | 46 ++++++++++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 15 ++++++++++++ 2 files changed, 61 insertions(+)drivers/firmware/xilinx/zynqmp.c +46
-0@@ -1617,6 +1617,52 @@ int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, }/** +* zynqmp_pm_sec_read_reg - PM call to securely read from given offset +* of the node +* @node_id: Node Id of the device +* @offset: Offset to be used (20-bit) +* @ret_value: Output data read from the given offset after +* firmware access policy is successfully enforced +* +* Return: Returns 0 on success or error value on failure +*/ +int zynqmp_pm_sec_read_reg (u32 node_id,u32 offset,u32 *ret_value) +{ +u32 ret_payload[PAYLOAD_ARG_CNT ]; +u32 count =1 ; +int ret; + +if (!ret_value) +return -EINVAL ; + + ret =zynqmp_pm_invoke_fn (PM_IOCTL , ret_payload,4 , node_id,IOCTL_READ_REG , + offset, count); + + *ret_value = ret_payload[1 ]; + +return ret; +} +EXPORT_SYMBOL_GPL (zynqmp_pm_sec_read_reg); + +/** +* zynqmp_pm_sec_mask_write_reg - PM call to securely write to given offset +* of the node +* @node_id: Node Id of the device +* @offset: Offset to be used (20-bit) +* @mask: Mask to be used +* @value: Value to be written +* +* Return: Returns 0 on success or error value on failure +*/ +int zynqmp_pm_sec_mask_write_reg (const u32 node_id,const u32 offset,u32 mask, +u32 value) +{ +return zynqmp_pm_invoke_fn (PM_IOCTL ,NULL ,5 , node_id,IOCTL_MASK_WRITE_REG , + offset, mask, value); +} +EXPORT_SYMBOL_GPL (zynqmp_pm_sec_mask_write_reg); + +/** * zynqmp_pm_set_sd_config - PM call to set value of SD config registers * @node: SD node ID * @config: The config type of SD registers include/linux/firmware/xlnx-zynqmp.h +8
-0@@ -241,6 +241,7 @@ enum pm_ioctl_id {IOCTL_GET_FEATURE_CONFIG =27 ,/* IOCTL for Secure Read/Write Interface */ IOCTL_READ_REG =28 , +IOCTL_MASK_WRITE_REG =29 ,/* Dynamic SD/GEM configuration */ IOCTL_SET_SD_CONFIG =30 , IOCTL_SET_GEM_CONFIG = 31,@@ -620,6 +621,9 @@ int zynqmp_pm_register_notifier(const u32 node, const u32 event,int zynqmp_pm_is_function_supported (const u32 api_id,const u32 id);int zynqmp_pm_set_feature_config (enum pm_feature_config_id id,u32 value);int zynqmp_pm_get_feature_config (enum pm_feature_config_id id,u32 *payload); +int zynqmp_pm_sec_read_reg (u32 node_id,u32 offset,u32 *ret_value); +int zynqmp_pm_sec_mask_write_reg (const u32 node_id,const u32 offset, +u32 mask,u32 value);int zynqmp_pm_register_sgi (u32 sgi_num,u32 reset);int zynqmp_pm_force_pwrdwn (const u32 target,const enum zynqmp_pm_request_ack ack);@@ -922,6 +926,17 @@ static inline int zynqmp_pm_request_wake(const u32 node,return -ENODEV ; } +static inline int zynqmp_pm_sec_read_reg (u32 node_id,u32 offset,u32 *ret_value) +{ +return -ENODEV ; +}
include/linux/firmware/xlnx-zynqmp.h static inline int zynqmp_pm_request_wake(const u32 node, · line 942
Quoted 10 lines
include/linux/firmware/xlnx-zynqmp.h +7
-0+ +static inline int zynqmp_pm_sec_mask_write_reg (const u32 node_id,const u32 offset, +u32 mask,u32 value) +{ +return -ENODEV ; +} +static inline int zynqmp_pm_get_rpu_mode (u32 node_id,enum rpu_oper_mode *rpu_mode) {return -ENODEV ;
Feel free to take this via UFS tree.
Thanks,
Michal
Ajay Neeli
maintainerPATCH v2 3/4 firmware: xilinx: Add APIs for UFS PHY initialization
In reply to Ajay Neeli- Add APIs for UFS PHY initialization.
- Verify M-PHY TX-RX configuration readiness.
- Confirm SRAM initialization and Set SRAM bypass.
- Retrieve UFS calibration values.
---
Changes in v1->v2: None
--- drivers/firmware/xilinx/Makefile | 2 +- drivers/firmware/xilinx/zynqmp-ufs.c | 118 +++++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp-ufs.h | 38 ++++++++++ include/linux/firmware/xlnx-zynqmp.h | 1 + 4 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 drivers/firmware/xilinx/zynqmp-ufs.c create mode 100644 include/linux/firmware/xlnx-zynqmp-ufs.h
drivers/firmware/xilinx/Makefile +1 -1
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for Xilinx firmwares -obj-$(CONFIG_ZYNQMP_FIRMWARE) += zynqmp.o +obj-$(CONFIG_ZYNQMP_FIRMWARE) += zynqmp.o zynqmp-ufs.o obj-$(CONFIG_ZYNQMP_FIRMWARE_DEBUG) += zynqmp-debug.o
drivers/firmware/xilinx/zynqmp-ufs.c new file +118 -0
118 lines not on this page · raw message
include/linux/firmware/xlnx-zynqmp-ufs.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Firmware layer for UFS APIs. +* +* Copyright (c) 2025 Advanced Micro Devices, Inc. +*/ + +#ifndef __FIRMWARE_XLNX_ZYNQMP_UFS_H__ +#define __FIRMWARE_XLNX_ZYNQMP_UFS_H__ + +#if IS_REACHABLE (CONFIG_ZYNQMP_FIRMWARE ) +int zynqmp_pm_is_mphy_tx_rx_config_ready (bool *is_ready); +int zynqmp_pm_is_sram_init_done (bool *is_done); +int zynqmp_pm_set_sram_bypass (void ); +int zynqmp_pm_get_ufs_calibration_values (u32 *val); +#else +static inline int zynqmp_pm_is_mphy_tx_rx_config_ready (bool *is_ready) +{ +return -ENODEV ; +} + +static inline int zynqmp_pm_is_sram_init_done (bool *is_done) +{ +return -ENODEV ; +} + +static inline int zynqmp_pm_set_sram_bypass (void ) +{ +return -ENODEV ; +} + +static inline int zynqmp_pm_get_ufs_calibration_values (u32 *val) +{ +return -ENODEV ; +} +#endif + +#endif /* __FIRMWARE_XLNX_ZYNQMP_UFS_H__ */
include/linux/firmware/xlnx-zynqmp.h +1 -0
@@ -16,6 +16,7 @@#include <linux/types.h> #include <linux/err.h> +#include <linux/firmware/xlnx-zynqmp-ufs.h> #define ZYNQMP_PM_VERSION_MAJOR 1#define ZYNQMP_PM_VERSION_MINOR 0
Signature · 1 line
1.8.3.1
Re: [PATCH v2 3/4] firmware: xilinx: Add APIs for UFS PHY initialization
Quoted 202 lines · Ajay Neeli
- Add APIs for UFS PHY initialization.
- Verify M-PHY TX-RX configuration readiness.
- Confirm SRAM initialization and Set SRAM bypass.
- Retrieve UFS calibration values.Signed-off-by Ajay Neeli <[email protected]>---
Changes inv1->v2: None--- drivers/firmware/xilinx/Makefile | 2 +- drivers/firmware/xilinx/zynqmp-ufs.c | 118 +++++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp-ufs.h | 38 ++++++++++ include/linux/firmware/xlnx-zynqmp.h | 1 + 4 files changed, 158 insertions(+), 1 deletion(-)create mode 100644
drivers/firmware/xilinx/zynqmp-ufs.ccreate mode 100644include/linux/firmware/xlnx-zynqmp-ufs.hdrivers/firmware/xilinx/Makefile +1
-1@@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for Xilinx firmwares -obj-$(CONFIG_ZYNQMP_FIRMWARE) += zynqmp.o +obj-$(CONFIG_ZYNQMP_FIRMWARE) += zynqmp.o zynqmp-ufs.o obj-$(CONFIG_ZYNQMP_FIRMWARE_DEBUG) += zynqmp-debug.odrivers/firmware/xilinx/zynqmp-ufs.c new file +118
-0@@ -0,0 +1,118 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Firmware Layer for UFS APIs +* +* Copyright (C) 2025 Advanced Micro Devices, Inc. +*/ + +#include <linux/firmware/xlnx-zynqmp.h> +#include <linux/module.h> + +/* Register Node IDs */ +#define PM_REGNODE_PMC_IOU_SLCR 0x30000002/* PMC IOU SLCR */ +#define PM_REGNODE_EFUSE_CACHE 0x30000003/* EFUSE Cache */ + +/* Register Offsets for PMC IOU SLCR */ +#define SRAM_CSR_OFFSET 0x104C/* SRAM Control and Status */ +#define TXRX_CFGRDY_OFFSET 0x1054/* M-PHY TX-RX Config ready */ + +/* Masks for SRAM Control and Status Register */ +#define SRAM_CSR_INIT_DONE_MASK BIT(0)/* SRAM initialization done */ +#define SRAM_CSR_EXT_LD_DONE_MASK BIT(1)/* SRAM External load done */ +#define SRAM_CSR_BYPASS_MASK BIT(2)/* Bypass SRAM interface */ + +/* Mask to check M-PHY TX-RX configuration readiness */ +#define TX_RX_CFG_RDY_MASK GENMASK(3, 0) + +/* Register Offsets for EFUSE Cache */ +#define UFS_CAL_1_OFFSET 0xBE8/* UFS Calibration Value */ + +/** +* zynqmp_pm_is_mphy_tx_rx_config_ready - check M-PHY TX-RX config readiness +* @is_ready: Store output status (true/false) +* +* Return: Returns 0 on success or error value on failure. +*/ +int zynqmp_pm_is_mphy_tx_rx_config_ready (bool *is_ready) +{ +u32 regval; +int ret; + +if (!is_ready) +return -EINVAL ; + + ret =zynqmp_pm_sec_read_reg (PM_REGNODE_PMC_IOU_SLCR ,TXRX_CFGRDY_OFFSET , ®val); +if (ret) +return ret; + + regval &=TX_RX_CFG_RDY_MASK ; +if (regval) + *is_ready = true; +else + *is_ready = false; + +return ret; +} +EXPORT_SYMBOL_GPL (zynqmp_pm_is_mphy_tx_rx_config_ready); + +/** +* zynqmp_pm_is_sram_init_done - check SRAM initialization +* @is_done: Store output status (true/false) +* +* Return: Returns 0 on success or error value on failure. +*/ +int zynqmp_pm_is_sram_init_done (bool *is_done) +{ +u32 regval; +int ret; + +if (!is_done) +return -EINVAL ; + + ret =zynqmp_pm_sec_read_reg (PM_REGNODE_PMC_IOU_SLCR ,SRAM_CSR_OFFSET , ®val); +if (ret) +return ret; + + regval &=SRAM_CSR_INIT_DONE_MASK ; +if (regval) + *is_done = true; +else + *is_done = false; + +return ret; +} +EXPORT_SYMBOL_GPL (zynqmp_pm_is_sram_init_done); + +/** +* zynqmp_pm_set_sram_bypass - Set SRAM bypass Control +* +* Return: Returns 0 on success or error value on failure. +*/ +int zynqmp_pm_set_sram_bypass (void ) +{ +u32 sram_csr; +int ret; + + ret =zynqmp_pm_sec_read_reg (PM_REGNODE_PMC_IOU_SLCR ,SRAM_CSR_OFFSET , &sram_csr); +if (ret) +return ret; + + sram_csr &= ~SRAM_CSR_EXT_LD_DONE_MASK ; + sram_csr |=SRAM_CSR_BYPASS_MASK ; + +return zynqmp_pm_sec_mask_write_reg (PM_REGNODE_PMC_IOU_SLCR ,SRAM_CSR_OFFSET , +GENMASK (2 ,1 ), sram_csr); +} +EXPORT_SYMBOL_GPL (zynqmp_pm_set_sram_bypass); + +/** +* zynqmp_pm_get_ufs_calibration_values - Read UFS calibration values +* @val: Store the calibration value +* +* Return: Returns 0 on success or error value on failure. +*/ +int zynqmp_pm_get_ufs_calibration_values (u32 *val) +{ +return zynqmp_pm_sec_read_reg (PM_REGNODE_EFUSE_CACHE ,UFS_CAL_1_OFFSET , val); +} +EXPORT_SYMBOL_GPL (zynqmp_pm_get_ufs_calibration_values);include/linux/firmware/xlnx-zynqmp-ufs.h new file +38
-0@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Firmware layer for UFS APIs. +* +* Copyright (c) 2025 Advanced Micro Devices, Inc. +*/ + +#ifndef __FIRMWARE_XLNX_ZYNQMP_UFS_H__ +#define __FIRMWARE_XLNX_ZYNQMP_UFS_H__ + +#if IS_REACHABLE (CONFIG_ZYNQMP_FIRMWARE ) +int zynqmp_pm_is_mphy_tx_rx_config_ready (bool *is_ready); +int zynqmp_pm_is_sram_init_done (bool *is_done); +int zynqmp_pm_set_sram_bypass (void ); +int zynqmp_pm_get_ufs_calibration_values (u32 *val); +#else +static inline int zynqmp_pm_is_mphy_tx_rx_config_ready (bool *is_ready) +{ +return -ENODEV ; +} + +static inline int zynqmp_pm_is_sram_init_done (bool *is_done) +{ +return -ENODEV ; +} + +static inline int zynqmp_pm_set_sram_bypass (void ) +{ +return -ENODEV ; +} + +static inline int zynqmp_pm_get_ufs_calibration_values (u32 *val) +{ +return -ENODEV ; +} +#endif + +#endif /* __FIRMWARE_XLNX_ZYNQMP_UFS_H__ */ include/linux/firmware/xlnx-zynqmp.h +0
-0
include/linux/firmware/xlnx-zynqmp.h line 22
Quoted 7 lines
include/linux/firmware/xlnx-zynqmp.h +1
-0@@ -16,6 +16,7 @@#include <linux/types.h> #include <linux/err.h> +#include <linux/firmware/xlnx-zynqmp-ufs.h> #define ZYNQMP_PM_VERSION_MAJOR 1#define ZYNQMP_PM_VERSION_MINOR 0
Thanks,
Michal
Ajay Neeli
maintainerPATCH v2 4/4 ufs: amd-versal2: Add UFS support for AMD Versal Gen 2 SoC
In reply to Ajay NeeliFrom: Sai Krishna Potthuri <[email protected]>
Add support for the UFS host controller on the AMD Versal Gen 2 SoC, built on the Synopsys DWC UFS architecture, using the UFSHCD DWC and UFSHCD platform driver. This controller requires specific configurations like M-PHY/RMMI/UniPro and vendor specific registers programming before doing the UIC_LINKSTARTUP.
---
Changes in v1->v2:
Moved the PHY reset logic to ufs-host-init to prevent unhandled interrupts. Remove vendor-specific ISR handling, as it is no longer needed.
--- MAINTAINERS | 7 + drivers/ufs/host/Kconfig | 13 + drivers/ufs/host/Makefile | 1 + drivers/ufs/host/ufs-amd-versal2.c | 564 +++++++++++++++++++++++++++++++++++++ drivers/ufs/host/ufshcd-dwc.h | 46 +++ include/ufs/unipro.h | 1 + 6 files changed, 632 insertions(+) create mode 100644 drivers/ufs/host/ufs-amd-versal2.c
MAINTAINERS +7 -0
@@ -25453,6 +25453,13 @@ F: Documentation/devicetree/bindings/ufs/ F: Documentation/scsi/ufs.rst F: drivers/ufs/core/ +UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER AMD VERSAL2 +M: Sai Krishna Potthuri <[email protected]> +M: Ajay Neeli <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml +F: drivers/ufs/host/ufs-amd-versal2.c + UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER DWC HOOKS M: Pedro Sousa <[email protected]> L: [email protected]
drivers/ufs/host/Kconfig +13 -0
@@ -154,3 +154,16 @@ config SCSI_UFS_ROCKCHIP Select this if you have UFS controller on Rockchip chipset. If unsure, say N. + +config SCSI_UFS_AMD_VERSAL2 + tristate "AMD Versal Gen 2 UFS controller platform driver" + depends on SCSI_UFSHCD_PLATFORM && (ARCH_ZYNQMP || COMPILE_TEST) + help + This selects the AMD Versal Gen 2 specific additions on top of + the UFSHCD DWC and UFSHCD platform driver. UFS host on AMD + Versal Gen 2 needs some vendor specific configurations like PHY + and vendor specific register accesses before accessing the + hardware. + + Select this if you have UFS controller on AMD Versal Gen 2 SoC. + If unsure, say N.
drivers/ufs/host/Makefile +1 -0
@@ -13,3 +13,4 @@ obj-$(CONFIG_SCSI_UFS_RENESAS) += ufs-renesas.o obj-$(CONFIG_SCSI_UFS_ROCKCHIP) += ufs-rockchip.o obj-$(CONFIG_SCSI_UFS_SPRD) += ufs-sprd.o obj-$(CONFIG_SCSI_UFS_TI_J721E) += ti-j721e-ufs.o +obj-$(CONFIG_SCSI_UFS_AMD_VERSAL2) += ufs-amd-versal2.o ufshcd-dwc.o
drivers/ufs/host/ufs-amd-versal2.c new file +564 -0
564 lines not on this page · raw message
drivers/ufs/host/ufshcd-dwc.h +46 -0
52 lines not on this page · raw message
include/ufs/unipro.h +1 -0
@@ -174,6 +174,7 @@#define VS_POWERSTATE 0xD083#define VS_MPHYCFGUPDT 0xD085#define VS_DEBUGOMC 0xD09E +#define VS_MPHYDISABLE 0xD0C1#define PA_GRANULARITY_MIN_VAL 1#define PA_GRANULARITY_MAX_VAL 6
Signature · 1 line
1.8.3.1
Bart Van Assche
reviewerQuoted 1 line · Ajay Neeli
Removed patch that utilized reserved bits for vendor-specific interrupts.
Thanks! This second version of this patch series looks good to me.
Bart.
Martin K. Petersen
AppliedAjay,
Quoted 7 lines
This patch series adds support for the UFS driver on the AMD Versal Gen 2 SoC. It includes:
- Device tree bindings and driver implementation.
- Secure read support for the secure retrieval of UFS calibration values.The UFS host driver is based upon the Synopsis DesignWare (DWC) UFS architecture, utilizing the existing
UFSHCD_DWCandUFSHCD_PLATFORMdrivers.
Applied to 6.19/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 9 lines · Ajay Neeli
This patch series adds support for the UFS driver on the AMD Versal Gen 2 SoC. It includes:
- Device tree bindings and driver implementation.
- Secure read support for the secure retrieval of UFS calibration values.The UFS host driver is based upon the Synopsis DesignWare (DWC) UFS architecture, utilizing the existing
UFSHCD_DWCandUFSHCD_PLATFORMdrivers.[...]
Applied to 6.19/scsi-queue, thanks!
[1/4] dt-bindings: ufs: amd-versal2: Add UFS Host Controller for AMD Versal Gen 2 SoC
https://git.kernel.org/mkp/scsi/c/754c6f539eff [2/4] firmware: xilinx: Add support for secure read/write ioctl interface https://git.kernel.org/mkp/scsi/c/00b3e8480be7 [3/4] firmware: xilinx: Add APIs for UFS PHY initialization https://git.kernel.org/mkp/scsi/c/0e4d26f79a74 [4/4] ufs: amd-versal2: Add UFS support for AMD Versal Gen 2 SoC https://git.kernel.org/mkp/scsi/c/769b8b2ffded
Signature · 1 line
Martin K. Petersen