blob: 162c8a954f07901fbc6b3adb56c120c96d9355ac [file] [log] [blame]
Tony Lic8b57f12007-08-17 10:35:59 +08001/*
2 * Copyright (C) 2007 Freescale Semiconductor, Inc.
3 *
4 * Tony Li <tony.li@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 */
10
11#include <common.h>
12#include <i2c.h>
13#include <asm/io.h>
14
15#include "pq-mds-pib.h"
16
17int pib_init(void)
18{
19 u8 val8;
20 u8 orig_i2c_bus;
21
22 /* Switch temporarily to I2C bus #2 */
23 orig_i2c_bus = i2c_get_bus_num();
24 i2c_set_bus_num(1);
Kim Phillips7c667142007-08-16 22:52:59 -050025
26 val8 = 0;
Tony Lic8b57f12007-08-17 10:35:59 +080027#if defined(CONFIG_PCI) && !defined(CONFIG_PCISLAVE)
28 /* Assign PIB PMC slot to desired PCI bus */
Tony Lic8b57f12007-08-17 10:35:59 +080029 i2c_write(0x23, 0x6, 1, &val8, 1);
30 i2c_write(0x23, 0x7, 1, &val8, 1);
31 val8 = 0xff;
32 i2c_write(0x23, 0x2, 1, &val8, 1);
33 i2c_write(0x23, 0x3, 1, &val8, 1);
34
35 val8 = 0;
36 i2c_write(0x26, 0x6, 1, &val8, 1);
37 val8 = 0x34;
38 i2c_write(0x26, 0x7, 1, &val8, 1);
Tony Lic8b57f12007-08-17 10:35:59 +080039 val8 = 0xf3; /* PMC1, PMC2, PMC3 slot to PCI bus */
Tony Lic8b57f12007-08-17 10:35:59 +080040 i2c_write(0x26, 0x2, 1, &val8, 1);
41 val8 = 0xff;
42 i2c_write(0x26, 0x3, 1, &val8, 1);
43
44 val8 = 0;
45 i2c_write(0x27, 0x6, 1, &val8, 1);
46 i2c_write(0x27, 0x7, 1, &val8, 1);
47 val8 = 0xff;
48 i2c_write(0x27, 0x2, 1, &val8, 1);
49 val8 = 0xef;
50 i2c_write(0x27, 0x3, 1, &val8, 1);
51
52 eieio();
53
Tony Lic8b57f12007-08-17 10:35:59 +080054 printf("PCI 32bit bus on PMC1 & PMC2 &PMC3\n");
55#endif
Tony Lic8b57f12007-08-17 10:35:59 +080056
Tony Lic8b57f12007-08-17 10:35:59 +080057 /* Reset to original I2C bus */
58 i2c_set_bus_num(orig_i2c_bus);
59 return 0;
60}