mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 22:51:37 +00:00
BeagleBoard: Remove userbutton command and use gpio command instead
Remove userbutton command and do the detection in board config file using the gpio command Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com> Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
This commit is contained in:
parent
c8da405c85
commit
aae58b954b
2 changed files with 9 additions and 57 deletions
|
@ -507,58 +507,3 @@ int ehci_hcd_stop(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_USB_EHCI */
|
#endif /* CONFIG_USB_EHCI */
|
||||||
|
|
||||||
#ifndef CONFIG_SPL_BUILD
|
|
||||||
/*
|
|
||||||
* This command returns the status of the user button on beagle xM
|
|
||||||
* Input - none
|
|
||||||
* Returns - 1 if button is held down
|
|
||||||
* 0 if button is not held down
|
|
||||||
*/
|
|
||||||
int do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
||||||
{
|
|
||||||
int button = 0;
|
|
||||||
int gpio;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* pass address parameter as argv[0] (aka command name),
|
|
||||||
* and all remaining args
|
|
||||||
*/
|
|
||||||
switch (get_board_revision()) {
|
|
||||||
case REVISION_AXBX:
|
|
||||||
case REVISION_CX:
|
|
||||||
case REVISION_C4:
|
|
||||||
gpio = 7;
|
|
||||||
break;
|
|
||||||
case REVISION_XM_A:
|
|
||||||
case REVISION_XM_B:
|
|
||||||
case REVISION_XM_C:
|
|
||||||
default:
|
|
||||||
gpio = 4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
gpio_request(gpio, "");
|
|
||||||
gpio_direction_input(gpio);
|
|
||||||
printf("The user button is currently ");
|
|
||||||
if (gpio_get_value(gpio))
|
|
||||||
{
|
|
||||||
button = 1;
|
|
||||||
printf("PRESSED.\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
button = 0;
|
|
||||||
printf("NOT pressed.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return !button;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
U_BOOT_CMD(
|
|
||||||
userbutton, CONFIG_SYS_MAXARGS, 1, do_userbutton,
|
|
||||||
"Return the status of the BeagleBoard USER button",
|
|
||||||
""
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -167,6 +167,7 @@
|
||||||
#define CONFIG_CMD_PING
|
#define CONFIG_CMD_PING
|
||||||
#define CONFIG_CMD_DHCP
|
#define CONFIG_CMD_DHCP
|
||||||
#define CONFIG_CMD_SETEXPR /* Evaluate expressions */
|
#define CONFIG_CMD_SETEXPR /* Evaluate expressions */
|
||||||
|
#define CONFIG_CMD_GPIO /* Enable gpio command */
|
||||||
|
|
||||||
#undef CONFIG_CMD_FLASH /* flinfo, erase, protect */
|
#undef CONFIG_CMD_FLASH /* flinfo, erase, protect */
|
||||||
#undef CONFIG_CMD_FPGA /* FPGA configuration Support */
|
#undef CONFIG_CMD_FPGA /* FPGA configuration Support */
|
||||||
|
@ -280,10 +281,16 @@
|
||||||
"ramboot=echo Booting from ramdisk ...; " \
|
"ramboot=echo Booting from ramdisk ...; " \
|
||||||
"run ramargs; " \
|
"run ramargs; " \
|
||||||
"bootm ${loadaddr}\0" \
|
"bootm ${loadaddr}\0" \
|
||||||
|
"userbutton=if gpio input 173; then run userbutton_xm; " \
|
||||||
|
"else run userbutton_nonxm; fi;\0" \
|
||||||
|
"userbutton_xm=gpio input 4;\0" \
|
||||||
|
"userbutton_nonxm=gpio input 7;\0"
|
||||||
|
/* "run userbutton" will return 1 (false) if is pressed and 0 (false) if not */
|
||||||
#define CONFIG_BOOTCOMMAND \
|
#define CONFIG_BOOTCOMMAND \
|
||||||
"if mmc rescan ${mmcdev}; then " \
|
"if mmc rescan ${mmcdev}; then " \
|
||||||
"if userbutton; then " \
|
"if run userbutton; then " \
|
||||||
|
"setenv bootenv uEnv.txt;" \
|
||||||
|
"else " \
|
||||||
"setenv bootenv user.txt;" \
|
"setenv bootenv user.txt;" \
|
||||||
"fi;" \
|
"fi;" \
|
||||||
"echo SD/MMC found on device ${mmcdev};" \
|
"echo SD/MMC found on device ${mmcdev};" \
|
||||||
|
|
Loading…
Add table
Reference in a new issue