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