xref: /rk3399_rockchip-uboot/board/xilinx/microblaze-generic/microblaze-generic.c (revision d69f8f41af5c8a1cc0b062cf2c7fbbfdbfe8e72d)
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>
30*d69f8f41SMichal Simek #include <netdev.h>
3152a822edSMichal Simek #include <asm/microblaze_intc.h>
3252a822edSMichal Simek #include <asm/asm.h>
3352a822edSMichal Simek 
3452a822edSMichal Simek void do_reset (void)
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
4452a822edSMichal Simek }
4552a822edSMichal Simek 
4652a822edSMichal Simek int gpio_init (void)
4752a822edSMichal Simek {
4852a822edSMichal Simek #ifdef CONFIG_SYS_GPIO_0
4952a822edSMichal Simek 	*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) = 0xFFFFFFFF;
5052a822edSMichal Simek #endif
5152a822edSMichal Simek 	return 0;
5252a822edSMichal Simek }
5352a822edSMichal Simek 
5452a822edSMichal Simek #ifdef CONFIG_SYS_FSL_2
5552a822edSMichal Simek void fsl_isr2 (void *arg) {
5652a822edSMichal Simek 	volatile int num;
5752a822edSMichal Simek 	*((unsigned int *)(CONFIG_SYS_GPIO_0_ADDR + 0x4)) =
5852a822edSMichal Simek 	    ++(*((unsigned int *)(CONFIG_SYS_GPIO_0_ADDR + 0x4)));
5952a822edSMichal Simek 	GET (num, 2);
6052a822edSMichal Simek 	NGET (num, 2);
6152a822edSMichal Simek 	puts("*");
6252a822edSMichal Simek }
6352a822edSMichal Simek 
64b2664097SMichal Simek int fsl_init2 (void) {
6552a822edSMichal Simek 	puts("fsl_init2\n");
66b2664097SMichal Simek 	install_interrupt_handler (FSL_INTR_2, fsl_isr2, NULL);
67b2664097SMichal Simek 	return 0;
6852a822edSMichal Simek }
6952a822edSMichal Simek #endif
70*d69f8f41SMichal Simek 
71*d69f8f41SMichal Simek int board_eth_init(bd_t *bis)
72*d69f8f41SMichal Simek {
73*d69f8f41SMichal Simek 	/*
74*d69f8f41SMichal Simek 	 * This board either has PCI NICs or uses the CPU's TSECs
75*d69f8f41SMichal Simek 	 * pci_eth_init() will return 0 if no NICs found, so in that case
76*d69f8f41SMichal Simek 	 * returning -1 will force cpu_eth_init() to be called.
77*d69f8f41SMichal Simek 	 */
78*d69f8f41SMichal Simek #ifdef CONFIG_XILINX_EMACLITE
79*d69f8f41SMichal Simek 	return xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR);
80*d69f8f41SMichal Simek #endif
81*d69f8f41SMichal Simek }
82