summaryrefslogtreecommitdiff
path: root/target/linux/mpc83xx/patches-3.8/201-powerpc-add-rb_iomap.patch
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-02-21 20:39:22 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-02-21 20:39:22 +0000
commit9ec9adf3ea4c51fc0e9aece21110b05f57bd76af (patch)
treec1e66354b5a2f0c433bb23113626c39fe4daf9e3 /target/linux/mpc83xx/patches-3.8/201-powerpc-add-rb_iomap.patch
parentc50881d7ba35ccd9e9ed07f3b76f66ce3a4f55de (diff)
downloadmtk-20170518-9ec9adf3ea4c51fc0e9aece21110b05f57bd76af.zip
mtk-20170518-9ec9adf3ea4c51fc0e9aece21110b05f57bd76af.tar.gz
mtk-20170518-9ec9adf3ea4c51fc0e9aece21110b05f57bd76af.tar.bz2
mpc83xx: add support for 3.8
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35736
Diffstat (limited to 'target/linux/mpc83xx/patches-3.8/201-powerpc-add-rb_iomap.patch')
-rw-r--r--target/linux/mpc83xx/patches-3.8/201-powerpc-add-rb_iomap.patch263
1 files changed, 263 insertions, 0 deletions
diff --git a/target/linux/mpc83xx/patches-3.8/201-powerpc-add-rb_iomap.patch b/target/linux/mpc83xx/patches-3.8/201-powerpc-add-rb_iomap.patch
new file mode 100644
index 0000000..d2da62a
--- /dev/null
+++ b/target/linux/mpc83xx/patches-3.8/201-powerpc-add-rb_iomap.patch
@@ -0,0 +1,263 @@
+--- a/arch/powerpc/kernel/Makefile
++++ b/arch/powerpc/kernel/Makefile
+@@ -118,9 +118,11 @@ obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.
+
+ obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o
+
++ifneq ($(CONFIG_RB_IOMAP),y)
+ ifneq ($(CONFIG_PPC_INDIRECT_IO),y)
+ obj-y += iomap.o
+ endif
++endif
+
+ obj-$(CONFIG_PPC64) += $(obj64-y)
+ obj-$(CONFIG_PPC32) += $(obj32-y)
+--- a/arch/powerpc/platforms/83xx/Makefile
++++ b/arch/powerpc/platforms/83xx/Makefile
+@@ -7,6 +7,7 @@ obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mp
+ obj-$(CONFIG_MPC830x_RDB) += mpc830x_rdb.o
+ obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o
+ obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o
++obj-$(CONFIG_RB_PPC) += rbppc.o
+ obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o
+ obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o
+ obj-$(CONFIG_MPC836x_MDS) += mpc836x_mds.o
+--- a/arch/powerpc/platforms/Kconfig
++++ b/arch/powerpc/platforms/Kconfig
+@@ -192,6 +192,10 @@ config PPC_INDIRECT_MMIO
+ config PPC_IO_WORKAROUNDS
+ bool
+
++config RB_IOMAP
++ bool
++ default y if RB_PPC
++
+ source "drivers/cpufreq/Kconfig"
+
+ menu "CPU Frequency drivers"
+--- a/arch/powerpc/sysdev/Makefile
++++ b/arch/powerpc/sysdev/Makefile
+@@ -69,3 +69,6 @@ subdir-ccflags-$(CONFIG_PPC_WERROR) := -
+ obj-$(CONFIG_PPC_XICS) += xics/
+
+ obj-$(CONFIG_GE_FPGA) += ge/
++
++obj-$(CONFIG_RB_IOMAP) += rb_iomap.o
++
+--- /dev/null
++++ b/arch/powerpc/sysdev/rb_iomap.c
+@@ -0,0 +1,204 @@
++#include <linux/init.h>
++#include <linux/pci.h>
++#include <linux/mm.h>
++#include <asm/io.h>
++
++#define LOCALBUS_START 0x40000000
++#define LOCALBUS_MASK 0x007fffff
++#define LOCALBUS_REGMASK 0x001fffff
++
++static void __iomem *localbus_base;
++
++static inline int is_localbus(void __iomem *addr)
++{
++ return ((unsigned) addr & ~LOCALBUS_MASK) == LOCALBUS_START;
++}
++
++static inline unsigned localbus_regoff(unsigned reg) {
++ return (reg << 16) | (((reg ^ 8) & 8) << 17);
++}
++
++static inline void __iomem *localbus_addr(void __iomem *addr)
++{
++ return localbus_base
++ + ((unsigned) addr & LOCALBUS_MASK & ~LOCALBUS_REGMASK)
++ + localbus_regoff((unsigned) addr & LOCALBUS_REGMASK);
++}
++
++unsigned int ioread8(void __iomem *addr)
++{
++ if (is_localbus(addr))
++ return in_be16(localbus_addr(addr)) >> 8;
++ return readb(addr);
++}
++EXPORT_SYMBOL(ioread8);
++
++unsigned int ioread16(void __iomem *addr)
++{
++ if (is_localbus(addr))
++ return le16_to_cpu(in_be16(localbus_addr(addr)));
++ return readw(addr);
++}
++EXPORT_SYMBOL(ioread16);
++
++unsigned int ioread16be(void __iomem *addr)
++{
++ return in_be16(addr);
++}
++EXPORT_SYMBOL(ioread16be);
++
++unsigned int ioread32(void __iomem *addr)
++{
++ return readl(addr);
++}
++EXPORT_SYMBOL(ioread32);
++
++unsigned int ioread32be(void __iomem *addr)
++{
++ return in_be32(addr);
++}
++EXPORT_SYMBOL(ioread32be);
++
++void iowrite8(u8 val, void __iomem *addr)
++{
++ if (is_localbus(addr))
++ out_be16(localbus_addr(addr), ((u16) val) << 8);
++ else
++ writeb(val, addr);
++}
++EXPORT_SYMBOL(iowrite8);
++
++void iowrite16(u16 val, void __iomem *addr)
++{
++ if (is_localbus(addr))
++ out_be16(localbus_addr(addr), cpu_to_le16(val));
++ else
++ writew(val, addr);
++}
++EXPORT_SYMBOL(iowrite16);
++
++void iowrite16be(u16 val, void __iomem *addr)
++{
++ out_be16(addr, val);
++}
++EXPORT_SYMBOL(iowrite16be);
++
++void iowrite32(u32 val, void __iomem *addr)
++{
++ writel(val, addr);
++}
++EXPORT_SYMBOL(iowrite32);
++
++void iowrite32be(u32 val, void __iomem *addr)
++{
++ out_be32(addr, val);
++}
++EXPORT_SYMBOL(iowrite32be);
++
++void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
++{
++ if (is_localbus(addr)) {
++ unsigned i;
++ void *laddr = localbus_addr(addr);
++ u8 *buf = dst;
++
++ for (i = 0; i < count; ++i) {
++ *buf++ = in_be16(laddr) >> 8;
++ }
++ } else {
++ _insb((u8 __iomem *) addr, dst, count);
++ }
++}
++EXPORT_SYMBOL(ioread8_rep);
++
++void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
++{
++ if (is_localbus(addr)) {
++ unsigned i;
++ void *laddr = localbus_addr(addr);
++ u16 *buf = dst;
++
++ for (i = 0; i < count; ++i) {
++ *buf++ = in_be16(laddr);
++ }
++ } else {
++ _insw_ns((u16 __iomem *) addr, dst, count);
++ }
++}
++EXPORT_SYMBOL(ioread16_rep);
++
++void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
++{
++ _insl_ns((u32 __iomem *) addr, dst, count);
++}
++EXPORT_SYMBOL(ioread32_rep);
++
++void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
++{
++ if (is_localbus(addr)) {
++ unsigned i;
++ void *laddr = localbus_addr(addr);
++ const u8 *buf = src;
++
++ for (i = 0; i < count; ++i) {
++ out_be16(laddr, ((u16) *buf++) << 8);
++ }
++ } else {
++ _outsb((u8 __iomem *) addr, src, count);
++ }
++}
++EXPORT_SYMBOL(iowrite8_rep);
++
++void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
++{
++ if (is_localbus(addr)) {
++ unsigned i;
++ void *laddr = localbus_addr(addr);
++ const u16 *buf = src;
++
++ for (i = 0; i < count; ++i) {
++ out_be16(laddr, *buf++);
++ }
++ } else {
++ _outsw_ns((u16 __iomem *) addr, src, count);
++ }
++}
++EXPORT_SYMBOL(iowrite16_rep);
++
++void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
++{
++ _outsl_ns((u32 __iomem *) addr, src, count);
++}
++EXPORT_SYMBOL(iowrite32_rep);
++
++void __iomem *ioport_map(unsigned long port, unsigned int len)
++{
++ return (void __iomem *) (port + _IO_BASE);
++}
++EXPORT_SYMBOL(ioport_unmap);
++
++void ioport_unmap(void __iomem *addr)
++{
++ /* Nothing to do */
++}
++EXPORT_SYMBOL(ioport_map);
++
++void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
++{
++ /* Nothing to do */
++}
++EXPORT_SYMBOL(pci_iounmap);
++
++void __iomem *localbus_map(unsigned long addr, unsigned int len)
++{
++ if (!localbus_base)
++ localbus_base = ioremap(addr & ~LOCALBUS_MASK,
++ LOCALBUS_MASK + 1);
++ return (void *) (LOCALBUS_START + (addr & LOCALBUS_MASK));
++}
++EXPORT_SYMBOL(localbus_map);
++
++void localbus_unmap(void __iomem *addr)
++{
++}
++EXPORT_SYMBOL(localbus_unmap);
+--- a/arch/powerpc/platforms/83xx/Kconfig
++++ b/arch/powerpc/platforms/83xx/Kconfig
+@@ -44,6 +44,7 @@ config RB_PPC
+ select QUICC_ENGINE
+ select PPC_MPC832x
+ select PPC_MPC834x
++ select RB_IOMAP
+ help
+ This option enables support for MikroTik RouterBOARD 333/600 series boards.
+