Skip to content

Conversation

@zhuyingjiang
Copy link

By default, the I2S ports are in master mode, during
DSP powerup sequences, this may cause distortion on
some boards for drives FS and BCLK high.
So we need to set it as slave before enabling DSP.
closes #778
Signed-off-by: Zhu Yingjiang yingjiang.zhu@linux.intel.com

@ranj063
Copy link
Collaborator

ranj063 commented Apr 11, 2019

So we need to set it as slave before enabling DSP.

@zhuyingjiang im not aware of what the sequence should be but in the commit, you set the slave mode after powering up the DSP's. It seems to contradict the commit message?

@ranj063
Copy link
Collaborator

ranj063 commented Apr 11, 2019

@zhuyingjiang also wondering why we do it only for APL and not the other cavs platforms?

@zhuyingjiang
Copy link
Author

So we need to set it as slave before enabling DSP.

@zhuyingjiang im not aware of what the sequence should be but in the commit, you set the slave mode after powering up the DSP's. It seems to contradict the commit message?

That is "during power up sequence", which include:

  1. power up core
  2. purge FW
  3. unset core 0
  4. wait for IPC done
    5 .power down core
    ....
    So power up sequence including "power up core".

@zhuyingjiang
Copy link
Author

@zhuyingjiang also wondering why we do it only for APL and not the other cavs platforms?

@ranj063 this is for issue #778, and from the cAVS 1.8 spec, I can't find the "I2S Force Dynamic Clock Gating" bit, but it does have "set slave" in SSC1 register.
For SOC earlier than SKL/APL(cAVS1.5) , I still have not got the spec.
@plbossart Could you explain more for @ranj063 's query? do we still need enable that on CNL?

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhuyingjiang the ask is to make sure valid sequences are programmed, not just to mirror what others did and hope for the best. You need to get access to the documentation and double-check all values, I did what I could to verify but you need to go deeper. In addition it's not quite right to a new operation just for a sequence that takes place inside the boot flow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this abstraction layer is not needed, this is a platform-specific operation that should be part of the initial DSP boot process. There's no point in exposing this to the core or add an intel-specific operation here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart OK, I will get the doc of BDW/HSW and see if they are the same step of doing so, and I will still check if the clock gating step is not needed, if yes, we do not need this layer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, this is not needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a shortcut to set the SCLKDIR (bit 25) and SFRMDIR (bit 24) fields of register SSC1 (offset 4 of SSP base). For both fields 1 means slave and 0 master.
You'd want to test that these bits are actually set since access from the host might be disabled on some platforms due to the access policy.

The registers are identical for cAVS 1.8, but you may need to check that the base SSP address is the same.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart OK, will do, but cAVS1.8 less the clock gating registers , will verify on cAVS1.5 if APL_DISABLE_ALL_SSP_CLK_GT operation can be omit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes 6 bits, and looks awfully correlated to the number of SSPs. for other platforms you'd need to adjust this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the same time, I do not see anything in the IP reference on this, except for some bits called "I2S Force Dynamic Clock Gating" and "I2S Extension Force Dynamic Clock Gating" which have a different bit field in the CLKSTS register. clearly you need to make sure the registers you are using are valid, not just copy/paste from somewhere else without verifying the right bits are programmed with the right values.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart OK, will check if "I2S Force Dynamic Clock Gating" setting can be omit.

@zhuyingjiang
Copy link
Author

@plbossart Do you means on all platform including BDW/HSW, APL(cAVS1.5), and CNL(cAVS1.8) need enable the feature? I will get the BDW/HSW specs and go deep with the specs then refine the PR.
Thanks!
I only changed the APL related is because that the issue #778 has the "[APL][GLK] harden" in title, so this is a misunderstanding.

@plbossart
Copy link
Member

plbossart commented Apr 15, 2019 via email

@zhuyingjiang zhuyingjiang force-pushed the topic/apl-set-I2S-as-slave branch from 3ebe44a to 25bf592 Compare April 17, 2019 10:58
@zhuyingjiang zhuyingjiang changed the title ASoC:SOF:APL:set I2S slave before enabling DSP [RFC]ASoC:SOF:APL:set I2S slave before enabling DSP Apr 17, 2019
@plbossart
Copy link
Member

@zhuyingjiang The ask was to enable the SSP as slave before the firmware is loaded, not to use the SSP as slave unconditionally! The firmware should do what the topology wants. The benefit is that if the topology does want slave mode, then there is no transition to master first which drives the clocks before stopping to drive them.

Also it's possible that some platforms set the access policy in the BIOS/Coreboot and the writing from the host fails. That's ok. Those platforms would not use slave mode anyways.

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

certainly not 8. where did you read this?

Copy link
Author

@zhuyingjiang zhuyingjiang Apr 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart yes, it is 8 for max, but maybe some ports reserved.
From cAVS1.8 HAS:

I2SPC | 3 | I2S Port Count.Value of 0 – 8 is allowed

and on our current WHL RVP, the I2SPC is 3, but there have base address from 0x10000 (I2S0) to 0x17000 (I2S7). The last 5 are reserved, we can write but will not take effect.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So use 3 then...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks!

@zhuyingjiang
Copy link
Author

@zhuyingjiang The ask was to enable the SSP as slave before the firmware is loaded, not to use the SSP as slave unconditionally! The firmware should do what the topology wants. The benefit is that if the topology does want slave mode, then there is no transition to master first which drives the clocks before stopping to drive them.

@plbossart The code I attached above to modify in Firmware side is to do debug and validate. it is not submit to FW repo.

From the spec, the host need to set the SSP to slave after poweron to avoid distortion, then when the DSP owns the access right it can set it according to the topology, by reading from the IPC message the host sent

@zhuyingjiang zhuyingjiang force-pushed the topic/apl-set-I2S-as-slave branch from 25bf592 to 72ee42f Compare April 18, 2019 06:54
@zhuyingjiang
Copy link
Author

@plbossart updated, with separate patch.

@zhuyingjiang zhuyingjiang requested a review from plbossart April 18, 2019 07:03
Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments below.
You want to use ASoC: SOF: Intel: hda: as the commit title prefix, thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I only see 3 SSPs for CNL/WHL/CML. You are confusing IP options and SOC reality, please look at the right documentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, changed.

@zhuyingjiang zhuyingjiang force-pushed the topic/apl-set-I2S-as-slave branch from 72ee42f to 3a75b1e Compare April 19, 2019 01:48
@zhuyingjiang
Copy link
Author

@plbossart @ranj063 Changed the commit message and the CNL SSP count.

@zhuyingjiang zhuyingjiang changed the title [RFC]ASoC:SOF:APL:set I2S slave before enabling DSP ASoC:SOF:APL:set I2S slave before enabling DSP Apr 19, 2019
@keyonjie
Copy link

keyonjie commented Apr 19, 2019

@zhuyingjiang can you add a space after each colon between sections in your subject of each commits, e.g.
ASoC: SOF: APL: set I2S slave before enabling DSP

The DSP SSP device memory can be conditionally accessed by
the host(depending on access policy).

Add the SSP base memory offset of APL and CNL.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
add SSP info of APL and CNL, to the sof_intel_dsp_desc
structure. The max SSP count the platform support and
the SSP base address.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
@zhuyingjiang zhuyingjiang force-pushed the topic/apl-set-I2S-as-slave branch from 3a75b1e to ecb2123 Compare April 19, 2019 07:48
@zhuyingjiang
Copy link
Author

@keyonjie Updated, thanks!

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zhuyingjiang for taking the feedback into account, looks almost good.

One last change to polish this PR, please fix the last commit message:

By default, the I2S ports are configured in master mode during
DSP powerup sequences, and the FS and BCLK lines will be driven on startup, even when the topology file explicitly requires the SSP to be slave.

This may be problematic for external components configured in master mode who don't expect the Intel SOC/PCH to drive. Fix by configuring the SSP as slave before the SSP outputs are enabled to avoid this transient behavior.

When the topology file configures the SSP as clock master, the initial slave configuration will be overridden.

Also please be consistent in commit titles, using Intel with a capital 'I' shows you've paid attention to details.

By default, the I2S ports are configured in master mode during
DSP powerup sequences, the FS and BCLK lines will be driven on
startup, even when the topology file explicitly requires the
SSP to be slave.

This may be problematic for external components configured in
master mode who don't expect the Intel SOC/PCH to drive. Fix by
configuring the SSP as slave before the SSP outputs are enabled
to avoid this transient behavior.

When the topology file configures the SSP as clock master, the
initial slave configuration will be overridden.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
@zhuyingjiang zhuyingjiang force-pushed the topic/apl-set-I2S-as-slave branch from ecb2123 to c77ad74 Compare April 20, 2019 02:14
@zhuyingjiang
Copy link
Author

@plbossart Updated, thanks!

@plbossart
Copy link
Member

one additional reviewer needed.

Copy link
Collaborator

@ranj063 ranj063 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart the change looks good to me. I havent read the documentation to confirm the APL/CNL SSP counts but if you are good with it, it should be fine.

@plbossart
Copy link
Member

@plbossart the change looks good to me. I havent read the documentation to confirm the APL/CNL SSP counts but if you are good with it, it should be fine.

thanks @ranj063

@plbossart plbossart merged commit 596d392 into thesofproject:topic/sof-dev Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[APL][GLK] harden: set I2S as slave before enabling DSP

4 participants