diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2012-09-23 10:42:35 +0300 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-10-04 14:59:28 -0700 |
commit | bec4808b9b87718c153a204e69790e7841b693a3 (patch) | |
tree | 66a036f8b3b6e0bea8c64117ed3f6159552a5d6c /drivers/video/tegra/host/tsec | |
parent | b1674ec821594219f881f8298648d1300f78d2a2 (diff) |
video: tegra: host: Use sg_table for DMA addresses
Use scatter-gather list for storing DMA addresses. This will allow
us to use DMA addresses from non-nvmap memory managers.
Change-Id: Id4a56ef5772a0d08b964336c51b06aa2b8432fe3
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/135086
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/host/tsec')
-rw-r--r-- | drivers/video/tegra/host/tsec/tsec.c | 13 | ||||
-rw-r--r-- | drivers/video/tegra/host/tsec/tsec.h | 5 |
2 files changed, 10 insertions, 8 deletions
diff --git a/drivers/video/tegra/host/tsec/tsec.c b/drivers/video/tegra/host/tsec/tsec.c index 94a1428cb1c3..a2cadabcf73f 100644 --- a/drivers/video/tegra/host/tsec/tsec.c +++ b/drivers/video/tegra/host/tsec/tsec.c @@ -23,6 +23,7 @@ #include <linux/module.h> #include <asm/byteorder.h> /* for parsing ucode image wrt endianness */ #include <linux/delay.h> /* for udelay */ +#include <linux/scatterlist.h> #include "dev.h" #include "tsec.h" #include "hw_tsec.h" @@ -134,7 +135,7 @@ int tsec_boot(struct nvhost_device *dev) nvhost_device_writel(dev, tsec_dmactl_r(), 0); nvhost_device_writel(dev, tsec_dmatrfbase_r(), - (m->pa + m->os.bin_data_offset) >> 8); + (sg_dma_address(m->pa->sgl) + m->os.bin_data_offset) >> 8); for (offset = 0; offset < m->os.data_size; offset += 256) tsec_dma_pa_to_internal_256b(dev, @@ -282,9 +283,9 @@ int tsec_read_ucode(struct nvhost_device *dev, const char *fw_name) } m->pa = mem_op().pin(nvhost_get_host(dev)->memmgr, m->mem_r); - if (IS_ERR_VALUE(m->pa)) { + if (IS_ERR_OR_NULL(m->pa)) { dev_err(&dev->dev, "nvmap pin failed for ucode"); - err = m->pa; + err = PTR_ERR(m->pa); m->pa = 0; goto clean_up; } @@ -313,7 +314,7 @@ clean_up: if (ucode_ptr) mem_op().munmap(m->mem_r, ucode_ptr); if (m->pa) - mem_op().unpin(nvhost_get_host(dev)->memmgr, m->mem_r); + mem_op().unpin(nvhost_get_host(dev)->memmgr, m->mem_r, m->pa); if (m->mem_r) mem_op().put(nvhost_get_host(dev)->memmgr, m->mem_r); release_firmware(ucode_fw); @@ -356,7 +357,7 @@ void nvhost_tsec_init(struct nvhost_device *dev) clean_up: dev_err(&dev->dev, "failed"); - mem_op().unpin(nvhost_get_host(dev)->memmgr, m->mem_r); + mem_op().unpin(nvhost_get_host(dev)->memmgr, m->mem_r, m->pa); } void nvhost_tsec_deinit(struct nvhost_device *dev) @@ -365,7 +366,7 @@ void nvhost_tsec_deinit(struct nvhost_device *dev) /* unpin, free ucode memory */ if (m->mem_r) { - mem_op().unpin(nvhost_get_host(dev)->memmgr, m->mem_r); + mem_op().unpin(nvhost_get_host(dev)->memmgr, m->mem_r, m->pa); mem_op().put(nvhost_get_host(dev)->memmgr, m->mem_r); m->mem_r = 0; } diff --git a/drivers/video/tegra/host/tsec/tsec.h b/drivers/video/tegra/host/tsec/tsec.h index 475196b108bb..7a4159e02b12 100644 --- a/drivers/video/tegra/host/tsec/tsec.h +++ b/drivers/video/tegra/host/tsec/tsec.h @@ -24,6 +24,7 @@ #include <linux/nvhost.h> struct mem_handle; +struct sg_table; void nvhost_tsec_finalize_poweron(struct nvhost_device *dev); void nvhost_tsec_init(struct nvhost_device *dev); @@ -53,7 +54,7 @@ struct tsec { u32 size; } os; - phys_addr_t pa; + struct sg_table *pa; }; struct tsec_ucode_bin_header_v1 { @@ -82,7 +83,7 @@ struct tsec_ucode_v1 { struct tsec_ucode_bin_header_v1 *bin_header; struct tsec_ucode_os_header_v1 *os_header; struct mem_handle *mem; - phys_addr_t pa; + struct sg_table *pa; bool valid; }; |