#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/amlogic/iomap.h>
-#include <linux/amlogic/cpu_version.h>
#include <asm/compiler.h>
#undef pr_fmt
#define pr_fmt(fmt) "aml_iomap: " fmt
{ .compatible = "amlogic, iomap" },
{ /* sentinel */ },
};
-void __iomem *meson_reg_map[IO_BUS_MAX];
+
+static void __iomem *meson_reg_map[IO_BUS_MAX] = { NULL };
int aml_reg_read(u32 bus_type, unsigned int reg, unsigned int *val)
{
- if (bus_type < IO_BUS_MAX) {
+ if (bus_type < IO_BUS_MAX && (meson_reg_map[bus_type] != NULL)) {
*val = readl((meson_reg_map[bus_type]+reg));
return 0;
} else
int aml_reg_write(u32 bus_type, unsigned int reg, unsigned int val)
{
- if (bus_type < IO_BUS_MAX) {
+ if (bus_type < IO_BUS_MAX && (meson_reg_map[bus_type] != NULL)) {
writel(val, (meson_reg_map[bus_type]+reg));
return 0;
} else
unsigned int reg, unsigned int mask,
unsigned int val)
{
- if (bus_type < IO_BUS_MAX) {
+ if (bus_type < IO_BUS_MAX && (meson_reg_map[bus_type] != NULL)) {
unsigned int tmp, orig;
aml_reg_read(bus_type, reg, &orig);