On 2/11/21 11:50 AM, AngeloGioacchino Del Regno wrote: > In preparation for adding support for the MSM8998 SoC's IPA, > add the necessary bits for IPA version 3.1 featuring GSI 1.0, > found on at least MSM8998. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxxx> Overall, this looks good. As I mentioned, I've implemented a very similar set of changes in my private development tree. It's part of a much larger set of changes intended to allow many IPA versions to be supported. A few minor comments, below. -Alex > --- > drivers/net/ipa/gsi.c | 8 ++++---- > drivers/net/ipa/ipa_endpoint.c | 17 +++++++++-------- > drivers/net/ipa/ipa_main.c | 8 ++++++-- > drivers/net/ipa/ipa_reg.h | 3 +++ > drivers/net/ipa/ipa_version.h | 1 + > 5 files changed, 23 insertions(+), 14 deletions(-) > > diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c > index 14d9a791924b..6315336b3ca8 100644 > --- a/drivers/net/ipa/gsi.c > +++ b/drivers/net/ipa/gsi.c > @@ -794,14 +794,14 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) > > /* Max prefetch is 1 segment (do not set MAX_PREFETCH_FMASK) */ > > - /* We enable the doorbell engine for IPA v3.5.1 */ > - if (gsi->version == IPA_VERSION_3_5_1 && doorbell) > + /* We enable the doorbell engine for IPA v3.x */ > + if (gsi->version < IPA_VERSION_4_0 && doorbell) My version: if (gsi->version < IPA_VERSION_4_0 && doorbell) So... You're doing the right thing. Almost all changes I made like this were identical to yours; others were (I think all) equivalent. > val |= USE_DB_ENG_FMASK; > > /* v4.0 introduces an escape buffer for prefetch. We use it > * on all but the AP command channel. > */ > - if (gsi->version != IPA_VERSION_3_5_1 && !channel->command) { > + if (gsi->version >= IPA_VERSION_4_0 && !channel->command) { > /* If not otherwise set, prefetch buffers are used */ > if (gsi->version < IPA_VERSION_4_5) > val |= USE_ESCAPE_BUF_ONLY_FMASK; . . . > diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c > index 84bb8ae92725..be191993fbec 100644 > --- a/drivers/net/ipa/ipa_main.c > +++ b/drivers/net/ipa/ipa_main.c . . . > @@ -276,6 +276,7 @@ static void ipa_hardware_config_qsb(struct ipa *ipa) > > max1 = 12; > switch (version) { > + case IPA_VERSION_3_1: I do this a little differently now. These values will be found in the "ipa_data" file for the platform. Also I think you'd need different values for IPA v3.1 than for IPA v3.5.1. > case IPA_VERSION_3_5_1: > max0 = 8; > break; > @@ -404,6 +405,9 @@ static void ipa_hardware_config(struct ipa *ipa) > /* Enable open global clocks (not needed for IPA v4.5) */ > val = GLOBAL_FMASK; > val |= GLOBAL_2X_CLK_FMASK; > + if (version == IPA_VERSION_3_1) > + val |= MISC_FMASK; I see this being set for a workaround or IPA v3.1 in the msm-4.4 tree, but the other two flags aren't set in that case. So this might not be quite right. > + > iowrite32(val, ipa->reg_virt + IPA_REG_CLKON_CFG_OFFSET); > > /* Disable PA mask to allow HOLB drop */ . . .