Merge with /home/wd/git/u-boot/custodian/u-boot-mpc83xx
This commit is contained in:
102
board/freescale/common/pq-mds-pib.c
Normal file
102
board/freescale/common/pq-mds-pib.c
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* Tony Li <tony.li@freescale.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <i2c.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include "pq-mds-pib.h"
|
||||
|
||||
int pib_init(void)
|
||||
{
|
||||
u8 val8;
|
||||
u8 orig_i2c_bus;
|
||||
|
||||
/* Switch temporarily to I2C bus #2 */
|
||||
orig_i2c_bus = i2c_get_bus_num();
|
||||
i2c_set_bus_num(1);
|
||||
|
||||
val8 = 0;
|
||||
#if defined(CONFIG_PCI) && !defined(CONFIG_PCISLAVE)
|
||||
/* Assign PIB PMC slot to desired PCI bus */
|
||||
i2c_write(0x23, 0x6, 1, &val8, 1);
|
||||
i2c_write(0x23, 0x7, 1, &val8, 1);
|
||||
val8 = 0xff;
|
||||
i2c_write(0x23, 0x2, 1, &val8, 1);
|
||||
i2c_write(0x23, 0x3, 1, &val8, 1);
|
||||
|
||||
val8 = 0;
|
||||
i2c_write(0x26, 0x6, 1, &val8, 1);
|
||||
val8 = 0x34;
|
||||
i2c_write(0x26, 0x7, 1, &val8, 1);
|
||||
#if defined(CONFIG_MPC832XEMDS)
|
||||
val8 = 0xf9; /* PMC2, PMC3 slot to PCI bus */
|
||||
#else
|
||||
val8 = 0xf3; /* PMC1, PMC2, PMC3 slot to PCI bus */
|
||||
#endif
|
||||
i2c_write(0x26, 0x2, 1, &val8, 1);
|
||||
val8 = 0xff;
|
||||
i2c_write(0x26, 0x3, 1, &val8, 1);
|
||||
|
||||
val8 = 0;
|
||||
i2c_write(0x27, 0x6, 1, &val8, 1);
|
||||
i2c_write(0x27, 0x7, 1, &val8, 1);
|
||||
val8 = 0xff;
|
||||
i2c_write(0x27, 0x2, 1, &val8, 1);
|
||||
val8 = 0xef;
|
||||
i2c_write(0x27, 0x3, 1, &val8, 1);
|
||||
|
||||
eieio();
|
||||
|
||||
#if defined(CONFIG_MPC832XEMDS)
|
||||
printf("PCI 32bit bus on PMC2 &PMC3\n");
|
||||
#else
|
||||
printf("PCI 32bit bus on PMC1 & PMC2 &PMC3\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PQ_MDS_PIB_ATM)
|
||||
#if defined(CONFIG_MPC8360EMDS)
|
||||
val8 = 0;
|
||||
i2c_write(0x20, 0x6, 1, &val8, 1);
|
||||
i2c_write(0x20, 0x7, 1, &val8, 1);
|
||||
|
||||
val8 = 0xdf;
|
||||
i2c_write(0x20, 0x2, 1, &val8, 1);
|
||||
val8 = 0xf7;
|
||||
i2c_write(0x20, 0x3, 1, &val8, 1);
|
||||
|
||||
eieio();
|
||||
|
||||
printf("QOC3 ATM card on PMC0\n");
|
||||
#elif defined(CONFIG_MPC832XEMDS)
|
||||
val = 0;
|
||||
i2c_write(0x26, 0x7, 1, &val, 1);
|
||||
val = 0xf7;
|
||||
i2c_write(0x26, 0x3, 1, &val, 1);
|
||||
|
||||
val = 0;
|
||||
i2c_write(0x21, 0x6, 1, &val, 1);
|
||||
i2c_write(0x21, 0x7, 1, &val, 1);
|
||||
|
||||
val = 0xdf;
|
||||
i2c_write(0x21, 0x2, 1, &val, 1);
|
||||
val = 0xef;
|
||||
i2c_write(0x21, 0x3, 1, &val, 1);
|
||||
|
||||
eieio();
|
||||
|
||||
printf("QOC3 ATM card on PMC1\n");
|
||||
#endif
|
||||
#endif
|
||||
/* Reset to original I2C bus */
|
||||
i2c_set_bus_num(orig_i2c_bus);
|
||||
return 0;
|
||||
}
|
||||
9
board/freescale/common/pq-mds-pib.h
Normal file
9
board/freescale/common/pq-mds-pib.h
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*/
|
||||
|
||||
extern int pib_init(void);
|
||||
@@ -23,7 +23,11 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
#include <ft_build.h>
|
||||
#elif defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#endif
|
||||
#include <pci.h>
|
||||
#include <mpc83xx.h>
|
||||
|
||||
@@ -96,21 +100,22 @@ void pci_init_board(void)
|
||||
mpc83xx_pci_init(1, reg, warmboot);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
|
||||
#if defined(CONFIG_OF_BOARD_SETUP)
|
||||
void ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
u32 *p;
|
||||
int len;
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
|
||||
p = ft_get_prop(blob, "/memory/reg", &len);
|
||||
if (p) {
|
||||
if (p != NULL) {
|
||||
*p++ = cpu_to_be32(bd->bi_memstart);
|
||||
*p = cpu_to_be32(bd->bi_memsize);
|
||||
}
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -112,8 +112,6 @@ long int initdram(int board_type)
|
||||
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
|
||||
return -1;
|
||||
|
||||
puts("Initializing\n");
|
||||
|
||||
/* DDR SDRAM - Main SODIMM */
|
||||
msize = fixed_sdram();
|
||||
|
||||
@@ -127,7 +125,6 @@ long int initdram(int board_type)
|
||||
resume_from_sleep();
|
||||
#endif
|
||||
|
||||
puts(" DDR RAM: ");
|
||||
/* return total bus SDRAM size(bytes) -- DDR */
|
||||
return msize;
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <miiphy.h>
|
||||
#include <command.h>
|
||||
#include <libfdt.h>
|
||||
#include <libfdt_env.h>
|
||||
#if defined(CONFIG_PCI)
|
||||
#include <pci.h>
|
||||
#endif
|
||||
@@ -92,8 +91,6 @@ long int initdram(int board_type)
|
||||
|
||||
msize = fixed_sdram();
|
||||
|
||||
puts("\n DDR RAM: ");
|
||||
|
||||
/* return total bus SDRAM size(bytes) -- DDR */
|
||||
return (msize * 1024 * 1024);
|
||||
}
|
||||
@@ -185,33 +182,21 @@ void pci_init_board(void)
|
||||
}
|
||||
|
||||
#if defined(CONFIG_OF_BOARD_SETUP)
|
||||
|
||||
/*
|
||||
* Prototypes of functions that we use.
|
||||
*/
|
||||
void ft_cpu_setup(void *blob, bd_t *bd);
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
void ft_pci_setup(void *blob, bd_t *bd);
|
||||
#endif
|
||||
|
||||
void
|
||||
ft_board_setup(void *blob, bd_t *bd)
|
||||
void ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
int nodeoffset;
|
||||
int tmp[2];
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
u32 *p;
|
||||
int len;
|
||||
|
||||
nodeoffset = fdt_find_node_by_path(blob, "/memory");
|
||||
if (nodeoffset >= 0) {
|
||||
tmp[0] = cpu_to_be32(bd->bi_memstart);
|
||||
tmp[1] = cpu_to_be32(bd->bi_memsize);
|
||||
fdt_setprop(blob, nodeoffset, "reg", tmp, sizeof(tmp));
|
||||
p = ft_get_prop(blob, "/memory/reg", &len);
|
||||
if (p != NULL) {
|
||||
*p++ = cpu_to_be32(bd->bi_memstart);
|
||||
*p = cpu_to_be32(bd->bi_memsize);
|
||||
}
|
||||
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_OF_BOARD_SETUP */
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = $(obj)lib$(BOARD).a
|
||||
|
||||
COBJS := $(BOARD).o pci.o
|
||||
COBJS := $(BOARD).o pci.o ../common/pq-mds-pib.o
|
||||
|
||||
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
|
||||
OBJS := $(addprefix $(obj),$(COBJS))
|
||||
@@ -29,6 +29,11 @@
|
||||
#endif
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
#include <ft_build.h>
|
||||
#elif defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#endif
|
||||
#if defined(CONFIG_PQ_MDS_PIB)
|
||||
#include "../common/pq-mds-pib.h"
|
||||
#endif
|
||||
|
||||
const qe_iop_conf_t qe_iop_conf_tab[] = {
|
||||
@@ -86,6 +91,14 @@ int board_early_init_f(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_early_init_r(void)
|
||||
{
|
||||
#ifdef CONFIG_PQ_MDS_PIB
|
||||
pib_init();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fixed_sdram(void);
|
||||
|
||||
long int initdram(int board_type)
|
||||
@@ -101,8 +114,6 @@ long int initdram(int board_type)
|
||||
|
||||
msize = fixed_sdram();
|
||||
|
||||
puts("\n DDR RAM: ");
|
||||
|
||||
/* return total bus SDRAM size(bytes) -- DDR */
|
||||
return (msize * 1024 * 1024);
|
||||
}
|
||||
@@ -155,22 +166,22 @@ int checkboard(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
|
||||
void
|
||||
ft_board_setup(void *blob, bd_t *bd)
|
||||
#if defined(CONFIG_OF_BOARD_SETUP)
|
||||
void ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
u32 *p;
|
||||
int len;
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
|
||||
p = ft_get_prop(blob, "/memory/reg", &len);
|
||||
if (p != NULL) {
|
||||
*p++ = cpu_to_be32(bd->bi_memstart);
|
||||
*p = cpu_to_be32(bd->bi_memsize);
|
||||
}
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <i2c.h>
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
#include <ft_build.h>
|
||||
#elif defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#endif
|
||||
|
||||
#include <asm/fsl_i2c.h>
|
||||
@@ -129,7 +131,6 @@ void pci_init_board(void)
|
||||
volatile pcictrl83xx_t *pci_ctrl;
|
||||
volatile pciconf83xx_t *pci_conf;
|
||||
|
||||
u8 val8, orig_i2c_bus;
|
||||
u16 reg16;
|
||||
u32 val32;
|
||||
u32 dev;
|
||||
@@ -197,43 +198,6 @@ void pci_init_board(void)
|
||||
PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP | PIWAR_WTT_SNOOP |
|
||||
PIWAR_IWS_2G;
|
||||
|
||||
/*
|
||||
* Assign PIB PMC slot to desired PCI bus
|
||||
*/
|
||||
|
||||
/* Switch temporarily to I2C bus #2 */
|
||||
orig_i2c_bus = i2c_get_bus_num();
|
||||
i2c_set_bus_num(1);
|
||||
|
||||
val8 = 0;
|
||||
i2c_write(0x23, 0x6, 1, &val8, 1);
|
||||
i2c_write(0x23, 0x7, 1, &val8, 1);
|
||||
val8 = 0xff;
|
||||
i2c_write(0x23, 0x2, 1, &val8, 1);
|
||||
i2c_write(0x23, 0x3, 1, &val8, 1);
|
||||
|
||||
val8 = 0;
|
||||
i2c_write(0x26, 0x6, 1, &val8, 1);
|
||||
val8 = 0x34;
|
||||
i2c_write(0x26, 0x7, 1, &val8, 1);
|
||||
|
||||
val8 = 0xf9; /* PMC2, PMC3 slot to PCI bus */
|
||||
i2c_write(0x26, 0x2, 1, &val8, 1);
|
||||
val8 = 0xff;
|
||||
i2c_write(0x26, 0x3, 1, &val8, 1);
|
||||
|
||||
val8 = 0;
|
||||
i2c_write(0x27, 0x6, 1, &val8, 1);
|
||||
i2c_write(0x27, 0x7, 1, &val8, 1);
|
||||
val8 = 0xff;
|
||||
i2c_write(0x27, 0x2, 1, &val8, 1);
|
||||
val8 = 0xef;
|
||||
i2c_write(0x27, 0x3, 1, &val8, 1);
|
||||
asm("eieio");
|
||||
|
||||
/* Reset to original I2C bus */
|
||||
i2c_set_bus_num(orig_i2c_bus);
|
||||
|
||||
/*
|
||||
* Release PCI RST Output signal
|
||||
*/
|
||||
@@ -290,8 +254,6 @@ void pci_init_board(void)
|
||||
pci_hose_write_config_byte(&hose[0], dev, PCI_LATENCY_TIMER, 0x80);
|
||||
pci_hose_write_config_byte(&hose[0], dev, PCI_CACHE_LINE_SIZE, 0x08);
|
||||
|
||||
printf("PCI 32bit bus on PMC2 & PMC3\n");
|
||||
|
||||
/*
|
||||
* Hose scan.
|
||||
*/
|
||||
@@ -299,7 +261,27 @@ void pci_init_board(void)
|
||||
}
|
||||
#endif /* CONFIG_PCISLAVE */
|
||||
|
||||
#ifdef CONFIG_OF_FLAT_TREE
|
||||
#if defined(CONFIG_OF_LIBFDT)
|
||||
void
|
||||
ft_pci_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
int nodeoffset;
|
||||
int err;
|
||||
int tmp[2];
|
||||
|
||||
nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500");
|
||||
if (nodeoffset >= 0) {
|
||||
tmp[0] = cpu_to_be32(hose[0].first_busno);
|
||||
tmp[1] = cpu_to_be32(hose[0].last_busno);
|
||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
||||
tmp, sizeof(tmp));
|
||||
|
||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
||||
tmp, sizeof(tmp[0]));
|
||||
}
|
||||
}
|
||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||
void
|
||||
ft_pci_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
@@ -34,6 +34,8 @@
|
||||
#endif
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
#include <ft_build.h>
|
||||
#elif defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#endif
|
||||
|
||||
int fixed_sdram(void);
|
||||
@@ -68,8 +70,6 @@ long int initdram (int board_type)
|
||||
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
|
||||
return -1;
|
||||
|
||||
puts("Initializing\n");
|
||||
|
||||
/* DDR SDRAM - Main SODIMM */
|
||||
im->sysconf.ddrlaw[0].bar = CFG_DDR_BASE & LAWBAR_BAR;
|
||||
#if defined(CONFIG_SPD_EEPROM)
|
||||
@@ -88,7 +88,7 @@ long int initdram (int board_type)
|
||||
*/
|
||||
ddr_enable_ecc(msize * 1024 * 1024);
|
||||
#endif
|
||||
puts(" DDR RAM: ");
|
||||
|
||||
/* return total bus SDRAM size(bytes) -- DDR */
|
||||
return (msize * 1024 * 1024);
|
||||
}
|
||||
@@ -189,9 +189,6 @@ void sdram_init(void)
|
||||
volatile lbus83xx_t *lbc= &immap->lbus;
|
||||
uint *sdram_addr = (uint *)CFG_LBC_SDRAM_BASE;
|
||||
|
||||
puts("\n SDRAM on Local Bus: ");
|
||||
print_size (CFG_LBC_SDRAM_SIZE * 1024 * 1024, "\n");
|
||||
|
||||
/*
|
||||
* Setup SDRAM Base and Option Registers, already done in cpu_init.c
|
||||
*/
|
||||
@@ -253,26 +250,25 @@ void sdram_init(void)
|
||||
#else
|
||||
void sdram_init(void)
|
||||
{
|
||||
puts(" SDRAM on Local Bus is NOT available!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
|
||||
void
|
||||
ft_board_setup(void *blob, bd_t *bd)
|
||||
#if defined(CONFIG_OF_BOARD_SETUP)
|
||||
void ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
u32 *p;
|
||||
int len;
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
|
||||
p = ft_get_prop(blob, "/memory/reg", &len);
|
||||
if (p != NULL) {
|
||||
*p++ = cpu_to_be32(bd->bi_memstart);
|
||||
*p = cpu_to_be32(bd->bi_memsize);
|
||||
}
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -25,6 +25,12 @@
|
||||
#include <pci.h>
|
||||
#include <asm/mpc8349_pci.h>
|
||||
#include <i2c.h>
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
#include <ft_build.h>
|
||||
#elif defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#endif
|
||||
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@@ -382,7 +388,40 @@ pci_init_board(void)
|
||||
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF_FLAT_TREE
|
||||
#if defined(CONFIG_OF_LIBFDT)
|
||||
void
|
||||
ft_pci_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
int nodeoffset;
|
||||
int err;
|
||||
int tmp[2];
|
||||
|
||||
nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500");
|
||||
if (nodeoffset >= 0) {
|
||||
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
||||
tmp, sizeof(tmp));
|
||||
|
||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
||||
tmp, sizeof(tmp[0]));
|
||||
}
|
||||
#ifdef CONFIG_MPC83XX_PCI2
|
||||
nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8600");
|
||||
if (nodeoffset >= 0) {
|
||||
tmp[0] = cpu_to_be32(pci_hose[1].first_busno);
|
||||
tmp[1] = cpu_to_be32(pci_hose[1].last_busno);
|
||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
||||
tmp, sizeof(tmp));
|
||||
|
||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
||||
tmp, sizeof(tmp[0]));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||
void
|
||||
ft_pci_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
@@ -39,6 +39,8 @@
|
||||
#endif
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
#include <ft_build.h>
|
||||
#elif defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SPD_EEPROM
|
||||
@@ -74,7 +76,7 @@ int fixed_sdram(void)
|
||||
|
||||
im->ddr.timing_cfg_1 = CFG_DDR_TIMING_1;
|
||||
im->ddr.timing_cfg_2 = CFG_DDR_TIMING_2;/* Was "2 << TIMING_CFG2_WR_DATA_DELAY_SHIFT" */
|
||||
im->ddr.sdram_cfg = SDRAM_CFG_SREN | SDRAM_CFG_SDRAM_TYPE_DDR;
|
||||
im->ddr.sdram_cfg = SDRAM_CFG_SREN | SDRAM_CFG_SDRAM_TYPE_DDR1;
|
||||
im->ddr.sdram_mode =
|
||||
(0x0000 << SDRAM_MODE_ESD_SHIFT) | (0x0032 << SDRAM_MODE_SD_SHIFT);
|
||||
im->ddr.sdram_interval =
|
||||
@@ -160,7 +162,6 @@ long int initdram(int board_type)
|
||||
ddr_enable_ecc(msize * 1048576);
|
||||
#endif
|
||||
|
||||
puts(" DDR RAM: ");
|
||||
/* return total bus RAM size(bytes) */
|
||||
return msize * 1024 * 1024;
|
||||
}
|
||||
@@ -385,22 +386,22 @@ int misc_init_r(void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
|
||||
void
|
||||
ft_board_setup(void *blob, bd_t *bd)
|
||||
#if defined(CONFIG_OF_BOARD_SETUP)
|
||||
void ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
u32 *p;
|
||||
int len;
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
|
||||
p = ft_get_prop(blob, "/memory/reg", &len);
|
||||
if (p != NULL) {
|
||||
*p++ = cpu_to_be32(bd->bi_memstart);
|
||||
*p = cpu_to_be32(bd->bi_memsize);
|
||||
}
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <i2c.h>
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
#include <ft_build.h>
|
||||
#elif defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#endif
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
@@ -332,8 +334,40 @@ void pci_init_board(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PCI */
|
||||
#ifdef CONFIG_OF_FLAT_TREE
|
||||
#if defined(CONFIG_OF_LIBFDT)
|
||||
void
|
||||
ft_pci_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
int nodeoffset;
|
||||
int err;
|
||||
int tmp[2];
|
||||
|
||||
nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500");
|
||||
if (nodeoffset >= 0) {
|
||||
tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
|
||||
tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
|
||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
||||
tmp, sizeof(tmp));
|
||||
|
||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
||||
tmp, sizeof(tmp[0]));
|
||||
}
|
||||
#ifdef CONFIG_MPC83XX_PCI2
|
||||
nodeoffset = fdt_find_node_by_path(blob, "/" OF_SOC "/pci@8500");
|
||||
if (nodeoffset >= 0) {
|
||||
tmp[0] = cpu_to_be32(pci_hose[1].first_busno);
|
||||
tmp[1] = cpu_to_be32(pci_hose[1].last_busno);
|
||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
||||
tmp, sizeof(tmp));
|
||||
|
||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
||||
tmp, sizeof(tmp[0]));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||
void
|
||||
ft_pci_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
@@ -355,3 +389,4 @@ ft_pci_setup(void *blob, bd_t *bd)
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_OF_FLAT_TREE */
|
||||
#endif /* CONFIG_PCI */
|
||||
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = $(obj)lib$(BOARD).a
|
||||
|
||||
COBJS := $(BOARD).o pci.o
|
||||
COBJS := $(BOARD).o pci.o ../common/pq-mds-pib.o
|
||||
|
||||
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
|
||||
OBJS := $(addprefix $(obj),$(COBJS))
|
||||
@@ -29,7 +29,9 @@
|
||||
#include <ft_build.h>
|
||||
#elif defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#include <libfdt_env.h>
|
||||
#endif
|
||||
#if defined(CONFIG_PQ_MDS_PIB)
|
||||
#include "../common/pq-mds-pib.h"
|
||||
#endif
|
||||
|
||||
const qe_iop_conf_t qe_iop_conf_tab[] = {
|
||||
@@ -107,6 +109,14 @@ int board_early_init_f(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_early_init_r(void)
|
||||
{
|
||||
#ifdef CONFIG_PQ_MDS_PIB
|
||||
pib_init();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
|
||||
extern void ddr_enable_ecc(unsigned int dram_size);
|
||||
#endif
|
||||
@@ -139,7 +149,7 @@ long int initdram(int board_type)
|
||||
* Initialize SDRAM if it is on local bus.
|
||||
*/
|
||||
sdram_init();
|
||||
puts(" DDR RAM: ");
|
||||
|
||||
/* return total bus SDRAM size(bytes) -- DDR */
|
||||
return (msize * 1024 * 1024);
|
||||
}
|
||||
@@ -224,8 +234,6 @@ void sdram_init(void)
|
||||
volatile lbus83xx_t *lbc = &immap->lbus;
|
||||
uint *sdram_addr = (uint *) CFG_LBC_SDRAM_BASE;
|
||||
|
||||
puts("\n SDRAM on Local Bus: ");
|
||||
print_size(CFG_LBC_SDRAM_SIZE * 1024 * 1024, "\n");
|
||||
/*
|
||||
* Setup SDRAM Base and Option Registers, already done in cpu_init.c
|
||||
*/
|
||||
@@ -281,36 +289,13 @@ void sdram_init(void)
|
||||
#else
|
||||
void sdram_init(void)
|
||||
{
|
||||
puts("SDRAM on Local Bus is NOT available!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)) \
|
||||
&& defined(CONFIG_OF_BOARD_SETUP)
|
||||
|
||||
/*
|
||||
* Prototypes of functions that we use.
|
||||
*/
|
||||
void ft_cpu_setup(void *blob, bd_t *bd);
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
void ft_pci_setup(void *blob, bd_t *bd);
|
||||
#endif
|
||||
|
||||
void
|
||||
ft_board_setup(void *blob, bd_t *bd)
|
||||
#if defined(CONFIG_OF_BOARD_SETUP)
|
||||
void ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
#if defined(CONFIG_OF_LIBFDT)
|
||||
int nodeoffset;
|
||||
int tmp[2];
|
||||
|
||||
nodeoffset = fdt_find_node_by_path(blob, "/memory");
|
||||
if (nodeoffset >= 0) {
|
||||
tmp[0] = cpu_to_be32(bd->bi_memstart);
|
||||
tmp[1] = cpu_to_be32(bd->bi_memsize);
|
||||
fdt_setprop(blob, nodeoffset, "reg", tmp, sizeof(tmp));
|
||||
}
|
||||
#else
|
||||
#if defined(CONFIG_OF_FLAT_TREE)
|
||||
u32 *p;
|
||||
int len;
|
||||
|
||||
@@ -320,10 +305,9 @@ ft_board_setup(void *blob, bd_t *bd)
|
||||
*p = cpu_to_be32(bd->bi_memsize);
|
||||
}
|
||||
#endif
|
||||
|
||||
ft_cpu_setup(blob, bd);
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif
|
||||
ft_cpu_setup(blob, bd);
|
||||
}
|
||||
#endif /* CONFIG_OF_x */
|
||||
#endif
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <ft_build.h>
|
||||
#elif defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#include <libfdt_env.h>
|
||||
#endif
|
||||
|
||||
#include <asm/fsl_i2c.h>
|
||||
@@ -132,7 +131,6 @@ void pci_init_board(void)
|
||||
volatile pcictrl83xx_t *pci_ctrl;
|
||||
volatile pciconf83xx_t *pci_conf;
|
||||
|
||||
u8 val8, orig_i2c_bus;
|
||||
u16 reg16;
|
||||
u32 val32;
|
||||
u32 dev;
|
||||
@@ -200,43 +198,6 @@ void pci_init_board(void)
|
||||
PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP | PIWAR_WTT_SNOOP |
|
||||
PIWAR_IWS_2G;
|
||||
|
||||
/*
|
||||
* Assign PIB PMC slot to desired PCI bus
|
||||
*/
|
||||
|
||||
/* Switch temporarily to I2C bus #2 */
|
||||
orig_i2c_bus = i2c_get_bus_num();
|
||||
i2c_set_bus_num(1);
|
||||
|
||||
val8 = 0;
|
||||
i2c_write(0x23, 0x6, 1, &val8, 1);
|
||||
i2c_write(0x23, 0x7, 1, &val8, 1);
|
||||
val8 = 0xff;
|
||||
i2c_write(0x23, 0x2, 1, &val8, 1);
|
||||
i2c_write(0x23, 0x3, 1, &val8, 1);
|
||||
|
||||
val8 = 0;
|
||||
i2c_write(0x26, 0x6, 1, &val8, 1);
|
||||
val8 = 0x34;
|
||||
i2c_write(0x26, 0x7, 1, &val8, 1);
|
||||
|
||||
val8 = 0xf3; /*PMC1, PMC2, PMC3 slot to PCI bus */
|
||||
i2c_write(0x26, 0x2, 1, &val8, 1);
|
||||
val8 = 0xff;
|
||||
i2c_write(0x26, 0x3, 1, &val8, 1);
|
||||
|
||||
val8 = 0;
|
||||
i2c_write(0x27, 0x6, 1, &val8, 1);
|
||||
i2c_write(0x27, 0x7, 1, &val8, 1);
|
||||
val8 = 0xff;
|
||||
i2c_write(0x27, 0x2, 1, &val8, 1);
|
||||
val8 = 0xef;
|
||||
i2c_write(0x27, 0x3, 1, &val8, 1);
|
||||
asm("eieio");
|
||||
|
||||
/* Reset to original I2C bus */
|
||||
i2c_set_bus_num(orig_i2c_bus);
|
||||
|
||||
/*
|
||||
* Release PCI RST Output signal
|
||||
*/
|
||||
@@ -293,8 +254,6 @@ void pci_init_board(void)
|
||||
pci_hose_write_config_byte(&hose[0], dev, PCI_LATENCY_TIMER, 0x80);
|
||||
pci_hose_write_config_byte(&hose[0], dev, PCI_CACHE_LINE_SIZE, 0x08);
|
||||
|
||||
printf("PCI 32bit bus on PMC1 & PMC2 & PMC3\n");
|
||||
|
||||
/*
|
||||
* Hose scan.
|
||||
*/
|
||||
@@ -314,7 +273,12 @@ ft_pci_setup(void *blob, bd_t *bd)
|
||||
if (nodeoffset >= 0) {
|
||||
tmp[0] = cpu_to_be32(hose[0].first_busno);
|
||||
tmp[1] = cpu_to_be32(hose[0].last_busno);
|
||||
err = fdt_setprop(blob, nodeoffset, "bus-range", tmp, sizeof(tmp));
|
||||
err = fdt_setprop(blob, nodeoffset, "bus-range",
|
||||
tmp, sizeof(tmp));
|
||||
|
||||
tmp[0] = cpu_to_be32(gd->pci_clk);
|
||||
err = fdt_setprop(blob, nodeoffset, "clock-frequency",
|
||||
tmp, sizeof(tmp[0]));
|
||||
}
|
||||
}
|
||||
#elif defined(CONFIG_OF_FLAT_TREE)
|
||||
@@ -64,8 +64,6 @@ long int initdram (int board_type)
|
||||
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
|
||||
return -1;
|
||||
|
||||
puts("Initializing\n");
|
||||
|
||||
/* DDR SDRAM - Main SODIMM */
|
||||
im->sysconf.ddrlaw[0].bar = CFG_DDR_BASE & LAWBAR_BAR;
|
||||
#if defined(CONFIG_SPD_EEPROM)
|
||||
@@ -84,7 +82,6 @@ long int initdram (int board_type)
|
||||
*/
|
||||
ddr_enable_ecc(msize * 1024 * 1024);
|
||||
#endif
|
||||
puts(" DDR RAM: ");
|
||||
/* return total bus SDRAM size(bytes) -- DDR */
|
||||
return (msize * 1024 * 1024);
|
||||
}
|
||||
@@ -130,7 +127,7 @@ int fixed_sdram(void)
|
||||
#if defined(CONFIG_DDR_2T_TIMING)
|
||||
| SDRAM_CFG_2T_EN
|
||||
#endif
|
||||
| 2 << SDRAM_CFG_SDRAM_TYPE_SHIFT;
|
||||
| SDRAM_CFG_SDRAM_TYPE_DDR1;
|
||||
#if defined (CONFIG_DDR_32BIT)
|
||||
/* for 32-bit mode burst length is 8 */
|
||||
im->ddr.sdram_cfg |= (SDRAM_CFG_32_BE | SDRAM_CFG_8_BE);
|
||||
|
||||
@@ -114,7 +114,7 @@ long int initdram (int board_type)
|
||||
/* enable DDR controller */
|
||||
im->ddr.sdram_cfg = (SDRAM_CFG_MEM_EN |
|
||||
SDRAM_CFG_SREN |
|
||||
SDRAM_CFG_SDRAM_TYPE_DDR);
|
||||
SDRAM_CFG_SDRAM_TYPE_DDR1);
|
||||
SYNC;
|
||||
|
||||
/* size detection */
|
||||
@@ -388,7 +388,7 @@ static void set_ddr_config(void) {
|
||||
/* don't enable DDR controller yet */
|
||||
im->ddr.sdram_cfg =
|
||||
SDRAM_CFG_SREN |
|
||||
SDRAM_CFG_SDRAM_TYPE_DDR;
|
||||
SDRAM_CFG_SDRAM_TYPE_DDR1;
|
||||
SYNC;
|
||||
|
||||
/* Set SDRAM mode */
|
||||
|
||||
Reference in New Issue
Block a user