Add interconnect support to QSPI and QUP drivers
Subsystems (9)
v4 cover Add interconnect support to QSPI and QUP drivers
dt-binding patch for QUP drivers.
- https://patchwork.kernel.org/patch/11436621/ [Convert QUP bindings to YAML and add ICC, pin swap doc]
High level design:
- QUP wrapper/common driver.
Vote for QUP core on behalf of earlycon from probe. Remove BW vote during earlycon exit call
- SERIAL driver.
Vote only for CPU/CORE path because driver is in FIFO mode only Vote/unvote from qcom_geni_serial_pm func.
Bump up the CPU vote from set_termios call based on real time need
- I2C driver.
Vote for CORE/CPU/DDR path
Vote/unvote from runtime resume/suspend callback
As bus speed for I2C is fixed from probe itself no need for bump up.
- SPI QUP driver.
Vote only for CPU/CORE path because driver is in FIFO mode only Vote/unvote from runtime resume/suspend callback Bump up CPU vote based on real time need per transfer.
- QSPI driver.
Vote only for CPU path
Vote/unvote from runtime resume/suspend callback Bump up CPU vote based on real time need per transfer.
Changes in V2:
- Add devm_of_icc_get() API interconnect core.
- Add ICC support to common driver to fix earlyconsole crash.
Changes in V3:
- Define common ICC APIs in geni-se driver and use it across geni based I2C,SPI and UART driver.
Changes in V4:
- Add a patch to ICC core to scale peak requirement as twice of average if it is not mentioned explicilty.
Akash Asthana (9):
interconnect: Add devm_of_icc_get() as exported API for users
interconnect: Set peak requirement as twice of average
soc: qcom: geni: Support for ICC voting
soc: qcom-geni-se: Add interconnect support to fix earlycon crash
i2c: i2c-qcom-geni: Add interconnect support
spi: spi-geni-qcom: Add interconnect support
tty: serial: qcom_geni_serial: Add interconnect support
spi: spi-qcom-qspi: Add interconnect support
arm64: dts: sc7180: Add interconnect for QUP and QSPI
arch/arm64/boot/dts/qcom/sc7180.dtsi | 127 ++++++++++++++++++++++++++++++++++ drivers/i2c/busses/i2c-qcom-geni.c | 26 ++++++- drivers/interconnect/core.c | 35 ++++++++++ drivers/soc/qcom/qcom-geni-se.c | 111 +++++++++++++++++++++++++++++ drivers/spi/spi-geni-qcom.c | 25 ++++++- drivers/spi/spi-qcom-qspi.c | 43 +++++++++++- drivers/tty/serial/qcom_geni_serial.c | 32 ++++++++- include/linux/interconnect.h | 7 ++ include/linux/qcom-geni-se.h | 33 +++++++++ 9 files changed, 433 insertions(+), 6 deletions(-)
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
PATCH v4 1/9 interconnect: Add devm_of_icc_get() as exported API for users
Users can use devm version of of_icc_get() to benefit from automatic resource release.
Reviewed by: Matthias Kaehlcke <[email protected]>
--- drivers/interconnect/core.c | 25 +++++++++++++++++++++++++ include/linux/interconnect.h | 7 +++++++ 2 files changed, 32 insertions(+)
drivers/interconnect/core.c +25 -0
@@ -350,6 +350,31 @@ static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)return node; } +static void devm_icc_release (struct device *dev,void *res) +{ +icc_put (*(struct icc_path **)res); +} + +struct icc_path *devm_of_icc_get (struct device *dev,const char *name) +{ +struct icc_path **ptr, *path; + + ptr =devres_alloc (devm_icc_release,sizeof (**ptr),GFP_KERNEL ); +if (!ptr) +return ERR_PTR (-ENOMEM ); + + path =of_icc_get (dev, name); +if (!IS_ERR (path)) { + *ptr = path; +devres_add (dev, ptr); + }else { +devres_free (ptr); + } + +return path; +} +EXPORT_SYMBOL_GPL (devm_of_icc_get); +/** * of_icc_get() - get a path handle from a DT node based on name * @dev: device pointer for the consumer device
include/linux/interconnect.h +7 -0
@@ -28,6 +28,7 @@ struct device;struct icc_path *icc_get (struct device *dev,const int src_id,const int dst_id);struct icc_path *of_icc_get (struct device *dev,const char *name); +struct icc_path *devm_of_icc_get (struct device *dev,const char *name);void icc_put (struct icc_path *path);int icc_set_bw (struct icc_path *path,u32 avg_bw,u32 peak_bw);void icc_set_tag (struct icc_path *path,u32 tag);
@@ -46,6 +47,12 @@ static inline struct icc_path *of_icc_get(struct device *dev,return NULL ; } +static inline struct icc_path *devm_of_icc_get (struct device *dev, +const char *name) +{ +return NULL ; +} +static inline void icc_put (struct icc_path *path) { }
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Re: [PATCH V4 1/9] interconnect: Add devm_of_icc_get() as exported API for users
Hi Akash,
Quoted 7 lines · Akash Asthana
Users can use devm version of
of_icc_get()to benefit from automatic resource release.Signed-off-by Akash Asthana <[email protected]>Reviewed by: Matthias Kaehlcke <[email protected]>
Reviewed-by Bjorn Andersson <[email protected]>---
Thank you for this patch! I am applying it, so there is no need to re-send it.
BR,
Georgi
PATCH v4 2/9 interconnect: Set peak requirement as twice of average
In reply to Akash AsthanaLot of ICC clients are not aware of their actual peak requirement, most commonly they tend to guess their peak requirement as (some factor) * avg_bw.
Centralize random peak guess as twice of average, out into the core to maintain consistency across the clients. Client can always override this setting if they got a better idea.
--- drivers/interconnect/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/interconnect/core.c +10 -0
@@ -516,6 +516,10 @@ EXPORT_SYMBOL_GPL(icc_set_tag);* The @path can be NULL when the "interconnects" DT properties is missing, * which will mean that no constraints will be set. * +* This function assumes peak_bw as twice of avg_bw, if peak_bw is not mentioned +* explicitly by clients. Clients can pass peak_bw as 0 < peak_bw <=avg_bw to +* make it a noops. +* * Returns 0 on success, or an appropriate error code otherwise. */ int icc_set_bw (struct icc_path *path,u32 avg_bw,u32 peak_bw)
@@ -531,6 +535,12 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)if (WARN_ON (IS_ERR (path) || !path->num_nodes))return -EINVAL ; +/* +* Assume peak requirement as twice of avg requirement, if it is not +* mentioned explicitly. +*/ + peak_bw = peak_bw ? peak_bw :2 * avg_bw; +mutex_lock (&icc_lock); old_avg = path->reqs[0 ].avg_bw;
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Re: [PATCH V4 2/9] interconnect: Set peak requirement as twice of average
Hi Akash,
Quoted 7 lines · Akash Asthana
Lot of ICC clients are not aware of their actual peak requirement, most commonly they tend to guess their peak requirement as (some factor) *
avg_bw.Centralize random peak guess as twice of average, out into the core to maintain consistency across the clients. Client can always override this setting if they got a better idea.
I am still not convinced that this is a good idea. If the factor is a random value, then i think that the default factor should be 1.
According to your previous reply, it seems that from geni we are requesting double peak bandwidth to compensate for other clients which are not requesting bandwidth for themselves. IMO, this is a bit hacky.
Instead of requesting double peak bandwidth, IIUC the correct thing to do here is to request peak_bw = avg_bw for geni. And instead of trying to compensate for other clients "stealing" bandwidth, can't we make these clients vote for their own bandwidth? Or if they really can't, this should be handled elsewhere - maybe in the interconnect platform driver we can reserve some amount of minimum bandwidth for such cases?
Thanks,
Georgi
Re: [PATCH V4 2/9] interconnect: Set peak requirement as twice of average
Hi Georgi,
Quoted 17 lines · Georgi Djakov
Hi Akash,
Quoted 7 lines · Akash Asthana
Lot of ICC clients are not aware of their actual peak requirement, most commonly they tend to guess their peak requirement as (some factor) *
avg_bw.Centralize random peak guess as twice of average, out into the core to maintain consistency across the clients. Client can always override this setting if they got a better idea.
I am still not convinced that this is a good idea. If the factor is a random value, then i think that the default factor should be 1.
According to your previous reply, it seems that from geni we are requesting double peak bandwidth to compensate for other clients which are not requesting bandwidth for themselves. IMO, this is a bit hacky.
Quoted 6 lines
Instead of requesting double peak bandwidth, IIUC the correct thing to do here is to request
peak_bw=avg_bwfor geni. And instead of trying to compensate for other clients "stealing" bandwidth, can't we make these clients vote for their own bandwidth? Or if they really can't, this should be handled elsewhere - maybe in the interconnect platform driver we can reserve some amount of minimum bandwidth for such cases?
Okay, probably we can correct clients vote for their own bandwidth or reserve some minimum BW from interconnect platform driver is case of any latency issue observed.
I will drop this change in next version.
Will it create any difference if peak_bw = 0 instead of peak_bw = avg_bw? In my understanding peak_bw <= avg_bw is no-ops, it won't impact the NOC speed.
Regards,
Akash
Quoted 3 lines
Thanks,
Georgi
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Re: [PATCH V4 2/9] interconnect: Set peak requirement as twice of average
Hi Akash,
Quoted 27 lines · Akash Asthana
Hi Georgi,
Quoted 17 lines · Georgi Djakov
Hi Akash,
Quoted 7 lines · Akash Asthana
Lot of ICC clients are not aware of their actual peak requirement, most commonly they tend to guess their peak requirement as (some factor) *
avg_bw.Centralize random peak guess as twice of average, out into the core to maintain consistency across the clients. Client can always override this setting if they got a better idea.
I am still not convinced that this is a good idea. If the factor is a random value, then i think that the default factor should be 1.
According to your previous reply, it seems that from geni we are requesting double peak bandwidth to compensate for other clients which are not requesting bandwidth for themselves. IMO, this is a bit hacky.
Quoted 6 lines
Instead of requesting double peak bandwidth, IIUC the correct thing to do here is to request
peak_bw=avg_bwfor geni. And instead of trying to compensate for other clients "stealing" bandwidth, can't we make these clients vote for their own bandwidth? Or if they really can't, this should be handled elsewhere - maybe in the interconnect platform driver we can reserve some amount of minimum bandwidth for such cases?
Quoted 3 lines
Okay, probably we can correct clients vote for their own bandwidth or reserve some minimum BW from interconnect platform driver is case of any latency issue observed.
Yes, this sounds like the correct thing to do.
Quoted 5 lines
I will drop this change in next version.
Will it create any difference if
peak_bw= 0 instead ofpeak_bw=avg_bw? In my understandingpeak_bw<=avg_bwis no-ops, it won't impact the NOC speed.
It will not have impact on the NOC speed, but it does not make much logical sense to have peak_bw = 0 or peak_bw < avg_bw. In the geni case, i think what we want to do is peak_bw = avg_bw.
Thanks,
Georgi
PATCH v4 3/9 soc: qcom: geni: Support for ICC voting
In reply to Akash AsthanaAdd necessary macros and structure variables to support ICC BW voting from individual SE drivers.
---
Changes in V2:
- As per Bjorn's comment dropped enums for ICC paths, given the three paths individual members
Changes in V3:
- Add geni_icc_get, geni_icc_vote_on and geni_icc_vote_off as helper API.
- Add geni_icc_path structure in common header
Changes in V4:
- As per Bjorn's comment print error message in geni_icc_get if return value is not -EPROBE_DEFER.
- As per Bjorn's comment remove NULL on path before calling icc_set_bw API.
- As per Bjorn's comment drop __func__ print.
- As per Matthias's comment, make ICC path a array instead of individual member entry in geni_se struct.
Note: I have ignored below check patch suggestion because it was throwing
compilation error as 'icc_ddr' is not compile time comstant.
WARNING: char * array declaration might be better as static const
- FILE: drivers/soc/qcom/qcom-geni-se.c:726:
- const char *icc_names[] = {"qup-core", "qup-config", icc_ddr};
drivers/soc/qcom/qcom-geni-se.c | 61 +++++++++++++++++++++++++++++++++++++++++ include/linux/qcom-geni-se.h | 31 +++++++++++++++++++++ 2 files changed, 92 insertions(+)
drivers/soc/qcom/qcom-geni-se.c +61 -0
@@ -720,6 +720,67 @@ void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) }EXPORT_SYMBOL (geni_se_rx_dma_unprep); +int geni_icc_get (struct geni_se *se,const char *icc_ddr) +{ +int i, icc_err; +const char *icc_names[] = {"qup-core" ,"qup-config" , icc_ddr}; + +for (i =0 ; i <ARRAY_SIZE (se->icc_paths); i++) { +if (!icc_names[i]) +continue ; + + se->icc_paths[i].path =devm_of_icc_get (se->dev, icc_names[i]); +if (IS_ERR (se->icc_paths[i].path)) + goto icc_get_failure; + } + +return 0 ; + +icc_get_failure: + icc_err =PTR_ERR (se->icc_paths[i].path); +if (icc_err != -EPROBE_DEFER ) +dev_err_ratelimited (se->dev,"Failed to get path:%d, ret:%d\n" , + i, icc_err); +return icc_err; + +} +EXPORT_SYMBOL (geni_icc_get); + +int geni_icc_vote_on (struct geni_se *se) +{ +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (se->icc_paths); i++) { + ret =icc_set_bw (se->icc_paths[i].path, + se->icc_paths[i].avg_bw, se->icc_paths[i].peak_bw); +if (ret) { +dev_err_ratelimited (se->dev,"ICC BW voting failed on path:%d, ret:%d\n" , + i, ret); +return ret; + } + } + +return 0 ; +} +EXPORT_SYMBOL (geni_icc_vote_on); + +int geni_icc_vote_off (struct geni_se *se) +{ +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (se->icc_paths); i++) { + ret =icc_set_bw (se->icc_paths[i].path,0 ,0 ); +if (ret) { +dev_err_ratelimited (se->dev,"ICC BW remove failed on path:%d, ret:%d\n" , + i, ret); +return ret; + } + } + +return 0 ; +} +EXPORT_SYMBOL (geni_icc_vote_off); +static int geni_se_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
include/linux/qcom-geni-se.h +31 -0
@@ -6,6 +6,8 @@#ifndef _LINUX_QCOM_GENI_SE#define _LINUX_QCOM_GENI_SE +#include <linux/interconnect.h> +/* Transfer mode supported by GENI Serial Engines */ enum geni_se_xfer_mode { GENI_SE_INVALID,
@@ -25,6 +27,12 @@ enum geni_se_protocol_type {struct geni_wrapper ;struct clk ; +struct geni_icc_path { +struct icc_path *path; +unsigned int avg_bw; +unsigned int peak_bw; +}; +/** * struct geni_se - GENI Serial Engine * @base: Base Address of the Serial Engine's register block
@@ -33,6 +41,7 @@ struct clk;* @clk: Handle to the core serial engine clock * @num_clk_levels: Number of valid clock levels in clk_perf_tbl * @clk_perf_tbl: Table of clock frequency input to serial engine clock +* @icc_paths: Array of ICC paths for SE */ struct geni_se {void __iomem *base;
@@ -41,6 +50,7 @@ struct geni_se {struct clk *clk;unsigned int num_clk_levels;unsigned long *clk_perf_tbl; +struct geni_icc_path icc_paths[3 ]; };/* Common SE registers */
@@ -229,6 +239,21 @@ struct geni_se {#define GENI_SE_VERSION_MINOR (ver) ((ver & HW_VER_MINOR_MASK) >> HW_VER_MINOR_SHFT)#define GENI_SE_VERSION_STEP (ver) (ver & HW_VER_STEP_MASK) +/* +* Define bandwidth thresholds that cause the underlying Core 2X interconnect +* clock to run at the named frequency. These baseline values are recommended +* by the hardware team, and are not dynamically scaled with GENI bandwidth +* beyond basic on/off. +*/ +#define CORE_2X_19_2_MHZ 960 +#define CORE_2X_50_MHZ 2500 +#define CORE_2X_100_MHZ 5000 +#define CORE_2X_150_MHZ 7500 +#define CORE_2X_200_MHZ 10000 +#define CORE_2X_236_MHZ 16383 + +#define GENI_DEFAULT_BW Bps_to_icc(1000) +#if IS_ENABLED (CONFIG_QCOM_GENI_SE )u32 geni_se_get_qup_hw_version (struct geni_se *se);
@@ -416,5 +441,11 @@ int geni_se_rx_dma_prep(struct geni_se *se, void *buf, size_t len,void geni_se_tx_dma_unprep (struct geni_se *se,dma_addr_t iova,size_t len);void geni_se_rx_dma_unprep (struct geni_se *se,dma_addr_t iova,size_t len); + +int geni_icc_get (struct geni_se *se,const char *icc_ddr); + +int geni_icc_vote_on (struct geni_se *se); + +int geni_icc_vote_off (struct geni_se *se);#endif #endif
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Re: [PATCH V4 3/9] soc: qcom: geni: Support for ICC voting
Hi Akash,
Quoted 52 lines · Akash Asthana
Add necessary macros and structure variables to support ICC BW voting from individual SE drivers.
Signed-off-by Akash Asthana <[email protected]>---
Changes in V2:
- As per Bjorn's comment dropped enums for ICC paths, given the three paths individual membersChanges in V3:
- Addgeni_icc_get,geni_icc_vote_onandgeni_icc_vote_offas helper API.
- Addgeni_icc_pathstructure in common headerChanges in V4:
- As per Bjorn's comment print error message ingeni_icc_getif return value is not -EPROBE_DEFER.
- As per Bjorn's comment remove NULL on path before callingicc_set_bwAPI.
- As per Bjorn's comment drop__func__print.
- As per Matthias's comment, make ICC path a array instead of individual member entry ingeni_sestruct.Note: I have ignored below check patch suggestion because it was throwing
compilation error as 'icc_ddr' is not compile time comstant.WARNING: char * array declaration might be better as static const
- FILE:drivers/soc/qcom/qcom-geni-se.c:726:
- const char *icc_names[] = {"qup-core", "qup-config",icc_ddr};drivers/soc/qcom/qcom-geni-se.c | 61 +++++++++++++++++++++++++++++++++++++++++ include/linux/qcom-geni-se.h | 31 +++++++++++++++++++++ 2 files changed, 92 insertions(+)drivers/soc/qcom/qcom-geni-se.c +10
-0@@ -720,6 +720,67 @@ void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) }EXPORT_SYMBOL (geni_se_rx_dma_unprep); +int geni_icc_get (struct geni_se *se,const char *icc_ddr) +{ +int i, icc_err; +const char *icc_names[] = {"qup-core" ,"qup-config" , icc_ddr}; + +for (i =0 ; i <ARRAY_SIZE (se->icc_paths); i++) { +if (!icc_names[i]) +continue ; + + se->icc_paths[i].path =devm_of_icc_get (se->dev, icc_names[i]);
drivers/soc/qcom/qcom-geni-se.c void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) · line 742
Quoted 10 lines
drivers/soc/qcom/qcom-geni-se.c +10
-0+if (IS_ERR (se->icc_paths[i].path)) + goto icc_get_failure; + } + +return 0 ; + +icc_get_failure: + icc_err =PTR_ERR (se->icc_paths[i].path); +if (icc_err != -EPROBE_DEFER ) + dev_err_ratelimited(se->dev, "Failed to get path:%d, ret:%d\n",
Better be explicit that it's an ICC path and log icc_names[i] instead of i.
drivers/soc/qcom/qcom-geni-se.c void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) · line 755
Quoted 13 lines
drivers/soc/qcom/qcom-geni-se.c +13
-0+ i, icc_err); +return icc_err; + +} +EXPORT_SYMBOL (geni_icc_get); + +int geni_icc_vote_on (struct geni_se *se) +{ +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (se->icc_paths); i++) { + ret =icc_set_bw (se->icc_paths[i].path, + se->icc_paths[i].avg_bw, se->icc_paths[i].peak_bw);
I'll leave it to others to decide whether it's ok to leave the implementation of the icc_enable/disable() APIs suggested on
https://patchwork.kernel.org/patch/11467511/#23269555 for later.
drivers/soc/qcom/qcom-geni-se.c void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) · line 758
Quoted 3 lines
drivers/soc/qcom/qcom-geni-se.c +3
-0+if (ret) { +dev_err_ratelimited (se->dev,"ICC BW voting failed on path:%d, ret:%d\n" , + i, ret);
Instead of logging the index, which isn't very expressive, you could have a static string array of the path names ({"core", "config", "ddr"} or similar) that is used when logging errors in _vote_on/off().
Quoted 63 lines
drivers/soc/qcom/qcom-geni-se.c +25
-0+return ret; + } + } + +return 0 ; +} +EXPORT_SYMBOL (geni_icc_vote_on); + +int geni_icc_vote_off (struct geni_se *se) +{ +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (se->icc_paths); i++) { + ret =icc_set_bw (se->icc_paths[i].path,0 ,0 ); +if (ret) { +dev_err_ratelimited (se->dev,"ICC BW remove failed on path:%d, ret:%d\n" , + i, ret); +return ret; + } + } + +return 0 ; +} +EXPORT_SYMBOL (geni_icc_vote_off); +static int geni_se_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;include/linux/qcom-geni-se.h +9
-0@@ -6,6 +6,8 @@#ifndef _LINUX_QCOM_GENI_SE#define _LINUX_QCOM_GENI_SE +#include <linux/interconnect.h> +/* Transfer mode supported by GENI Serial Engines */ enum geni_se_xfer_mode { GENI_SE_INVALID,@@ -25,6 +27,12 @@ enum geni_se_protocol_type {struct geni_wrapper ;struct clk ; +struct geni_icc_path { +struct icc_path *path; +unsigned int avg_bw; +unsigned int peak_bw; +}; +/** * struct geni_se - GENI Serial Engine * @base: Base Address of the Serial Engine's register block @@ -33,6 +41,7 @@ struct clk;* @clk: Handle to the core serial engine clock * @num_clk_levels: Number of valid clock levels in clk_perf_tbl * @clk_perf_tbl: Table of clock frequency input to serial engine clock +* @icc_paths: Array of ICC paths for SE */ struct geni_se {void __iomem *base;
include/linux/qcom-geni-se.h struct geni_se { · line 53
Quoted 4 lines
include/linux/qcom-geni-se.h +1
-0@@ -41,6 +50,7 @@ struct geni_se {struct clk *clk;unsigned int num_clk_levels;unsigned long *clk_perf_tbl; +struct geni_icc_path icc_paths[3 ];
You also need enums for the paths, otherwise you end up with code like this, which isn't really self-explanatory:
gi2c->se.icc_paths[0].avg_bw = GENI_DEFAULT_BW; gi2c->se.icc_paths[1].avg_bw = GENI_DEFAULT_BW; gi2c->se.icc_paths[2].avg_bw = Bps_to_icc(gi2c->clk_freq_out);
(from "[V4,5/9] i2c: i2c-qcom-geni: Add interconnect support")
I know Bjorn asked in v1 to remove the enums you had, however it was a slightly different context. If we are sticking to use an array of 'struct geni_icc_path' (which reduces redundant code) the enums are 'needed'.
Re: [PATCH V4 3/9] soc: qcom: geni: Support for ICC voting
Hi Matthias,
Quoted 165 lines · Matthias Kaehlcke
Hi Akash,
Quoted 52 lines · Akash Asthana
Add necessary macros and structure variables to support ICC BW voting from individual SE drivers.
Signed-off-by Akash Asthana <[email protected]>---
Changes in V2:
- As per Bjorn's comment dropped enums for ICC paths, given the three paths individual membersChanges in V3:
- Addgeni_icc_get,geni_icc_vote_onandgeni_icc_vote_offas helper API.
- Addgeni_icc_pathstructure in common headerChanges in V4:
- As per Bjorn's comment print error message ingeni_icc_getif return value is not -EPROBE_DEFER.
- As per Bjorn's comment remove NULL on path before callingicc_set_bwAPI.
- As per Bjorn's comment drop__func__print.
- As per Matthias's comment, make ICC path a array instead of individual member entry ingeni_sestruct.Note: I have ignored below check patch suggestion because it was throwing
compilation error as 'icc_ddr' is not compile time comstant.WARNING: char * array declaration might be better as static const
- FILE:drivers/soc/qcom/qcom-geni-se.c:726:
- const char *icc_names[] = {"qup-core", "qup-config",icc_ddr};drivers/soc/qcom/qcom-geni-se.c | 61 +++++++++++++++++++++++++++++++++++++++++ include/linux/qcom-geni-se.h | 31 +++++++++++++++++++++ 2 files changed, 92 insertions(+)drivers/soc/qcom/qcom-geni-se.c +10
-0@@ -720,6 +720,67 @@ void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) }EXPORT_SYMBOL (geni_se_rx_dma_unprep); +int geni_icc_get (struct geni_se *se,const char *icc_ddr) +{ +int i, icc_err; +const char *icc_names[] = {"qup-core" ,"qup-config" , icc_ddr}; + +for (i =0 ; i <ARRAY_SIZE (se->icc_paths); i++) { +if (!icc_names[i]) +continue ; + + se->icc_paths[i].path =devm_of_icc_get (se->dev, icc_names[i]);drivers/soc/qcom/qcom-geni-se.c void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) · line 742
Quoted 10 lines
drivers/soc/qcom/qcom-geni-se.c +10
-0+if (IS_ERR (se->icc_paths[i].path)) + goto icc_get_failure; + } + +return 0 ; + +icc_get_failure: + icc_err =PTR_ERR (se->icc_paths[i].path); +if (icc_err != -EPROBE_DEFER ) + dev_err_ratelimited(se->dev, "Failed to get path:%d, ret:%d\n",Better be explicit that it's an ICC path and log icc_names[i] instead of i.
drivers/soc/qcom/qcom-geni-se.c void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) · line 755
Quoted 13 lines
drivers/soc/qcom/qcom-geni-se.c +13
-0+ i, icc_err); +return icc_err; + +} +EXPORT_SYMBOL (geni_icc_get); + +int geni_icc_vote_on (struct geni_se *se) +{ +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (se->icc_paths); i++) { + ret =icc_set_bw (se->icc_paths[i].path, + se->icc_paths[i].avg_bw, se->icc_paths[i].peak_bw);I'll leave it to others to decide whether it's ok to leave the implementation of the icc_enable/disable() APIs suggested on
https://patchwork.kernel.org/patch/11467511/#23269555 for later.drivers/soc/qcom/qcom-geni-se.c void geni_se_rx_dma_unprep(struct geni_se *se, dma_addr_t iova, size_t len) · line 758
Quoted 3 lines
drivers/soc/qcom/qcom-geni-se.c +3
-0+if (ret) { +dev_err_ratelimited (se->dev,"ICC BW voting failed on path:%d, ret:%d\n" , + i, ret);Instead of logging the index, which isn't very expressive, you could have a static string array of the path names ({"core", "config", "ddr"} or similar) that is used when logging errors in _vote_on/off().
Quoted 63 lines
drivers/soc/qcom/qcom-geni-se.c +25
-0+return ret; + } + } + +return 0 ; +} +EXPORT_SYMBOL (geni_icc_vote_on); + +int geni_icc_vote_off (struct geni_se *se) +{ +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (se->icc_paths); i++) { + ret =icc_set_bw (se->icc_paths[i].path,0 ,0 ); +if (ret) { +dev_err_ratelimited (se->dev,"ICC BW remove failed on path:%d, ret:%d\n" , + i, ret); +return ret; + } + } + +return 0 ; +} +EXPORT_SYMBOL (geni_icc_vote_off); +static int geni_se_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;include/linux/qcom-geni-se.h +9
-0@@ -6,6 +6,8 @@#ifndef _LINUX_QCOM_GENI_SE#define _LINUX_QCOM_GENI_SE +#include <linux/interconnect.h> +/* Transfer mode supported by GENI Serial Engines */ enum geni_se_xfer_mode { GENI_SE_INVALID,@@ -25,6 +27,12 @@ enum geni_se_protocol_type {struct geni_wrapper ;struct clk ; +struct geni_icc_path { +struct icc_path *path; +unsigned int avg_bw; +unsigned int peak_bw; +}; +/** * struct geni_se - GENI Serial Engine * @base: Base Address of the Serial Engine's register block @@ -33,6 +41,7 @@ struct clk;* @clk: Handle to the core serial engine clock * @num_clk_levels: Number of valid clock levels in clk_perf_tbl * @clk_perf_tbl: Table of clock frequency input to serial engine clock +* @icc_paths: Array of ICC paths for SE */ struct geni_se {void __iomem *base;include/linux/qcom-geni-se.h struct geni_se { · line 53
Quoted 4 lines
include/linux/qcom-geni-se.h +1
-0@@ -41,6 +50,7 @@ struct geni_se {struct clk *clk;unsigned int num_clk_levels;unsigned long *clk_perf_tbl; +struct geni_icc_path icc_paths[3 ];You also need enums for the paths, otherwise you end up with code like this, which isn't really self-explanatory:
gi2c->se.icc_paths[0].avg_bw = GENI_DEFAULT_BW; gi2c->se.icc_paths[1].avg_bw = GENI_DEFAULT_BW; gi2c->se.icc_paths[2].avg_bw = Bps_to_icc(gi2c->clk_freq_out);
Quoted 6 lines
(from "[V4,5/9] i2c: i2c-qcom-geni: Add interconnect support")I know Bjorn asked in v1 to remove the enums you had, however it was a slightly different context. If we are sticking to use an array of 'struct
geni_icc_path' (which reduces redundant code) the enums are 'needed'.
Ok
Regards,
Akash
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
PATCH v4 4/9 soc: qcom-geni-se: Add interconnect support to fix earlycon crash
In reply to Akash AsthanaQUP core clock is shared among all the SE drivers present on particular QUP wrapper, the system will reset(unclocked access) if earlycon used after QUP core clock is put to 0 from other SE drivers before real console comes up.
As earlycon can't vote for it's QUP core need, to fix this add ICC support to common/QUP wrapper driver and put vote for QUP core from probe on behalf of earlycon and remove vote during earlycon exit call.
---
Change in V3:
- Add geni_remove_earlycon_icc_vote API that will be used by earlycon exit function to remove ICC vote for earlyconsole.
- Remove suspend/resume hook for geni-se driver as we are no longer removing earlyconsole ICC vote from system suspend, we are removing from earlycon exit.
Change in V4:
- As per Matthias comment make 'earlycon_wrapper' as static structure.
drivers/soc/qcom/qcom-geni-se.c | 50 +++++++++++++++++++++++++++++++++++ drivers/tty/serial/qcom_geni_serial.c | 7 +++++ include/linux/qcom-geni-se.h | 2 ++ 3 files changed, 59 insertions(+)
drivers/soc/qcom/qcom-geni-se.c +50 -0
@@ -90,8 +90,11 @@ struct geni_wrapper {struct device *dev;void __iomem *base;struct clk_bulk_data ahb_clks[NUM_AHB_CLKS ]; +struct geni_icc_path to_core; }; +static struct geni_wrapper *earlycon_wrapper; +#define QUP_HW_VER_REG 0x4/* Common SE registers */
@@ -781,6 +784,26 @@ int geni_icc_vote_off(struct geni_se *se) }EXPORT_SYMBOL (geni_icc_vote_off); +void geni_remove_earlycon_icc_vote (void ) +{ +struct geni_wrapper *wrapper = earlycon_wrapper; +struct device_node *parent =of_get_next_parent (wrapper->dev->of_node); +struct device_node *child; + +for_each_child_of_node (parent, child) { +if (of_device_is_compatible (child,"qcom,geni-se-qup" )) { + wrapper =platform_get_drvdata (of_find_device_by_node ( + child)); +icc_put (wrapper->to_core.path); + wrapper->to_core.path =NULL ; + } + } +of_node_put (parent); + + earlycon_wrapper =NULL ; +} +EXPORT_SYMBOL (geni_remove_earlycon_icc_vote); +static int geni_se_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -808,6 +831,33 @@ static int geni_se_probe(struct platform_device *pdev) } } +#ifdef CONFIG_SERIAL_EARLYCON + wrapper->to_core.path =devm_of_icc_get (dev,"qup-core" ); +if (IS_ERR (wrapper->to_core.path)) +return PTR_ERR (wrapper->to_core.path); +/* +* Put minmal BW request on core clocks on behalf of early console. +* The vote will be removed earlycon exit function. +* +* Note: We are putting vote on each QUP wrapper instead only to which +* earlycon is connected because QUP core clock of different wrapper +* share same voltage domain. If core1 is put to 0, then core2 will +* also run at 0, if not voted. Default ICC vote will be removed ASA +* we touch any of the core clock. +* core1 = core2 = max(core1, core2) +*/ + ret =icc_set_bw (wrapper->to_core.path,GENI_DEFAULT_BW ,0 ); +if (ret) { +dev_err (&pdev->dev,"%s: ICC BW voting failed for core\n" , + __func__); +return ret; + } + +if (of_get_compatible_child (pdev->dev.of_node,"qcom,geni-debug-uart" )) + earlycon_wrapper = wrapper; +of_node_put (pdev->dev.of_node); +#endif +dev_set_drvdata (dev, wrapper);dev_dbg (dev,"GENI SE Driver probed\n" );return devm_of_platform_populate (dev);
drivers/tty/serial/qcom_geni_serial.c +7 -0
@@ -1090,6 +1090,12 @@ static void qcom_geni_serial_earlycon_write(struct console *con,__qcom_geni_serial_console_write (&dev->port, s, n); } +static int qcom_geni_serial_earlycon_exit (struct console *con) +{ +geni_remove_earlycon_icc_vote (); +return 0 ; +} +static int __init qcom_geni_serial_earlycon_setup (struct earlycon_device *dev,const char *opt) {
@@ -1135,6 +1141,7 @@ static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev,writel (stop_bit_len, uport->membase +SE_UART_TX_STOP_BIT_LEN ); dev->con->write = qcom_geni_serial_earlycon_write; + dev->con->exit = qcom_geni_serial_earlycon_exit; dev->con->setup =NULL ;return 0 ; }
include/linux/qcom-geni-se.h +2 -0
@@ -447,5 +447,7 @@ int geni_icc_get(struct geni_se *se, const char *icc_ddr);int geni_icc_vote_on (struct geni_se *se);int geni_icc_vote_off (struct geni_se *se); + +void geni_remove_earlycon_icc_vote (void );#endif #endif
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Re: [PATCH V4 4/9] soc: qcom-geni-se: Add interconnect support to fix earlycon crash
Hi Akash,
Quoted 122 lines · Akash Asthana
QUP core clock is shared among all the SE drivers present on particular QUP wrapper, the system will reset(unclocked access) if earlycon used after QUP core clock is put to 0 from other SE drivers before real console comes up.
As earlycon can't vote for it's QUP core need, to fix this add ICC support to common/QUP wrapper driver and put vote for QUP core from probe on behalf of earlycon and remove vote during earlycon exit call.
Signed-off-by Akash Asthana <[email protected]>Reported-by Matthias Kaehlcke <[email protected]>---
Change in V3:
- Addgeni_remove_earlycon_icc_voteAPI that will be used by earlycon exit function to remove ICC vote for earlyconsole.
- Remove suspend/resume hook for geni-se driver as we are no longer removing earlyconsole ICC vote from system suspend, we are removing from earlycon exit.Change in V4:
- As per Matthias comment make 'earlycon_wrapper' as static structure.drivers/soc/qcom/qcom-geni-se.c | 50 +++++++++++++++++++++++++++++++++++ drivers/tty/serial/qcom_geni_serial.c | 7 +++++ include/linux/qcom-geni-se.h | 2 ++ 3 files changed, 59 insertions(+)drivers/soc/qcom/qcom-geni-se.c +50
-0@@ -90,8 +90,11 @@ struct geni_wrapper {struct device *dev;void __iomem *base;struct clk_bulk_data ahb_clks[NUM_AHB_CLKS ]; +struct geni_icc_path to_core; }; +static struct geni_wrapper *earlycon_wrapper; +#define QUP_HW_VER_REG 0x4/* Common SE registers */ @@ -781,6 +784,26 @@ int geni_icc_vote_off(struct geni_se *se) }EXPORT_SYMBOL (geni_icc_vote_off); +void geni_remove_earlycon_icc_vote (void ) +{ +struct geni_wrapper *wrapper = earlycon_wrapper; +struct device_node *parent =of_get_next_parent (wrapper->dev->of_node); +struct device_node *child; + +for_each_child_of_node (parent, child) { +if (of_device_is_compatible (child,"qcom,geni-se-qup" )) { + wrapper =platform_get_drvdata (of_find_device_by_node ( + child)); +icc_put (wrapper->to_core.path); + wrapper->to_core.path =NULL ; + } + } +of_node_put (parent); + + earlycon_wrapper =NULL ; +} +EXPORT_SYMBOL (geni_remove_earlycon_icc_vote); +static int geni_se_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;@@ -808,6 +831,33 @@ static int geni_se_probe(struct platform_device *pdev) } } +#ifdef CONFIG_SERIAL_EARLYCON + wrapper->to_core.path =devm_of_icc_get (dev,"qup-core" ); +if (IS_ERR (wrapper->to_core.path)) +return PTR_ERR (wrapper->to_core.path); +/* +* Put minmal BW request on core clocks on behalf of early console. +* The vote will be removed earlycon exit function. +* +* Note: We are putting vote on each QUP wrapper instead only to which +* earlycon is connected because QUP core clock of different wrapper +* share same voltage domain. If core1 is put to 0, then core2 will +* also run at 0, if not voted. Default ICC vote will be removed ASA +* we touch any of the core clock. +* core1 = core2 = max(core1, core2) +*/ + ret =icc_set_bw (wrapper->to_core.path,GENI_DEFAULT_BW ,0 ); +if (ret) { +dev_err (&pdev->dev,"%s: ICC BW voting failed for core\n" , + __func__); +return ret; + } + +if (of_get_compatible_child (pdev->dev.of_node,"qcom,geni-debug-uart" )) + earlycon_wrapper = wrapper; +of_node_put (pdev->dev.of_node); +#endif +dev_set_drvdata (dev, wrapper);dev_dbg (dev,"GENI SE Driver probed\n" );return devm_of_platform_populate (dev);drivers/tty/serial/qcom_geni_serial.c +6
-0@@ -1090,6 +1090,12 @@ static void qcom_geni_serial_earlycon_write(struct console *con,__qcom_geni_serial_console_write (&dev->port, s, n); } +static int qcom_geni_serial_earlycon_exit (struct console *con) +{ +geni_remove_earlycon_icc_vote (); +return 0 ; +} +static int __init qcom_geni_serial_earlycon_setup (struct earlycon_device *dev,const char *opt) {
drivers/tty/serial/qcom_geni_serial.c static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev, · line 1144
Quoted 4 lines
drivers/tty/serial/qcom_geni_serial.c +1
-0@@ -1135,6 +1141,7 @@ static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev,writel (stop_bit_len, uport->membase +SE_UART_TX_STOP_BIT_LEN ); dev->con->write = qcom_geni_serial_earlycon_write; + dev->con->exit = qcom_geni_serial_earlycon_exit;
The idea of using the exit handler of the early console to remove the votes seemed appealing at first, however it has a drawback: the bandwidth requests in geni_se_probe() are always made when CONFIG_SERIAL_EARLYCON=y, also when the system doesn't actually use an early console. On such a system the votes would never be removed.
A possible alternative could seem to remove the vote at the end of qcom_geni_serial_probe() of the 'normal' console, but it has a similar
problem: the system could not even have a normal console. One could possibly argue that CONFIG_SERIAL_QCOM_GENI_CONSOLE shouldn't be set on such a system, however it could be enabled to have a console for development, and in production the same kernel config is used, but with the console disabled through the device tree.
I don't really have a good idea at this point, maybe we just need something as ugly as a delayed work to remove the votes. Other suggestions are welcome :)
Re: [PATCH V4 4/9] soc: qcom-geni-se: Add interconnect support to fix earlycon crash
Hi Matthias,
Quoted 143 lines · Matthias Kaehlcke
Hi Akash,
Quoted 122 lines · Akash Asthana
QUP core clock is shared among all the SE drivers present on particular QUP wrapper, the system will reset(unclocked access) if earlycon used after QUP core clock is put to 0 from other SE drivers before real console comes up.
As earlycon can't vote for it's QUP core need, to fix this add ICC support to common/QUP wrapper driver and put vote for QUP core from probe on behalf of earlycon and remove vote during earlycon exit call.
Signed-off-by Akash Asthana <[email protected]>Reported-by Matthias Kaehlcke <[email protected]>---
Change in V3:
- Addgeni_remove_earlycon_icc_voteAPI that will be used by earlycon exit function to remove ICC vote for earlyconsole.
- Remove suspend/resume hook for geni-se driver as we are no longer removing earlyconsole ICC vote from system suspend, we are removing from earlycon exit.Change in V4:
- As per Matthias comment make 'earlycon_wrapper' as static structure.drivers/soc/qcom/qcom-geni-se.c | 50 +++++++++++++++++++++++++++++++++++ drivers/tty/serial/qcom_geni_serial.c | 7 +++++ include/linux/qcom-geni-se.h | 2 ++ 3 files changed, 59 insertions(+)drivers/soc/qcom/qcom-geni-se.c +50
-0@@ -90,8 +90,11 @@ struct geni_wrapper {struct device *dev;void __iomem *base;struct clk_bulk_data ahb_clks[NUM_AHB_CLKS ]; +struct geni_icc_path to_core; }; +static struct geni_wrapper *earlycon_wrapper; +#define QUP_HW_VER_REG 0x4/* Common SE registers */ @@ -781,6 +784,26 @@ int geni_icc_vote_off(struct geni_se *se) }EXPORT_SYMBOL (geni_icc_vote_off); +void geni_remove_earlycon_icc_vote (void ) +{ +struct geni_wrapper *wrapper = earlycon_wrapper; +struct device_node *parent =of_get_next_parent (wrapper->dev->of_node); +struct device_node *child; + +for_each_child_of_node (parent, child) { +if (of_device_is_compatible (child,"qcom,geni-se-qup" )) { + wrapper =platform_get_drvdata (of_find_device_by_node ( + child)); +icc_put (wrapper->to_core.path); + wrapper->to_core.path =NULL ; + } + } +of_node_put (parent); + + earlycon_wrapper =NULL ; +} +EXPORT_SYMBOL (geni_remove_earlycon_icc_vote); +static int geni_se_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;@@ -808,6 +831,33 @@ static int geni_se_probe(struct platform_device *pdev) } } +#ifdef CONFIG_SERIAL_EARLYCON + wrapper->to_core.path =devm_of_icc_get (dev,"qup-core" ); +if (IS_ERR (wrapper->to_core.path)) +return PTR_ERR (wrapper->to_core.path); +/* +* Put minmal BW request on core clocks on behalf of early console. +* The vote will be removed earlycon exit function. +* +* Note: We are putting vote on each QUP wrapper instead only to which +* earlycon is connected because QUP core clock of different wrapper +* share same voltage domain. If core1 is put to 0, then core2 will +* also run at 0, if not voted. Default ICC vote will be removed ASA +* we touch any of the core clock. +* core1 = core2 = max(core1, core2) +*/ + ret =icc_set_bw (wrapper->to_core.path,GENI_DEFAULT_BW ,0 ); +if (ret) { +dev_err (&pdev->dev,"%s: ICC BW voting failed for core\n" , + __func__); +return ret; + } + +if (of_get_compatible_child (pdev->dev.of_node,"qcom,geni-debug-uart" )) + earlycon_wrapper = wrapper; +of_node_put (pdev->dev.of_node); +#endif +dev_set_drvdata (dev, wrapper);dev_dbg (dev,"GENI SE Driver probed\n" );return devm_of_platform_populate (dev);drivers/tty/serial/qcom_geni_serial.c +6
-0@@ -1090,6 +1090,12 @@ static void qcom_geni_serial_earlycon_write(struct console *con,__qcom_geni_serial_console_write (&dev->port, s, n); } +static int qcom_geni_serial_earlycon_exit (struct console *con) +{ +geni_remove_earlycon_icc_vote (); +return 0 ; +} +static int __init qcom_geni_serial_earlycon_setup (struct earlycon_device *dev,const char *opt) {drivers/tty/serial/qcom_geni_serial.c static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev, · line 1144
Quoted 4 lines
drivers/tty/serial/qcom_geni_serial.c +1
-0@@ -1135,6 +1141,7 @@ static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev,writel (stop_bit_len, uport->membase +SE_UART_TX_STOP_BIT_LEN ); dev->con->write = qcom_geni_serial_earlycon_write; + dev->con->exit = qcom_geni_serial_earlycon_exit;The idea of using the exit handler of the early console to remove the votes seemed appealing at first, however it has a drawback: the bandwidth requests in
geni_se_probe()are always made whenCONFIG_SERIAL_EARLYCON=y, also when the system doesn't actually use an early console. On such a system the votes would never be removed.A possible alternative could seem to remove the vote at the end of
qcom_geni_serial_probe()of the 'normal' console, but it has a similar
problem: the system could not even have a normal console. One could possibly argue thatCONFIG_SERIAL_QCOM_GENI_CONSOLEshouldn't be set on such a system, however it could be enabled to have a console for development, and in production the same kernel config is used, but with the console disabled through the device tree.
Quoted 3 lines
I don't really have a good idea at this point, maybe we just need something as ugly as a delayed work to remove the votes. Other suggestions are welcome :)
I think we can do something like below. Before voting we are checking whether earlyconsole ("qcom_geni") exits or not. The name is fixed from earlycon declaration file@drivers/tty/serial/qcom_geni_serial.c
OF_EARLYCON_DECLARE(qcom_geni, "qcom,geni-debug-uart", qcom_geni_serial_earlycon_setup);
====================================================================================
@@ -809,6 +809,8 @@ static int geni_se_probe(struct platform_device *pdev) struct device *dev = &pdev->dev;
struct resource *res;
struct geni_wrapper *wrapper;
+ struct console *bcon = NULL;
+ int earlycon_present = 0;
int ret;
wrapper = devm_kzalloc(dev, sizeof(*wrapper), GFP_KERNEL); @@ -832,6 +834,15 @@ static int geni_se_probe(struct platform_device *pdev) }
#ifdef CONFIG_SERIAL_EARLYCON
+ if (console_drivers)
+ for_each_console(bcon)
+ if (!strcmp(bcon->name, "qcom_geni")) { + earlycon_present = 1;
+ break;
+ }
+ if(!earlycon_present)
+ goto exit;
+
wrapper->to_core.path = devm_of_icc_get(dev, "qup-core"); if (IS_ERR(wrapper->to_core.path))
return PTR_ERR(wrapper->to_core.path);
@@ -858,6 +869,7 @@ static int geni_se_probe(struct platform_device *pdev) of_node_put(pdev->dev.of_node);
#endif
+exit:
dev_set_drvdata(dev, wrapper);
dev_dbg(dev, "GENI SE Driver probed\n");
return devm_of_platform_populate(dev);
======================================================================================
Regards,
Akash
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Re: [PATCH V4 4/9] soc: qcom-geni-se: Add interconnect support to fix earlycon crash
Hi Akash,
Quoted 6 lines · Akash Asthana
Hi Matthias,
Quoted 3 lines · Matthias Kaehlcke
Hi Akash,
On Wed, Apr 15, 2020 at 03:53:13PM +0530, Akash Asthana wrote:
...
Quoted 48 lines
Quoted 34 lines
Quoted 17 lines
drivers/tty/serial/qcom_geni_serial.c +6
-0@@ -1090,6 +1090,12 @@ static void qcom_geni_serial_earlycon_write(struct console *con,__qcom_geni_serial_console_write (&dev->port, s, n); } +static int qcom_geni_serial_earlycon_exit (struct console *con) +{ +geni_remove_earlycon_icc_vote (); +return 0 ; +} +static int __init qcom_geni_serial_earlycon_setup (struct earlycon_device *dev,const char *opt) {drivers/tty/serial/qcom_geni_serial.c static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev, · line 1143
Quoted 3 lines
drivers/tty/serial/qcom_geni_serial.c +1
-0@@ -1135,6 +1141,7 @@ static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev,writel (stop_bit_len, uport->membase +SE_UART_TX_STOP_BIT_LEN ); dev->con->write = qcom_geni_serial_earlycon_write; + dev->con->exit = qcom_geni_serial_earlycon_exit;The idea of using the exit handler of the early console to remove the votes seemed appealing at first, however it has a drawback: the bandwidth requests in
geni_se_probe()are always made whenCONFIG_SERIAL_EARLYCON=y, also when the system doesn't actually use an early console. On such a system the votes would never be removed.A possible alternative could seem to remove the vote at the end of
qcom_geni_serial_probe()of the 'normal' console, but it has a similar
problem: the system could not even have a normal console. One could possibly argue thatCONFIG_SERIAL_QCOM_GENI_CONSOLEshouldn't be set on such a system, however it could be enabled to have a console for development, and in production the same kernel config is used, but with the console disabled through the device tree.Quoted 3 lines
I don't really have a good idea at this point, maybe we just need something as ugly as a delayed work to remove the votes. Other suggestions are welcome :)
I think we can do something like below. Before voting we are checking whether earlyconsole ("
qcom_geni") exits or not. The name is fixed from earlycon declarationfile@drivers/tty/serial/qcom_geni_serial.c
OF_EARLYCON_DECLARE(qcom_geni, "qcom,geni-debug-uart", qcom_geni_serial_earlycon_setup);====================================================================================
Review static int geni_se_probe(struct platform_device *pdev) · line 812
Quoted 4 lines
(quoted diff) +1
-0@@ -809,6 +809,8 @@ static int geni_se_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct resource *res; struct geni_wrapper *wrapper; + struct console *bcon = NULL;
nit: initialization is not needed
Quoted 22 lines
drivers/soc/qcom/qcom-geni-se.c +10
-0+ int earlycon_present = 0; int ret; wrapper = devm_kzalloc(dev, sizeof(*wrapper), GFP_KERNEL);@@ -832,6 +834,15 @@ static int geni_se_probe(struct platform_device *pdev) } #ifdef CONFIG_SERIAL_EARLYCON + if (console_drivers) + for_each_console(bcon) + if (!strcmp(bcon->name, "qcom_geni")) { + earlycon_present = 1; + break; + } + if(!earlycon_present) + goto exit; + wrapper->to_core.path = devm_of_icc_get(dev, "qup-core"); if (IS_ERR(wrapper->to_core.path)) return PTR_ERR(wrapper->to_core.path);
drivers/soc/qcom/qcom-geni-se.c static int geni_se_probe(struct platform_device *pdev) · line 875
Quoted 7 lines
drivers/soc/qcom/qcom-geni-se.c +1
-0@@ -858,6 +869,7 @@ static int geni_se_probe(struct platform_device *pdev) of_node_put(pdev->dev.of_node); #endif +exit: dev_set_drvdata(dev, wrapper); dev_dbg(dev, "GENI SE Driver probed\n"); return devm_of_platform_populate(dev);
This should work as long as the early console is always set up before geni_se is probed, which seems a safe assumption.
PATCH v4 5/9 i2c: i2c-qcom-geni: Add interconnect support
In reply to Akash AsthanaGet the interconnect paths for I2C based Serial Engine device and vote according to the bus speed of the driver.
---
Changes in V2:
- As per Bjorn's comment, removed se == NULL check from geni_i2c_icc_get
- As per Bjorn's comment, removed code to set se->icc_path* to NULL in failure
- As per Bjorn's comment, introduced and using devm_of_icc_get API for getting path handle
- As per Matthias comment, added error handling for icc_set_bw call
Changes in V3:
- As per Matthias comment, use common library APIs defined in geni-se driver for ICC functionality.
Changes in V4:
- Move peak_bw guess as twice of avg_bw if nothing mentioned explicitly to ICC core.
drivers/i2c/busses/i2c-qcom-geni.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-qcom-geni.c +25 -1
@@ -557,6 +557,22 @@ static int geni_i2c_probe(struct platform_device *pdev) gi2c->adap.dev.of_node = dev->of_node;strlcpy (gi2c->adap.name,"Geni-I2C" ,sizeof (gi2c->adap.name)); + ret =geni_icc_get (&gi2c->se,"qup-memory" ); +if (ret) +return ret; +/* +* Set the bus quota for core and cpu to a reasonable value for +* register access. +* Set quota for DDR based on bus speed. +*/ + gi2c->se.icc_paths[0 ].avg_bw =GENI_DEFAULT_BW ; + gi2c->se.icc_paths[1 ].avg_bw =GENI_DEFAULT_BW ; + gi2c->se.icc_paths[2 ].avg_bw =Bps_to_icc (gi2c->clk_freq_out); + + ret =geni_icc_vote_on (&gi2c->se); +if (ret) +return ret; + ret =geni_se_resources_on (&gi2c->se);if (ret) {dev_err (dev,"Error turning on resources %d\n" , ret);
@@ -579,6 +595,10 @@ static int geni_i2c_probe(struct platform_device *pdev)return ret; } + ret =geni_icc_vote_off (&gi2c->se); +if (ret) +return ret; +dev_dbg (dev,"i2c fifo/se-dma mode. fifo depth:%d\n" , tx_depth); gi2c->suspended =1 ;
@@ -623,7 +643,7 @@ static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev) gi2c->suspended =1 ; } -return 0 ; +return geni_icc_vote_off (&gi2c->se); }static int __maybe_unused geni_i2c_runtime_resume (struct device *dev)
@@ -631,6 +651,10 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev)int ret;struct geni_i2c_dev *gi2c =dev_get_drvdata (dev); + ret =geni_icc_vote_on (&gi2c->se); +if (ret) +return ret; + ret =geni_se_resources_on (&gi2c->se);if (ret)return ret;
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Re: [PATCH V4 5/9] i2c: i2c-qcom-geni: Add interconnect support
Hi Akash,
Quoted 32 lines · Akash Asthana
Get the interconnect paths for I2C based Serial Engine device and vote according to the bus speed of the driver.
Signed-off-by Akash Asthana <[email protected]>---
Changes in V2:
- As per Bjorn's comment, removed se == NULL check fromgeni_i2c_icc_get
- As per Bjorn's comment, removed code to set se->icc_path* to NULL in failure
- As per Bjorn's comment, introduced and usingdevm_of_icc_getAPI for getting path handle
- As per Matthias comment, added error handling foricc_set_bwcallChanges in V3:
- As per Matthias comment, use common library APIs defined in geni-se driver for ICC functionality.Changes in V4:
- Movepeak_bwguess as twice ofavg_bwif nothing mentioned explicitly to ICC core.drivers/i2c/busses/i2c-qcom-geni.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)drivers/i2c/busses/i2c-qcom-geni.c +1
-0@@ -557,6 +557,22 @@ static int geni_i2c_probe(struct platform_device *pdev) gi2c->adap.dev.of_node = dev->of_node;strlcpy (gi2c->adap.name,"Geni-I2C" ,sizeof (gi2c->adap.name)); + ret =geni_icc_get (&gi2c->se,"qup-memory" );
drivers/i2c/busses/i2c-qcom-geni.c static int geni_i2c_probe(struct platform_device *pdev) · line 570
Quoted 10 lines
drivers/i2c/busses/i2c-qcom-geni.c +10
-0+if (ret) +return ret; +/* +* Set the bus quota for core and cpu to a reasonable value for +* register access. +* Set quota for DDR based on bus speed. +*/ + gi2c->se.icc_paths[0 ].avg_bw =GENI_DEFAULT_BW ; + gi2c->se.icc_paths[1 ].avg_bw =GENI_DEFAULT_BW ; + gi2c->se.icc_paths[2 ].avg_bw =Bps_to_icc (gi2c->clk_freq_out);
As commented on patch "soc: qcom: geni: Support for ICC voting" the use of literals to index the paths isn't very clear, please use enums.
PATCH v4 6/9 spi: spi-geni-qcom: Add interconnect support
In reply to Akash AsthanaGet the interconnect paths for SPI based Serial Engine device and vote according to the current bus speed of the driver.
---
Changes in V2:
- As per Bjorn's comment, removed se == NULL check from geni_spi_icc_get
- As per Bjorn's comment, removed code to set se->icc_path* to NULL in failure
- As per Bjorn's comment, introduced and using devm_of_icc_get API for getting path handle
- As per Matthias comment, added error handling for icc_set_bw call
Changes in V3:
- As per Matthias's comment, use helper ICC function from geni-se driver.
Changes in V4:
- Move peak_bw guess as twice of avg_bw if nothing mentioned explicitly to ICC core.
drivers/spi/spi-geni-qcom.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/spi/spi-geni-qcom.c +24 -1
@@ -234,6 +234,12 @@ static int setup_fifo_params(struct spi_device *spi_slv,return ret; } +/* Set BW quota for CPU as driver supports FIFO mode only. */ + se->icc_paths[1 ].avg_bw =Bps_to_icc (mas->cur_speed_hz); + ret =geni_icc_vote_on (se); +if (ret) +return ret; + clk_sel = idx &CLK_SEL_MSK ; m_clk_cfg = (div <<CLK_DIV_SHFT ) |SER_CLK_EN ;spi_setup_word_len (mas, spi_slv->mode, spi_slv->bits_per_word);
@@ -578,6 +584,13 @@ static int spi_geni_probe(struct platform_device *pdev)spin_lock_init (&mas->lock);pm_runtime_enable (dev); + ret =geni_icc_get (&mas->se,NULL ); +if (ret) + goto spi_geni_probe_runtime_disable; +/* Set the bus quota to a reasonable value for register access */ + mas->se.icc_paths[0 ].avg_bw =Bps_to_icc (CORE_2X_50_MHZ ); + mas->se.icc_paths[1 ].avg_bw =GENI_DEFAULT_BW ; + ret =spi_geni_init (mas);if (ret) goto spi_geni_probe_runtime_disable;
@@ -616,14 +629,24 @@ static int __maybe_unused spi_geni_runtime_suspend(struct device *dev) {struct spi_master *spi =dev_get_drvdata (dev);struct spi_geni_master *mas =spi_master_get_devdata (spi); +int ret; -return geni_se_resources_off (&mas->se); + ret =geni_se_resources_off (&mas->se); +if (ret) +return ret; + +return geni_icc_vote_off (&mas->se); }static int __maybe_unused spi_geni_runtime_resume (struct device *dev) {struct spi_master *spi =dev_get_drvdata (dev);struct spi_geni_master *mas =spi_master_get_devdata (spi); +int ret; + + ret =geni_icc_vote_on (&mas->se); +if (ret) +return ret;return geni_se_resources_on (&mas->se); }
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Re: [PATCH V4 6/9] spi: spi-geni-qcom: Add interconnect support
Quoted 2 lines · Akash Asthana
Get the interconnect paths for SPI based Serial Engine device and vote according to the current bus speed of the driver.
PATCH v4 7/9 tty: serial: qcom_geni_serial: Add interconnect support
In reply to Akash AsthanaGet the interconnect paths for Uart based Serial Engine device and vote according to the baud rate requirement of the driver.
---
Changes in V2:
- As per Bjorn's comment, removed se == NULL check from geni_serial_icc_get
- As per Bjorn's comment, removed code to set se->icc_path* to NULL in failure
- As per Bjorn's comment, introduced and using devm_of_icc_get API for getting path handle
- As per Matthias comment, added error handling for icc_set_bw call
Changes in V3:
- As per Matthias comment, use common library APIs defined in geni-se driver for ICC functionality.
Changes in V4:
- As per Mark's comment move peak_bw guess as twice of avg_bw if nothing mentioned explicitly to ICC core.
- As per Matthias's comment select core clock BW based on baud rate. If it's less than 115200 go for GENI_DEFAULT_BW else CORE_2X_50_MHZ
drivers/tty/serial/qcom_geni_serial.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/tty/serial/qcom_geni_serial.c +22 -3
@@ -965,6 +965,15 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, ser_clk_cfg =SER_CLK_EN ; ser_clk_cfg |= clk_div <<CLK_DIV_SHFT ; +/* +* Bump up BW vote on CPU and CORE path as driver supports FIFO mode +* only. +*/ + port->se.icc_paths[0 ].avg_bw = (baud >115200 ) ? +Bps_to_icc (CORE_2X_50_MHZ ) :GENI_DEFAULT_BW ; + port->se.icc_paths[1 ].avg_bw =Bps_to_icc (baud); +geni_icc_vote_on (&port->se); +/* parity */ tx_trans_cfg =readl (uport->membase +SE_UART_TX_TRANS_CFG ); tx_parity_cfg =readl (uport->membase +SE_UART_TX_PARITY_CFG );
@@ -1202,11 +1211,14 @@ static void qcom_geni_serial_pm(struct uart_port *uport,if (old_state ==UART_PM_STATE_UNDEFINED ) old_state =UART_PM_STATE_OFF ; -if (new_state ==UART_PM_STATE_ON && old_state ==UART_PM_STATE_OFF ) +if (new_state ==UART_PM_STATE_ON && old_state ==UART_PM_STATE_OFF ) { +geni_icc_vote_on (&port->se);geni_se_resources_on (&port->se); -else if (new_state ==UART_PM_STATE_OFF && - old_state ==UART_PM_STATE_ON ) + }else if (new_state ==UART_PM_STATE_OFF && + old_state ==UART_PM_STATE_ON ) {geni_se_resources_off (&port->se); +geni_icc_vote_off (&port->se); + } }static const struct uart_ops qcom_geni_console_pops = {
@@ -1304,6 +1316,13 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)return -ENOMEM ; } + ret =geni_icc_get (&port->se,NULL ); +if (ret) +return ret; +/* Set the bus quota to a reasonable value for register access */ + port->se.icc_paths[0 ].avg_bw =GENI_DEFAULT_BW ; + port->se.icc_paths[1 ].avg_bw =GENI_DEFAULT_BW ; + port->name =devm_kasprintf (uport->dev,GFP_KERNEL ,"qcom_geni_serial_%s%d" ,uart_console (uport) ?"console" :"uart" , uport->line);
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Re: [PATCH V4 7/9] tty: serial: qcom_geni_serial: Add interconnect support
Quoted 30 lines · Akash Asthana
Get the interconnect paths for Uart based Serial Engine device and vote according to the baud rate requirement of the driver.
Signed-off-by Akash Asthana <[email protected]>---
Changes in V2:
- As per Bjorn's comment, removed se == NULL check fromgeni_serial_icc_get
- As per Bjorn's comment, removed code to set se->icc_path* to NULL in failure
- As per Bjorn's comment, introduced and usingdevm_of_icc_getAPI for getting path handle
- As per Matthias comment, added error handling foricc_set_bwcallChanges in V3:
- As per Matthias comment, use common library APIs defined in geni-se driver for ICC functionality.Changes in V4:
- As per Mark's comment movepeak_bwguess as twice ofavg_bwif nothing mentioned explicitly to ICC core.
- As per Matthias's comment select core clock BW based on baud rate. If it's less than 115200 go forGENI_DEFAULT_BWelseCORE_2X_50_MHZdrivers/tty/serial/qcom_geni_serial.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)drivers/tty/serial/qcom_geni_serial.c +0
-0
drivers/tty/serial/qcom_geni_serial.c static void qcom_geni_serial_set_termios(struct uart_port *uport, · line 974
Quoted 10 lines
drivers/tty/serial/qcom_geni_serial.c +7
-0@@ -965,6 +965,15 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, ser_clk_cfg =SER_CLK_EN ; ser_clk_cfg |= clk_div <<CLK_DIV_SHFT ; +/* +* Bump up BW vote on CPU and CORE path as driver supports FIFO mode +* only. +*/ + port->se.icc_paths[0 ].avg_bw = (baud >115200 ) ? +Bps_to_icc (CORE_2X_50_MHZ ) :GENI_DEFAULT_BW ; + port->se.icc_paths[1 ].avg_bw =Bps_to_icc (baud);
use enums to index the paths
Quoted 24 lines
drivers/tty/serial/qcom_geni_serial.c +8
-3+geni_icc_vote_on (&port->se); +/* parity */ tx_trans_cfg =readl (uport->membase +SE_UART_TX_TRANS_CFG ); tx_parity_cfg =readl (uport->membase +SE_UART_TX_PARITY_CFG );@@ -1202,11 +1211,14 @@ static void qcom_geni_serial_pm(struct uart_port *uport,if (old_state ==UART_PM_STATE_UNDEFINED ) old_state =UART_PM_STATE_OFF ; -if (new_state ==UART_PM_STATE_ON && old_state ==UART_PM_STATE_OFF ) +if (new_state ==UART_PM_STATE_ON && old_state ==UART_PM_STATE_OFF ) { +geni_icc_vote_on (&port->se);geni_se_resources_on (&port->se); -else if (new_state ==UART_PM_STATE_OFF && - old_state ==UART_PM_STATE_ON ) + }else if (new_state ==UART_PM_STATE_OFF && + old_state ==UART_PM_STATE_ON ) {geni_se_resources_off (&port->se); +geni_icc_vote_off (&port->se); + } }static const struct uart_ops qcom_geni_console_pops = {
drivers/tty/serial/qcom_geni_serial.c static int qcom_geni_serial_probe(struct platform_device *pdev) · line 1324
Quoted 9 lines
drivers/tty/serial/qcom_geni_serial.c +6
-0@@ -1304,6 +1316,13 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)return -ENOMEM ; } + ret =geni_icc_get (&port->se,NULL ); +if (ret) +return ret; +/* Set the bus quota to a reasonable value for register access */ + port->se.icc_paths[0 ].avg_bw =GENI_DEFAULT_BW ; + port->se.icc_paths[1 ].avg_bw =GENI_DEFAULT_BW ;
The comment isn't very useful, the use of GENI_DEFAULT_BW essentially implies "a reasonable value". I suggest to drop it.
PATCH v4 8/9 spi: spi-qcom-qspi: Add interconnect support
In reply to Akash AsthanaGet the interconnect paths for QSPI device and vote according to the current bus speed of the driver.
Reviewed by: Matthias Kaehlcke <[email protected]>
---
Changes in V2:
- As per Bjorn's comment, introduced and using devm_of_icc_get API for getting path handle
- As per Matthias comment, added error handling for icc_set_bw call
Changes in V3:
- No Change.
Changes in V4:
- As per Mark's comment move peak_bw guess as twice of avg_bw if nothing mentioned explicitly to ICC core.
drivers/spi/spi-qcom-qspi.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-)
drivers/spi/spi-qcom-qspi.c +42 -1
@@ -2,6 +2,7 @@// Copyright (c) 2017-2018, The Linux foundation. All rights reserved. #include <linux/clk.h> +#include <linux/interconnect.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/module.h>
@@ -139,7 +140,10 @@ struct qcom_qspi {struct device *dev;struct clk_bulk_data *clks;struct qspi_xfer xfer; -/* Lock to protect xfer and IRQ accessed registers */ +struct icc_path *icc_path_cpu_to_qspi; +unsigned int avg_bw_cpu; +unsigned int peak_bw_cpu; +/* Lock to protect data accessed by IRQs */ spinlock_t lock; };
@@ -241,6 +245,16 @@ static int qcom_qspi_transfer_one(struct spi_master *master,return ret; } +/* Set BW quota for CPU as driver supports FIFO mode only. */ + ctrl->avg_bw_cpu =Bps_to_icc (speed_hz); + ret =icc_set_bw (ctrl->icc_path_cpu_to_qspi, ctrl->avg_bw_cpu, + ctrl->peak_bw_cpu); +if (ret) { +dev_err (ctrl->dev,"%s: ICC BW voting failed for cpu\n" , + __func__); +return ret; + } +spin_lock_irqsave (&ctrl->lock, flags);/* We are half duplex, so either rx or tx will be set */
@@ -458,6 +472,16 @@ static int qcom_qspi_probe(struct platform_device *pdev)if (ret) goto exit_probe_master_put; + ctrl->icc_path_cpu_to_qspi =devm_of_icc_get (dev,"qspi-config" ); +if (IS_ERR (ctrl->icc_path_cpu_to_qspi)) { + ret =PTR_ERR (ctrl->icc_path_cpu_to_qspi); +if (ret != -EPROBE_DEFER ) +dev_err (dev,"Failed to get cpu path, ret:%d\n" , ret); + goto exit_probe_master_put; + } +/* Put BW vote on CPU path for register access */ + ctrl->avg_bw_cpu =Bps_to_icc (1000 ); + ret =platform_get_irq (pdev,0 );if (ret <0 ) goto exit_probe_master_put;
@@ -511,9 +535,17 @@ static int __maybe_unused qcom_qspi_runtime_suspend(struct device *dev) {struct spi_master *master =dev_get_drvdata (dev);struct qcom_qspi *ctrl =spi_master_get_devdata (master); +int ret;clk_bulk_disable_unprepare (QSPI_NUM_CLKS , ctrl->clks); + ret =icc_set_bw (ctrl->icc_path_cpu_to_qspi,0 ,0 ); +if (ret) { +dev_err_ratelimited (ctrl->dev,"%s: ICC BW remove failed for cpu\n" , + __func__); +return ret; + } +return 0 ; }
@@ -521,6 +553,15 @@ static int __maybe_unused qcom_qspi_runtime_resume(struct device *dev) {struct spi_master *master =dev_get_drvdata (dev);struct qcom_qspi *ctrl =spi_master_get_devdata (master); +int ret; + + ret =icc_set_bw (ctrl->icc_path_cpu_to_qspi, ctrl->avg_bw_cpu, + ctrl->peak_bw_cpu); +if (ret) { +dev_err_ratelimited (ctrl->dev,"%s: ICC BW voting failed for cpu\n" , + __func__); +return ret; + }return clk_bulk_prepare_enable (QSPI_NUM_CLKS , ctrl->clks); }
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
PATCH v4 9/9 arm64: dts: sc7180: Add interconnect for QUP and QSPI
In reply to Akash AsthanaAdd interconnect ports for GENI QUPs and QSPI to set bus capabilities.
---
Changes in V2:
- As per Bjorn's comment, ignoring 80 char limit in defining interconnects paths.
Changes in V3:
- No change.
Change in V4:
- No change.
arch/arm64/boot/dts/qcom/sc7180.dtsi | 127 +++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+)
arch/arm64/boot/dts/qcom/sc7180.dtsi +127 -0
@@ -506,6 +506,8 @@ #size-cells = <2>; ranges; iommus = <&apps_smmu 0x43 0x0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>; + interconnect-names = "qup-core"; status = "disabled"; i2c0: i2c@880000 {
@@ -518,6 +520,11 @@ interrupts = <GIC_SPI 601 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>, + <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -531,6 +538,9 @@ interrupts = <GIC_SPI 601 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -542,6 +552,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart0_default>; interrupts = <GIC_SPI 601 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -555,6 +568,11 @@ interrupts = <GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>, + <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -568,6 +586,9 @@ interrupts = <GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -579,6 +600,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart1_default>; interrupts = <GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -592,6 +616,11 @@ interrupts = <GIC_SPI 603 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>, + <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -603,6 +632,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart2_default>; interrupts = <GIC_SPI 603 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -616,6 +648,11 @@ interrupts = <GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>, + <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -629,6 +666,9 @@ interrupts = <GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -640,6 +680,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart3_default>; interrupts = <GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -653,6 +696,11 @@ interrupts = <GIC_SPI 605 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>, + <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -664,6 +712,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart4_default>; interrupts = <GIC_SPI 605 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -677,6 +728,11 @@ interrupts = <GIC_SPI 606 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>, + <&aggre1_noc MASTER_QUP_0 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -690,6 +746,9 @@ interrupts = <GIC_SPI 606 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -701,6 +760,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart5_default>; interrupts = <GIC_SPI 606 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_0 &qup_virt SLAVE_QUP_CORE_0>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_0>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; }; };
@@ -715,6 +777,8 @@ #size-cells = <2>; ranges; iommus = <&apps_smmu 0x4c3 0x0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>; + interconnect-names = "qup-core"; status = "disabled"; i2c6: i2c@a80000 {
@@ -727,6 +791,11 @@ interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>, + <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -740,6 +809,9 @@ interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -751,6 +823,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart6_default>; interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -764,6 +839,11 @@ interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>, + <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -775,6 +855,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart7_default>; interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -788,6 +871,11 @@ interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>, + <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -801,6 +889,9 @@ interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -812,6 +903,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart8_default>; interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -825,6 +919,11 @@ interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>, + <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -836,6 +935,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart9_default>; interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -849,6 +951,11 @@ interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>, + <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -862,6 +969,9 @@ interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -873,6 +983,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart10_default>; interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -886,6 +999,11 @@ interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>, + <&aggre2_noc MASTER_QUP_1 &mc_virt SLAVE_EBI1>; + interconnect-names = "qup-core", "qup-config", + "qup-memory"; status = "disabled"; };
@@ -899,6 +1017,9 @@ interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
@@ -910,6 +1031,9 @@ pinctrl-names = "default"; pinctrl-0 = <&qup_uart11_default>; interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&qup_virt MASTER_QUP_CORE_1 &qup_virt SLAVE_QUP_CORE_1>, + <&gem_noc MASTER_APPSS_PROC &config_noc SLAVE_QUP_1>; + interconnect-names = "qup-core", "qup-config"; status = "disabled"; }; };
@@ -1414,6 +1538,9 @@ clocks = <&gcc GCC_QSPI_CNOC_PERIPH_AHB_CLK>, <&gcc GCC_QSPI_CORE_CLK>; clock-names = "iface", "core"; + interconnects = <&gem_noc MASTER_APPSS_PROC + &config_noc SLAVE_QSPI_0>; + interconnect-names = "qspi-config"; status = "disabled"; };
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project