1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
279340db7SStephen Warren /*
379340db7SStephen Warren  * Copyright 2015 Stephen Warren
479340db7SStephen Warren  */
579340db7SStephen Warren 
679340db7SStephen Warren #include <config.h>
779340db7SStephen Warren #include <phys2bus.h>
879340db7SStephen Warren 
979340db7SStephen Warren unsigned long phys_to_bus(unsigned long phys)
1079340db7SStephen Warren {
11ed7481c7SStephen Warren #ifndef CONFIG_BCM2835
1279340db7SStephen Warren 	return 0xc0000000 | phys;
1379340db7SStephen Warren #else
1479340db7SStephen Warren 	return 0x40000000 | phys;
1579340db7SStephen Warren #endif
1679340db7SStephen Warren }
1779340db7SStephen Warren 
1879340db7SStephen Warren unsigned long bus_to_phys(unsigned long bus)
1979340db7SStephen Warren {
2079340db7SStephen Warren 	return bus & ~0xc0000000;
2179340db7SStephen Warren }
22