Commit e537654b authored by Tuowen Zhao's avatar Tuowen Zhao Committed by Lee Jones

lib: devres: add a helper function for ioremap_uc

Implement a resource managed strongly uncachable ioremap function.

Cc: <stable@vger.kernel.org> # v4.19+
Tested-by: default avatarAceLan Kao <acelan.kao@canonical.com>
Signed-off-by: default avatarTuowen Zhao <ztuowen@gmail.com>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 38e45d81
...@@ -64,6 +64,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr) ...@@ -64,6 +64,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
resource_size_t size); resource_size_t size);
void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset,
resource_size_t size);
void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
resource_size_t size); resource_size_t size);
void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset, void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
enum devm_ioremap_type { enum devm_ioremap_type {
DEVM_IOREMAP = 0, DEVM_IOREMAP = 0,
DEVM_IOREMAP_NC, DEVM_IOREMAP_NC,
DEVM_IOREMAP_UC,
DEVM_IOREMAP_WC, DEVM_IOREMAP_WC,
}; };
...@@ -39,6 +40,9 @@ static void __iomem *__devm_ioremap(struct device *dev, resource_size_t offset, ...@@ -39,6 +40,9 @@ static void __iomem *__devm_ioremap(struct device *dev, resource_size_t offset,
case DEVM_IOREMAP_NC: case DEVM_IOREMAP_NC:
addr = ioremap_nocache(offset, size); addr = ioremap_nocache(offset, size);
break; break;
case DEVM_IOREMAP_UC:
addr = ioremap_uc(offset, size);
break;
case DEVM_IOREMAP_WC: case DEVM_IOREMAP_WC:
addr = ioremap_wc(offset, size); addr = ioremap_wc(offset, size);
break; break;
...@@ -68,6 +72,21 @@ void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, ...@@ -68,6 +72,21 @@ void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
} }
EXPORT_SYMBOL(devm_ioremap); EXPORT_SYMBOL(devm_ioremap);
/**
* devm_ioremap_uc - Managed ioremap_uc()
* @dev: Generic device to remap IO address for
* @offset: Resource address to map
* @size: Size of map
*
* Managed ioremap_uc(). Map is automatically unmapped on driver detach.
*/
void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset,
resource_size_t size)
{
return __devm_ioremap(dev, offset, size, DEVM_IOREMAP_UC);
}
EXPORT_SYMBOL_GPL(devm_ioremap_uc);
/** /**
* devm_ioremap_nocache - Managed ioremap_nocache() * devm_ioremap_nocache - Managed ioremap_nocache()
* @dev: Generic device to remap IO address for * @dev: Generic device to remap IO address for
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment