2 * Copyright 2009-2011 Freescale Semiconductor, Inc.
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <linux/compiler.h>
28 #include <asm/processor.h>
29 #include <asm/cache.h>
30 #include <asm/immap_85xx.h>
31 #include <asm/fsl_law.h>
32 #include <asm/fsl_serdes.h>
33 #include <asm/fsl_portals.h>
34 #include <asm/fsl_liodn.h>
36 extern void pci_of_setup(void *blob, bd_t *bd);
38 #include "../common/ngpixis.h"
40 DECLARE_GLOBAL_DATA_PTR;
45 struct cpu_type *cpu = gd->cpu;
46 ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
49 printf("Board: %sDS, ", cpu->name);
50 printf("Sys ID: 0x%02x, Sys Ver: 0x%02x, FPGA Ver: 0x%02x, ",
51 in_8(&pixis->id), in_8(&pixis->arch), in_8(&pixis->scver));
53 sw = in_8(&PIXIS_SW(PIXIS_LBMAP_SWITCH));
54 sw = (sw & PIXIS_LBMAP_MASK) >> PIXIS_LBMAP_SHIFT;
57 printf("vBank: %d\n", sw);
63 printf("invalid setting of SW%u\n", PIXIS_LBMAP_SWITCH);
65 #ifdef CONFIG_PHYS_64BIT
66 puts("36-bit Addressing\n");
69 /* Display the RCW, so that no one gets confused as to what RCW
70 * we're actually using for this boot.
72 puts("Reset Configuration Word (RCW):");
73 for (i = 0; i < ARRAY_SIZE(gur->rcwsr); i++) {
74 u32 rcw = in_be32(&gur->rcwsr[i]);
77 printf("\n %08x:", i * 4);
82 /* Display the actual SERDES reference clocks as configured by the
83 * dip switches on the board. Note that the SWx registers could
84 * technically be set to force the reference clocks to match the
85 * values that the SERDES expects (or vice versa). For now, however,
86 * we just display both values and hope the user notices when they
89 puts("SERDES Reference Clocks: ");
90 sw = in_8(&PIXIS_SW(3));
91 printf("Bank1=%uMHz ", (sw & 0x40) ? 125 : 100);
92 printf("Bank2=%sMHz ", (sw & 0x20) ? "156.25" : "125");
93 printf("Bank3=%sMHz\n", (sw & 0x10) ? "156.25" : "125");
98 int board_early_init_f(void)
100 volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
103 * P4080 DS board only uses the DDR1_MCK0/3 and DDR2_MCK0/3
104 * disable the DDR1_MCK1/2/4/5 and DDR2_MCK1/2/4/5 to reduce
105 * the noise introduced by these unterminated and unused clock pairs.
107 setbits_be32(&gur->ddrclkdr, 0x001B001B);
112 int board_early_init_r(void)
114 const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
115 const u8 flash_esel = find_tlb_idx((void *)flashbase, 1);
118 * Remap Boot flash + PROMJET region to caching-inhibited
119 * so that flash can be erased properly.
122 /* Flush d-cache and invalidate i-cache of any FLASH data */
126 /* invalidate existing TLB entry for flash + promjet */
127 disable_tlb(flash_esel);
129 set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS, /* tlb, epn, rpn */
130 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, /* perms, wimge */
131 0, flash_esel, BOOKE_PAGESZ_256M, 1); /* ts, esel, tsize, iprot */
139 static const char *serdes_clock_to_string(u32 clock)
142 case SRDS_PLLCR0_RFCK_SEL_100:
144 case SRDS_PLLCR0_RFCK_SEL_125:
146 case SRDS_PLLCR0_RFCK_SEL_156_25:
153 #define NUM_SRDS_BANKS 3
155 int misc_init_r(void)
157 serdes_corenet_t *srds_regs = (void *)CONFIG_SYS_FSL_CORENET_SERDES_ADDR;
158 u32 actual[NUM_SRDS_BANKS];
162 /* Warn if the expected SERDES reference clocks don't match the
163 * actual reference clocks. This needs to be done after calling
164 * p4080_erratum_serdes8(), since that function may modify the clocks.
166 sw3 = in_8(&PIXIS_SW(3));
167 actual[0] = (sw3 & 0x40) ?
168 SRDS_PLLCR0_RFCK_SEL_125 : SRDS_PLLCR0_RFCK_SEL_100;
169 actual[1] = (sw3 & 0x20) ?
170 SRDS_PLLCR0_RFCK_SEL_156_25 : SRDS_PLLCR0_RFCK_SEL_125;
171 actual[2] = (sw3 & 0x10) ?
172 SRDS_PLLCR0_RFCK_SEL_156_25 : SRDS_PLLCR0_RFCK_SEL_125;
174 for (i = 0; i < NUM_SRDS_BANKS; i++) {
175 u32 expected = srds_regs->bank[i].pllcr0 & SRDS_PLLCR0_RFCK_SEL_MASK;
176 if (expected != actual[i]) {
177 printf("Warning: SERDES bank %u expects reference clock"
178 " %sMHz, but actual is %sMHz\n", i + 1,
179 serdes_clock_to_string(expected),
180 serdes_clock_to_string(actual[i]));
187 void ft_board_setup(void *blob, bd_t *bd)
192 ft_cpu_setup(blob, bd);
194 base = getenv_bootm_low();
195 size = getenv_bootm_size();
197 fdt_fixup_memory(blob, (u64)base, (u64)size);
200 pci_of_setup(blob, bd);
203 fdt_fixup_liodn(blob);
206 int board_eth_init(bd_t *bis)
208 return pci_eth_init(bis);