mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
Revert "Revert "io: make register access in amvecm simple [1/1]""
merge after https://jira.amlogic.com/browse/SWPL-16378 is fixed.
This reverts commit 8f2983fb44.
Change-Id: If914ba7009d7858206d95bc61dd714d156b0924c
This commit is contained in:
@@ -39,6 +39,8 @@ static const struct of_device_id iomap_dt_match[] = {
|
||||
|
||||
static void __iomem *meson_reg_map[IO_BUS_MAX] = { NULL };
|
||||
static uint meson_reg_max[IO_BUS_MAX] = { 0 };
|
||||
void __iomem *vpp_base;
|
||||
unsigned int vpp_max;
|
||||
|
||||
inline int aml_reg_read(u32 bus_type, unsigned int reg, unsigned int *val)
|
||||
{
|
||||
@@ -295,6 +297,10 @@ static int iomap_probe(struct platform_device *pdev)
|
||||
meson_reg_max[i] = res.end - res.start;
|
||||
i++;
|
||||
}
|
||||
if (i > IO_VAPB_BUS_BASE) {
|
||||
vpp_base = meson_reg_map[IO_VAPB_BUS_BASE];
|
||||
vpp_max = meson_reg_max[IO_VAPB_BUS_BASE];
|
||||
}
|
||||
pr_info("amlogic iomap probe done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SKIP_IO_TRACE
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
@@ -93,4 +93,37 @@ extern void aml_write_hiubus(unsigned int reg, unsigned int val);
|
||||
|
||||
extern void aml_hiubus_update_bits(unsigned int reg,
|
||||
unsigned int mask, unsigned int val);
|
||||
|
||||
#include <linux/io.h>
|
||||
extern void __iomem *vpp_base;
|
||||
extern uint vpp_max;
|
||||
|
||||
static inline int aml_reg_vcbus_invalid(unsigned int reg)
|
||||
{
|
||||
return !(vpp_base && (vpp_max >= reg));
|
||||
}
|
||||
|
||||
static inline int aml_read_vcbus_s(unsigned int reg)
|
||||
{
|
||||
return readl((vpp_base + (reg << 2)));
|
||||
}
|
||||
|
||||
static inline void aml_write_vcbus_s(unsigned int reg, unsigned int val)
|
||||
{
|
||||
writel(val, (vpp_base + (reg << 2)));
|
||||
}
|
||||
|
||||
static inline void aml_vcbus_update_bits_s(unsigned int reg, unsigned int value,
|
||||
unsigned int start, unsigned int len)
|
||||
{
|
||||
unsigned int tmp, orig;
|
||||
unsigned int mask = (((1L << len) - 1) << start);
|
||||
int r = (reg << 2);
|
||||
|
||||
orig = readl((vpp_base + r));
|
||||
tmp = orig & ~mask;
|
||||
tmp |= (value << start) & mask;
|
||||
writel(tmp, (vpp_base + r));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -381,12 +381,12 @@ struct am_pq_parm_s {
|
||||
static inline void WRITE_VPP_REG(uint32_t reg,
|
||||
const uint32_t value)
|
||||
{
|
||||
aml_write_vcbus(reg, value);
|
||||
aml_write_vcbus_s(reg, value);
|
||||
}
|
||||
|
||||
static inline uint32_t READ_VPP_REG(uint32_t reg)
|
||||
{
|
||||
return aml_read_vcbus(reg);
|
||||
return aml_read_vcbus_s(reg);
|
||||
}
|
||||
|
||||
static inline void WRITE_VPP_REG_BITS(uint32_t reg,
|
||||
@@ -394,9 +394,7 @@ static inline void WRITE_VPP_REG_BITS(uint32_t reg,
|
||||
const uint32_t start,
|
||||
const uint32_t len)
|
||||
{
|
||||
WRITE_VPP_REG(reg, ((READ_VPP_REG(reg) &
|
||||
~(((1L << (len)) - 1) << (start))) |
|
||||
(((value) & ((1L << (len)) - 1)) << (start))));
|
||||
aml_vcbus_update_bits_s(reg, value, start, len);
|
||||
}
|
||||
|
||||
static inline uint32_t READ_VPP_REG_BITS(uint32_t reg,
|
||||
@@ -405,7 +403,7 @@ static inline uint32_t READ_VPP_REG_BITS(uint32_t reg,
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
val = ((READ_VPP_REG(reg) >> (start)) & ((1L << (len)) - 1));
|
||||
val = ((aml_read_vcbus_s(reg) >> (start)) & ((1L << (len)) - 1));
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user