Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 1 | /* |
| 2 | * MPC8610 HPCD board specific routines |
| 3 | * |
| 4 | * Initial author: Xianghua Xiao <x.xiao@freescale.com> |
| 5 | * Recode: Jason Jin <jason.jin@freescale.com> |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 6 | * York Sun <yorksun@freescale.com> |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 7 | * |
| 8 | * Rewrite the interrupt routing. remove the 8259PIC support, |
| 9 | * All the integrated device in ULI use sideband interrupt. |
| 10 | * |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 11 | * Copyright 2008 Freescale Semiconductor Inc. |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify it |
| 14 | * under the terms of the GNU General Public License as published by the |
| 15 | * Free Software Foundation; either version 2 of the License, or (at your |
| 16 | * option) any later version. |
| 17 | */ |
| 18 | |
| 19 | #include <linux/stddef.h> |
| 20 | #include <linux/kernel.h> |
| 21 | #include <linux/pci.h> |
Anton Vorontsov | 8c68e2f | 2009-09-16 01:44:00 +0400 | [diff] [blame] | 22 | #include <linux/interrupt.h> |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 23 | #include <linux/kdev_t.h> |
| 24 | #include <linux/delay.h> |
| 25 | #include <linux/seq_file.h> |
| 26 | #include <linux/of.h> |
| 27 | |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 28 | #include <asm/time.h> |
| 29 | #include <asm/machdep.h> |
| 30 | #include <asm/pci-bridge.h> |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 31 | #include <asm/prom.h> |
| 32 | #include <mm/mmu_decl.h> |
| 33 | #include <asm/udbg.h> |
| 34 | |
| 35 | #include <asm/mpic.h> |
| 36 | |
Timur Tabi | c7d24a2 | 2008-01-18 09:24:53 -0600 | [diff] [blame] | 37 | #include <linux/of_platform.h> |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 38 | #include <sysdev/fsl_pci.h> |
| 39 | #include <sysdev/fsl_soc.h> |
Anton Vorontsov | d2998c2 | 2009-06-18 16:49:02 -0700 | [diff] [blame] | 40 | #include <sysdev/simple_gpio.h> |
Timur Tabi | c8bfa77 | 2011-06-23 06:16:48 +0000 | [diff] [blame] | 41 | #include <asm/fsl_guts.h> |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 42 | |
Kumar Gala | 98384c6 | 2008-07-02 11:46:20 -0500 | [diff] [blame] | 43 | #include "mpc86xx.h" |
| 44 | |
Anton Vorontsov | 8c68e2f | 2009-09-16 01:44:00 +0400 | [diff] [blame] | 45 | static struct device_node *pixis_node; |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 46 | static unsigned char *pixis_bdcfg0, *pixis_arch; |
| 47 | |
Timur Tabi | c8bfa77 | 2011-06-23 06:16:48 +0000 | [diff] [blame] | 48 | /* DIU Pixel Clock bits of the CLKDVDR Global Utilities register */ |
| 49 | #define CLKDVDR_PXCKEN 0x80000000 |
| 50 | #define CLKDVDR_PXCKINV 0x10000000 |
| 51 | #define CLKDVDR_PXCKDLY 0x06000000 |
| 52 | #define CLKDVDR_PXCLK_MASK 0x001F0000 |
| 53 | |
Anton Vorontsov | 8c68e2f | 2009-09-16 01:44:00 +0400 | [diff] [blame] | 54 | #ifdef CONFIG_SUSPEND |
| 55 | static irqreturn_t mpc8610_sw9_irq(int irq, void *data) |
| 56 | { |
| 57 | pr_debug("%s: PIXIS' event (sw9/wakeup) IRQ handled\n", __func__); |
| 58 | return IRQ_HANDLED; |
| 59 | } |
| 60 | |
| 61 | static void __init mpc8610_suspend_init(void) |
| 62 | { |
| 63 | int irq; |
| 64 | int ret; |
| 65 | |
| 66 | if (!pixis_node) |
| 67 | return; |
| 68 | |
| 69 | irq = irq_of_parse_and_map(pixis_node, 0); |
| 70 | if (!irq) { |
| 71 | pr_err("%s: can't map pixis event IRQ.\n", __func__); |
| 72 | return; |
| 73 | } |
| 74 | |
Geert Uytterhoeven | e0be2c2 | 2011-05-04 16:29:31 +0200 | [diff] [blame] | 75 | ret = request_irq(irq, mpc8610_sw9_irq, 0, "sw9:wakeup", NULL); |
Anton Vorontsov | 8c68e2f | 2009-09-16 01:44:00 +0400 | [diff] [blame] | 76 | if (ret) { |
| 77 | pr_err("%s: can't request pixis event IRQ: %d\n", |
| 78 | __func__, ret); |
| 79 | irq_dispose_mapping(irq); |
| 80 | } |
| 81 | |
| 82 | enable_irq_wake(irq); |
| 83 | } |
| 84 | #else |
| 85 | static inline void mpc8610_suspend_init(void) { } |
| 86 | #endif /* CONFIG_SUSPEND */ |
| 87 | |
Uwe Kleine-König | ce6d73c | 2014-09-10 21:56:38 +0200 | [diff] [blame] | 88 | static const struct of_device_id mpc8610_ids[] __initconst = { |
Timur Tabi | c7d24a2 | 2008-01-18 09:24:53 -0600 | [diff] [blame] | 89 | { .compatible = "fsl,mpc8610-immr", }, |
Anton Vorontsov | 8c68e2f | 2009-09-16 01:44:00 +0400 | [diff] [blame] | 90 | { .compatible = "fsl,mpc8610-guts", }, |
Anton Vorontsov | 34b4a87 | 2008-05-04 22:46:27 +0400 | [diff] [blame] | 91 | { .compatible = "simple-bus", }, |
Timur Tabi | 4c5ddd5 | 2010-05-03 16:54:15 -0500 | [diff] [blame] | 92 | /* So that the DMA channel nodes can be probed individually: */ |
| 93 | { .compatible = "fsl,eloplus-dma", }, |
Jia Hongtao | 905e75c | 2012-08-28 15:44:08 +0800 | [diff] [blame] | 94 | /* PCI controllers */ |
| 95 | { .compatible = "fsl,mpc8610-pci", }, |
| 96 | { .compatible = "fsl,mpc8641-pcie", }, |
Timur Tabi | c7d24a2 | 2008-01-18 09:24:53 -0600 | [diff] [blame] | 97 | {} |
| 98 | }; |
| 99 | |
| 100 | static int __init mpc8610_declare_of_platform_devices(void) |
| 101 | { |
Anton Vorontsov | d2998c2 | 2009-06-18 16:49:02 -0700 | [diff] [blame] | 102 | /* Firstly, register PIXIS GPIOs. */ |
| 103 | simple_gpiochip_init("fsl,fpga-pixis-gpio-bank"); |
| 104 | |
Anton Vorontsov | 8c68e2f | 2009-09-16 01:44:00 +0400 | [diff] [blame] | 105 | /* Enable wakeup on PIXIS' event IRQ. */ |
| 106 | mpc8610_suspend_init(); |
| 107 | |
Timur Tabi | c7d24a2 | 2008-01-18 09:24:53 -0600 | [diff] [blame] | 108 | /* Without this call, the SSI device driver won't get probed. */ |
| 109 | of_platform_bus_probe(NULL, mpc8610_ids, NULL); |
| 110 | |
| 111 | return 0; |
| 112 | } |
Jia Hongtao | 905e75c | 2012-08-28 15:44:08 +0800 | [diff] [blame] | 113 | machine_arch_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); |
Timur Tabi | c7d24a2 | 2008-01-18 09:24:53 -0600 | [diff] [blame] | 114 | |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 115 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) |
| 116 | |
Timur Tabi | f46dad2 | 2011-05-09 14:29:40 -0500 | [diff] [blame] | 117 | /* |
| 118 | * DIU Area Descriptor |
| 119 | * |
| 120 | * The MPC8610 reference manual shows the bits of the AD register in |
| 121 | * little-endian order, which causes the BLUE_C field to be split into two |
| 122 | * parts. To simplify the definition of the MAKE_AD() macro, we define the |
| 123 | * fields in big-endian order and byte-swap the result. |
| 124 | * |
| 125 | * So even though the registers don't look like they're in the |
| 126 | * same bit positions as they are on the P1022, the same value is written to |
| 127 | * the AD register on the MPC8610 and on the P1022. |
| 128 | */ |
| 129 | #define AD_BYTE_F 0x10000000 |
| 130 | #define AD_ALPHA_C_MASK 0x0E000000 |
| 131 | #define AD_ALPHA_C_SHIFT 25 |
| 132 | #define AD_BLUE_C_MASK 0x01800000 |
| 133 | #define AD_BLUE_C_SHIFT 23 |
| 134 | #define AD_GREEN_C_MASK 0x00600000 |
| 135 | #define AD_GREEN_C_SHIFT 21 |
| 136 | #define AD_RED_C_MASK 0x00180000 |
| 137 | #define AD_RED_C_SHIFT 19 |
| 138 | #define AD_PALETTE 0x00040000 |
| 139 | #define AD_PIXEL_S_MASK 0x00030000 |
| 140 | #define AD_PIXEL_S_SHIFT 16 |
| 141 | #define AD_COMP_3_MASK 0x0000F000 |
| 142 | #define AD_COMP_3_SHIFT 12 |
| 143 | #define AD_COMP_2_MASK 0x00000F00 |
| 144 | #define AD_COMP_2_SHIFT 8 |
| 145 | #define AD_COMP_1_MASK 0x000000F0 |
| 146 | #define AD_COMP_1_SHIFT 4 |
| 147 | #define AD_COMP_0_MASK 0x0000000F |
| 148 | #define AD_COMP_0_SHIFT 0 |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 149 | |
Timur Tabi | f46dad2 | 2011-05-09 14:29:40 -0500 | [diff] [blame] | 150 | #define MAKE_AD(alpha, red, blue, green, size, c0, c1, c2, c3) \ |
| 151 | cpu_to_le32(AD_BYTE_F | (alpha << AD_ALPHA_C_SHIFT) | \ |
| 152 | (blue << AD_BLUE_C_SHIFT) | (green << AD_GREEN_C_SHIFT) | \ |
| 153 | (red << AD_RED_C_SHIFT) | (c3 << AD_COMP_3_SHIFT) | \ |
| 154 | (c2 << AD_COMP_2_SHIFT) | (c1 << AD_COMP_1_SHIFT) | \ |
| 155 | (c0 << AD_COMP_0_SHIFT) | (size << AD_PIXEL_S_SHIFT)) |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 156 | |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 157 | u32 mpc8610hpcd_get_pixel_format(enum fsl_diu_monitor_port port, |
| 158 | unsigned int bits_per_pixel) |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 159 | { |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 160 | static const u32 pixelformat[][3] = { |
Timur Tabi | f46dad2 | 2011-05-09 14:29:40 -0500 | [diff] [blame] | 161 | { |
| 162 | MAKE_AD(3, 0, 2, 1, 3, 8, 8, 8, 8), |
| 163 | MAKE_AD(4, 2, 0, 1, 2, 8, 8, 8, 0), |
| 164 | MAKE_AD(4, 0, 2, 1, 1, 5, 6, 5, 0) |
| 165 | }, |
| 166 | { |
| 167 | MAKE_AD(3, 2, 0, 1, 3, 8, 8, 8, 8), |
| 168 | MAKE_AD(4, 0, 2, 1, 2, 8, 8, 8, 0), |
| 169 | MAKE_AD(4, 2, 0, 1, 1, 5, 6, 5, 0) |
| 170 | }, |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 171 | }; |
Timur Tabi | f46dad2 | 2011-05-09 14:29:40 -0500 | [diff] [blame] | 172 | unsigned int arch_monitor; |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 173 | |
Timur Tabi | f46dad2 | 2011-05-09 14:29:40 -0500 | [diff] [blame] | 174 | /* The DVI port is mis-wired on revision 1 of this board. */ |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 175 | arch_monitor = |
| 176 | ((*pixis_arch == 0x01) && (port == FSL_DIU_PORT_DVI)) ? 0 : 1; |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 177 | |
Timur Tabi | f46dad2 | 2011-05-09 14:29:40 -0500 | [diff] [blame] | 178 | switch (bits_per_pixel) { |
| 179 | case 32: |
| 180 | return pixelformat[arch_monitor][0]; |
| 181 | case 24: |
| 182 | return pixelformat[arch_monitor][1]; |
| 183 | case 16: |
| 184 | return pixelformat[arch_monitor][2]; |
| 185 | default: |
| 186 | pr_err("fsl-diu: unsupported pixel depth %u\n", bits_per_pixel); |
| 187 | return 0; |
| 188 | } |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 189 | } |
| 190 | |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 191 | void mpc8610hpcd_set_gamma_table(enum fsl_diu_monitor_port port, |
| 192 | char *gamma_table_base) |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 193 | { |
| 194 | int i; |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 195 | if (port == FSL_DIU_PORT_DLVDS) { |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 196 | for (i = 0; i < 256*3; i++) |
| 197 | gamma_table_base[i] = (gamma_table_base[i] << 2) | |
| 198 | ((gamma_table_base[i] >> 6) & 0x03); |
| 199 | } |
| 200 | } |
| 201 | |
Anton Vorontsov | f637ef8 | 2008-05-12 16:35:33 +0400 | [diff] [blame] | 202 | #define PX_BRDCFG0_DVISEL (1 << 3) |
| 203 | #define PX_BRDCFG0_DLINK (1 << 4) |
| 204 | #define PX_BRDCFG0_DIU_MASK (PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK) |
| 205 | |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 206 | void mpc8610hpcd_set_monitor_port(enum fsl_diu_monitor_port port) |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 207 | { |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 208 | switch (port) { |
| 209 | case FSL_DIU_PORT_DVI: |
Anton Vorontsov | f637ef8 | 2008-05-12 16:35:33 +0400 | [diff] [blame] | 210 | clrsetbits_8(pixis_bdcfg0, PX_BRDCFG0_DIU_MASK, |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 211 | PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK); |
| 212 | break; |
| 213 | case FSL_DIU_PORT_LVDS: |
| 214 | clrsetbits_8(pixis_bdcfg0, PX_BRDCFG0_DIU_MASK, |
| 215 | PX_BRDCFG0_DLINK); |
| 216 | break; |
| 217 | case FSL_DIU_PORT_DLVDS: |
| 218 | clrbits8(pixis_bdcfg0, PX_BRDCFG0_DIU_MASK); |
| 219 | break; |
| 220 | } |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 221 | } |
| 222 | |
Timur Tabi | c8bfa77 | 2011-06-23 06:16:48 +0000 | [diff] [blame] | 223 | /** |
| 224 | * mpc8610hpcd_set_pixel_clock: program the DIU's clock |
| 225 | * |
| 226 | * @pixclock: the wavelength, in picoseconds, of the clock |
| 227 | */ |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 228 | void mpc8610hpcd_set_pixel_clock(unsigned int pixclock) |
| 229 | { |
Timur Tabi | c8bfa77 | 2011-06-23 06:16:48 +0000 | [diff] [blame] | 230 | struct device_node *guts_np = NULL; |
Timur Tabi | 9cb6abc | 2012-03-19 11:06:39 -0500 | [diff] [blame] | 231 | struct ccsr_guts __iomem *guts; |
Timur Tabi | c8bfa77 | 2011-06-23 06:16:48 +0000 | [diff] [blame] | 232 | unsigned long freq; |
| 233 | u64 temp; |
| 234 | u32 pxclk; |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 235 | |
Timur Tabi | c8bfa77 | 2011-06-23 06:16:48 +0000 | [diff] [blame] | 236 | /* Map the global utilities registers. */ |
| 237 | guts_np = of_find_compatible_node(NULL, NULL, "fsl,mpc8610-guts"); |
| 238 | if (!guts_np) { |
Tim Blechmann | b6741bc | 2012-12-14 21:06:18 +0100 | [diff] [blame] | 239 | pr_err("mpc8610hpcd: missing global utilities device node\n"); |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 240 | return; |
| 241 | } |
| 242 | |
Timur Tabi | c8bfa77 | 2011-06-23 06:16:48 +0000 | [diff] [blame] | 243 | guts = of_iomap(guts_np, 0); |
| 244 | of_node_put(guts_np); |
| 245 | if (!guts) { |
Tim Blechmann | b6741bc | 2012-12-14 21:06:18 +0100 | [diff] [blame] | 246 | pr_err("mpc8610hpcd: could not map global utilities device\n"); |
Timur Tabi | c8bfa77 | 2011-06-23 06:16:48 +0000 | [diff] [blame] | 247 | return; |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 248 | } |
| 249 | |
Timur Tabi | c8bfa77 | 2011-06-23 06:16:48 +0000 | [diff] [blame] | 250 | /* Convert pixclock from a wavelength to a frequency */ |
| 251 | temp = 1000000000000ULL; |
| 252 | do_div(temp, pixclock); |
| 253 | freq = temp; |
| 254 | |
| 255 | /* |
| 256 | * 'pxclk' is the ratio of the platform clock to the pixel clock. |
| 257 | * On the MPC8610, the value programmed into CLKDVDR is the ratio |
| 258 | * minus one. The valid range of values is 2-31. |
| 259 | */ |
| 260 | pxclk = DIV_ROUND_CLOSEST(fsl_get_sys_freq(), freq) - 1; |
| 261 | pxclk = clamp_t(u32, pxclk, 2, 31); |
| 262 | |
| 263 | /* Disable the pixel clock, and set it to non-inverted and no delay */ |
| 264 | clrbits32(&guts->clkdvdr, |
| 265 | CLKDVDR_PXCKEN | CLKDVDR_PXCKDLY | CLKDVDR_PXCLK_MASK); |
| 266 | |
| 267 | /* Enable the clock and set the pxclk */ |
| 268 | setbits32(&guts->clkdvdr, CLKDVDR_PXCKEN | (pxclk << 16)); |
| 269 | |
| 270 | iounmap(guts); |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 271 | } |
| 272 | |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 273 | enum fsl_diu_monitor_port |
| 274 | mpc8610hpcd_valid_monitor_port(enum fsl_diu_monitor_port port) |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 275 | { |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 276 | return port; |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 277 | } |
| 278 | |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 279 | #endif |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 280 | |
| 281 | static void __init mpc86xx_hpcd_setup_arch(void) |
| 282 | { |
| 283 | struct resource r; |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 284 | unsigned char *pixis; |
| 285 | |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 286 | if (ppc_md.progress) |
| 287 | ppc_md.progress("mpc86xx_hpcd_setup_arch()", 0); |
| 288 | |
Jia Hongtao | 905e75c | 2012-08-28 15:44:08 +0800 | [diff] [blame] | 289 | fsl_pci_assign_primary(); |
| 290 | |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 291 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 292 | diu_ops.get_pixel_format = mpc8610hpcd_get_pixel_format; |
| 293 | diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table; |
| 294 | diu_ops.set_monitor_port = mpc8610hpcd_set_monitor_port; |
| 295 | diu_ops.set_pixel_clock = mpc8610hpcd_set_pixel_clock; |
Timur Tabi | 7653aaa | 2011-07-09 15:38:14 -0500 | [diff] [blame] | 296 | diu_ops.valid_monitor_port = mpc8610hpcd_valid_monitor_port; |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 297 | #endif |
| 298 | |
Anton Vorontsov | 8c68e2f | 2009-09-16 01:44:00 +0400 | [diff] [blame] | 299 | pixis_node = of_find_compatible_node(NULL, NULL, "fsl,fpga-pixis"); |
| 300 | if (pixis_node) { |
| 301 | of_address_to_resource(pixis_node, 0, &r); |
| 302 | of_node_put(pixis_node); |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 303 | pixis = ioremap(r.start, 32); |
| 304 | if (!pixis) { |
| 305 | printk(KERN_ERR "Err: can't map FPGA cfg register!\n"); |
| 306 | return; |
| 307 | } |
| 308 | pixis_bdcfg0 = pixis + 8; |
| 309 | pixis_arch = pixis + 1; |
| 310 | } else |
| 311 | printk(KERN_ERR "Err: " |
| 312 | "can't find device node 'fsl,fpga-pixis'\n"); |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 313 | |
| 314 | printk("MPC86xx HPCD board from Freescale Semiconductor\n"); |
| 315 | } |
| 316 | |
| 317 | /* |
| 318 | * Called very early, device-tree isn't unflattened |
| 319 | */ |
| 320 | static int __init mpc86xx_hpcd_probe(void) |
| 321 | { |
| 322 | unsigned long root = of_get_flat_dt_root(); |
| 323 | |
| 324 | if (of_flat_dt_is_compatible(root, "fsl,MPC8610HPCD")) |
| 325 | return 1; /* Looks good */ |
| 326 | |
| 327 | return 0; |
| 328 | } |
| 329 | |
York Sun | 6f90a8bd | 2008-04-28 02:15:36 -0700 | [diff] [blame] | 330 | static long __init mpc86xx_time_init(void) |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 331 | { |
| 332 | unsigned int temp; |
| 333 | |
| 334 | /* Set the time base to zero */ |
| 335 | mtspr(SPRN_TBWL, 0); |
| 336 | mtspr(SPRN_TBWU, 0); |
| 337 | |
| 338 | temp = mfspr(SPRN_HID0); |
| 339 | temp |= HID0_TBEN; |
| 340 | mtspr(SPRN_HID0, temp); |
| 341 | asm volatile("isync"); |
| 342 | |
| 343 | return 0; |
| 344 | } |
| 345 | |
| 346 | define_machine(mpc86xx_hpcd) { |
| 347 | .name = "MPC86xx HPCD", |
| 348 | .probe = mpc86xx_hpcd_probe, |
| 349 | .setup_arch = mpc86xx_hpcd_setup_arch, |
Kumar Gala | 98384c6 | 2008-07-02 11:46:20 -0500 | [diff] [blame] | 350 | .init_IRQ = mpc86xx_init_irq, |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 351 | .get_irq = mpic_get_irq, |
Kumar Gala | e1c1575 | 2007-10-04 01:04:57 -0500 | [diff] [blame] | 352 | .restart = fsl_rstcr_restart, |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 353 | .time_init = mpc86xx_time_init, |
| 354 | .calibrate_decr = generic_calibrate_decr, |
| 355 | .progress = udbg_progress, |
Timur Tabi | b567d1c | 2012-10-15 14:52:21 -0500 | [diff] [blame] | 356 | #ifdef CONFIG_PCI |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 357 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
Timur Tabi | b567d1c | 2012-10-15 14:52:21 -0500 | [diff] [blame] | 358 | #endif |
Xianghua Xiao | 0e65bfe3 | 2007-10-03 15:09:33 -0500 | [diff] [blame] | 359 | }; |