* [PATCH 1/5] arm: plat-orion: use 'void __iomem *' in addr-map code
2012-08-03 14:13 [v2] arm: mvebu: Add basic address decoding support for Marvell 370/XP Thomas Petazzoni
@ 2012-08-03 14:13 ` Thomas Petazzoni
2012-09-09 20:45 ` Jason Cooper
2012-08-03 14:13 ` [PATCH 2/5] arm: plat-orion: introduce PLAT_ORION_LEGACY hidden config option Thomas Petazzoni
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2012-08-03 14:13 UTC (permalink / raw)
To: linux-arm-kernel
Use 'void __iomem *' instead of u32 where appropriate in the addr-map
code. It requires adding a few casts in SoC-specific addr-map.c files,
but those casts will disappear once those SoC are migrated to the
device tree, in which case the address will come from the DT instead
of from #define values.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
arch/arm/mach-dove/addr-map.c | 2 +-
arch/arm/mach-kirkwood/addr-map.c | 5 +++--
arch/arm/mach-mv78xx0/addr-map.c | 4 ++--
arch/arm/mach-orion5x/addr-map.c | 5 +++--
arch/arm/plat-orion/addr-map.c | 11 ++++-------
arch/arm/plat-orion/include/plat/addr-map.h | 4 ++--
6 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/arch/arm/mach-dove/addr-map.c b/arch/arm/mach-dove/addr-map.c
index 2a06c01..adb428e 100644
--- a/arch/arm/mach-dove/addr-map.c
+++ b/arch/arm/mach-dove/addr-map.c
@@ -47,7 +47,7 @@ static inline void __iomem *ddr_map_sc(int i)
static struct __initdata orion_addr_map_cfg addr_map_cfg = {
.num_wins = 8,
.remappable_wins = 4,
- .bridge_virt_base = BRIDGE_VIRT_BASE,
+ .bridge_virt_base = (void __iomem *) BRIDGE_VIRT_BASE,
};
static const struct __initdata orion_addr_map_info addr_map_info[] = {
diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c
index e9a7180..2b27de6 100644
--- a/arch/arm/mach-kirkwood/addr-map.c
+++ b/arch/arm/mach-kirkwood/addr-map.c
@@ -41,7 +41,7 @@
static struct __initdata orion_addr_map_cfg addr_map_cfg = {
.num_wins = 8,
.remappable_wins = 4,
- .bridge_virt_base = BRIDGE_VIRT_BASE,
+ .bridge_virt_base = (void __iomem *) BRIDGE_VIRT_BASE,
};
static const struct __initdata orion_addr_map_info addr_map_info[] = {
@@ -86,5 +86,6 @@ void __init kirkwood_setup_cpu_mbus(void)
/*
* Setup MBUS dram target info.
*/
- orion_setup_cpu_mbus_target(&addr_map_cfg, DDR_WINDOW_CPU_BASE);
+ orion_setup_cpu_mbus_target(&addr_map_cfg,
+ (void __iomem *) DDR_WINDOW_CPU_BASE);
}
diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c
index 62b53d7..bac31e4 100644
--- a/arch/arm/mach-mv78xx0/addr-map.c
+++ b/arch/arm/mach-mv78xx0/addr-map.c
@@ -71,10 +71,10 @@ void __init mv78xx0_setup_cpu_mbus(void)
*/
if (mv78xx0_core_index() == 0)
orion_setup_cpu_mbus_target(&addr_map_cfg,
- DDR_WINDOW_CPU0_BASE);
+ (void __iomem *) DDR_WINDOW_CPU0_BASE);
else
orion_setup_cpu_mbus_target(&addr_map_cfg,
- DDR_WINDOW_CPU1_BASE);
+ (void __iomem *) DDR_WINDOW_CPU1_BASE);
}
void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index eaac83d..bfe4f10 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -79,7 +79,7 @@ static int __init cpu_win_can_remap(const struct orion_addr_map_cfg *cfg,
static struct orion_addr_map_cfg addr_map_cfg __initdata = {
.num_wins = 8,
.cpu_win_can_remap = cpu_win_can_remap,
- .bridge_virt_base = ORION5X_BRIDGE_VIRT_BASE,
+ .bridge_virt_base = (void __iomem *) ORION5X_BRIDGE_VIRT_BASE,
};
static const struct __initdata orion_addr_map_info addr_map_info[] = {
@@ -113,7 +113,8 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
/*
* Setup MBUS dram target info.
*/
- orion_setup_cpu_mbus_target(&addr_map_cfg, ORION5X_DDR_WINDOW_CPU_BASE);
+ orion_setup_cpu_mbus_target(&addr_map_cfg,
+ (void __iomem *) ORION5X_DDR_WINDOW_CPU_BASE);
}
void __init orion5x_setup_dev_boot_win(u32 base, u32 size)
diff --git a/arch/arm/plat-orion/addr-map.c b/arch/arm/plat-orion/addr-map.c
index 367ca89..a7b8060 100644
--- a/arch/arm/plat-orion/addr-map.c
+++ b/arch/arm/plat-orion/addr-map.c
@@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(mv_mbus_dram_info);
static void __init __iomem *
orion_win_cfg_base(const struct orion_addr_map_cfg *cfg, int win)
{
- return (void __iomem *)(cfg->bridge_virt_base + (win << 4));
+ return cfg->bridge_virt_base + (win << 4);
}
/*
@@ -143,19 +143,16 @@ void __init orion_config_wins(struct orion_addr_map_cfg * cfg,
* Setup MBUS dram target info.
*/
void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
- const u32 ddr_window_cpu_base)
+ const void __iomem *ddr_window_cpu_base)
{
- void __iomem *addr;
int i;
int cs;
orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
- addr = (void __iomem *)ddr_window_cpu_base;
-
for (i = 0, cs = 0; i < 4; i++) {
- u32 base = readl(addr + DDR_BASE_CS_OFF(i));
- u32 size = readl(addr + DDR_SIZE_CS_OFF(i));
+ u32 base = readl(ddr_window_cpu_base + DDR_BASE_CS_OFF(i));
+ u32 size = readl(ddr_window_cpu_base + DDR_SIZE_CS_OFF(i));
/*
* Chip select enabled?
diff --git a/arch/arm/plat-orion/include/plat/addr-map.h b/arch/arm/plat-orion/include/plat/addr-map.h
index fd556f7..0a746fd 100644
--- a/arch/arm/plat-orion/include/plat/addr-map.h
+++ b/arch/arm/plat-orion/include/plat/addr-map.h
@@ -16,7 +16,7 @@ extern struct mbus_dram_target_info orion_mbus_dram_info;
struct orion_addr_map_cfg {
const int num_wins; /* Total number of windows */
const int remappable_wins;
- const u32 bridge_virt_base;
+ void __iomem * const bridge_virt_base;
/* If NULL, the default cpu_win_can_remap will be used, using
the value in remappable_wins */
@@ -49,5 +49,5 @@ void __init orion_setup_cpu_win(const struct orion_addr_map_cfg *cfg,
const u8 attr, const int remap);
void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
- const u32 ddr_window_cpu_base);
+ const void __iomem *ddr_window_cpu_base);
#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 1/5] arm: plat-orion: use 'void __iomem *' in addr-map code
2012-08-03 14:13 ` [PATCH 1/5] arm: plat-orion: use 'void __iomem *' in addr-map code Thomas Petazzoni
@ 2012-09-09 20:45 ` Jason Cooper
2012-09-11 12:54 ` Thomas Petazzoni
0 siblings, 1 reply; 10+ messages in thread
From: Jason Cooper @ 2012-09-09 20:45 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Aug 03, 2012 at 04:13:53PM +0200, Thomas Petazzoni wrote:
> Use 'void __iomem *' instead of u32 where appropriate in the addr-map
> code. It requires adding a few casts in SoC-specific addr-map.c files,
> but those casts will disappear once those SoC are migrated to the
> device tree, in which case the address will come from the DT instead
> of from #define values.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thomas,
I just wanted to make sure this came to your attention. While
discussing the finer points of branch management for pull requests, Olof
had the following comments regarding this patch:
> > arm: plat-orion: use 'void __iomem *' in addr-map code
>
> Hmm, I would prefer if the actual constants were annotated instead of
> cast in the code here. See how we handled that on tegra with IOMEM().
> That will also help sparse catch unannotated uses of those constants.
Could you please take a look at this? I assume the rest of this series
relies on this patch, so I'm holding off until it's resolved.
thx,
Jason.
> ---
> arch/arm/mach-dove/addr-map.c | 2 +-
> arch/arm/mach-kirkwood/addr-map.c | 5 +++--
> arch/arm/mach-mv78xx0/addr-map.c | 4 ++--
> arch/arm/mach-orion5x/addr-map.c | 5 +++--
> arch/arm/plat-orion/addr-map.c | 11 ++++-------
> arch/arm/plat-orion/include/plat/addr-map.h | 4 ++--
> 6 files changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/mach-dove/addr-map.c b/arch/arm/mach-dove/addr-map.c
> index 2a06c01..adb428e 100644
> --- a/arch/arm/mach-dove/addr-map.c
> +++ b/arch/arm/mach-dove/addr-map.c
> @@ -47,7 +47,7 @@ static inline void __iomem *ddr_map_sc(int i)
> static struct __initdata orion_addr_map_cfg addr_map_cfg = {
> .num_wins = 8,
> .remappable_wins = 4,
> - .bridge_virt_base = BRIDGE_VIRT_BASE,
> + .bridge_virt_base = (void __iomem *) BRIDGE_VIRT_BASE,
> };
>
> static const struct __initdata orion_addr_map_info addr_map_info[] = {
> diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c
> index e9a7180..2b27de6 100644
> --- a/arch/arm/mach-kirkwood/addr-map.c
> +++ b/arch/arm/mach-kirkwood/addr-map.c
> @@ -41,7 +41,7 @@
> static struct __initdata orion_addr_map_cfg addr_map_cfg = {
> .num_wins = 8,
> .remappable_wins = 4,
> - .bridge_virt_base = BRIDGE_VIRT_BASE,
> + .bridge_virt_base = (void __iomem *) BRIDGE_VIRT_BASE,
> };
>
> static const struct __initdata orion_addr_map_info addr_map_info[] = {
> @@ -86,5 +86,6 @@ void __init kirkwood_setup_cpu_mbus(void)
> /*
> * Setup MBUS dram target info.
> */
> - orion_setup_cpu_mbus_target(&addr_map_cfg, DDR_WINDOW_CPU_BASE);
> + orion_setup_cpu_mbus_target(&addr_map_cfg,
> + (void __iomem *) DDR_WINDOW_CPU_BASE);
> }
> diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c
> index 62b53d7..bac31e4 100644
> --- a/arch/arm/mach-mv78xx0/addr-map.c
> +++ b/arch/arm/mach-mv78xx0/addr-map.c
> @@ -71,10 +71,10 @@ void __init mv78xx0_setup_cpu_mbus(void)
> */
> if (mv78xx0_core_index() == 0)
> orion_setup_cpu_mbus_target(&addr_map_cfg,
> - DDR_WINDOW_CPU0_BASE);
> + (void __iomem *) DDR_WINDOW_CPU0_BASE);
> else
> orion_setup_cpu_mbus_target(&addr_map_cfg,
> - DDR_WINDOW_CPU1_BASE);
> + (void __iomem *) DDR_WINDOW_CPU1_BASE);
> }
>
> void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
> diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
> index eaac83d..bfe4f10 100644
> --- a/arch/arm/mach-orion5x/addr-map.c
> +++ b/arch/arm/mach-orion5x/addr-map.c
> @@ -79,7 +79,7 @@ static int __init cpu_win_can_remap(const struct orion_addr_map_cfg *cfg,
> static struct orion_addr_map_cfg addr_map_cfg __initdata = {
> .num_wins = 8,
> .cpu_win_can_remap = cpu_win_can_remap,
> - .bridge_virt_base = ORION5X_BRIDGE_VIRT_BASE,
> + .bridge_virt_base = (void __iomem *) ORION5X_BRIDGE_VIRT_BASE,
> };
>
> static const struct __initdata orion_addr_map_info addr_map_info[] = {
> @@ -113,7 +113,8 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
> /*
> * Setup MBUS dram target info.
> */
> - orion_setup_cpu_mbus_target(&addr_map_cfg, ORION5X_DDR_WINDOW_CPU_BASE);
> + orion_setup_cpu_mbus_target(&addr_map_cfg,
> + (void __iomem *) ORION5X_DDR_WINDOW_CPU_BASE);
> }
>
> void __init orion5x_setup_dev_boot_win(u32 base, u32 size)
> diff --git a/arch/arm/plat-orion/addr-map.c b/arch/arm/plat-orion/addr-map.c
> index 367ca89..a7b8060 100644
> --- a/arch/arm/plat-orion/addr-map.c
> +++ b/arch/arm/plat-orion/addr-map.c
> @@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(mv_mbus_dram_info);
> static void __init __iomem *
> orion_win_cfg_base(const struct orion_addr_map_cfg *cfg, int win)
> {
> - return (void __iomem *)(cfg->bridge_virt_base + (win << 4));
> + return cfg->bridge_virt_base + (win << 4);
> }
>
> /*
> @@ -143,19 +143,16 @@ void __init orion_config_wins(struct orion_addr_map_cfg * cfg,
> * Setup MBUS dram target info.
> */
> void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
> - const u32 ddr_window_cpu_base)
> + const void __iomem *ddr_window_cpu_base)
> {
> - void __iomem *addr;
> int i;
> int cs;
>
> orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
>
> - addr = (void __iomem *)ddr_window_cpu_base;
> -
> for (i = 0, cs = 0; i < 4; i++) {
> - u32 base = readl(addr + DDR_BASE_CS_OFF(i));
> - u32 size = readl(addr + DDR_SIZE_CS_OFF(i));
> + u32 base = readl(ddr_window_cpu_base + DDR_BASE_CS_OFF(i));
> + u32 size = readl(ddr_window_cpu_base + DDR_SIZE_CS_OFF(i));
>
> /*
> * Chip select enabled?
> diff --git a/arch/arm/plat-orion/include/plat/addr-map.h b/arch/arm/plat-orion/include/plat/addr-map.h
> index fd556f7..0a746fd 100644
> --- a/arch/arm/plat-orion/include/plat/addr-map.h
> +++ b/arch/arm/plat-orion/include/plat/addr-map.h
> @@ -16,7 +16,7 @@ extern struct mbus_dram_target_info orion_mbus_dram_info;
> struct orion_addr_map_cfg {
> const int num_wins; /* Total number of windows */
> const int remappable_wins;
> - const u32 bridge_virt_base;
> + void __iomem * const bridge_virt_base;
>
> /* If NULL, the default cpu_win_can_remap will be used, using
> the value in remappable_wins */
> @@ -49,5 +49,5 @@ void __init orion_setup_cpu_win(const struct orion_addr_map_cfg *cfg,
> const u8 attr, const int remap);
>
> void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
> - const u32 ddr_window_cpu_base);
> + const void __iomem *ddr_window_cpu_base);
> #endif
> --
> 1.7.9.5
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 1/5] arm: plat-orion: use 'void __iomem *' in addr-map code
2012-09-09 20:45 ` Jason Cooper
@ 2012-09-11 12:54 ` Thomas Petazzoni
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2012-09-11 12:54 UTC (permalink / raw)
To: linux-arm-kernel
Jason,
Le Sun, 9 Sep 2012 16:45:19 -0400,
Jason Cooper <jason@lakedaemon.net> a ?crit :
> I just wanted to make sure this came to your attention. While
> discussing the finer points of branch management for pull requests,
> Olof had the following comments regarding this patch:
>
> > > arm: plat-orion: use 'void __iomem *' in addr-map code
> >
> > Hmm, I would prefer if the actual constants were annotated instead
> > of cast in the code here. See how we handled that on tegra with
> > IOMEM(). That will also help sparse catch unannotated uses of those
> > constants.
>
> Could you please take a look at this? I assume the rest of this
> series relies on this patch, so I'm holding off until it's resolved.
Sorry for the delay, I was busy working on the Marvell Armada
370/XP network driver. I have now posted a 17 patches series that
should hopefully address Olof's comment (version 4 of this patch
series).
Thanks!
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/5] arm: plat-orion: introduce PLAT_ORION_LEGACY hidden config option
2012-08-03 14:13 [v2] arm: mvebu: Add basic address decoding support for Marvell 370/XP Thomas Petazzoni
2012-08-03 14:13 ` [PATCH 1/5] arm: plat-orion: use 'void __iomem *' in addr-map code Thomas Petazzoni
@ 2012-08-03 14:13 ` Thomas Petazzoni
2012-08-03 14:13 ` [PATCH 3/5] arm: plat-orion: make bridge_virt_base non-const to support DT use case Thomas Petazzoni
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2012-08-03 14:13 UTC (permalink / raw)
To: linux-arm-kernel
Until now, the PLAT_ORION configuration option was common to all the
Marvell EBU SoCs, and selecting this option had the effect of enabling
the MPP code, GPIO code, address decoding and PCIe code from
plat-orion, as well as providing access to driver-specific header
files from plat-orion/include.
However, the Armada 370 and XP SoCs will not use the MPP and GPIO code
(instead some proper pinctrl and gpio drivers are in preparation), and
generally, we want to move away from plat-orion and instead have
everything in mach-mvebu.
That said, in the mean time, we want to leverage the driver-specific
headers as well as the address decoding code, so we introduce
PLAT_ORION_LEGACY. The older Marvell SoCs need to select
PLAT_ORION_LEGACY, while the newer Marvell SoCs need to select
PLAT_ORION. Of course, when PLAT_ORION_LEGACY is selected, it
automatically selects PLAT_ORION.
Then, with just PLAT_ORION, you have the address decoding code plus
the driver-specific headers. If you add PLAT_ORION_LEGACY to this, you
gain the old MPP, GPIO and PCIe code.
Again, this is only a temporary solution until we make all Marvell EBU
platforms converge into the mach-mvebu directory. This solution avoids
duplicating the existing address decoding code into mach-mvebu.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
arch/arm/Kconfig | 13 +++++++++----
arch/arm/plat-orion/Makefile | 9 ++++-----
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7980873..fc36a93 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -573,6 +573,7 @@ config ARCH_MVEBU
select GENERIC_IRQ_CHIP
select IRQ_DOMAIN
select COMMON_CLK
+ select PLAT_ORION
help
Support for the Marvell SoC Family with device tree support
@@ -583,7 +584,7 @@ config ARCH_DOVE
select ARCH_REQUIRE_GPIOLIB
select GENERIC_CLOCKEVENTS
select NEED_MACH_IO_H
- select PLAT_ORION
+ select PLAT_ORION_LEGACY
help
Support for the Marvell Dove SoC 88AP510
@@ -594,7 +595,7 @@ config ARCH_KIRKWOOD
select ARCH_REQUIRE_GPIOLIB
select GENERIC_CLOCKEVENTS
select NEED_MACH_IO_H
- select PLAT_ORION
+ select PLAT_ORION_LEGACY
help
Support for the following Marvell Kirkwood series SoCs:
88F6180, 88F6192 and 88F6281.
@@ -621,7 +622,7 @@ config ARCH_MV78XX0
select ARCH_REQUIRE_GPIOLIB
select GENERIC_CLOCKEVENTS
select NEED_MACH_IO_H
- select PLAT_ORION
+ select PLAT_ORION_LEGACY
help
Support for the following Marvell MV78xx0 series SoCs:
MV781x0, MV782x0.
@@ -634,7 +635,7 @@ config ARCH_ORION5X
select ARCH_REQUIRE_GPIOLIB
select GENERIC_CLOCKEVENTS
select NEED_MACH_IO_H
- select PLAT_ORION
+ select PLAT_ORION_LEGACY
help
Support for the following Marvell Orion 5x series SoCs:
Orion-1 (5181), Orion-VoIP (5181L), Orion-NAS (5182),
@@ -1153,6 +1154,10 @@ config PLAT_ORION
select GENERIC_IRQ_CHIP
select COMMON_CLK
+config PLAT_ORION_LEGACY
+ bool
+ select PLAT_ORION
+
config PLAT_PXA
bool
diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile
index c20ce0f..1251e5b 100644
--- a/arch/arm/plat-orion/Makefile
+++ b/arch/arm/plat-orion/Makefile
@@ -2,9 +2,8 @@
# Makefile for the linux kernel.
#
-obj-y := irq.o pcie.o time.o common.o mpp.o addr-map.o
-obj-m :=
-obj-n :=
-obj- :=
+obj-y += addr-map.o
-obj-$(CONFIG_GENERIC_GPIO) += gpio.o
+orion-gpio-$(CONFIG_GENERIC_GPIO) += gpio.o
+obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o
+obj-$(CONFIG_PLAT_ORION_LEGACY) += $(orion-gpio-y)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/5] arm: plat-orion: make bridge_virt_base non-const to support DT use case
2012-08-03 14:13 [v2] arm: mvebu: Add basic address decoding support for Marvell 370/XP Thomas Petazzoni
2012-08-03 14:13 ` [PATCH 1/5] arm: plat-orion: use 'void __iomem *' in addr-map code Thomas Petazzoni
2012-08-03 14:13 ` [PATCH 2/5] arm: plat-orion: introduce PLAT_ORION_LEGACY hidden config option Thomas Petazzoni
@ 2012-08-03 14:13 ` Thomas Petazzoni
2012-08-03 14:13 ` [PATCH 4/5] arm: mvebu: add basic address decoding support to Armada 370/XP Thomas Petazzoni
2012-08-03 14:13 ` [PATCH 5/5] arm: mvebu: add address decoding controller to the DT Thomas Petazzoni
4 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2012-08-03 14:13 UTC (permalink / raw)
To: linux-arm-kernel
For the Armada 370 and XP SoCs where the DT is used, we need to fill
at runtime the bridge_virt_base field on the
orion_addr_map_cfg. Therefore, remove the 'const' qualifier on this
field.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
arch/arm/plat-orion/include/plat/addr-map.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/plat-orion/include/plat/addr-map.h b/arch/arm/plat-orion/include/plat/addr-map.h
index 0a746fd..ec63e4a 100644
--- a/arch/arm/plat-orion/include/plat/addr-map.h
+++ b/arch/arm/plat-orion/include/plat/addr-map.h
@@ -16,7 +16,7 @@ extern struct mbus_dram_target_info orion_mbus_dram_info;
struct orion_addr_map_cfg {
const int num_wins; /* Total number of windows */
const int remappable_wins;
- void __iomem * const bridge_virt_base;
+ void __iomem *bridge_virt_base;
/* If NULL, the default cpu_win_can_remap will be used, using
the value in remappable_wins */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/5] arm: mvebu: add basic address decoding support to Armada 370/XP
2012-08-03 14:13 [v2] arm: mvebu: Add basic address decoding support for Marvell 370/XP Thomas Petazzoni
` (2 preceding siblings ...)
2012-08-03 14:13 ` [PATCH 3/5] arm: plat-orion: make bridge_virt_base non-const to support DT use case Thomas Petazzoni
@ 2012-08-03 14:13 ` Thomas Petazzoni
2012-08-03 14:45 ` Arnd Bergmann
2012-08-03 14:13 ` [PATCH 5/5] arm: mvebu: add address decoding controller to the DT Thomas Petazzoni
4 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2012-08-03 14:13 UTC (permalink / raw)
To: linux-arm-kernel
This commit adds basic support for address decoding configuration for
the Armada 370 and Armada XP SoCs, re-using the infrastructure
provided in plat-orion.
For now, only a BootROM window is configured on Armada XP, which is
needed to get the non-boot CPUs started and is therefore a requirement
for SMP support.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
arch/arm/mach-mvebu/Makefile | 2 +-
arch/arm/mach-mvebu/addr-map.c | 134 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 135 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/mach-mvebu/addr-map.c
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index e61d2b8..2143558 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -1,2 +1,2 @@
obj-y += system-controller.o
-obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o
+obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o addr-map.o
diff --git a/arch/arm/mach-mvebu/addr-map.c b/arch/arm/mach-mvebu/addr-map.c
new file mode 100644
index 0000000..4a371a3
--- /dev/null
+++ b/arch/arm/mach-mvebu/addr-map.c
@@ -0,0 +1,134 @@
+/*
+ * Address map functions for Marvell 370 / XP SoCs
+ *
+ * Copyright (C) 2012 Marvell
+ *
+ * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/mbus.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <plat/addr-map.h>
+
+/*
+ * Generic Address Decode Windows bit settings
+ */
+#define ARMADA_XP_TARGET_DEV_BUS 1
+#define ARMADA_XP_ATTR_DEV_BOOTROM 0x1D
+#define ARMADA_XP_TARGET_ETH1 3
+#define ARMADA_XP_TARGET_PCIE_0_2 4
+#define ARMADA_XP_TARGET_ETH0 7
+#define ARMADA_XP_TARGET_PCIE_1_3 8
+
+#define ARMADA_370_TARGET_DEV_BUS 1
+#define ARMADA_370_ATTR_DEV_BOOTROM 0x1D
+#define ARMADA_370_TARGET_PCIE_0 4
+#define ARMADA_370_TARGET_PCIE_1 8
+
+#define ARMADA_WINDOW_8_PLUS_OFFSET 0x90
+#define ARMADA_SDRAM_ADDR_DECODING_OFFSET 0x180
+
+static const struct __initdata orion_addr_map_info
+armada_xp_addr_map_info[] = {
+ /*
+ * Window for the BootROM, needed for SMP on Armada XP
+ */
+ { 0, 0xfff00000, SZ_1M, ARMADA_XP_TARGET_DEV_BUS,
+ ARMADA_XP_ATTR_DEV_BOOTROM, -1 },
+ /* End marker */
+ { -1, 0, 0, 0, 0, 0 },
+};
+
+static const struct __initdata orion_addr_map_info
+armada_370_addr_map_info[] = {
+ /* End marker */
+ { -1, 0, 0, 0, 0, 0 },
+};
+
+static struct of_device_id of_addr_decoding_controller_table[] = {
+ { .compatible = "marvell,armada-addr-decoding-controller" },
+ { /* end of list */ },
+};
+
+static void __iomem *
+armada_cfg_base(const struct orion_addr_map_cfg *cfg, int win)
+{
+ unsigned int offset;
+
+ /* The register layout is a bit annoying and the below code
+ * tries to cope with it.
+ * - At offset 0x0, there are the registers for the first 8
+ * windows, with 4 registers of 32 bits per window (ctrl,
+ * base, remap low, remap high)
+ * - Then at offset 0x80, there is a hole of 0x10 bytes for
+ * the internal registers base address and internal units
+ * sync barrier register.
+ * - Then at offset 0x90, there the registers for 12
+ * windows, with only 2 registers of 32 bits per window
+ * (ctrl, base).
+ */
+ if (win < 8)
+ offset = (win << 4);
+ else
+ offset = ARMADA_WINDOW_8_PLUS_OFFSET + (win << 3);
+
+ return (void __iomem *)(cfg->bridge_virt_base + offset);
+}
+
+static struct __initdata orion_addr_map_cfg addr_map_cfg = {
+ .num_wins = 20,
+ .remappable_wins = 8,
+ .win_cfg_base = armada_cfg_base,
+};
+
+static int __init armada_setup_cpu_mbus(void)
+{
+ struct device_node *np;
+ void __iomem *mbus_unit_addr_decoding_base;
+ void __iomem *sdram_addr_decoding_base;
+
+ np = of_find_matching_node(NULL, of_addr_decoding_controller_table);
+ if (!np)
+ return -ENODEV;
+
+ mbus_unit_addr_decoding_base = of_iomap(np, 0);
+ BUG_ON(!mbus_unit_addr_decoding_base);
+
+ sdram_addr_decoding_base =
+ mbus_unit_addr_decoding_base +
+ ARMADA_SDRAM_ADDR_DECODING_OFFSET;
+
+ addr_map_cfg.bridge_virt_base = mbus_unit_addr_decoding_base;
+
+ /*
+ * Disable, clear and configure windows.
+ */
+ if (of_machine_is_compatible("marvell,armadaxp"))
+ orion_config_wins(&addr_map_cfg, armada_xp_addr_map_info);
+ else if (of_machine_is_compatible("marvell,armada370"))
+ orion_config_wins(&addr_map_cfg, armada_370_addr_map_info);
+ else {
+ pr_err("Unsupported SoC\n");
+ return -EINVAL;
+ }
+
+ /*
+ * Setup MBUS dram target info.
+ */
+ orion_setup_cpu_mbus_target(&addr_map_cfg,
+ sdram_addr_decoding_base);
+ return 0;
+}
+
+/* Using a early_initcall is needed so that this initialization gets
+ * done before the SMP initialization, which requires the BootROM to
+ * be remapped. */
+early_initcall(armada_setup_cpu_mbus);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/5] arm: mvebu: add basic address decoding support to Armada 370/XP
2012-08-03 14:13 ` [PATCH 4/5] arm: mvebu: add basic address decoding support to Armada 370/XP Thomas Petazzoni
@ 2012-08-03 14:45 ` Arnd Bergmann
0 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2012-08-03 14:45 UTC (permalink / raw)
To: linux-arm-kernel
On Friday 03 August 2012, Thomas Petazzoni wrote:
> +static void __iomem *
> +armada_cfg_base(const struct orion_addr_map_cfg *cfg, int win)
> +{
> + unsigned int offset;
> +
> + /* The register layout is a bit annoying and the below code
> + * tries to cope with it.
> + * - At offset 0x0, there are the registers for the first 8
> + * windows, with 4 registers of 32 bits per window (ctrl,
> + * base, remap low, remap high)
> + * - Then at offset 0x80, there is a hole of 0x10 bytes for
> + * the internal registers base address and internal units
> + * sync barrier register.
> + * - Then at offset 0x90, there the registers for 12
> + * windows, with only 2 registers of 32 bits per window
> + * (ctrl, base).
> + */
> + if (win < 8)
> + offset = (win << 4);
> + else
> + offset = ARMADA_WINDOW_8_PLUS_OFFSET + (win << 3);
> +
> + return (void __iomem *)(cfg->bridge_virt_base + offset);
> +}
> +
This cast can go away now that the type is already correct. Other
than that, the patch looks fine.
Arnd
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/5] arm: mvebu: add address decoding controller to the DT
2012-08-03 14:13 [v2] arm: mvebu: Add basic address decoding support for Marvell 370/XP Thomas Petazzoni
` (3 preceding siblings ...)
2012-08-03 14:13 ` [PATCH 4/5] arm: mvebu: add basic address decoding support to Armada 370/XP Thomas Petazzoni
@ 2012-08-03 14:13 ` Thomas Petazzoni
4 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2012-08-03 14:13 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
arch/arm/boot/dts/armada-370-xp.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 6b6b932..16cc82c 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -63,6 +63,11 @@
reg = <0xd0020300 0x30>;
interrupts = <37>, <38>, <39>, <40>;
};
+
+ addr-decoding at d0020000 {
+ compatible = "marvell,armada-addr-decoding-controller";
+ reg = <0xd0020000 0x258>;
+ };
};
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 1/5] arm: plat-orion: use 'void __iomem *' in addr-map code
2012-08-06 9:42 [v3] Add basic address decoding support for Marvell 370/XP Thomas Petazzoni
@ 2012-08-06 9:42 ` Thomas Petazzoni
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2012-08-06 9:42 UTC (permalink / raw)
To: linux-arm-kernel
Use 'void __iomem *' instead of u32 where appropriate in the addr-map
code. It requires adding a few casts in SoC-specific addr-map.c files,
but those casts will disappear once those SoC are migrated to the
device tree, in which case the address will come from the DT instead
of from #define values.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
arch/arm/mach-dove/addr-map.c | 2 +-
arch/arm/mach-kirkwood/addr-map.c | 5 +++--
arch/arm/mach-mv78xx0/addr-map.c | 4 ++--
arch/arm/mach-orion5x/addr-map.c | 5 +++--
arch/arm/plat-orion/addr-map.c | 11 ++++-------
arch/arm/plat-orion/include/plat/addr-map.h | 4 ++--
6 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/arch/arm/mach-dove/addr-map.c b/arch/arm/mach-dove/addr-map.c
index 2a06c01..adb428e 100644
--- a/arch/arm/mach-dove/addr-map.c
+++ b/arch/arm/mach-dove/addr-map.c
@@ -47,7 +47,7 @@ static inline void __iomem *ddr_map_sc(int i)
static struct __initdata orion_addr_map_cfg addr_map_cfg = {
.num_wins = 8,
.remappable_wins = 4,
- .bridge_virt_base = BRIDGE_VIRT_BASE,
+ .bridge_virt_base = (void __iomem *) BRIDGE_VIRT_BASE,
};
static const struct __initdata orion_addr_map_info addr_map_info[] = {
diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c
index e9a7180..2b27de6 100644
--- a/arch/arm/mach-kirkwood/addr-map.c
+++ b/arch/arm/mach-kirkwood/addr-map.c
@@ -41,7 +41,7 @@
static struct __initdata orion_addr_map_cfg addr_map_cfg = {
.num_wins = 8,
.remappable_wins = 4,
- .bridge_virt_base = BRIDGE_VIRT_BASE,
+ .bridge_virt_base = (void __iomem *) BRIDGE_VIRT_BASE,
};
static const struct __initdata orion_addr_map_info addr_map_info[] = {
@@ -86,5 +86,6 @@ void __init kirkwood_setup_cpu_mbus(void)
/*
* Setup MBUS dram target info.
*/
- orion_setup_cpu_mbus_target(&addr_map_cfg, DDR_WINDOW_CPU_BASE);
+ orion_setup_cpu_mbus_target(&addr_map_cfg,
+ (void __iomem *) DDR_WINDOW_CPU_BASE);
}
diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c
index 62b53d7..bac31e4 100644
--- a/arch/arm/mach-mv78xx0/addr-map.c
+++ b/arch/arm/mach-mv78xx0/addr-map.c
@@ -71,10 +71,10 @@ void __init mv78xx0_setup_cpu_mbus(void)
*/
if (mv78xx0_core_index() == 0)
orion_setup_cpu_mbus_target(&addr_map_cfg,
- DDR_WINDOW_CPU0_BASE);
+ (void __iomem *) DDR_WINDOW_CPU0_BASE);
else
orion_setup_cpu_mbus_target(&addr_map_cfg,
- DDR_WINDOW_CPU1_BASE);
+ (void __iomem *) DDR_WINDOW_CPU1_BASE);
}
void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index eaac83d..bfe4f10 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -79,7 +79,7 @@ static int __init cpu_win_can_remap(const struct orion_addr_map_cfg *cfg,
static struct orion_addr_map_cfg addr_map_cfg __initdata = {
.num_wins = 8,
.cpu_win_can_remap = cpu_win_can_remap,
- .bridge_virt_base = ORION5X_BRIDGE_VIRT_BASE,
+ .bridge_virt_base = (void __iomem *) ORION5X_BRIDGE_VIRT_BASE,
};
static const struct __initdata orion_addr_map_info addr_map_info[] = {
@@ -113,7 +113,8 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
/*
* Setup MBUS dram target info.
*/
- orion_setup_cpu_mbus_target(&addr_map_cfg, ORION5X_DDR_WINDOW_CPU_BASE);
+ orion_setup_cpu_mbus_target(&addr_map_cfg,
+ (void __iomem *) ORION5X_DDR_WINDOW_CPU_BASE);
}
void __init orion5x_setup_dev_boot_win(u32 base, u32 size)
diff --git a/arch/arm/plat-orion/addr-map.c b/arch/arm/plat-orion/addr-map.c
index 367ca89..a7b8060 100644
--- a/arch/arm/plat-orion/addr-map.c
+++ b/arch/arm/plat-orion/addr-map.c
@@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(mv_mbus_dram_info);
static void __init __iomem *
orion_win_cfg_base(const struct orion_addr_map_cfg *cfg, int win)
{
- return (void __iomem *)(cfg->bridge_virt_base + (win << 4));
+ return cfg->bridge_virt_base + (win << 4);
}
/*
@@ -143,19 +143,16 @@ void __init orion_config_wins(struct orion_addr_map_cfg * cfg,
* Setup MBUS dram target info.
*/
void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
- const u32 ddr_window_cpu_base)
+ const void __iomem *ddr_window_cpu_base)
{
- void __iomem *addr;
int i;
int cs;
orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
- addr = (void __iomem *)ddr_window_cpu_base;
-
for (i = 0, cs = 0; i < 4; i++) {
- u32 base = readl(addr + DDR_BASE_CS_OFF(i));
- u32 size = readl(addr + DDR_SIZE_CS_OFF(i));
+ u32 base = readl(ddr_window_cpu_base + DDR_BASE_CS_OFF(i));
+ u32 size = readl(ddr_window_cpu_base + DDR_SIZE_CS_OFF(i));
/*
* Chip select enabled?
diff --git a/arch/arm/plat-orion/include/plat/addr-map.h b/arch/arm/plat-orion/include/plat/addr-map.h
index fd556f7..0a746fd 100644
--- a/arch/arm/plat-orion/include/plat/addr-map.h
+++ b/arch/arm/plat-orion/include/plat/addr-map.h
@@ -16,7 +16,7 @@ extern struct mbus_dram_target_info orion_mbus_dram_info;
struct orion_addr_map_cfg {
const int num_wins; /* Total number of windows */
const int remappable_wins;
- const u32 bridge_virt_base;
+ void __iomem * const bridge_virt_base;
/* If NULL, the default cpu_win_can_remap will be used, using
the value in remappable_wins */
@@ -49,5 +49,5 @@ void __init orion_setup_cpu_win(const struct orion_addr_map_cfg *cfg,
const u8 attr, const int remap);
void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
- const u32 ddr_window_cpu_base);
+ const void __iomem *ddr_window_cpu_base);
#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread