1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright 2015 Stephen Warren
9 #ifdef CONFIG_PHYS_TO_BUS
10 unsigned long phys_to_bus(unsigned long phys);
11 unsigned long bus_to_phys(unsigned long bus);
13 static inline unsigned long phys_to_bus(unsigned long phys)
18 static inline unsigned long bus_to_phys(unsigned long bus)
24 #if CONFIG_IS_ENABLED(DM)
25 #include <dm/device.h>
27 static inline dma_addr_t dev_phys_to_bus(struct udevice *dev, phys_addr_t phys)
29 return phys - dev_get_dma_offset(dev);
32 static inline phys_addr_t dev_bus_to_phys(struct udevice *dev, dma_addr_t bus)
34 return bus + dev_get_dma_offset(dev);
37 #define dev_phys_to_bus(_, _addr) _addr
38 #define dev_bus_to_phys(_, _addr) _addr