aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-04-29 20:07:03 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-29 20:07:03 -0400
commite0a515bc6a2188f02916e976f419a8640312e32a (patch)
treedd8f4f64cffe37725000c7a80d4b2b973c69f65a /arch
parent991cef7be26ce78fe2bac72bedaf89e002cc2712 (diff)
parent6fb8f3acbe833586eb32598d1f844eb9f77c4fba (diff)
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: [PATCH] powerpc: update cell_defconfig [PATCH] spufs: Disable local interrupts for SPE hash_page calls. [PATCH] powerpc: Add cputable entry for POWER6 [PATCH] ppc32 CPM_UART: Fixed odd address translations [PATCH] ppc32: Update board-specific code of the CPM UART users [PATCH] ppc32 CPM_UART: Convert to use platform devices [PATCH] ppc32: odd fixes and improvements in ppc_sys [PATCH] powerpc: Wire up *at syscalls [PATCH] ppc32: add 440GX erratum 440_43 workaround [PATCH] powerpc: Use check_legacy_ioport() on ppc32 too. [PATCH] powerpc64: Fix loading of modules without a .toc section [PATCH] sound/ppc: snd_pmac_toonie_init should be __init powerpc/pseries: Tell firmware our capabilities on new machines [PATCH] powerpc: Fix pagetable bloat for hugepages
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/configs/cell_defconfig40
-rw-r--r--arch/powerpc/kernel/cputable.c16
-rw-r--r--arch/powerpc/kernel/module_64.c16
-rw-r--r--arch/powerpc/kernel/prom_init.c112
-rw-r--r--arch/powerpc/kernel/setup-common.c8
-rw-r--r--arch/powerpc/kernel/setup_64.c8
-rw-r--r--arch/powerpc/kernel/systbl.S13
-rw-r--r--arch/powerpc/mm/hugetlbpage.c295
-rw-r--r--arch/powerpc/mm/init_64.c7
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c10
-rw-r--r--arch/powerpc/platforms/cell/spu_callbacks.c13
-rw-r--r--arch/ppc/platforms/4xx/ocotea.c2
-rw-r--r--arch/ppc/platforms/mpc8272ads_setup.c114
-rw-r--r--arch/ppc/platforms/mpc866ads_setup.c140
-rw-r--r--arch/ppc/platforms/mpc885ads_setup.c131
-rw-r--r--arch/ppc/platforms/pq2ads.c31
-rw-r--r--arch/ppc/syslib/ibm440gx_common.c13
-rw-r--r--arch/ppc/syslib/ibm440gx_common.h4
-rw-r--r--arch/ppc/syslib/mpc8xx_devices.c25
-rw-r--r--arch/ppc/syslib/ppc_sys.c4
-rw-r--r--arch/ppc/syslib/pq2_sys.c8
21 files changed, 926 insertions, 84 deletions
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index fe22e54ab2b0..dbe421dc3c11 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y
9CONFIG_MMU=y 9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y 10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y 11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_PPC=y 14CONFIG_PPC=y
14CONFIG_EARLY_PRINTK=y 15CONFIG_EARLY_PRINTK=y
@@ -55,6 +56,7 @@ CONFIG_SYSCTL=y
55CONFIG_IKCONFIG=y 56CONFIG_IKCONFIG=y
56CONFIG_IKCONFIG_PROC=y 57CONFIG_IKCONFIG_PROC=y
57# CONFIG_CPUSETS is not set 58# CONFIG_CPUSETS is not set
59# CONFIG_RELAY is not set
58CONFIG_INITRAMFS_SOURCE="" 60CONFIG_INITRAMFS_SOURCE=""
59CONFIG_CC_OPTIMIZE_FOR_SIZE=y 61CONFIG_CC_OPTIMIZE_FOR_SIZE=y
60# CONFIG_EMBEDDED is not set 62# CONFIG_EMBEDDED is not set
@@ -69,10 +71,6 @@ CONFIG_BASE_FULL=y
69CONFIG_FUTEX=y 71CONFIG_FUTEX=y
70CONFIG_EPOLL=y 72CONFIG_EPOLL=y
71CONFIG_SHMEM=y 73CONFIG_SHMEM=y
72CONFIG_CC_ALIGN_FUNCTIONS=0
73CONFIG_CC_ALIGN_LABELS=0
74CONFIG_CC_ALIGN_LOOPS=0
75CONFIG_CC_ALIGN_JUMPS=0
76CONFIG_SLAB=y 74CONFIG_SLAB=y
77# CONFIG_TINY_SHMEM is not set 75# CONFIG_TINY_SHMEM is not set
78CONFIG_BASE_SMALL=0 76CONFIG_BASE_SMALL=0
@@ -84,7 +82,6 @@ CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y 82CONFIG_MODULES=y
85CONFIG_MODULE_UNLOAD=y 83CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set 84# CONFIG_MODULE_FORCE_UNLOAD is not set
87CONFIG_OBSOLETE_MODPARM=y
88# CONFIG_MODVERSIONS is not set 85# CONFIG_MODVERSIONS is not set
89# CONFIG_MODULE_SRCVERSION_ALL is not set 86# CONFIG_MODULE_SRCVERSION_ALL is not set
90CONFIG_KMOD=y 87CONFIG_KMOD=y
@@ -93,6 +90,7 @@ CONFIG_STOP_MACHINE=y
93# 90#
94# Block layer 91# Block layer
95# 92#
93# CONFIG_BLK_DEV_IO_TRACE is not set
96 94
97# 95#
98# IO Schedulers 96# IO Schedulers
@@ -126,6 +124,7 @@ CONFIG_RTAS_FLASH=y
126CONFIG_MMIO_NVRAM=y 124CONFIG_MMIO_NVRAM=y
127CONFIG_CELL_IIC=y 125CONFIG_CELL_IIC=y
128# CONFIG_PPC_MPC106 is not set 126# CONFIG_PPC_MPC106 is not set
127# CONFIG_PPC_970_NAP is not set
129# CONFIG_CPU_FREQ is not set 128# CONFIG_CPU_FREQ is not set
130# CONFIG_WANT_EARLY_SERIAL is not set 129# CONFIG_WANT_EARLY_SERIAL is not set
131 130
@@ -167,7 +166,6 @@ CONFIG_HAVE_MEMORY_PRESENT=y
167CONFIG_SPARSEMEM_EXTREME=y 166CONFIG_SPARSEMEM_EXTREME=y
168# CONFIG_MEMORY_HOTPLUG is not set 167# CONFIG_MEMORY_HOTPLUG is not set
169CONFIG_SPLIT_PTLOCK_CPUS=4 168CONFIG_SPLIT_PTLOCK_CPUS=4
170CONFIG_MIGRATION=y
171# CONFIG_PPC_64K_PAGES is not set 169# CONFIG_PPC_64K_PAGES is not set
172CONFIG_SCHED_SMT=y 170CONFIG_SCHED_SMT=y
173CONFIG_PROC_DEVICETREE=y 171CONFIG_PROC_DEVICETREE=y
@@ -184,7 +182,6 @@ CONFIG_GENERIC_ISA_DMA=y
184# CONFIG_PPC_INDIRECT_PCI is not set 182# CONFIG_PPC_INDIRECT_PCI is not set
185CONFIG_PCI=y 183CONFIG_PCI=y
186CONFIG_PCI_DOMAINS=y 184CONFIG_PCI_DOMAINS=y
187CONFIG_PCI_LEGACY_PROC=y
188# CONFIG_PCI_DEBUG is not set 185# CONFIG_PCI_DEBUG is not set
189 186
190# 187#
@@ -226,6 +223,7 @@ CONFIG_SYN_COOKIES=y
226# CONFIG_INET_AH is not set 223# CONFIG_INET_AH is not set
227# CONFIG_INET_ESP is not set 224# CONFIG_INET_ESP is not set
228# CONFIG_INET_IPCOMP is not set 225# CONFIG_INET_IPCOMP is not set
226# CONFIG_INET_XFRM_TUNNEL is not set
229CONFIG_INET_TUNNEL=y 227CONFIG_INET_TUNNEL=y
230CONFIG_INET_DIAG=y 228CONFIG_INET_DIAG=y
231CONFIG_INET_TCP_DIAG=y 229CONFIG_INET_TCP_DIAG=y
@@ -242,6 +240,7 @@ CONFIG_IPV6=y
242CONFIG_INET6_AH=m 240CONFIG_INET6_AH=m
243CONFIG_INET6_ESP=m 241CONFIG_INET6_ESP=m
244CONFIG_INET6_IPCOMP=m 242CONFIG_INET6_IPCOMP=m
243CONFIG_INET6_XFRM_TUNNEL=m
245CONFIG_INET6_TUNNEL=m 244CONFIG_INET6_TUNNEL=m
246CONFIG_IPV6_TUNNEL=m 245CONFIG_IPV6_TUNNEL=m
247CONFIG_NETFILTER=y 246CONFIG_NETFILTER=y
@@ -632,6 +631,7 @@ CONFIG_SERIAL_NONSTANDARD=y
632# 631#
633CONFIG_SERIAL_8250=y 632CONFIG_SERIAL_8250=y
634CONFIG_SERIAL_8250_CONSOLE=y 633CONFIG_SERIAL_8250_CONSOLE=y
634CONFIG_SERIAL_8250_PCI=y
635CONFIG_SERIAL_8250_NR_UARTS=4 635CONFIG_SERIAL_8250_NR_UARTS=4
636CONFIG_SERIAL_8250_RUNTIME_UARTS=4 636CONFIG_SERIAL_8250_RUNTIME_UARTS=4
637# CONFIG_SERIAL_8250_EXTENDED is not set 637# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -717,7 +717,6 @@ CONFIG_I2C_ALGOBIT=y
717# CONFIG_I2C_PARPORT_LIGHT is not set 717# CONFIG_I2C_PARPORT_LIGHT is not set
718# CONFIG_I2C_PROSAVAGE is not set 718# CONFIG_I2C_PROSAVAGE is not set
719# CONFIG_I2C_SAVAGE4 is not set 719# CONFIG_I2C_SAVAGE4 is not set
720# CONFIG_SCx200_ACB is not set
721# CONFIG_I2C_SIS5595 is not set 720# CONFIG_I2C_SIS5595 is not set
722# CONFIG_I2C_SIS630 is not set 721# CONFIG_I2C_SIS630 is not set
723# CONFIG_I2C_SIS96X is not set 722# CONFIG_I2C_SIS96X is not set
@@ -736,9 +735,7 @@ CONFIG_I2C_ALGOBIT=y
736# CONFIG_SENSORS_PCF8574 is not set 735# CONFIG_SENSORS_PCF8574 is not set
737# CONFIG_SENSORS_PCA9539 is not set 736# CONFIG_SENSORS_PCA9539 is not set
738# CONFIG_SENSORS_PCF8591 is not set 737# CONFIG_SENSORS_PCF8591 is not set
739# CONFIG_SENSORS_RTC8564 is not set
740# CONFIG_SENSORS_MAX6875 is not set 738# CONFIG_SENSORS_MAX6875 is not set
741# CONFIG_RTC_X1205_I2C is not set
742# CONFIG_I2C_DEBUG_CORE is not set 739# CONFIG_I2C_DEBUG_CORE is not set
743# CONFIG_I2C_DEBUG_ALGO is not set 740# CONFIG_I2C_DEBUG_ALGO is not set
744# CONFIG_I2C_DEBUG_BUS is not set 741# CONFIG_I2C_DEBUG_BUS is not set
@@ -766,10 +763,6 @@ CONFIG_I2C_ALGOBIT=y
766# 763#
767 764
768# 765#
769# Multimedia Capabilities Port drivers
770#
771
772#
773# Multimedia devices 766# Multimedia devices
774# 767#
775# CONFIG_VIDEO_DEV is not set 768# CONFIG_VIDEO_DEV is not set
@@ -818,6 +811,19 @@ CONFIG_USB_ARCH_HAS_EHCI=y
818# CONFIG_MMC is not set 811# CONFIG_MMC is not set
819 812
820# 813#
814# LED devices
815#
816# CONFIG_NEW_LEDS is not set
817
818#
819# LED drivers
820#
821
822#
823# LED Triggers
824#
825
826#
821# InfiniBand support 827# InfiniBand support
822# 828#
823CONFIG_INFINIBAND=y 829CONFIG_INFINIBAND=y
@@ -834,6 +840,11 @@ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y
834# 840#
835 841
836# 842#
843# Real Time Clock
844#
845# CONFIG_RTC_CLASS is not set
846
847#
837# File systems 848# File systems
838# 849#
839CONFIG_EXT2_FS=y 850CONFIG_EXT2_FS=y
@@ -889,7 +900,6 @@ CONFIG_TMPFS=y
889CONFIG_HUGETLBFS=y 900CONFIG_HUGETLBFS=y
890CONFIG_HUGETLB_PAGE=y 901CONFIG_HUGETLB_PAGE=y
891CONFIG_RAMFS=y 902CONFIG_RAMFS=y
892# CONFIG_RELAYFS_FS is not set
893# CONFIG_CONFIGFS_FS is not set 903# CONFIG_CONFIGFS_FS is not set
894 904
895# 905#
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 39e348a3ade2..3f7182db9ed5 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -57,6 +57,8 @@ extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
57 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) 57 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
58#define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\ 58#define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\
59 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) 59 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
60#define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\
61 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
60#define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ 62#define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
61 PPC_FEATURE_BOOKE) 63 PPC_FEATURE_BOOKE)
62 64
@@ -263,6 +265,20 @@ struct cpu_spec cpu_specs[] = {
263 .oprofile_type = PPC_OPROFILE_POWER4, 265 .oprofile_type = PPC_OPROFILE_POWER4,
264 .platform = "power5+", 266 .platform = "power5+",
265 }, 267 },
268 { /* Power6 */
269 .pvr_mask = 0xffff0000,
270 .pvr_value = 0x003e0000,
271 .cpu_name = "POWER6",
272 .cpu_features = CPU_FTRS_POWER6,
273 .cpu_user_features = COMMON_USER_POWER6,
274 .icache_bsize = 128,
275 .dcache_bsize = 128,
276 .num_pmcs = 6,
277 .cpu_setup = __setup_cpu_power4,
278 .oprofile_cpu_type = "ppc64/power6",
279 .oprofile_type = PPC_OPROFILE_POWER4,
280 .platform = "power6",
281 },
266 { /* Cell Broadband Engine */ 282 { /* Cell Broadband Engine */
267 .pvr_mask = 0xffff0000, 283 .pvr_mask = 0xffff0000,
268 .pvr_value = 0x00700000, 284 .pvr_value = 0x00700000,
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 928b8581fcb0..ba34001fca8e 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -191,11 +191,19 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
191 (void *)hdr 191 (void *)hdr
192 + sechdrs[sechdrs[i].sh_link].sh_offset); 192 + sechdrs[sechdrs[i].sh_link].sh_offset);
193 } 193 }
194 if (!me->arch.stubs_section || !me->arch.toc_section) { 194
195 printk("%s: doesn't contain .toc or .stubs.\n", me->name); 195 if (!me->arch.stubs_section) {
196 printk("%s: doesn't contain .stubs.\n", me->name);
196 return -ENOEXEC; 197 return -ENOEXEC;
197 } 198 }
198 199
200 /* If we don't have a .toc, just use .stubs. We need to set r2
201 to some reasonable value in case the module calls out to
202 other functions via a stub, or if a function pointer escapes
203 the module by some means. */
204 if (!me->arch.toc_section)
205 me->arch.toc_section = me->arch.stubs_section;
206
199 /* Override the stubs size */ 207 /* Override the stubs size */
200 sechdrs[me->arch.stubs_section].sh_size = get_stubs_size(hdr, sechdrs); 208 sechdrs[me->arch.stubs_section].sh_size = get_stubs_size(hdr, sechdrs);
201 return 0; 209 return 0;
@@ -342,7 +350,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
342 break; 350 break;
343 351
344 case R_PPC64_TOC16: 352 case R_PPC64_TOC16:
345 /* Subtact TOC pointer */ 353 /* Subtract TOC pointer */
346 value -= my_r2(sechdrs, me); 354 value -= my_r2(sechdrs, me);
347 if (value + 0x8000 > 0xffff) { 355 if (value + 0x8000 > 0xffff) {
348 printk("%s: bad TOC16 relocation (%lu)\n", 356 printk("%s: bad TOC16 relocation (%lu)\n",
@@ -355,7 +363,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
355 break; 363 break;
356 364
357 case R_PPC64_TOC16_DS: 365 case R_PPC64_TOC16_DS:
358 /* Subtact TOC pointer */ 366 /* Subtract TOC pointer */
359 value -= my_r2(sechdrs, me); 367 value -= my_r2(sechdrs, me);
360 if ((value & 3) != 0 || value + 0x8000 > 0xffff) { 368 if ((value & 3) != 0 || value + 0x8000 > 0xffff) {
361 printk("%s: bad TOC16_DS relocation (%lu)\n", 369 printk("%s: bad TOC16_DS relocation (%lu)\n",
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 7e4d54821a07..078fb5533541 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -636,10 +636,96 @@ static void __init early_cmdline_parse(void)
636 636
637#ifdef CONFIG_PPC_PSERIES 637#ifdef CONFIG_PPC_PSERIES
638/* 638/*
639 * To tell the firmware what our capabilities are, we have to pass 639 * There are two methods for telling firmware what our capabilities are.
640 * it a fake 32-bit ELF header containing a couple of PT_NOTE sections 640 * Newer machines have an "ibm,client-architecture-support" method on the
641 * that contain structures that contain the actual values. 641 * root node. For older machines, we have to call the "process-elf-header"
642 * method in the /packages/elf-loader node, passing it a fake 32-bit
643 * ELF header containing a couple of PT_NOTE sections that contain
644 * structures that contain various information.
642 */ 645 */
646
647/*
648 * New method - extensible architecture description vector.
649 *
650 * Because the description vector contains a mix of byte and word
651 * values, we declare it as an unsigned char array, and use this
652 * macro to put word values in.
653 */
654#define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \
655 ((x) >> 8) & 0xff, (x) & 0xff
656
657/* Option vector bits - generic bits in byte 1 */
658#define OV_IGNORE 0x80 /* ignore this vector */
659#define OV_CESSATION_POLICY 0x40 /* halt if unsupported option present*/
660
661/* Option vector 1: processor architectures supported */
662#define OV1_PPC_2_00 0x80 /* set if we support PowerPC 2.00 */
663#define OV1_PPC_2_01 0x40 /* set if we support PowerPC 2.01 */
664#define OV1_PPC_2_02 0x20 /* set if we support PowerPC 2.02 */
665#define OV1_PPC_2_03 0x10 /* set if we support PowerPC 2.03 */
666#define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */
667#define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */
668
669/* Option vector 2: Open Firmware options supported */
670#define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */
671
672/* Option vector 3: processor options supported */
673#define OV3_FP 0x80 /* floating point */
674#define OV3_VMX 0x40 /* VMX/Altivec */
675
676/* Option vector 5: PAPR/OF options supported */
677#define OV5_LPAR 0x80 /* logical partitioning supported */
678#define OV5_SPLPAR 0x40 /* shared-processor LPAR supported */
679/* ibm,dynamic-reconfiguration-memory property supported */
680#define OV5_DRCONF_MEMORY 0x20
681#define OV5_LARGE_PAGES 0x10 /* large pages supported */
682
683/*
684 * The architecture vector has an array of PVR mask/value pairs,
685 * followed by # option vectors - 1, followed by the option vectors.
686 */
687static unsigned char ibm_architecture_vec[] = {
688 W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */
689 W(0xffff0000), W(0x003e0000), /* POWER6 */
690 W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */
691 5 - 1, /* 5 option vectors */
692
693 /* option vector 1: processor architectures supported */
694 3 - 1, /* length */
695 0, /* don't ignore, don't halt */
696 OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 |
697 OV1_PPC_2_04 | OV1_PPC_2_05,
698
699 /* option vector 2: Open Firmware options supported */
700 34 - 1, /* length */
701 OV2_REAL_MODE,
702 0, 0,
703 W(0xffffffff), /* real_base */
704 W(0xffffffff), /* real_size */
705 W(0xffffffff), /* virt_base */
706 W(0xffffffff), /* virt_size */
707 W(0xffffffff), /* load_base */
708 W(64), /* 128MB min RMA */
709 W(0xffffffff), /* full client load */
710 0, /* min RMA percentage of total RAM */
711 48, /* max log_2(hash table size) */
712
713 /* option vector 3: processor options supported */
714 3 - 1, /* length */
715 0, /* don't ignore, don't halt */
716 OV3_FP | OV3_VMX,
717
718 /* option vector 4: IBM PAPR implementation */
719 2 - 1, /* length */
720 0, /* don't halt */
721
722 /* option vector 5: PAPR/OF options */
723 3 - 1, /* length */
724 0, /* don't ignore, don't halt */
725 OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES,
726};
727
728/* Old method - ELF header with PT_NOTE sections */
643static struct fake_elf { 729static struct fake_elf {
644 Elf32_Ehdr elfhdr; 730 Elf32_Ehdr elfhdr;
645 Elf32_Phdr phdr[2]; 731 Elf32_Phdr phdr[2];
@@ -728,8 +814,26 @@ static struct fake_elf {
728 814
729static void __init prom_send_capabilities(void) 815static void __init prom_send_capabilities(void)
730{ 816{
731 ihandle elfloader; 817 ihandle elfloader, root;
818 prom_arg_t ret;
819
820 root = call_prom("open", 1, 1, ADDR("/"));
821 if (root != 0) {
822 /* try calling the ibm,client-architecture-support method */
823 if (call_prom_ret("call-method", 3, 2, &ret,
824 ADDR("ibm,client-architecture-support"),
825 ADDR(ibm_architecture_vec)) == 0) {
826 /* the call exists... */
827 if (ret)
828 prom_printf("WARNING: ibm,client-architecture"
829 "-support call FAILED!\n");
830 call_prom("close", 1, 0, root);
831 return;
832 }
833 call_prom("close", 1, 0, root);
834 }
732 835
836 /* no ibm,client-architecture-support call, try the old way */
733 elfloader = call_prom("open", 1, 1, ADDR("/packages/elf-loader")); 837 elfloader = call_prom("open", 1, 1, ADDR("/packages/elf-loader"));
734 if (elfloader == 0) { 838 if (elfloader == 0) {
735 prom_printf("couldn't open /packages/elf-loader\n"); 839 prom_printf("couldn't open /packages/elf-loader\n");
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 1d93e73a7003..684ab1d49c65 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -516,3 +516,11 @@ void probe_machine(void)
516 516
517 printk(KERN_INFO "Using %s machine description\n", ppc_md.name); 517 printk(KERN_INFO "Using %s machine description\n", ppc_md.name);
518} 518}
519
520int check_legacy_ioport(unsigned long base_port)
521{
522 if (ppc_md.check_legacy_ioport == NULL)
523 return 0;
524 return ppc_md.check_legacy_ioport(base_port);
525}
526EXPORT_SYMBOL(check_legacy_ioport);
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 13e91c4d70a8..4467c49903b6 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -594,14 +594,6 @@ void ppc64_terminate_msg(unsigned int src, const char *msg)
594 printk("[terminate]%04x %s\n", src, msg); 594 printk("[terminate]%04x %s\n", src, msg);
595} 595}
596 596
597int check_legacy_ioport(unsigned long base_port)
598{
599 if (ppc_md.check_legacy_ioport == NULL)
600 return 0;
601 return ppc_md.check_legacy_ioport(base_port);
602}
603EXPORT_SYMBOL(check_legacy_ioport);
604
605void cpu_die(void) 597void cpu_die(void)
606{ 598{
607 if (ppc_md.cpu_die) 599 if (ppc_md.cpu_die)
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index 0b98eea73c5e..cf56a1d499ff 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -325,6 +325,19 @@ SYSCALL(unshare)
325SYSCALL(splice) 325SYSCALL(splice)
326SYSCALL(tee) 326SYSCALL(tee)
327SYSCALL(vmsplice) 327SYSCALL(vmsplice)
328COMPAT_SYS(openat)
329SYSCALL(mkdirat)
330SYSCALL(mknodat)
331SYSCALL(fchownat)
332COMPAT_SYS(futimesat)
333SYSX(sys_newfstatat, sys_fstatat64, sys_fstatat64)
334SYSCALL(unlinkat)
335SYSCALL(renameat)
336SYSCALL(linkat)
337SYSCALL(symlinkat)
338SYSCALL(readlinkat)
339SYSCALL(fchmodat)
340SYSCALL(faccessat)
328 341
329/* 342/*
330 * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c 343 * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 7370f9f33e29..266b8b2ceac9 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -30,13 +30,66 @@
30#define NUM_LOW_AREAS (0x100000000UL >> SID_SHIFT) 30#define NUM_LOW_AREAS (0x100000000UL >> SID_SHIFT)
31#define NUM_HIGH_AREAS (PGTABLE_RANGE >> HTLB_AREA_SHIFT) 31#define NUM_HIGH_AREAS (PGTABLE_RANGE >> HTLB_AREA_SHIFT)
32 32
33#ifdef CONFIG_PPC_64K_PAGES
34#define HUGEPTE_INDEX_SIZE (PMD_SHIFT-HPAGE_SHIFT)
35#else
36#define HUGEPTE_INDEX_SIZE (PUD_SHIFT-HPAGE_SHIFT)
37#endif
38#define PTRS_PER_HUGEPTE (1 << HUGEPTE_INDEX_SIZE)
39#define HUGEPTE_TABLE_SIZE (sizeof(pte_t) << HUGEPTE_INDEX_SIZE)
40
41#define HUGEPD_SHIFT (HPAGE_SHIFT + HUGEPTE_INDEX_SIZE)
42#define HUGEPD_SIZE (1UL << HUGEPD_SHIFT)
43#define HUGEPD_MASK (~(HUGEPD_SIZE-1))
44
45#define huge_pgtable_cache (pgtable_cache[HUGEPTE_CACHE_NUM])
46
47/* Flag to mark huge PD pointers. This means pmd_bad() and pud_bad()
48 * will choke on pointers to hugepte tables, which is handy for
49 * catching screwups early. */
50#define HUGEPD_OK 0x1
51
52typedef struct { unsigned long pd; } hugepd_t;
53
54#define hugepd_none(hpd) ((hpd).pd == 0)
55
56static inline pte_t *hugepd_page(hugepd_t hpd)
57{
58 BUG_ON(!(hpd.pd & HUGEPD_OK));
59 return (pte_t *)(hpd.pd & ~HUGEPD_OK);
60}
61
62static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr)
63{
64 unsigned long idx = ((addr >> HPAGE_SHIFT) & (PTRS_PER_HUGEPTE-1));
65 pte_t *dir = hugepd_page(*hpdp);
66
67 return dir + idx;
68}
69
70static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
71 unsigned long address)
72{
73 pte_t *new = kmem_cache_alloc(huge_pgtable_cache,
74 GFP_KERNEL|__GFP_REPEAT);
75
76 if (! new)
77 return -ENOMEM;
78
79 spin_lock(&mm->page_table_lock);
80 if (!hugepd_none(*hpdp))
81 kmem_cache_free(huge_pgtable_cache, new);
82 else
83 hpdp->pd = (unsigned long)new | HUGEPD_OK;
84 spin_unlock(&mm->page_table_lock);
85 return 0;
86}
87
33/* Modelled after find_linux_pte() */ 88/* Modelled after find_linux_pte() */
34pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) 89pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
35{ 90{
36 pgd_t *pg; 91 pgd_t *pg;
37 pud_t *pu; 92 pud_t *pu;
38 pmd_t *pm;
39 pte_t *pt;
40 93
41 BUG_ON(! in_hugepage_area(mm->context, addr)); 94 BUG_ON(! in_hugepage_area(mm->context, addr));
42 95
@@ -46,26 +99,14 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
46 if (!pgd_none(*pg)) { 99 if (!pgd_none(*pg)) {
47 pu = pud_offset(pg, addr); 100 pu = pud_offset(pg, addr);
48 if (!pud_none(*pu)) { 101 if (!pud_none(*pu)) {
49 pm = pmd_offset(pu, addr);
50#ifdef CONFIG_PPC_64K_PAGES 102#ifdef CONFIG_PPC_64K_PAGES
51 /* Currently, we use the normal PTE offset within full 103 pmd_t *pm;
52 * size PTE pages, thus our huge PTEs are scattered in 104 pm = pmd_offset(pu, addr);
53 * the PTE page and we do waste some. We may change 105 if (!pmd_none(*pm))
54 * that in the future, but the current mecanism keeps 106 return hugepte_offset((hugepd_t *)pm, addr);
55 * things much simpler 107#else
56 */ 108 return hugepte_offset((hugepd_t *)pu, addr);
57 if (!pmd_none(*pm)) { 109#endif
58 /* Note: pte_offset_* are all equivalent on
59 * ppc64 as we don't have HIGHMEM
60 */
61 pt = pte_offset_kernel(pm, addr);
62 return pt;
63 }
64#else /* CONFIG_PPC_64K_PAGES */
65 /* On 4k pages, we put huge PTEs in the PMD page */
66 pt = (pte_t *)pm;
67 return pt;
68#endif /* CONFIG_PPC_64K_PAGES */
69 } 110 }
70 } 111 }
71 112
@@ -76,8 +117,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
76{ 117{
77 pgd_t *pg; 118 pgd_t *pg;
78 pud_t *pu; 119 pud_t *pu;
79 pmd_t *pm; 120 hugepd_t *hpdp = NULL;
80 pte_t *pt;
81 121
82 BUG_ON(! in_hugepage_area(mm->context, addr)); 122 BUG_ON(! in_hugepage_area(mm->context, addr));
83 123
@@ -87,23 +127,182 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
87 pu = pud_alloc(mm, pg, addr); 127 pu = pud_alloc(mm, pg, addr);
88 128
89 if (pu) { 129 if (pu) {
130#ifdef CONFIG_PPC_64K_PAGES
131 pmd_t *pm;
90 pm = pmd_alloc(mm, pu, addr); 132 pm = pmd_alloc(mm, pu, addr);
91 if (pm) { 133 if (pm)
134 hpdp = (hugepd_t *)pm;
135#else
136 hpdp = (hugepd_t *)pu;
137#endif
138 }
139
140 if (! hpdp)
141 return NULL;
142
143 if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr))
144 return NULL;
145
146 return hugepte_offset(hpdp, addr);
147}
148
149static void free_hugepte_range(struct mmu_gather *tlb, hugepd_t *hpdp)
150{
151 pte_t *hugepte = hugepd_page(*hpdp);
152
153 hpdp->pd = 0;
154 tlb->need_flush = 1;
155 pgtable_free_tlb(tlb, pgtable_free_cache(hugepte, HUGEPTE_CACHE_NUM,
156 HUGEPTE_TABLE_SIZE-1));
157}
158
92#ifdef CONFIG_PPC_64K_PAGES 159#ifdef CONFIG_PPC_64K_PAGES
93 /* See comment in huge_pte_offset. Note that if we ever 160static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
94 * want to put the page size in the PMD, we would have 161 unsigned long addr, unsigned long end,
95 * to open code our own pte_alloc* function in order 162 unsigned long floor, unsigned long ceiling)
96 * to populate and set the size atomically 163{
97 */ 164 pmd_t *pmd;
98 pt = pte_alloc_map(mm, pm, addr); 165 unsigned long next;
99#else /* CONFIG_PPC_64K_PAGES */ 166 unsigned long start;
100 pt = (pte_t *)pm; 167
101#endif /* CONFIG_PPC_64K_PAGES */ 168 start = addr;
102 return pt; 169 pmd = pmd_offset(pud, addr);
103 } 170 do {
171 next = pmd_addr_end(addr, end);
172 if (pmd_none(*pmd))
173 continue;
174 free_hugepte_range(tlb, (hugepd_t *)pmd);
175 } while (pmd++, addr = next, addr != end);
176
177 start &= PUD_MASK;
178 if (start < floor)
179 return;
180 if (ceiling) {
181 ceiling &= PUD_MASK;
182 if (!ceiling)
183 return;
104 } 184 }
185 if (end - 1 > ceiling - 1)
186 return;
105 187
106 return NULL; 188 pmd = pmd_offset(pud, start);
189 pud_clear(pud);
190 pmd_free_tlb(tlb, pmd);
191}
192#endif
193
194static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
195 unsigned long addr, unsigned long end,
196 unsigned long floor, unsigned long ceiling)
197{
198 pud_t *pud;
199 unsigned long next;
200 unsigned long start;
201
202 start = addr;
203 pud = pud_offset(pgd, addr);
204 do {
205 next = pud_addr_end(addr, end);
206#ifdef CONFIG_PPC_64K_PAGES
207 if (pud_none_or_clear_bad(pud))
208 continue;
209 hugetlb_free_pmd_range(tlb, pud, addr, next, floor, ceiling);
210#else
211 if (pud_none(*pud))
212 continue;
213 free_hugepte_range(tlb, (hugepd_t *)pud);
214#endif
215 } while (pud++, addr = next, addr != end);
216
217 start &= PGDIR_MASK;
218 if (start < floor)
219 return;
220 if (ceiling) {
221 ceiling &= PGDIR_MASK;
222 if (!ceiling)
223 return;
224 }
225 if (end - 1 > ceiling - 1)
226 return;
227
228 pud = pud_offset(pgd, start);
229 pgd_clear(pgd);
230 pud_free_tlb(tlb, pud);
231}
232
233/*
234 * This function frees user-level page tables of a process.
235 *
236 * Must be called with pagetable lock held.
237 */
238void hugetlb_free_pgd_range(struct mmu_gather **tlb,
239 unsigned long addr, unsigned long end,
240 unsigned long floor, unsigned long ceiling)
241{
242 pgd_t *pgd;
243 unsigned long next;
244 unsigned long start;
245
246 /*
247 * Comments below take from the normal free_pgd_range(). They
248 * apply here too. The tests against HUGEPD_MASK below are
249 * essential, because we *don't* test for this at the bottom
250 * level. Without them we'll attempt to free a hugepte table
251 * when we unmap just part of it, even if there are other
252 * active mappings using it.
253 *
254 * The next few lines have given us lots of grief...
255 *
256 * Why are we testing HUGEPD* at this top level? Because
257 * often there will be no work to do at all, and we'd prefer
258 * not to go all the way down to the bottom just to discover
259 * that.
260 *
261 * Why all these "- 1"s? Because 0 represents both the bottom
262 * of the address space and the top of it (using -1 for the
263 * top wouldn't help much: the masks would do the wrong thing).
264 * The rule is that addr 0 and floor 0 refer to the bottom of
265 * the address space, but end 0 and ceiling 0 refer to the top
266 * Comparisons need to use "end - 1" and "ceiling - 1" (though
267 * that end 0 case should be mythical).
268 *
269 * Wherever addr is brought up or ceiling brought down, we
270 * must be careful to reject "the opposite 0" before it
271 * confuses the subsequent tests. But what about where end is
272 * brought down by HUGEPD_SIZE below? no, end can't go down to
273 * 0 there.
274 *
275 * Whereas we round start (addr) and ceiling down, by different
276 * masks at different levels, in order to test whether a table
277 * now has no other vmas using it, so can be freed, we don't
278 * bother to round floor or end up - the tests don't need that.
279 */
280
281 addr &= HUGEPD_MASK;
282 if (addr < floor) {
283 addr += HUGEPD_SIZE;
284 if (!addr)
285 return;
286 }
287 if (ceiling) {
288 ceiling &= HUGEPD_MASK;
289 if (!ceiling)
290 return;
291 }
292 if (end - 1 > ceiling - 1)
293 end -= HUGEPD_SIZE;
294 if (addr > end - 1)
295 return;
296
297 start = addr;
298 pgd = pgd_offset((*tlb)->mm, addr);
299 do {
300 BUG_ON(! in_hugepage_area((*tlb)->mm->context, addr));
301 next = pgd_addr_end(addr, end);
302 if (pgd_none_or_clear_bad(pgd))
303 continue;
304 hugetlb_free_pud_range(*tlb, pgd, addr, next, floor, ceiling);
305 } while (pgd++, addr = next, addr != end);
107} 306}
108 307
109void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, 308void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
@@ -841,3 +1040,27 @@ repeat:
841 out: 1040 out:
842 return err; 1041 return err;
843} 1042}
1043
1044static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags)
1045{
1046 memset(addr, 0, kmem_cache_size(cache));
1047}
1048
1049static int __init hugetlbpage_init(void)
1050{
1051 if (!cpu_has_feature(CPU_FTR_16M_PAGE))
1052 return -ENODEV;
1053
1054 huge_pgtable_cache = kmem_cache_create("hugepte_cache",
1055 HUGEPTE_TABLE_SIZE,
1056 HUGEPTE_TABLE_SIZE,
1057 SLAB_HWCACHE_ALIGN |
1058 SLAB_MUST_HWCACHE_ALIGN,
1059 zero_ctor, NULL);
1060 if (! huge_pgtable_cache)
1061 panic("hugetlbpage_init(): could not create hugepte cache\n");
1062
1063 return 0;
1064}
1065
1066module_init(hugetlbpage_init);
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index babebd15bdc4..9e30f968c184 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -162,7 +162,14 @@ static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = {
162}; 162};
163#endif /* CONFIG_PPC_64K_PAGES */ 163#endif /* CONFIG_PPC_64K_PAGES */
164 164
165#ifdef CONFIG_HUGETLB_PAGE
166/* Hugepages need one extra cache, initialized in hugetlbpage.c. We
167 * can't put into the tables above, because HPAGE_SHIFT is not compile
168 * time constant. */
169kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)+1];
170#else
165kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)]; 171kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)];
172#endif
166 173
167void pgtable_cache_init(void) 174void pgtable_cache_init(void)
168{ 175{
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 269dda4fd0b4..ef47a6239d48 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -306,19 +306,19 @@ spu_request_irqs(struct spu *spu)
306 306
307 snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0", spu->number); 307 snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0", spu->number);
308 ret = request_irq(irq_base + spu->isrc, 308 ret = request_irq(irq_base + spu->isrc,
309 spu_irq_class_0, 0, spu->irq_c0, spu); 309 spu_irq_class_0, SA_INTERRUPT, spu->irq_c0, spu);
310 if (ret) 310 if (ret)
311 goto out; 311 goto out;
312 312
313 snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1", spu->number); 313 snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1", spu->number);
314 ret = request_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc, 314 ret = request_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc,
315 spu_irq_class_1, 0, spu->irq_c1, spu); 315 spu_irq_class_1, SA_INTERRUPT, spu->irq_c1, spu);
316 if (ret) 316 if (ret)
317 goto out1; 317 goto out1;
318 318
319 snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2", spu->number); 319 snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2", spu->number);
320 ret = request_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc, 320 ret = request_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc,
321 spu_irq_class_2, 0, spu->irq_c2, spu); 321 spu_irq_class_2, SA_INTERRUPT, spu->irq_c2, spu);
322 if (ret) 322 if (ret)
323 goto out2; 323 goto out2;
324 goto out; 324 goto out;
@@ -487,10 +487,14 @@ int spu_irq_class_1_bottom(struct spu *spu)
487 ea = spu->dar; 487 ea = spu->dar;
488 dsisr = spu->dsisr; 488 dsisr = spu->dsisr;
489 if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) { 489 if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) {
490 u64 flags;
491
490 access = (_PAGE_PRESENT | _PAGE_USER); 492 access = (_PAGE_PRESENT | _PAGE_USER);
491 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL; 493 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL;
494 local_irq_save(flags);
492 if (hash_page(ea, access, 0x300) != 0) 495 if (hash_page(ea, access, 0x300) != 0)
493 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR; 496 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR;
497 local_irq_restore(flags);
494 } 498 }
495 if (error & CLASS1_ENABLE_STORAGE_FAULT_INTR) { 499 if (error & CLASS1_ENABLE_STORAGE_FAULT_INTR) {
496 if ((ret = spu_handle_mm_fault(spu)) != 0) 500 if ((ret = spu_handle_mm_fault(spu)) != 0)
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c
index b283380a2a18..95b36430aa0f 100644
--- a/arch/powerpc/platforms/cell/spu_callbacks.c
+++ b/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -319,6 +319,19 @@ void *spu_syscall_table[] = {
319 [__NR_splice] sys_splice, 319 [__NR_splice] sys_splice,
320 [__NR_tee] sys_tee, 320 [__NR_tee] sys_tee,
321 [__NR_vmsplice] sys_vmsplice, 321 [__NR_vmsplice] sys_vmsplice,
322 [__NR_openat] sys_openat,
323 [__NR_mkdirat] sys_mkdirat,
324 [__NR_mknodat] sys_mknodat,
325 [__NR_fchownat] sys_fchownat,
326 [__NR_futimesat] sys_futimesat,
327 [__NR_newfstatat] sys_newfstatat,
328 [__NR_unlinkat] sys_unlinkat,
329 [__NR_renameat] sys_renameat,
330 [__NR_linkat] sys_linkat,
331 [__NR_symlinkat] sys_symlinkat,
332 [__NR_readlinkat] sys_readlinkat,
333 [__NR_fchmodat] sys_fchmodat,
334 [__NR_faccessat] sys_faccessat,
322}; 335};
323 336
324long spu_sys_callback(struct spu_syscall_block *s) 337long spu_sys_callback(struct spu_syscall_block *s)
diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
index f841972f1fa9..554776d4b8ac 100644
--- a/arch/ppc/platforms/4xx/ocotea.c
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -331,7 +331,7 @@ static void __init ocotea_init(void)
331void __init platform_init(unsigned long r3, unsigned long r4, 331void __init platform_init(unsigned long r3, unsigned long r4,
332 unsigned long r5, unsigned long r6, unsigned long r7) 332 unsigned long r5, unsigned long r6, unsigned long r7)
333{ 333{
334 ibm44x_platform_init(r3, r4, r5, r6, r7); 334 ibm440gx_platform_init(r3, r4, r5, r6, r7);
335 335
336 ppc_md.setup_arch = ocotea_setup_arch; 336 ppc_md.setup_arch = ocotea_setup_arch;
337 ppc_md.show_cpuinfo = ocotea_show_cpuinfo; 337 ppc_md.show_cpuinfo = ocotea_show_cpuinfo;
diff --git a/arch/ppc/platforms/mpc8272ads_setup.c b/arch/ppc/platforms/mpc8272ads_setup.c
index bc9b94f77e39..e62b75707f7a 100644
--- a/arch/ppc/platforms/mpc8272ads_setup.c
+++ b/arch/ppc/platforms/mpc8272ads_setup.c
@@ -26,11 +26,35 @@
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/ppc_sys.h> 27#include <asm/ppc_sys.h>
28#include <asm/ppcboot.h> 28#include <asm/ppcboot.h>
29#include <linux/fs_uart_pd.h>
29 30
30#include "pq2ads_pd.h" 31#include "pq2ads_pd.h"
31 32
32static void init_fcc1_ioports(void); 33static void init_fcc1_ioports(void);
33static void init_fcc2_ioports(void); 34static void init_fcc2_ioports(void);
35static void init_scc1_uart_ioports(void);
36static void init_scc4_uart_ioports(void);
37
38static struct fs_uart_platform_info mpc8272_uart_pdata[] = {
39 [fsid_scc1_uart] = {
40 .init_ioports = init_scc1_uart_ioports,
41 .fs_no = fsid_scc1_uart,
42 .brg = 1,
43 .tx_num_fifo = 4,
44 .tx_buf_size = 32,
45 .rx_num_fifo = 4,
46 .rx_buf_size = 32,
47 },
48 [fsid_scc4_uart] = {
49 .init_ioports = init_scc4_uart_ioports,
50 .fs_no = fsid_scc4_uart,
51 .brg = 4,
52 .tx_num_fifo = 4,
53 .tx_buf_size = 32,
54 .rx_num_fifo = 4,
55 .rx_buf_size = 32,
56 },
57};
34 58
35static struct fs_mii_bus_info mii_bus_info = { 59static struct fs_mii_bus_info mii_bus_info = {
36 .method = fsmii_bitbang, 60 .method = fsmii_bitbang,
@@ -201,6 +225,55 @@ static void __init mpc8272ads_fixup_enet_pdata(struct platform_device *pdev,
201 } 225 }
202} 226}
203 227
228static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev,
229 int idx)
230{
231 bd_t *bd = (bd_t *) __res;
232 struct fs_uart_platform_info *pinfo;
233 int num = ARRAY_SIZE(mpc8272_uart_pdata);
234 int id = fs_uart_id_scc2fsid(idx);
235
236 /* no need to alter anything if console */
237 if ((id <= num) && (!pdev->dev.platform_data)) {
238 pinfo = &mpc8272_uart_pdata[id];
239 pinfo->uart_clk = bd->bi_intfreq;
240 pdev->dev.platform_data = pinfo;
241 }
242}
243
244static void init_scc1_uart_ioports(void)
245{
246 cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t));
247
248 /* SCC1 is only on port D */
249 setbits32(&immap->im_ioport.iop_ppard,0x00000003);
250 clrbits32(&immap->im_ioport.iop_psord,0x00000001);
251 setbits32(&immap->im_ioport.iop_psord,0x00000002);
252 clrbits32(&immap->im_ioport.iop_pdird,0x00000001);
253 setbits32(&immap->im_ioport.iop_pdird,0x00000002);
254
255 /* Wire BRG1 to SCC1 */
256 clrbits32(&immap->im_cpmux.cmx_scr,0x00ffffff);
257
258 iounmap(immap);
259}
260
261static void init_scc4_uart_ioports(void)
262{
263 cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t));
264
265 setbits32(&immap->im_ioport.iop_ppard,0x00000600);
266 clrbits32(&immap->im_ioport.iop_psord,0x00000600);
267 clrbits32(&immap->im_ioport.iop_pdird,0x00000200);
268 setbits32(&immap->im_ioport.iop_pdird,0x00000400);
269
270 /* Wire BRG4 to SCC4 */
271 clrbits32(&immap->im_cpmux.cmx_scr,0x000000ff);
272 setbits32(&immap->im_cpmux.cmx_scr,0x0000001b);
273
274 iounmap(immap);
275}
276
204static int mpc8272ads_platform_notify(struct device *dev) 277static int mpc8272ads_platform_notify(struct device *dev)
205{ 278{
206 static const struct platform_notify_dev_map dev_map[] = { 279 static const struct platform_notify_dev_map dev_map[] = {
@@ -209,6 +282,10 @@ static int mpc8272ads_platform_notify(struct device *dev)
209 .rtn = mpc8272ads_fixup_enet_pdata 282 .rtn = mpc8272ads_fixup_enet_pdata
210 }, 283 },
211 { 284 {
285 .bus_id = "fsl-cpm-scc:uart",
286 .rtn = mpc
287 },
288 {
212 .bus_id = NULL 289 .bus_id = NULL
213 } 290 }
214 }; 291 };
@@ -230,7 +307,44 @@ int __init mpc8272ads_init(void)
230 ppc_sys_device_enable(MPC82xx_CPM_FCC1); 307 ppc_sys_device_enable(MPC82xx_CPM_FCC1);
231 ppc_sys_device_enable(MPC82xx_CPM_FCC2); 308 ppc_sys_device_enable(MPC82xx_CPM_FCC2);
232 309
310 /* to be ready for console, let's attach pdata here */
311#ifdef CONFIG_SERIAL_CPM_SCC1
312 ppc_sys_device_setfunc(MPC82xx_CPM_SCC1, PPC_SYS_FUNC_UART);
313 ppc_sys_device_enable(MPC82xx_CPM_SCC1);
314
315#endif
316
317#ifdef CONFIG_SERIAL_CPM_SCC4
318 ppc_sys_device_setfunc(MPC82xx_CPM_SCC4, PPC_SYS_FUNC_UART);
319 ppc_sys_device_enable(MPC82xx_CPM_SCC4);
320#endif
321
322
233 return 0; 323 return 0;
234} 324}
235 325
326/*
327 To prevent confusion, console selection is gross:
328 by 0 assumed SCC1 and by 1 assumed SCC4
329 */
330struct platform_device* early_uart_get_pdev(int index)
331{
332 bd_t *bd = (bd_t *) __res;
333 struct fs_uart_platform_info *pinfo;
334
335 struct platform_device* pdev = NULL;
336 if(index) { /*assume SCC4 here*/
337 pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC4];
338 pinfo = &mpc8272<F12>_uart_pdata[1];
339 } else { /*over SCC1*/
340 pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC1];
341 pinfo = &mpc8272_uart_pdata[0];
342 }
343
344 pinfo->uart_clk = bd->bi_intfreq;
345 pdev->dev.platform_data = pinfo;
346 ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR);
347 return NULL;
348}
349
236arch_initcall(mpc8272ads_init); 350arch_initcall(mpc8272ads_init);
diff --git a/arch/ppc/platforms/mpc866ads_setup.c b/arch/ppc/platforms/mpc866ads_setup.c
index ac8fcc68afeb..6ce3b842defe 100644
--- a/arch/ppc/platforms/mpc866ads_setup.c
+++ b/arch/ppc/platforms/mpc866ads_setup.c
@@ -20,6 +20,7 @@
20#include <linux/device.h> 20#include <linux/device.h>
21 21
22#include <linux/fs_enet_pd.h> 22#include <linux/fs_enet_pd.h>
23#include <linux/fs_uart_pd.h>
23#include <linux/mii.h> 24#include <linux/mii.h>
24 25
25#include <asm/delay.h> 26#include <asm/delay.h>
@@ -37,6 +38,11 @@
37 38
38extern unsigned char __res[]; 39extern unsigned char __res[];
39 40
41static void setup_fec1_ioports(void);
42static void setup_scc1_ioports(void);
43static void setup_smc1_ioports(void);
44static void setup_smc2_ioports(void);
45
40static struct fs_mii_bus_info fec_mii_bus_info = { 46static struct fs_mii_bus_info fec_mii_bus_info = {
41 .method = fsmii_fec, 47 .method = fsmii_fec,
42 .id = 0, 48 .id = 0,
@@ -79,6 +85,28 @@ static struct fs_platform_info mpc8xx_scc_pdata = {
79 .phy_irq = -1, 85 .phy_irq = -1,
80 86
81 .bus_info = &scc_mii_bus_info, 87 .bus_info = &scc_mii_bus_info,
88
89};
90
91static struct fs_uart_platform_info mpc866_uart_pdata[] = {
92 [fsid_smc1_uart] = {
93 .brg = 1,
94 .fs_no = fsid_smc1_uart,
95 .init_ioports = setup_smc1_ioports,
96 .tx_num_fifo = 4,
97 .tx_buf_size = 32,
98 .rx_num_fifo = 4,
99 .rx_buf_size = 32,
100 },
101 [fsid_smc2_uart] = {
102 .brg = 2,
103 .fs_no = fsid_smc2_uart,
104 .init_ioports = setup_smc2_ioports,
105 .tx_num_fifo = 4,
106 .tx_buf_size = 32,
107 .rx_num_fifo = 4,
108 .rx_buf_size = 32,
109 },
82}; 110};
83 111
84void __init board_init(void) 112void __init board_init(void)
@@ -92,9 +120,12 @@ void __init board_init(void)
92 printk(KERN_CRIT "Could not remap BCSR1\n"); 120 printk(KERN_CRIT "Could not remap BCSR1\n");
93 return; 121 return;
94 } 122 }
123
95#ifdef CONFIG_SERIAL_CPM_SMC1 124#ifdef CONFIG_SERIAL_CPM_SMC1
96 cp->cp_simode &= ~(0xe0000000 >> 17); /* brg1 */ 125 cp->cp_simode &= ~(0xe0000000 >> 17); /* brg1 */
97 clrbits32(bcsr_io,(0x80000000 >> 7)); 126 clrbits32(bcsr_io,(0x80000000 >> 7));
127 cp->cp_smc[0].smc_smcm |= (SMCM_RX | SMCM_TX);
128 cp->cp_smc[0].smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
98#else 129#else
99 setbits32(bcsr_io,(0x80000000 >> 7)); 130 setbits32(bcsr_io,(0x80000000 >> 7));
100 131
@@ -108,6 +139,8 @@ void __init board_init(void)
108 cp->cp_simode &= ~(0xe0000000 >> 1); 139 cp->cp_simode &= ~(0xe0000000 >> 1);
109 cp->cp_simode |= (0x20000000 >> 1); /* brg2 */ 140 cp->cp_simode |= (0x20000000 >> 1); /* brg2 */
110 clrbits32(bcsr_io,(0x80000000 >> 13)); 141 clrbits32(bcsr_io,(0x80000000 >> 13));
142 cp->cp_smc[1].smc_smcm |= (SMCM_RX | SMCM_TX);
143 cp->cp_smc[1].smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
111#else 144#else
112 clrbits32(bcsr_io,(0x80000000 >> 13)); 145 clrbits32(bcsr_io,(0x80000000 >> 13));
113 cp->cp_pbpar &= ~(0x00000c00); 146 cp->cp_pbpar &= ~(0x00000c00);
@@ -232,6 +265,74 @@ static void mpc866ads_fixup_scc_enet_pdata(struct platform_device *pdev,
232 mpc866ads_fixup_enet_pdata(pdev, fsid_scc1 + pdev->id - 1); 265 mpc866ads_fixup_enet_pdata(pdev, fsid_scc1 + pdev->id - 1);
233} 266}
234 267
268static void setup_smc1_ioports(void)
269{
270 immap_t *immap = (immap_t *) IMAP_ADDR;
271 unsigned *bcsr_io;
272 unsigned int iobits = 0x000000c0;
273
274 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
275
276 if (bcsr_io == NULL) {
277 printk(KERN_CRIT "Could not remap BCSR1\n");
278 return;
279 }
280
281 clrbits32(bcsr_io,BCSR1_RS232EN_1);
282 iounmap(bcsr_io);
283
284 setbits32(&immap->im_cpm.cp_pbpar, iobits);
285 clrbits32(&immap->im_cpm.cp_pbdir, iobits);
286 clrbits16(&immap->im_cpm.cp_pbodr, iobits);
287
288}
289
290static void setup_smc2_ioports(void)
291{
292 immap_t *immap = (immap_t *) IMAP_ADDR;
293 unsigned *bcsr_io;
294 unsigned int iobits = 0x00000c00;
295
296 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
297
298 if (bcsr_io == NULL) {
299 printk(KERN_CRIT "Could not remap BCSR1\n");
300 return;
301 }
302
303 clrbits32(bcsr_io,BCSR1_RS232EN_2);
304
305 iounmap(bcsr_io);
306
307#ifndef CONFIG_SERIAL_CPM_ALT_SMC2
308 setbits32(&immap->im_cpm.cp_pbpar, iobits);
309 clrbits32(&immap->im_cpm.cp_pbdir, iobits);
310 clrbits16(&immap->im_cpm.cp_pbodr, iobits);
311#else
312 setbits16(&immap->im_ioport.iop_papar, iobits);
313 clrbits16(&immap->im_ioport.iop_padir, iobits);
314 clrbits16(&immap->im_ioport.iop_paodr, iobits);
315#endif
316
317}
318
319static void __init mpc866ads_fixup_uart_pdata(struct platform_device *pdev,
320 int idx)
321{
322 bd_t *bd = (bd_t *) __res;
323 struct fs_uart_platform_info *pinfo;
324 int num = ARRAY_SIZE(mpc866_uart_pdata);
325
326 int id = fs_uart_id_smc2fsid(idx);
327
328 /* no need to alter anything if console */
329 if ((id <= num) && (!pdev->dev.platform_data)) {
330 pinfo = &mpc866_uart_pdata[id];
331 pinfo->uart_clk = bd->bi_intfreq;
332 pdev->dev.platform_data = pinfo;
333 }
334}
335
235static int mpc866ads_platform_notify(struct device *dev) 336static int mpc866ads_platform_notify(struct device *dev)
236{ 337{
237 static const struct platform_notify_dev_map dev_map[] = { 338 static const struct platform_notify_dev_map dev_map[] = {
@@ -244,6 +345,10 @@ static int mpc866ads_platform_notify(struct device *dev)
244 .rtn = mpc866ads_fixup_scc_enet_pdata, 345 .rtn = mpc866ads_fixup_scc_enet_pdata,
245 }, 346 },
246 { 347 {
348 .bus_id = "fsl-cpm-smc:uart",
349 .rtn = mpc866ads_fixup_uart_pdata
350 },
351 {
247 .bus_id = NULL 352 .bus_id = NULL
248 } 353 }
249 }; 354 };
@@ -267,7 +372,42 @@ int __init mpc866ads_init(void)
267#endif 372#endif
268 ppc_sys_device_enable(MPC8xx_CPM_FEC1); 373 ppc_sys_device_enable(MPC8xx_CPM_FEC1);
269 374
375/* Since either of the uarts could be used as console, they need to ready */
376#ifdef CONFIG_SERIAL_CPM_SMC1
377 ppc_sys_device_enable(MPC8xx_CPM_SMC1);
378 ppc_sys_device_setfunc(MPC8xx_CPM_SMC1, PPC_SYS_FUNC_UART);
379#endif
380
381#ifdef CONFIG_SERIAL_CPM_SMCer
382 ppc_sys_device_enable(MPC8xx_CPM_SMC2);
383 ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART);
384#endif
385
270 return 0; 386 return 0;
271} 387}
272 388
389/*
390 To prevent confusion, console selection is gross:
391 by 0 assumed SMC1 and by 1 assumed SMC2
392 */
393struct platform_device* early_uart_get_pdev(int index)
394{
395 bd_t *bd = (bd_t *) __res;
396 struct fs_uart_platform_info *pinfo;
397
398 struct platform_device* pdev = NULL;
399 if(index) { /*assume SMC2 here*/
400 pdev = &ppc_sys_platform_devices[MPC8xx_CPM_SMC2];
401 pinfo = &mpc866_uart_pdata[1];
402 } else { /*over SMC1*/
403 pdev = &ppc_sys_platform_devices[MPC8xx_CPM_SMC1];
404 pinfo = &mpc866_uart_pdata[0];
405 }
406
407 pinfo->uart_clk = bd->bi_intfreq;
408 pdev->dev.platform_data = pinfo;
409 ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR);
410 return NULL;
411}
412
273arch_initcall(mpc866ads_init); 413arch_initcall(mpc866ads_init);
diff --git a/arch/ppc/platforms/mpc885ads_setup.c b/arch/ppc/platforms/mpc885ads_setup.c
index 50a99e5f7c68..4b88679cd31c 100644
--- a/arch/ppc/platforms/mpc885ads_setup.c
+++ b/arch/ppc/platforms/mpc885ads_setup.c
@@ -20,6 +20,7 @@
20#include <linux/device.h> 20#include <linux/device.h>
21 21
22#include <linux/fs_enet_pd.h> 22#include <linux/fs_enet_pd.h>
23#include <linux/fs_uart_pd.h>
23#include <linux/mii.h> 24#include <linux/mii.h>
24 25
25#include <asm/delay.h> 26#include <asm/delay.h>
@@ -35,9 +36,32 @@
35#include <asm/ppc_sys.h> 36#include <asm/ppc_sys.h>
36 37
37extern unsigned char __res[]; 38extern unsigned char __res[];
39static void setup_smc1_ioports(void);
40static void setup_smc2_ioports(void);
38 41
39static void __init mpc885ads_scc_phy_init(char); 42static void __init mpc885ads_scc_phy_init(char);
40 43
44static struct fs_uart_platform_info mpc885_uart_pdata[] = {
45 [fsid_smc1_uart] = {
46 .brg = 1,
47 .fs_no = fsid_smc1_uart,
48 .init_ioports = setup_smc1_ioports,
49 .tx_num_fifo = 4,
50 .tx_buf_size = 32,
51 .rx_num_fifo = 4,
52 .rx_buf_size = 32,
53 },
54 [fsid_smc2_uart] = {
55 .brg = 2,
56 .fs_no = fsid_smc2_uart,
57 .init_ioports = setup_smc2_ioports,
58 .tx_num_fifo = 4,
59 .tx_buf_size = 32,
60 .rx_num_fifo = 4,
61 .rx_buf_size = 32,
62 },
63};
64
41static struct fs_mii_bus_info fec_mii_bus_info = { 65static struct fs_mii_bus_info fec_mii_bus_info = {
42 .method = fsmii_fec, 66 .method = fsmii_fec,
43 .id = 0, 67 .id = 0,
@@ -116,6 +140,8 @@ void __init board_init(void)
116#ifdef CONFIG_SERIAL_CPM_SMC1 140#ifdef CONFIG_SERIAL_CPM_SMC1
117 cp->cp_simode &= ~(0xe0000000 >> 17); /* brg1 */ 141 cp->cp_simode &= ~(0xe0000000 >> 17); /* brg1 */
118 clrbits32(bcsr_io, BCSR1_RS232EN_1); 142 clrbits32(bcsr_io, BCSR1_RS232EN_1);
143 cp->cp_smc[0].smc_smcm |= (SMCM_RX | SMCM_TX);
144 cp->cp_smc[0].smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
119#else 145#else
120 setbits32(bcsr_io,BCSR1_RS232EN_1); 146 setbits32(bcsr_io,BCSR1_RS232EN_1);
121 cp->cp_smc[0].smc_smcmr = 0; 147 cp->cp_smc[0].smc_smcmr = 0;
@@ -126,6 +152,8 @@ void __init board_init(void)
126 cp->cp_simode &= ~(0xe0000000 >> 1); 152 cp->cp_simode &= ~(0xe0000000 >> 1);
127 cp->cp_simode |= (0x20000000 >> 1); /* brg2 */ 153 cp->cp_simode |= (0x20000000 >> 1); /* brg2 */
128 clrbits32(bcsr_io,BCSR1_RS232EN_2); 154 clrbits32(bcsr_io,BCSR1_RS232EN_2);
155 cp->cp_smc[1].smc_smcm |= (SMCM_RX | SMCM_TX);
156 cp->cp_smc[1].smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
129#else 157#else
130 setbits32(bcsr_io,BCSR1_RS232EN_2); 158 setbits32(bcsr_io,BCSR1_RS232EN_2);
131 cp->cp_smc[1].smc_smcmr = 0; 159 cp->cp_smc[1].smc_smcmr = 0;
@@ -343,6 +371,70 @@ static void mpc885ads_scc_phy_init(char phy_addr)
343 out_be32(&fecp->fec_mii_speed, 0); 371 out_be32(&fecp->fec_mii_speed, 0);
344} 372}
345 373
374static void setup_smc1_ioports(void)
375{
376 immap_t *immap = (immap_t *) IMAP_ADDR;
377 unsigned *bcsr_io;
378 unsigned int iobits = 0x000000c0;
379
380 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
381
382 if (bcsr_io == NULL) {
383 printk(KERN_CRIT "Could not remap BCSR1\n");
384 return;
385 }
386 clrbits32(bcsr_io,BCSR1_RS232EN_1);
387 iounmap(bcsr_io);
388
389 setbits32(&immap->im_cpm.cp_pbpar, iobits);
390 clrbits32(&immap->im_cpm.cp_pbdir, iobits);
391 clrbits16(&immap->im_cpm.cp_pbodr, iobits);
392}
393
394static void setup_smc2_ioports(void)
395{
396 immap_t *immap = (immap_t *) IMAP_ADDR;
397 unsigned *bcsr_io;
398 unsigned int iobits = 0x00000c00;
399
400 bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
401
402 if (bcsr_io == NULL) {
403 printk(KERN_CRIT "Could not remap BCSR1\n");
404 return;
405 }
406 clrbits32(bcsr_io,BCSR1_RS232EN_2);
407 iounmap(bcsr_io);
408
409#ifndef CONFIG_SERIAL_CPM_ALT_SMC2
410 setbits32(&immap->im_cpm.cp_pbpar, iobits);
411 clrbits32(&immap->im_cpm.cp_pbdir, iobits);
412 clrbits16(&immap->im_cpm.cp_pbodr, iobits);
413#else
414 setbits16(&immap->im_ioport.iop_papar, iobits);
415 clrbits16(&immap->im_ioport.iop_padir, iobits);
416 clrbits16(&immap->im_ioport.iop_paodr, iobits);
417#endif
418}
419
420static void __init mpc885ads_fixup_uart_pdata(struct platform_device *pdev,
421 int idx)
422{
423 bd_t *bd = (bd_t *) __res;
424 struct fs_uart_platform_info *pinfo;
425 int num = ARRAY_SIZE(mpc885_uart_pdata);
426
427 int id = fs_uart_id_smc2fsid(idx);
428
429 /* no need to alter anything if console */
430 if ((id <= num) && (!pdev->dev.platform_data)) {
431 pinfo = &mpc885_uart_pdata[id];
432 pinfo->uart_clk = bd->bi_intfreq;
433 pdev->dev.platform_data = pinfo;
434 }
435}
436
437
346static int mpc885ads_platform_notify(struct device *dev) 438static int mpc885ads_platform_notify(struct device *dev)
347{ 439{
348 440
@@ -356,12 +448,17 @@ static int mpc885ads_platform_notify(struct device *dev)
356 .rtn = mpc885ads_fixup_scc_enet_pdata, 448 .rtn = mpc885ads_fixup_scc_enet_pdata,
357 }, 449 },
358 { 450 {
451 .bus_id = "fsl-cpm-smc:uart",
452 .rtn = mpc885ads_fixup_uart_pdata
453 },
454 {
359 .bus_id = NULL 455 .bus_id = NULL
360 } 456 }
361 }; 457 };
362 458
363 platform_notify_map(dev_map,dev); 459 platform_notify_map(dev_map,dev);
364 460
461 return 0;
365} 462}
366 463
367int __init mpc885ads_init(void) 464int __init mpc885ads_init(void)
@@ -383,7 +480,41 @@ int __init mpc885ads_init(void)
383 ppc_sys_device_enable(MPC8xx_CPM_FEC2); 480 ppc_sys_device_enable(MPC8xx_CPM_FEC2);
384#endif 481#endif
385 482
483#ifdef CONFIG_SERIAL_CPM_SMC1
484 ppc_sys_device_enable(MPC8xx_CPM_SMC1);
485 ppc_sys_device_setfunc(MPC8xx_CPM_SMC1, PPC_SYS_FUNC_UART);
486#endif
487
488#ifdef CONFIG_SERIAL_CPM_SMC2
489 ppc_sys_device_enable(MPC8xx_CPM_SMC2);
490 ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART);
491#endif
386 return 0; 492 return 0;
387} 493}
388 494
389arch_initcall(mpc885ads_init); 495arch_initcall(mpc885ads_init);
496
497/*
498 To prevent confusion, console selection is gross:
499 by 0 assumed SMC1 and by 1 assumed SMC2
500 */
501struct platform_device* early_uart_get_pdev(int index)
502{
503 bd_t *bd = (bd_t *) __res;
504 struct fs_uart_platform_info *pinfo;
505
506 struct platform_device* pdev = NULL;
507 if(index) { /*assume SMC2 here*/
508 pdev = &ppc_sys_platform_devices[MPC8xx_CPM_SMC2];
509 pinfo = &mpc885_uart_pdata[1];
510 } else { /*over SMC1*/
511 pdev = &ppc_sys_platform_devices[MPC8xx_CPM_SMC1];
512 pinfo = &mpc885_uart_pdata[0];
513 }
514
515 pinfo->uart_clk = bd->bi_intfreq;
516 pdev->dev.platform_data = pinfo;
517 ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR);
518 return NULL;
519}
520
diff --git a/arch/ppc/platforms/pq2ads.c b/arch/ppc/platforms/pq2ads.c
index 3365fd788a7a..7fc2e02f5246 100644
--- a/arch/ppc/platforms/pq2ads.c
+++ b/arch/ppc/platforms/pq2ads.c
@@ -14,11 +14,40 @@
14 14
15#include <linux/init.h> 15#include <linux/init.h>
16 16
17#include <asm/io.h>
17#include <asm/mpc8260.h> 18#include <asm/mpc8260.h>
19#include <asm/cpm2.h>
20#include <asm/immap_cpm2.h>
18 21
19void __init 22void __init
20m82xx_board_setup(void) 23m82xx_board_setup(void)
21{ 24{
25 cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t));
26 u32 *bcsr = ioremap(BCSR_ADDR+4, sizeof(u32));
27
22 /* Enable the 2nd UART port */ 28 /* Enable the 2nd UART port */
23 *(volatile uint *)(BCSR_ADDR + 4) &= ~BCSR1_RS232_EN2; 29 clrbits32(bcsr, BCSR1_RS232_EN2);
30
31#ifdef CONFIG_SERIAL_CPM_SCC1
32 clrbits32((u32*)&immap->im_scc[0].scc_sccm, UART_SCCM_TX | UART_SCCM_RX);
33 clrbits32((u32*)&immap->im_scc[0].scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
34#endif
35
36#ifdef CONFIG_SERIAL_CPM_SCC2
37 clrbits32((u32*)&immap->im_scc[1].scc_sccm, UART_SCCM_TX | UART_SCCM_RX);
38 clrbits32((u32*)&immap->im_scc[1].scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
39#endif
40
41#ifdef CONFIG_SERIAL_CPM_SCC3
42 clrbits32((u32*)&immap->im_scc[2].scc_sccm, UART_SCCM_TX | UART_SCCM_RX);
43 clrbits32((u32*)&immap->im_scc[2].scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
44#endif
45
46#ifdef CONFIG_SERIAL_CPM_SCC4
47 clrbits32((u32*)&immap->im_scc[3].scc_sccm, UART_SCCM_TX | UART_SCCM_RX);
48 clrbits32((u32*)&immap->im_scc[3].scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
49#endif
50
51 iounmap(bcsr);
52 iounmap(immap);
24} 53}
diff --git a/arch/ppc/syslib/ibm440gx_common.c b/arch/ppc/syslib/ibm440gx_common.c
index a7dd55f1c63e..f6cc16888527 100644
--- a/arch/ppc/syslib/ibm440gx_common.c
+++ b/arch/ppc/syslib/ibm440gx_common.c
@@ -2,7 +2,7 @@
2 * PPC440GX system library 2 * PPC440GX system library
3 * 3 *
4 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> 4 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
5 * Copyright (c) 2003, 2004 Zultys Technologies 5 * Copyright (c) 2003 - 2006 Zultys Technologies
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
@@ -282,3 +282,14 @@ int ibm440gx_show_cpuinfo(struct seq_file *m){
282 return 0; 282 return 0;
283} 283}
284 284
285void __init ibm440gx_platform_init(unsigned long r3, unsigned long r4,
286 unsigned long r5, unsigned long r6,
287 unsigned long r7)
288{
289 /* Erratum 440_43 workaround, disable L1 cache parity checking */
290 if (!strcmp(cur_cpu_spec->cpu_name, "440GX Rev. C") ||
291 !strcmp(cur_cpu_spec->cpu_name, "440GX Rev. F"))
292 mtspr(SPRN_CCR1, mfspr(SPRN_CCR1) | CCR1_DPC);
293
294 ibm44x_platform_init(r3, r4, r5, r6, r7);
295}
diff --git a/arch/ppc/syslib/ibm440gx_common.h b/arch/ppc/syslib/ibm440gx_common.h
index a2ab9fab8e34..a03ec6022e8f 100644
--- a/arch/ppc/syslib/ibm440gx_common.h
+++ b/arch/ppc/syslib/ibm440gx_common.h
@@ -29,6 +29,10 @@
29void ibm440gx_get_clocks(struct ibm44x_clocks*, unsigned int sys_clk, 29void ibm440gx_get_clocks(struct ibm44x_clocks*, unsigned int sys_clk,
30 unsigned int ser_clk) __init; 30 unsigned int ser_clk) __init;
31 31
32/* common 440GX platform init */
33void ibm440gx_platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
34 unsigned long r6, unsigned long r7) __init;
35
32/* Enable L2 cache */ 36/* Enable L2 cache */
33void ibm440gx_l2c_enable(void) __init; 37void ibm440gx_l2c_enable(void) __init;
34 38
diff --git a/arch/ppc/syslib/mpc8xx_devices.c b/arch/ppc/syslib/mpc8xx_devices.c
index bd41ed83beb3..6f536383866e 100644
--- a/arch/ppc/syslib/mpc8xx_devices.c
+++ b/arch/ppc/syslib/mpc8xx_devices.c
@@ -170,12 +170,18 @@ struct platform_device ppc_sys_platform_devices[] = {
170 [MPC8xx_CPM_SMC1] = { 170 [MPC8xx_CPM_SMC1] = {
171 .name = "fsl-cpm-smc", 171 .name = "fsl-cpm-smc",
172 .id = 1, 172 .id = 1,
173 .num_resources = 2, 173 .num_resources = 3,
174 .resource = (struct resource[]) { 174 .resource = (struct resource[]) {
175 { 175 {
176 .name = "regs", 176 .name = "regs",
177 .start = 0xa82, 177 .start = 0xa80,
178 .end = 0xa91, 178 .end = 0xa8f,
179 .flags = IORESOURCE_MEM,
180 },
181 {
182 .name = "pram",
183 .start = 0x3e80,
184 .end = 0x3ebf,
179 .flags = IORESOURCE_MEM, 185 .flags = IORESOURCE_MEM,
180 }, 186 },
181 { 187 {
@@ -189,15 +195,22 @@ struct platform_device ppc_sys_platform_devices[] = {
189 [MPC8xx_CPM_SMC2] = { 195 [MPC8xx_CPM_SMC2] = {
190 .name = "fsl-cpm-smc", 196 .name = "fsl-cpm-smc",
191 .id = 2, 197 .id = 2,
192 .num_resources = 2, 198 .num_resources = 3,
193 .resource = (struct resource[]) { 199 .resource = (struct resource[]) {
194 { 200 {
195 .name = "regs", 201 .name = "regs",
196 .start = 0xa92, 202 .start = 0xa90,
197 .end = 0xaa1, 203 .end = 0xa9f,
198 .flags = IORESOURCE_MEM, 204 .flags = IORESOURCE_MEM,
199 }, 205 },
200 { 206 {
207 .name = "pram",
208 .start = 0x3f80,
209 .end = 0x3fbf,
210 .flags = IORESOURCE_MEM,
211
212 },
213 {
201 .name = "interrupt", 214 .name = "interrupt",
202 .start = MPC8xx_INT_SMC2, 215 .start = MPC8xx_INT_SMC2,
203 .end = MPC8xx_INT_SMC2, 216 .end = MPC8xx_INT_SMC2,
diff --git a/arch/ppc/syslib/ppc_sys.c b/arch/ppc/syslib/ppc_sys.c
index 7662c4e6e7d6..2d48018b71d9 100644
--- a/arch/ppc/syslib/ppc_sys.c
+++ b/arch/ppc/syslib/ppc_sys.c
@@ -109,9 +109,11 @@ ppc_sys_fixup_mem_resource(struct platform_device *pdev, phys_addr_t paddr)
109 int i; 109 int i;
110 for (i = 0; i < pdev->num_resources; i++) { 110 for (i = 0; i < pdev->num_resources; i++) {
111 struct resource *r = &pdev->resource[i]; 111 struct resource *r = &pdev->resource[i];
112 if ((r->flags & IORESOURCE_MEM) == IORESOURCE_MEM) { 112 if (((r->flags & IORESOURCE_MEM) == IORESOURCE_MEM) &&
113 ((r->flags & PPC_SYS_IORESOURCE_FIXUPPED) != PPC_SYS_IORESOURCE_FIXUPPED)) {
113 r->start += paddr; 114 r->start += paddr;
114 r->end += paddr; 115 r->end += paddr;
116 r->flags |= PPC_SYS_IORESOURCE_FIXUPPED;
115 } 117 }
116 } 118 }
117} 119}
diff --git a/arch/ppc/syslib/pq2_sys.c b/arch/ppc/syslib/pq2_sys.c
index 75e64f1c144d..433b0fa203e1 100644
--- a/arch/ppc/syslib/pq2_sys.c
+++ b/arch/ppc/syslib/pq2_sys.c
@@ -113,13 +113,13 @@ struct ppc_sys_spec ppc_sys_specs[] = {
113 .ppc_sys_name = "8248", 113 .ppc_sys_name = "8248",
114 .mask = 0x0000ff00, 114 .mask = 0x0000ff00,
115 .value = 0x00000c00, 115 .value = 0x00000c00,
116 .num_devices = 11, 116 .num_devices = 12,
117 .device_list = (enum ppc_sys_devices[]) 117 .device_list = (enum ppc_sys_devices[])
118 { 118 {
119 MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, 119 MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1,
120 MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SMC1, 120 MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SCC4,
121 MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, 121 MPC82xx_CPM_SMC1, MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI,
122 MPC82xx_CPM_USB, MPC82xx_SEC1, 122 MPC82xx_CPM_I2C, MPC82xx_CPM_USB, MPC82xx_SEC1,
123 }, 123 },
124 }, 124 },
125 { 125 {