Skip to content

Commit aeee5e4

Browse files
SamulKyullSamulKyull
authored andcommitted
[board] support avaota f1
1 parent db68387 commit aeee5e4

File tree

6 files changed

+27
-53
lines changed

6 files changed

+27
-53
lines changed

board/avaota-f1/app/main.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include <cli_termesc.h>
2727

2828
extern sunxi_serial_t uart_dbg;
29-
extern sunxi_serial_t uart_cpu_dbg;
30-
extern sunxi_serial_t uart_card;
3129
extern dram_para_t dram_para;
3230
extern sunxi_dma_t sunxi_dma;
3331
extern sunxi_i2c_t sunxi_i2c0;
@@ -126,10 +124,6 @@ int main(void) {
126124

127125
sunxi_serial_init(&uart_dbg);
128126

129-
sunxi_serial_init(&uart_cpu_dbg);
130-
131-
sunxi_serial_init(&uart_card);
132-
133127
show_banner();
134128

135129
printk_info("Hello World!\n");

board/avaota-f1/board.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,8 @@ sunxi_serial_t uart_dbg = {
3131
.stop = UART_STOP_BIT_0,
3232
.parity = UART_PARITY_NO,
3333
.gpio_pin = {
34-
.gpio_tx = {GPIO_PIN(GPIO_PORTD, 22), GPIO_PERIPH_MUX3},
35-
.gpio_rx = {GPIO_PIN(GPIO_PORTD, 23), GPIO_PERIPH_MUX3},
36-
},
37-
.uart_clk = {
38-
.gate_reg_base = SUNXI_CCU_APP_BASE + BUS_CLK_GATING0_REG,
39-
.gate_reg_offset = BUS_CLK_GATING0_REG_UART0_PCLK_EN_OFFSET,
40-
.rst_reg_base = SUNXI_CCU_APP_BASE + BUS_Reset0_REG,
41-
.rst_reg_offset = BUS_Reset0_REG_PRESETN_UART0_SW_OFFSET,
42-
.parent_clk = 192000000,
43-
},
44-
};
45-
46-
sunxi_serial_t uart_cpu_dbg = {
47-
.base = SUNXI_UART0_BASE,
48-
.id = 0,
49-
.baud_rate = UART_BAUDRATE_115200,
50-
.dlen = UART_DLEN_8,
51-
.stop = UART_STOP_BIT_0,
52-
.parity = UART_PARITY_NO,
53-
.gpio_pin = {
54-
.gpio_tx = {GPIO_PIN(GPIO_PORTD, 22), GPIO_PERIPH_MUX3},
55-
.gpio_rx = {GPIO_PIN(GPIO_PORTD, 23), GPIO_PERIPH_MUX3},
34+
.gpio_tx = {GPIO_PIN(GPIO_PORTL, 4), GPIO_PERIPH_MUX3},
35+
.gpio_rx = {GPIO_PIN(GPIO_PORTL, 5), GPIO_PERIPH_MUX3},
5636
},
5737
.uart_clk = {
5838
.gate_reg_base = SUNXI_CCU_APP_BASE + BUS_CLK_GATING0_REG,

cmake/board/avaota-f1.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ set(CMAKE_C_COMPILER "${CROSS_COMPILE}gcc")
2828
set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++")
2929

3030
# Configure compiler flags based on ENABLE_HARDFP option
31-
set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -fdata-sections -march=rv32imafcxthead -mabi=ilp32f")
31+
set(CMAKE_COMMON_FLAGS "-nostdlib -Os -nostdinc -fdata-sections -march=rv32imafcxthead -mabi=ilp32f")
3232

3333
# Disable specific warning flags for C and C++ compilers
3434
set(CMAKE_C_DISABLE_WARN_FLAGS "-Wno-int-to-pointer-cast -Wno-shift-count-overflow -Wno-builtin-declaration-mismatch -Wno-pointer-to-int-cast -Wno-implicit-function-declaration -Wno-discarded-qualifiers")

src/drivers/chips/sun300iw1/sys-dram.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,11 +1048,11 @@ static unsigned int get_dram_size(void) {
10481048
val = readl((MCTL_COM_BASE + MCTL_COM_WORK_MODE0)); /* MCTL_COM_WORK_MODE0 */
10491049
size = calculate_rank_size(val);
10501050

1051-
if ((val & 0x3) == 0) /* Single rank? */
1051+
if ((val & 0x3) == 0) /* Single rank */
10521052
return size;
10531053

10541054
val = readl((MCTL_COM_BASE + MCTL_COM_WORK_MODE1)); /* MCTL_WORK_MODE1 */
1055-
if ((val & 0x3) == 0) /* Two identical ranks? */
1055+
if ((val & 0x3) == 0) /* Two identical ranks */
10561056
return size * 2;
10571057

10581058
/* Add sizes of both ranks */

src/drivers/mtd/sys-spi-nor.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,41 +41,41 @@ static const spi_nor_info_t spi_nor_info_table[] = {
4141
*/
4242
__attribute__((unused)) static inline void spi_nor_dump_sfdp(const sfdp_t *sfdp) {
4343
if (sfdp == NULL) {
44-
printk(LOG_LEVEL_TRACE, "SFDP data is NULL.\n");
44+
printk_trace("SFDP data is NULL.\n");
4545
return;
4646
}
4747

48-
printk(LOG_LEVEL_TRACE, "SFDP Header:\n");
49-
printk(LOG_LEVEL_TRACE, " Signature: %c%c%c%c\n",
48+
printk_trace("SFDP Header:\n");
49+
printk_trace(" Signature: %c%c%c%c\n",
5050
sfdp->header.sign[0],
5151
sfdp->header.sign[1],
5252
sfdp->header.sign[2],
5353
sfdp->header.sign[3]);
54-
printk(LOG_LEVEL_TRACE, " Minor version: %u\n", sfdp->header.minor);
55-
printk(LOG_LEVEL_TRACE, " Major version: %u\n", sfdp->header.major);
56-
printk(LOG_LEVEL_TRACE, " Number of Parameter Headers: %u\n", sfdp->header.nph);
57-
printk(LOG_LEVEL_TRACE, " Unused: 0x%02X\n", sfdp->header.unused);
54+
printk_trace(" Minor version: %u\n", sfdp->header.minor);
55+
printk_trace(" Major version: %u\n", sfdp->header.major);
56+
printk_trace(" Number of Parameter Headers: %u\n", sfdp->header.nph);
57+
printk_trace(" Unused: 0x%02X\n", sfdp->header.unused);
5858

59-
printk(LOG_LEVEL_TRACE, "SFDP Parameter Headers:\n");
59+
printk_trace("SFDP Parameter Headers:\n");
6060
for (int i = 0; i < sfdp->header.nph; i++) {
61-
printk(LOG_LEVEL_TRACE, " Parameter Header #%d:\n", i + 1);
62-
printk(LOG_LEVEL_TRACE, " IDLSB: 0x%02X\n", sfdp->parameter_header[i].idlsb);
63-
printk(LOG_LEVEL_TRACE, " Minor version: %u\n", sfdp->parameter_header[i].minor);
64-
printk(LOG_LEVEL_TRACE, " Major version: %u\n", sfdp->parameter_header[i].major);
65-
printk(LOG_LEVEL_TRACE, " Length: %u\n", sfdp->parameter_header[i].length);
66-
printk(LOG_LEVEL_TRACE, " PTP: 0x%02X 0x%02X 0x%02X\n",
61+
printk_trace(" Parameter Header #%d:\n", i + 1);
62+
printk_trace(" IDLSB: 0x%02X\n", sfdp->parameter_header[i].idlsb);
63+
printk_trace(" Minor version: %u\n", sfdp->parameter_header[i].minor);
64+
printk_trace(" Major version: %u\n", sfdp->parameter_header[i].major);
65+
printk_trace(" Length: %u\n", sfdp->parameter_header[i].length);
66+
printk_trace(" PTP: 0x%02X 0x%02X 0x%02X\n",
6767
sfdp->parameter_header[i].ptp[0],
6868
sfdp->parameter_header[i].ptp[1],
6969
sfdp->parameter_header[i].ptp[2]);
70-
printk(LOG_LEVEL_TRACE, " IDMSB: 0x%02X\n", sfdp->parameter_header[i].idmsb);
70+
printk_trace(" IDMSB: 0x%02X\n", sfdp->parameter_header[i].idmsb);
7171
}
7272

73-
printk(LOG_LEVEL_TRACE, "SFDP Basic Table:\n");
74-
printk(LOG_LEVEL_TRACE, " Minor version: %u\n", sfdp->basic_table.minor);
75-
printk(LOG_LEVEL_TRACE, " Major version: %u\n", sfdp->basic_table.major);
76-
printk(LOG_LEVEL_TRACE, " Table (16 x 4 bytes):\n");
73+
printk_trace("SFDP Basic Table:\n");
74+
printk_trace(" Minor version: %u\n", sfdp->basic_table.minor);
75+
printk_trace(" Major version: %u\n", sfdp->basic_table.major);
76+
printk_trace(" Table (16 x 4 bytes):\n");
7777
for (int i = 0; i < 16; i++) {
78-
printk(LOG_LEVEL_TRACE, " ");
78+
printk_trace(" ");
7979
for (int j = 0; j < 4; j++) {
8080
printk(LOG_LEVEL_MUTE, "0x%02X ", sfdp->basic_table.table[i * 4 + j]);
8181
}
@@ -285,7 +285,7 @@ static inline int spi_nor_get_info(sunxi_spi_t *spi) {
285285

286286
if (spi_nor_read_sfdp(spi, &sfdp)) {
287287
info.name = "SPDF";
288-
#if defined(LOG_LEVEL_TRACE)
288+
#if LOG_LEVEL_DEFAULT >= LOG_LEVEL_TRACE
289289
spi_nor_dump_sfdp(&sfdp);
290290
#endif
291291

src/drivers/sys-spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0+ */
22

33
#if LOG_LEVEL_DEFAULT <= LOG_LEVEL_DEBUG
4-
#define LOG_LEVEL_DEFAULT LOG_LEVEL_DEBUG
4+
/* #define LOG_LEVEL_DEFAULT LOG_LEVEL_DEBUG */
55
#endif
66

77
#include <io.h>

0 commit comments

Comments
 (0)