mpc83xx: Split PIB init code from pci.c and add Qoc3 ATM card support
PATCH 1/1 mpc83xx: Split PIB init code from pci.c and add Qoc3 ATM card support
The patch splits the PIB init code from pci.c to a single file board/freescale/common/pq-mds-pib.c And add Qoc3 ATM card support for MPC8360EMDS and MPC832XEMDS board.
---From cb531f3c9b98a08c15544d957bfcc2731710c979 Mon Sep 17 00:00:00 2001
From: lil <[email protected]>
Date: Thu, 16 Aug 2007 11:29:31 +0800
Subject: [PATCH] Splite PIB init code from pci.c
And add support QOC3 ATM card.
--- board/freescale/common/pq-mds-pib.c | 101 +++++++++++++++++++++++++++++++++++ board/freescale/common/pq-mds-pib.h | 9 +++ board/mpc832xemds/Makefile | 2 +- board/mpc832xemds/mpc832xemds.c | 11 ++++ board/mpc832xemds/pci.c | 40 -------------- board/mpc8360emds/Makefile | 2 +- board/mpc8360emds/mpc8360emds.c | 11 ++++ board/mpc8360emds/pci.c | 40 -------------- include/configs/MPC832XEMDS.h | 4 ++ include/configs/MPC8360EMDS.h | 8 ++- 10 files changed, 144 insertions(+), 84 deletions(-) create mode 100644 board/freescale/common/pq-mds-pib.c create mode 100644 board/freescale/common/pq-mds-pib.h
(quoted diff) +0 -0
b/board/freescale/common/pq-mds-pib.c
new file mode 100644
index 0000000..9799117
board/freescale/common/pq-mds-pib.c new file +6 -0
@@ -0,0 +1,101 @@ +/* +* Copyright (C) 2007 Freescale Semiconductor, Inc. +* +* Tony Li <[email protected]> +* +* 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);
+#if defined(CONFIG_PCI) && !defined(CONFIG_PCISLAVE)
+ /* Assign PIB PMC slot to desired PCI bus */
+ 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);
+#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;
+}
(quoted diff) +0 -0
b/board/freescale/common/pq-mds-pib.h
new file mode 100644
index 0000000..67066fd
board/freescale/common/pq-mds-pib.h new file +4 -0
@@ -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);
board/mpc832xemds/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o pci.o +COBJS := $(BOARD).o pci.o ../freescale/common/pq-mds-pib.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
(quoted diff) +0 -0
b/board/mpc832xemds/mpc832xemds.c
index 772da67..a049a14 100644
board/mpc832xemds/mpc832xemds.c +11 -0
@@ -30,6 +30,9 @@#if defined(CONFIG_OF_FLAT_TREE )#include <ft_build.h> #endif +#if defined(CONFIG_PQ_MDS_PIB ) +#include "../freescale/common/pq-mds-pib.h" +#endif const qe_iop_conf_t qe_iop_conf_tab[] = {/* ETH3 */
@@ -86,6 +89,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)
board/mpc832xemds/pci.c +0 -40
@@ -129,7 +129,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;
@@ -198,43 +197,6 @@ void pci_init_board(void)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 */ udelay (2000 );
@@ -290,8 +252,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. */
board/mpc8360emds/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o pci.o +COBJS := $(BOARD).o pci.o ../freescale/common/pq-mds-pib.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
(quoted diff) +0 -0
b/board/mpc8360emds/mpc8360emds.c
index 3fa093d..210d62d 100644
board/mpc8360emds/mpc8360emds.c +11 -0
@@ -31,6 +31,9 @@#include <libfdt.h> #include <libfdt_env.h> #endif +#if defined(CONFIG_PQ_MDS_PIB ) +#include "../freescale/common/pq-mds-pib.h" +#endif const qe_iop_conf_t qe_iop_conf_tab[] = {/* GETH1 */
@@ -107,6 +110,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
board/mpc8360emds/pci.c +0 -40
@@ -132,7 +132,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;
@@ -201,43 +200,6 @@ void pci_init_board(void)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 */ udelay (2000 );
@@ -293,8 +255,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. */
(quoted diff) +0 -0
b/include/configs/MPC832XEMDS.h
index f62ca2c..055b2e2 100644
include/configs/MPC832XEMDS.h +4 -0
@@ -30,6 +30,9 @@#define CONFIG_MPC83XX 1/* MPC83xx family */ #define CONFIG_MPC832X 1/* MPC832x CPU specific */ #define CONFIG_MPC832XEMDS 1/* MPC832XEMDS board specific */ +#undef CONFIG_PQ_MDS_PIB/* POWERQUICC MDS Platform IO Board */ + +#undef CONFIG_PQ_MDS_PIB_ATM/* QOC3 ATM card */ /* * System Clock Setup
@@ -87,6 +90,7 @@#define CFG_SICRL 0x00000000#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_BOARD_EARLY_INIT_R /* * IMMR new address
(quoted diff) +0 -0
b/include/configs/MPC8360EMDS.h
index 4b32a14..f6cde03 100644
include/configs/MPC8360EMDS.h +6 -2
@@ -32,6 +32,9 @@#define CONFIG_MPC83XX 1/* MPC83XX family */ #define CONFIG_MPC8360 1/* MPC8360 CPU specific */ #define CONFIG_MPC8360EMDS 1/* MPC8360EMDS board specific */ +#undef CONFIG_PQ_MDS_PIB/* POWERQUICC MDS Platform IO Board */ + +#undef CONFIG_PQ_MDS_PIB_ATM/* QOC3 ATM card */ /* * System Clock Setup
@@ -88,6 +91,7 @@#define CFG_SICRL 0x40000000#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_BOARD_EARLY_INIT_R /* * IMMR new address
@@ -309,13 +313,13 @@/* * CS4 on Local Bus, to PIB */ -#define CFG_BR4_PRELIM 0xf8008801/* CS4 base address at 0xf8008000 */ +#define CFG_BR4_PRELIM 0xf8010801/* CS4 base address at 0xf8010000 */ #define CFG_OR4_PRELIM 0xffffe9f7/* size 32KB, port size 8bit, GPCM */ /* * CS5 on Local Bus, to PIB */ -#define CFG_BR5_PRELIM 0xf8010801/* CS5 base address at 0xf8010000 */ +#define CFG_BR5_PRELIM 0xf8008801/* CS5 base address at 0xf8008000 */ #define CFG_OR5_PRELIM 0xffffe9f7/* size 32KB, port size 8bit, GPCM */ /*
Signature · 1 line
1.5.1
PATCH 1/1 mpc83xx: Split PIB init code from pci.c and add Qoc3 ATM card support
Quoted 5 lines · On 16 Aug 2007 13:34:51 +0800 Tony Li <[email protected]> wrote:
The patch splits the PIB init code from
pci.cto a single fileboard/freescale/common/pq-mds-pib.cAnd add Qoc3 ATM card support for MPC8360EMDS and MPC832XEMDS board.Signed-off-by Tony Li <[email protected]>
it appears this patch is corrupt:
---
$ ../linux-2.6/scripts/checkpatch.pl --no-tree 53 ERROR: patch seems to be corrupt (line wrapped?) #109: FILE: board/freescale/common/pq-mds-pib.c:6: it
ERROR: patch seems to be corrupt (line wrapped?) #216: FILE: board/freescale/common/pq-mds-pib.h:4:
it
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
---
please resend after turning off line wrapping in your mailer.
include/configs/MPC832XEMDS.h line 35
Quoted 8 lines
+++
b/include/configs/MPC832XEMDS.hinclude/configs/MPC832XEMDS.h +3
-0@@ -30,6 +30,9 @@#define CONFIG_MPC83XX 1/* MPC83xx family */ #define CONFIG_MPC832X 1/* MPC832x CPU specific */ #define CONFIG_MPC832XEMDS 1/* MPC832XEMDS board specific */ +#undef CONFIG_PQ_MDS_PIB/* POWERQUICC MDS Platform IO Board */ + +#undef CONFIG_PQ_MDS_PIB_ATM/* QOC3 ATM card */
whilst you're at it, please move the blank line above the undef PIB line, to indicate the h/w relationship.
Thanks,
Kim
PATCH 1/1 mpc83xx: Split PIB init code from pci.c and add Qoc3 ATM card support
Quoted 13 lines
-----Original Message-----
From: Phillips Kim-R1AAHA
Sent: 2007?8?17? 8:22
To: Li Tony-r64360
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] [PATCH] mpc83xx: Split PIB init code frompci.cand add Qoc3 ATM card supportOn 16 Aug 2007 13:34:51 +0800
Tony Li <[email protected]> wrote:
Quoted 9 lines
Quoted 6 lines
The patch splits the PIB init code from
pci.cto a single fileboard/freescale/common/pq-mds-pib.c
And add Qoc3 ATM card support for MPC8360EMDS and MPC832XEMDS board.Signed-off-by Tony Li <[email protected]>it appears this patch is corrupt:
I am sorry for that. I must my mail configure faulty.
Quoted 22 lines
---
$ ../linux-2.6/scripts/checkpatch.pl --no-tree 53 ERROR: patch seems to be corrupt (line wrapped?) #109: FILE: board/freescale/common/pq-mds-pib.c:6: itERROR: patch seems to be corrupt (line wrapped?) #216: FILE:
board/freescale/common/pq-mds-pib.h:4:
itYour patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in
MAINTAINERS.
---please resend after turning off line wrapping in your mailer.
Review line 31
Quoted 4 lines
+++
b/include/configs/MPC832XEMDS.h(quoted diff) +0
-0@@ -30,6 +30,9 @@ #define CONFIG_MPC83XX 1 /* MPC83xx family */ #define CONFIG_MPC832X 1 /* MPC832x CPUspecific */
Quoted 8 lines
include/configs/MPC832XEMDS.h line 35
Quoted 4 lines
include/configs/MPC832XEMDS.h +3
-0#define CONFIG_MPC832XEMDS 1/* MPC832XEMDS board specific */ +#undef CONFIG_PQ_MDS_PIB/* POWERQUICC MDS Platform IO Board */ + +#undef CONFIG_PQ_MDS_PIB_ATM/* QOC3 ATM card */ whilst you're at it, please move the blank line above the undef PIB line, to indicate the h/w relationship.
OK
Quoted 4 lines
Thanks,
Kim
-- Tony