Add a macro that gets the physical address of a memory mapped device
register from a bus space resource. Note that this macro is just for ARM, and is intended to have a short lifespan. The DMA engines in some SoCs need the physical address of a memory-mapped device register as one of the arguments for the transfer. Several scattered ad-hoc solutions have been converted to use this macro, which now also serves to mark the places where a more complete fix needs to be applied (after that fix has been designed).
This commit is contained in:
parent
0952142d82
commit
b2acea1ddc
@ -173,7 +173,6 @@ bcm_sdhci_attach(device_t dev)
|
||||
int default_freq;
|
||||
void *buffer;
|
||||
vm_paddr_t buffer_phys;
|
||||
void *va;
|
||||
|
||||
sc->sc_dev = dev;
|
||||
sc->sc_req = NULL;
|
||||
@ -284,9 +283,8 @@ bcm_sdhci_attach(device_t dev)
|
||||
|
||||
sc->sc_dma_buffer = buffer;
|
||||
sc->sc_dma_buffer_phys = buffer_phys;
|
||||
va = (void*)rman_get_start(sc->sc_mem_res);
|
||||
sc->sc_sdhci_buffer_phys =
|
||||
pmap_kextract((vm_offset_t)va) + SDHCI_BUFFER;
|
||||
sc->sc_sdhci_buffer_phys = BUS_SPACE_PHYSADDR(sc->sc_mem_res,
|
||||
SDHCI_BUFFER);
|
||||
|
||||
bus_generic_probe(dev);
|
||||
bus_generic_attach(dev);
|
||||
|
@ -725,4 +725,12 @@ bs_c_8_proto(f);
|
||||
|
||||
#include <machine/bus_dma.h>
|
||||
|
||||
/*
|
||||
* Get the physical address of a bus space memory-mapped resource.
|
||||
* Doing this as a macro is a temporary solution until a more robust fix is
|
||||
* designed. It also serves to mark the locations needing that fix.
|
||||
*/
|
||||
#define BUS_SPACE_PHYSADDR(res, offs) \
|
||||
(vtophys(rman_get_start(res)+(offs)))
|
||||
|
||||
#endif /* _MACHINE_BUS_H_ */
|
||||
|
@ -327,7 +327,7 @@ cpsw_debugf(const char *fmt, ...)
|
||||
#define cpsw_cpdma_bd_offset(i) (CPSW_CPPI_RAM_OFFSET + ((i)*16))
|
||||
|
||||
#define cpsw_cpdma_bd_paddr(sc, slot) \
|
||||
(slot->bd_offset + vtophys(rman_get_start(sc->res[0])))
|
||||
BUS_SPACE_PHYSADDR(sc->res[0], slot->bd_offset)
|
||||
#define cpsw_cpdma_read_bd(sc, slot, val) \
|
||||
bus_read_region_4(sc->res[0], slot->bd_offset, (uint32_t *) val, 4)
|
||||
#define cpsw_cpdma_write_bd(sc, slot, val) \
|
||||
|
@ -1584,7 +1584,6 @@ static int
|
||||
ti_mmchs_activate(device_t dev)
|
||||
{
|
||||
struct ti_mmchs_softc *sc = device_get_softc(dev);
|
||||
unsigned long addr;
|
||||
int rid;
|
||||
int err;
|
||||
|
||||
@ -1630,8 +1629,8 @@ ti_mmchs_activate(device_t dev)
|
||||
panic("Unknown OMAP device\n");
|
||||
|
||||
/* Get the physical address of the MMC data register, needed for DMA */
|
||||
addr = vtophys(rman_get_start(sc->sc_mem_res));
|
||||
sc->sc_data_reg_paddr = addr + sc->sc_reg_off + MMCHS_DATA;
|
||||
sc->sc_data_reg_paddr = BUS_SPACE_PHYSADDR(sc->sc_mem_res,
|
||||
sc->sc_reg_off + MMCHS_DATA);
|
||||
|
||||
/* Set the initial power state to off */
|
||||
sc->sc_cur_power_mode = power_off;
|
||||
|
Loading…
x
Reference in New Issue
Block a user