1bc8f8c26SIlya Yanok /* 2bc8f8c26SIlya Yanok * Copyright (C) 2010 Freescale Semiconductor, Inc. 3bc8f8c26SIlya Yanok * Copyright (C) 2010 Ilya Yanok, Emcraft Systems, yanok@emcraft.com 4bc8f8c26SIlya Yanok * 5bc8f8c26SIlya Yanok * See file CREDITS for list of people who contributed to this 6bc8f8c26SIlya Yanok * project. 7bc8f8c26SIlya Yanok * 8bc8f8c26SIlya Yanok * This program is free software; you can redistribute it and/or 9bc8f8c26SIlya Yanok * modify it under the terms of the GNU General Public License as 10bc8f8c26SIlya Yanok * published by the Free Software Foundation; either version 2 of 11bc8f8c26SIlya Yanok * the License, or (at your option) any later version. 12bc8f8c26SIlya Yanok * 13bc8f8c26SIlya Yanok * This program is distributed in the hope that it will be useful, 14bc8f8c26SIlya Yanok * but WITHOUT ANY WARRANTY; without even the implied warranty of 15bc8f8c26SIlya Yanok * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the 16bc8f8c26SIlya Yanok * GNU General Public License for more details. 17bc8f8c26SIlya Yanok * 18bc8f8c26SIlya Yanok * You should have received a copy of the GNU General Public License 19bc8f8c26SIlya Yanok * along with this program; if not, write to the Free Software 20bc8f8c26SIlya Yanok * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21bc8f8c26SIlya Yanok * MA 02111-1307 USA 22bc8f8c26SIlya Yanok */ 23bc8f8c26SIlya Yanok 24bc8f8c26SIlya Yanok #include <common.h> 25bc8f8c26SIlya Yanok #include <i2c.h> 26bc8f8c26SIlya Yanok #include <libfdt.h> 27bc8f8c26SIlya Yanok #include <fdt_support.h> 28bc8f8c26SIlya Yanok #include <pci.h> 29bc8f8c26SIlya Yanok #include <mpc83xx.h> 30bc8f8c26SIlya Yanok #include <netdev.h> 31bc8f8c26SIlya Yanok #include <asm/io.h> 32bc8f8c26SIlya Yanok #include <asm/fsl_serdes.h> 33bc8f8c26SIlya Yanok #include <asm/fsl_mpc83xx_serdes.h> 34bc8f8c26SIlya Yanok 35bc8f8c26SIlya Yanok DECLARE_GLOBAL_DATA_PTR; 36bc8f8c26SIlya Yanok 37bc8f8c26SIlya Yanok int checkboard(void) 38bc8f8c26SIlya Yanok { 39bc8f8c26SIlya Yanok printf("Board: MPC8308 P1M\n"); 40bc8f8c26SIlya Yanok 41bc8f8c26SIlya Yanok return 0; 42bc8f8c26SIlya Yanok } 43bc8f8c26SIlya Yanok 44bc8f8c26SIlya Yanok static struct pci_region pcie_regions_0[] = { 45bc8f8c26SIlya Yanok { 46bc8f8c26SIlya Yanok .bus_start = CONFIG_SYS_PCIE1_MEM_BASE, 47bc8f8c26SIlya Yanok .phys_start = CONFIG_SYS_PCIE1_MEM_PHYS, 48bc8f8c26SIlya Yanok .size = CONFIG_SYS_PCIE1_MEM_SIZE, 49bc8f8c26SIlya Yanok .flags = PCI_REGION_MEM, 50bc8f8c26SIlya Yanok }, 51bc8f8c26SIlya Yanok { 52bc8f8c26SIlya Yanok .bus_start = CONFIG_SYS_PCIE1_IO_BASE, 53bc8f8c26SIlya Yanok .phys_start = CONFIG_SYS_PCIE1_IO_PHYS, 54bc8f8c26SIlya Yanok .size = CONFIG_SYS_PCIE1_IO_SIZE, 55bc8f8c26SIlya Yanok .flags = PCI_REGION_IO, 56bc8f8c26SIlya Yanok }, 57bc8f8c26SIlya Yanok }; 58bc8f8c26SIlya Yanok 59bc8f8c26SIlya Yanok void pci_init_board(void) 60bc8f8c26SIlya Yanok { 61bc8f8c26SIlya Yanok immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; 62bc8f8c26SIlya Yanok sysconf83xx_t *sysconf = &immr->sysconf; 63bc8f8c26SIlya Yanok law83xx_t *pcie_law = sysconf->pcielaw; 64bc8f8c26SIlya Yanok struct pci_region *pcie_reg[] = { pcie_regions_0 }; 65bc8f8c26SIlya Yanok 66bc8f8c26SIlya Yanok fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_PEX, 67bc8f8c26SIlya Yanok FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V); 68bc8f8c26SIlya Yanok 69bc8f8c26SIlya Yanok /* Deassert the resets in the control register */ 70bc8f8c26SIlya Yanok out_be32(&sysconf->pecr1, 0xE0008000); 71bc8f8c26SIlya Yanok udelay(2000); 72bc8f8c26SIlya Yanok 73bc8f8c26SIlya Yanok /* Configure PCI Express Local Access Windows */ 74bc8f8c26SIlya Yanok out_be32(&pcie_law[0].bar, CONFIG_SYS_PCIE1_BASE & LAWBAR_BAR); 75bc8f8c26SIlya Yanok out_be32(&pcie_law[0].ar, LBLAWAR_EN | LBLAWAR_512MB); 76bc8f8c26SIlya Yanok 77*6aa3d3bfSPeter Tyser mpc83xx_pcie_init(1, pcie_reg); 78bc8f8c26SIlya Yanok } 79bc8f8c26SIlya Yanok 80bc8f8c26SIlya Yanok #if defined(CONFIG_OF_BOARD_SETUP) 81bc8f8c26SIlya Yanok void ft_board_setup(void *blob, bd_t *bd) 82bc8f8c26SIlya Yanok { 83bc8f8c26SIlya Yanok ft_cpu_setup(blob, bd); 84bc8f8c26SIlya Yanok fdt_fixup_dr_usb(blob, bd); 85bc8f8c26SIlya Yanok } 86bc8f8c26SIlya Yanok #endif 87bc8f8c26SIlya Yanok 88bc8f8c26SIlya Yanok int board_eth_init(bd_t *bis) 89bc8f8c26SIlya Yanok { 90bc8f8c26SIlya Yanok int rv, num_if = 0; 91bc8f8c26SIlya Yanok 92bc8f8c26SIlya Yanok /* Initialize TSECs first */ 93bc8f8c26SIlya Yanok rv = cpu_eth_init(bis); 94bc8f8c26SIlya Yanok if (rv >= 0) 95bc8f8c26SIlya Yanok num_if += rv; 96bc8f8c26SIlya Yanok else 97bc8f8c26SIlya Yanok printf("ERROR: failed to initialize TSECs.\n"); 98bc8f8c26SIlya Yanok 99bc8f8c26SIlya Yanok rv = pci_eth_init(bis); 100bc8f8c26SIlya Yanok if (rv >= 0) 101bc8f8c26SIlya Yanok num_if += rv; 102bc8f8c26SIlya Yanok else 103bc8f8c26SIlya Yanok printf("ERROR: failed to initialize PCI Ethernet.\n"); 104bc8f8c26SIlya Yanok 105bc8f8c26SIlya Yanok return num_if; 106bc8f8c26SIlya Yanok } 107