LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [patch 14/16] powerpc: make initialization of OF hooks dependent on PPC_OF
From: Benjamin Herrenschmidt @ 2006-11-02 22:35 UTC (permalink / raw)
  To: s.hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102125629.771962000@localhost.localdomain>

On Thu, 2006-11-02 at 13:56 +0100, s.hauer@pengutronix.de wrote:
> plain text document attachment
> (powerpc-head_32.S-remove-MULTIPLATFORM.diff)
> Make initialization of OF hooks dependent on PPC_OF, not on MULTIPLATFORM
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Though see my comment about your previous patch... In fact, they could
be one patch since things might not work/build if you only apply one of
them. So 13 and 14 should be folded into one.
 
> Index: arch/powerpc/kernel/head_32.S
> ===================================================================
> --- a/arch/powerpc/kernel/head_32.S.orig
> +++ b/arch/powerpc/kernel/head_32.S
> @@ -119,7 +119,7 @@ __start:
>   * because OF may have I/O devices mapped into that area
>   * (particularly on CHRP).
>   */
> -#ifdef CONFIG_PPC_MULTIPLATFORM
> +#ifdef CONFIG_PPC_OF
>  	cmpwi	0,r5,0
>  	beq	1f
>  	bl	prom_init
> 
> --
>  Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
>   Pengutronix - Linux Solutions for Science and Industry
>     Handelsregister: Amtsgericht Hildesheim, HRA 2686
>       Hannoversche Str. 2, 31134 Hildesheim, Germany
>     Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [patch 13/16] powerpc: make prom_init.o dependent on PPC_OF
From: Benjamin Herrenschmidt @ 2006-11-02 22:34 UTC (permalink / raw)
  To: s.hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102125629.335003000@localhost.localdomain>

On Thu, 2006-11-02 at 13:56 +0100, s.hauer@pengutronix.de wrote:
> plain text document attachment
> (powerpc-kernel-makefile-move-prom_init.c-to-PPC_OF.diff)
> prom_init.o is used for OF machines, so make compilation dependent
> on that and not on PPC_MULTIPLATFORM
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Note that CONFIG_PPC_OF is always set in arch/powerpc since that
includes support for the flat device-tree... We might want to keep a
separate option for prom_init.c, though I'm not too big about it right
now. Maybe CONFIG_PPC_BOOT_FROM_OF :) That would allow custom kernel to
be shrunk down if they don't need to support platforms that are known
not to have a real OF (iSeries for example).


> Index: arch/powerpc/kernel/Makefile
> ===================================================================
> --- a/arch/powerpc/kernel/Makefile.orig
> +++ b/arch/powerpc/kernel/Makefile
> @@ -21,7 +21,7 @@ obj-$(CONFIG_PPC64)		+= setup_64.o binfm
>  obj-$(CONFIG_PPC64)		+= vdso64/
>  obj-$(CONFIG_ALTIVEC)		+= vecemu.o vector.o
>  obj-$(CONFIG_PPC_970_NAP)	+= idle_power4.o
> -obj-$(CONFIG_PPC_OF)		+= of_device.o prom_parse.o
> +obj-$(CONFIG_PPC_OF)		+= of_device.o prom_parse.o prom_init.o
>  procfs-$(CONFIG_PPC64)		:= proc_ppc64.o
>  obj-$(CONFIG_PROC_FS)		+= $(procfs-y)
>  rtaspci-$(CONFIG_PPC64)		:= rtas_pci.o
> @@ -53,7 +53,6 @@ obj-y				+= time.o prom.o traps.o setup-
>  				   udbg.o misc.o io.o
>  obj-$(CONFIG_PPC32)		+= entry_32.o setup_32.o misc_32.o
>  obj-$(CONFIG_PPC64)		+= misc_64.o dma_64.o iommu.o
> -obj-$(CONFIG_PPC_MULTIPLATFORM)	+= prom_init.o
>  obj-$(CONFIG_MODULES)		+= ppc_ksyms.o
>  obj-$(CONFIG_BOOTX_TEXT)	+= btext.o
>  obj-$(CONFIG_SMP)		+= smp.o
> 
> --
>  Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
>   Pengutronix - Linux Solutions for Science and Industry
>     Handelsregister: Amtsgericht Hildesheim, HRA 2686
>       Hannoversche Str. 2, 31134 Hildesheim, Germany
>     Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [patch 08/16] powerpc: remove EMBEDDED6xx Kconfig entry
From: Grant Likely @ 2006-11-02 22:32 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1162506319.10630.42.camel@localhost.localdomain>

On 11/2/06, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> As for new platforms, I tend to have no problem if they just create a
> directory of their own (platforms/chesnut, etc...) though in some we
> might want a grab bag for boards that really only need one file...
>
> This could be a plaforms/misc, or platforms/simple, or just have them at
> the root of platforms...

Root of platforms makes sense to me.

g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply

* Re: [patch 11/16] powerpc: remove occurences of PPC_MULTIPLATFORM in pci_64.c
From: Benjamin Herrenschmidt @ 2006-11-02 22:32 UTC (permalink / raw)
  To: s.hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102125628.463964000@localhost.localdomain>

On Thu, 2006-11-02 at 13:56 +0100, s.hauer@pengutronix.de wrote:
> plain text document attachment
> (powerpc-pci_64.S-remove-MULTIPLATFORM.diff)
> Since iSeries is merged to MULTIPLATFORM, there is no way to build a 64bit
> kernel without MULTIPLATFORM, so PPC_MULTIPLATFORM can be removed in
> 64bit-only files 
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> Index: arch/powerpc/kernel/pci_64.c
> ===================================================================
> --- a/arch/powerpc/kernel/pci_64.c.orig
> +++ b/arch/powerpc/kernel/pci_64.c
> @@ -42,11 +42,9 @@
>  unsigned long pci_probe_only = 1;
>  int pci_assign_all_buses = 0;
>  
> -#ifdef CONFIG_PPC_MULTIPLATFORM
>  static void fixup_resource(struct resource *res, struct pci_dev *dev);
>  static void do_bus_setup(struct pci_bus *bus);
>  static void phbs_remap_io(void);
> -#endif
>  
>  /* pci_io_base -- the base address from which io bars are offsets.
>   * This is the lowest I/O base address (so bar values are always positive),
> @@ -251,7 +249,6 @@ static void __init pcibios_claim_of_setu
>  		pcibios_claim_one_bus(b);
>  }
>  
> -#ifdef CONFIG_PPC_MULTIPLATFORM
>  static u32 get_int_prop(struct device_node *np, const char *name, u32 def)
>  {
>  	const u32 *prop;
> @@ -506,7 +503,6 @@ void __devinit of_scan_pci_bridge(struct
>  		pci_scan_child_bus(bus);
>  }
>  EXPORT_SYMBOL(of_scan_pci_bridge);
> -#endif /* CONFIG_PPC_MULTIPLATFORM */
>  
>  void __devinit scan_phb(struct pci_controller *hose)
>  {
> @@ -540,7 +536,7 @@ void __devinit scan_phb(struct pci_contr
>  	}
>  
>  	mode = PCI_PROBE_NORMAL;
> -#ifdef CONFIG_PPC_MULTIPLATFORM
> +
>  	if (node && ppc_md.pci_probe_mode)
>  		mode = ppc_md.pci_probe_mode(bus);
>  	DBG("    probe mode: %d\n", mode);
> @@ -548,7 +544,7 @@ void __devinit scan_phb(struct pci_contr
>  		bus->subordinate = hose->last_busno;
>  		of_scan_bus(node, bus);
>  	}
> -#endif /* CONFIG_PPC_MULTIPLATFORM */
> +
>  	if (mode == PCI_PROBE_NORMAL)
>  		hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
>  }
> @@ -592,11 +588,9 @@ static int __init pcibios_init(void)
>  	if (ppc64_isabridge_dev != NULL)
>  		printk(KERN_DEBUG "ISA bridge at %s\n", pci_name(ppc64_isabridge_dev));
>  
> -#ifdef CONFIG_PPC_MULTIPLATFORM
>  	if (!firmware_has_feature(FW_FEATURE_ISERIES))
>  		/* map in PCI I/O space */
>  		phbs_remap_io();
> -#endif
>  
>  	printk(KERN_DEBUG "PCI: Probing PCI hardware done\n");
>  
> @@ -873,8 +867,6 @@ void pcibios_add_platform_entries(struct
>  	device_create_file(&pdev->dev, &dev_attr_devspec);
>  }
>  
> -#ifdef CONFIG_PPC_MULTIPLATFORM
> -
>  #define ISA_SPACE_MASK 0x1
>  #define ISA_SPACE_IO 0x1
>  
> @@ -1343,8 +1335,6 @@ struct pci_controller* pci_find_hose_for
>  	return NULL;
>  }
>  
> -#endif /* CONFIG_PPC_MULTIPLATFORM */
> -
>  unsigned long pci_address_to_pio(phys_addr_t address)
>  {
>  	struct pci_controller *hose, *tmp;
> 
> --
>  Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
>   Pengutronix - Linux Solutions for Science and Industry
>     Handelsregister: Amtsgericht Hildesheim, HRA 2686
>       Hannoversche Str. 2, 31134 Hildesheim, Germany
>     Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [patch 10/16] powerpc: make hash_native_64.o a 64bit-only object
From: Benjamin Herrenschmidt @ 2006-11-02 22:31 UTC (permalink / raw)
  To: s.hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102125628.027744000@localhost.localdomain>

On Thu, 2006-11-02 at 13:56 +0100, s.hauer@pengutronix.de wrote:
> plain text document attachment
> (powerpc-mm-makefile-hash_native_64-make-obj64.diff)
> Make hash_native_64.o dependent on 64bit, not on MULTIPLATFORM
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

If we ever want it, we might have specific Kconfig options for the
various low level MMU interfaces and have the platform select them, but
for now, that's fine.

> Index: arch/powerpc/mm/Makefile
> ===================================================================
> --- a/arch/powerpc/mm/Makefile.orig
> +++ b/arch/powerpc/mm/Makefile
> @@ -8,7 +8,7 @@ endif
>  
>  obj-y				:= fault.o mem.o lmb.o
>  obj-$(CONFIG_PPC32)		+= init_32.o pgtable_32.o mmu_context_32.o
> -hash-$(CONFIG_PPC_MULTIPLATFORM) := hash_native_64.o
> +hash-$(CONFIG_PPC64)		:= hash_native_64.o
>  obj-$(CONFIG_PPC64)		+= init_64.o pgtable_64.o mmu_context_64.o \
>  				   hash_utils_64.o hash_low_64.o tlb_64.o \
>  				   slb_low.o slb.o stab.o mmap.o imalloc.o \
> 
> --
>  Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
>   Pengutronix - Linux Solutions for Science and Industry
>     Handelsregister: Amtsgericht Hildesheim, HRA 2686
>       Hannoversche Str. 2, 31134 Hildesheim, Germany
>     Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [patch 08/16] powerpc: remove EMBEDDED6xx Kconfig entry
From: Benjamin Herrenschmidt @ 2006-11-02 22:30 UTC (permalink / raw)
  To: Stephen Winiecki; +Cc: linuxppc-dev
In-Reply-To: <OF3E950149.B4C8024A-ON8725721A.006D325F-8525721A.007259AD@us.ibm.com>


> What exactly is the intent of PPC_MULTIPLATFORM - the current desc
> states "Generic desktop/server/laptop" - which doesn't exactly scream
> 'embedded' to me either.  I guess I saw embedded6xx as a 'catch-all'
> for everything else.

It's historical. It was the good old prep/chrp/pmac option, meaning that
more than one board support can be built in the same kernel. I've made
the policy decision with ARCH=powerpc that we should now make that
mandatory for new boards (of course provided the CPUs are of the same
family) since, as Sascha rightfully pointed out, it costs nothing and
keeps things cleaner.

Thus I'm all about getting rid of the option :)

> I might be missing something - but when you removed EMBEDDED6xx from
> powerpc/Kconfig in patch 8, and removed MPC7448HPC2 from
> embedded6xx/Kconfig in patch 6 - where did you move the MPC7448HPC2
> config section to?  Is your thought that it will depend on
> PPC_MULTIPLATFORM now as well?

Board support are just boolean options depending on their CPU family
choice. That's the goal at least. I'm sure we are due for some Kconfig
cleanup to make that more visible :) We should probably split the
Kconfig into separate files for the various CPU families containing the
platforms for these families.

> This may be slightly off topic - but one other thing I have noticed
> that the new boot wrapper script supports specific 'types' of zImage
> files associated w/ 'MUTIPLATFORMS' (PSERIES, CHRP, PREP etc.) and
> uImage - which is what I think the majority of 'embedded' platforms
> will use by defining CONFIG_DEFAULT_UIMAGE.

That is not totally clear since they have non-compatible board info.

>   For IBM boards with PIBS just 'normal' zImage ELF files get loaded -
> I'm not sure if there should be another type defined/supported for
> boards which don't fit necessarily into a PSERIES/CHRP/PREP definition
> and also don't use uboot - CONFIG_DEFAULT_ZIMAGE? 
> 

Ask Paulus about the naming but pSeries is just "normal" in the sense
that it's "booted from a real OF" support.

The problem is despite the ability to do those nice multiplatform kernel
images, we still have bootloader incompatibilities. Thus we want to move
those to the zImage wrapper which can produce, from an already built
vmlinux binary, any zImage that can be supported for a given firmware
interface.

In the long run, we hope that firmwares will finally get their gears
together and use either a real OF entry point or a direct flat
device-tree entry point, which means that a single zImage (the "normal
one as you call it) will be able to boot everything.

There's also a glitch with real OF zImages due to the fact that IBM
pSeries OF requires a Notes section forcing OF into real mode while
Apple OF is allergic to that (it will crash badly) so we need to keep a
separate zImage for PowerMac. However, the vmlinux are the same so if
you use something like yaboot, the same vmlinux cna be booted on all
those machines.

Ben.

^ permalink raw reply

* Re: [patch 08/16] powerpc: remove EMBEDDED6xx Kconfig entry
From: Benjamin Herrenschmidt @ 2006-11-02 22:25 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102160009.GC4928@localhost.localdomain>

On Thu, 2006-11-02 at 17:00 +0100, Sascha Hauer wrote:
> On Thu, Nov 02, 2006 at 10:32:53AM -0500, Stephen Winiecki wrote:
> > 
> >    I also have a question about 750xx platforms.  I currently am looking at
> >    adding platform code supporting IBM 750GX/CL eval boards.  Where would
> >    they go - as well as others like Buckeye/Chestnut if/when they move over
> >    to /powerpc?
> 
> I don't know - Lets wait for ben and others what they say about this
> approach.
> My intention with this patch is to try and motivate people to
> integrate their machines as a part of the multiplatform support, because
> it doesn't cost a thing.

And that's a great move :) Thanks for doing that work !

> The presence of the embedded6xx entry and the entries in the directory
> itself makes people think (me too) that the multiplatform thing is only
> for the big irons. I think it's better to unify the two ways of platform
> support where it's possible.

Yes. I've been wanting to get rid of it for some time.

As for new platforms, I tend to have no problem if they just create a
directory of their own (platforms/chesnut, etc...) though in some we
might want a grab bag for boards that really only need one file...

This could be a plaforms/misc, or platforms/simple, or just have them at
the root of platforms...

Ben. 

^ permalink raw reply

* Re: [patch 06/16] powerpc: remove _machine
From: Benjamin Herrenschmidt @ 2006-11-02 22:23 UTC (permalink / raw)
  To: s.hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102125626.263838000@localhost.localdomain>

On Thu, 2006-11-02 at 13:56 +0100, s.hauer@pengutronix.de wrote:
> plain text document attachment
> (powerpc-include-asm-powerpc-processor_h-remove-_machine.diff)
> The _machine macro was once used for compatibility with ARCH=ppc
> drivers. It is unused in current kernels
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> Index: include/asm-powerpc/processor.h
> ===================================================================
> --- a/include/asm-powerpc/processor.h.orig
> +++ b/include/asm-powerpc/processor.h
> @@ -53,10 +53,6 @@ extern unsigned char ucBoardRevMaj, ucBo
>  
>  #endif /* CONFIG_PPC_PREP */
>  
> -#ifndef CONFIG_PPC_MULTIPLATFORM
> -#define _machine 0
> -#endif /* CONFIG_PPC_MULTIPLATFORM */
> -
>  #endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */
>  
>  /*
> 
> --
>  Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
>   Pengutronix - Linux Solutions for Science and Industry
>     Handelsregister: Amtsgericht Hildesheim, HRA 2686
>       Hannoversche Str. 2, 31134 Hildesheim, Germany
>     Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [patch 05/16] powerpc: remove ifdef
From: Benjamin Herrenschmidt @ 2006-11-02 22:22 UTC (permalink / raw)
  To: s.hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102125625.828393000@localhost.localdomain>

On Thu, 2006-11-02 at 13:56 +0100, s.hauer@pengutronix.de wrote:
> plain text document attachment
> (powerpc-include-asm-powerpc-pci_h-remove-ifdef.diff)
> current kernels always have one of CONFIG_PPC_MULTIPLATFORM
> or CONFIG_PPC32 defined, so remove bogus ifdef
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> Index: linux-2.6/include/asm-powerpc/pci.h
> ===================================================================
> --- linux-2.6.orig/include/asm-powerpc/pci.h
> +++ linux-2.6/include/asm-powerpc/pci.h
> @@ -238,12 +238,10 @@ extern pgprot_t	pci_phys_mem_access_prot
>  					 unsigned long size,
>  					 pgprot_t prot);
>  
> -#if defined(CONFIG_PPC_MULTIPLATFORM) || defined(CONFIG_PPC32)
>  #define HAVE_ARCH_PCI_RESOURCE_TO_USER
>  extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
>  				 const struct resource *rsrc,
>  				 resource_size_t *start, resource_size_t *end);
> -#endif /* CONFIG_PPC_MULTIPLATFORM || CONFIG_PPC32 */
>  
>  #endif	/* __KERNEL__ */
>  #endif /* __ASM_POWERPC_PCI_H */
> 
> --
>  Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
>   Pengutronix - Linux Solutions for Science and Industry
>     Handelsregister: Amtsgericht Hildesheim, HRA 2686
>       Hannoversche Str. 2, 31134 Hildesheim, Germany
>     Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [patch 04/16] powerpc: remove dead code in iommu.h
From: Benjamin Herrenschmidt @ 2006-11-02 22:21 UTC (permalink / raw)
  To: s.hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102125625.428089000@localhost.localdomain>

On Thu, 2006-11-02 at 13:55 +0100, s.hauer@pengutronix.de wrote:
> plain text document attachment
> (powerpc-include-asm-powerpc-iommu_h-remove-dead-code.diff)
> iommu_setup_pSeries() and iommu_setup_dart() are declared extern but are
> not implemented, so remove them. iommu_free_table() is pSeries specific,
> so #ifdef it with CONFIG_PPC_PSERIES and not CONFIG_PPC_MULTIPLATFORM
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

There is no need to #ifdef an extern declaration. Just remove the
ifdef's and the two obsolete prototypes alltogether

Cheers,
Ben.

> Index: linux-2.6/include/asm-powerpc/iommu.h
> ===================================================================
> --- linux-2.6.orig/include/asm-powerpc/iommu.h
> +++ linux-2.6/include/asm-powerpc/iommu.h
> @@ -70,16 +70,12 @@ struct iommu_table {
>  struct scatterlist;
>  struct device_node;
>  
> -#ifdef CONFIG_PPC_MULTIPLATFORM
> -
> -/* Walks all buses and creates iommu tables */
> -extern void iommu_setup_pSeries(void);
> -extern void iommu_setup_dart(void);
> +#ifdef CONFIG_PPC_PSERIES
>  
>  /* Frees table for an individual device node */
>  extern void iommu_free_table(struct device_node *dn);
>  
> -#endif /* CONFIG_PPC_MULTIPLATFORM */
> +#endif /* CONFIG_PPC_PSERIES */
>  
>  /* Initializes an iommu_table based in values set in the passed-in
>   * structure
> 
> --
>  Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
>   Pengutronix - Linux Solutions for Science and Industry
>     Handelsregister: Amtsgericht Hildesheim, HRA 2686
>       Hannoversche Str. 2, 31134 Hildesheim, Germany
>     Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [patch 02/16] replace CONFIG_PPC_MULTIPLATFORM with CONFIG_PPC_PMAC in tulip driver
From: Benjamin Herrenschmidt @ 2006-11-02 22:20 UTC (permalink / raw)
  To: s.hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102125624.568115000@localhost.localdomain>

On Thu, 2006-11-02 at 13:55 +0100, s.hauer@pengutronix.de wrote:
> plain text document attachment
> (drivers-net-tulip-de4x5-remove-MULTIPLATFORM.diff)
> replace CONFIG_PPC_MULTIPLATFORM with CONFIG_PPC_PMAC in
> drivers/net/tulip/de4x5.c. It is needed for a pmac specific hook but
> has nothing with to do with PPC_MULTIPLATFORM
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> Index: linux-2.6/drivers/net/tulip/de4x5.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/tulip/de4x5.c
> +++ linux-2.6/drivers/net/tulip/de4x5.c
> @@ -473,9 +473,9 @@
>  #include <asm/byteorder.h>
>  #include <asm/unaligned.h>
>  #include <asm/uaccess.h>
> -#ifdef CONFIG_PPC_MULTIPLATFORM
> +#ifdef CONFIG_PPC_PMAC
>  #include <asm/machdep.h>
> -#endif /* CONFIG_PPC_MULTIPLATFORM */
> +#endif /* CONFIG_PPC_PMAC */
>  
>  #include "de4x5.h"
>  
> @@ -4151,7 +4151,7 @@ get_hw_addr(struct net_device *dev)
>      /* If possible, try to fix a broken card - SMC only so far */
>      srom_repair(dev, broken);
>  
> -#ifdef CONFIG_PPC_MULTIPLATFORM
> +#ifdef CONFIG_PPC_PMAC
>      /*
>      ** If the address starts with 00 a0, we have to bit-reverse
>      ** each byte of the address.
> @@ -4168,7 +4168,7 @@ get_hw_addr(struct net_device *dev)
>  		    dev->dev_addr[i] = ((x & 0x55) << 1) + ((x & 0xaa) >> 1);
>  	    }
>      }
> -#endif /* CONFIG_PPC_MULTIPLATFORM */
> +#endif /* CONFIG_PPC_PMAC */
>  
>      /* Test for a bad enet address */
>      status = test_bad_enet(dev, status);
> 
> --
>  Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
>   Pengutronix - Linux Solutions for Science and Industry
>     Handelsregister: Amtsgericht Hildesheim, HRA 2686
>       Hannoversche Str. 2, 31134 Hildesheim, Germany
>     Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* minor progress with plb_temac v3.00a, EDK 8.2, & 2.6.18.1
From: robert corley @ 2006-11-02 22:20 UTC (permalink / raw)
  To: linux linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 4792 bytes --]

For those interested, I have acheived some measure of success with the plb_temac driver.

I have attached a txt file of what I had to do to get it working under 2.6.18.1

I am using the plb_temac in DMA mode 3

Below you will see the boot dump.

For those able to help, can anyone provide insight as to the failure of setting PHY link speed?

-cy



====================
----------------------------------------------------------------------
2.6.18.1 kernel with all patches
11/02/2006    15:30
plb_temac v3.00a
hard_temac v3.00b


loaded at:     00400000 009F1138
board data at: 009EF120 009EF138
relocated to:  004040B4 004040CC
zimage at:     00404EC7 0057C1F2
initrd at:     0057D000 009EE6FE
avail ram:     009F2000 04000000


Linux/PPC load: console=ttyUL0 single ip=192.168.1.100:192.168.1.144:192.168.1.1:255.255.255.0:nab:: ramdisk_size=4660000 root=/dev/ram rw

Uncompressing Linux...done.

Now booting the kernel

[    0.000000] Linux version 2.6.18.1 (rdcorle@athena) (gcc version 3.4.2) #2 Thu Nov 2 21:56:32 UTC 2006
[    0.000000] Xilinx ML403 Reference System (Virtex-4 FX)
[    0.000000] Built 1 zonelists.  Total pages: 16384
[    0.000000] Kernel command line: console=ttyUL0 single ip=192.168.1.100:192.168.1.144:192.168.1.1:255.255.255.0:nab:: ramdisk_size=4660000 root=/dev/ram rw
[    0.000000] Xilinx INTC #0 at 0xD1000FC0 mapped to 0xFDFFFFC0
[    0.000000] PID hash table entries: 512 (order: 9, 2048 bytes)
[    0.000158] Console: colour dummy device 80x25
[    0.000568] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.001277] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.012895] Memory: 57060k available (2548k kernel code, 640k data, 96k init, 0k highmem)
[    0.104378] Mount-cache hash table entries: 512
[    0.106721] checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
[    2.414242] Freeing initrd memory: 4549k freed
[    2.418712] NET: Registered protocol family 16
[    2.427313] NET: Registered protocol family 2
[    2.464244] IP route cache hash table entries: 512 (order: -1, 2048 bytes)
[    2.465037] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    2.465205] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    2.465296] TCP: Hash tables configured (established 2048 bind 1024)
[    2.465324] TCP reno registered
[    2.474633] NTFS driver 2.1.27 [Flags: R/O].
[    2.475046] JFS: nTxBlock = 481, nTxLock = 3854
[    2.477623] SGI XFS with no debug enabled
[    2.479001] io scheduler noop registered
[    2.479109] io scheduler anticipatory registered
[    2.479197] io scheduler deadline registered
[    2.479402] io scheduler cfq registered (default)
[    2.517627] uartlite.0: ttyUL0 at MMIO 0xa0000000 (irq = 1) is a uartlite
[    2.691029] RAMDISK driver initialized: 16 RAM disks of 4660000K size 1024 blocksize
[    2.703933] loop: loaded (max 8 devices)
[    2.709698] XTemac: using sgDMA mode.
[    2.713493] XTemac: using TxDRE mode
[    2.717081] XTemac: using RxDRE mode
[    2.720678] XTemac: buffer descriptor size: 32768 (0x8000)
[    2.726622] XTemac: (buffer_descriptor_init) phy: 0x580000, virt: 0xff100000, size: 0x8000
[    2.741073] eth0: Xilinx TEMAC #0 at 0x60000000 mapped to 0xC5050000, irq=0
[    2.748080] eth0: XTemac id 1.0f, block id 5, type 8
[    2.753636] mice: PS/2 mouse device common for all mice
[    2.759529] TCP bic registered
[    3.264317] eth0: XTemac: Options: 0xb8f2
[   15.227339] eth0: XTemac: Not able to set the speed to 1000 (status: 0x148)
[   25.200394] eth0: XTemac: Not able to set the speed to 100 (status: 0x148)
[   35.173357] eth0: XTemac: Not able to set the speed to 10 (status: 0x148)
[   35.180122] eth0: XTemac: could not negotiate speed
[   35.187740] eth0: XTemac: Send Threshold = 16, Receive Threshold = 2
[   35.194116] eth0: XTemac: Send Wait bound = 1, Receive Wait bound = 1
[   36.205399] IP-Config: Complete:
[   36.208459]       device=eth0, addr=192.168.1.100, mask=255.255.255.0, gw=192.168.1.1,
[   36.216339]      host=nab, domain=, nis-domain=(none),
[   36.221487]      bootserver=192.168.1.144, rootserver=192.168.1.144, rootpath=
[   36.229826] RAMDISK: Compressed image found at block 0
[   37.200498] eth0: XTemac: PHY Link carrier lost.
[   39.097820] VFS: Mounted root (ext2 filesystem).
[   39.102751] Freeing unused kernel memory: 96k init
[   39.108356] ulite_startup: UART status = 0x0014
[   39.124619] ulite_startup: UART status = 0x0014
[   39.134313] ulite_startup: UART status = 0x0014


BusyBox v1.00-pre9 (2004.04.18-19:53+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

-sh: can't access tty; job control turned off



[-- Attachment #2: kernel 2.6.18 and the plb_temac.txt --]
[-- Type: text/plain, Size: 3950 bytes --]

steps for plb_temac drivers under EDK 8.2.02i (w/SP2.4+0)
Using plb_temac v3.00a & hard_temac v3.00b

Generate s/w libraries

1.	copy or ftp the following files from C:\EDK\sw\ThirdParty\bsp\linux_2_6_v1_00_a\linux\
	to the base directory of the linux source tree

	USED:
	arch\ppc\platforms\4xx\xparameters\xparameters.h

	** UNUSED
	arch\ppc\platforms\4xx\virtex.c
	arch\ppc\boot\simple\embed_config.c
	include\linux\xilinx_devices.h

2.	copy C:\EDK\sw\ThirdParty\bsp\linux_2_6_v1_00_a\drivers\temac_linux_2_6_v2_00_b\src\adapter.c to
	../drivers/net/xilinx_temac/adapter.c

3.	copy or ftp ..\linux\arch\ppc\platforms\xilinx_ocp => drivers/xilinx_edk
	Note: Remove all old files first *except* Kconfig, xio.h

4.	modify drivers/xilinx_edk/Makefile with the following to look like this:

# Linux file to EXPORT_SYMBOL all of the Xilinx entries.
obj-$(CONFIG_XILINX_EDK) += xilinx_syms.o
#
# # The Xilinx OS independent code.
xilinx_syms-objs := xbasic_types.o \
                    xdmav3.o xdmav3_intr.o xdmav3_selftest.o xdmav3_simple.o xdmav3_sg.o \
                    xipif_v1_23_b.o \
                    xpacket_fifo_l_v2_00_a.o xpacket_fifo_v2_00_a.o \
                    xversion.o

5.	Modify your copied xparameters_ml403.h (see notes below) as follows:
	add these lines after #define XPAR_PLB_TEMAC_0_INCLUDE_RX_CSUM

	#define XPAR_TEMAC_0_IPIF_RDFIFO_DEPTH  XPAR_PLB_TEMAC_0_RXFIFO_DEPTH
	#define XPAR_TEMAC_0_IPIF_WRFIFO_DEPTH  XPAR_PLB_TEMAC_0_TXFIFO_DEPTH
	#define XPAR_TEMAC_0_MAC_FIFO_DEPTH     XPAR_PLB_TEMAC_0_MAC_FIFO_DEPTH
	#define XPAR_TEMAC_0_TEMAC_DCR_HOST     0
	#define XPAR_TEMAC_0_INCLUDE_DRE        1


6.	(optional) modify arch/ppc/platforms/virtex.h to accomodate RX_CSUM XPAR

struct xtemac_platform_data {
#ifdef XPAR_TEMAC_0_INCLUDE_RX_CSUM
      u8 tx_dre;
      u8 rx_dre;
      u8 tx_csum;
      u8 rx_csum;
      u8 phy_type;
#endif
      u8 dma_mode;
      u32 rx_pkt_fifo_depth;
      u32 tx_pkt_fifo_depth;
      u16 mac_fifo_depth;
      u8 dcr_host;
      u8 dre;
      u8 mac_addr[6];
};

7.	Modify ../drivers/net/xilinx_temac/adapter.c to remove #include <linux/xilinx_devices.h> and
	add #include <linux/platform_device.h>
	add #include <platforms/4xx/virtex.h>

____________________________________________________________________________________
NOTES:
1.	Don't forget to copy EDK-generated xparameters.h to ../arch/ppc/platforms/4xx/xparameters/xparameters_ml403.h



=====================================================
Files in latest patch:
../drivers/net/xilinx_temac =
Makefile
adapter.c
xtemac.c
xtemac_control.c
xtemac_fifo.c
xtemac_intr.c
xtemac_intr_fifo.c
xtemac_intr_sgdma.c
xtemac_l.c
xtemac_sgdma.c
xtemac.h
xtemac_i.h
xtemac_l.h

Files in ..\linux\drivers\net\xilinx_temac =>  (** = new files)

Makefile
adapter.c
xtemac.c
xtemac_control.c
xtemac_fifo.c
xtemac_g.c**
xtemac_intr.c
xtemac_intr_fifo.c
xtemac_intr_sgdma.c
xtemac_l.c
xtemac_selftest.c**
xtemac_sgdma.c
xtemac_sinit.c**
xtemac_stats.c**
xtemac.h
xtemac_i.h
xtemac_l.h

============================================================
Files in ../drivers/xilinx_edk =>

Kconfig
Makefile
xbasic_types.c
xdmav2.c
xdmav2_intr.c
xdmav2_sg.c
xdmav2_simple.c
xilinx_syms.c
xpacket_fifo_l_v2_00_a.c
xpacket_fifo_v2_00_a.c
xbasic_types.h
xdmabdv2.h
xdmav2.h
xdmav2_l.h
xio.h
xpacket_fifo_l_v2_00_a.h
xpacket_fifo_v2_00_a.h
xstatus.h

Files in ..\linux\arch\ppc\platforms\xilinx_ocp=>
Makefile
xbasic_types.c
xutil_memtest.c
xpacket_fifo_v2_00_a.c
xdmav3.c
xpacket_fifo_l_v2_00_a.c
xdmav3_intr.c
xipif_v1_23_b.c
xdmav3_selftest.c
xdmav3_sg.c
xdmav3_simple.c
xversion.c
xenv.h
xenv_none.h
xenv_vxworks.h
xdmav3_l.h
xipif_v1_23_b.h
xdmav3.h
xpacket_fifo_l_v2_00_a.h
xdmabdv3.h
xpacket_fifo_v2_00_a.h
xparameters_ml300.h
xstatus.h
xutil.h
xbasic_types.h
xenv_linux.h
xversion.h

^ permalink raw reply

* Re: [patch 01/16] remove inclusion of asm/processor.h for powerpc
From: Benjamin Herrenschmidt @ 2006-11-02 22:20 UTC (permalink / raw)
  To: s.hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102125624.134898000@localhost.localdomain>

On Thu, 2006-11-02 at 13:55 +0100, s.hauer@pengutronix.de wrote:
> plain text document attachment
> (drivers-ide-pci-via82xxx-remove-ppc-ifdef.diff)
> Remove inclusion of asm/processor.h for powerpc. It was used for
> some ppc specific hook in this file, but the hook is gone

It's not:

init_hwif_via82cxxx() contains:

#if defined(CONFIG_PPC_CHRP) && defined(CONFIG_PPC32)
        if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) {
                hwif->irq = hwif->channel ? 15 : 14;
        }
#endif

Now you can replace CONFIG_PPC_MULTIPLATFORM with CONFIG_PPC_CHRP

> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> Index: linux-2.6/drivers/ide/pci/via82cxxx.c
> ===================================================================
> --- linux-2.6.orig/drivers/ide/pci/via82cxxx.c
> +++ linux-2.6/drivers/ide/pci/via82cxxx.c
> @@ -35,10 +35,6 @@
>  #include <linux/ide.h>
>  #include <asm/io.h>
>  
> -#ifdef CONFIG_PPC_MULTIPLATFORM
> -#include <asm/processor.h>
> -#endif
> -
>  #include "ide-timing.h"
>  
>  #define DISPLAY_VIA_TIMINGS
> 
> --
>  Dipl.-Ing. Sascha Hauer | http://www.pengutronix.de
>   Pengutronix - Linux Solutions for Science and Industry
>     Handelsregister: Amtsgericht Hildesheim, HRA 2686
>       Hannoversche Str. 2, 31134 Hildesheim, Germany
>     Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [patch 08/16] powerpc: remove EMBEDDED6xx Kconfig entry
From: Benjamin Herrenschmidt @ 2006-11-02 22:13 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <528646bc0611020755k5be2d2ach388e921a29663bfa@mail.gmail.com>


> Then perhaps Efika should also be under platforms/mpc52xx?

Classifying platforms by their processor might not be the best idea... I
makes some sense when those platforms are basically reference designs
for the said processor but I yet have to be convinced it's really a good
thing in the long run :)

There will be a lot of platforms that will consist of basically once
signle source file. I think we need a directory for those. Maybe
platform/misc :) Or we could have them at the root of platforms/ in
fact... 

Paulus, what is your preference in that area ?

In the long run, it doesn't really matter in the sense that it's purely
the file location in the source tree, it has no effect on the content of
those files (+/- include path) or at runtime. You can still build kernel
with multiple images if the CPU cores are of the same category etc...
Thus, in this regard, it's almost cosmetic.
 
Cheers,
Ben.

^ permalink raw reply

* porting Xilinx drivers...
From: Michael Galassi @ 2006-11-02 22:10 UTC (permalink / raw)
  To: linuxppc-embedded

I need to get Xilinx's latest Temac drivers ported to a 2.6 kernel, I
don't much care if it is Montavista's 2.6.10 variant or one of the more
mainstream (kernel.org) variants.  To this end I would love a FM, even
an outdated HOWTO (is there any other sort?) which dives into how this
is done would be exceedingly nice.  Does anyone know of some such a
beast?  I'd even happily update an outdated version as I go along and
post it back here (along with the resulting driver if there is any
interest).

Thanks,

-michael

^ permalink raw reply

* RE: rebuild error for 2.6.18 plb_temac driver from EDK
From: robert corley @ 2006-11-02 21:04 UTC (permalink / raw)
  To: linux linuxppc-embedded

To answer my own question:=0A=0AMakefile (drivers/xilinx_edk/Makefile) inco=
rrect.  This one works=0A=0A-----------------------------------------------=
---------------------------------------=0A# Linux file to EXPORT_SYMBOL all=
 of the Xilinx entries.=0Aobj-$(CONFIG_XILINX_EDK) +=3D xilinx_syms.o=0A#=
=0A# # The Xilinx OS independent code.=0Axilinx_syms-objs :=3D xbasic_types=
.o \=0A                    xdmav3.o xdmav3_intr.o xdmav3_selftest.o xdmav3_=
simple.o xdmav3_sg.o \=0A                    xipif_v1_23_b.o \=0A          =
          xpacket_fifo_l_v2_00_a.o xpacket_fifo_v2_00_a.o \=0A             =
       xversion.o=0A-------------------------------------------------------=
-------------------------------=0A=0A=0A!! Thank goodness for Documentation=
/kbuild/makefiles.txt  !!=0A=0A-cy=0A=0A

^ permalink raw reply

* Re: [PATCH/RFC] powerpc: Add Efika platform support
From: Nicolas DET @ 2006-11-02 20:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, sl, linuxppc-embedded
In-Reply-To: <1162423546.25682.486.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 3229 bytes --]

Benjamin Herrenschmidt wrote:
> On Thu, 2006-11-02 at 09:19 +1100, Benjamin Herrenschmidt wrote:
>> On Wed, 2006-11-01 at 21:29 +0100, Nicolas DET wrote:
> 
> Ooops ... here's the english version :)
> 
>>> +
>>> +static void __init efika_init_IRQ(void)
>>> +{
>>> +	mpc52xx_init_irq();
>>> +}
>> Ya pas moyen que mpc52xx_init_irq() ait le bon prototype pour que tu le
>> colle directement dans ppc_md. ?
> 
> It would be better if mpc52xx_init_irq() had the right prototype so it
> can be hooked directly from ppc_md.

Well. there was other init done here before. However, I think it's good 
to have this here, in case more code would be needed or in the 
ppc_md.init_IRQ is changed. no ?

>>> +
>>> +	ISA_DMA_THRESHOLD = ~0L;
>>> +	DMA_MODE_READ = 0x44;
>>> +	DMA_MODE_WRITE = 0x48;
>> Ca viens de CHRP ca ? Je suis pas sur que ca soit super utile... mais
>> bon, ca mange pas de pain.. Au cas ou qqun colle un southbridge ISA sur
>> le bus PCI :)
> 

Well. It it doesn't hurt it can stay here. People are a little bit weird 
today. Maybe they would try to solder a PCI southbridige to get a nice 
PC speaker beep ;-)

> This comes from CHRP ? I'm not sure it's terribly useful, at least for
> Efika, though it doesn't hurt. Maybe some day somebody will stick an ISA
> southbridge on the 5200 PCI bus :)
> 
>>> +void __init efika_pcisetup(void)
>>> +{
>>> +	const int *bus_range;
>>> +	int len;
>>> +	struct pci_controller *hose;
>>> +	struct device_node *root;
>>> +	struct device_node *pcictrl;
>>> +
>>> +	root = of_find_node_by_path("/");
>>> +	if (root == NULL) {
>>> +		printk(KERN_WARNING EFIKA_PLATFORM_NAME
>>> +		       ": Unable to find the root node\n");
>>> +		return;
>>> +	}
>>> +
>>> +	for (pcictrl = NULL;;) {
>>> +		pcictrl = of_get_next_child(root, pcictrl);
>>> +		if ((pcictrl == NULL) || (strcmp(pcictrl->name, "pci") == 0))
>>> +			break;
>>> +	}
>>> +
>>> +	if (pcictrl == NULL) {
>>> +		printk(KERN_WARNING EFIKA_PLATFORM_NAME
>>> +		       ": Unable to find the PCI bridge node\n");
>>> +		return;
>>> +	}
>>> +
>>> +	of_node_put(pcictrl);
>>> +	of_node_put(root);
>> Euh... non... tu fait pas of_node_put(pcictrl) avant de t'en servir...
>> tu fait ca quand tu as fini. Ca veut dire probablement changer test
>> "return" en "goto bail;" ou un truc du genre.
> 
> Don't do an of_node_put(pcictrl) before you use that node... Do it when
> you are done with it, which probably means changing "return" statements
> into something like "goto bail;"
> 

I hope I did it right.

>>> +	if (bus_range[1] == bus_range[0])
>>> +		printk(KERN_INFO EFIKA_PLATFORM_NAME ": PCI bus %d",
>>> +		       bus_range[0]);
>>> +	else
>>> +		printk(KERN_INFO EFIKA_PLATFORM_NAME ": PCI buses %d..%d",
>>> +		       bus_range[0], bus_range[1]);
>>> +	printk(" controlled by %s", pcictrl->full_name);
>>> +	printk("\n");
>> You really need the above printk's ? 
> 
> Ah, that one was good :)
> 

>> 	hose->arch_data = of_node_get(pcictrl);
>>

Ok

>>> +	hose->first_busno = bus_range[0];
>>> +	hose->last_busno = bus_range[1];
>>> +	hose->ops = &rtas_pci_ops;
>>> +
>>> +	pci_process_bridge_OF_ranges(hose, pcictrl, 0);
>>> +}
>> Le reste est bon.
>>
>> On y est presque ! :)
> 
> The rest is good, we're almost there :)
> 



[-- Attachment #2: archpowerpc_efika.patch --]
[-- Type: text/plain, Size: 9937 bytes --]

--- a/arch/powerpc/platforms/efika/setup.c	1970-01-01 01:00:00.000000000 +0100
+++ b/arch/powerpc/platforms/efika/setup.c	2006-11-02 17:54:37.000000000 +0100
@@ -0,0 +1,166 @@
+/*
+ *
+ * Efika 5K2 platform setup
+ * Some code really inspired from the lite5200b platform.
+ * 
+ * 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/errno.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/ptrace.h>
+#include <linux/slab.h>
+#include <linux/user.h>
+#include <linux/interrupt.h>
+#include <linux/reboot.h>
+#include <linux/init.h>
+#include <linux/utsrelease.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/console.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/initrd.h>
+#include <linux/module.h>
+#include <linux/timer.h>
+
+#include <asm/pgtable.h>
+#include <asm/prom.h>
+#include <asm/dma.h>
+#include <asm/machdep.h>
+#include <asm/irq.h>
+#include <asm/sections.h>
+#include <asm/time.h>
+#include <asm/rtas.h>
+#include <asm/of_device.h>
+#include <asm/mpc52xx.h>
+
+#include "efika.h"
+
+static void efika_show_cpuinfo(struct seq_file *m)
+{
+	struct device_node *root;
+	const char *revision = NULL;
+	const char *codegendescription = NULL;
+	const char *codegenvendor = NULL;
+
+	root = of_find_node_by_path("/");
+	if (root) {
+		revision = get_property(root, "revision", NULL);
+		codegendescription =
+		    get_property(root, "CODEGEN,description", NULL);
+		codegenvendor = get_property(root, "CODEGEN,vendor", NULL);
+	}
+
+	of_node_put(root);
+
+	if (codegendescription)
+		seq_printf(m, "machine\t\t: %s\n", codegendescription);
+	else
+		seq_printf(m, "machine\t\t: Efika\n");
+
+	if (revision)
+		seq_printf(m, "revision\t: %s\n", revision);
+
+	if (codegenvendor)
+		seq_printf(m, "vendor\t\t: %s\n", codegenvendor);
+}
+
+static void __init efika_setup_arch(void)
+{
+	rtas_initialize();
+
+#ifdef CONFIG_BLK_DEV_INITRD
+	initrd_below_start_ok = 1;
+
+	if (initrd_start)
+		ROOT_DEV = Root_RAM0;
+	else
+#endif
+		ROOT_DEV = Root_SDA2;	/* sda2 (sda1 is for the kernel) */
+
+	efika_pcisetup();
+
+	if (ppc_md.progress)
+		ppc_md.progress("Linux/PPC " UTS_RELEASE " runnung on Efika ;-)\n", 0x0);
+}
+
+static void __init efika_init_IRQ(void)
+{
+	mpc52xx_init_irq();
+}
+
+static void __init efika_init(void)
+{
+	struct device_node *np;
+	struct device_node *cnp = NULL;
+	const u32 *base;
+	char *name;
+
+	/* Find every child of the SOC node and add it to of_platform */
+	np = of_find_node_by_name(NULL, "builtin");
+	if (np) {
+		while ((cnp = of_get_next_child(np, cnp))) {
+			name = kmalloc(BUS_ID_SIZE, GFP_KERNEL);
+			if (name == NULL)
+				continue;
+
+			strcpy(name, cnp->name);
+
+			base = get_property(cnp, "reg", NULL);
+			if (base == NULL) {
+				kfree(name);
+				continue;
+			}
+
+			sprintf(name+strlen(name), "@%x", *base);
+			of_platform_device_create(cnp, name, NULL);
+
+			printk(KERN_INFO ": Added %s (%s) to the known devices\n", name, cnp->full_name);
+		}
+	}
+
+	if (ppc_md.progress)
+		ppc_md.progress("  Have fun with your Efika!    ", 0x7777);
+}
+
+static int __init efika_probe(void)
+{
+	char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+					  "model", NULL);
+
+	if (model == NULL)
+		return 0;
+	if (strcmp(model, "EFIKA5K2"))
+		return 0;
+
+	ISA_DMA_THRESHOLD = ~0L;
+	DMA_MODE_READ = 0x44;
+	DMA_MODE_WRITE = 0x48;
+
+	return 1;
+}
+
+define_machine(efika)
+{
+	.name = EFIKA_PLATFORM_NAME,
+	.probe = efika_probe,
+	.setup_arch = efika_setup_arch,
+	.init = efika_init,
+	.show_cpuinfo = efika_show_cpuinfo,
+	.init_IRQ = efika_init_IRQ,
+	.get_irq = mpc52xx_get_irq,
+	.restart = rtas_restart,
+	.power_off = rtas_power_off,
+	.halt = rtas_halt,
+	.set_rtc_time = rtas_set_rtc_time,
+	.get_rtc_time = rtas_get_rtc_time,
+	.progress = rtas_progress,
+	.get_boot_time = rtas_get_boot_time,
+	.calibrate_decr = generic_calibrate_decr,
+	.phys_mem_access_prot = pci_phys_mem_access_prot,
+};
--- a/arch/powerpc/platforms/efika/pci.c	1970-01-01 01:00:00.000000000 +0100
+++ b/arch/powerpc/platforms/efika/pci.c	2006-11-02 17:54:37.000000000 +0100
@@ -0,0 +1,119 @@
+
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/string.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/prom.h>
+#include <asm/machdep.h>
+#include <asm/sections.h>
+#include <asm/pci-bridge.h>
+#include <asm/rtas.h>
+
+#include "efika.h"
+
+#ifdef CONFIG_PCI
+/*
+ * Access functions for PCI config space using RTAS calls.
+ */
+static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
+			    int len, u32 * val)
+{
+	struct pci_controller *hose = bus->sysdata;
+	unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
+	    | (((bus->number - hose->first_busno) & 0xff) << 16)
+	    | (hose->index << 24);
+	int ret = -1;
+	int rval;
+
+	rval = rtas_call(rtas_token("read-pci-config"), 2, 2, &ret, addr, len);
+	*val = ret;
+	return rval ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
+}
+
+static int rtas_write_config(struct pci_bus *bus, unsigned int devfn,
+			     int offset, int len, u32 val)
+{
+	struct pci_controller *hose = bus->sysdata;
+	unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
+	    | (((bus->number - hose->first_busno) & 0xff) << 16)
+	    | (hose->index << 24);
+	int rval;
+
+	rval = rtas_call(rtas_token("write-pci-config"), 3, 1, NULL,
+			 addr, len, val);
+	return rval ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
+}
+
+static struct pci_ops rtas_pci_ops = {
+	rtas_read_config,
+	rtas_write_config
+};
+
+void __init efika_pcisetup(void)
+{
+	const int *bus_range;
+	int len;
+	struct pci_controller *hose;
+	struct device_node *root;
+	struct device_node *pcictrl;
+
+	root = of_find_node_by_path("/");
+	if (root == NULL) {
+		printk(KERN_WARNING EFIKA_PLATFORM_NAME
+		       ": Unable to find the root node\n");
+		return;
+	}
+
+	for (pcictrl = NULL;;) {
+		pcictrl = of_get_next_child(root, pcictrl);
+		if ((pcictrl == NULL) || (strcmp(pcictrl->name, "pci") == 0))
+			break;
+	}
+
+	of_node_put(root);
+
+	if (pcictrl == NULL) {
+		printk(KERN_WARNING EFIKA_PLATFORM_NAME
+		       ": Unable to find the PCI bridge node\n");
+		of_node_put(pcictrl);
+		return;
+	}
+
+	bus_range = get_property(pcictrl, "bus-range", &len);
+	if (bus_range == NULL || len < 2 * sizeof(int)) {
+		printk(KERN_WARNING EFIKA_PLATFORM_NAME
+		       ": Can't get bus-range for %s\n", pcictrl->full_name);
+		return;
+	}
+	if (bus_range[1] == bus_range[0])
+		printk(KERN_INFO EFIKA_PLATFORM_NAME ": PCI bus %d",
+		       bus_range[0]);
+	else
+		printk(KERN_INFO EFIKA_PLATFORM_NAME ": PCI buses %d..%d",
+		       bus_range[0], bus_range[1]);
+	printk(" controlled by %s\n", pcictrl->full_name);
+	printk("\n");
+
+	hose = pcibios_alloc_controller();
+	if (!hose) {
+		printk(KERN_WARNING EFIKA_PLATFORM_NAME
+		       ": Can't allocate PCI controller structure for %s\n",
+		       pcictrl->full_name);
+		return;
+	}
+
+	hose->arch_data = of_node_get(pcictrl);
+	hose->first_busno = bus_range[0];
+	hose->last_busno = bus_range[1];
+	hose->ops = &rtas_pci_ops;
+
+	pci_process_bridge_OF_ranges(hose, pcictrl, 0);
+}
+
+#else
+void __init efika_pcisetup(void)
+{}
+#endif
--- a/arch/powerpc/platforms/efika/efika.h	1970-01-01 01:00:00.000000000 +0100
+++ b/arch/powerpc/platforms/efika/efika.h	2006-11-02 17:54:37.000000000 +0100
@@ -0,0 +1,19 @@
+/*
+ * Efika 5K2 platform setup - Header file
+ *
+ * Copyright (C) 2006 bplan GmbH
+ *
+ * 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 __ARCH_POWERPC_EFIKA__
+#define __ARCH_POWERPC_EFIKA__
+
+#define EFIKA_PLATFORM_NAME "Efika"
+
+extern void __init efika_pcisetup(void);
+
+#endif
--- a/arch/powerpc/platforms/efika/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ b/arch/powerpc/platforms/efika/Makefile	2006-11-02 17:55:29.000000000 +0100
@@ -0,0 +1 @@
+obj-y += setup.o pci.o
--- a/arch/powerpc/platforms/Makefile	2006-11-01 09:18:43.000000000 +0100
+++ b/arch/powerpc/platforms/Makefile	2006-11-02 17:54:37.000000000 +0100
@@ -6,6 +6,7 @@ obj-$(CONFIG_PPC_PMAC)		+= powermac/
 endif
 endif
 obj-$(CONFIG_PPC_CHRP)		+= chrp/
+obj-$(CONFIG_PPC_EFIKA)          += efika/
 obj-$(CONFIG_4xx)		+= 4xx/
 obj-$(CONFIG_PPC_83xx)		+= 83xx/
 obj-$(CONFIG_PPC_85xx)		+= 85xx/
--- a/arch/powerpc/boot/Makefile	2006-11-01 09:18:42.000000000 +0100
+++ b/arch/powerpc/boot/Makefile	2006-10-31 12:31:55.000000000 +0100
@@ -115,7 +115,7 @@ endif
 quiet_cmd_wrap	= WRAP    $@
       cmd_wrap	=$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) vmlinux
 quiet_cmd_wrap_initrd = WRAP    $@
-      cmd_wrap_initrd =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
+      cmd_wrap_initrd =$(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
 				-i $(obj)/ramdisk.image.gz vmlinux
 
 $(obj)/zImage.chrp: vmlinux $(wrapperbits)
@@ -155,6 +155,7 @@ image-$(CONFIG_PPC_PSERIES)		+= zImage.p
 image-$(CONFIG_PPC_MAPLE)		+= zImage.pseries
 image-$(CONFIG_PPC_IBM_CELL_BLADE)	+= zImage.pseries
 image-$(CONFIG_PPC_CHRP)		+= zImage.chrp
+image-$(CONFIG_PPC_EFIKA)		+= zImage.chrp
 image-$(CONFIG_PPC_PMAC)		+= zImage.pmac
 image-$(CONFIG_DEFAULT_UIMAGE)		+= uImage
 
--- a/arch/powerpc/Kconfig	2006-11-01 09:18:42.000000000 +0100
+++ b/arch/powerpc/Kconfig	2006-11-02 17:55:20.000000000 +0100
@@ -386,6 +386,14 @@ config PPC_CHRP
 	select PPC_UDBG_16550
 	default y
 
+config PPC_EFIKA
+	bool "bPlan Efika 5k2. MPC5200B based computer"
+	depends on PPC_MULTIPLATFORM && PPC32
+	select PPC_RTAS
+	select RTAS_PROC
+	select PPC_MPC52xx
+	default y
+
 config PPC_PMAC
 	bool "Apple PowerMac based machines"
 	depends on PPC_MULTIPLATFORM

[-- Attachment #3: nd.vcf --]
[-- Type: text/x-vcard, Size: 249 bytes --]

begin:vcard
fn:Nicolas DET ( bplan GmbH )
n:DET;Nicolas
org:bplan GmbH
adr:;;;;;;Germany
email;internet:nd@bplan-gmbh.de
title:Software Entwicklung
tel;work:+49 6171 9187 - 31
x-mozilla-html:FALSE
url:http://www.bplan-gmbh.de
version:2.1
end:vcard


^ permalink raw reply

* Re: [PATCH/RFC] powerpc: Add of_platform support for OHCI/Bigendian HC
From: Nicolas DET @ 2006-11-02 20:49 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, sl, linuxppc-embedded
In-Reply-To: <1162423628.25682.489.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

Benjamin Herrenschmidt wrote:
> On Thu, 2006-11-02 at 09:23 +1100, Benjamin Herrenschmidt wrote:
> 
> And in english here too....
> 
>> On Wed, 2006-11-01 at 21:31 +0100, Nicolas DET wrote:
>>
>>> +/**+	ohci = hcd_to_ohci(hcd);
>>> +	ohci->flags |= OHCI_BIG_ENDIAN;
>>> +	ohci_hcd_init(ohci);
>> Bon, c'est pas mal. Le seul truc ici, c'est que je prefererais que
>> big-endian ne soit pas hard-code comme ca mais depende du device-tree.
>> Ce code doit pouvoir etre re-utilise pour des implementations
>> little-endian.
> 
> Ok, so it looks good. The only thing here is that I would prefer if the
> big-endian setting wasn't hard-coded, but set based on the device-tree,
> so that this code can be re-used for little-endian implementations.
> 
>>> +	retval = usb_add_hcd(hcd, irq, IRQF_DISABLED);
>>> +	if (retval == 0)
>>> +		return retval;
>> Pourquoi IRQF_DISABLED ?
> 
> Why IRQF_DISABLED ?
> 

It's like this in ofsoc-ppc. As I am not sure what it does exactly I 
left it like this. This module performs well here so far.



[-- Attachment #2: archpowerpc_ohciof.patch --]
[-- Type: text/plain, Size: 8655 bytes --]

--- a/drivers/usb/host/ohci-ppc-of.c	1970-01-01 01:00:00.000000000 +0100
+++ b/drivers/usb/host/ohci-ppc-of.c	2006-11-02 18:06:02.000000000 +0100
@@ -0,0 +1,322 @@
+/*
+ * OHCI HCD (Host Controller Driver) for USB.
+ *
+ * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
+ * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
+ * (C) Copyright 2002 Hewlett-Packard Company
+ * (C) Copyright 2003-2005 MontaVista Software Inc.
+ * 
+ * Probe and init OHCI Big endian HC from OpenFirmware device tree
+ * Tested on Efika 5k2
+ *
+ * Modified by Dale Farnsworth <dale@farnsworth.org> from ohci-sa1111.c
+ *
+ * This file is licenced under the GPL.
+ */
+
+#include <linux/signal.h>
+
+#include <asm/of_device.h>
+#include <asm/prom.h>
+
+/* configure so an HC device and id are always provided */
+/* always called with process context; sleeping is OK */
+
+/*
+ * usb_hcd_ppc_of_probe - initialize On-Chip HCDs
+ * Context: !in_interrupt()
+ *
+ * Allocates basic resources for this USB host controller.
+ *
+ * Store this function in the HCD's struct pci_driver as probe().
+ */
+static int usb_hcd_ppc_of_probe(const struct hc_driver *driver,
+			  struct of_device *dev, int is_bigendian)
+{
+	int retval;
+	struct usb_hcd *hcd;
+	struct ohci_hcd	*ohci;
+	struct resource res;
+	int irq;
+	int ret;
+
+	pr_debug("initializing PPC-OF USB Controller\n");
+
+	if ((ret = of_address_to_resource(dev->node, 0, &res)) != 0)
+		return ret;
+
+	hcd = usb_create_hcd(driver, &dev->dev, "PPC-OF USB");
+	if (!hcd)
+		return -ENOMEM;
+	hcd->rsrc_start = res.start;
+	hcd->rsrc_len = res.end - res.start + 1;
+
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
+		pr_debug(__FILE__ ": request_mem_region failed\n");
+		retval = -EBUSY;
+		goto err1;
+	}
+
+	irq = irq_of_parse_and_map(dev->node, 0);
+	if (irq == NO_IRQ) {
+		retval = -EBUSY;
+		goto err2;
+	}
+
+	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {
+		pr_debug(__FILE__ ": ioremap failed\n");
+		retval = -ENOMEM;
+		goto err2;
+	}
+
+	ohci = hcd_to_ohci(hcd);
+	if (is_bigendian)
+		ohci->flags |= OHCI_BIG_ENDIAN;
+	ohci_hcd_init(ohci);
+
+	retval = usb_add_hcd(hcd, irq, IRQF_DISABLED);
+	if (retval == 0)
+		return retval;
+
+	pr_debug("Removing PPC-OF USB Controller\n");
+
+	iounmap(hcd->regs);
+ err2:
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+ err1:
+ 	usb_put_hcd(hcd);
+	return retval;
+}
+
+
+/* may be called without controller electrically present */
+/* may be called with controller, bus, and devices active */
+
+/*
+ * usb_hcd_ppc_of_remove - shutdown processing for On-Chip HCDs
+ * @pdev: USB Host Controller being removed
+ * Context: !in_interrupt()
+ *
+ * Reverses the effect of usb_hcd_ppc_of_probe().
+ * It is always called from a thread
+ * context, normally "rmmod", "apmd", or something similar.
+ *
+ */
+static void usb_hcd_ppc_of_remove(struct usb_hcd *hcd,
+		struct of_device *op)
+{
+	usb_remove_hcd(hcd);
+
+	pr_debug("stopping PPC-OF USB Controller\n");
+
+	iounmap(hcd->regs);
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+	usb_put_hcd(hcd);
+}
+
+static int __devinit
+ohci_ppc_of_start(struct usb_hcd *hcd)
+{
+	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
+	int		ret;
+
+	if ((ret = ohci_init(ohci)) < 0)
+		return ret;
+
+	if ((ret = ohci_run(ohci)) < 0) {
+		err("can't start %s", ohci_to_hcd(ohci)->self.bus_name);
+		ohci_stop(hcd);
+		return ret;
+	}
+
+	return 0;
+}
+
+static const struct hc_driver ohci_ppc_of_hc_driver = {
+	.description =		hcd_name,
+	.hcd_priv_size =	sizeof(struct ohci_hcd),
+
+	/*
+	 * generic hardware linkage
+	 */
+	.irq =			ohci_irq,
+	.flags =		HCD_USB11 | HCD_MEMORY,
+
+	/*
+	 * basic lifecycle operations
+	 */
+	.start =		ohci_ppc_of_start,
+	.stop =			ohci_stop,
+	.shutdown = 		ohci_shutdown,
+
+	/*
+	 * managing i/o requests and associated device resources
+	 */
+	.urb_enqueue =		ohci_urb_enqueue,
+	.urb_dequeue =		ohci_urb_dequeue,
+	.endpoint_disable =	ohci_endpoint_disable,
+
+	/*
+	 * scheduling support
+	 */
+	.get_frame_number =	ohci_get_frame,
+
+	/*
+	 * root hub support
+	 */
+	.hub_status_data =	ohci_hub_status_data,
+	.hub_control =		ohci_hub_control,
+	.hub_irq_enable =	ohci_rhsc_enable,
+#ifdef	CONFIG_PM
+	.bus_suspend =		ohci_bus_suspend,
+	.bus_resume =		ohci_bus_resume,
+#endif
+	.start_port_reset =	ohci_start_port_reset,
+};
+
+
+
+static int ohci_hcd_ppc_of_drv_remove(struct of_device *op)
+{
+	struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
+	dev_set_drvdata(&op->dev, NULL);
+
+	usb_hcd_ppc_of_remove(hcd, op);
+	return 0;
+}
+
+static int ohci_hcd_ppc_of_drv_shutdown(struct of_device *op)
+{
+	struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
+
+        if (hcd->driver->shutdown)
+                hcd->driver->shutdown(hcd);
+
+	return 0;
+}
+
+/*
+ *
+*/
+
+static struct of_device_id ohci_hcd_ppc_of_match_be[] = {
+	{
+		.name = "usb",
+		.compatible = "ohci-bigendian",
+	},
+	{
+		.name = "usb",
+		.compatible = "ohci-be",
+	},
+	{},
+};
+
+static int __devinit
+ohci_hcd_ppc_of_drv_probe_be(struct of_device *op, const struct of_device_id *match)
+{
+	int ret;
+
+	if (usb_disabled())
+		return -ENODEV;
+
+	ret = usb_hcd_ppc_of_probe(&ohci_ppc_of_hc_driver, op, 1);
+	return ret;
+}
+
+static struct of_platform_driver ohci_hcd_ppc_of_driver_be = {
+	.name	= "ppc-of-ohci-be",
+	.match_table	= ohci_hcd_ppc_of_match_be,
+	.probe		= ohci_hcd_ppc_of_drv_probe_be,
+	.remove		= ohci_hcd_ppc_of_drv_remove,
+	.shutdown 	= ohci_hcd_ppc_of_drv_shutdown,
+#ifdef	CONFIG_PM
+	/*.suspend	= ohci_hcd_ppc_soc_drv_suspend,*/
+	/*.resume	= ohci_hcd_ppc_soc_drv_resume,*/
+#endif
+	.driver		= {
+		.name	= "ppc-of-ohci-be",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init ohci_hcd_ppc_of_init_be(void)
+{
+	pr_debug(DRIVER_INFO " (PPC OF)\n");
+	pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed),
+							sizeof(struct td));
+	
+	return of_register_driver(&ohci_hcd_ppc_of_driver_be);    
+}
+
+static void __exit ohci_hcd_ppc_of_cleanup_be(void)
+{
+	of_unregister_driver(&ohci_hcd_ppc_of_driver_be);
+}
+
+module_init(ohci_hcd_ppc_of_init_be);
+module_exit(ohci_hcd_ppc_of_cleanup_be);
+
+/*
+ *
+*/
+
+static struct of_device_id ohci_hcd_ppc_of_match_le[] = {
+	{
+		.name = "usb",
+		.compatible = "ohci-littledian",
+	},
+	{
+		.name = "usb",
+		.compatible = "ohci-le",
+	},
+	{},
+};
+
+static int __devinit
+ohci_hcd_ppc_of_drv_probe_le(struct of_device *op, const struct of_device_id *match)
+{
+	int ret;
+
+	if (usb_disabled())
+		return -ENODEV;
+
+	ret = usb_hcd_ppc_of_probe(&ohci_ppc_of_hc_driver, op, 0);
+	return ret;
+}
+
+
+static struct of_platform_driver ohci_hcd_ppc_of_driver_le = {
+	.name	= "ppc-of-ohci-le",
+	.match_table	= ohci_hcd_ppc_of_match_le,
+	.probe		= ohci_hcd_ppc_of_drv_probe_le,
+	.remove		= ohci_hcd_ppc_of_drv_remove,
+	.shutdown 	= ohci_hcd_ppc_of_drv_shutdown,
+#ifdef	CONFIG_PM
+	/*.suspend	= ohci_hcd_ppc_soc_drv_suspend,*/
+	/*.resume	= ohci_hcd_ppc_soc_drv_resume,*/
+#endif
+	.driver		= {
+		.name	= "ppc-of-ohci-le",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init ohci_hcd_ppc_of_init_le(void)
+{
+	pr_debug(DRIVER_INFO " (PPC OF)\n");
+	pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed),
+							sizeof(struct td));
+	
+	return of_register_driver(&ohci_hcd_ppc_of_driver_le);    
+}
+
+static void __exit ohci_hcd_ppc_of_cleanup_le(void)
+{
+	of_unregister_driver(&ohci_hcd_ppc_of_driver_le);
+}
+
+
+module_init(ohci_hcd_ppc_of_init_le);
+module_exit(ohci_hcd_ppc_of_cleanup_le);
+
--- a/drivers/usb/host/Kconfig	2006-11-01 09:18:56.000000000 +0100
+++ b/drivers/usb/host/Kconfig	2006-11-02 17:54:37.000000000 +0100
@@ -106,6 +106,15 @@ config USB_OHCI_HCD_PPC_SOC
 	  Enables support for the USB controller on the MPC52xx or
 	  STB03xxx processor chip.  If unsure, say Y.
 
+config USB_OHCI_HCD_PPC_OF
+	bool "OHCI support for PPC USB controller for OpenFirmware platform"
+	depends on USB_OHCI_HCD && PPC_OF
+	default y
+	select USB_OHCI_BIG_ENDIAN
+	select USB_OHCI_LITTLE_ENDIAN
+	---help---
+	  Enables support for the USB controller PowerPC OpenFirmware platform
+
 config USB_OHCI_HCD_PCI
 	bool "OHCI support for PCI-bus USB controllers"
 	depends on USB_OHCI_HCD && PCI && (STB03xxx || PPC_MPC52xx)
--- a/drivers/usb/host/ohci-hcd.c	2006-11-01 09:18:56.000000000 +0100
+++ b/drivers/usb/host/ohci-hcd.c	2006-11-02 18:06:02.000000000 +0100
@@ -930,6 +930,12 @@ MODULE_LICENSE ("GPL");
 #include "ohci-ppc-soc.c"
 #endif
 
+#ifdef CONFIG_USB_OHCI_HCD_PPC_OF
+#include "ohci-ppc-of.c"
+#endif
+
+
+
 #if defined(CONFIG_ARCH_AT91RM9200) || defined(CONFIG_ARCH_AT91SAM9261)
 #include "ohci-at91.c"
 #endif

[-- Attachment #3: nd.vcf --]
[-- Type: text/x-vcard, Size: 249 bytes --]

begin:vcard
fn:Nicolas DET ( bplan GmbH )
n:DET;Nicolas
org:bplan GmbH
adr:;;;;;;Germany
email;internet:nd@bplan-gmbh.de
title:Software Entwicklung
tel;work:+49 6171 9187 - 31
x-mozilla-html:FALSE
url:http://www.bplan-gmbh.de
version:2.1
end:vcard


^ permalink raw reply

* Re: [patch 08/16] powerpc: remove EMBEDDED6xx Kconfig entry
From: Stephen Winiecki @ 2006-11-02 20:49 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: linuxppc-dev
In-Reply-To: <20061102160009.GC4928@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 2049 bytes --]






Sascha Hauer <s.hauer@pengutronix.de> wrote on 11/02/2006 11:00:09 AM:

> On Thu, Nov 02, 2006 at 10:32:53AM -0500, Stephen Winiecki wrote:
> >
> >    I also have a question about 750xx platforms.  I currently am
looking at
> >    adding platform code supporting IBM 750GX/CL eval boards.  Where
would
> >    they go - as well as others like Buckeye/Chestnut if/when they move
over
> >    to /powerpc?
>
> I don't know - Lets wait for ben and others what they say about this
> approach.
> My intention with this patch is to try and motivate people to
> integrate their machines as a part of the multiplatform support, because
> it doesn't cost a thing.
> The presence of the embedded6xx entry and the entries in the directory
> itself makes people think (me too) that the multiplatform thing is only
> for the big irons. I think it's better to unify the two ways of platform
> support where it's possible.
>
What exactly is the intent of PPC_MULTIPLATFORM - the current desc states
"Generic desktop/server/laptop" - which doesn't exactly scream 'embedded'
to me either.  I guess I saw embedded6xx as a 'catch-all' for everything
else.

I might be missing something - but when you removed EMBEDDED6xx from
powerpc/Kconfig in patch 8, and removed MPC7448HPC2 from
embedded6xx/Kconfig in patch 6 - where did you move the MPC7448HPC2 config
section to?  Is your thought that it will depend on PPC_MULTIPLATFORM now
as well?

This may be slightly off topic - but one other thing I have noticed that
the new boot wrapper script supports specific 'types' of zImage files
associated w/ 'MUTIPLATFORMS' (PSERIES, CHRP, PREP etc.) and uImage - which
is what I think the majority of 'embedded' platforms will use by defining
CONFIG_DEFAULT_UIMAGE.  For IBM boards with PIBS just 'normal' zImage ELF
files get loaded - I'm not sure if there should be another type
defined/supported for boards which don't fit necessarily into a
PSERIES/CHRP/PREP definition and also don't use uboot -
CONFIG_DEFAULT_ZIMAGE?


[-- Attachment #2: Type: text/html, Size: 2354 bytes --]

^ permalink raw reply

* Re: [PATCH/RFC] powerpc: Add MPC5200 Interrupt Controller support.
From: Nicolas DET @ 2006-11-02 20:47 UTC (permalink / raw)
  To: Nicolas DET; +Cc: Sylvain Munaut, sl, linuxppc-embedded, linuxppc-dev
In-Reply-To: <454A1C37.5050208@bplan-gmbh.de>

[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]

Nicolas DET wrote:
> Benjamin Herrenschmidt wrote:
> 
>> Now, in addition to that, we have another issue I haven't spotted
>> before, but it might be worth considering:
>>
>> Do we actually want the sdma interrupts handled there ? Because if you
>> look closely, the SDMA is basically a cascaded interrupt controller. It
>> hangs of per interrupt 0 :)
> 
> I know. I already spot this point (IRQ as far as I remenber and in 
> private mails) and I got no answer so I assumed it was ok like I did. 
> It's also really simplier and easier to add SDMA has another irq_chip.
> Keep is simple ;-)
> 
>> Thus we could simply remove the code for it from that driver and
>> implement it as as separate controller with a separate interrupt domain.
>> I know you won't like that idea because it means having a different
>> interrupt tree but it's worth having the discussion.
>>
> 
> The device tree won't change anyway...
> 
> I'll submit a new buch of patches pretty soon. Maybe the final version.
> 
> "On y est presque !" ;-)
> 

I attached the new Interrupt Controller patch. I have been very busy 
today. I hope I did not overlook anything.

RFC


[-- Attachment #2: archpowerpc_mpc52x.patch --]
[-- Type: text/plain, Size: 23958 bytes --]

--- a/arch/powerpc/sysdev/mpc52xx_pic.c	1970-01-01 01:00:00.000000000 +0100
+++ b/arch/powerpc/sysdev/mpc52xx_pic.c	2006-11-02 17:56:10.000000000 +0100
@@ -0,0 +1,515 @@
+/*
+ *
+ * Programmable Interrupt Controller functions for the Freescale MPC52xx.
+ *
+ * Based on (well, mostly copied from) the code from the 2.4 kernel by
+ * Dale Farnsworth <dfarnsworth@mvista.com> and Kent Borg.
+ * 
+ * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2003 Montavista Software, Inc
+ *
+ * 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.
+ *
+ */
+
+#undef DEBUG
+
+#include <linux/stddef.h>
+#include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/stddef.h>
+#include <linux/delay.h>
+#include <linux/irq.h>
+#include <linux/hardirq.h>
+
+#include <asm/io.h>
+#include <asm/processor.h>
+#include <asm/system.h>
+#include <asm/irq.h>
+#include <asm/prom.h>
+#include <asm/mpc52xx.h>
+
+/*
+ *
+*/
+
+static struct mpc52xx_intr __iomem *intr;
+static struct mpc52xx_sdma __iomem *sdma;
+static struct irq_host *mpc52xx_irqhost = NULL;
+
+static unsigned char mpc52xx_map_senses[4] = {
+	IRQ_TYPE_LEVEL_HIGH,
+	IRQ_TYPE_EDGE_FALLING,
+	IRQ_TYPE_EDGE_RISING,
+	IRQ_TYPE_LEVEL_LOW,
+};
+
+/*
+ *
+*/
+
+static inline void io_be_setbit(u32 __iomem *addr, int bitno)
+{
+	out_be32(addr, in_be32(addr) | (1 << bitno) );
+}
+
+static inline void io_be_clrbit(u32 __iomem *addr, int bitno)
+{
+	out_be32(addr, in_be32(addr) & ~(1 << bitno));
+}
+
+static inline struct device_node *find_mpc52xx_picnode(void)
+{
+	return of_find_compatible_node(NULL, "interrupt-controller",
+				       "mpc5200-pic");
+}
+
+static inline struct device_node *find_mpc52xx_sdmanode(void)
+{
+	return of_find_compatible_node(NULL, "dma-controller",
+				       "mpc5200-bestcomm");
+}
+
+/*
+ * IRQ[0-3] interrupt irq_chip
+*/
+
+static void mpc52xx_extirq_mask(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	io_be_clrbit(&intr->ctrl, 11 - l2irq);
+}
+
+static void mpc52xx_extirq_unmask(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	io_be_setbit(&intr->ctrl, 11 - l2irq);
+}
+
+static void mpc52xx_extirq_ack(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	io_be_setbit(&intr->ctrl, 27-l2irq);
+}
+
+static struct irq_chip mpc52xx_extirq_irqchip = {
+	.typename = " MPC52xx IRQ[0-3] ",
+	.mask = mpc52xx_extirq_mask,
+	.unmask = mpc52xx_extirq_unmask,
+	.ack = mpc52xx_extirq_ack,
+};
+
+/*
+ * Main interrupt irq_chip
+*/
+
+static void mpc52xx_main_mask(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	io_be_setbit(&intr->main_mask, 15 - l2irq);
+}
+
+static void mpc52xx_main_unmask(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	io_be_clrbit(&intr->main_mask, 15 - l2irq);
+}
+
+static struct irq_chip mpc52xx_main_irqchip = {
+	.typename = "MPC52xx Main",
+	.mask = mpc52xx_main_mask,
+	.mask_ack = mpc52xx_main_mask,
+	.unmask = mpc52xx_main_unmask,
+};
+
+/*
+ * Peripherals interrupt irq_chip
+*/
+
+static void mpc52xx_periph_mask(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	io_be_setbit(&intr->per_mask, 31 - l2irq);
+}
+
+static void mpc52xx_periph_unmask(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	io_be_clrbit(&intr->per_mask, 31 - l2irq);
+}
+
+static struct irq_chip mpc52xx_periph_irqchip = {
+	.typename = "MPC52xx Peripherals",
+	.mask = mpc52xx_periph_mask,
+	.mask_ack = mpc52xx_periph_mask,
+	.unmask = mpc52xx_periph_unmask,
+};
+
+/*
+ * SDMA interrupt irq_chip
+*/
+
+static void mpc52xx_sdma_mask(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	io_be_setbit(&sdma->IntMask, l2irq);
+}
+
+static void mpc52xx_sdma_unmask(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	io_be_clrbit(&sdma->IntMask, l2irq);
+}
+
+static void mpc52xx_sdma_ack(unsigned int virq)
+{
+	int irq;
+	int l2irq;
+
+	irq = irq_map[virq].hwirq;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	pr_debug("%s: irq=%x. l2=%d\n", __func__, irq, l2irq);
+
+	out_be32(&sdma->IntPend, 1 << l2irq);
+}
+
+static struct irq_chip mpc52xx_sdma_irqchip = {
+	.typename = "MPC52xx SDMA",
+	.mask = mpc52xx_sdma_mask,
+	.unmask = mpc52xx_sdma_unmask,
+	.ack = mpc52xx_sdma_ack,
+};
+
+/*
+ * irq_host
+*/
+
+static int mpc52xx_irqhost_match(struct irq_host *h, struct device_node *node)
+{
+	pr_debug("%s: %p vs %p\n", __func__, find_mpc52xx_picnode(), node);
+	return mpc52xx_irqhost->host_data == node;
+}
+
+static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
+				 u32 * intspec, unsigned int intsize,
+				 irq_hw_number_t * out_hwirq,
+				 unsigned int *out_flags)
+{
+	int intrvect_l1;
+	int intrvect_l2;
+	int intrvect_type;
+	int intrvect_linux;
+
+	if (intsize != 3)
+		return -1;
+
+	intrvect_l1 = (int)intspec[0];
+	intrvect_l2 = (int)intspec[1];
+	intrvect_type = (int)intspec[2];
+
+	intrvect_linux =
+	    (intrvect_l1 << MPC52xx_IRQ_L1_OFFSET) & MPC52xx_IRQ_L1_MASK;
+	intrvect_linux |=
+	    (intrvect_l2 << MPC52xx_IRQ_L2_OFFSET) & MPC52xx_IRQ_L2_MASK;
+
+	pr_debug("return %x, l1=%d, l2=%d\n", intrvect_linux, intrvect_l1,
+		 intrvect_l2);
+
+	*out_hwirq = intrvect_linux;
+	*out_flags = mpc52xx_map_senses[intrvect_type];
+
+	return 0;
+}
+
+/*
+ * this function retrieves the correct IRQ type out
+ * of the MPC regs
+ * Only externals IRQs needs this
+*/
+static int mpc52xx_irqx_gettype(int irq)
+{
+	int type;
+	u32 ctrl_reg;
+
+	ctrl_reg = in_be32(&intr->ctrl);
+	type = (ctrl_reg >> (22 - irq * 2)) & 0x3;
+
+	return mpc52xx_map_senses[type];
+}
+
+static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq,
+			       irq_hw_number_t irq)
+{
+	int l1irq;
+	int l2irq;
+	struct irq_chip *good_irqchip;
+	void *good_handle;
+	int type;
+
+	l1irq = (irq & MPC52xx_IRQ_L1_MASK) >> MPC52xx_IRQ_L1_OFFSET;
+	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+	/*
+	 * Most of ours IRQs will be level low
+	 * Only external IRQs on some platform may be others
+	 */
+	type = IRQ_TYPE_LEVEL_LOW;
+
+	switch (l1irq) {
+	case MPC52xx_IRQ_L1_CRIT:
+		pr_debug("%s: Critical. l2=%x\n", __func__, l2irq);
+
+		BUG_ON(l2irq != 0);
+
+		type = mpc52xx_irqx_gettype(l2irq);
+		good_irqchip = &mpc52xx_extirq_irqchip;
+		break;
+
+	case MPC52xx_IRQ_L1_MAIN:
+		pr_debug("%s: Main IRQ[1-3] l2=%x\n", __func__, l2irq);
+
+		if ((l2irq >= 1) && (l2irq <= 3)) {
+			type = mpc52xx_irqx_gettype(l2irq);
+			good_irqchip = &mpc52xx_extirq_irqchip;
+		} else {
+			good_irqchip = &mpc52xx_main_irqchip;
+		}
+		break;
+
+	case MPC52xx_IRQ_L1_PERP:
+		pr_debug("%s: Peripherals. l2=%x\n", __func__, l2irq);
+		good_irqchip = &mpc52xx_periph_irqchip;
+		break;
+
+	case MPC52xx_IRQ_L1_SDMA:
+		pr_debug("%s: SDMA. l2=%x\n", __func__, l2irq);
+		good_irqchip = &mpc52xx_sdma_irqchip;
+		break;
+
+	default:
+		pr_debug("%s: Error, unknown L1 IRQ (0x%x)\n", __func__, l1irq);
+		printk(KERN_ERR "Unknow IRQ!\n");
+		return -EINVAL;
+	}
+
+	switch (type) {
+	case IRQ_TYPE_EDGE_FALLING:
+	case IRQ_TYPE_EDGE_RISING:
+		good_handle = handle_edge_irq;
+		break;
+	default:
+		good_handle = handle_level_irq;
+	}
+
+	set_irq_chip_and_handler(virq, good_irqchip, good_handle);
+
+	pr_debug("%s: virq=%x, hw=%x. type=%x\n", __func__, virq,
+		 (int)irq, type);
+
+	return 0;
+}
+
+static struct irq_host_ops mpc52xx_irqhost_ops = {
+	.match = mpc52xx_irqhost_match,
+	.xlate = mpc52xx_irqhost_xlate,
+	.map = mpc52xx_irqhost_map,
+};
+
+/*
+ * init (public)
+*/
+
+void __init mpc52xx_init_irq(void)
+{
+	struct device_node *picnode;
+	int picnode_regsize;
+	u32 picnode_regoffset;
+
+	struct device_node *sdmanode;
+	int sdmanode_regsize;
+	u32 sdmanode_regoffset;
+
+	u64 size64;
+	int flags;
+
+	u32 intr_ctrl;
+
+	picnode = find_mpc52xx_picnode();
+	sdmanode = find_mpc52xx_sdmanode();
+
+	if ( (picnode == NULL) || (sdmanode == NULL) )
+		return;
+
+	/* Retrieve PIC ressources */
+	picnode_regoffset = (u32) of_get_address(picnode, 0, &size64, &flags);
+	if (picnode_regoffset == 0)
+		return ;
+
+	picnode_regoffset = of_translate_address(picnode, (u32 *) picnode_regoffset);
+	picnode_regsize = (int)size64;	
+
+	/* Retrieve SDMA ressources */
+	sdmanode_regoffset = (u32) of_get_address(sdmanode, 0, &size64, &flags);
+	if (sdmanode_regoffset == 0)
+		return ;
+
+	sdmanode_regoffset = of_translate_address(sdmanode, (u32 *) sdmanode_regoffset);
+	sdmanode_regsize = (int)size64;
+
+	/* Remap the necessary zones */
+	intr = ioremap(picnode_regoffset, picnode_regsize);
+	sdma = ioremap(sdmanode_regoffset, sdmanode_regsize);
+
+	if ((intr == NULL) || (sdma == NULL))
+		panic("Can't ioremap PIC/SDMA register or init_irq !");
+
+	printk(KERN_INFO "Remapped MPC52xx PIC at 0x%8.8x\n", picnode_regoffset);
+	printk(KERN_INFO "Remapped MPC52xx SDMA at 0x%8.8x\n", sdmanode_regoffset);
+
+	of_node_put(picnode);
+	of_node_put(sdmanode);
+
+	/* Disable all interrupt sources. */
+	out_be32(&sdma->IntPend, 0xffffffff);	/* 1 means clear pending */
+	out_be32(&sdma->IntMask, 0xffffffff);	/* 1 means disabled */
+	out_be32(&intr->per_mask, 0x7ffffc00);	/* 1 means disabled */
+	out_be32(&intr->main_mask, 0x00010fff);	/* 1 means disabled */
+	intr_ctrl = in_be32(&intr->ctrl);
+	intr_ctrl &= 0x00ff0000;	/* Keeps IRQ[0-3] config */
+	intr_ctrl |= 0x0f000000 |	/* clear IRQ 0-3 */
+	    0x00001000 |	/* MEE master external enable */
+	    0x00000000 |	/* 0 means disable IRQ 0-3 */
+	    0x00000001;		/* CEb route critical normally */
+	out_be32(&intr->ctrl, intr_ctrl);
+
+	/* Zero a bunch of the priority settings.  */
+	out_be32(&intr->per_pri1, 0);
+	out_be32(&intr->per_pri2, 0);
+	out_be32(&intr->per_pri3, 0);
+	out_be32(&intr->main_pri1, 0);
+	out_be32(&intr->main_pri2, 0);
+
+	/*
+	 * As last step, add an irq host to translate the real
+	 * hw irq information provided by the ofw to linux virq
+	 */
+
+	mpc52xx_irqhost =
+	    irq_alloc_host(IRQ_HOST_MAP_LINEAR, MPC52xx_IRQ_HIGHTESTVIRQ,
+			   &mpc52xx_irqhost_ops, -1);
+
+	if (mpc52xx_irqhost)
+		mpc52xx_irqhost->host_data = picnode;
+}
+
+/*
+ * get_irq (public)
+*/
+unsigned int mpc52xx_get_irq(void)
+{
+	u32 status;
+	int irq = NO_IRQ_IGNORE;
+
+	status = in_be32(&intr->enc_status);
+	if (status & 0x00000400) {	/* critical */
+		irq = (status >> 8) & 0x3;
+		if (irq == 2)	/* high priority peripheral */
+			goto peripheral;
+		irq |=
+		    (MPC52xx_IRQ_L1_CRIT << MPC52xx_IRQ_L1_OFFSET) &
+		    MPC52xx_IRQ_L1_MASK;
+	} else if (status & 0x00200000) {	/* main */
+		irq = (status >> 16) & 0x1f;
+		if (irq == 4)	/* low priority peripheral */
+			goto peripheral;
+		irq |=
+		    (MPC52xx_IRQ_L1_MAIN << MPC52xx_IRQ_L1_OFFSET) &
+		    MPC52xx_IRQ_L1_MASK;
+	} else if (status & 0x20000000) {	/* peripheral */
+	      peripheral:
+		irq = (status >> 24) & 0x1f;
+		if (irq == 0) {	/* bestcomm */
+			status = in_be32(&sdma->IntPend);
+			irq = ffs(status) - 1;
+			irq |=
+			    (MPC52xx_IRQ_L1_SDMA << MPC52xx_IRQ_L1_OFFSET) &
+			    MPC52xx_IRQ_L1_MASK;
+		} else
+			irq |=
+			    (MPC52xx_IRQ_L1_PERP << MPC52xx_IRQ_L1_OFFSET) &
+			    MPC52xx_IRQ_L1_MASK;
+
+	}
+
+	pr_debug("%s: irq=%x. virq=%d\n", __func__, irq,
+		 irq_linear_revmap(mpc52xx_irqhost, irq));
+
+	return irq_linear_revmap(mpc52xx_irqhost, irq);
+}
--- a/arch/powerpc/sysdev/Makefile	2006-11-01 09:18:43.000000000 +0100
+++ b/arch/powerpc/sysdev/Makefile	2006-10-31 19:56:41.000000000 +0100
@@ -13,6 +13,7 @@ obj-$(CONFIG_FSL_SOC)		+= fsl_soc.o
 obj-$(CONFIG_PPC_TODC)		+= todc.o
 obj-$(CONFIG_TSI108_BRIDGE)	+= tsi108_pci.o tsi108_dev.o
 obj-$(CONFIG_QUICC_ENGINE)	+= qe_lib/
+obj-$(CONFIG_PPC_MPC52xx_PIC)	+= mpc52xx_pic.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
 obj-$(CONFIG_PPC_I8259)		+= i8259.o
--- a/include/asm-powerpc/mpc52xx.h	1970-01-01 01:00:00.000000000 +0100
+++ b/include/asm-powerpc/mpc52xx.h	2006-11-02 17:54:37.000000000 +0100
@@ -0,0 +1,319 @@
+/*
+ * 
+ * Prototypes, etc. for the Freescale MPC52xx embedded cpu chips
+ * May need to be cleaned as the port goes on ...
+ *
+ * Copyright (C) 2004-2005 Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2003 MontaVista, Software, Inc.
+ *
+ * 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 __ASM_POWERPC_MPC52xx_H__
+#define __ASM_POWERPC_MPC52xx_H__
+
+#ifndef __ASSEMBLY__
+#include <asm/types.h>
+#include <asm/prom.h>
+
+#endif				/* __ASSEMBLY__ */
+
+/* ======================================================================== */
+/* Main registers/struct addresses                                          */
+/* ======================================================================== */
+
+/* Registers zone offset/size  */
+#define MPC52xx_MMAP_CTL_OFFSET		0x0000
+#define MPC52xx_MMAP_CTL_SIZE		0x068
+#define MPC52xx_SDRAM_OFFSET		0x0100
+#define MPC52xx_SDRAM_SIZE		0x010
+#define MPC52xx_CDM_OFFSET		0x0200
+#define MPC52xx_CDM_SIZE		0x038
+#define MPC52xx_INTR_OFFSET		0x0500
+#define MPC52xx_INTR_SIZE		0x04c
+#define MPC52xx_GPTx_OFFSET(x)		(0x0600 + ((x)<<4))
+#define MPC52xx_GPT_SIZE		0x010
+#define MPC52xx_RTC_OFFSET		0x0800
+#define MPC52xx_RTC_SIZE		0x024
+#define MPC52xx_GPIO_OFFSET		0x0b00
+#define MPC52xx_GPIO_SIZE		0x040
+#define MPC52xx_GPIO_WKUP_OFFSET	0x0c00
+#define MPC52xx_GPIO_WKUP_SIZE		0x028
+#define MPC52xx_PCI_OFFSET		0x0d00
+#define MPC52xx_PCI_SIZE		0x100
+#define MPC52xx_SDMA_OFFSET		0x1200
+#define MPC52xx_SDMA_SIZE		0x100
+#define MPC52xx_XLB_OFFSET		0x1f00
+#define MPC52xx_XLB_SIZE		0x100
+#define MPC52xx_PSCx_OFFSET(x)		(((x)!=6)?(0x1e00+((x)<<9)):0x2c00)
+#define MPC52xx_PSC_SIZE		0x0a0
+
+/* SRAM used for SDMA */
+#define MPC52xx_SRAM_OFFSET		0x8000
+#define MPC52xx_SRAM_SIZE		0x4000
+
+/* ======================================================================== */
+/* IRQ mapping                                                              */
+/* ======================================================================== */
+
+#define MPC52xx_IRQ_L1_CRIT	(0)
+#define MPC52xx_IRQ_L1_MAIN	(1)
+#define MPC52xx_IRQ_L1_PERP	(2)
+#define MPC52xx_IRQ_L1_SDMA	(3)
+
+#define MPC52xx_IRQ_L1_OFFSET   (6)
+#define MPC52xx_IRQ_L1_MASK     (0x00c0)
+
+#define MPC52xx_IRQ_L2_OFFSET   (0)
+#define MPC52xx_IRQ_L2_MASK     (0x003f)
+
+#define MPC52xx_IRQ_HIGHTESTVIRQ (0xd0)
+
+/* ======================================================================== */
+/* Structures mapping of some unit register set                             */
+/* ======================================================================== */
+
+#ifndef __ASSEMBLY__
+
+/* Memory Mapping Control */
+struct mpc52xx_mmap_ctl {
+	u32 mbar;		/* MMAP_CTRL + 0x00 */
+
+	u32 cs0_start;		/* MMAP_CTRL + 0x04 */
+	u32 cs0_stop;		/* MMAP_CTRL + 0x08 */
+	u32 cs1_start;		/* MMAP_CTRL + 0x0c */
+	u32 cs1_stop;		/* MMAP_CTRL + 0x10 */
+	u32 cs2_start;		/* MMAP_CTRL + 0x14 */
+	u32 cs2_stop;		/* MMAP_CTRL + 0x18 */
+	u32 cs3_start;		/* MMAP_CTRL + 0x1c */
+	u32 cs3_stop;		/* MMAP_CTRL + 0x20 */
+	u32 cs4_start;		/* MMAP_CTRL + 0x24 */
+	u32 cs4_stop;		/* MMAP_CTRL + 0x28 */
+	u32 cs5_start;		/* MMAP_CTRL + 0x2c */
+	u32 cs5_stop;		/* MMAP_CTRL + 0x30 */
+
+	u32 sdram0;		/* MMAP_CTRL + 0x34 */
+	u32 sdram1;		/* MMAP_CTRL + 0X38 */
+
+	u32 reserved[4];	/* MMAP_CTRL + 0x3c .. 0x48 */
+
+	u32 boot_start;		/* MMAP_CTRL + 0x4c */
+	u32 boot_stop;		/* MMAP_CTRL + 0x50 */
+
+	u32 ipbi_ws_ctrl;	/* MMAP_CTRL + 0x54 */
+
+	u32 cs6_start;		/* MMAP_CTRL + 0x58 */
+	u32 cs6_stop;		/* MMAP_CTRL + 0x5c */
+	u32 cs7_start;		/* MMAP_CTRL + 0x60 */
+	u32 cs7_stop;		/* MMAP_CTRL + 0x64 */
+};
+
+/* SDRAM control */
+struct mpc52xx_sdram {
+	u32 mode;		/* SDRAM + 0x00 */
+	u32 ctrl;		/* SDRAM + 0x04 */
+	u32 config1;		/* SDRAM + 0x08 */
+	u32 config2;		/* SDRAM + 0x0c */
+};
+
+/* Interrupt controller */
+struct mpc52xx_intr {
+	u32 per_mask;		/* INTR + 0x00 */
+	u32 per_pri1;		/* INTR + 0x04 */
+	u32 per_pri2;		/* INTR + 0x08 */
+	u32 per_pri3;		/* INTR + 0x0c */
+	u32 ctrl;		/* INTR + 0x10 */
+	u32 main_mask;		/* INTR + 0x14 */
+	u32 main_pri1;		/* INTR + 0x18 */
+	u32 main_pri2;		/* INTR + 0x1c */
+	u32 reserved1;		/* INTR + 0x20 */
+	u32 enc_status;		/* INTR + 0x24 */
+	u32 crit_status;	/* INTR + 0x28 */
+	u32 main_status;	/* INTR + 0x2c */
+	u32 per_status;		/* INTR + 0x30 */
+	u32 reserved2;		/* INTR + 0x34 */
+	u32 per_error;		/* INTR + 0x38 */
+};
+
+/* SDMA */
+struct mpc52xx_sdma {
+	u32 taskBar;		/* SDMA + 0x00 */
+	u32 currentPointer;	/* SDMA + 0x04 */
+	u32 endPointer;		/* SDMA + 0x08 */
+	u32 variablePointer;	/* SDMA + 0x0c */
+
+	u8 IntVect1;		/* SDMA + 0x10 */
+	u8 IntVect2;		/* SDMA + 0x11 */
+	u16 PtdCntrl;		/* SDMA + 0x12 */
+
+	u32 IntPend;		/* SDMA + 0x14 */
+	u32 IntMask;		/* SDMA + 0x18 */
+
+	u16 tcr[16];		/* SDMA + 0x1c .. 0x3a */
+
+	u8 ipr[32];		/* SDMA + 0x3c .. 0x5b */
+
+	u32 cReqSelect;		/* SDMA + 0x5c */
+	u32 task_size0;		/* SDMA + 0x60 */
+	u32 task_size1;		/* SDMA + 0x64 */
+	u32 MDEDebug;		/* SDMA + 0x68 */
+	u32 ADSDebug;		/* SDMA + 0x6c */
+	u32 Value1;		/* SDMA + 0x70 */
+	u32 Value2;		/* SDMA + 0x74 */
+	u32 Control;		/* SDMA + 0x78 */
+	u32 Status;		/* SDMA + 0x7c */
+	u32 PTDDebug;		/* SDMA + 0x80 */
+};
+
+/* GPT */
+struct mpc52xx_gpt {
+	u32 mode;		/* GPTx + 0x00 */
+	u32 count;		/* GPTx + 0x04 */
+	u32 pwm;		/* GPTx + 0x08 */
+	u32 status;		/* GPTx + 0X0c */
+};
+
+/* GPIO */
+struct mpc52xx_gpio {
+	u32 port_config;	/* GPIO + 0x00 */
+	u32 simple_gpioe;	/* GPIO + 0x04 */
+	u32 simple_ode;		/* GPIO + 0x08 */
+	u32 simple_ddr;		/* GPIO + 0x0c */
+	u32 simple_dvo;		/* GPIO + 0x10 */
+	u32 simple_ival;	/* GPIO + 0x14 */
+	u8 outo_gpioe;		/* GPIO + 0x18 */
+	u8 reserved1[3];	/* GPIO + 0x19 */
+	u8 outo_dvo;		/* GPIO + 0x1c */
+	u8 reserved2[3];	/* GPIO + 0x1d */
+	u8 sint_gpioe;		/* GPIO + 0x20 */
+	u8 reserved3[3];	/* GPIO + 0x21 */
+	u8 sint_ode;		/* GPIO + 0x24 */
+	u8 reserved4[3];	/* GPIO + 0x25 */
+	u8 sint_ddr;		/* GPIO + 0x28 */
+	u8 reserved5[3];	/* GPIO + 0x29 */
+	u8 sint_dvo;		/* GPIO + 0x2c */
+	u8 reserved6[3];	/* GPIO + 0x2d */
+	u8 sint_inten;		/* GPIO + 0x30 */
+	u8 reserved7[3];	/* GPIO + 0x31 */
+	u16 sint_itype;		/* GPIO + 0x34 */
+	u16 reserved8;		/* GPIO + 0x36 */
+	u8 gpio_control;	/* GPIO + 0x38 */
+	u8 reserved9[3];	/* GPIO + 0x39 */
+	u8 sint_istat;		/* GPIO + 0x3c */
+	u8 sint_ival;		/* GPIO + 0x3d */
+	u8 bus_errs;		/* GPIO + 0x3e */
+	u8 reserved10;		/* GPIO + 0x3f */
+};
+
+#define MPC52xx_GPIO_PSC_CONFIG_UART_WITHOUT_CD	4
+#define MPC52xx_GPIO_PSC_CONFIG_UART_WITH_CD	5
+#define MPC52xx_GPIO_PCI_DIS			(1<<15)
+
+/* GPIO with WakeUp*/
+struct mpc52xx_gpio_wkup {
+	u8 wkup_gpioe;		/* GPIO_WKUP + 0x00 */
+	u8 reserved1[3];	/* GPIO_WKUP + 0x03 */
+	u8 wkup_ode;		/* GPIO_WKUP + 0x04 */
+	u8 reserved2[3];	/* GPIO_WKUP + 0x05 */
+	u8 wkup_ddr;		/* GPIO_WKUP + 0x08 */
+	u8 reserved3[3];	/* GPIO_WKUP + 0x09 */
+	u8 wkup_dvo;		/* GPIO_WKUP + 0x0C */
+	u8 reserved4[3];	/* GPIO_WKUP + 0x0D */
+	u8 wkup_inten;		/* GPIO_WKUP + 0x10 */
+	u8 reserved5[3];	/* GPIO_WKUP + 0x11 */
+	u8 wkup_iinten;		/* GPIO_WKUP + 0x14 */
+	u8 reserved6[3];	/* GPIO_WKUP + 0x15 */
+	u16 wkup_itype;		/* GPIO_WKUP + 0x18 */
+	u8 reserved7[2];	/* GPIO_WKUP + 0x1A */
+	u8 wkup_maste;		/* GPIO_WKUP + 0x1C */
+	u8 reserved8[3];	/* GPIO_WKUP + 0x1D */
+	u8 wkup_ival;		/* GPIO_WKUP + 0x20 */
+	u8 reserved9[3];	/* GPIO_WKUP + 0x21 */
+	u8 wkup_istat;		/* GPIO_WKUP + 0x24 */
+	u8 reserved10[3];	/* GPIO_WKUP + 0x25 */
+};
+
+/* XLB Bus control */
+struct mpc52xx_xlb {
+	u8 reserved[0x40];
+	u32 config;		/* XLB + 0x40 */
+	u32 version;		/* XLB + 0x44 */
+	u32 status;		/* XLB + 0x48 */
+	u32 int_enable;		/* XLB + 0x4c */
+	u32 addr_capture;	/* XLB + 0x50 */
+	u32 bus_sig_capture;	/* XLB + 0x54 */
+	u32 addr_timeout;	/* XLB + 0x58 */
+	u32 data_timeout;	/* XLB + 0x5c */
+	u32 bus_act_timeout;	/* XLB + 0x60 */
+	u32 master_pri_enable;	/* XLB + 0x64 */
+	u32 master_priority;	/* XLB + 0x68 */
+	u32 base_address;	/* XLB + 0x6c */
+	u32 snoop_window;	/* XLB + 0x70 */
+};
+
+#define MPC52xx_XLB_CFG_PLDIS		(1 << 31)
+#define MPC52xx_XLB_CFG_SNOOP		(1 << 15)
+
+/* Clock Distribution control */
+struct mpc52xx_cdm {
+	u32 jtag_id;		/* CDM + 0x00  reg0 read only */
+	u32 rstcfg;		/* CDM + 0x04  reg1 read only */
+	u32 breadcrumb;		/* CDM + 0x08  reg2 */
+
+	u8 mem_clk_sel;		/* CDM + 0x0c  reg3 byte0 */
+	u8 xlb_clk_sel;		/* CDM + 0x0d  reg3 byte1 read only */
+	u8 ipb_clk_sel;		/* CDM + 0x0e  reg3 byte2 */
+	u8 pci_clk_sel;		/* CDM + 0x0f  reg3 byte3 */
+
+	u8 ext_48mhz_en;	/* CDM + 0x10  reg4 byte0 */
+	u8 fd_enable;		/* CDM + 0x11  reg4 byte1 */
+	u16 fd_counters;	/* CDM + 0x12  reg4 byte2,3 */
+
+	u32 clk_enables;	/* CDM + 0x14  reg5 */
+
+	u8 osc_disable;		/* CDM + 0x18  reg6 byte0 */
+	u8 reserved0[3];	/* CDM + 0x19  reg6 byte1,2,3 */
+
+	u8 ccs_sleep_enable;	/* CDM + 0x1c  reg7 byte0 */
+	u8 osc_sleep_enable;	/* CDM + 0x1d  reg7 byte1 */
+	u8 reserved1;		/* CDM + 0x1e  reg7 byte2 */
+	u8 ccs_qreq_test;	/* CDM + 0x1f  reg7 byte3 */
+
+	u8 soft_reset;		/* CDM + 0x20  u8 byte0 */
+	u8 no_ckstp;		/* CDM + 0x21  u8 byte0 */
+	u8 reserved2[2];	/* CDM + 0x22  u8 byte1,2,3 */
+
+	u8 pll_lock;		/* CDM + 0x24  reg9 byte0 */
+	u8 pll_looselock;	/* CDM + 0x25  reg9 byte1 */
+	u8 pll_sm_lockwin;	/* CDM + 0x26  reg9 byte2 */
+	u8 reserved3;		/* CDM + 0x27  reg9 byte3 */
+
+	u16 reserved4;		/* CDM + 0x28  reg10 byte0,1 */
+	u16 mclken_div_psc1;	/* CDM + 0x2a  reg10 byte2,3 */
+
+	u16 reserved5;		/* CDM + 0x2c  reg11 byte0,1 */
+	u16 mclken_div_psc2;	/* CDM + 0x2e  reg11 byte2,3 */
+
+	u16 reserved6;		/* CDM + 0x30  reg12 byte0,1 */
+	u16 mclken_div_psc3;	/* CDM + 0x32  reg12 byte2,3 */
+
+	u16 reserved7;		/* CDM + 0x34  reg13 byte0,1 */
+	u16 mclken_div_psc6;	/* CDM + 0x36  reg13 byte2,3 */
+};
+
+#endif				/* __ASSEMBLY__ */
+
+/* ========================================================================= */
+/* Prototypes for MPC52xx syslib                                             */
+/* ========================================================================= */
+
+#ifndef __ASSEMBLY__
+
+extern void mpc52xx_init_irq(void);
+extern unsigned int mpc52xx_get_irq(void);
+
+#endif				/* __ASSEMBLY__ */
+
+#endif				/* _ASM_POWERPC_MPC52xx_H__ */
--- a/include/asm-ppc/io.h	2006-11-01 09:19:02.000000000 +0100
+++ b/include/asm-ppc/io.h	2006-11-02 18:01:17.000000000 +0100
@@ -26,7 +26,7 @@
 
 #if defined(CONFIG_4xx)
 #include <asm/ibm4xx.h>
-#elif defined(CONFIG_PPC_MPC52xx)
+#elif defined(CONFIG_PPC_MPC52xx) && !defined(CONFIG_PPC_MERGE)
 #include <asm/mpc52xx.h>
 #elif defined(CONFIG_8xx)
 #include <asm/mpc8xx.h>

[-- Attachment #3: nd.vcf --]
[-- Type: text/x-vcard, Size: 249 bytes --]

begin:vcard
fn:Nicolas DET ( bplan GmbH )
n:DET;Nicolas
org:bplan GmbH
adr:;;;;;;Germany
email;internet:nd@bplan-gmbh.de
title:Software Entwicklung
tel;work:+49 6171 9187 - 31
x-mozilla-html:FALSE
url:http://www.bplan-gmbh.de
version:2.1
end:vcard


^ permalink raw reply

* Re: [PATCH] adding ROM chips to device tree
From: Vitaly Wool @ 2006-11-02 20:30 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linuxppc-embedded
In-Reply-To: <454A408D.1020503@ru.mvista.com>


>     The set of device properties may vary from driver to driver, anway...

It's pretty easy to define set of properties universal for each type of
flash chips.


>     Hey, you just changed device_type from "mtd" to "rom", do you expect this 
> to still work? :-)

Heh, I've put the updated description in the patch but forgot to re-diff
the rest...


>     And, this actually should be registering *all* devices, not only "physmap" 
> ones. The of_device probing code should figure out which drivers will get 
> which devices.

Fine, I guess you're eager to send a respin of the patch... Feel free
to! :)

Thanks,
  Vitaly

^ permalink raw reply

* Re: [PATCH] adding ROM chips to device tree
From: Vitaly Wool @ 2006-11-02 20:23 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linuxppc-embedded
In-Reply-To: <454A4266.8040505@ru.mvista.com>


>     Also remember that we're not describing "physmap" compatible devices only.

No we are. This description fits nothing else but memory-mapped flashes.

Vitaly

^ permalink raw reply

* rebuild error for 2.6.18 plb_temac driver from EDK
From: robert corley @ 2006-11-02 19:32 UTC (permalink / raw)
  To: linux linuxppc-embedded

Can anyone help me out with this message?  It must be simple but I just am =
not familiar enough=0Awith the kernel build process to recognize the error:=
=0A=0A  CHK     include/linux/version.h=0A  CHK     include/linux/utsreleas=
e.h=0A  CHK     include/linux/compile.h=0Adnsdomainname: Unknown host=0Amak=
e[2]: *** No rule to make target `drivers/xilinx_edk/xilinx_syms.o', needed=
 by `drivers/xilinx_edk/built-in.o'.  Stop.=0Amake[1]: *** [drivers/xilinx_=
edk] Error 2=0Amake: *** [drivers] Error 2=0A=0A# Linux file to EXPORT_SYMB=
OL all of the Xilinx entries.=0Aobj-$(CONFIG_XILINX_EDK) :=3D xilinx_syms.o=
=0A#=0A# # The Xilinx OS independent code.=0Aobj-$(CONFIG_XILINX_EDK) +=3D =
xbasic_types.o \=0A                            xdmav3.o xdmav3_intr.o xdmav=
3_selftest.o xdmav3_simple.o xdmav3_sg.o \=0A                            xi=
pif_v1_23_b.o \=0A                            xpacket_fifo_l_v2_00_a.o xpac=
ket_fifo_v2_00_a.o \=0A                            xutil_memtest.c xversion=
.o=0A=0A=0A

^ permalink raw reply

* Re: [PATCH] adding ROM chips to device tree
From: Sergei Shtylyov @ 2006-11-02 19:09 UTC (permalink / raw)
  To: Josh Boyer; +Cc: Vitaly Wool, linuxppc-embedded
In-Reply-To: <1162474237.11351.7.camel@zod.rchland.ibm.com>

Hello.

Josh Boyer wrote:

>>+
>>+    Required properties:
>>+
>>+     - device_type : has to be "rom"

> Why "rom" instead of "NOR"?

    What does "NOR" mean -- logical operator? :-)
    I'd yet agree with "nor-flash", however, the physmap-driven device may not 
always be writeable, IIUC...

>>+     - compatible : Should be the name of the MTD driver. Currently, this is
>>+       most likely to be "physmap".
>>+     - reg : Offset and length of the register set for the device.

> reg doesn't really describe a register set here.  It's the overall
> memory space for flash.

    This is no more a standard boilerplate, if you look at this file.
    Also remember that we're not describing "physmap" compatible devices only.

>>+
>>+    Recommended properties :
>>+
>>+     - bank-width : Width of the flash data bus in bytes. Must be specified
>>+       for the NOR flashes.

> This is a required property, not a recommended one.

    Required by *certain* driver. Others may not need it (know beforehand).

> josh

WBR, Sergei

^ permalink raw reply

* Re: [PATCH] adding ROM chips to device tree
From: Sergei Shtylyov @ 2006-11-02 19:01 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: linuxppc-embedded
In-Reply-To: <20061102145539.f0b8657f.vwool@ru.mvista.com>

Hello.

Vitaly Wool wrote:
> Hello folks,

> inlined below is the patch which adds support for flash device descriptions to the OF device tree. It's inspired by and partially borrowed from Sergei's patch which can be found at http://patchwork.ozlabs.org/linuxppc/patch?id=6526 but arranges things in a different way.
> It should be used together with the corresponding MTD layer extension the current version of which was recently posted to linux-mtd list for discussion and can be found at http://lists.infradead.org/pipermail/linux-mtd/2006-November/016700.html.
> In fact, currently this description can handle only flash devices mapped into memory in a linear way. For NAND flashes we'll need a whole lot different description but let's solve problems as they arise since I'm not aware of any ppc board w/ NAND chip yet :)

    The set of device properties may vary from driver to driver, anway...

>  Documentation/powerpc/booting-without-of.txt |   37 +++++++++++++++++++++++++++
>  arch/powerpc/sysdev/Makefile                 |    1
>  arch/powerpc/sysdev/flash.c                  |   27 +++++++++++++++++++

    Maybe worth renaming into mtd.c...

>  3 files changed, 65 insertions(+)

> Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>

> Index: powerpc/Documentation/powerpc/booting-without-of.txt
> ===================================================================
> --- powerpc.orig/Documentation/powerpc/booting-without-of.txt
> +++ powerpc/Documentation/powerpc/booting-without-of.txt
> @@ -6,6 +6,8 @@
>      IBM Corp.
>  (c) 2005 Becky Bruce <becky.bruce at freescale.com>,
>      Freescale Semiconductor, FSL SOC and 32-bit additions
> +(c) 2006 MontaVista Software, Inc.
> +    Flash chip node definition
>  
>     May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.
>  
> @@ -1693,6 +1696,41 @@ platforms are moved over to use the flat
>  		};
>  	};
>  
> +    viii) Flash chip nodes

    Ha, it shoulf be h). The stupid roman numbering was introduced for QUICC 
engine devices. I wodner whose idea it was to have *two* i) items in a row... :-)

> +
> +    Flash chips (Memory Technology Devices) are often used for solid state
> +    file systems on embedded devices.
> +
> +    Required properties:
> +
> +     - device_type : has to be "rom"
> +     - compatible : Should be the name of the MTD driver. Currently, this is
> +       most likely to be "physmap".
> +     - reg : Offset and length of the register set for the device.
> +
> +    Recommended properties :
> +
> +     - bank-width : Width of the flash data bus in bytes. Must be specified
> +       for the NOR flashes.
> +     - partitions : Several pairs of 32-bit values where the first value is
> +       partition's offset from the start of the MTD device and the second
> +       one is partition size in bytes with LSB used to signify a read only
> +       partititon (so, the parition size should always be an even number).
> +     - partition-names : The list of concatenated zero terminated strings
> +       representing the partition names.
> +
> +   Example:
> +
> + 	flash@ff000000 {
> + 		device_type = "rom";
> + 		compatible = "physmap";
> + 		reg = <ff000000 01000000>;
> + 		bank-width = <4>;
> + 		partitions = <00000000 00f80000
> + 			      00f80000 00080001>;
> + 		partition-names = "fs\0firmware";
> + 	};
> +
>     More devices will be defined as this spec matures.
>  
>  
> Index: powerpc/arch/powerpc/sysdev/Makefile
> ===================================================================
> --- powerpc.orig/arch/powerpc/sysdev/Makefile
> +++ powerpc/arch/powerpc/sysdev/Makefile
> @@ -12,6 +12,7 @@ obj-$(CONFIG_MMIO_NVRAM)	+= mmio_nvram.o
>  obj-$(CONFIG_FSL_SOC)		+= fsl_soc.o
>  obj-$(CONFIG_TSI108_BRIDGE)	+= tsi108_pci.o tsi108_dev.o
>  obj-$(CONFIG_QUICC_ENGINE)	+= qe_lib/
> +obj-$(CONFIG_MTD)		+= flash.o
>  
>  ifeq ($(CONFIG_PPC_MERGE),y)
>  obj-$(CONFIG_PPC_I8259)		+= i8259.o
> Index: powerpc/arch/powerpc/sysdev/flash.c
> ===================================================================
> --- /dev/null
> +++ powerpc/arch/powerpc/sysdev/flash.c
> @@ -0,0 +1,27 @@
> +/*
> + * arch/powerpc/sysdev/flash.c
> + *
> + * Flash memory registration
> + *
> + * (C) 2006 MontaVista Software, Inc. 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 <asm/of_device.h>
> +
> +static int __init powerpc_flash_init(void)
> +{
> +	struct device_node *node = NULL;
> +	int num = 0;

    There's no need to count anymore...

> +	while ((node = of_find_compatible_node(node, "mtd", "physmap"))

    Hey, you just changed device_type from "mtd" to "rom", do you expect this 
to still work? :-)
    And, this actually should be registering *all* devices, not only "physmap" 
ones. The of_device probing code should figure out which drivers will get 
which devices.

> +			!= NULL) {
> +		of_platform_device_create(node, "physmap-flash", NULL);
> +		++num;
> +	}
> +	return 0;
> +}
> +
> +arch_initcall(powerpc_flash_init);

WBR, Sergei

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox