mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-18 14:48:17 +01:00
kmp204x: handle dip-switch for factory settings
Add readout of dip-switch to revert to factory settings. If one or more dip-switch are set, launch bank 0 that contains the bootloader to do the required action. Signed-off-by: Stefan Bigler <stefan.bigler@keymile.com> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
This commit is contained in:
parent
a53e65d053
commit
4921a149e1
@ -116,6 +116,9 @@ int board_early_init_r(void)
|
|||||||
/* enable the Unit LED (red) & Boot LED (on) */
|
/* enable the Unit LED (red) & Boot LED (on) */
|
||||||
qrio_set_leds();
|
qrio_set_leds();
|
||||||
|
|
||||||
|
/* enable Application Buffer */
|
||||||
|
qrio_enable_app_buffer();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,6 +174,18 @@ int hush_init_var(void)
|
|||||||
#if defined(CONFIG_LAST_STAGE_INIT)
|
#if defined(CONFIG_LAST_STAGE_INIT)
|
||||||
int last_stage_init(void)
|
int last_stage_init(void)
|
||||||
{
|
{
|
||||||
|
#if defined(CONFIG_KMCOGE4)
|
||||||
|
/* on KMCOGE4, the BFTIC4 is on the LBAPP2 */
|
||||||
|
struct bfticu_iomap *bftic4 =
|
||||||
|
(struct bfticu_iomap *)CONFIG_SYS_LBAPP2_BASE;
|
||||||
|
u8 dip_switch = in_8((u8 *)&(bftic4->mswitch)) & BFTICU_DIPSWITCH_MASK;
|
||||||
|
|
||||||
|
if (dip_switch != 0) {
|
||||||
|
/* start bootloader */
|
||||||
|
puts("DIP: Enabled\n");
|
||||||
|
setenv("actual_bank", "0");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
set_km_env();
|
set_km_env();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -22,5 +22,6 @@ void qrio_gpio_direction_input(u8 port_off, u8 gpio_nr);
|
|||||||
void qrio_prst(u8 bit, bool en, bool wden);
|
void qrio_prst(u8 bit, bool en, bool wden);
|
||||||
void qrio_prstcfg(u8 bit, u8 mode);
|
void qrio_prstcfg(u8 bit, u8 mode);
|
||||||
void qrio_set_leds(void);
|
void qrio_set_leds(void);
|
||||||
|
void qrio_enable_app_buffer(void);
|
||||||
|
|
||||||
void pci_of_setup(void *blob, bd_t *bd);
|
void pci_of_setup(void *blob, bd_t *bd);
|
||||||
|
@ -159,3 +159,17 @@ void qrio_set_leds(void)
|
|||||||
ctrlh |= (CTRLH_WRL_BOOT | CTRLH_WRL_UNITRUN);
|
ctrlh |= (CTRLH_WRL_BOOT | CTRLH_WRL_UNITRUN);
|
||||||
out_8(qrio_base + CTRLH_OFF, ctrlh);
|
out_8(qrio_base + CTRLH_OFF, ctrlh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CTRLL_OFF 0x03
|
||||||
|
#define CTRLL_WRB_BUFENA 0x20
|
||||||
|
|
||||||
|
void qrio_enable_app_buffer(void)
|
||||||
|
{
|
||||||
|
u8 ctrll;
|
||||||
|
void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
|
||||||
|
|
||||||
|
/* enable application buffer */
|
||||||
|
ctrll = in_8(qrio_base + CTRLL_OFF);
|
||||||
|
ctrll |= (CTRLL_WRB_BUFENA);
|
||||||
|
out_8(qrio_base + CTRLL_OFF, ctrll);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user