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>
3052a822edSMichal Simek #include <asm/microblaze_intc.h>
3152a822edSMichal Simek #include <asm/asm.h>
3252a822edSMichal Simek 
3352a822edSMichal Simek void do_reset (void)
3452a822edSMichal Simek {
3552a822edSMichal Simek #ifdef CONFIG_SYS_GPIO_0
3652a822edSMichal Simek 	*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) =
3752a822edSMichal Simek 	    ++(*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)));
3852a822edSMichal Simek #endif
3952a822edSMichal Simek #ifdef CONFIG_SYS_RESET_ADDRESS
4052a822edSMichal Simek 	puts ("Reseting board\n");
4152a822edSMichal Simek 	asm ("bra r0");
4252a822edSMichal Simek #endif
4352a822edSMichal Simek }
4452a822edSMichal Simek 
4552a822edSMichal Simek int gpio_init (void)
4652a822edSMichal Simek {
4752a822edSMichal Simek #ifdef CONFIG_SYS_GPIO_0
4852a822edSMichal Simek 	*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) = 0xFFFFFFFF;
4952a822edSMichal Simek #endif
5052a822edSMichal Simek 	return 0;
5152a822edSMichal Simek }
5252a822edSMichal Simek 
5352a822edSMichal Simek #ifdef CONFIG_SYS_FSL_2
5452a822edSMichal Simek void fsl_isr2 (void *arg) {
5552a822edSMichal Simek 	volatile int num;
5652a822edSMichal Simek 	*((unsigned int *)(CONFIG_SYS_GPIO_0_ADDR + 0x4)) =
5752a822edSMichal Simek 	    ++(*((unsigned int *)(CONFIG_SYS_GPIO_0_ADDR + 0x4)));
5852a822edSMichal Simek 	GET (num, 2);
5952a822edSMichal Simek 	NGET (num, 2);
6052a822edSMichal Simek 	puts("*");
6152a822edSMichal Simek }
6252a822edSMichal Simek 
63*b2664097SMichal Simek int fsl_init2 (void) {
6452a822edSMichal Simek 	puts("fsl_init2\n");
65*b2664097SMichal Simek 	install_interrupt_handler (FSL_INTR_2, fsl_isr2, NULL);
66*b2664097SMichal Simek 	return 0;
6752a822edSMichal Simek }
6852a822edSMichal Simek #endif
69