alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jie Yang <yang.jie@intel.com>
To: alsa-devel@alsa-project.org
Cc: mengdong.lin@intel.com, broonie@kernel.org, liam.r.girdwood@intel.com
Subject: [PATCH v2 3/4] ASoC: Intel: Add dummy read for SRAM block enable
Date: Mon, 14 Jul 2014 17:11:11 +0800	[thread overview]
Message-ID: <1405329072-28679-4-git-send-email-yang.jie@intel.com> (raw)
In-Reply-To: <1405329072-28679-1-git-send-email-yang.jie@intel.com>

Add dummy read after each block enable, to workaround
SRAM write missing bytes issue.

Signed-off-by: Jie Yang <yang.jie@intel.com>
---
 sound/soc/intel/sst-haswell-dsp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c
index 40bb020..61dbf91 100644
--- a/sound/soc/intel/sst-haswell-dsp.c
+++ b/sound/soc/intel/sst-haswell-dsp.c
@@ -376,6 +376,17 @@ static u32 hsw_block_get_bit(struct sst_mem_block *block)
 	return bit;
 }
 
+/*dummy read a SRAM block.*/
+static void sst_mem_block_dummy_read(struct sst_mem_block *block)
+{
+	u32 size;
+	u8 tmp_buf[4];
+	struct sst_dsp *sst = block->dsp;
+
+	size = block->size > 4 ? 4 : block->size;
+	memcpy_fromio(tmp_buf, sst->addr.lpe + block->offset, size);
+}
+
 /* enable 32kB memory block - locks held by caller */
 static int hsw_block_enable(struct sst_mem_block *block)
 {
@@ -395,6 +406,8 @@ static int hsw_block_enable(struct sst_mem_block *block)
 	/* wait 18 DSP clock ticks */
 	udelay(10);
 
+	/*add a dummy read before the SRAM block is written, otherwise the writing may miss bytes sometimes.*/
+	sst_mem_block_dummy_read(block);
 	return 0;
 }
 
-- 
1.8.3.2

  parent reply	other threads:[~2014-07-14  9:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14  9:11 [PATCH v2 0/4] ASoC: Intel: Enable BDW/HSW SRAM power gating Jie Yang
2014-07-14  9:11 ` [PATCH v2 1/4] ASoC: Intel: Merge wild cat point ADSP DRAM regions Jie Yang
2014-07-14 18:12   ` Mark Brown
2014-07-14  9:11 ` [PATCH v2 2/4] ASoC: Intel: Use a table for ADSP SRAM shift Jie Yang
2014-07-14 18:12   ` Mark Brown
2014-07-14  9:11 ` Jie Yang [this message]
2014-07-14 18:11   ` [PATCH v2 3/4] ASoC: Intel: Add dummy read for SRAM block enable Mark Brown
2014-07-14  9:11 ` [PATCH v2 4/4] ASoC: Intel: Start with all memory banks disabled Jie Yang
2014-07-14 18:13   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405329072-28679-4-git-send-email-yang.jie@intel.com \
    --to=yang.jie@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@intel.com \
    --cc=mengdong.lin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).