summaryrefslogtreecommitdiff
path: root/utils/hwstub/stub/rk27xx
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-02-04 00:10:41 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-02-10 23:14:24 +0100
commitc17d30f20466861a244c603665c580feb7758abf (patch)
treec5044f599f89d89de0b1419bd40e92211f8c8b8a /utils/hwstub/stub/rk27xx
parent6d64111b3c2f772cfc3539bb13851f78d4b55870 (diff)
downloadrockbox-c17d30f20466861a244c603665c580feb7758abf.tar.gz
rockbox-c17d30f20466861a244c603665c580feb7758abf.zip
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
Diffstat (limited to 'utils/hwstub/stub/rk27xx')
-rw-r--r--utils/hwstub/stub/rk27xx/target.c59
1 files changed, 11 insertions, 48 deletions
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
33}; 33};
34 34
35static enum rk27xx_family_t g_rk27xx_family = UNKNOWN; 35static enum rk27xx_family_t g_rk27xx_family = UNKNOWN;
36static int g_atexit = HWSTUB_ATEXIT_OFF;
37 36
38static void _enable_irq(void) 37static void _enable_irq(void)
39{ 38{
@@ -43,23 +42,6 @@ static void _enable_irq(void)
43 ); 42 );
44} 43}
45 44
46static void power_off(void)
47{
48 GPIO_PCCON &= ~(1<<0);
49 while(1);
50}
51
52static void rk27xx_reset(void)
53{
54 /* use Watchdog to reset */
55 SCU_CLKCFG &= ~CLKCFG_WDT;
56 WDTLR = 1;
57 WDTCON = (1<<4) | (1<<3);
58
59 /* Wait for reboot to kick in */
60 while(1);
61}
62
63/* us may be at most 2^31/200 (~10 seconds) for 200MHz max cpu freq */ 45/* us may be at most 2^31/200 (~10 seconds) for 200MHz max cpu freq */
64void target_udelay(int us) 46void target_udelay(int us)
65{ 47{
@@ -132,41 +114,22 @@ void target_init(void)
132 } 114 }
133} 115}
134 116
135static struct usb_resp_info_target_t g_target = 117struct hwstub_target_desc_t __attribute__((aligned(2))) target_descriptor =
136{ 118{
137 .id = HWSTUB_TARGET_RK27, 119 sizeof(struct hwstub_target_desc_t),
138 .name = "Rockchip RK27XX" 120 HWSTUB_DT_TARGET,
121 HWSTUB_TARGET_RK27,
122 "Rockchip RK27XX"
139}; 123};
140 124
141int target_get_info(int info, void **buffer) 125void target_get_desc(int desc, void **buffer)
142{ 126{
143 if(info == HWSTUB_INFO_TARGET) 127 (void) desc;
144 { 128 *buffer = NULL;
145 *buffer = &g_target;
146 return sizeof(g_target);
147 }
148 else
149 return -1;
150} 129}
151 130
152int target_atexit(int method) 131void target_get_config_desc(void *buffer, int *size)
153{ 132{
154 g_atexit = method; 133 (void) buffer;
155 return 0; 134 (void) size;
156}
157
158void target_exit(void)
159{
160 switch(g_atexit)
161 {
162 case HWSTUB_ATEXIT_OFF:
163 power_off();
164 // fallthrough in case of return
165 case HWSTUB_ATEXIT_REBOOT:
166 rk27xx_reset();
167 // fallthrough in case of return
168 case HWSTUB_ATEXIT_NOP:
169 default:
170 return;
171 }
172} 135}