mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-15 17:28:15 +00:00
Moved mpc8641hpcn_board_reset() out of cpu/ into board/.
Signed-off-by: Jon Loeliger <jdl@freescale.com>
This commit is contained in:
parent
b2a941de06
commit
4d3d729c16
2 changed files with 99 additions and 84 deletions
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <command.h>
|
||||||
#include <pci.h>
|
#include <pci.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
#include <asm/immap_86xx.h>
|
#include <asm/immap_86xx.h>
|
||||||
|
@ -35,6 +36,9 @@
|
||||||
extern void ft_cpu_setup(void *blob, bd_t *bd);
|
extern void ft_cpu_setup(void *blob, bd_t *bd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "pixis.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
|
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
|
||||||
extern void ddr_enable_ecc(unsigned int dram_size);
|
extern void ddr_enable_ecc(unsigned int dram_size);
|
||||||
#endif
|
#endif
|
||||||
|
@ -292,4 +296,93 @@ ft_board_setup(void *blob, bd_t *bd)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||||
|
{
|
||||||
|
char cmd;
|
||||||
|
ulong val;
|
||||||
|
ulong corepll;
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
cmd = argv[1][1];
|
||||||
|
switch (cmd) {
|
||||||
|
case 'f': /* reset with frequency changed */
|
||||||
|
if (argc < 5)
|
||||||
|
goto my_usage;
|
||||||
|
read_from_px_regs(0);
|
||||||
|
|
||||||
|
val = set_px_sysclk(simple_strtoul(argv[2], NULL, 10));
|
||||||
|
|
||||||
|
corepll = strfractoint(argv[3]);
|
||||||
|
val = val + set_px_corepll(corepll);
|
||||||
|
val = val + set_px_mpxpll(simple_strtoul(argv[4], NULL, 10));
|
||||||
|
if (val == 3) {
|
||||||
|
printf("Setting registers VCFGEN0 and VCTL\n");
|
||||||
|
read_from_px_regs(1);
|
||||||
|
printf("Resetting board with values from VSPEED0, VSPEED1, VCLKH, and VCLKL ....\n");
|
||||||
|
set_px_go();
|
||||||
|
} else
|
||||||
|
goto my_usage;
|
||||||
|
|
||||||
|
while (1); /* Not reached */
|
||||||
|
|
||||||
|
case 'l':
|
||||||
|
if (argv[2][1] == 'f') {
|
||||||
|
read_from_px_regs(0);
|
||||||
|
read_from_px_regs_altbank(0);
|
||||||
|
/* reset with frequency changed */
|
||||||
|
val = set_px_sysclk(simple_strtoul(argv[3], NULL, 10));
|
||||||
|
|
||||||
|
corepll = strfractoint(argv[4]);
|
||||||
|
val = val + set_px_corepll(corepll);
|
||||||
|
val = val + set_px_mpxpll(simple_strtoul(argv[5], NULL, 10));
|
||||||
|
if (val == 3) {
|
||||||
|
printf("Setting registers VCFGEN0, VCFGEN1, VBOOT, and VCTL\n");
|
||||||
|
set_altbank();
|
||||||
|
read_from_px_regs(1);
|
||||||
|
read_from_px_regs_altbank(1);
|
||||||
|
printf("Enabling watchdog timer on the FPGA and resetting board with values from VSPEED0, VSPEED1, VCLKH, and VCLKL to boot from the other bank ....\n");
|
||||||
|
set_px_go_with_watchdog();
|
||||||
|
} else
|
||||||
|
goto my_usage;
|
||||||
|
|
||||||
|
while(1); /* Not reached */
|
||||||
|
|
||||||
|
} else if(argv[2][1] == 'd'){
|
||||||
|
/* Reset from next bank without changing frequencies but with watchdog timer enabled */
|
||||||
|
read_from_px_regs(0);
|
||||||
|
read_from_px_regs_altbank(0);
|
||||||
|
printf("Setting registers VCFGEN1, VBOOT, and VCTL\n");
|
||||||
|
set_altbank();
|
||||||
|
read_from_px_regs_altbank(1);
|
||||||
|
printf("Enabling watchdog timer on the FPGA and resetting board to boot from the other bank....\n");
|
||||||
|
set_px_go_with_watchdog();
|
||||||
|
while(1); /* Not reached */
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* Reset from next bank without changing frequency and without watchdog timer enabled */
|
||||||
|
read_from_px_regs(0);
|
||||||
|
read_from_px_regs_altbank(0);
|
||||||
|
if(argc > 2)
|
||||||
|
goto my_usage;
|
||||||
|
printf("Setting registers VCFGNE1, VBOOT, and VCTL\n");
|
||||||
|
set_altbank();
|
||||||
|
read_from_px_regs_altbank(1);
|
||||||
|
printf("Resetting board to boot from the other bank....\n");
|
||||||
|
set_px_go();
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
goto my_usage;
|
||||||
|
}
|
||||||
|
|
||||||
|
my_usage:
|
||||||
|
printf("\nUsage: reset cf <SYSCLK freq> <COREPLL ratio> <MPXPLL ratio>\n");
|
||||||
|
printf(" reset altbank [cf <SYSCLK freq> <COREPLL ratio> <MPXPLL ratio>]\n");
|
||||||
|
printf("For example: reset cf 40 2.5 10\n");
|
||||||
|
printf("See MPC8641HPCN Design Workbook for valid values of command line parameters.\n");
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else
|
||||||
|
out8(PIXIS_BASE+PIXIS_RST,0);
|
||||||
|
}
|
||||||
|
|
|
@ -32,7 +32,10 @@
|
||||||
#include <ft_build.h>
|
#include <ft_build.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../board/mpc8641hpcn/pixis.h"
|
#ifdef CONFIG_MPC8641HPCN
|
||||||
|
extern void mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag,
|
||||||
|
int argc, char *argv[]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int checkcpu (void)
|
int checkcpu (void)
|
||||||
|
@ -146,9 +149,7 @@ soft_restart(unsigned long addr)
|
||||||
void
|
void
|
||||||
do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char cmd;
|
ulong addr;
|
||||||
ulong addr, val;
|
|
||||||
ulong corepll;
|
|
||||||
|
|
||||||
#ifdef CFG_RESET_ADDRESS
|
#ifdef CFG_RESET_ADDRESS
|
||||||
addr = CFG_RESET_ADDRESS;
|
addr = CFG_RESET_ADDRESS;
|
||||||
|
@ -181,86 +182,7 @@ do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||||
|
|
||||||
#else /* CONFIG_MPC8641HPCN */
|
#else /* CONFIG_MPC8641HPCN */
|
||||||
|
|
||||||
if (argc > 1) {
|
mpc8641_reset_board(cmdtp, flag, argc, argv);
|
||||||
cmd = argv[1][1];
|
|
||||||
switch(cmd) {
|
|
||||||
case 'f': /* reset with frequency changed */
|
|
||||||
if (argc < 5)
|
|
||||||
goto my_usage;
|
|
||||||
read_from_px_regs(0);
|
|
||||||
|
|
||||||
val = set_px_sysclk(simple_strtoul(argv[2],NULL,10));
|
|
||||||
|
|
||||||
corepll = strfractoint(argv[3]);
|
|
||||||
val = val + set_px_corepll(corepll);
|
|
||||||
val = val + set_px_mpxpll(simple_strtoul(argv[4],
|
|
||||||
NULL, 10));
|
|
||||||
if (val == 3) {
|
|
||||||
printf("Setting registers VCFGEN0 and VCTL\n");
|
|
||||||
read_from_px_regs(1);
|
|
||||||
printf("Resetting board with values from VSPEED0, VSPEED1, VCLKH, and VCLKL ....\n");
|
|
||||||
set_px_go();
|
|
||||||
} else
|
|
||||||
goto my_usage;
|
|
||||||
|
|
||||||
while (1); /* Not reached */
|
|
||||||
|
|
||||||
case 'l':
|
|
||||||
if (argv[2][1] == 'f') {
|
|
||||||
read_from_px_regs(0);
|
|
||||||
read_from_px_regs_altbank(0);
|
|
||||||
/* reset with frequency changed */
|
|
||||||
val = set_px_sysclk(simple_strtoul(argv[3],NULL,10));
|
|
||||||
|
|
||||||
corepll = strfractoint(argv[4]);
|
|
||||||
val = val + set_px_corepll(corepll);
|
|
||||||
val = val + set_px_mpxpll(simple_strtoul(argv[5],NULL,10));
|
|
||||||
if (val == 3) {
|
|
||||||
printf("Setting registers VCFGEN0, VCFGEN1, VBOOT, and VCTL\n");
|
|
||||||
set_altbank();
|
|
||||||
read_from_px_regs(1);
|
|
||||||
read_from_px_regs_altbank(1);
|
|
||||||
printf("Enabling watchdog timer on the FPGA and resetting board with values from VSPEED0, VSPEED1, VCLKH, and VCLKL to boot from the other bank ....\n");
|
|
||||||
set_px_go_with_watchdog();
|
|
||||||
} else
|
|
||||||
goto my_usage;
|
|
||||||
|
|
||||||
while(1); /* Not reached */
|
|
||||||
} else if(argv[2][1] == 'd'){
|
|
||||||
/* Reset from next bank without changing frequencies but with watchdog timer enabled */
|
|
||||||
read_from_px_regs(0);
|
|
||||||
read_from_px_regs_altbank(0);
|
|
||||||
printf("Setting registers VCFGEN1, VBOOT, and VCTL\n");
|
|
||||||
set_altbank();
|
|
||||||
read_from_px_regs_altbank(1);
|
|
||||||
printf("Enabling watchdog timer on the FPGA and resetting board to boot from the other bank....\n");
|
|
||||||
set_px_go_with_watchdog();
|
|
||||||
while(1); /* Not reached */
|
|
||||||
} else {
|
|
||||||
/* Reset from next bank without changing frequency and without watchdog timer enabled */
|
|
||||||
read_from_px_regs(0);
|
|
||||||
read_from_px_regs_altbank(0);
|
|
||||||
if(argc > 2)
|
|
||||||
goto my_usage;
|
|
||||||
printf("Setting registers VCFGNE1, VBOOT, and VCTL\n");
|
|
||||||
set_altbank();
|
|
||||||
read_from_px_regs_altbank(1);
|
|
||||||
printf("Resetting board to boot from the other bank....\n");
|
|
||||||
set_px_go();
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
goto my_usage;
|
|
||||||
}
|
|
||||||
|
|
||||||
my_usage:
|
|
||||||
printf("\nUsage: reset cf <SYSCLK freq> <COREPLL ratio> <MPXPLL ratio>\n");
|
|
||||||
printf(" reset altbank [cf <SYSCLK freq> <COREPLL ratio> <MPXPLL ratio>]\n");
|
|
||||||
printf("For example: reset cf 40 2.5 10\n");
|
|
||||||
printf("See MPC8641HPCN Design Workbook for valid values of command line parameters.\n");
|
|
||||||
return;
|
|
||||||
} else
|
|
||||||
out8(PIXIS_BASE+PIXIS_RST,0);
|
|
||||||
|
|
||||||
#endif /* !CONFIG_MPC8641HPCN */
|
#endif /* !CONFIG_MPC8641HPCN */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue