mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-11 13:08:31 -04:00
Finish up support for MarelV38B board
- add watchdog support - enable GPIO_WKUP_7 pin for input - code cleanup
This commit is contained in:
parent
ffa150bc90
commit
25721b5cec
@ -28,6 +28,7 @@
|
|||||||
#include <mpc5xxx.h>
|
#include <mpc5xxx.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
|
||||||
|
|
||||||
#ifndef CFG_RAMBOOT
|
#ifndef CFG_RAMBOOT
|
||||||
static void sdram_start(int hi_addr)
|
static void sdram_start(int hi_addr)
|
||||||
{
|
{
|
||||||
@ -194,18 +195,33 @@ int checkboard (void)
|
|||||||
int board_early_init_r(void)
|
int board_early_init_r(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Now, when we are in RAM, enable flash write access for detection process.
|
* Now, when we are in RAM, enable flash write access for the
|
||||||
* Note that CS_BOOT cannot be cleared when executing in flash.
|
* detection process. Note that CS_BOOT cannot be cleared when
|
||||||
|
* executing in flash.
|
||||||
*/
|
*/
|
||||||
*(vu_long *) MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
|
*(vu_long *) MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
|
||||||
|
|
||||||
|
#ifdef CONFIG_HW_WATCHDOG
|
||||||
|
/*
|
||||||
|
* Enable and configure the direction (output) of PSC3_9 - watchdog
|
||||||
|
* reset input. Refer to 7.3.2.2.[1,3,4] of the MPC5200B User's
|
||||||
|
* Manual.
|
||||||
|
*/
|
||||||
|
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC3_9;
|
||||||
|
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC3_9;
|
||||||
|
#endif /* CONFIG_HW_WATCHDOG */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable GPIO_WKUP_7 to "read the status of the actual power
|
||||||
|
* situation". Default direction is input, so no need to set it
|
||||||
|
* explicitly.
|
||||||
|
*/
|
||||||
|
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_WKUP_7;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
|
#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
|
||||||
|
|
||||||
#define GPIO_PSC1_4 0x01000000UL
|
|
||||||
|
|
||||||
void init_ide_reset(void)
|
void init_ide_reset(void)
|
||||||
{
|
{
|
||||||
debug("init_ide_reset\n");
|
debug("init_ide_reset\n");
|
||||||
@ -214,7 +230,7 @@ void init_ide_reset(void)
|
|||||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||||
/* Deassert reset */
|
/* Deassert reset */
|
||||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
*(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -223,30 +239,22 @@ void ide_set_reset(int idereset)
|
|||||||
debug("ide_reset(%d)\n", idereset);
|
debug("ide_reset(%d)\n", idereset);
|
||||||
|
|
||||||
if (idereset) {
|
if (idereset) {
|
||||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4;
|
*(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4;
|
||||||
/* Make a delay. MPC5200 spec says 25 usec min */
|
/* Make a delay. MPC5200 spec says 25 usec min */
|
||||||
udelay(500000);
|
udelay(500000);
|
||||||
} else
|
} else
|
||||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
*(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
|
||||||
}
|
}
|
||||||
#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
|
#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
|
||||||
|
|
||||||
|
|
||||||
void led_d4_on(void)
|
#ifdef CONFIG_HW_WATCHDOG
|
||||||
{
|
|
||||||
/* TIMER7 as GPIO output low */
|
|
||||||
*(vu_long *) (MPC5XXX_GPT + 0x70) |= 0x24;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void led_d4_off(void)
|
|
||||||
{
|
|
||||||
/* TIMER7 as GPIO output high */
|
|
||||||
*(vu_long *) (MPC5XXX_GPT + 0x70) |= 0x34;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void hw_watchdog_reset(void)
|
void hw_watchdog_reset(void)
|
||||||
{
|
{
|
||||||
/* TODO fill this in */
|
/*
|
||||||
|
* MarelV38B has a TPS3705 watchdog. Spec says that to kick the dog
|
||||||
|
* we need a positive or negative transition on WDI i.e., our PSC3_9.
|
||||||
|
*/
|
||||||
|
*(vu_long *) MPC5XXX_WU_GPIO_DATA_O ^= GPIO_PSC3_9;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_HW_WATCHDOG */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user