net: ipa: add support for IPA v3.1
Subsystems (5)
cover net: ipa: add support for IPA v3.1
This series adds support for IPA v3.1, used by the Qualcomm Snapdragon 835 (MSM8998).
The first patch adds "qcom,msm8998-ipa" to the DT binding.
The next four patches add code to ensure correct operation on IPA v3.1:
- Avoid touching unsupported inter-EE interrupt mask registers
- Set the proper flags in the clock configuration register
- Work around the lack of an IPA FLAVOR_0 register
- Work around the lack of a GSI PARAM_2 register
The last patch defines configuration data for this version of IPA.
Many thanks are due to AngeloGioacchino Del Regno and Jami Kettunen, both associated with SoMainline. Angelo first posted code to implement most of what was required for this, and Jami has been helpful testing these changes on his hardware.
-Alex
Alex Elder (6):
dt-bindings: net: qcom,ipa: add support for MSM8998
net: ipa: inter-EE interrupts aren't always available
net: ipa: disable misc clock gating for IPA v3.1
net: ipa: FLAVOR_0 register doesn't exist until IPA v3.5
net: ipa: introduce gsi_ring_setup()
net: ipa: add IPA v3.1 configuration data
.../devicetree/bindings/net/qcom,ipa.yaml | 1 + drivers/net/ipa/Makefile | 6 +- drivers/net/ipa/gsi.c | 90 ++- drivers/net/ipa/gsi.h | 2 +- drivers/net/ipa/gsi_reg.h | 3 +- drivers/net/ipa/ipa_data-v3.1.c | 533 ++++++++++++++++++ drivers/net/ipa/ipa_data.h | 1 + drivers/net/ipa/ipa_endpoint.c | 15 + drivers/net/ipa/ipa_main.c | 18 +- 9 files changed, 629 insertions(+), 40 deletions(-) create mode 100644 drivers/net/ipa/ipa_data-v3.1.c
Signature · 1 line
2.27.0
PATCH 1/6 dt-bindings: net: qcom,ipa: add support for MSM8998
Add support for "qcom,msm8998-ipa", which uses IPA v3.1.
Originally proposed by AngeloGioacchino Del Regno.
--- Documentation/devicetree/bindings/net/qcom,ipa.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/qcom,ipa.yaml +1 -0
@@ -44,6 +44,7 @@ description: properties: compatible: enum: + - qcom,msm8998-ipa - qcom,sc7180-ipa - qcom,sc7280-ipa - qcom,sdm845-ipa
Signature · 1 line
2.27.0
PATCH 2/6 net: ipa: inter-EE interrupts aren't always available
In reply to Alex ElderThe GSI inter-EE interrupts are not supported prior to IPA v3.5. Don't attempt to initialize them in gsi_irq_setup() for hardware that does not support them.
Originally proposed by AngeloGioacchino Del Regno.
--- drivers/net/ipa/gsi.c | 13 ++++++++++--- drivers/net/ipa/gsi_reg.h | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/ipa/gsi.c +10 -3
@@ -210,9 +210,16 @@ static void gsi_irq_setup(struct gsi *gsi)iowrite32 (0 , gsi->virt +GSI_CNTXT_GLOB_IRQ_EN_OFFSET );iowrite32 (0 , gsi->virt +GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET ); -/* The inter-EE registers are in the non-adjusted address range */ -iowrite32 (0 , gsi->virt_raw +GSI_INTER_EE_SRC_CH_IRQ_MSK_OFFSET ); -iowrite32 (0 , gsi->virt_raw +GSI_INTER_EE_SRC_EV_CH_IRQ_MSK_OFFSET ); +/* The inter-EE interrupts are not supported for IPA v3.0-v3.1 */ +if (gsi->version >IPA_VERSION_3_1 ) { +u32 offset; + +/* These registers are in the non-adjusted address range */ + offset =GSI_INTER_EE_SRC_CH_IRQ_MSK_OFFSET ; +iowrite32 (0 , gsi->virt_raw + offset); + offset =GSI_INTER_EE_SRC_EV_CH_IRQ_MSK_OFFSET ; +iowrite32 (0 , gsi->virt_raw + offset); + }iowrite32 (0 , gsi->virt +GSI_CNTXT_GSI_IRQ_EN_OFFSET ); }
drivers/net/ipa/gsi_reg.h +2 -1
@@ -52,7 +52,8 @@*/ #define GSI_EE_REG_ADJUST 0x0000d000/* IPA v4.5+ */ -/* The two inter-EE IRQ register offsets are relative to gsi->virt_raw */ +/* The inter-EE IRQ registers are relative to gsi->virt_raw (IPA v3.5+) */ +#define GSI_INTER_EE_SRC_CH_IRQ_MSK_OFFSET \ GSI_INTER_EE_N_SRC_CH_IRQ_MSK_OFFSET(GSI_EE_AP)#define GSI_INTER_EE_N_SRC_CH_IRQ_MSK_OFFSET (ee) \
Signature · 1 line
2.27.0
Re: [PATCH net-next 2/6] net: ipa: inter-EE interrupts aren't always available
Il 21/06/21 19:56, Alex Elder ha scritto:
Quoted 8 lines
The GSI inter-EE interrupts are not supported prior to IPA v3.5. Don't attempt to initialize them in
gsi_irq_setup()for hardware that does not support them.Originally proposed by AngeloGioacchino Del Regno.
PATCH 3/6 net: ipa: disable misc clock gating for IPA v3.1
In reply to Alex ElderFor IPA v3.1, a workaround is needed to disable gating on a MISC clock. I have no further explanation, but this is what the downstream code (msm-4.4) does.
This was suggested in a patch from AngeloGioacchino Del Regno.
--- drivers/net/ipa/ipa_main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ipa/ipa_main.c +9 -5
@@ -400,16 +400,20 @@ static void ipa_hardware_config(struct ipa *ipa, const struct ipa_data *data)/* Implement some hardware workarounds */ if (version >=IPA_VERSION_4_0 && version <IPA_VERSION_4_5 ) { -/* Enable open global clocks (not needed for IPA v4.5) */ - val =GLOBAL_FMASK ; - val |=GLOBAL_2X_CLK_FMASK ; -iowrite32 (val, ipa->reg_virt +IPA_REG_CLKON_CFG_OFFSET ); -/* Disable PA mask to allow HOLB drop */ val =ioread32 (ipa->reg_virt +IPA_REG_TX_CFG_OFFSET ); val &= ~PA_MASK_EN_FMASK ;iowrite32 (val, ipa->reg_virt +IPA_REG_TX_CFG_OFFSET ); + +/* Enable open global clocks in the CLKON configuration */ + val =GLOBAL_FMASK |GLOBAL_2X_CLK_FMASK ; + }else if (version ==IPA_VERSION_3_1 ) { + val =MISC_FMASK ;/* Disable MISC clock gating */ + }else { + val =0 ;/* No CLKON configuration needed */ } +if (val) +iowrite32 (val, ipa->reg_virt +IPA_REG_CLKON_CFG_OFFSET );ipa_hardware_config_comp (ipa);
Signature · 1 line
2.27.0
Re: [PATCH net-next 3/6] net: ipa: disable misc clock gating for IPA v3.1
Il 21/06/21 19:56, Alex Elder ha scritto:
Quoted 8 lines
For IPA v3.1, a workaround is needed to disable gating on a MISC clock. I have no further explanation, but this is what the downstream code (msm-4.4) does.
This was suggested in a patch from AngeloGioacchino Del Regno.
PATCH 4/6 net: ipa: FLAVOR_0 register doesn't exist until IPA v3.5
In reply to Alex ElderThe FLAVOR_0 version first appears in IPA v3.5, so avoid attempting to read it for versions prior to that.
This register contains a concise definition of the number and direction of endpoints supported by the hardware, and without it we can't verify endpoint configuration in ipa_endpoint_config(). In this case, just indicate that any endpoint number is available for use.
Originally proposed by AngeloGioacchino Del Regno.
--- drivers/net/ipa/ipa_endpoint.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/net/ipa/ipa_endpoint.c +15 -0
@@ -1731,6 +1731,21 @@ int ipa_endpoint_config(struct ipa *ipa)u32 max;u32 val; +/* Prior to IPAv3.5, the FLAVOR_0 register was not supported. +* Furthermore, the endpoints were not grouped such that TX +* endpoint numbers started with 0 and RX endpoints had numbers +* higher than all TX endpoints, so we can't do the simple +* direction check used for newer hardware below. +* +* For hardware that doesn't support the FLAVOR_0 register, +* just set the available mask to support any endpoint, and +* assume the configuration is valid. +*/ +if (ipa->version <IPA_VERSION_3_5 ) { + ipa->available = ~0 ; +return 0 ; + } +/* Find out about the endpoints supplied by the hardware, and ensure * the highest one doesn't exceed the number we support. */
Signature · 1 line
2.27.0
Re: [PATCH net-next 4/6] net: ipa: FLAVOR_0 register doesn't exist until IPA v3.5
Il 21/06/21 19:56, Alex Elder ha scritto:
Quoted 9 lines
The
FLAVOR_0version first appears in IPA v3.5, so avoid attempting to read it for versions prior to that.This register contains a concise definition of the number and direction of endpoints supported by the hardware, and without it we can't verify endpoint configuration in
ipa_endpoint_config(). In this case, just indicate that any endpoint number is available for use.
Quoted 4 lines
Originally proposed by AngeloGioacchino Del Regno.
PATCH 5/6 net: ipa: introduce gsi_ring_setup()
In reply to Alex ElderPrior to IPA v3.5.1, there is no HW_PARAM_2 GSI register, which we use to determine the number of channels and endpoints per execution environment. In that case, we will just assume the number supported is the maximum supported by the driver.
Introduce gsi_ring_setup() to encapsulate the code that determines the number of channels and endpoints.
Update GSI_EVT_RING_COUNT_MAX so it is big enough to handle any available channel for all supported hardware (IPA v4.9 can have 23 channels and 24 event rings).
--- drivers/net/ipa/gsi.c | 77 ++++++++++++++++++++++++++++--------------- drivers/net/ipa/gsi.h | 2 +- 2 files changed, 51 insertions(+), 28 deletions(-)
drivers/net/ipa/gsi.c +50 -27
@@ -224,6 +224,51 @@ static void gsi_irq_setup(struct gsi *gsi)iowrite32 (0 , gsi->virt +GSI_CNTXT_GSI_IRQ_EN_OFFSET ); } +/* Get # supported channel and event rings; there is no gsi_ring_teardown() */ +static int gsi_ring_setup (struct gsi *gsi) +{ +struct device *dev = gsi->dev; +u32 count; +u32 val; + +if (gsi->version <IPA_VERSION_3_5_1 ) { +/* No HW_PARAM_2 register prior to IPA v3.5.1, assume the max */ + gsi->channel_count =GSI_CHANNEL_COUNT_MAX ; + gsi->evt_ring_count =GSI_EVT_RING_COUNT_MAX ; + +return 0 ; + } + + val =ioread32 (gsi->virt +GSI_GSI_HW_PARAM_2_OFFSET ); + + count =u32_get_bits (val,NUM_CH_PER_EE_FMASK ); +if (!count) { +dev_err (dev,"GSI reports zero channels supported\n" ); +return -EINVAL ; + } +if (count >GSI_CHANNEL_COUNT_MAX ) { +dev_warn (dev,"limiting to %u channels; hardware supports %u\n" , +GSI_CHANNEL_COUNT_MAX , count); + count =GSI_CHANNEL_COUNT_MAX ; + } + gsi->channel_count = count; + + count =u32_get_bits (val,NUM_EV_PER_EE_FMASK ); +if (!count) { +dev_err (dev,"GSI reports zero event rings supported\n" ); +return -EINVAL ; + } +if (count >GSI_EVT_RING_COUNT_MAX ) { +dev_warn (dev, +"limiting to %u event rings; hardware supports %u\n" , +GSI_EVT_RING_COUNT_MAX , count); + count =GSI_EVT_RING_COUNT_MAX ; + } + gsi->evt_ring_count = count; + +return 0 ; +} +/* Event ring commands are performed one at a time. Their completion * is signaled by the event ring control GSI interrupt type, which is * only enabled when we issue an event ring command. Only the event
@@ -1834,43 +1879,21 @@ static void gsi_channel_teardown(struct gsi *gsi)/* Setup function for GSI. GSI firmware must be loaded and initialized */ int gsi_setup (struct gsi *gsi) { -struct device *dev = gsi->dev;u32 val; +int ret;/* Here is where we first touch the GSI hardware */ val =ioread32 (gsi->virt +GSI_GSI_STATUS_OFFSET );if (!(val &ENABLED_FMASK )) { -dev_err (dev,"GSI has not been enabled\n" ); +dev_err (gsi->dev,"GSI has not been enabled\n" );return -EIO ; }gsi_irq_setup (gsi);/* No matching teardown required */ - val =ioread32 (gsi->virt +GSI_GSI_HW_PARAM_2_OFFSET ); - - gsi->channel_count =u32_get_bits (val,NUM_CH_PER_EE_FMASK ); -if (!gsi->channel_count) { -dev_err (dev,"GSI reports zero channels supported\n" ); -return -EINVAL ; - } -if (gsi->channel_count >GSI_CHANNEL_COUNT_MAX ) { -dev_warn (dev, -"limiting to %u channels; hardware supports %u\n" , -GSI_CHANNEL_COUNT_MAX , gsi->channel_count); - gsi->channel_count =GSI_CHANNEL_COUNT_MAX ; - } - - gsi->evt_ring_count =u32_get_bits (val,NUM_EV_PER_EE_FMASK ); -if (!gsi->evt_ring_count) { -dev_err (dev,"GSI reports zero event rings supported\n" ); -return -EINVAL ; - } -if (gsi->evt_ring_count >GSI_EVT_RING_COUNT_MAX ) { -dev_warn (dev, -"limiting to %u event rings; hardware supports %u\n" , -GSI_EVT_RING_COUNT_MAX , gsi->evt_ring_count); - gsi->evt_ring_count =GSI_EVT_RING_COUNT_MAX ; - } + ret =gsi_ring_setup (gsi);/* No matching teardown required */ +if (ret) +return ret;/* Initialize the error log */ iowrite32 (0 , gsi->virt +GSI_ERROR_LOG_OFFSET );
drivers/net/ipa/gsi.h +1 -1
@@ -17,7 +17,7 @@/* Maximum number of channels and event rings supported by the driver */ #define GSI_CHANNEL_COUNT_MAX 23 -#define GSI_EVT_RING_COUNT_MAX 20 +#define GSI_EVT_RING_COUNT_MAX 24/* Maximum TLV FIFO size for a channel; 64 here is arbitrary (and high) */ #define GSI_TLV_MAX 64
Signature · 1 line
2.27.0
Re: [PATCH net-next 5/6] net: ipa: introduce gsi_ring_setup()
Il 21/06/21 19:56, Alex Elder ha scritto:
Quoted 5 lines
Prior to IPA v3.5.1, there is no
HW_PARAM_2GSI register, which we use to determine the number of channels and endpoints per execution environment. In that case, we will just assume the number supported is the maximum supported by the driver.
Quoted 8 lines
Introduce
gsi_ring_setup()to encapsulate the code that determines the number of channels and endpoints.Update
GSI_EVT_RING_COUNT_MAXso it is big enough to handle any available channel for all supported hardware (IPA v4.9 can have 23 channels and 24 event rings).Signed-off-by Alex Elder <[email protected]>
PATCH 6/6 net: ipa: add IPA v3.1 configuration data
In reply to Alex ElderAdd support for the MSM8998 SoC, which includes IPA version 3.1.
Originally proposed by AngeloGioacchino Del Regno.
--- drivers/net/ipa/Makefile | 6 +- drivers/net/ipa/ipa_data-v3.1.c | 533 ++++++++++++++++++++++++++++++++ drivers/net/ipa/ipa_data.h | 1 + drivers/net/ipa/ipa_main.c | 4 + 4 files changed, 541 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ipa/ipa_data-v3.1.c
drivers/net/ipa/Makefile +3 -3
@@ -10,6 +10,6 @@ ipa-y := ipa_main.o ipa_clock.o ipa_reg.o ipa_mem.o \ ipa_resource.o ipa_qmi.o ipa_qmi_msg.o \ ipa_sysfs.o -ipa-y += ipa_data-v3.5.1.o ipa_data-v4.2.o \ - ipa_data-v4.5.o ipa_data-v4.9.o \ - ipa_data-v4.11.o +ipa-y += ipa_data-v3.1.o ipa_data-v3.5.1.o \ + ipa_data-v4.2.o ipa_data-v4.5.o \ + ipa_data-v4.9.o ipa_data-v4.11.o
drivers/net/ipa/ipa_data-v3.1.c new file +533 -0
533 lines not on this page · raw message
drivers/net/ipa/ipa_data.h +1 -0
@@ -300,6 +300,7 @@ struct ipa_data {const struct ipa_clock_data *clock_data; }; +extern const struct ipa_data ipa_data_v3_1;extern const struct ipa_data ipa_data_v3_5_1;extern const struct ipa_data ipa_data_v4_2;extern const struct ipa_data ipa_data_v4_5;
drivers/net/ipa/ipa_main.c +4 -0
@@ -578,6 +578,10 @@ static int ipa_firmware_load(struct device *dev) }static const struct of_device_id ipa_match[] = { + { + .compatible ="qcom,msm8998-ipa" , + .data = &ipa_data_v3_1, + }, { .compatible ="qcom,sdm845-ipa" , .data = &ipa_data_v3_5_1,
Signature · 1 line
2.27.0
Re: [PATCH net-next 6/6] net: ipa: add IPA v3.1 configuration data
Il 21/06/21 19:56, Alex Elder ha scritto:
Quoted 6 lines
Add support for the MSM8998 SoC, which includes IPA version 3.1.
Originally proposed by AngeloGioacchino Del Regno.
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 5 lines · On Mon, 21 Jun 2021 12:56:21 -0500 you wrote:
This series adds support for IPA v3.1, used by the Qualcomm Snapdragon 835 (MSM8998).
The first patch adds "qcom,msm8998-ipa" to the DT binding.
Quoted 8 lines
The next four patches add code to ensure correct operation on IPA v3.1:
- Avoid touching unsupported inter-EE interrupt mask registers
- Set the proper flags in the clock configuration register
- Work around the lack of an IPAFLAVOR_0register
- Work around the lack of a GSIPARAM_2register[...]
Here is the summary with links:
- [net-next,1/6] dt-bindings: net: qcom,ipa: add support for MSM8998
https://git.kernel.org/netdev/net-next/c/2afd6c8b43c1 - [net-next,2/6] net: ipa: inter-EE interrupts aren't always available https://git.kernel.org/netdev/net-next/c/c31d73494fa5 - [net-next,3/6] net: ipa: disable misc clock gating for IPA v3.1 https://git.kernel.org/netdev/net-next/c/3833d0abd2c5 - [net-next,4/6] net: ipa: FLAVOR_0 register doesn't exist until IPA v3.5 https://git.kernel.org/netdev/net-next/c/110971d1ee4d - [net-next,5/6] net: ipa: introduce gsi_ring_setup() https://git.kernel.org/netdev/net-next/c/bae70a803a77 - [net-next,6/6] net: ipa: add IPA v3.1 configuration data https://git.kernel.org/netdev/net-next/c/1bb1a117878b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html