diff options
author | Sylvain Munaut <tnt@246tnt.com> | 2005-03-30 16:29:22 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-03-30 16:29:22 -0800 |
commit | 27afc6c3b6a0d53ae99f9698bd4613e56dc3cc71 (patch) | |
tree | 0c533395f840351996433578859f31d4a72f6152 | |
parent | c674630bdd7c6f82aef021e18f1071e5ce38d21d (diff) | |
download | history-27afc6c3b6a0d53ae99f9698bd4613e56dc3cc71.tar.gz |
[PATCH] ppc32: Use platform bus / ppc_sys model for 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@246tNt.com>
Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/ppc/platforms/lite5200.c | 15 | ||||
-rw-r--r-- | arch/ppc/syslib/Makefile | 3 | ||||
-rw-r--r-- | arch/ppc/syslib/mpc52xx_devices.c | 318 | ||||
-rw-r--r-- | arch/ppc/syslib/mpc52xx_setup.c | 13 | ||||
-rw-r--r-- | arch/ppc/syslib/mpc52xx_sys.c | 38 | ||||
-rw-r--r-- | include/asm-ppc/mpc52xx.h | 34 | ||||
-rw-r--r-- | include/asm-ppc/ppc_sys.h | 2 |
7 files changed, 422 insertions, 1 deletions
diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c index 37ba4f4275da2..4ea7eb9e31c5c 100644 --- a/arch/ppc/platforms/lite5200.c +++ b/arch/ppc/platforms/lite5200.c @@ -34,6 +34,7 @@ #include <asm/bootinfo.h> #include <asm/io.h> #include <asm/mpc52xx.h> +#include <asm/ppc_sys.h> #include <syslib/mpc52xx_pci.h> @@ -49,6 +50,17 @@ EXPORT_SYMBOL(__res); /* For modules */ /* Platform specific code */ /* ======================================================================== */ +/* Supported PSC function in "preference" order */ +struct mpc52xx_psc_func mpc52xx_psc_functions[] = { + { .id = 0, + .func = "uart", + }, + { .id = -1, /* End entry */ + .func = NULL, + } + }; + + static int lite5200_show_cpuinfo(struct seq_file *m) { @@ -148,6 +160,9 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, } } + /* PPC Sys identification */ + identify_ppc_sys_by_id(mfspr(SPRN_SVR)); + /* BAT setup */ mpc52xx_set_bat(); diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile index 830d00da5db0b..dd418ea3426c7 100644 --- a/arch/ppc/syslib/Makefile +++ b/arch/ppc/syslib/Makefile @@ -108,7 +108,8 @@ ifeq ($(CONFIG_83xx),y) 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 --git a/arch/ppc/syslib/mpc52xx_devices.c b/arch/ppc/syslib/mpc52xx_devices.c new file mode 100644 index 0000000000000..ad5182efca1dd --- /dev/null +++ b/arch/ppc/syslib/mpc52xx_devices.c @@ -0,0 +1,318 @@ +/* + * arch/ppc/syslib/mpc52xx_devices.c + * + * Freescale MPC52xx device descriptions + * + * + * Maintainer : Sylvain Munaut <tnt@246tNt.com> + * + * Copyright (C) 2005 Sylvain Munaut <tnt@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 = 0x0900, + .end = 0x097f, + .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 = 0x0980, + .end = 0x09ff, + .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 = 0x0f00, + .end = 0x0f1f, + .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 = 0x1000, + .end = 0x10ff, + .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 = 0x1300, + .end = 0x130f, + .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 = 0x2000, + .end = 0x209f, + .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 = 0x2200, + .end = 0x229f, + .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 = 0x2400, + .end = 0x249f, + .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 = 0x2600, + .end = 0x269f, + .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 = 0x2800, + .end = 0x289f, + .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 = 0x2c00, + .end = 0x2c9f, + .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 = 0x3000, + .end = 0x33ff, + .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 = 0x3a00, + .end = 0x3aff, + .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 = 0x3d00, + .end = 0x3d1f, + .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 = 0x3d40, + .end = 0x3d5f, + .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); diff --git a/arch/ppc/syslib/mpc52xx_setup.c b/arch/ppc/syslib/mpc52xx_setup.c index d7494d5888265..bb2374585a7b9 100644 --- a/arch/ppc/syslib/mpc52xx_setup.c +++ b/arch/ppc/syslib/mpc52xx_setup.c @@ -215,3 +215,16 @@ mpc52xx_calibrate_decr(void) tb_ticks_per_jiffy = xlbfreq / HZ / divisor; tb_to_us = mulhwu_scale_factor(xlbfreq / divisor, 1000000); } + +int mpc52xx_match_psc_function(int psc_idx, const char *func) +{ + struct mpc52xx_psc_func *cf = mpc52xx_psc_functions; + + while ((cf->id != -1) && (cf->func != NULL)) { + if ((cf->id == psc_idx) && !strcmp(cf->func,func)) + return 1; + cf++; + } + + return 0; +} diff --git a/arch/ppc/syslib/mpc52xx_sys.c b/arch/ppc/syslib/mpc52xx_sys.c new file mode 100644 index 0000000000000..9a0f90aa8aac8 --- /dev/null +++ b/arch/ppc/syslib/mpc52xx_sys.c @@ -0,0 +1,38 @@ +/* + * arch/ppc/syslib/mpc52xx_sys.c + * + * Freescale MPC52xx system descriptions + * + * + * Maintainer : Sylvain Munaut <tnt@246tNt.com> + * + * Copyright (C) 2005 Sylvain Munaut <tnt@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 <asm/ppc_sys.h> + +struct ppc_sys_spec *cur_ppc_sys_spec; +struct ppc_sys_spec ppc_sys_specs[] = { + { + .ppc_sys_name = "5200", + .mask = 0xffff0000, + .value = 0x80110000, + .num_devices = 15, + .device_list = (enum ppc_sys_devices[]) + { + MPC52xx_MSCAN1, MPC52xx_MSCAN2, MPC52xx_SPI, + MPC52xx_USB, MPC52xx_BDLC, MPC52xx_PSC1, MPC52xx_PSC2, + MPC52xx_PSC3, MPC52xx_PSC4, MPC52xx_PSC5, MPC52xx_PSC6, + MPC52xx_FEC, MPC52xx_ATA, MPC52xx_I2C1, MPC52xx_I2C2, + }, + }, + { /* default match */ + .ppc_sys_name = "", + .mask = 0x00000000, + .value = 0x00000000, + }, +}; diff --git a/include/asm-ppc/mpc52xx.h b/include/asm-ppc/mpc52xx.h index 84c29a053eaa0..e5f80c22fbfcf 100644 --- a/include/asm-ppc/mpc52xx.h +++ b/include/asm-ppc/mpc52xx.h @@ -30,6 +30,29 @@ struct pt_regs; /* ======================================================================== */ +/* PPC Sys devices definition */ +/* ======================================================================== */ + +enum ppc_sys_devices { + MPC52xx_MSCAN1, + MPC52xx_MSCAN2, + MPC52xx_SPI, + MPC52xx_USB, + MPC52xx_BDLC, + MPC52xx_PSC1, + MPC52xx_PSC2, + MPC52xx_PSC3, + MPC52xx_PSC4, + MPC52xx_PSC5, + MPC52xx_PSC6, + MPC52xx_FEC, + MPC52xx_ATA, + MPC52xx_I2C1, + MPC52xx_I2C2, +}; + + +/* ======================================================================== */ /* Main registers/struct addresses */ /* ======================================================================== */ @@ -392,6 +415,17 @@ extern void mpc52xx_calibrate_decr(void); extern void mpc52xx_find_bridges(void); + + /* Matching of PSC function */ +struct mpc52xx_psc_func { + int id; + char *func; +}; + +extern int mpc52xx_match_psc_function(int psc_idx, const char *func); +extern struct mpc52xx_psc_func mpc52xx_psc_functions[]; + /* This array is to be defined in platform file */ + #endif /* __ASSEMBLY__ */ diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h index 293e47f1d99a5..24b991c427694 100644 --- a/include/asm-ppc/ppc_sys.h +++ b/include/asm-ppc/ppc_sys.h @@ -25,6 +25,8 @@ #include <asm/mpc83xx.h> #elif defined(CONFIG_85xx) #include <asm/mpc85xx.h> +#elif defined(CONFIG_PPC_MPC52xx) +#include <asm/mpc52xx.h> #else #error "need definition of ppc_sys_devices" #endif |