Skip to content

Commit

Permalink
drivers: ssp: fix program of MLCS register
Browse files Browse the repository at this point in the history
Programming of the MLCS register was performed on the incorrect bits.
Additionally, saving the new version did not erase the previously set
value, which could result in an incorrect register value.

Signed-off-by: Damian Nikodem <[email protected]>
  • Loading branch information
dnikodem authored and carlescufi committed Aug 6, 2024
1 parent 65bdf65 commit ed31037
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
11 changes: 6 additions & 5 deletions drivers/dai/intel/ssp/ssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1962,15 +1962,16 @@ static int dai_ssp_parse_tlv(struct dai_intel_ssp *dp, const uint8_t *aux_ptr, s
case SSP_LINK_CLK_SOURCE:
#ifdef CONFIG_SOC_SERIES_INTEL_ADSP_ACE
link = (struct ssp_intel_link_ctl *)&aux_tlv->val;

#if CONFIG_SOC_INTEL_ACE15_MTPM
sys_write32(sys_read32(dai_ip_base(dp) + I2SLCTL_OFFSET) |
sys_write32((sys_read32(dai_ip_base(dp) + I2SLCTL_OFFSET) &
~I2CLCTL_MLCS(0x7)) |
I2CLCTL_MLCS(link->clock_source), dai_ip_base(dp) +
I2SLCTL_OFFSET);
#elif CONFIG_SOC_INTEL_ACE20_LNL || CONFIG_SOC_INTEL_ACE30_PTL
sys_write32(sys_read32(dai_i2svss_base(dp) + I2SLCTL_OFFSET) |
I2CLCTL_MLCS(link->clock_source), dai_i2svss_base(dp) +
I2SLCTL_OFFSET);
sys_write32((sys_read32(dai_i2svss_base(dp) + I2SLCTL_OFFSET) &
~I2CLCTL_MLCS(0x7)) |
I2CLCTL_MLCS(link->clock_source),
dai_i2svss_base(dp) + I2SLCTL_OFFSET);
#endif
LOG_INF("link clock_source %u", link->clock_source);
#endif
Expand Down
2 changes: 1 addition & 1 deletion drivers/dai/intel/ssp/ssp_regs_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
#define I2SLCTL_SPA(x) BIT(0 + x)
#define I2SLCTL_CPA(x) BIT(8 + x)

#define I2CLCTL_MLCS(x) DAI_INTEL_SSP_SET_BITS(30, 27, x)
#define I2CLCTL_MLCS(x) DAI_INTEL_SSP_SET_BITS(29, 27, x)
#define SHIM_CLKCTL 0x78
#define SHIM_CLKCTL_I2SFDCGB(x) BIT(20 + x)
#define SHIM_CLKCTL_I2SEFDCGB(x) BIT(18 + x)
Expand Down
2 changes: 1 addition & 1 deletion drivers/dai/intel/ssp/ssp_regs_v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
#define PCMS0CM_OFFSET 0x16
#define PCMS1CM_OFFSET 0x1A

#define I2CLCTL_MLCS(x) DAI_INTEL_SSP_SET_BITS(30, 27, x)
#define I2CLCTL_MLCS(x) DAI_INTEL_SSP_SET_BITS(29, 27, x)
#define SHIM_CLKCTL 0x78
#define SHIM_CLKCTL_I2SFDCGB(x) BIT(20 + x)
#define SHIM_CLKCTL_I2SEFDCGB(x) BIT(18 + x)
Expand Down
2 changes: 1 addition & 1 deletion drivers/dai/intel/ssp/ssp_regs_v3.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
#define I2SLCTL_SPA(x) BIT(16 + x)
#define I2SLCTL_CPA(x) BIT(23 + x)

#define I2CLCTL_MLCS(x) DAI_INTEL_SSP_SET_BITS(30, 27, x)
#define I2CLCTL_MLCS(x) DAI_INTEL_SSP_SET_BITS(29, 27, x)
#define SHIM_CLKCTL 0x78
#define SHIM_CLKCTL_I2SFDCGB(x) BIT(20 + x)
#define SHIM_CLKCTL_I2SEFDCGB(x) BIT(18 + x)
Expand Down
3 changes: 3 additions & 0 deletions dts/xtensa/intel/intel_adsp_ace30_ptl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
#size-cells = <0>;
reg = <0x00028100 0x1000
0x00079C00 0x200>;
i2svss = <0x00028C00 0x1000>;
interrupts = <0x00 0 0>;
interrupt-parent = <&ace_intc>;
dmas = <&hda_link_out 1
Expand Down Expand Up @@ -269,6 +270,7 @@
#size-cells = <0>;
reg = <0x00029100 0x1000
0x00079C00 0x200>;
i2svss = <0x00029C00 0x1000>;
interrupts = <0x01 0 0>;
interrupt-parent = <&ace_intc>;
dmas = <&hda_link_out 2
Expand Down Expand Up @@ -333,6 +335,7 @@
#size-cells = <0>;
reg = <0x0002a100 0x1000
0x00079C00 0x200>;
i2svss = <0x0002AC00 0x1000>;
interrupts = <0x02 0 0>;
interrupt-parent = <&ace_intc>;
dmas = <&hda_link_out 3
Expand Down

0 comments on commit ed31037

Please sign in to comment.