152a822edSMichal Simek /*
252a822edSMichal Simek  * (C) Copyright 2007 Michal Simek
352a822edSMichal Simek  *
452a822edSMichal Simek  * Michal  SIMEK <monstr@monstr.eu>
552a822edSMichal Simek  *
652a822edSMichal Simek  * See file CREDITS for list of people who contributed to this
752a822edSMichal Simek  * project.
852a822edSMichal Simek  *
952a822edSMichal Simek  * This program is free software; you can redistribute it and/or
1052a822edSMichal Simek  * modify it under the terms of the GNU General Public License as
1152a822edSMichal Simek  * published by the Free Software Foundation; either version 2 of
1252a822edSMichal Simek  * the License, or (at your option) any later version.
1352a822edSMichal Simek  *
1452a822edSMichal Simek  * This program is distributed in the hope that it will be useful,
1552a822edSMichal Simek  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1652a822edSMichal Simek  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
1752a822edSMichal Simek  * GNU General Public License for more details.
1852a822edSMichal Simek  *
1952a822edSMichal Simek  * You should have received a copy of the GNU General Public License
2052a822edSMichal Simek  * along with this program; if not, write to the Free Software
2152a822edSMichal Simek  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2252a822edSMichal Simek  * MA 02111-1307 USA
2352a822edSMichal Simek  */
2452a822edSMichal Simek 
2552a822edSMichal Simek /* This is a board specific file.  It's OK to include board specific
2652a822edSMichal Simek  * header files */
2752a822edSMichal Simek 
2852a822edSMichal Simek #include <common.h>
2952a822edSMichal Simek #include <config.h>
30d69f8f41SMichal Simek #include <netdev.h>
3152a822edSMichal Simek #include <asm/microblaze_intc.h>
3252a822edSMichal Simek #include <asm/asm.h>
3352a822edSMichal Simek 
34882b7d72SMike Frysinger int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
3552a822edSMichal Simek {
3652a822edSMichal Simek #ifdef CONFIG_SYS_GPIO_0
3752a822edSMichal Simek 	*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) =
3852a822edSMichal Simek 	    ++(*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)));
3952a822edSMichal Simek #endif
4052a822edSMichal Simek #ifdef CONFIG_SYS_RESET_ADDRESS
4152a822edSMichal Simek 	puts ("Reseting board\n");
4252a822edSMichal Simek 	asm ("bra r0");
4352a822edSMichal Simek #endif
44882b7d72SMike Frysinger 	return 0;
4552a822edSMichal Simek }
4652a822edSMichal Simek 
4752a822edSMichal Simek int gpio_init (void)
4852a822edSMichal Simek {
4952a822edSMichal Simek #ifdef CONFIG_SYS_GPIO_0
5052a822edSMichal Simek 	*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) = 0xFFFFFFFF;
5152a822edSMichal Simek #endif
5252a822edSMichal Simek 	return 0;
5352a822edSMichal Simek }
5452a822edSMichal Simek 
5552a822edSMichal Simek #ifdef CONFIG_SYS_FSL_2
5652a822edSMichal Simek void fsl_isr2 (void *arg) {
5752a822edSMichal Simek 	volatile int num;
5852a822edSMichal Simek 	*((unsigned int *)(CONFIG_SYS_GPIO_0_ADDR + 0x4)) =
5952a822edSMichal Simek 	    ++(*((unsigned int *)(CONFIG_SYS_GPIO_0_ADDR + 0x4)));
6052a822edSMichal Simek 	GET (num, 2);
6152a822edSMichal Simek 	NGET (num, 2);
6252a822edSMichal Simek 	puts("*");
6352a822edSMichal Simek }
6452a822edSMichal Simek 
65b2664097SMichal Simek int fsl_init2 (void) {
6652a822edSMichal Simek 	puts("fsl_init2\n");
67b2664097SMichal Simek 	install_interrupt_handler (FSL_INTR_2, fsl_isr2, NULL);
68b2664097SMichal Simek 	return 0;
6952a822edSMichal Simek }
7052a822edSMichal Simek #endif
71d69f8f41SMichal Simek 
72d69f8f41SMichal Simek int board_eth_init(bd_t *bis)
73d69f8f41SMichal Simek {
74c1044a1eSMichal Simek 	int ret = 0;
75*e634138eSMichal Simek 
76*e634138eSMichal Simek #ifdef CONFIG_XILINX_AXIEMAC
77*e634138eSMichal Simek 	ret |= xilinx_axiemac_initialize(bis, XILINX_AXIEMAC_BASEADDR,
78*e634138eSMichal Simek 						XILINX_AXIDMA_BASEADDR);
79*e634138eSMichal Simek #endif
80*e634138eSMichal Simek 
81d69f8f41SMichal Simek #ifdef CONFIG_XILINX_EMACLITE
82c1044a1eSMichal Simek 	u32 txpp = 0;
83c1044a1eSMichal Simek 	u32 rxpp = 0;
84c1044a1eSMichal Simek # ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG
85c1044a1eSMichal Simek 	txpp = 1;
86d69f8f41SMichal Simek # endif
87c1044a1eSMichal Simek # ifdef CONFIG_XILINX_EMACLITE_RX_PING_PONG
88c1044a1eSMichal Simek 	rxpp = 1;
89c1044a1eSMichal Simek # endif
90c1044a1eSMichal Simek 	ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR,
91c1044a1eSMichal Simek 			txpp, rxpp);
92c1044a1eSMichal Simek #endif
93c1044a1eSMichal Simek 	return ret;
94d69f8f41SMichal Simek }
95