devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Integrator devicetree support
@ 2012-08-16 12:15 Linus Walleij
       [not found] ` <1345119317-22600-1-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2012-08-16 12:15 UTC (permalink / raw)
  To: linux-arm-kernel, devicetree-discuss
  Cc: Will Deacon, Linus Walleij, arm, Russell King

This is a patch set for devicetree on the Integrator/AP and
Integrator/CP I've been cooking. I did some stepwise development
in recent kernels moving to sparse IRQs, per-system clock
source then common clk. Now we can do single zImage and
also devicetree on this platform, so this is a first patch
set.

In case you're wondering why, take down your Torvalds
autobiography and read the title. It was also a bit of
learning exercise, plus it's fun to run devicetree on this
ARMv4 system.

This patch set moves all the non-DT platform code into
#ifndef CONFIG_OF sections for clarity. The plan is to
delete them after deprecation.

Remaining roadblocks to deleting non-DT code altogether.

- Uncertain about how to do the fpga-irq DT binding so
  please review closely.

- The Integrator/AP ARM core tiles have add-on logic modules
  called Integrator/IM-PD1 with a load of PrimeCells and
  stuff. These spawn off a special bus called "lm" in
  arch/arm/mach-integrator/lm.c, and the core module support
  is in impd1.c. It'd probably be pretty easy to create
  device tree bindings for these, but I have no such module
  and no clue on where to get one. Is anyone actually using
  it? Russell?

- The special PCI adapter in the Integrator has to be DT:ed,
  but AFAICT there is still a problem with how to represent
  these things in DT. Any hints/examples, Arnd, Rob?
  arch/arm/mach-integrator/pci_v3.c

Yours,
Linus Walleij

Linus Walleij (6):
  ARM: integrator: call common init function from machine
  ARM: integrator: check PL010 device name rather than base address
  ARM: plat-versatile: add DT support to FPGA IRQ controller
  ARM: integrator: initial device tree support
  ARM: integrator: convert AMBA devices to device tree
  ARM: integrator: convert platform devices to Device Tree

 Documentation/devicetree/bindings/arm/arm-boards   |  12 +
 .../devicetree/bindings/arm/versatile-fpga-irq.txt |  35 +++
 arch/arm/boot/dts/integratorap.dts                 |  78 ++++++
 arch/arm/boot/dts/integratorcp.dts                 | 122 +++++++++
 arch/arm/mach-integrator/common.h                  |   3 +
 arch/arm/mach-integrator/core.c                    |  14 +-
 arch/arm/mach-integrator/integrator_ap.c           | 214 ++++++++++-----
 arch/arm/mach-integrator/integrator_cp.c           | 296 +++++++++++++--------
 arch/arm/plat-versatile/fpga-irq.c                 |  41 +++
 arch/arm/plat-versatile/include/plat/fpga-irq.h    |   2 +
 10 files changed, 640 insertions(+), 177 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/versatile-fpga-irq.txt
 create mode 100644 arch/arm/boot/dts/integratorap.dts
 create mode 100644 arch/arm/boot/dts/integratorcp.dts

-- 
1.7.11.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/6] Integrator devicetree support
       [not found] ` <1345119317-22600-1-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2012-08-16 13:44   ` Arnd Bergmann
       [not found]     ` <201208161344.55723.arnd-r2nGTMty4D4@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2012-08-16 13:44 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Will Deacon, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	arm-DgEjT+Ai2ygdnm+yROfE0A, Russell King,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Thursday 16 August 2012, Linus Walleij wrote:
> This patch set moves all the non-DT platform code into
> #ifndef CONFIG_OF sections for clarity. The plan is to
> delete them after deprecation.

I'm fine with your playing around with this in any way you
like, but I think in general we should have a new CONFIG_ATAG
symbol, so you can build a kernel that supports booting
both with and without DT for the same platform, depending
on what the boot loader supports.

Then you can enclose all the non-DT sections in #ifdef
CONFIG_ATAG and we can remove them at some later stage.

> - The special PCI adapter in the Integrator has to be DT:ed,
>   but AFAICT there is still a problem with how to represent
>   these things in DT. Any hints/examples, Arnd, Rob?
>   arch/arm/mach-integrator/pci_v3.c

PCI bindings are a bit tricky but they are well-defined,
see www.openfirmware.org/ofwg/bindings/pci/pci2_1.pdf

The main thing to understand is the use of 3-cell address
spaces and the interrupt map. Each PCI host must have

         #interrupt-cells = <1>;
         #size-cells = <2>;
         #address-cells = <3>;

The "ranges" property is used to transform the PCI
address space into the host address space.

The first cell identifies the device and address space
using a bit-masked notation. The important part to
know here is 

0x00000000 config space
0x01000000 I/O space
0x02000000 memory space
0x03000000 64 bit memory space
0x42000000 memory space, prefetchable
0x43000000 64 bit memory space, prefetchable

Each entry in the ranges property consists of 3 cells
for the PCI address start, one cell for a 32 bit parent
but start address where this is mapped, and two cells for
the size.
For your bus, the ranges then would be defined as 

ranges = <0x00000000 0x00000000 0x00000000 /* configuration space: */
	  0x61000000 0x00000000 0x00100000 /* 16 MB at 61000000    */
	  0x01000000 0x00000000 0x00000000 /* I/O space:	   */
	  0x60000000 0x00000000 0x00010000 /* 64KB at 0x60000000   */
	  0x02000000 0x00000000 0x40000000 /* non-prefetchable mem */
	  0x40000000 0x00000000 0x10000000 /* identity-mapped      */
	  0x42000000 0x00000000 0x50000000 /* prefetchable mem     */
	  0x50000000 0x00000000 0x10000000> /* identity-mapped     */

I'm not quite sure if I understood the comments about LB_BASE0 etc
correctly, so it might actually be different.

You also need an interrupt-map, which maps the slots to the
connected irq lines in a board-specific way:

interrupt-map = <
	/* IDSEL 9 */
	0x4800 0 0 1 &pic 14 /* INT A on slot 9 is irq 14 */
	0x4800 0 0 2 &pic 15 /* INT B on slot 9 is irq 15 */
	0x4800 0 0 3 &pic 16 /* INT C on slot 9 is irq 16 */
	0x4800 0 0 4 &pic 17 /* INT D on slot 9 is irq 17 */

	/* IDSEL 10 */
	0x5000 0 0 1 &pic 15 /* INT A on slot 10 is irq 15 */
	0x5000 0 0 2 &pic 16 /* INT B on slot 10 is irq 16 */
	0x5000 0 0 3 &pic 17 /* INT C on slot 10 is irq 17 */
	0x5000 0 0 4 &pic 14 /* INT D on slot 10 is irq 18 */

	/* IDSEL 11 */
	0x5800 0 0 1 &pic 16 /* INT A on slot 11 is irq 16 */
	0x5800 0 0 2 &pic 17 /* INT B on slot 11 is irq 17 */
	0x5800 0 0 3 &pic 14 /* INT C on slot 11 is irq 18 */
	0x5800 0 0 4 &pic 15 /* INT D on slot 11 is irq 14 */

	/* IDSEL 12 */
	0x6000 0 0 1 &pic 17 /* INT A on slot 12 is irq 17 */
	0x6000 0 0 2 &pic 14 /* INT B on slot 12 is irq 14 */
	0x6000 0 0 3 &pic 15 /* INT C on slot 12 is irq 15 */
	0x6000 0 0 4 &pic 16 /* INT D on slot 12 is irq 16 */
	>;

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/6] Integrator devicetree support
       [not found]     ` <201208161344.55723.arnd-r2nGTMty4D4@public.gmane.org>
@ 2012-08-18 23:06       ` Linus Walleij
       [not found]         ` <CACRpkdYYgdzAU=nyL7dQbdMLx3z3G+K7ba0uJe1=aX=BLeF_sg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2012-08-18 23:06 UTC (permalink / raw)
  To: Arnd Bergmann, Nicolas Pitre
  Cc: Will Deacon, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	arm-DgEjT+Ai2ygdnm+yROfE0A, Russell King,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Thu, Aug 16, 2012 at 3:44 PM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
> On Thursday 16 August 2012, Linus Walleij wrote:
>> This patch set moves all the non-DT platform code into
>> #ifndef CONFIG_OF sections for clarity. The plan is to
>> delete them after deprecation.
>
> I'm fine with your playing around with this in any way you
> like, but I think in general we should have a new CONFIG_ATAG
> symbol, so you can build a kernel that supports booting
> both with and without DT for the same platform, depending
> on what the boot loader supports.
>
> Then you can enclose all the non-DT sections in #ifdef
> CONFIG_ATAG and we can remove them at some later stage.

Since we already have CONFIG_USE_OF I think
CONFIG_USE_ATAGS is more apropriate, but I get the
idea. So it begins like this:

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e91c7cd..0764ef7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1907,6 +1907,12 @@ endmenu

 menu "Boot options"

+config USE_ATAGS
+       bool "ATAGS support"
+       default y
+       help
+         Include support for ATAGS-based machine descriptions.
+
 config USE_OF
        bool "Flattened Device Tree support"
        select OF
@@ -2110,6 +2116,7 @@ config KEXEC

 config ATAGS_PROC
        bool "Export atags in procfs"
+       depends on USE_ATAGS
        depends on KEXEC
        default y
        help

But then we hit #ifdeffing and compiling out a lot of dangerous stuff
in arch/arm/kernel and then I get the creeps. I can try, but I think
this is typical Nico territory for example...

Yours,
Linus Walleij

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/6] Integrator devicetree support
       [not found]         ` <CACRpkdYYgdzAU=nyL7dQbdMLx3z3G+K7ba0uJe1=aX=BLeF_sg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-08-19 14:05           ` Arnd Bergmann
  2012-08-19 15:52           ` Nicolas Pitre
  1 sibling, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2012-08-19 14:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Russell King, Nicolas Pitre,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Will Deacon,
	arm-DgEjT+Ai2ygdnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Saturday 18 August 2012, Linus Walleij wrote:
> Since we already have CONFIG_USE_OF I think
> CONFIG_USE_ATAGS is more apropriate, but I get the
> idea.

There is both CONFIG_USE_OF and CONFIG_OF. The former is what
a platform selects and it turns on a few other options as well,
while the latter is the one that you typically check in #ifdef.

We might need both of them for ATAG as well, but I think if
we have just one, CONFIG_ATAGS or CONFIG_ATAG would be nicer
because it's slightly shorter.

> So it begins like this:
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index e91c7cd..0764ef7 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1907,6 +1907,12 @@ endmenu
> 
>  menu "Boot options"
> 
> +config USE_ATAGS
> +       bool "ATAGS support"
> +       default y
> +       help
> +         Include support for ATAGS-based machine descriptions.
> +
>  config USE_OF
>         bool "Flattened Device Tree support"
>         select OF
> @@ -2110,6 +2116,7 @@ config KEXEC
> 
>  config ATAGS_PROC
>         bool "Export atags in procfs"
> +       depends on USE_ATAGS
>         depends on KEXEC
>         default y
>         help
> 
> But then we hit #ifdeffing and compiling out a lot of dangerous stuff
> in arch/arm/kernel and then I get the creeps. I can try, but I think
> this is typical Nico territory for example...

We don't have to enclose every single usage of ATAGS with this, but
I think it's helpful in platforms that you want to migrate away
from ATAG to DT-only. I think we should also use this method in
mach-ux500, for instance.

Putting MACHINE_START and DT_MACHINE_START inside of CONFIG_ATAG
and CONFIG_OF respectively would help ensure that we don't
accidentally build support for a board that cannot work.

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/6] Integrator devicetree support
       [not found]         ` <CACRpkdYYgdzAU=nyL7dQbdMLx3z3G+K7ba0uJe1=aX=BLeF_sg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2012-08-19 14:05           ` Arnd Bergmann
@ 2012-08-19 15:52           ` Nicolas Pitre
       [not found]             ` <alpine.LFD.2.02.1208191148520.1754-QuJgVwGFrdf/9pzu0YdTqQ@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Pitre @ 2012-08-19 15:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Russell King, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	Will Deacon, arm-DgEjT+Ai2ygdnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Sun, 19 Aug 2012, Linus Walleij wrote:

> But then we hit #ifdeffing and compiling out a lot of dangerous stuff
> in arch/arm/kernel and then I get the creeps. I can try, but I think
> this is typical Nico territory for example...

I did post a patch moving all the ATAG stuff to a separate source file a 
while ago, exactly for that purpose.  I should try to dig it out and 
refresh it.


Nicolas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/6] Integrator devicetree support
       [not found]             ` <alpine.LFD.2.02.1208191148520.1754-QuJgVwGFrdf/9pzu0YdTqQ@public.gmane.org>
@ 2012-08-30 21:01               ` Nicolas Pitre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Pitre @ 2012-08-30 21:01 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Russell King, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	Will Deacon, arm-DgEjT+Ai2ygdnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Sun, 19 Aug 2012, Nicolas Pitre wrote:

> On Sun, 19 Aug 2012, Linus Walleij wrote:
> 
> > But then we hit #ifdeffing and compiling out a lot of dangerous stuff
> > in arch/arm/kernel and then I get the creeps. I can try, but I think
> > this is typical Nico territory for example...
> 
> I did post a patch moving all the ATAG stuff to a separate source file a 
> while ago, exactly for that purpose.  I should try to dig it out and 
> refresh it.

OK... In this case "a while ago" = 2 years!

Please see the 2 patches to follow.


Nicolas

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-30 21:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16 12:15 [PATCH 0/6] Integrator devicetree support Linus Walleij
     [not found] ` <1345119317-22600-1-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-08-16 13:44   ` Arnd Bergmann
     [not found]     ` <201208161344.55723.arnd-r2nGTMty4D4@public.gmane.org>
2012-08-18 23:06       ` Linus Walleij
     [not found]         ` <CACRpkdYYgdzAU=nyL7dQbdMLx3z3G+K7ba0uJe1=aX=BLeF_sg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-19 14:05           ` Arnd Bergmann
2012-08-19 15:52           ` Nicolas Pitre
     [not found]             ` <alpine.LFD.2.02.1208191148520.1754-QuJgVwGFrdf/9pzu0YdTqQ@public.gmane.org>
2012-08-30 21:01               ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).