diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/boot/Makefile | 5 | ||||
-rw-r--r-- | arch/powerpc/boot/cuboot-52xx.c | 59 | ||||
-rw-r--r-- | arch/powerpc/boot/mpc52xx-psc.c | 69 | ||||
-rw-r--r-- | arch/powerpc/boot/ops.h | 1 | ||||
-rw-r--r-- | arch/powerpc/boot/serial.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/Kconfig | 1 |
6 files changed, 135 insertions, 2 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index c1582b62911c..b63e423428c7 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -45,8 +45,8 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ | |||
45 | ns16550.c serial.c simple_alloc.c div64.S util.S \ | 45 | ns16550.c serial.c simple_alloc.c div64.S util.S \ |
46 | gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ | 46 | gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ |
47 | 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ | 47 | 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ |
48 | cpm-serial.c stdlib.c | 48 | cpm-serial.c stdlib.c mpc52xx-psc.c |
49 | src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \ | 49 | src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \ |
50 | cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ | 50 | cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ |
51 | ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ | 51 | ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ |
52 | cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c cuboot-bamboo.c | 52 | cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c cuboot-bamboo.c |
@@ -143,6 +143,7 @@ image-$(CONFIG_DEFAULT_UIMAGE) += uImage | |||
143 | ifneq ($(CONFIG_DEVICE_TREE),"") | 143 | ifneq ($(CONFIG_DEVICE_TREE),"") |
144 | image-$(CONFIG_PPC_8xx) += cuImage.8xx | 144 | image-$(CONFIG_PPC_8xx) += cuImage.8xx |
145 | image-$(CONFIG_8260) += cuImage.pq2 | 145 | image-$(CONFIG_8260) += cuImage.pq2 |
146 | image-$(CONFIG_PPC_MPC52xx) += cuImage.52xx | ||
146 | image-$(CONFIG_PPC_83xx) += cuImage.83xx | 147 | image-$(CONFIG_PPC_83xx) += cuImage.83xx |
147 | image-$(CONFIG_PPC_85xx) += cuImage.85xx | 148 | image-$(CONFIG_PPC_85xx) += cuImage.85xx |
148 | image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony | 149 | image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony |
diff --git a/arch/powerpc/boot/cuboot-52xx.c b/arch/powerpc/boot/cuboot-52xx.c new file mode 100644 index 000000000000..9256a26d40e4 --- /dev/null +++ b/arch/powerpc/boot/cuboot-52xx.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * Old U-boot compatibility for MPC5200 | ||
3 | * | ||
4 | * Author: Grant Likely <grant.likely@secretlab.ca> | ||
5 | * | ||
6 | * Copyright (c) 2007 Secret Lab Technologies Ltd. | ||
7 | * Copyright (c) 2007 Freescale Semiconductor, Inc. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License version 2 as published | ||
11 | * by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include "ops.h" | ||
15 | #include "stdio.h" | ||
16 | #include "io.h" | ||
17 | #include "cuboot.h" | ||
18 | |||
19 | #define TARGET_PPC_MPC52xx | ||
20 | #include "ppcboot.h" | ||
21 | |||
22 | static bd_t bd; | ||
23 | |||
24 | static void platform_fixups(void) | ||
25 | { | ||
26 | void *soc, *reg; | ||
27 | int div; | ||
28 | u32 sysfreq; | ||
29 | |||
30 | |||
31 | dt_fixup_memory(bd.bi_memstart, bd.bi_memsize); | ||
32 | dt_fixup_mac_addresses(bd.bi_enetaddr); | ||
33 | dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq); | ||
34 | |||
35 | /* Unfortunately, the specific model number is encoded in the | ||
36 | * soc node name in existing dts files -- once that is fixed, | ||
37 | * this can do a simple path lookup. | ||
38 | */ | ||
39 | soc = find_node_by_devtype(NULL, "soc"); | ||
40 | if (soc) { | ||
41 | setprop(soc, "bus-frequency", &bd.bi_ipbfreq, | ||
42 | sizeof(bd.bi_ipbfreq)); | ||
43 | |||
44 | if (!dt_xlate_reg(soc, 0, (void*)®, NULL)) | ||
45 | return; | ||
46 | div = in_8(reg + 0x204) & 0x0020 ? 8 : 4; | ||
47 | sysfreq = bd.bi_busfreq * div; | ||
48 | setprop(soc, "system-frequency", &sysfreq, sizeof(sysfreq)); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | ||
53 | unsigned long r6, unsigned long r7) | ||
54 | { | ||
55 | CUBOOT_INIT(); | ||
56 | ft_init(_dtb_start, _dtb_end - _dtb_start, 32); | ||
57 | serial_console_init(); | ||
58 | platform_ops.fixups = platform_fixups; | ||
59 | } | ||
diff --git a/arch/powerpc/boot/mpc52xx-psc.c b/arch/powerpc/boot/mpc52xx-psc.c new file mode 100644 index 000000000000..1074626e6a37 --- /dev/null +++ b/arch/powerpc/boot/mpc52xx-psc.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * MPC5200 PSC serial console support. | ||
3 | * | ||
4 | * Author: Grant Likely <grant.likely@secretlab.ca> | ||
5 | * | ||
6 | * Copyright (c) 2007 Secret Lab Technologies Ltd. | ||
7 | * Copyright (c) 2007 Freescale Semiconductor, Inc. | ||
8 | * | ||
9 | * It is assumed that the firmware (or the platform file) has already set | ||
10 | * up the port. | ||
11 | */ | ||
12 | |||
13 | #include "types.h" | ||
14 | #include "io.h" | ||
15 | #include "ops.h" | ||
16 | |||
17 | /* Programmable Serial Controller (PSC) status register bits */ | ||
18 | #define MPC52xx_PSC_SR 0x04 | ||
19 | #define MPC52xx_PSC_SR_RXRDY 0x0100 | ||
20 | #define MPC52xx_PSC_SR_RXFULL 0x0200 | ||
21 | #define MPC52xx_PSC_SR_TXRDY 0x0400 | ||
22 | #define MPC52xx_PSC_SR_TXEMP 0x0800 | ||
23 | |||
24 | #define MPC52xx_PSC_BUFFER 0x0C | ||
25 | |||
26 | static void *psc; | ||
27 | |||
28 | static int psc_open(void) | ||
29 | { | ||
30 | /* Assume the firmware has already configured the PSC into | ||
31 | * uart mode */ | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static void psc_putc(unsigned char c) | ||
36 | { | ||
37 | while (!(in_be16(psc + MPC52xx_PSC_SR) & MPC52xx_PSC_SR_TXRDY)) ; | ||
38 | out_8(psc + MPC52xx_PSC_BUFFER, c); | ||
39 | } | ||
40 | |||
41 | static unsigned char psc_tstc(void) | ||
42 | { | ||
43 | return (in_be16(psc + MPC52xx_PSC_SR) & MPC52xx_PSC_SR_RXRDY) != 0; | ||
44 | } | ||
45 | |||
46 | static unsigned char psc_getc(void) | ||
47 | { | ||
48 | while (!(in_be16(psc + MPC52xx_PSC_SR) & MPC52xx_PSC_SR_RXRDY)) ; | ||
49 | return in_8(psc + MPC52xx_PSC_BUFFER); | ||
50 | } | ||
51 | |||
52 | int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp) | ||
53 | { | ||
54 | int n; | ||
55 | |||
56 | /* Get the base address of the psc registers */ | ||
57 | n = getprop(devp, "virtual-reg", &psc, sizeof(psc)); | ||
58 | if (n != sizeof(psc)) { | ||
59 | if (!dt_xlate_reg(devp, 0, (void *)&psc, NULL)) | ||
60 | return -1; | ||
61 | } | ||
62 | |||
63 | scdp->open = psc_open; | ||
64 | scdp->putc = psc_putc; | ||
65 | scdp->getc = psc_getc; | ||
66 | scdp->tstc = psc_tstc; | ||
67 | |||
68 | return 0; | ||
69 | } | ||
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h index 703255bf0089..f639fcab2c44 100644 --- a/arch/powerpc/boot/ops.h +++ b/arch/powerpc/boot/ops.h | |||
@@ -84,6 +84,7 @@ int serial_console_init(void); | |||
84 | int ns16550_console_init(void *devp, struct serial_console_data *scdp); | 84 | int ns16550_console_init(void *devp, struct serial_console_data *scdp); |
85 | int mpsc_console_init(void *devp, struct serial_console_data *scdp); | 85 | int mpsc_console_init(void *devp, struct serial_console_data *scdp); |
86 | int cpm_console_init(void *devp, struct serial_console_data *scdp); | 86 | int cpm_console_init(void *devp, struct serial_console_data *scdp); |
87 | int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp); | ||
87 | void *simple_alloc_init(char *base, unsigned long heap_size, | 88 | void *simple_alloc_init(char *base, unsigned long heap_size, |
88 | unsigned long granularity, unsigned long max_allocs); | 89 | unsigned long granularity, unsigned long max_allocs); |
89 | extern void flush_cache(void *, unsigned long); | 90 | extern void flush_cache(void *, unsigned long); |
diff --git a/arch/powerpc/boot/serial.c b/arch/powerpc/boot/serial.c index d47f8e0b4b81..95e08e4ddcd2 100644 --- a/arch/powerpc/boot/serial.c +++ b/arch/powerpc/boot/serial.c | |||
@@ -126,6 +126,8 @@ int serial_console_init(void) | |||
126 | dt_is_compatible(devp, "fsl,cpm2-scc-uart") || | 126 | dt_is_compatible(devp, "fsl,cpm2-scc-uart") || |
127 | dt_is_compatible(devp, "fsl,cpm2-smc-uart")) | 127 | dt_is_compatible(devp, "fsl,cpm2-smc-uart")) |
128 | rc = cpm_console_init(devp, &serial_cd); | 128 | rc = cpm_console_init(devp, &serial_cd); |
129 | else if (dt_is_compatible(devp, "mpc5200-psc-uart")) | ||
130 | rc = mpc5200_psc_console_init(devp, &serial_cd); | ||
129 | 131 | ||
130 | /* Add other serial console driver calls here */ | 132 | /* Add other serial console driver calls here */ |
131 | 133 | ||
diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig index 3ffaa066c2c8..9ddf251b192b 100644 --- a/arch/powerpc/platforms/52xx/Kconfig +++ b/arch/powerpc/platforms/52xx/Kconfig | |||
@@ -30,6 +30,7 @@ config PPC_EFIKA | |||
30 | config PPC_LITE5200 | 30 | config PPC_LITE5200 |
31 | bool "Freescale Lite5200 Eval Board" | 31 | bool "Freescale Lite5200 Eval Board" |
32 | depends on PPC_MULTIPLATFORM && PPC32 | 32 | depends on PPC_MULTIPLATFORM && PPC32 |
33 | select WANT_DEVICE_TREE | ||
33 | select PPC_MPC5200 | 34 | select PPC_MPC5200 |
34 | default n | 35 | default n |
35 | 36 | ||