diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-05-22 19:11:07 +0200 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-05-23 13:30:52 +0200 |
commit | 6b74f61a471ad0f3a5e919e314d4f60cd3966f5e (patch) | |
tree | 9ab2c2ea8a78c499f1ce755737e5dc5003ca2a07 /include | |
parent | Linux 3.15-rc6 (diff) | |
parent | ARM: dma: use phys_addr_t in __dma_page_[cpu_to_dev/dev_to_cpu] (diff) | |
download | linux-6b74f61a471ad0f3a5e919e314d4f60cd3966f5e.tar.xz linux-6b74f61a471ad0f3a5e919e314d4f60cd3966f5e.zip |
Merge tag 'dt-dma-properties-for-arm' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone into devel-stable
DT support for 'dma-ranges'and 'dma-coherent' properties with ARM updates
- The 'dma-ranges' helps to take care of few DMAable system memory
restrictions by use of dma_pfn_offset which is maintained per
device. Arch code then uses it for dma address translations for such
cases. We update the dma_pfn_offset accordingly during DT the device
creation process.
- The 'dma-coherent' property is used to setup arch's coherent dma_ops.
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 2 | ||||
-rw-r--r-- | include/linux/dma-mapping.h | 7 | ||||
-rw-r--r-- | include/linux/of_address.h | 14 |
3 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index d1d1c055b48e..460ebad15109 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -685,6 +685,7 @@ struct acpi_dev_node { * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all * hardware supports 64-bit addresses for consistent allocations * such descriptors. + * @dma_pfn_offset: offset of DMA memory range relatively of RAM * @dma_parms: A low level driver may set these to teach IOMMU code about * segment limitations. * @dma_pools: Dma pools (if dma'ble device). @@ -750,6 +751,7 @@ struct device { not all hardware supports 64 bit addresses for consistent allocations such descriptors. */ + unsigned long dma_pfn_offset; struct device_dma_parameters *dma_parms; diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index fd4aee29ad10..c7d9b1b14ce7 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -123,6 +123,13 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) extern u64 dma_get_required_mask(struct device *dev); +#ifndef set_arch_dma_coherent_ops +static inline int set_arch_dma_coherent_ops(struct device *dev) +{ + return 0; +} +#endif + static inline unsigned int dma_get_max_seg_size(struct device *dev) { return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536; diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 5f6ed6b182b8..839a3521b28e 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -63,6 +63,9 @@ extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, extern struct of_pci_range *of_pci_range_parser_one( struct of_pci_range_parser *parser, struct of_pci_range *range); +extern int of_dma_get_range(struct device_node *np, u64 *dma_addr, + u64 *paddr, u64 *size); +extern bool of_dma_is_coherent(struct device_node *np); #else /* CONFIG_OF_ADDRESS */ static inline struct device_node *of_find_matching_node_by_address( struct device_node *from, @@ -90,6 +93,17 @@ static inline struct of_pci_range *of_pci_range_parser_one( { return NULL; } + +static inline int of_dma_get_range(struct device_node *np, u64 *dma_addr, + u64 *paddr, u64 *size) +{ + return -ENODEV; +} + +static inline bool of_dma_is_coherent(struct device_node *np) +{ + return false; +} #endif /* CONFIG_OF_ADDRESS */ #ifdef CONFIG_OF |