At Mon, 17 Feb 2014 13:32:08 +0000, Liam Girdwood wrote:
Provide services for Intel SST drivers to load SST modular firmware.
SST Firmware can be made up of several modules. These modules can exist within any of the compatible SST memory blocks. Provide a generic memory block and firmware module manager that can be used with any SST firmware and core.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com
sound/soc/intel/sst-firmware.c | 586 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 586 insertions(+) create mode 100644 sound/soc/intel/sst-firmware.c
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c new file mode 100644 index 0000000..b6f9b5e --- /dev/null +++ b/sound/soc/intel/sst-firmware.c @@ -0,0 +1,586 @@ +/*
- Intel SST Firmware Loader
- Copyright (C) 2013, Intel Corporation. All rights reserved.
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License version
- 2 as published by the Free Software Foundation.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- */
+#include <linux/kernel.h> +#include <linux/slab.h> +#include <linux/sched.h> +#include <linux/firmware.h> +#include <linux/export.h> +#include <linux/platform_device.h> +#include <linux/dma-mapping.h> +#include <linux/dmaengine.h> +#include <linux/pci.h>
+#include <asm/page.h> +#include <asm/pgtable.h>
+#include "sst-dsp.h" +#include "sst-dsp-priv.h"
+static void sst_memcpy32(void *dest, void *src, u32 bytes) +{
- u32 i;
- /* copy one 32 bit word at a time as 64 bit access is not supported */
- for (i = 0; i < bytes; i += 4)
memcpy_toio(dest + i, src + i, 4);
+}
+/* create new generic firmware object */ +struct sst_fw *sst_fw_new(struct sst_dsp *dsp,
- const struct firmware *fw, void *private)
+{
- struct sst_fw *sst_fw;
- int err;
- if (!dsp->ops->parse_fw)
return NULL;
- sst_fw = kzalloc(sizeof(*sst_fw), GFP_KERNEL);
- if (sst_fw == NULL)
return NULL;
- sst_fw->dsp = dsp;
- sst_fw->private = private;
- sst_fw->size = fw->size;
- err = dma_coerce_mask_and_coherent(dsp->dev, DMA_BIT_MASK(32));
- if (err < 0) {
kfree(sst_fw);
return NULL;
- }
- /* allocate DMA buffer to store FW data */
- sst_fw->dma_buf = dma_alloc_coherent(dsp->dev, sst_fw->size,
&sst_fw->dmable_fw_paddr, GFP_DMA);
Missing GFP_KERNEL?
Takashi