[linux-yocto] [PATCH 2/2] drivers/misc: Cleanup the Axxia NCR Driver
Cristian Bercaru
cristian.bercaru at windriver.com
Fri Nov 13 10:29:16 PST 2015
From: John Jacques <john.jacques at intel.com>
Cleanup, remove old code, and remove unneccesary locking.
Signed-off-by: John Jacques <john.jacques at intel.com>
---
arch/arm/include/asm/lsi/acp_ncr.h | 45 --------------------------------
arch/arm/mach-axxia/axxia.c | 1 -
arch/arm/mach-axxia/ddr_retention.c | 3 +--
arch/arm/mach-axxia/include/mach/ncr.h | 44 -------------------------------
arch/arm/mach-axxia/rapidio.c | 2 +-
drivers/edac/axxia_edac-l2_cpu.c | 2 +-
drivers/edac/axxia_edac-l3.c | 2 +-
drivers/edac/axxia_edac-mc.c | 2 +-
drivers/misc/lsi-ncr.c | 30 ++++++++++++++++-----
9 files changed, 29 insertions(+), 102 deletions(-)
delete mode 100644 arch/arm/include/asm/lsi/acp_ncr.h
delete mode 100644 arch/arm/mach-axxia/include/mach/ncr.h
diff --git a/arch/arm/include/asm/lsi/acp_ncr.h b/arch/arm/include/asm/lsi/acp_ncr.h
deleted file mode 100644
index 114a36b..0000000
--- a/arch/arm/include/asm/lsi/acp_ncr.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * asm/lsi/acp_ncr.h
- *
- * Copyright (C) 2010 LSI
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __DRIVERS_LSI_ACP_NCR_H
-#define __DRIVERS_LSI_ACP_NCR_H
-
-#ifndef NCP_REGION_ID
-#define NCP_REGION_ID(node, target) \
-(unsigned long)((((node) & 0xffff) << 16) | ((target) & 0xffff))
-#endif
-
-#ifndef NCP_NODE_ID
-#define NCP_NODE_ID(region) (((region) >> 16) & 0xffff)
-#endif
-
-#ifndef NCP_TARGET_ID
-#define NCP_TARGET_ID(region) ((region) & 0xffff)
-#endif
-
-int ncr_read(unsigned long, unsigned long, int, void *);
-int ncr_write(unsigned long, unsigned long, int, void *);
-
-int is_asic(void);
-
-extern int acp_mdio_read(unsigned long, unsigned long, unsigned short *, int);
-extern int acp_mdio_write(unsigned long, unsigned long, unsigned short, int);
-
-#endif /* __DRIVERS_LSI_ACP_NCR_H */
diff --git a/arch/arm/mach-axxia/axxia.c b/arch/arm/mach-axxia/axxia.c
index ce87da6..2105c32 100644
--- a/arch/arm/mach-axxia/axxia.c
+++ b/arch/arm/mach-axxia/axxia.c
@@ -50,7 +50,6 @@
#include <mach/timers.h>
#include <mach/axxia-gic.h>
#include <linux/irqchip/arm-gic.h>
-#include <mach/ncr.h>
#include "axxia.h"
#include "pci.h"
#ifdef CONFIG_AXXIA_RIO
diff --git a/arch/arm/mach-axxia/ddr_retention.c b/arch/arm/mach-axxia/ddr_retention.c
index 25b0d7a..c897992 100644
--- a/arch/arm/mach-axxia/ddr_retention.c
+++ b/arch/arm/mach-axxia/ddr_retention.c
@@ -31,9 +31,8 @@
#include <linux/of.h>
#include <linux/io.h>
#include <asm/cacheflush.h>
-#include <mach/ncr.h>
#include "axxia.h"
-#include "../../drivers/misc/lsi-ncr.h"
+#include "../../../drivers/misc/lsi-ncr.h"
static void __iomem *nca;
static void __iomem *apb;
diff --git a/arch/arm/mach-axxia/include/mach/ncr.h b/arch/arm/mach-axxia/include/mach/ncr.h
deleted file mode 100644
index 926d366..0000000
--- a/arch/arm/mach-axxia/include/mach/ncr.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * arch/arm/mach-axxia/include/mach/ncr.h
- *
- * Copyright (C) 2010 LSI
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __ARCH_ARM_MACH_AXXIA_NCR_H
-#define __ARCH_ARM_MACH_AXXIA_NCR_H
-
-#ifndef NCP_REGION_ID
-#define NCP_REGION_ID(node, target) \
-((unsigned long) ((((node) & 0xffff) << 16) | ((target) & 0xffff)))
-#endif
-
-#ifndef NCP_NODE_ID
-#define NCP_NODE_ID(region) (((region) >> 16) & 0xffff)
-#endif
-
-#ifndef NCP_TARGET_ID
-#define NCP_TARGET_ID(region) ((region) & 0xffff)
-#endif
-
-unsigned long ncr_register_read(unsigned *);
-void ncr_register_write(const unsigned, unsigned *);
-int ncr_read(unsigned long, unsigned long, int, void *);
-int ncr_write(unsigned long, unsigned long, int, void *);
-int ncr_init(void);
-void ncr_exit(void);
-
-#endif /* __ARCH_ARM_MACH_AXXIA_NCR_H */
diff --git a/arch/arm/mach-axxia/rapidio.c b/arch/arm/mach-axxia/rapidio.c
index 4de8787..1619464 100644
--- a/arch/arm/mach-axxia/rapidio.c
+++ b/arch/arm/mach-axxia/rapidio.c
@@ -32,7 +32,7 @@
#include <linux/io.h>
#include <linux/signal.h>
-#include <mach/ncr.h>
+#include "../../../drivers/misc/lsi-ncr.h"
#include <mach/rio.h>
/**
diff --git a/drivers/edac/axxia_edac-l2_cpu.c b/drivers/edac/axxia_edac-l2_cpu.c
index b1dd029..2face86 100644
--- a/drivers/edac/axxia_edac-l2_cpu.c
+++ b/drivers/edac/axxia_edac-l2_cpu.c
@@ -26,7 +26,7 @@
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/edac.h>
-#include <mach/ncr.h>
+#include "../misc/lsi-ncr.h"
#include <linux/of_platform.h>
#include <linux/of.h>
#include <linux/of_address.h>
diff --git a/drivers/edac/axxia_edac-l3.c b/drivers/edac/axxia_edac-l3.c
index 2732490..73674cf 100644
--- a/drivers/edac/axxia_edac-l3.c
+++ b/drivers/edac/axxia_edac-l3.c
@@ -26,7 +26,7 @@
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/edac.h>
-#include <mach/ncr.h>
+#include "../misc/lsi-ncr.h"
#include <linux/of_platform.h>
#include <linux/of.h>
#include <linux/of_address.h>
diff --git a/drivers/edac/axxia_edac-mc.c b/drivers/edac/axxia_edac-mc.c
index 643ed38..bc3b004 100644
--- a/drivers/edac/axxia_edac-mc.c
+++ b/drivers/edac/axxia_edac-mc.c
@@ -26,7 +26,7 @@
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/edac.h>
-#include <mach/ncr.h>
+#include "../misc/lsi-ncr.h"
#include <linux/of_platform.h>
#include <linux/of.h>
#include <linux/of_address.h>
diff --git a/drivers/misc/lsi-ncr.c b/drivers/misc/lsi-ncr.c
index 6a4a208..3c78d1b 100644
--- a/drivers/misc/lsi-ncr.c
+++ b/drivers/misc/lsi-ncr.c
@@ -22,14 +22,13 @@
#include <linux/module.h>
#include <linux/io.h>
+#include <linux/of.h>
#include "lsi-ncr.h"
-#ifdef CONFIG_ARM
-#include <../../arch/arm/mach-axxia/axxia.h>
-#endif
#ifdef CONFIG_ARCH_AXXIA
#define NCA_PHYS_ADDRESS 0x002020100000ULL
#define APB2SER_PHY_PHYS_ADDRESS 0x002010000000ULL
+#define SYSCON_PHYS_ADDR 0x002010030000ULL
#else
#define NCA_PHYS_ADDRESS 0x002000520000ULL
#endif
@@ -728,14 +727,24 @@ EXPORT_SYMBOL(ncr_write);
static int
ncr_init(void)
{
+#ifdef CONFIG_ARCH_AXXIA
+ u32 pfuse;
+ u32 chip_type;
+ u32 chip_ver;
+ void __iomem *syscon;
+
+ syscon = ioremap(SYSCON_PHYS_ADDR, SZ_64K);
+
+ if (WARN_ON(!syscon))
+ return -ENODEV;
/*
* read chip type/revision to determine if low-level locking
* is required and select the appropriate io_fns.
*/
- u32 pfuse = readl(syscon + 0x34);
- u32 chip_type = pfuse & 0x1f;
- u32 chip_ver = (pfuse >> 8) & 0x7;
+ pfuse = readl(syscon + 0x34);
+ chip_type = pfuse & 0x1f;
+ chip_ver = (pfuse >> 8) & 0x7;
if ((chip_type == 0 || chip_type == 9) && (chip_ver == 0)) {
/* AXM5516v1.0 needs low-level locking */
@@ -745,6 +754,15 @@ ncr_init(void)
default_io_fn = &ncr_io_fn_nolock;
}
+ iounmap(syscon);
+#else
+ /* 3500 doesn't need the lock, 3400 does. */
+ if (of_find_compatible_node(NULL, NULL, "lsi,acp3500"))
+ default_io_fn = &ncr_io_fn_nolock;
+ else
+ default_io_fn = &ncr_io_fn_lock;
+#endif
+
nca_address = ioremap(NCA_PHYS_ADDRESS, 0x20000);
#ifdef APB2SER_PHY_PHYS_ADDRESS
--
1.7.9.5
More information about the linux-yocto
mailing list