aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-03-21 12:59:19 -0400
committerJason Cooper <jason@lakedaemon.net>2013-04-15 10:06:39 -0400
commit95b80e0a9ab3c1c8b41af5f2863801708f8f7288 (patch)
treee64757a5964eb9b745e9357581476a80d01ab3ee /arch/arm
parent5d1190ea69cd158835518d4132b3d98774073092 (diff)
arm: mach-mv78xx0: convert to use the mvebu-mbus driver
This commit convers the mach-mv78xx0 sub-architecture to use the mvebu-mbus driver. We simply have to call mvebu_mbus_init() in the ->init_early() function, and modify the PCIe code so that it uses the new functions provided by mvebu-mbus to create the needed PCIe windows. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-mv78xx0/Makefile2
-rw-r--r--arch/arm/mach-mv78xx0/addr-map.c93
-rw-r--r--arch/arm/mach-mv78xx0/common.c10
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/mv78xx0.h9
-rw-r--r--arch/arm/mach-mv78xx0/pcie.c21
-rw-r--r--arch/arm/plat-orion/Makefile2
7 files changed, 30 insertions, 108 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b6f5f28ef007..9462dd931b33 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -588,6 +588,7 @@ config ARCH_MV78XX0
588 select GENERIC_CLOCKEVENTS 588 select GENERIC_CLOCKEVENTS
589 select PCI 589 select PCI
590 select PLAT_ORION_LEGACY 590 select PLAT_ORION_LEGACY
591 select MVEBU_MBUS
591 help 592 help
592 Support for the following Marvell MV78xx0 series SoCs: 593 Support for the following Marvell MV78xx0 series SoCs:
593 MV781x0, MV782x0. 594 MV781x0, MV782x0.
diff --git a/arch/arm/mach-mv78xx0/Makefile b/arch/arm/mach-mv78xx0/Makefile
index 67a13f9bfe64..7cd04634d302 100644
--- a/arch/arm/mach-mv78xx0/Makefile
+++ b/arch/arm/mach-mv78xx0/Makefile
@@ -1,4 +1,4 @@
1obj-y += common.o addr-map.o mpp.o irq.o pcie.o 1obj-y += common.o mpp.o irq.o pcie.o
2obj-$(CONFIG_MACH_DB78X00_BP) += db78x00-bp-setup.o 2obj-$(CONFIG_MACH_DB78X00_BP) += db78x00-bp-setup.o
3obj-$(CONFIG_MACH_RD78X00_MASA) += rd78x00-masa-setup.o 3obj-$(CONFIG_MACH_RD78X00_MASA) += rd78x00-masa-setup.o
4obj-$(CONFIG_MACH_TERASTATION_WXL) += buffalo-wxl-setup.o 4obj-$(CONFIG_MACH_TERASTATION_WXL) += buffalo-wxl-setup.o
diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c
deleted file mode 100644
index 26e9876b50e9..000000000000
--- a/arch/arm/mach-mv78xx0/addr-map.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * arch/arm/mach-mv78xx0/addr-map.c
3 *
4 * Address map functions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <linux/io.h>
15#include <plat/addr-map.h>
16#include <mach/mv78xx0.h>
17#include "common.h"
18
19/*
20 * Generic Address Decode Windows bit settings
21 */
22#define TARGET_DEV_BUS 1
23#define TARGET_PCIE0 4
24#define TARGET_PCIE1 8
25#define TARGET_PCIE(i) ((i) ? TARGET_PCIE1 : TARGET_PCIE0)
26#define ATTR_DEV_SPI_ROM 0x1f
27#define ATTR_DEV_BOOT 0x2f
28#define ATTR_DEV_CS3 0x37
29#define ATTR_DEV_CS2 0x3b
30#define ATTR_DEV_CS1 0x3d
31#define ATTR_DEV_CS0 0x3e
32#define ATTR_PCIE_IO(l) (0xf0 & ~(0x10 << (l)))
33#define ATTR_PCIE_MEM(l) (0xf8 & ~(0x10 << (l)))
34
35/*
36 * CPU Address Decode Windows registers
37 */
38#define WIN0_OFF(n) (BRIDGE_VIRT_BASE + 0x0000 + ((n) << 4))
39#define WIN8_OFF(n) (BRIDGE_VIRT_BASE + 0x0900 + (((n) - 8) << 4))
40
41static void __init __iomem *win_cfg_base(const struct orion_addr_map_cfg *cfg, int win)
42{
43 /*
44 * Find the control register base address for this window.
45 *
46 * BRIDGE_VIRT_BASE points to the right (CPU0's or CPU1's)
47 * MBUS bridge depending on which CPU core we're running on,
48 * so we don't need to take that into account here.
49 */
50
51 return (win < 8) ? WIN0_OFF(win) : WIN8_OFF(win);
52}
53
54/*
55 * Description of the windows needed by the platform code
56 */
57static struct orion_addr_map_cfg addr_map_cfg __initdata = {
58 .num_wins = 14,
59 .remappable_wins = 8,
60 .win_cfg_base = win_cfg_base,
61};
62
63void __init mv78xx0_setup_cpu_mbus(void)
64{
65 /*
66 * Disable, clear and configure windows.
67 */
68 orion_config_wins(&addr_map_cfg, NULL);
69
70 /*
71 * Setup MBUS dram target info.
72 */
73 if (mv78xx0_core_index() == 0)
74 orion_setup_cpu_mbus_target(&addr_map_cfg,
75 (void __iomem *) DDR_WINDOW_CPU0_BASE);
76 else
77 orion_setup_cpu_mbus_target(&addr_map_cfg,
78 (void __iomem *) DDR_WINDOW_CPU1_BASE);
79}
80
81void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
82 int maj, int min)
83{
84 orion_setup_cpu_win(&addr_map_cfg, window, base, size,
85 TARGET_PCIE(maj), ATTR_PCIE_IO(min), 0);
86}
87
88void __init mv78xx0_setup_pcie_mem_win(int window, u32 base, u32 size,
89 int maj, int min)
90{
91 orion_setup_cpu_win(&addr_map_cfg, window, base, size,
92 TARGET_PCIE(maj), ATTR_PCIE_MEM(min), -1);
93}
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 0efa14498ebc..749a7f8c4992 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -334,6 +334,14 @@ void __init mv78xx0_uart3_init(void)
334void __init mv78xx0_init_early(void) 334void __init mv78xx0_init_early(void)
335{ 335{
336 orion_time_set_base(TIMER_VIRT_BASE); 336 orion_time_set_base(TIMER_VIRT_BASE);
337 if (mv78xx0_core_index() == 0)
338 mvebu_mbus_init("marvell,mv78xx0-mbus",
339 BRIDGE_WINS_CPU0_BASE, BRIDGE_WINS_SZ,
340 DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ);
341 else
342 mvebu_mbus_init("marvell,mv78xx0-mbus",
343 BRIDGE_WINS_CPU1_BASE, BRIDGE_WINS_SZ,
344 DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ);
337} 345}
338 346
339void __init_refok mv78xx0_timer_init(void) 347void __init_refok mv78xx0_timer_init(void)
@@ -397,8 +405,6 @@ void __init mv78xx0_init(void)
397 printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000); 405 printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000);
398 printk("TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000); 406 printk("TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000);
399 407
400 mv78xx0_setup_cpu_mbus();
401
402#ifdef CONFIG_CACHE_FEROCEON_L2 408#ifdef CONFIG_CACHE_FEROCEON_L2
403 feroceon_l2_init(is_l2_writethrough()); 409 feroceon_l2_init(is_l2_writethrough());
404#endif 410#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
index 46200a183cf2..723748d8ba7d 100644
--- a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
+++ b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
@@ -60,13 +60,18 @@
60 */ 60 */
61#define BRIDGE_VIRT_BASE (MV78XX0_CORE_REGS_VIRT_BASE) 61#define BRIDGE_VIRT_BASE (MV78XX0_CORE_REGS_VIRT_BASE)
62#define BRIDGE_PHYS_BASE (MV78XX0_CORE_REGS_PHYS_BASE) 62#define BRIDGE_PHYS_BASE (MV78XX0_CORE_REGS_PHYS_BASE)
63#define BRIDGE_WINS_CPU0_BASE (MV78XX0_CORE0_REGS_PHYS_BASE)
64#define BRIDGE_WINS_CPU1_BASE (MV78XX0_CORE1_REGS_PHYS_BASE)
65#define BRIDGE_WINS_SZ (0xA000)
63 66
64/* 67/*
65 * Register Map 68 * Register Map
66 */ 69 */
67#define DDR_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x00000) 70#define DDR_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x00000)
68#define DDR_WINDOW_CPU0_BASE (DDR_VIRT_BASE + 0x1500) 71#define DDR_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x00000)
69#define DDR_WINDOW_CPU1_BASE (DDR_VIRT_BASE + 0x1570) 72#define DDR_WINDOW_CPU0_BASE (DDR_PHYS_BASE + 0x1500)
73#define DDR_WINDOW_CPU1_BASE (DDR_PHYS_BASE + 0x1570)
74#define DDR_WINDOW_CPU_SZ (0x20)
70 75
71#define DEV_BUS_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x10000) 76#define DEV_BUS_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x10000)
72#define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x10000) 77#define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x10000)
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
index ee8c0b51df2c..dc26a654c496 100644
--- a/arch/arm/mach-mv78xx0/pcie.c
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -10,11 +10,11 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/mbus.h>
13#include <video/vga.h> 14#include <video/vga.h>
14#include <asm/irq.h> 15#include <asm/irq.h>
15#include <asm/mach/pci.h> 16#include <asm/mach/pci.h>
16#include <plat/pcie.h> 17#include <plat/pcie.h>
17#include <plat/addr-map.h>
18#include <mach/mv78xx0.h> 18#include <mach/mv78xx0.h>
19#include "common.h" 19#include "common.h"
20 20
@@ -54,7 +54,6 @@ static void __init mv78xx0_pcie_preinit(void)
54 int i; 54 int i;
55 u32 size_each; 55 u32 size_each;
56 u32 start; 56 u32 start;
57 int win = 0;
58 57
59 pcie_io_space.name = "PCIe I/O Space"; 58 pcie_io_space.name = "PCIe I/O Space";
60 pcie_io_space.start = MV78XX0_PCIE_IO_PHYS_BASE(0); 59 pcie_io_space.start = MV78XX0_PCIE_IO_PHYS_BASE(0);
@@ -72,6 +71,7 @@ static void __init mv78xx0_pcie_preinit(void)
72 start = MV78XX0_PCIE_MEM_PHYS_BASE; 71 start = MV78XX0_PCIE_MEM_PHYS_BASE;
73 for (i = 0; i < num_pcie_ports; i++) { 72 for (i = 0; i < num_pcie_ports; i++) {
74 struct pcie_port *pp = pcie_port + i; 73 struct pcie_port *pp = pcie_port + i;
74 char winname[MVEBU_MBUS_MAX_WINNAME_SZ];
75 75
76 snprintf(pp->mem_space_name, sizeof(pp->mem_space_name), 76 snprintf(pp->mem_space_name, sizeof(pp->mem_space_name),
77 "PCIe %d.%d MEM", pp->maj, pp->min); 77 "PCIe %d.%d MEM", pp->maj, pp->min);
@@ -85,12 +85,17 @@ static void __init mv78xx0_pcie_preinit(void)
85 if (request_resource(&iomem_resource, &pp->res)) 85 if (request_resource(&iomem_resource, &pp->res))
86 panic("can't allocate PCIe MEM sub-space"); 86 panic("can't allocate PCIe MEM sub-space");
87 87
88 mv78xx0_setup_pcie_mem_win(win + i + 8, pp->res.start, 88 snprintf(winname, sizeof(winname), "pcie%d.%d",
89 resource_size(&pp->res), 89 pp->maj, pp->min);
90 pp->maj, pp->min); 90
91 91 mvebu_mbus_add_window_remap_flags(winname,
92 mv78xx0_setup_pcie_io_win(win + i, i * SZ_64K, SZ_64K, 92 pp->res.start,
93 pp->maj, pp->min); 93 resource_size(&pp->res),
94 MVEBU_MBUS_NO_REMAP,
95 MVEBU_MBUS_PCI_MEM);
96 mvebu_mbus_add_window_remap_flags(winname,
97 i * SZ_64K, SZ_64K,
98 0, MVEBU_MBUS_PCI_IO);
94 } 99 }
95} 100}
96 101
diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile
index 09711cdc6817..2eca54b65906 100644
--- a/arch/arm/plat-orion/Makefile
+++ b/arch/arm/plat-orion/Makefile
@@ -3,8 +3,6 @@
3# 3#
4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include 4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
5 5
6obj-$(CONFIG_ARCH_MV78XX0) += addr-map.o
7
8orion-gpio-$(CONFIG_GENERIC_GPIO) += gpio.o 6orion-gpio-$(CONFIG_GENERIC_GPIO) += gpio.o
9obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o 7obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o
10obj-$(CONFIG_PLAT_ORION_LEGACY) += $(orion-gpio-y) 8obj-$(CONFIG_PLAT_ORION_LEGACY) += $(orion-gpio-y)