2004-03-25 19:29:38 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2004
|
|
|
|
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de.
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2004-03-25 19:29:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <mpc8xx.h>
|
|
|
|
#include "kup.h"
|
2010-07-19 21:46:48 +00:00
|
|
|
#include <asm/io.h>
|
2004-03-25 19:29:38 +00:00
|
|
|
|
2010-07-19 21:46:48 +00:00
|
|
|
|
|
|
|
int misc_init_f(void)
|
2004-03-25 19:29:38 +00:00
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
|
2004-03-25 19:29:38 +00:00
|
|
|
volatile sysconf8xx_t *siu = &immap->im_siu_conf;
|
|
|
|
|
2010-07-19 21:46:48 +00:00
|
|
|
while (in_be32(&siu->sc_sipend) & 0x20000000) {
|
|
|
|
debug("waiting for 5V VCC\n");
|
2004-03-25 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* RS232 / RS485 default is RS232 */
|
2010-07-19 21:46:48 +00:00
|
|
|
clrbits_be16(&immap->im_ioport.iop_padat, PA_RS485);
|
|
|
|
clrbits_be16(&immap->im_ioport.iop_papar, PA_RS485);
|
|
|
|
clrbits_be16(&immap->im_ioport.iop_paodr, PA_RS485);
|
|
|
|
setbits_be16(&immap->im_ioport.iop_padir, PA_RS485);
|
|
|
|
|
|
|
|
/* IO Reset min 1 msec */
|
|
|
|
setbits_be16(&immap->im_ioport.iop_padat,
|
|
|
|
(PA_RESET_IO_01 | PA_RESET_IO_02));
|
|
|
|
clrbits_be16(&immap->im_ioport.iop_papar,
|
|
|
|
(PA_RESET_IO_01 | PA_RESET_IO_02));
|
|
|
|
clrbits_be16(&immap->im_ioport.iop_paodr,
|
|
|
|
(PA_RESET_IO_01 | PA_RESET_IO_02));
|
|
|
|
setbits_be16(&immap->im_ioport.iop_padir,
|
|
|
|
(PA_RESET_IO_01 | PA_RESET_IO_02));
|
|
|
|
udelay(1000);
|
|
|
|
clrbits_be16(&immap->im_ioport.iop_padat,
|
|
|
|
(PA_RESET_IO_01 | PA_RESET_IO_02));
|
2004-03-25 19:29:38 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_IDE_LED
|
2010-07-19 21:46:48 +00:00
|
|
|
void ide_led(uchar led, uchar status)
|
2004-03-25 19:29:38 +00:00
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
|
2004-03-25 19:29:38 +00:00
|
|
|
|
|
|
|
/* We have one led for both pcmcia slots */
|
2010-07-19 21:46:48 +00:00
|
|
|
if (status)
|
|
|
|
clrbits_be16(&immap->im_ioport.iop_padat, PA_LED_YELLOW);
|
|
|
|
else
|
|
|
|
setbits_be16(&immap->im_ioport.iop_padat, PA_LED_YELLOW);
|
2004-03-25 19:29:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-07-19 21:46:48 +00:00
|
|
|
void poweron_key(void)
|
2004-03-25 19:29:38 +00:00
|
|
|
{
|
2008-10-16 13:01:15 +00:00
|
|
|
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
|
2004-03-25 19:29:38 +00:00
|
|
|
|
2010-07-19 21:46:48 +00:00
|
|
|
clrbits_be16(&immap->im_ioport.iop_pcpar, PC_SWITCH1);
|
|
|
|
clrbits_be16(&immap->im_ioport.iop_pcdir, PC_SWITCH1);
|
2004-03-25 19:29:38 +00:00
|
|
|
|
2010-07-19 21:46:48 +00:00
|
|
|
if (in_be16(&immap->im_ioport.iop_pcdat) & (PC_SWITCH1))
|
|
|
|
setenv("key1", "off");
|
2004-03-25 19:29:38 +00:00
|
|
|
else
|
2010-07-19 21:46:48 +00:00
|
|
|
setenv("key1", "on");
|
2004-03-25 19:29:38 +00:00
|
|
|
}
|