From c17d30f20466861a244c603665c580feb7758abf Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Tue, 4 Feb 2014 00:10:41 +0100 Subject: utils/hwstub: completely rework the protocol, drop unused features The protocol has evolved a lot during the 2.x.y lifetime, bringing more features which later got unused. This commit removes all the unused stuff and simplifies everything: - drop the feature mask: everything is mandatory or stalled on error - remove the info request and put all static information in standard USB descriptors which are part of the configuration descriptor (and can be retrieved using the standard GetDescriptor request). - remove the USB interface, we had only one anyway - remove all endpoint descriptors - remove the exit/atexit stuff, it never worked as intended anyway - update the hwstub library and make it able to handle any device - update the tools (mostly renaming and removing of code) Change-Id: I1872bba7f4177fc3891180e8f944aab88f5bde31 --- utils/hwstub/stub/rk27xx/target.c | 59 ++++++++------------------------------- 1 file changed, 11 insertions(+), 48 deletions(-) (limited to 'utils/hwstub/stub/rk27xx') diff --git a/utils/hwstub/stub/rk27xx/target.c b/utils/hwstub/stub/rk27xx/target.c index f9efccaef0..ff2e952909 100644 --- a/utils/hwstub/stub/rk27xx/target.c +++ b/utils/hwstub/stub/rk27xx/target.c @@ -33,7 +33,6 @@ enum rk27xx_family_t }; static enum rk27xx_family_t g_rk27xx_family = UNKNOWN; -static int g_atexit = HWSTUB_ATEXIT_OFF; static void _enable_irq(void) { @@ -43,23 +42,6 @@ static void _enable_irq(void) ); } -static void power_off(void) -{ - GPIO_PCCON &= ~(1<<0); - while(1); -} - -static void rk27xx_reset(void) -{ - /* use Watchdog to reset */ - SCU_CLKCFG &= ~CLKCFG_WDT; - WDTLR = 1; - WDTCON = (1<<4) | (1<<3); - - /* Wait for reboot to kick in */ - while(1); -} - /* us may be at most 2^31/200 (~10 seconds) for 200MHz max cpu freq */ void target_udelay(int us) { @@ -132,41 +114,22 @@ void target_init(void) } } -static struct usb_resp_info_target_t g_target = +struct hwstub_target_desc_t __attribute__((aligned(2))) target_descriptor = { - .id = HWSTUB_TARGET_RK27, - .name = "Rockchip RK27XX" + sizeof(struct hwstub_target_desc_t), + HWSTUB_DT_TARGET, + HWSTUB_TARGET_RK27, + "Rockchip RK27XX" }; -int target_get_info(int info, void **buffer) +void target_get_desc(int desc, void **buffer) { - if(info == HWSTUB_INFO_TARGET) - { - *buffer = &g_target; - return sizeof(g_target); - } - else - return -1; + (void) desc; + *buffer = NULL; } -int target_atexit(int method) +void target_get_config_desc(void *buffer, int *size) { - g_atexit = method; - return 0; -} - -void target_exit(void) -{ - switch(g_atexit) - { - case HWSTUB_ATEXIT_OFF: - power_off(); - // fallthrough in case of return - case HWSTUB_ATEXIT_REBOOT: - rk27xx_reset(); - // fallthrough in case of return - case HWSTUB_ATEXIT_NOP: - default: - return; - } + (void) buffer; + (void) size; } -- cgit v1.2.3