2013-05-13 10:16:17

by Maxime Ripard

[permalink] [raw]
Subject: [PATCH 0/4] ARM: Remove boilerplate debug_ll_io_init code

Hi,

The recent introduction of debug_ll_io_init made possible to not rely
anymore on a custom map_io function but on debug_ll_io_init for the
early mapping and then on the various drivers to do the needed mappings for
the kernel to boot.

Some architectures begin to use only this function as the map_io callback in
the machine description.

In order to remove some boilerplate code, make the ARM mm code call
debug_ll_io_init by itself when no .map_io callback is defined.

This has been tested on the sunxi platform.

Thanks,
Maxime

Maxime Ripard (4):
ARM: mmu: Call debug_ll_io_init if no map_io function is specified
ARM: highbank: remove the .map_io declaration
ARM: mxs: remove the .map_io declaration
ARM: sunxi: Remove the .map_io function declaration

arch/arm/mach-highbank/highbank.c | 1 -
arch/arm/mach-mxs/mach-mxs.c | 1 -
arch/arm/mach-sunxi/sunxi.c | 17 -----------------
arch/arm/mach-sunxi/sunxi.h | 20 --------------------
arch/arm/mm/mmu.c | 2 ++
5 files changed, 2 insertions(+), 39 deletions(-)
delete mode 100644 arch/arm/mach-sunxi/sunxi.h

--
1.8.1.2


2013-05-13 10:16:19

by Maxime Ripard

[permalink] [raw]
Subject: [PATCH 2/4] ARM: highbank: remove the .map_io declaration

Now that the ARM core code calls debug_ll_io_init, we can remove it from
the machine_desc declaration.

Signed-off-by: Maxime Ripard <[email protected]>
---
arch/arm/mach-highbank/highbank.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index e7df2dd..dc5d6be 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -176,7 +176,6 @@ static const char *highbank_match[] __initconst = {

DT_MACHINE_START(HIGHBANK, "Highbank")
.smp = smp_ops(highbank_smp_ops),
- .map_io = debug_ll_io_init,
.init_irq = highbank_init_irq,
.init_time = highbank_timer_init,
.init_machine = highbank_init,
--
1.8.1.2

2013-05-13 10:16:18

by Maxime Ripard

[permalink] [raw]
Subject: [PATCH 1/4] ARM: mmu: Call debug_ll_io_init if no map_io function is specified

More and more sub-architectures are using only the debug_ll_io_init
function as the map_io function. Make the core code call this function
if no function is specified in the machine description to remove some
boilerplate code.

Signed-off-by: Maxime Ripard <[email protected]>
---
arch/arm/mm/mmu.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index e0d8565..faa36d7 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1232,6 +1232,8 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
*/
if (mdesc->map_io)
mdesc->map_io();
+ else
+ debug_ll_io_init();
fill_pmd_gaps();

/* Reserve fixed i/o space in VMALLOC region */
--
1.8.1.2

2013-05-13 10:16:46

by Maxime Ripard

[permalink] [raw]
Subject: [PATCH 4/4] ARM: sunxi: Remove the .map_io function declaration

debug_ll_io_init should be enough to map the needed addresses at boot,
so remove the trivial map_io code, and let the core call
debug_ll_io_init.

Signed-off-by: Maxime Ripard <[email protected]>
---
arch/arm/mach-sunxi/sunxi.c | 17 -----------------
arch/arm/mach-sunxi/sunxi.h | 20 --------------------
2 files changed, 37 deletions(-)
delete mode 100644 arch/arm/mach-sunxi/sunxi.h

diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 706ce35..d1b5bc5 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -26,8 +26,6 @@
#include <asm/mach/map.h>
#include <asm/system_misc.h>

-#include "sunxi.h"
-
#define SUN4I_WATCHDOG_CTRL_REG 0x00
#define SUN4I_WATCHDOG_CTRL_RESTART (1 << 0)
#define SUN4I_WATCHDOG_MODE_REG 0x04
@@ -81,20 +79,6 @@ static void sunxi_setup_restart(void)
arm_pm_restart = of_id->data;
}

-static struct map_desc sunxi_io_desc[] __initdata = {
- {
- .virtual = (unsigned long) SUNXI_REGS_VIRT_BASE,
- .pfn = __phys_to_pfn(SUNXI_REGS_PHYS_BASE),
- .length = SUNXI_REGS_SIZE,
- .type = MT_DEVICE,
- },
-};
-
-void __init sunxi_map_io(void)
-{
- iotable_init(sunxi_io_desc, ARRAY_SIZE(sunxi_io_desc));
-}
-
static void __init sunxi_timer_init(void)
{
sunxi_init_clocks();
@@ -116,7 +100,6 @@ static const char * const sunxi_board_dt_compat[] = {

DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
.init_machine = sunxi_dt_init,
- .map_io = sunxi_map_io,
.init_irq = irqchip_init,
.init_time = sunxi_timer_init,
.dt_compat = sunxi_board_dt_compat,
diff --git a/arch/arm/mach-sunxi/sunxi.h b/arch/arm/mach-sunxi/sunxi.h
deleted file mode 100644
index 33b5871..0000000
--- a/arch/arm/mach-sunxi/sunxi.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Generic definitions for Allwinner SunXi SoCs
- *
- * Copyright (C) 2012 Maxime Ripard
- *
- * Maxime Ripard <[email protected]>
- *
- * 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.
- */
-
-#ifndef __MACH_SUNXI_H
-#define __MACH_SUNXI_H
-
-#define SUNXI_REGS_PHYS_BASE 0x01c00000
-#define SUNXI_REGS_VIRT_BASE IOMEM(0xf1c00000)
-#define SUNXI_REGS_SIZE (SZ_2M + SZ_1M)
-
-#endif /* __MACH_SUNXI_H */
--
1.8.1.2

2013-05-13 10:17:08

by Maxime Ripard

[permalink] [raw]
Subject: [PATCH 3/4] ARM: mxs: remove the .map_io declaration

Now that the ARM core code calls debug_ll_io_init, we can remove it from
the machine_desc declaration.

Signed-off-by: Maxime Ripard <[email protected]>
---
arch/arm/mach-mxs/mach-mxs.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 5b62b64..d67ecc1 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -434,7 +434,6 @@ static const char *mxs_dt_compat[] __initdata = {
};

DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)")
- .map_io = debug_ll_io_init,
.init_irq = irqchip_init,
.handle_irq = icoll_handle_irq,
.init_time = mxs_timer_init,
--
1.8.1.2

2013-05-14 03:30:36

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH 3/4] ARM: mxs: remove the .map_io declaration

On Mon, May 13, 2013 at 12:16:08PM +0200, Maxime Ripard wrote:
> Now that the ARM core code calls debug_ll_io_init, we can remove it from
> the machine_desc declaration.
>
> Signed-off-by: Maxime Ripard <[email protected]>

Acked-by: Shawn Guo <[email protected]>

> ---
> arch/arm/mach-mxs/mach-mxs.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
> index 5b62b64..d67ecc1 100644
> --- a/arch/arm/mach-mxs/mach-mxs.c
> +++ b/arch/arm/mach-mxs/mach-mxs.c
> @@ -434,7 +434,6 @@ static const char *mxs_dt_compat[] __initdata = {
> };
>
> DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)")
> - .map_io = debug_ll_io_init,
> .init_irq = irqchip_init,
> .handle_irq = icoll_handle_irq,
> .init_time = mxs_timer_init,
> --
> 1.8.1.2
>

2013-05-15 22:41:05

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM: Remove boilerplate debug_ll_io_init code

On Monday 13 May 2013, Maxime Ripard wrote:
> The recent introduction of debug_ll_io_init made possible to not rely
> anymore on a custom map_io function but on debug_ll_io_init for the
> early mapping and then on the various drivers to do the needed mappings for
> the kernel to boot.
>
> Some architectures begin to use only this function as the map_io callback in
> the machine description.
>
> In order to remove some boilerplate code, make the ARM mm code call
> debug_ll_io_init by itself when no .map_io callback is defined.
>
> This has been tested on the sunxi platform.

Great stuff!

I didn't notice the addition of debug_ll_io_init, so this is a nice surprise
for me.

Acked-by: Arnd Bergmann <[email protected]>

2013-05-16 15:20:44

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM: Remove boilerplate debug_ll_io_init code

Hi Arnd,

Le 16/05/2013 00:40, Arnd Bergmann a ?crit :
> On Monday 13 May 2013, Maxime Ripard wrote:
>> The recent introduction of debug_ll_io_init made possible to not rely
>> anymore on a custom map_io function but on debug_ll_io_init for the
>> early mapping and then on the various drivers to do the needed mappings for
>> the kernel to boot.
>>
>> Some architectures begin to use only this function as the map_io callback in
>> the machine description.
>>
>> In order to remove some boilerplate code, make the ARM mm code call
>> debug_ll_io_init by itself when no .map_io callback is defined.
>>
>> This has been tested on the sunxi platform.
>
> Great stuff!
>
> I didn't notice the addition of debug_ll_io_init, so this is a nice surprise
> for me.

Well, you can thank Rob for that, I wasn't involved in it in the first
place :)

> Acked-by: Arnd Bergmann <[email protected]>

Thanks,

How will we merge this? The first patch would be merged by Russel and
the 3 others by their respective maintainers?

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

2013-05-16 16:15:21

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 2/4] ARM: highbank: remove the .map_io declaration

On Mon, May 13, 2013 at 5:16 AM, Maxime Ripard
<[email protected]> wrote:
> Now that the ARM core code calls debug_ll_io_init, we can remove it from
> the machine_desc declaration.
>
> Signed-off-by: Maxime Ripard <[email protected]>

Acked-by: Rob Herring <[email protected]>

> ---
> arch/arm/mach-highbank/highbank.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
> index e7df2dd..dc5d6be 100644
> --- a/arch/arm/mach-highbank/highbank.c
> +++ b/arch/arm/mach-highbank/highbank.c
> @@ -176,7 +176,6 @@ static const char *highbank_match[] __initconst = {
>
> DT_MACHINE_START(HIGHBANK, "Highbank")
> .smp = smp_ops(highbank_smp_ops),
> - .map_io = debug_ll_io_init,
> .init_irq = highbank_init_irq,
> .init_time = highbank_timer_init,
> .init_machine = highbank_init,
> --
> 1.8.1.2
>

2013-05-16 16:16:55

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 1/4] ARM: mmu: Call debug_ll_io_init if no map_io function is specified

On Mon, May 13, 2013 at 5:16 AM, Maxime Ripard
<[email protected]> wrote:
> More and more sub-architectures are using only the debug_ll_io_init
> function as the map_io function. Make the core code call this function
> if no function is specified in the machine description to remove some
> boilerplate code.
>
> Signed-off-by: Maxime Ripard <[email protected]>

Acked-by: Rob Herring <[email protected]>

> ---
> arch/arm/mm/mmu.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
> index e0d8565..faa36d7 100644
> --- a/arch/arm/mm/mmu.c
> +++ b/arch/arm/mm/mmu.c
> @@ -1232,6 +1232,8 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
> */
> if (mdesc->map_io)
> mdesc->map_io();
> + else
> + debug_ll_io_init();
> fill_pmd_gaps();
>
> /* Reserve fixed i/o space in VMALLOC region */
> --
> 1.8.1.2
>

2013-05-17 13:31:49

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM: Remove boilerplate debug_ll_io_init code

On Thursday 16 May 2013, Maxime Ripard wrote:

>
> How will we merge this? The first patch would be merged by Russel and
> the 3 others by their respective maintainers?

I think since it's mostly platform code and all trivial, we can merge
it into the next/cleanup branch in arm-soc directly.

Arnd

2013-05-19 15:13:19

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH 0/4] ARM: Remove boilerplate debug_ll_io_init code

Hi Arnd,

On Fri, May 17, 2013 at 03:31:16PM +0200, Arnd Bergmann wrote:
> On Thursday 16 May 2013, Maxime Ripard wrote:
>
> >
> > How will we merge this? The first patch would be merged by Russel and
> > the 3 others by their respective maintainers?
>
> I think since it's mostly platform code and all trivial, we can merge
> it into the next/cleanup branch in arm-soc directly.

Ok, then I can probably merge it into the branch with the irqchip_init
patches and send both these cleanups into the same branch in a few
weeks?

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com