diff options
author | Timur Tabi <timur@freescale.com> | 2012-07-23 19:12:29 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2012-09-12 15:57:07 -0400 |
commit | 34f84b5b5bc83f4fc208cc278f572e6d926f976b (patch) | |
tree | 916767962fa305e2de6fa4e9075d7c53a5ec9022 /arch/powerpc/platforms | |
parent | 4c30c143f02f1ab8d9740c61db1ce335a5f95095 (diff) |
powerpc/85xx: introduce support for the Freescale / iVeia P1022RDK
The Freescale / iVeia P1022RDK reference board is a small-factor board
with a Freescale P1022 SOC. It includes:
1) 512 MB 64-bit DDR3-800 (max) memory
2) 8MB SPI serial flash memory for boot loader
3) Bootable 4-bit SD/MMC port
4) Two 10/100/1000 Ethernet connectors
5) One SATA port
6) Two USB ports
7) One PCIe x4 slot
8) DVI video connector
9) Audio input and output jacks, powered by a Wolfson WM8960 codec.
Unlike the P1022DS, the P1022RDK does not have any localbus devices,
presumably because of the localbus / DIU multiplexing restriction of
the P1022 SOC.
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/85xx/Kconfig | 7 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/p1022_rdk.c | 195 |
3 files changed, 203 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index 31f0618ec677..02d02a09942d 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig | |||
@@ -104,6 +104,13 @@ config P1022_DS | |||
104 | help | 104 | help |
105 | This option enables support for the Freescale P1022DS reference board. | 105 | This option enables support for the Freescale P1022DS reference board. |
106 | 106 | ||
107 | config P1022_RDK | ||
108 | bool "Freescale / iVeia P1022 RDK" | ||
109 | select DEFAULT_UIMAGE | ||
110 | help | ||
111 | This option enables support for the Freescale / iVeia P1022RDK | ||
112 | reference board. | ||
113 | |||
107 | config P1023_RDS | 114 | config P1023_RDS |
108 | bool "Freescale P1023 RDS" | 115 | bool "Freescale P1023 RDS" |
109 | select DEFAULT_UIMAGE | 116 | select DEFAULT_UIMAGE |
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile index d99268aef556..76f679cb04a0 100644 --- a/arch/powerpc/platforms/85xx/Makefile +++ b/arch/powerpc/platforms/85xx/Makefile | |||
@@ -15,6 +15,7 @@ obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o | |||
15 | obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o | 15 | obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o |
16 | obj-$(CONFIG_P1010_RDB) += p1010rdb.o | 16 | obj-$(CONFIG_P1010_RDB) += p1010rdb.o |
17 | obj-$(CONFIG_P1022_DS) += p1022_ds.o | 17 | obj-$(CONFIG_P1022_DS) += p1022_ds.o |
18 | obj-$(CONFIG_P1022_RDK) += p1022_rdk.o | ||
18 | obj-$(CONFIG_P1023_RDS) += p1023_rds.o | 19 | obj-$(CONFIG_P1023_RDS) += p1023_rds.o |
19 | obj-$(CONFIG_P2041_RDB) += p2041_rdb.o corenet_ds.o | 20 | obj-$(CONFIG_P2041_RDB) += p2041_rdb.o corenet_ds.o |
20 | obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o | 21 | obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o |
diff --git a/arch/powerpc/platforms/85xx/p1022_rdk.c b/arch/powerpc/platforms/85xx/p1022_rdk.c new file mode 100644 index 000000000000..b3cf11b92e75 --- /dev/null +++ b/arch/powerpc/platforms/85xx/p1022_rdk.c | |||
@@ -0,0 +1,195 @@ | |||
1 | /* | ||
2 | * P1022 RDK board specific routines | ||
3 | * | ||
4 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
5 | * | ||
6 | * Author: Timur Tabi <timur@freescale.com> | ||
7 | * | ||
8 | * Based on p1022_ds.c | ||
9 | * | ||
10 | * This file is licensed under the terms of the GNU General Public License | ||
11 | * version 2. This program is licensed "as is" without any warranty of any | ||
12 | * kind, whether express or implied. | ||
13 | */ | ||
14 | |||
15 | #include <linux/pci.h> | ||
16 | #include <linux/of_platform.h> | ||
17 | #include <linux/memblock.h> | ||
18 | #include <asm/div64.h> | ||
19 | #include <asm/mpic.h> | ||
20 | #include <asm/swiotlb.h> | ||
21 | |||
22 | #include <sysdev/fsl_soc.h> | ||
23 | #include <sysdev/fsl_pci.h> | ||
24 | #include <asm/udbg.h> | ||
25 | #include <asm/fsl_guts.h> | ||
26 | #include "smp.h" | ||
27 | |||
28 | #include "mpc85xx.h" | ||
29 | |||
30 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) | ||
31 | |||
32 | /* DIU Pixel Clock bits of the CLKDVDR Global Utilities register */ | ||
33 | #define CLKDVDR_PXCKEN 0x80000000 | ||
34 | #define CLKDVDR_PXCKINV 0x10000000 | ||
35 | #define CLKDVDR_PXCKDLY 0x06000000 | ||
36 | #define CLKDVDR_PXCLK_MASK 0x00FF0000 | ||
37 | |||
38 | /** | ||
39 | * p1022rdk_set_monitor_port: switch the output to a different monitor port | ||
40 | */ | ||
41 | static void p1022rdk_set_monitor_port(enum fsl_diu_monitor_port port) | ||
42 | { | ||
43 | if (port != FSL_DIU_PORT_DVI) { | ||
44 | pr_err("p1022rdk: unsupported monitor port %i\n", port); | ||
45 | return; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * p1022rdk_set_pixel_clock: program the DIU's clock | ||
51 | * | ||
52 | * @pixclock: the wavelength, in picoseconds, of the clock | ||
53 | */ | ||
54 | void p1022rdk_set_pixel_clock(unsigned int pixclock) | ||
55 | { | ||
56 | struct device_node *guts_np = NULL; | ||
57 | struct ccsr_guts __iomem *guts; | ||
58 | unsigned long freq; | ||
59 | u64 temp; | ||
60 | u32 pxclk; | ||
61 | |||
62 | /* Map the global utilities registers. */ | ||
63 | guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); | ||
64 | if (!guts_np) { | ||
65 | pr_err("p1022rdk: missing global utilties device node\n"); | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | guts = of_iomap(guts_np, 0); | ||
70 | of_node_put(guts_np); | ||
71 | if (!guts) { | ||
72 | pr_err("p1022rdk: could not map global utilties device\n"); | ||
73 | return; | ||
74 | } | ||
75 | |||
76 | /* Convert pixclock from a wavelength to a frequency */ | ||
77 | temp = 1000000000000ULL; | ||
78 | do_div(temp, pixclock); | ||
79 | freq = temp; | ||
80 | |||
81 | /* | ||
82 | * 'pxclk' is the ratio of the platform clock to the pixel clock. | ||
83 | * This number is programmed into the CLKDVDR register, and the valid | ||
84 | * range of values is 2-255. | ||
85 | */ | ||
86 | pxclk = DIV_ROUND_CLOSEST(fsl_get_sys_freq(), freq); | ||
87 | pxclk = clamp_t(u32, pxclk, 2, 255); | ||
88 | |||
89 | /* Disable the pixel clock, and set it to non-inverted and no delay */ | ||
90 | clrbits32(&guts->clkdvdr, | ||
91 | CLKDVDR_PXCKEN | CLKDVDR_PXCKDLY | CLKDVDR_PXCLK_MASK); | ||
92 | |||
93 | /* Enable the clock and set the pxclk */ | ||
94 | setbits32(&guts->clkdvdr, CLKDVDR_PXCKEN | (pxclk << 16)); | ||
95 | |||
96 | iounmap(guts); | ||
97 | } | ||
98 | |||
99 | /** | ||
100 | * p1022rdk_valid_monitor_port: set the monitor port for sysfs | ||
101 | */ | ||
102 | enum fsl_diu_monitor_port | ||
103 | p1022rdk_valid_monitor_port(enum fsl_diu_monitor_port port) | ||
104 | { | ||
105 | return FSL_DIU_PORT_DVI; | ||
106 | } | ||
107 | |||
108 | #endif | ||
109 | |||
110 | void __init p1022_rdk_pic_init(void) | ||
111 | { | ||
112 | struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN | | ||
113 | MPIC_SINGLE_DEST_CPU, | ||
114 | 0, 256, " OpenPIC "); | ||
115 | BUG_ON(mpic == NULL); | ||
116 | mpic_init(mpic); | ||
117 | } | ||
118 | |||
119 | /* | ||
120 | * Setup the architecture | ||
121 | */ | ||
122 | static void __init p1022_rdk_setup_arch(void) | ||
123 | { | ||
124 | #ifdef CONFIG_PCI | ||
125 | struct device_node *np; | ||
126 | #endif | ||
127 | dma_addr_t max = 0xffffffff; | ||
128 | |||
129 | if (ppc_md.progress) | ||
130 | ppc_md.progress("p1022_rdk_setup_arch()", 0); | ||
131 | |||
132 | #ifdef CONFIG_PCI | ||
133 | for_each_compatible_node(np, "pci", "fsl,p1022-pcie") { | ||
134 | struct resource rsrc; | ||
135 | struct pci_controller *hose; | ||
136 | |||
137 | of_address_to_resource(np, 0, &rsrc); | ||
138 | |||
139 | if ((rsrc.start & 0xfffff) == 0x8000) | ||
140 | fsl_add_bridge(np, 1); | ||
141 | else | ||
142 | fsl_add_bridge(np, 0); | ||
143 | |||
144 | hose = pci_find_hose_for_OF_device(np); | ||
145 | max = min(max, hose->dma_window_base_cur + | ||
146 | hose->dma_window_size); | ||
147 | } | ||
148 | #endif | ||
149 | |||
150 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) | ||
151 | diu_ops.set_monitor_port = p1022rdk_set_monitor_port; | ||
152 | diu_ops.set_pixel_clock = p1022rdk_set_pixel_clock; | ||
153 | diu_ops.valid_monitor_port = p1022rdk_valid_monitor_port; | ||
154 | #endif | ||
155 | |||
156 | mpc85xx_smp_init(); | ||
157 | |||
158 | #ifdef CONFIG_SWIOTLB | ||
159 | if ((memblock_end_of_DRAM() - 1) > max) { | ||
160 | ppc_swiotlb_enable = 1; | ||
161 | set_pci_dma_ops(&swiotlb_dma_ops); | ||
162 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; | ||
163 | } | ||
164 | #endif | ||
165 | |||
166 | pr_info("Freescale / iVeia P1022 RDK reference board\n"); | ||
167 | } | ||
168 | |||
169 | machine_device_initcall(p1022_rdk, mpc85xx_common_publish_devices); | ||
170 | |||
171 | machine_arch_initcall(p1022_rdk, swiotlb_setup_bus_notifier); | ||
172 | |||
173 | /* | ||
174 | * Called very early, device-tree isn't unflattened | ||
175 | */ | ||
176 | static int __init p1022_rdk_probe(void) | ||
177 | { | ||
178 | unsigned long root = of_get_flat_dt_root(); | ||
179 | |||
180 | return of_flat_dt_is_compatible(root, "fsl,p1022rdk"); | ||
181 | } | ||
182 | |||
183 | define_machine(p1022_rdk) { | ||
184 | .name = "P1022 RDK", | ||
185 | .probe = p1022_rdk_probe, | ||
186 | .setup_arch = p1022_rdk_setup_arch, | ||
187 | .init_IRQ = p1022_rdk_pic_init, | ||
188 | #ifdef CONFIG_PCI | ||
189 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, | ||
190 | #endif | ||
191 | .get_irq = mpic_get_irq, | ||
192 | .restart = fsl_rstcr_restart, | ||
193 | .calibrate_decr = generic_calibrate_decr, | ||
194 | .progress = udbg_progress, | ||
195 | }; | ||