Tegra: smmu: export handlers to read/write SMMU registers
This patch exports the SMMU register read/write handlers for platforms. Change-Id: If92f0d3ce820e4997c090b48be7614407bb582da Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
This commit is contained in:
parent
a391d4942a
commit
91dd7edd31
|
@ -18,60 +18,6 @@
|
||||||
|
|
||||||
extern void memcpy16(void *dest, const void *src, unsigned int length);
|
extern void memcpy16(void *dest, const void *src, unsigned int length);
|
||||||
|
|
||||||
/* SMMU IDs currently supported by the driver */
|
|
||||||
enum {
|
|
||||||
TEGRA_SMMU0 = 0U,
|
|
||||||
TEGRA_SMMU1,
|
|
||||||
TEGRA_SMMU2
|
|
||||||
};
|
|
||||||
|
|
||||||
static uint32_t tegra_smmu_read_32(uint32_t smmu_id, uint32_t off)
|
|
||||||
{
|
|
||||||
uint32_t ret = 0U;
|
|
||||||
|
|
||||||
#if defined(TEGRA_SMMU0_BASE)
|
|
||||||
if (smmu_id == TEGRA_SMMU0) {
|
|
||||||
ret = mmio_read_32(TEGRA_SMMU0_BASE + (uint64_t)off);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(TEGRA_SMMU1_BASE)
|
|
||||||
if (smmu_id == TEGRA_SMMU1) {
|
|
||||||
ret = mmio_read_32(TEGRA_SMMU1_BASE + (uint64_t)off);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(TEGRA_SMMU2_BASE)
|
|
||||||
if (smmu_id == TEGRA_SMMU2) {
|
|
||||||
ret = mmio_read_32(TEGRA_SMMU2_BASE + (uint64_t)off);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void tegra_smmu_write_32(uint32_t smmu_id,
|
|
||||||
uint32_t off, uint32_t val)
|
|
||||||
{
|
|
||||||
#if defined(TEGRA_SMMU0_BASE)
|
|
||||||
if (smmu_id == TEGRA_SMMU0) {
|
|
||||||
mmio_write_32(TEGRA_SMMU0_BASE + (uint64_t)off, val);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(TEGRA_SMMU1_BASE)
|
|
||||||
if (smmu_id == TEGRA_SMMU1) {
|
|
||||||
mmio_write_32(TEGRA_SMMU1_BASE + (uint64_t)off, val);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(TEGRA_SMMU2_BASE)
|
|
||||||
if (smmu_id == TEGRA_SMMU2) {
|
|
||||||
mmio_write_32(TEGRA_SMMU2_BASE + (uint64_t)off, val);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SMMU_NUM_CONTEXTS 64U
|
#define SMMU_NUM_CONTEXTS 64U
|
||||||
#define SMMU_CONTEXT_BANK_MAX_IDX 64U
|
#define SMMU_CONTEXT_BANK_MAX_IDX 64U
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,68 @@
|
||||||
#define SMMU_GSR0_PGSIZE_SHIFT 16U
|
#define SMMU_GSR0_PGSIZE_SHIFT 16U
|
||||||
#define SMMU_GSR0_PGSIZE_4K (0U << SMMU_GSR0_PGSIZE_SHIFT)
|
#define SMMU_GSR0_PGSIZE_4K (0U << SMMU_GSR0_PGSIZE_SHIFT)
|
||||||
#define SMMU_GSR0_PGSIZE_64K (1U << SMMU_GSR0_PGSIZE_SHIFT)
|
#define SMMU_GSR0_PGSIZE_64K (1U << SMMU_GSR0_PGSIZE_SHIFT)
|
||||||
#define SMMU_ACR_CACHE_LOCK_ENABLE_BIT (1U << 26)
|
#define SMMU_ACR_CACHE_LOCK_ENABLE_BIT (1ULL << 26U)
|
||||||
|
#define SMMU_GSR0_PER (0x20200U)
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SMMU Global Aux. Control Register
|
* SMMU Global Aux. Control Register
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define SMMU_CBn_ACTLR_CPRE_BIT (1ULL << 1U)
|
#define SMMU_CBn_ACTLR_CPRE_BIT (1ULL << 1U)
|
||||||
|
|
||||||
|
/* SMMU IDs currently supported by the driver */
|
||||||
|
enum {
|
||||||
|
TEGRA_SMMU0 = 0U,
|
||||||
|
TEGRA_SMMU1 = 1U,
|
||||||
|
TEGRA_SMMU2 = 2U
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline uint32_t tegra_smmu_read_32(uint32_t smmu_id, uint32_t off)
|
||||||
|
{
|
||||||
|
uint32_t ret = 0U;
|
||||||
|
|
||||||
|
#if defined(TEGRA_SMMU0_BASE)
|
||||||
|
if (smmu_id == TEGRA_SMMU0) {
|
||||||
|
ret = mmio_read_32(TEGRA_SMMU0_BASE + (uint64_t)off);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(TEGRA_SMMU1_BASE)
|
||||||
|
if (smmu_id == TEGRA_SMMU1) {
|
||||||
|
ret = mmio_read_32(TEGRA_SMMU1_BASE + (uint64_t)off);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(TEGRA_SMMU2_BASE)
|
||||||
|
if (smmu_id == TEGRA_SMMU2) {
|
||||||
|
ret = mmio_read_32(TEGRA_SMMU2_BASE + (uint64_t)off);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void tegra_smmu_write_32(uint32_t smmu_id,
|
||||||
|
uint32_t off, uint32_t val)
|
||||||
|
{
|
||||||
|
#if defined(TEGRA_SMMU0_BASE)
|
||||||
|
if (smmu_id == TEGRA_SMMU0) {
|
||||||
|
mmio_write_32(TEGRA_SMMU0_BASE + (uint64_t)off, val);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(TEGRA_SMMU1_BASE)
|
||||||
|
if (smmu_id == TEGRA_SMMU1) {
|
||||||
|
mmio_write_32(TEGRA_SMMU1_BASE + (uint64_t)off, val);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(TEGRA_SMMU2_BASE)
|
||||||
|
if (smmu_id == TEGRA_SMMU2) {
|
||||||
|
mmio_write_32(TEGRA_SMMU2_BASE + (uint64_t)off, val);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void tegra_smmu_init(void);
|
void tegra_smmu_init(void);
|
||||||
uint32_t plat_get_num_smmu_devices(void);
|
uint32_t plat_get_num_smmu_devices(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue