[PATCH 4/6] ppc32: Add platform bus / ppc_sys model to Freescale MPC52xx

Kumar Gala kumar.gala at freescale.com
Sat Mar 26 02:15:35 EST 2005


One question, do you really need #defines for the device offsets in 
mpc52xx_devices.c ?  Are these used anywhere else?

- kumar

On Mar 21, 2005, at 5:08 PM, Sylvain Munaut wrote:

> ppc32: Add platform bus / ppc_sys model to Freescale MPC52xx
>
> This patch makes all platform based around the Freescale MPC52xx use
>  the platform bus and more precisly the ppc_sys model put in
>  place by Kumar Gala.
>
>
>
> Signed-off-by: Sylvain Munaut <tnt at 246tNt.com>

[ snip ]

> diff -Nru a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
> --- a/arch/ppc/syslib/Makefile  2005-03-21 20:10:34 +01:00
>  +++ b/arch/ppc/syslib/Makefile  2005-03-21 20:10:34 +01:00
>  @@ -106,7 +106,8 @@
>   obj-$(CONFIG_PCI)              += indirect_pci.o pci_auto.o
>   endif
>   obj-$(CONFIG_MPC8555_CDS)      += todc_time.o
> -obj-$(CONFIG_PPC_MPC52xx)      += mpc52xx_setup.o mpc52xx_pic.o
> +obj-$(CONFIG_PPC_MPC52xx)      += mpc52xx_setup.o mpc52xx_pic.o \
>  +                                       mpc52xx_sys.o 
> mpc52xx_devices.o ppc_sys.o
>   ifeq ($(CONFIG_PPC_MPC52xx),y)
>  obj-$(CONFIG_PCI)              += mpc52xx_pci.o
>  endif
>  diff -Nru a/arch/ppc/syslib/mpc52xx_devices.c 
> b/arch/ppc/syslib/mpc52xx_devices.c
> --- /dev/null   Wed Dec 31 16:00:00 196900
>  +++ b/arch/ppc/syslib/mpc52xx_devices.c 2005-03-21 20:10:34 +01:00
>  @@ -0,0 +1,333 @@
>  +/*
>  + * arch/ppc/syslib/mpc52xx_devices.c
> + *
>  + * Freescale MPC52xx device descriptions
>  + *
>  + *
>  + * Maintainer : Sylvain Munaut <tnt at 246tNt.com>
> + *
>  + * Copyright (C) 2005 Sylvain Munaut <tnt at 246tNt.com>
> + *
>  + * This file is licensed under the terms of the GNU General Public 
> License
>  + * version 2. This program is licensed "as is" without any warranty 
> of any
>  + * kind, whether express or implied.
>  + */
>  +
>  +#include <linux/fsl_devices.h>
> +#include <linux/resource.h>
> +#include <asm/mpc52xx.h>
> +#include <asm/ppc_sys.h>
> +
>  +
>  +static u64 mpc52xx_dma_mask = 0xffffffffULL;
>  +
>  +static struct fsl_i2c_platform_data mpc52xx_fsl_i2c_pdata = {
>  +       .device_flags = FSL_I2C_DEV_CLOCK_5200,
> +};
>  +
>  +
>  +/* We use relative offsets for IORESOURCE_MEM to be independent from 
> the
>  + * MBAR location at compile time
>  + */
>  +
>  +/* TODO Add the BestComm initiator channel to the device definitions,
>  +   possibly using IORESOURCE_DMA. But that's when BestComm is ready 
> ... */
>  +
>  +struct platform_device ppc_sys_platform_devices[] = {
>  +       [MPC52xx_MSCAN1] = {
>  +               .name           = "mpc52xx-mscan",
>  +               .id             = 0,
> +               .num_resources  = 2,
>  +               .resource = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_MSCAN1_OFFSET,
> +                               .end    = MPC52xx_MSCAN1_OFFSET +
>  +                                               MPC52xx_MSCAN_SIZE - 
> 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_MSCAN1_IRQ,
> +                               .end    = MPC52xx_MSCAN1_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_MSCAN2] = {
>  +               .name           = "mpc52xx-mscan",
>  +               .id             = 1,
> +               .num_resources  = 2,
>  +               .resource = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_MSCAN2_OFFSET,
> +                               .end    = MPC52xx_MSCAN2_OFFSET +
>  +                                               MPC52xx_MSCAN_SIZE - 
> 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_MSCAN2_IRQ,
> +                               .end    = MPC52xx_MSCAN2_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_SPI] = {
>  +               .name           = "mpc52xx-spi",
> +               .id             = -1,
>  +               .num_resources  = 3,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_SPI_OFFSET,
> +                               .end    = MPC52xx_SPI_OFFSET +
>  +                                               MPC52xx_SPI_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .name   = "modf",
>  +                               .start  = MPC52xx_SPI_MODF_IRQ,
> +                               .end    = MPC52xx_SPI_MODF_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +                       {
>  +                               .name   = "spif",
>  +                               .start  = MPC52xx_SPI_SPIF_IRQ,
> +                               .end    = MPC52xx_SPI_SPIF_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_USB] = {
>  +               .name           = "ppc-soc-ohci",
> +               .id             = -1,
>  +               .num_resources  = 2,
>  +               .dev.dma_mask   = &mpc52xx_dma_mask,
> +               .dev.coherent_dma_mask = 0xffffffffULL,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_USB_OFFSET,
> +                               .end    = MPC52xx_USB_OFFSET +
>  +                                               MPC52xx_USB_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_USB_IRQ,
> +                               .end    = MPC52xx_USB_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_BDLC] = {
>  +               .name           = "mpc52xx-bdlc",
>  +               .id             = -1,
>  +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_BDLC_OFFSET,
> +                               .end    = MPC52xx_BDLC_OFFSET +
>  +                                               MPC52xx_BDLC_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_BDLC_IRQ,
> +                               .end    = MPC52xx_BDLC_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_PSC1] = {
>  +               .name           = "mpc52xx-psc",
>  +               .id             = 0,
> +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_PSC1_OFFSET,
> +                               .end    = MPC52xx_PSC1_OFFSET +
>  +                                               MPC52xx_PSC_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_PSC1_IRQ,
> +                               .end    = MPC52xx_PSC1_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_PSC2] = {
>  +               .name           = "mpc52xx-psc",
>  +               .id             = 1,
> +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_PSC2_OFFSET,
> +                               .end    = MPC52xx_PSC2_OFFSET +
>  +                                               MPC52xx_PSC_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_PSC2_IRQ,
> +                               .end    = MPC52xx_PSC2_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_PSC3] = {
>  +               .name           = "mpc52xx-psc",
>  +               .id             = 2,
> +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_PSC3_OFFSET,
> +                               .end    = MPC52xx_PSC3_OFFSET +
>  +                                               MPC52xx_PSC_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_PSC3_IRQ,
> +                               .end    = MPC52xx_PSC3_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_PSC4] = {
>  +               .name           = "mpc52xx-psc",
>  +               .id             = 3,
> +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_PSC4_OFFSET,
> +                               .end    = MPC52xx_PSC4_OFFSET +
>  +                                               MPC52xx_PSC_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_PSC4_IRQ,
> +                               .end    = MPC52xx_PSC4_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_PSC5] = {
>  +               .name           = "mpc52xx-psc",
>  +               .id             = 4,
> +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_PSC5_OFFSET,
> +                               .end    = MPC52xx_PSC5_OFFSET +
>  +                                               MPC52xx_PSC_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_PSC5_IRQ,
> +                               .end    = MPC52xx_PSC5_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_PSC6] = {
>  +               .name           = "mpc52xx-psc",
>  +               .id             = 5,
> +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_PSC6_OFFSET,
> +                               .end    = MPC52xx_PSC6_OFFSET +
>  +                                               MPC52xx_PSC_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_PSC6_IRQ,
> +                               .end    = MPC52xx_PSC6_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_FEC] = {
>  +               .name           = "mpc52xx-fec",
> +               .id             = -1,
>  +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_FEC_OFFSET,
> +                               .end    = MPC52xx_FEC_OFFSET +
>  +                                               MPC52xx_FEC_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_FEC_IRQ,
> +                               .end    = MPC52xx_FEC_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_ATA] = {
>  +               .name           = "mpc52xx-ata",
> +               .id             = -1,
>  +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_ATA_OFFSET,
> +                               .end    = MPC52xx_ATA_OFFSET +
>  +                                               MPC52xx_ATA_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_ATA_IRQ,
> +                               .end    = MPC52xx_ATA_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_I2C1] = {
>  +               .name           = "fsl-i2c",
>  +               .id             = 0,
> +               .dev.platform_data = &mpc52xx_fsl_i2c_pdata,
> +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_I2C1_OFFSET,
> +                               .end    = MPC52xx_I2C1_OFFSET +
>  +                                               MPC52xx_I2C_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_I2C1_IRQ,
> +                               .end    = MPC52xx_I2C1_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +       [MPC52xx_I2C2] = {
>  +               .name           = "fsl-i2c",
>  +               .id             = 1,
> +               .dev.platform_data = &mpc52xx_fsl_i2c_pdata,
> +               .num_resources  = 2,
>  +               .resource       = (struct resource[]) {
>  +                       {
>  +                               .start  = MPC52xx_I2C2_OFFSET,
> +                               .end    = MPC52xx_I2C2_OFFSET +
>  +                                               MPC52xx_I2C_SIZE - 1,
>  +                               .flags  = IORESOURCE_MEM,
> +                       },
>  +                       {
>  +                               .start  = MPC52xx_I2C2_IRQ,
> +                               .end    = MPC52xx_I2C2_IRQ,
> +                               .flags  = IORESOURCE_IRQ,
> +                       },
>  +               },
>  +       },
>  +};
>  +
>  +
>  +static int __init mach_mpc52xx_fixup(struct platform_device *pdev)
>  +{
>  +       ppc_sys_fixup_mem_resource(pdev, MPC52xx_MBAR);
> +       return 0;
>  +}
>  +
>  +static int __init mach_mpc52xx_init(void)
> +{
>  +       ppc_sys_device_fixup = mach_mpc52xx_fixup;
> +       return 0;
>  +}
>  +
>  +postcore_initcall(mach_mpc52xx_init);




More information about the Linuxppc-embedded mailing list