2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2006-01-13 01:51:38 +00:00
|
|
|
/*
|
2009-07-18 23:42:13 +00:00
|
|
|
* Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
|
2006-01-13 01:51:38 +00:00
|
|
|
*/
|
|
|
|
|
2019-11-14 19:57:47 +00:00
|
|
|
#include <init.h>
|
2006-01-13 01:51:38 +00:00
|
|
|
#include <asm/mmu.h>
|
2008-08-22 18:00:13 +00:00
|
|
|
#include <asm/io.h>
|
2006-01-13 01:51:38 +00:00
|
|
|
#include <common.h>
|
2008-08-22 18:00:13 +00:00
|
|
|
#include <mpc83xx.h>
|
2006-01-13 01:51:38 +00:00
|
|
|
#include <pci.h>
|
|
|
|
#include <i2c.h>
|
2008-08-22 18:00:13 +00:00
|
|
|
#include <asm/fsl_i2c.h>
|
2020-05-10 17:40:11 +00:00
|
|
|
#include <linux/delay.h>
|
2006-01-13 01:51:38 +00:00
|
|
|
|
2008-08-22 18:00:13 +00:00
|
|
|
static struct pci_region pci1_regions[] = {
|
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
bus_start: CONFIG_SYS_PCI1_MEM_BASE,
|
|
|
|
phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
|
|
|
|
size: CONFIG_SYS_PCI1_MEM_SIZE,
|
2008-08-22 18:00:13 +00:00
|
|
|
flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
|
|
|
|
},
|
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
bus_start: CONFIG_SYS_PCI1_IO_BASE,
|
|
|
|
phys_start: CONFIG_SYS_PCI1_IO_PHYS,
|
|
|
|
size: CONFIG_SYS_PCI1_IO_SIZE,
|
2008-08-22 18:00:13 +00:00
|
|
|
flags: PCI_REGION_IO
|
|
|
|
},
|
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
|
|
|
|
phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
|
|
|
|
size: CONFIG_SYS_PCI1_MMIO_SIZE,
|
2008-08-22 18:00:13 +00:00
|
|
|
flags: PCI_REGION_MEM
|
2006-01-13 01:51:38 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-08-22 18:00:13 +00:00
|
|
|
#ifdef CONFIG_MPC83XX_PCI2
|
|
|
|
static struct pci_region pci2_regions[] = {
|
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
bus_start: CONFIG_SYS_PCI2_MEM_BASE,
|
|
|
|
phys_start: CONFIG_SYS_PCI2_MEM_PHYS,
|
|
|
|
size: CONFIG_SYS_PCI2_MEM_SIZE,
|
2008-08-22 18:00:13 +00:00
|
|
|
flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
|
|
|
|
},
|
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
bus_start: CONFIG_SYS_PCI2_IO_BASE,
|
|
|
|
phys_start: CONFIG_SYS_PCI2_IO_PHYS,
|
|
|
|
size: CONFIG_SYS_PCI2_IO_SIZE,
|
2008-08-22 18:00:13 +00:00
|
|
|
flags: PCI_REGION_IO
|
|
|
|
},
|
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
bus_start: CONFIG_SYS_PCI2_MMIO_BASE,
|
|
|
|
phys_start: CONFIG_SYS_PCI2_MMIO_PHYS,
|
|
|
|
size: CONFIG_SYS_PCI2_MMIO_SIZE,
|
2008-08-22 18:00:13 +00:00
|
|
|
flags: PCI_REGION_MEM
|
|
|
|
},
|
2006-01-13 01:51:38 +00:00
|
|
|
};
|
2008-08-22 18:00:13 +00:00
|
|
|
#endif
|
2006-01-13 01:51:38 +00:00
|
|
|
|
2008-08-22 18:00:15 +00:00
|
|
|
#ifndef CONFIG_PCISLAVE
|
2008-08-22 18:00:13 +00:00
|
|
|
void pib_init(void)
|
2006-01-13 01:51:38 +00:00
|
|
|
{
|
2006-09-12 14:15:53 +00:00
|
|
|
u8 val8, orig_i2c_bus;
|
2006-01-13 01:51:38 +00:00
|
|
|
/*
|
|
|
|
* Assign PIB PMC slot to desired PCI bus
|
|
|
|
*/
|
2006-09-12 14:15:53 +00:00
|
|
|
/* Switch temporarily to I2C bus #2 */
|
|
|
|
orig_i2c_bus = i2c_get_bus_num();
|
2006-11-30 17:02:20 +00:00
|
|
|
i2c_set_bus_num(1);
|
2006-01-13 01:51:38 +00:00
|
|
|
|
|
|
|
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);
|
2019-01-21 08:17:51 +00:00
|
|
|
#if defined(CONFIG_PCI_64BIT)
|
2006-01-13 01:51:38 +00:00
|
|
|
val8 = 0xf4; /* PMC2:PCI1/64-bit */
|
2019-01-21 08:17:51 +00:00
|
|
|
#elif defined(CONFIG_PCI_ALL_PCI1)
|
2006-01-13 01:51:38 +00:00
|
|
|
val8 = 0xf3; /* PMC1:PCI1 PMC2:PCI1 PMC3:PCI1 */
|
2019-01-21 08:17:51 +00:00
|
|
|
#elif defined(CONFIG_PCI_ONE_PCI1)
|
2006-01-13 01:51:38 +00:00
|
|
|
val8 = 0xf9; /* PMC1:PCI1 PMC2:PCI2 PMC3:PCI2 */
|
|
|
|
#else
|
|
|
|
val8 = 0xf5; /* PMC1:PCI1 PMC2:PCI1 PMC3:PCI2 */
|
|
|
|
#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);
|
|
|
|
asm("eieio");
|
|
|
|
|
2019-01-21 08:17:51 +00:00
|
|
|
#if defined(CONFIG_PCI_64BIT)
|
2006-01-13 01:51:38 +00:00
|
|
|
printf("PCI1: 64-bit on PMC2\n");
|
2019-01-21 08:17:51 +00:00
|
|
|
#elif defined(CONFIG_PCI_ALL_PCI1)
|
2006-01-13 01:51:38 +00:00
|
|
|
printf("PCI1: 32-bit on PMC1, PMC2, PMC3\n");
|
2019-01-21 08:17:51 +00:00
|
|
|
#elif defined(CONFIG_PCI_ONE_PCI1)
|
2006-01-13 01:51:38 +00:00
|
|
|
printf("PCI1: 32-bit on PMC1\n");
|
|
|
|
printf("PCI2: 32-bit on PMC2, PMC3\n");
|
|
|
|
#else
|
|
|
|
printf("PCI1: 32-bit on PMC1, PMC2\n");
|
|
|
|
printf("PCI2: 32-bit on PMC3\n");
|
|
|
|
#endif
|
2006-09-12 14:15:53 +00:00
|
|
|
/* Reset to original I2C bus */
|
2006-11-04 01:15:00 +00:00
|
|
|
i2c_set_bus_num(orig_i2c_bus);
|
2006-01-13 01:51:38 +00:00
|
|
|
}
|
|
|
|
|
2008-08-22 18:00:15 +00:00
|
|
|
#endif /* CONFIG_PCISLAVE */
|