feat(fix): close ar100s uart7 debug
2 files added
8 files modified
.. | .. |
---|
37 | 37 | # |
---|
38 | 38 | # debug printk function |
---|
39 | 39 | # |
---|
40 | | -CFG_DEBUGGER_PRINTF=y |
---|
41 | | -CFG_DEBUG_ERR=y |
---|
42 | | -CFG_DEBUG_LOG=y |
---|
43 | | -CFG_DEBUG_WRN=y |
---|
44 | | -# CFG_DEBUG_INF is not set |
---|
| 40 | +# CFG_DEBUGGER_PRINTF is not set |
---|
45 | 41 | |
---|
46 | 42 | # |
---|
47 | 43 | # shell function |
---|
.. | .. |
---|
| 1 | +/* |
---|
| 2 | +********************************************************************************************************* |
---|
| 3 | +* AR100 SYSTEM |
---|
| 4 | +* AR100 Software System Develop Kits |
---|
| 5 | +* pmu module |
---|
| 6 | +* |
---|
| 7 | +* (c) Copyright 2012-2016, Sunny China |
---|
| 8 | +* All Rights Reserved |
---|
| 9 | +* |
---|
| 10 | +* File : pmu.c |
---|
| 11 | +* By : Sunny |
---|
| 12 | +* Version : v1.0 |
---|
| 13 | +* Date : 2012-5-22 |
---|
| 14 | +* Descript: power management unit. |
---|
| 15 | +* Update : date auther ver notes |
---|
| 16 | +* 2012-5-22 13:33:03 Sunny 1.0 Create this file. |
---|
| 17 | +********************************************************************************************************* |
---|
| 18 | +*/ |
---|
| 19 | + |
---|
| 20 | +#include "pmu_i.h" |
---|
| 21 | + |
---|
| 22 | +/** |
---|
| 23 | + * tcs4838 voltages info table, |
---|
| 24 | + * the index of table is voltage type. |
---|
| 25 | + */ |
---|
| 26 | +pmu_onoff_reg_bitmap_t tcs4838_onoff_reg_bitmap[] = { |
---|
| 27 | + //dev_addr //reg_addr //offset //state //dvm_en |
---|
| 28 | + {RSB_RTSADDR_TCS4838, TCS4838_VSEL0, 7, 1, 0},//TCS4838_DCDC0 |
---|
| 29 | + {RSB_RTSADDR_TCS4838, TCS4838_VSEL1, 7, 1, 0},//TCS4838_DCDC1 |
---|
| 30 | +}; |
---|
| 31 | + |
---|
| 32 | +/** |
---|
| 33 | + * tcs4838 check, |
---|
| 34 | + */ |
---|
| 35 | +s32 tcs4838_is_exist(void) |
---|
| 36 | +{ |
---|
| 37 | + u8 devaddr; |
---|
| 38 | + u8 regaddr; |
---|
| 39 | + u8 data; |
---|
| 40 | + |
---|
| 41 | + devaddr = RSB_RTSADDR_TCS4838; |
---|
| 42 | + regaddr = TCS4838_ID1; |
---|
| 43 | + |
---|
| 44 | + pmu_reg_read(&devaddr, ®addr, &data, 1); |
---|
| 45 | + data &= 0xE0; |
---|
| 46 | + |
---|
| 47 | + if (data == 0x80) { |
---|
| 48 | + return TRUE; |
---|
| 49 | + } |
---|
| 50 | + |
---|
| 51 | + return FALSE; |
---|
| 52 | +} |
---|
| 53 | + |
---|
| 54 | +/** |
---|
| 55 | + * tcs4838 specific function, |
---|
| 56 | + */ |
---|
| 57 | + |
---|
| 58 | +s32 tcs4838_pmu_set_voltage_state(u32 type, u32 state) |
---|
| 59 | +{ |
---|
| 60 | + u8 devaddr; |
---|
| 61 | + u8 regaddr; |
---|
| 62 | + u8 data; |
---|
| 63 | + u32 offset; |
---|
| 64 | + |
---|
| 65 | + devaddr = tcs4838_onoff_reg_bitmap[type].devaddr; |
---|
| 66 | + regaddr = tcs4838_onoff_reg_bitmap[type].regaddr; |
---|
| 67 | + offset = tcs4838_onoff_reg_bitmap[type].offset; |
---|
| 68 | +// tcs4838_onoff_reg_bitmap[type].state = state; |
---|
| 69 | + |
---|
| 70 | + //read-modify-write |
---|
| 71 | + pmu_reg_read(&devaddr, ®addr, &data, 1); |
---|
| 72 | + data &= (~(1 << offset)); |
---|
| 73 | + data |= (state << offset); |
---|
| 74 | + pmu_reg_write(&devaddr, ®addr, &data, 1); |
---|
| 75 | + |
---|
| 76 | + if (state == POWER_VOL_ON) { |
---|
| 77 | + //delay 1ms for open PMU output |
---|
| 78 | + time_mdelay(1); |
---|
| 79 | + } |
---|
| 80 | + |
---|
| 81 | + return OK; |
---|
| 82 | +} |
---|
| 83 | + |
---|
.. | .. |
---|
7 | 7 | */ |
---|
8 | 8 | #include "uart_i.h" |
---|
9 | 9 | |
---|
10 | | -volatile u32 uart_pin_not_used = 0; |
---|
| 10 | +volatile u32 uart_pin_not_used = 1; |
---|
11 | 11 | volatile u32 uart_lock = 1; |
---|
12 | 12 | volatile static u32 uart_rate; |
---|
13 | 13 | |
---|
.. | .. |
---|
115 | 115 | s32 uart_exit(void) |
---|
116 | 116 | { |
---|
117 | 117 | uart_lock = 1; |
---|
118 | | - uart_pin_not_used = 0; |
---|
| 118 | + uart_pin_not_used = 1; |
---|
119 | 119 | |
---|
120 | 120 | pin_set_multi_sel(PIN_GRP_PL, 2, 7); |
---|
121 | 121 | pin_set_multi_sel(PIN_GRP_PL, 3, 7); |
---|
.. | .. |
---|
5 | 5 | CFG_OPENRISC=y |
---|
6 | 6 | CFG_PMU_USED=y |
---|
7 | 7 | CFG_SUN50IW10P1=y |
---|
8 | | -CFG_DEBUG_WRN=y |
---|
9 | | -CFG_DEBUG_ERR=y |
---|
10 | 8 | CFG_AR100S_OS=y |
---|
11 | | -CFG_DEBUGGER_PRINTF=y |
---|
12 | 9 | CFG_EVB_PLATFORM=y |
---|
13 | 10 | CFG_AXP803_USED=y |
---|
14 | 11 | CFG_STANDBY_SERVICE=y |
---|
15 | 12 | CFG_CPUX_ARM64=y |
---|
16 | 13 | CFG_TWI_USED=y |
---|
17 | 14 | CFG_WATCHDOG_USED=y |
---|
18 | | -CFG_DEBUG_LOG=y |
---|
19 | 15 | CFG_FDT_USED=y |
---|
.. | .. |
---|
| 1 | +/* |
---|
| 2 | +******************************************************************************* |
---|
| 3 | +* AR100 SYSTEM |
---|
| 4 | +* AR100 Software System Develop Kits |
---|
| 5 | +* dram module |
---|
| 6 | +* |
---|
| 7 | +* (c) Copyright 2012-2016, Sunny China |
---|
| 8 | +* All Rights Reserved |
---|
| 9 | +* |
---|
| 10 | +* File : dfs.h |
---|
| 11 | +* By : Fanqh |
---|
| 12 | +* Version : v1.0 |
---|
| 13 | +* Date : 2022-1-10 |
---|
| 14 | +* Descript: dram dfs header. |
---|
| 15 | +* Update : date auther ver notes |
---|
| 16 | +* 2022-1-10 10:28:51 Fanqh 1.0 Create this file. |
---|
| 17 | +******************************************************************************** |
---|
| 18 | +*/ |
---|
| 19 | +#ifndef __DFS_H__ |
---|
| 20 | +#define __DFS_H__ |
---|
| 21 | + |
---|
| 22 | +#include <driver/timer.h> |
---|
| 23 | +#include <driver/dram.h> |
---|
| 24 | +#include <system/para.h> |
---|
| 25 | + |
---|
| 26 | +#ifdef CFG_DRAMFREQ_USED |
---|
| 27 | +extern int mctl_mdfs_software(__dram_para_t *para, unsigned int freq_id); |
---|
| 28 | +#else |
---|
| 29 | +static inline int mctl_mdfs_software(__dram_para_t *para, unsigned int freq_id) { return -1; } |
---|
| 30 | +#endif |
---|
| 31 | +#endif |
---|
.. | .. |
---|
7 | 7 | #define CFG_OPENRISC 1 |
---|
8 | 8 | #define CFG_PMU_USED 1 |
---|
9 | 9 | #define CFG_SUN50IW10P1 1 |
---|
10 | | -#define CFG_DEBUG_WRN 1 |
---|
11 | | -#define CFG_DEBUG_ERR 1 |
---|
12 | 10 | #define CFG_AR100S_OS 1 |
---|
13 | | -#define CFG_DEBUGGER_PRINTF 1 |
---|
14 | 11 | #define CFG_EVB_PLATFORM 1 |
---|
15 | 12 | #define CFG_AXP803_USED 1 |
---|
16 | 13 | #define CFG_STANDBY_SERVICE 1 |
---|
17 | 14 | #define CFG_CPUX_ARM64 1 |
---|
18 | 15 | #define CFG_TWI_USED 1 |
---|
19 | 16 | #define CFG_WATCHDOG_USED 1 |
---|
20 | | -#define CFG_DEBUG_LOG 1 |
---|
21 | 17 | #define CFG_FDT_USED 1 |
---|
.. | .. |
---|
22 | 22 | |
---|
23 | 23 | /* extern u32 debug_level; */ |
---|
24 | 24 | |
---|
25 | | -#ifdef CFG_DEBUGGER_PRINTF |
---|
| 25 | +#define ENOSYS 88 |
---|
| 26 | +// #ifdef CFG_DEBUGGER_PRINTF |
---|
26 | 27 | /* |
---|
27 | 28 | ********************************************************************************************************* |
---|
28 | 29 | * INITIALIZE DEBUGGER |
---|
.. | .. |
---|
111 | 112 | */ |
---|
112 | 113 | s32 set_debug_level(u32 level); |
---|
113 | 114 | |
---|
114 | | -#else |
---|
115 | | -static inline s32 debugger_init(void) |
---|
116 | | -{ |
---|
117 | | - return -ENOSYS; |
---|
118 | | -} |
---|
119 | | - |
---|
120 | | -static inline s32 debugger_exit(void) |
---|
121 | | -{ |
---|
122 | | - return -ENOSYS; |
---|
123 | | -} |
---|
124 | | - |
---|
125 | | -static inline s32 debugger_putc(char ch) |
---|
126 | | -{ |
---|
127 | | - return -ENOSYS; |
---|
128 | | -} |
---|
129 | | - |
---|
130 | | -static inline u32 debugger_get(char *buf) |
---|
131 | | -{ |
---|
132 | | - return -ENOSYS; |
---|
133 | | -} |
---|
134 | | - |
---|
135 | | -static inline s32 debugger_puts(char *string) |
---|
136 | | -{ |
---|
137 | | - return -ENOSYS; |
---|
138 | | -} |
---|
139 | | - |
---|
140 | | -static inline s32 debugger_printf(u32 level, const char *format, ...) |
---|
141 | | -{ |
---|
142 | | - return -ENOSYS; |
---|
143 | | -} |
---|
144 | | - |
---|
145 | | -static inline s32 vprintk(u32 level, const char *format, va_list args) |
---|
146 | | -{ |
---|
147 | | - return -ENOSYS; |
---|
148 | | -} |
---|
149 | | - |
---|
150 | | -static inline s32 set_debug_level(u32 level) |
---|
151 | | -{ |
---|
152 | | - return -ENOSYS; |
---|
153 | | -} |
---|
154 | | - |
---|
155 | | -#endif |
---|
156 | 115 | |
---|
157 | 116 | #endif /* __DEBUGGER_H__ */ |
---|
.. | .. |
---|
5 | 5 | |
---|
6 | 6 | config DEBUGGER_PRINTF |
---|
7 | 7 | bool "debugger printf support" |
---|
8 | | - default y |
---|
| 8 | + default n |
---|
9 | 9 | |
---|
10 | 10 | if DEBUGGER_PRINTF |
---|
11 | 11 | |
---|
12 | 12 | config DEBUG_ERR |
---|
13 | 13 | bool "err debug support" |
---|
14 | | - default y |
---|
| 14 | + default n |
---|
15 | 15 | |
---|
16 | 16 | config DEBUG_LOG |
---|
17 | 17 | bool "log debug support" |
---|
18 | | - default y |
---|
| 18 | + default n |
---|
19 | 19 | |
---|
20 | 20 | config DEBUG_WRN |
---|
21 | 21 | bool "warn debug support" |
---|
22 | | - default y |
---|
| 22 | + default n |
---|
23 | 23 | |
---|
24 | 24 | config DEBUG_INF |
---|
25 | 25 | bool "inf debug support" |
---|
.. | .. |
---|
35 | 35 | */ |
---|
36 | 36 | s32 debugger_init(void) |
---|
37 | 37 | { |
---|
| 38 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
38 | 39 | /* initialize serial module */ |
---|
39 | 40 | uart_init(); |
---|
40 | 41 | #ifdef CFG_SHELL_USED |
---|
.. | .. |
---|
44 | 45 | #endif |
---|
45 | 46 | |
---|
46 | 47 | return OK; |
---|
| 48 | +#else |
---|
| 49 | + return -ENOSYS; |
---|
| 50 | +#endif |
---|
47 | 51 | } |
---|
48 | 52 | |
---|
49 | 53 | /* |
---|
.. | .. |
---|
59 | 63 | */ |
---|
60 | 64 | s32 debugger_exit(void) |
---|
61 | 65 | { |
---|
| 66 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
62 | 67 | return OK; |
---|
| 68 | +#else |
---|
| 69 | + return -ENOSYS; |
---|
| 70 | +#endif |
---|
63 | 71 | } |
---|
64 | 72 | |
---|
65 | 73 | /* |
---|
.. | .. |
---|
75 | 83 | */ |
---|
76 | 84 | s32 debugger_putc(char ch) |
---|
77 | 85 | { |
---|
| 86 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
78 | 87 | uart_putc(ch); |
---|
79 | 88 | |
---|
80 | 89 | return OK; |
---|
| 90 | +#else |
---|
| 91 | + return -ENOSYS; |
---|
| 92 | +#endif |
---|
81 | 93 | } |
---|
82 | 94 | |
---|
83 | 95 | /* |
---|
.. | .. |
---|
93 | 105 | */ |
---|
94 | 106 | u32 debugger_get(char *buf) |
---|
95 | 107 | { |
---|
| 108 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
96 | 109 | return uart_get(buf); |
---|
| 110 | +#else |
---|
| 111 | + return -ENOSYS; |
---|
| 112 | +#endif |
---|
97 | 113 | } |
---|
98 | 114 | |
---|
99 | 115 | /* |
---|
.. | .. |
---|
109 | 125 | */ |
---|
110 | 126 | s32 debugger_puts(char *string) |
---|
111 | 127 | { |
---|
| 128 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
112 | 129 | uart_puts(string); |
---|
113 | 130 | |
---|
114 | 131 | return OK; |
---|
| 132 | +#else |
---|
| 133 | + return -ENOSYS; |
---|
| 134 | +#endif |
---|
115 | 135 | } |
---|
116 | 136 | |
---|
117 | 137 | /* |
---|
.. | .. |
---|
137 | 157 | char debugger_buffer[DEBUG_BUFFER_SIZE]; |
---|
138 | 158 | s32 debugger_printf(u32 level, const char *format, ...) |
---|
139 | 159 | { |
---|
| 160 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
140 | 161 | va_list args; |
---|
141 | 162 | char string[16]; /* align by cpu word */ |
---|
142 | 163 | char *pdest; |
---|
.. | .. |
---|
237 | 258 | return (pdest - debugger_buffer); |
---|
238 | 259 | } |
---|
239 | 260 | return OK; |
---|
| 261 | +#else |
---|
| 262 | + return -ENOSYS; |
---|
| 263 | +#endif |
---|
240 | 264 | } |
---|
241 | 265 | |
---|
| 266 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
242 | 267 | static s32 print_align(char *string, s32 len, s32 align) |
---|
243 | 268 | { |
---|
244 | 269 | /* |
---|
.. | .. |
---|
254 | 279 | /* not fill anything */ |
---|
255 | 280 | return 0; |
---|
256 | 281 | } |
---|
| 282 | +#endif |
---|
257 | 283 | |
---|
258 | 284 | /* |
---|
259 | 285 | ********************************************************************************************************* |
---|
.. | .. |
---|
266 | 292 | * Returns : OK if print current time succeeded, others if failed. |
---|
267 | 293 | ********************************************************************************************************* |
---|
268 | 294 | */ |
---|
| 295 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
269 | 296 | static s32 print_current_time(void) |
---|
270 | 297 | { |
---|
271 | 298 | char time[12]; |
---|
.. | .. |
---|
309 | 336 | |
---|
310 | 337 | return OK; |
---|
311 | 338 | } |
---|
| 339 | +#endif |
---|
312 | 340 | |
---|
313 | 341 | /* |
---|
314 | 342 | ********************************************************************************************************* |
---|
.. | .. |
---|
323 | 351 | */ |
---|
324 | 352 | s32 set_debug_level(u32 level) |
---|
325 | 353 | { |
---|
| 354 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
326 | 355 | LOG("debug_mask from %d to %d\n", debug_level, level); |
---|
327 | 356 | debug_level = level; |
---|
328 | 357 | |
---|
329 | 358 | return OK; |
---|
| 359 | +#else |
---|
| 360 | + return -ENOSYS; |
---|
| 361 | +#endif |
---|
330 | 362 | } |
---|
.. | .. |
---|
21 | 21 | |
---|
22 | 22 | #include "include.h" |
---|
23 | 23 | |
---|
| 24 | +#ifdef CFG_DEBUGGER_PRINTF |
---|
24 | 25 | static s32 print_align(char *string, s32 len, s32 align); |
---|
25 | 26 | static s32 print_current_time(void); |
---|
| 27 | +#endif |
---|
26 | 28 | |
---|
27 | 29 | |
---|
28 | 30 | #endif /* __DEBUGGER_I_H__ */ |
---|