Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 1 | /* |
Kumar Gala | 6525d51 | 2010-07-08 22:37:44 -0500 | [diff] [blame] | 2 | * Copyright 2007,2009-2010 Freescale Semiconductor, Inc. |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 3 | * |
| 4 | * See file CREDITS for list of people who contributed to this |
| 5 | * project. |
| 6 | * |
| 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. |
| 11 | * |
| 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. |
| 16 | * |
| 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, |
| 20 | * MA 02111-1307 USA |
| 21 | */ |
| 22 | |
| 23 | #include <common.h> |
| 24 | #include <command.h> |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 25 | #include <pci.h> |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 26 | #include <asm/processor.h> |
Kumar Gala | 1167a2f | 2008-08-26 08:02:30 -0500 | [diff] [blame] | 27 | #include <asm/mmu.h> |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 28 | #include <asm/immap_85xx.h> |
Kumar Gala | c851462 | 2009-04-02 13:22:48 -0500 | [diff] [blame] | 29 | #include <asm/fsl_pci.h> |
Kumar Gala | 1167a2f | 2008-08-26 08:02:30 -0500 | [diff] [blame] | 30 | #include <asm/fsl_ddr_sdram.h> |
Kumar Gala | 5d27e02 | 2010-12-15 04:55:20 -0600 | [diff] [blame] | 31 | #include <asm/fsl_serdes.h> |
Kumar Gala | 56a9270 | 2007-08-30 16:18:18 -0500 | [diff] [blame] | 32 | #include <asm/io.h> |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 33 | #include <miiphy.h> |
Kumar Gala | addce57 | 2007-11-26 17:12:24 -0600 | [diff] [blame] | 34 | #include <libfdt.h> |
| 35 | #include <fdt_support.h> |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 36 | #include <tsec.h> |
Ben Warren | 0b252f5 | 2008-08-31 21:41:08 -0700 | [diff] [blame] | 37 | #include <netdev.h> |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 38 | |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 39 | #include "../common/sgmii_riser.h" |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 40 | |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 41 | int checkboard (void) |
| 42 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 43 | volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); |
Becky Bruce | f51cdaf | 2010-06-17 11:37:20 -0500 | [diff] [blame] | 44 | volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 45 | volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR); |
Kumar Gala | 6bb5b41 | 2009-07-14 22:42:01 -0500 | [diff] [blame] | 46 | u8 vboot; |
| 47 | u8 *pixis_base = (u8 *)PIXIS_BASE; |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 48 | |
Wolfgang Denk | 2f15278 | 2007-05-05 18:23:11 +0200 | [diff] [blame] | 49 | if ((uint)&gur->porpllsr != 0xe00e0000) { |
Wolfgang Denk | 9b55a25 | 2008-07-11 01:16:00 +0200 | [diff] [blame] | 50 | printf("immap size error %lx\n",(ulong)&gur->porpllsr); |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 51 | } |
Kumar Gala | 6bb5b41 | 2009-07-14 22:42:01 -0500 | [diff] [blame] | 52 | printf ("Board: MPC8544DS, Sys ID: 0x%02x, " |
| 53 | "Sys Ver: 0x%02x, FPGA Ver: 0x%02x, ", |
| 54 | in_8(pixis_base + PIXIS_ID), in_8(pixis_base + PIXIS_VER), |
| 55 | in_8(pixis_base + PIXIS_PVER)); |
| 56 | |
| 57 | vboot = in_8(pixis_base + PIXIS_VBOOT); |
| 58 | if (vboot & PIXIS_VBOOT_FMAP) |
| 59 | printf ("vBank: %d\n", ((vboot & PIXIS_VBOOT_FBANK) >> 6)); |
| 60 | else |
| 61 | puts ("Promjet\n"); |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 62 | |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 63 | lbc->ltesr = 0xffffffff; /* Clear LBC error interrupts */ |
| 64 | lbc->lteir = 0xffffffff; /* Enable LBC error interrupts */ |
| 65 | ecm->eedr = 0xffffffff; /* Clear ecm errors */ |
| 66 | ecm->eeer = 0xffffffff; /* Enable ecm errors */ |
| 67 | |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 68 | return 0; |
| 69 | } |
| 70 | |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 71 | #ifdef CONFIG_PCI1 |
| 72 | static struct pci_controller pci1_hose; |
| 73 | #endif |
| 74 | |
| 75 | #ifdef CONFIG_PCIE1 |
| 76 | static struct pci_controller pcie1_hose; |
| 77 | #endif |
| 78 | |
| 79 | #ifdef CONFIG_PCIE2 |
| 80 | static struct pci_controller pcie2_hose; |
| 81 | #endif |
| 82 | |
| 83 | #ifdef CONFIG_PCIE3 |
| 84 | static struct pci_controller pcie3_hose; |
| 85 | #endif |
| 86 | |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 87 | void pci_init_board(void) |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 88 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 89 | volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 90 | struct fsl_pci_info pci_info[4]; |
| 91 | u32 devdisr, pordevsr, io_sel; |
| 92 | u32 porpllsr, pci_agent, pci_speed, pci_32, pci_arb, pci_clk_sel; |
| 93 | int first_free_busno = 0; |
| 94 | int num = 0; |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 95 | |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 96 | int pcie_ep, pcie_configured; |
| 97 | |
| 98 | devdisr = in_be32(&gur->devdisr); |
| 99 | pordevsr = in_be32(&gur->pordevsr); |
| 100 | porpllsr = in_be32(&gur->porpllsr); |
| 101 | io_sel = (pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19; |
| 102 | |
| 103 | debug (" pci_init_board: devdisr=%x, io_sel=%x\n", devdisr, io_sel); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 104 | |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 105 | puts("\n"); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 106 | |
| 107 | #ifdef CONFIG_PCIE3 |
Kumar Gala | 5d27e02 | 2010-12-15 04:55:20 -0600 | [diff] [blame] | 108 | pcie_configured = is_serdes_configured(PCIE3); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 109 | |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 110 | if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE3)){ |
| 111 | SET_STD_PCIE_INFO(pci_info[num], 3); |
| 112 | pcie_ep = fsl_setup_hose(&pcie3_hose, pci_info[num].regs); |
Kumar Gala | 10795f4 | 2008-12-02 16:08:36 -0600 | [diff] [blame] | 113 | #ifdef CONFIG_SYS_PCIE3_MEM_BUS2 |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 114 | /* outbound memory */ |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 115 | pci_set_region(&pcie3_hose.regions[0], |
Kumar Gala | 10795f4 | 2008-12-02 16:08:36 -0600 | [diff] [blame] | 116 | CONFIG_SYS_PCIE3_MEM_BUS2, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 117 | CONFIG_SYS_PCIE3_MEM_PHYS2, |
| 118 | CONFIG_SYS_PCIE3_MEM_SIZE2, |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 119 | PCI_REGION_MEM); |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 120 | |
| 121 | pcie3_hose.region_count = 1; |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 122 | #endif |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 123 | printf("PCIE3: connected to ULI as %s (base addr %lx)\n", |
| 124 | pcie_ep ? "Endpoint" : "Root Complex", |
| 125 | pci_info[num].regs); |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 126 | first_free_busno = fsl_pci_init_port(&pci_info[num++], |
| 127 | &pcie3_hose, first_free_busno); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 128 | |
Kumar Gala | 56a9270 | 2007-08-30 16:18:18 -0500 | [diff] [blame] | 129 | /* |
| 130 | * Activate ULI1575 legacy chip by performing a fake |
| 131 | * memory access. Needed to make ULI RTC work. |
| 132 | */ |
Kumar Gala | 10795f4 | 2008-12-02 16:08:36 -0600 | [diff] [blame] | 133 | in_be32((u32 *)CONFIG_SYS_PCIE3_MEM_BUS); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 134 | } else { |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 135 | printf("PCIE3: disabled\n"); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 136 | } |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 137 | puts("\n"); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 138 | #else |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 139 | setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCIE3); /* disable */ |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 140 | #endif |
| 141 | |
| 142 | #ifdef CONFIG_PCIE1 |
Kumar Gala | 5d27e02 | 2010-12-15 04:55:20 -0600 | [diff] [blame] | 143 | pcie_configured = is_serdes_configured(PCIE1); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 144 | |
| 145 | if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE)){ |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 146 | SET_STD_PCIE_INFO(pci_info[num], 1); |
| 147 | pcie_ep = fsl_setup_hose(&pcie1_hose, pci_info[num].regs); |
Kumar Gala | 10795f4 | 2008-12-02 16:08:36 -0600 | [diff] [blame] | 148 | #ifdef CONFIG_SYS_PCIE1_MEM_BUS2 |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 149 | /* outbound memory */ |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 150 | pci_set_region(&pcie1_hose.regions[0], |
Kumar Gala | 10795f4 | 2008-12-02 16:08:36 -0600 | [diff] [blame] | 151 | CONFIG_SYS_PCIE1_MEM_BUS2, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 152 | CONFIG_SYS_PCIE1_MEM_PHYS2, |
| 153 | CONFIG_SYS_PCIE1_MEM_SIZE2, |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 154 | PCI_REGION_MEM); |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 155 | |
| 156 | pcie1_hose.region_count = 1; |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 157 | #endif |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 158 | printf("PCIE1: connected to Slot 2 as %s (base addr %lx)\n", |
Peter Tyser | 64917ca | 2010-01-17 15:38:26 -0600 | [diff] [blame] | 159 | pcie_ep ? "Endpoint" : "Root Complex", |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 160 | pci_info[num].regs); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 161 | |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 162 | first_free_busno = fsl_pci_init_port(&pci_info[num++], |
| 163 | &pcie1_hose, first_free_busno); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 164 | } else { |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 165 | printf("PCIE1: disabled\n"); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 166 | } |
| 167 | |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 168 | puts("\n"); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 169 | #else |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 170 | setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCIE); /* disable */ |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 171 | #endif |
| 172 | |
| 173 | #ifdef CONFIG_PCIE2 |
Kumar Gala | 5d27e02 | 2010-12-15 04:55:20 -0600 | [diff] [blame] | 174 | pcie_configured = is_serdes_configured(PCIE2); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 175 | |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 176 | if (pcie_configured && !(devdisr & MPC85xx_DEVDISR_PCIE2)){ |
| 177 | SET_STD_PCIE_INFO(pci_info[num], 2); |
| 178 | pcie_ep = fsl_setup_hose(&pcie2_hose, pci_info[num].regs); |
Kumar Gala | 10795f4 | 2008-12-02 16:08:36 -0600 | [diff] [blame] | 179 | #ifdef CONFIG_SYS_PCIE2_MEM_BUS2 |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 180 | /* outbound memory */ |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 181 | pci_set_region(&pcie2_hose.regions[0], |
Kumar Gala | 10795f4 | 2008-12-02 16:08:36 -0600 | [diff] [blame] | 182 | CONFIG_SYS_PCIE2_MEM_BUS2, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 183 | CONFIG_SYS_PCIE2_MEM_PHYS2, |
| 184 | CONFIG_SYS_PCIE2_MEM_SIZE2, |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 185 | PCI_REGION_MEM); |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 186 | |
| 187 | pcie2_hose.region_count = 1; |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 188 | #endif |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 189 | printf("PCIE2: connected to Slot 1 as %s (base addr %lx)\n", |
| 190 | pcie_ep ? "Endpoint" : "Root Complex", |
| 191 | pci_info[num].regs); |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 192 | first_free_busno = fsl_pci_init_port(&pci_info[num++], |
| 193 | &pcie2_hose, first_free_busno); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 194 | } else { |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 195 | printf("PCIE2: disabled\n"); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 196 | } |
| 197 | |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 198 | puts("\n"); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 199 | #else |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 200 | setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCIE2); /* disable */ |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 201 | #endif |
| 202 | |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 203 | #ifdef CONFIG_PCI1 |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 204 | pci_speed = 66666000; |
| 205 | pci_32 = 1; |
| 206 | pci_arb = pordevsr & MPC85xx_PORDEVSR_PCI1_ARB; |
| 207 | pci_clk_sel = porpllsr & MPC85xx_PORDEVSR_PCI1_SPD; |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 208 | |
| 209 | if (!(devdisr & MPC85xx_DEVDISR_PCI1)) { |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 210 | SET_STD_PCI_INFO(pci_info[num], 1); |
| 211 | pci_agent = fsl_setup_hose(&pci1_hose, pci_info[num].regs); |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 212 | printf("PCI: %d bit, %s MHz, %s, %s, %s (base address %lx)\n", |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 213 | (pci_32) ? 32 : 64, |
| 214 | (pci_speed == 33333000) ? "33" : |
| 215 | (pci_speed == 66666000) ? "66" : "unknown", |
| 216 | pci_clk_sel ? "sync" : "async", |
| 217 | pci_agent ? "agent" : "host", |
| 218 | pci_arb ? "arbiter" : "external-arbiter", |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 219 | pci_info[num].regs); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 220 | |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 221 | first_free_busno = fsl_pci_init_port(&pci_info[num++], |
| 222 | &pci1_hose, first_free_busno); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 223 | } else { |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 224 | printf("PCI: disabled\n"); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 225 | } |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 226 | |
| 227 | puts("\n"); |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 228 | #else |
Kumar Gala | 645d5a7 | 2009-11-04 10:22:26 -0600 | [diff] [blame] | 229 | setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI1); /* disable */ |
Ed Swarthout | 837f1ba | 2007-07-27 01:50:51 -0500 | [diff] [blame] | 230 | #endif |
| 231 | } |
| 232 | |
| 233 | |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 234 | int last_stage_init(void) |
| 235 | { |
| 236 | return 0; |
| 237 | } |
| 238 | |
| 239 | |
| 240 | unsigned long |
| 241 | get_board_sys_clk(ulong dummy) |
| 242 | { |
| 243 | u8 i, go_bit, rd_clks; |
| 244 | ulong val = 0; |
Kumar Gala | 048e7ef | 2009-07-22 10:12:39 -0500 | [diff] [blame] | 245 | u8 *pixis_base = (u8 *)PIXIS_BASE; |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 246 | |
Kumar Gala | 048e7ef | 2009-07-22 10:12:39 -0500 | [diff] [blame] | 247 | go_bit = in_8(pixis_base + PIXIS_VCTL); |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 248 | go_bit &= 0x01; |
| 249 | |
Kumar Gala | 048e7ef | 2009-07-22 10:12:39 -0500 | [diff] [blame] | 250 | rd_clks = in_8(pixis_base + PIXIS_VCFGEN0); |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 251 | rd_clks &= 0x1C; |
| 252 | |
| 253 | /* |
| 254 | * Only if both go bit and the SCLK bit in VCFGEN0 are set |
| 255 | * should we be using the AUX register. Remember, we also set the |
| 256 | * GO bit to boot from the alternate bank on the on-board flash |
| 257 | */ |
| 258 | |
| 259 | if (go_bit) { |
| 260 | if (rd_clks == 0x1c) |
Kumar Gala | 048e7ef | 2009-07-22 10:12:39 -0500 | [diff] [blame] | 261 | i = in_8(pixis_base + PIXIS_AUX); |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 262 | else |
Kumar Gala | 048e7ef | 2009-07-22 10:12:39 -0500 | [diff] [blame] | 263 | i = in_8(pixis_base + PIXIS_SPD); |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 264 | } else { |
Kumar Gala | 048e7ef | 2009-07-22 10:12:39 -0500 | [diff] [blame] | 265 | i = in_8(pixis_base + PIXIS_SPD); |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | i &= 0x07; |
| 269 | |
| 270 | switch (i) { |
| 271 | case 0: |
| 272 | val = 33333333; |
| 273 | break; |
| 274 | case 1: |
| 275 | val = 40000000; |
| 276 | break; |
| 277 | case 2: |
| 278 | val = 50000000; |
| 279 | break; |
| 280 | case 3: |
| 281 | val = 66666666; |
| 282 | break; |
| 283 | case 4: |
| 284 | val = 83000000; |
| 285 | break; |
| 286 | case 5: |
| 287 | val = 100000000; |
| 288 | break; |
| 289 | case 6: |
| 290 | val = 133333333; |
| 291 | break; |
| 292 | case 7: |
| 293 | val = 166666666; |
| 294 | break; |
| 295 | } |
| 296 | |
| 297 | return val; |
| 298 | } |
| 299 | |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 300 | int board_eth_init(bd_t *bis) |
| 301 | { |
Ben Warren | 0b252f5 | 2008-08-31 21:41:08 -0700 | [diff] [blame] | 302 | #ifdef CONFIG_TSEC_ENET |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 303 | struct tsec_info_struct tsec_info[2]; |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 304 | int num = 0; |
| 305 | |
| 306 | #ifdef CONFIG_TSEC1 |
| 307 | SET_STD_TSEC_INFO(tsec_info[num], 1); |
Kumar Gala | 058d7dc | 2010-12-16 14:28:06 -0600 | [diff] [blame] | 308 | if (is_serdes_configured(SGMII_TSEC1)) { |
| 309 | puts("eTSEC1 is in sgmii mode.\n"); |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 310 | tsec_info[num].flags |= TSEC_SGMII; |
Kumar Gala | 058d7dc | 2010-12-16 14:28:06 -0600 | [diff] [blame] | 311 | } |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 312 | num++; |
| 313 | #endif |
| 314 | #ifdef CONFIG_TSEC3 |
| 315 | SET_STD_TSEC_INFO(tsec_info[num], 3); |
Kumar Gala | 058d7dc | 2010-12-16 14:28:06 -0600 | [diff] [blame] | 316 | if (is_serdes_configured(SGMII_TSEC3)) { |
| 317 | puts("eTSEC3 is in sgmii mode.\n"); |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 318 | tsec_info[num].flags |= TSEC_SGMII; |
Kumar Gala | 058d7dc | 2010-12-16 14:28:06 -0600 | [diff] [blame] | 319 | } |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 320 | num++; |
| 321 | #endif |
| 322 | |
| 323 | if (!num) { |
| 324 | printf("No TSECs initialized\n"); |
| 325 | |
| 326 | return 0; |
| 327 | } |
| 328 | |
Kumar Gala | 058d7dc | 2010-12-16 14:28:06 -0600 | [diff] [blame] | 329 | if (is_serdes_configured(SGMII_TSEC1) || |
| 330 | is_serdes_configured(SGMII_TSEC3)) { |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 331 | fsl_sgmii_riser_init(tsec_info, num); |
Kumar Gala | 058d7dc | 2010-12-16 14:28:06 -0600 | [diff] [blame] | 332 | } |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 333 | |
| 334 | |
| 335 | tsec_eth_init(bis, tsec_info, num); |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 336 | #endif |
Ben Warren | 0b252f5 | 2008-08-31 21:41:08 -0700 | [diff] [blame] | 337 | return pci_eth_init(bis); |
| 338 | } |
Andy Fleming | 216f2a7 | 2008-08-31 16:33:29 -0500 | [diff] [blame] | 339 | |
Kumar Gala | addce57 | 2007-11-26 17:12:24 -0600 | [diff] [blame] | 340 | #if defined(CONFIG_OF_BOARD_SETUP) |
Kumar Gala | 2dba0de | 2008-10-21 08:28:33 -0500 | [diff] [blame] | 341 | void ft_board_setup(void *blob, bd_t *bd) |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 342 | { |
Wolfgang Denk | 2f15278 | 2007-05-05 18:23:11 +0200 | [diff] [blame] | 343 | ft_cpu_setup(blob, bd); |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 344 | |
Kumar Gala | 6525d51 | 2010-07-08 22:37:44 -0500 | [diff] [blame] | 345 | FT_FSL_PCI_SETUP; |
Kumar Gala | 2dba0de | 2008-10-21 08:28:33 -0500 | [diff] [blame] | 346 | |
Andy Fleming | feede8b | 2008-12-05 20:10:22 -0600 | [diff] [blame] | 347 | #ifdef CONFIG_FSL_SGMII_RISER |
| 348 | fsl_sgmii_riser_fdt_fixup(blob); |
| 349 | #endif |
Jon Loeliger | 25d83d7 | 2007-04-11 16:51:02 -0500 | [diff] [blame] | 350 | } |
| 351 | #endif |