Add AM57xx Support to PRUSS driver
PATCH 1/1 soc: ti: PRUSS OCP configuration
In reply to Basharath Hussain KhajaFrom: Roger Quadros <[email protected]>
Updates OCP master port configuration to enable memory access outside of the PRU-ICSS subsystem.
This set of changes configures PRUSS_SYSCFG.STANDBY_INIT bit either to enable or disable the OCP master ports (applicable only on SoCs using OCP interconnect like the OMAP family).
--- drivers/soc/ti/pruss.c | 77 +++++++++++++++++++++++++++++++++++- include/linux/pruss_driver.h | 6 +++ 2 files changed, 82 insertions(+), 1 deletion(-)
drivers/soc/ti/pruss.c +76 -1
@@ -25,14 +25,19 @@#include <linux/slab.h> #include "pruss.h" +#define SYSCFG_STANDBY_INIT BIT(4) +#define SYSCFG_SUB_MWAIT_READY BIT(5) +/** * struct pruss_private_data - PRUSS driver private data * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock +* @has_ocp_syscfg: flag to indicate if OCP SYSCFG is present */ struct pruss_private_data {bool has_no_sharedram;bool has_core_mux_clock; +bool has_ocp_syscfg; };/**
@@ -286,6 +291,72 @@ int pruss_cfg_xfr_enable(struct pruss *pruss, enum pru_type pru_type, }EXPORT_SYMBOL_GPL (pruss_cfg_xfr_enable); +/** +* pruss_cfg_ocp_master_ports() - configure PRUSS OCP master ports +* @pruss: the pruss instance handle +* @enable: set to true for enabling or false for disabling the OCP master ports +* +* This function programs the PRUSS_SYSCFG.STANDBY_INIT bit either to enable or +* disable the OCP master ports (applicable only on SoCs using OCP interconnect +* like the OMAP family). Clearing the bit achieves dual functionalities - one +* is to deassert the MStandby signal to the device PRCM, and the other is to +* enable OCP master ports to allow accesses outside of the PRU-ICSS. The +* function has to wait for the PRCM to acknowledge through the monitoring of +* the PRUSS_SYSCFG.SUB_MWAIT bit when enabling master ports. Setting the bit +* disables the master access, and also signals the PRCM that the PRUSS is ready +* for Standby. +* +* Return: 0 on success, or an error code otherwise. ETIMEDOUT is returned +* when the ready-state fails. +*/ +int pruss_cfg_ocp_master_ports (struct pruss *pruss,bool enable) +{ +const struct pruss_private_data *data; +u32 syscfg_val, i; +int ret; + +if (IS_ERR_OR_NULL (pruss)) +return -EINVAL ; + + data =of_device_get_match_data (pruss->dev); + +/* nothing to do on non OMAP-SoCs */ +if (!data || !data->has_ocp_syscfg) +return 0 ; + +/* assert the MStandby signal during disable path */ +if (!enable) +return pruss_cfg_update (pruss,PRUSS_CFG_SYSCFG , +SYSCFG_STANDBY_INIT , +SYSCFG_STANDBY_INIT ); + +/* enable the OCP master ports and disable MStandby */ + ret =pruss_cfg_update (pruss,PRUSS_CFG_SYSCFG ,SYSCFG_STANDBY_INIT ,0 ); +if (ret) +return ret; + +/* wait till we are ready for transactions - delay is arbitrary */ +for (i =0 ; i <10 ; i++) { + ret =pruss_cfg_read (pruss,PRUSS_CFG_SYSCFG , &syscfg_val); +if (ret) + goto disable; + +if (!(syscfg_val &SYSCFG_SUB_MWAIT_READY )) +return 0 ; + +udelay (5 ); + } + +dev_err (pruss->dev,"timeout waiting for SUB_MWAIT_READY\n" ); + ret = -ETIMEDOUT ; + +disable: +pruss_cfg_update (pruss,PRUSS_CFG_SYSCFG ,SYSCFG_STANDBY_INIT , +SYSCFG_STANDBY_INIT ); +return ret; +} +EXPORT_SYMBOL_GPL (pruss_cfg_ocp_master_ports); +static void pruss_of_free_clk_provider (void *data) {struct device_node *clk_mux_np = data;
@@ -570,6 +641,10 @@ static const struct pruss_private_data am437x_pruss0_data = { .has_no_sharedram = true, }; +static const struct pruss_private_data am57xx_data = { + .has_ocp_syscfg = true, +}; +static const struct pruss_private_data am65x_j721e_pruss_data = { .has_core_mux_clock = true, };
@@ -578,7 +653,7 @@ static const struct of_device_id pruss_of_match[] = { { .compatible = "ti,am3356-pruss" }, { .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, }, { .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, }, - { .compatible = "ti,am5728-pruss" }, + { .compatible = "ti,am5728-pruss", .data = &am57xx_data, }, { .compatible = "ti,k2g-pruss" }, { .compatible = "ti,am654-icssg", .data = &am65x_j721e_pruss_data, }, { .compatible = "ti,j721e-icssg", .data = &am65x_j721e_pruss_data, },
include/linux/pruss_driver.h +6 -0
@@ -118,6 +118,7 @@ int pruss_cfg_gpimode(struct pruss *pruss, enum pruss_pru_id pru_id,int pruss_cfg_miirt_enable (struct pruss *pruss,bool enable);int pruss_cfg_xfr_enable (struct pruss *pruss,enum pru_type pru_type,bool enable); +int pruss_cfg_ocp_master_ports (struct pruss *pruss,bool enable);#else
@@ -172,6 +173,11 @@ static inline int pruss_cfg_xfr_enable(struct pruss *pruss,return ERR_PTR (-EOPNOTSUPP ); } +static int pruss_cfg_ocp_master_ports (struct pruss *pruss,bool enable) +{ +return -EOPNOTSUPP ; +} +#endif /* CONFIG_TI_PRUSS */ #endif /* _PRUSS_DRIVER_H_ */
Signature · 1 line
2.34.1
cover Add AM57xx Support to PRUSS driver
Hi,
This patch adds support for AM57xx SOC compatibility in the PRUSS driver which is a prerequisite for ICSSM Ethernet driver.
I will submit the patch series of ICSSM Ethernet driver for AM57xx subsequently in a separate thread after the merge of this patch.
Thanks & Best Regards,
Basharath
Roger Quadros (1):
soc: ti: PRUSS OCP configuration
drivers/soc/ti/pruss.c | 77 +++++++++++++++++++++++++++++++++++- include/linux/pruss_driver.h | 6 +++ 2 files changed, 82 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1
Re: [PATCH 1/1] soc: ti: PRUSS OCP configuration
In reply to Basharath Hussain KhajaLe 23/12/2024 à 14:55, Basharath Hussain Khaja a écrit :
Quoted 23 lines
From: Roger Quadros <[email protected]>
Updates OCP master port configuration to enable memory access outside of the PRU-ICSS subsystem.
This set of changes configures PRUSS_SYSCFG.STANDBY_INIT bit either to enable or disable the OCP master ports (applicable only on SoCs using OCP interconnect like the OMAP family).
Signed-off-by Roger Quadros <[email protected]>Signed-off-by Andrew F. Davis <[email protected]>Signed-off-by Parvathi Pudi <[email protected]>Signed-off-by Basharath Hussain Khaja <[email protected]>--- drivers/soc/ti/pruss.c | 77 +++++++++++++++++++++++++++++++++++- include/linux/pruss_driver.h | 6 +++ 2 files changed, 82 insertions(+), 1 deletion(-)drivers/soc/ti/pruss.c +0
-0
drivers/soc/ti/pruss.c line 29
Quoted 5 lines
drivers/soc/ti/pruss.c +2
-0@@ -25,14 +25,19 @@#include <linux/slab.h> #include "pruss.h" +#define SYSCFG_STANDBY_INIT BIT(4) +#define SYSCFG_SUB_MWAIT_READY BIT(5)
Hi,
Nitpick: #include <linux/bits.h>?
CJ
Hi Basharath,
Quoted 11 lines · Basharath Hussain Khaja
Hi,
This patch adds support for AM57xx SOC compatibility in the PRUSS driver which is a prerequisite for ICSSM Ethernet driver.
I will submit the patch series of ICSSM Ethernet driver for AM57xx subsequently in a separate thread after the merge of this patch.
Thanks & Best Regards,
Basharath
Quoted 7 lines
Roger Quadros (1):
soc: ti: PRUSS OCP configurationdrivers/soc/ti/pruss.c | 77 +++++++++++++++++++++++++++++++++++- include/linux/pruss_driver.h | 6 +++ 2 files changed, 82 insertions(+), 1 deletion(-)
For single patch, cover letter is not required. You can mention additional details below the tear line (---) in the patch itself.
Signature · 2 lines
Thanks and Regards, Danish
Re: [PATCH 1/1] soc: ti: PRUSS OCP configuration
In reply to Basharath Hussain KhajaQuoted 5 lines · Basharath Hussain Khaja
From: Roger Quadros <[email protected]>
Updates OCP master port configuration to enable memory access outside of the PRU-ICSS subsystem.
Quoted 8 lines
This set of changes configures PRUSS_SYSCFG.STANDBY_INIT bit either to enable or disable the OCP master ports (applicable only on SoCs using OCP interconnect like the OMAP family).
Signed-off-by Roger Quadros <[email protected]>Signed-off-by Andrew F. Davis <[email protected]>Signed-off-by Parvathi Pudi <[email protected]>Signed-off-by Basharath Hussain Khaja <[email protected]>
The patch LGTM however it doesn't apply cleanly on branch ti-drivers-soc-next on [1]
This applies cleanly on latest linux-next but not on [1] where Nishant will eventually apply the patches.
Applying: soc: ti: PRUSS OCP configuration
Patch failed at 0001 soc: ti: PRUSS OCP configuration
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
error: patch failed: include/linux/pruss_driver.h:172
error: include/linux/pruss_driver.h: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Please re-base the patch on [1] and re-send.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
Signature · 2 lines
Thanks and Regards, Danish
Re: [PATCH 1/1] soc: ti: PRUSS OCP configuration
In reply to Christophe JAILLETPlease note that this file "#include <linux/bits.h>" is already included in the pruss.h file and we are including the pruss.h file.