xref: /rk3399_rockchip-uboot/board/xilinx/microblaze-generic/microblaze-generic.c (revision 882b7d726febe65579d6502c271412ecb05821d7)
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 
34*882b7d72SMike 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
44*882b7d72SMike 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 {
74d69f8f41SMichal Simek 	/*
75d69f8f41SMichal Simek 	 * This board either has PCI NICs or uses the CPU's TSECs
76d69f8f41SMichal Simek 	 * pci_eth_init() will return 0 if no NICs found, so in that case
77d69f8f41SMichal Simek 	 * returning -1 will force cpu_eth_init() to be called.
78d69f8f41SMichal Simek 	 */
79d69f8f41SMichal Simek #ifdef CONFIG_XILINX_EMACLITE
80d69f8f41SMichal Simek 	return xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR);
81d69f8f41SMichal Simek #endif
82d69f8f41SMichal Simek }
83