Commit Graph

46667 Commits

Author SHA1 Message Date
chao an
e586f86918 sched/mqueue: fix resource leak in mq_timedsend()
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-15 01:56:35 +08:00
Alan Carvalho de Assis
f69251151e stm32f4discovery: Add W5500 board config example 2022-09-15 01:55:47 +08:00
Alan Carvalho de Assis
5322f909ef stm32f4discovery: Add support to WIZnet W5500 2022-09-15 01:55:47 +08:00
Eero Nurkkala
ec026c14cb risc-v/mpfs: emmcsd: further enhance the clocking
Simplify the clock mode from the board.h -files. Also make the
SD clock definable as well.

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-09-15 01:55:33 +08:00
Ville Juven
ea9144bda8 mpfs/mpfs_ddr.c: Stop the DDR training once it is completed
The DDR training IP stays active otherwise, so stop it when the training
is complete.

This fixes a potential interrupt storm via MPFS_IRQ_DDRC_TRAIN.
2022-09-14 22:31:36 +08:00
Alan Carvalho de Assis
72313301e2 net/w5500: Fix small typo 2022-09-13 19:50:25 -04:00
Nathan Hartman
1913163c64 drivers: Fix some Kconfig help texts 2022-09-13 23:25:47 +08:00
Nathan Hartman
00666a8778 drivers/mmcsd: Remove executable permissions from source files 2022-09-13 23:07:34 +08:00
ligd
bedd5d382d armv7-a: icache also need SMP cache coherency configuration
This can fixes the random crash happened sometime during boot.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-13 17:59:41 +08:00
Nathan Hartman
69feebe48c tools/pic32: Add description, fix nxstyle, fix typos
* tools/pic32/Config.mk: Fix typo.

* tools/pic32/mkpichex.c:
  (): Add one-line description of this file.
  (adjust_extlin): Fix nxstyle error and typo in comment.
2022-09-13 14:53:54 +08:00
Nathan Hartman
8231485eff tools/b16.c: Fix usage text 2022-09-13 14:53:42 +08:00
Eero Nurkkala
e5305a250a risc-v/mpfs: emmcsd: provide options for selecting clk speed
Some related products, such as Aries m100pfs, don't support eMMC
speeds up to 200MHz. Thus, provide option to select slower clock.
This has only to do with the clocking, no CMD6 is sent to select
high speed modes.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-09-13 11:23:45 +08:00
licheng
6a01099c59 reinit spi sd when sd status is wrong.
Signed-off-by: licheng <chengli@bestechnic.com>
2022-09-12 17:12:02 -03:00
Ville Juven
ff05cc593f risc-v/mmu: Fix L3 mappings for kernel, and mpfs protected mode userspace
The L3 mapping function was just way too simplistic. Depending on memory
configuration it either works or not.

Noticed that with icicle:pnsh the software crashes due to instruction
page fault, reason is the map_region() implementation that does not
work for regions that are not aligned to 2MB (the L2 page size).

Implemented an extremely simplistic page table allocator for the L3
references, that should once and for all get rid of the L3 mapping issue.

NOTE: gran_alloc() cannot be used at this point, it is too early for it.
2022-09-12 18:01:08 +09:00
Alan Carvalho de Assis
0eb79f1a9a ttgo_lora_esp32: Add support to SX1276 2022-09-11 13:13:16 +08:00
zhangyuan21
3b889d820f armv7-a/r: use SRS and RFE for exception handler 2022-09-11 10:50:37 +09:00
Xiang Xiao
8b8534c4b4 usrsock: Initialize g_usrsockdev in the declaration
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-11 10:08:04 +09:00
Xiang Xiao
b400b99001 net/usrsock: Simplify the return value process of net_timedwait
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-11 10:08:04 +09:00
Xiang Xiao
77823415ed net/usrsock: Remove the unnecessary blank line
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-11 10:08:04 +09:00
Xiang Xiao
3269c1a102 net/usrsock: Remove the unnecessary label
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-11 10:08:04 +09:00
Xiang Xiao
3d0985df39 net/usrsock: Remove the unnecessary extra space
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-11 10:08:04 +09:00
Xiang Xiao
ef246c0869 mtd/config: Remove MTD_CONFIG_ERASEDVALUE
since we can query this value by MTDIOC_ERASESTATE after:
commit 30cb497fe1
Author: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Date:   Tue Jul 13 19:33:12 2021 -0300

    mtd: Add MTDIOC_ERASESTATE command for retrieving erase state value

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-10 10:41:42 +02:00
liangchaozhong
62cbd72149 remove access on /dev/usrsock in up_usrsock.c
Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
2022-09-10 13:08:22 +08:00
liangchaozhong
5ec4296553 move usrsock_dev.c to driver folder
Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
2022-09-10 13:08:22 +08:00
ligd
3a023f4d1a arm: fix backtrace busyloop
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-10 12:48:11 +08:00
ligd
b3ebe66ff5 arch: dump backtrace should after set rtcb regs
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-10 12:48:11 +08:00
ligd
a3f9bd3786 backtrace: fix busy loop backtrace
Situation:
1. user call assert
2. crash in assert
3. crash happend, do backtrace
4. backtrace interrupt stack successful
5. busy loop backtrace user stack with CURRENT_REGS

Fix:
use rtcb->regs instead

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-10 12:48:11 +08:00
ligd
a1c9598fff kasan: use init value to avoid kasan used before bss clear
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-10 10:31:16 +08:00
curuvar
46103e29c0 Add "telnet" configuration to Raspberry Pi Pico W 2022-09-10 10:30:59 +08:00
ligd
d1b118d731 uart_rpmsg: add mutex to dmatx
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-09 20:27:25 -03:00
ligd
37d37dcae5 armv7-a/r: use generic timer to realize arm_timer
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-09 21:52:35 +02:00
ligd
bc17563a8f wqueue: fix race-condition on work_queue
CPU0                     CPU1

work_queue(a)            work_queue(a)
                         -> work_cancel(a)
-> work_cancel(a)
-> enter_critical()
-> sq_addlast(a)
-> leave_critical()
                         -> enter_critical()
                         -> sq_addlast(a) // double add, wrong
                         -> leave_critical()

Also, this happens in mulit-threads in one CPU.

Fix:

work_cancel() should in critical section.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-09 21:52:21 +02:00
ligd
4c19130d1d cache: fix up_clean_dcache() slowly
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-09 21:51:35 +02:00
ligd
10529c7d0a sched: fix kasan report error when open CONFIG_DEBUG_MM
reason:
1. g_running_tasks = thread A
2. thread A exit (free thread A's tcb) -> thread B
3. thread B interrupt by irq
4. check g_running_tasks->flags -> kasan report used after free

rootcause:
g_running_tasks has't set completely when syscall hanppened

Resolve:
Use rtcb (get at ISR begining) instead

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-09 19:00:05 +02:00
Xiang Xiao
ed85055edb udp: Remove the unnessary check of addr size in udp_readahead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-09 17:21:33 +02:00
Xiang Xiao
7f26b92130 udp: Don't accumulate the receive length in psock_udp_recvfrom
since udp_recvfrom_newdata is called no more than once

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-09 17:21:33 +02:00
Eero Nurkkala
945e531eaf risc-v/mpfs: emmcsd: allow switching from SD to eMMC
If the system starts up using the SD-card, and later wants
to switch to use the eMMC, it's not going to happen. SD-card
will be kept selected within the FPGA making the transition
fail.

It's been possible to switch from eMMC to SD, but now the
transition is possible for both directions.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-09-09 21:40:35 +08:00
Huang Qi
d7b04a2b8b Config.mk: Add COMPILEZIG
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-09-09 21:39:49 +08:00
liangchaozhong
644c4afeed usrsock:refine usrsock's architecture
Seperate usrsock device driver with usrsock core function layer
to make it more flexiable to adopt other kind of usrsock interface driver

Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
2022-09-09 20:56:12 +09:00
chao an
d10cd8d585 net/procfs: add udp profs support
add proc node /proc/net/udp to show the active udp connections from procfs

nuttx style:

server> cat /proc/net/udp
UDP sl     local_address          remote_address     flg   txsz   rxsz  (IPv4)
  1:          0.0.0.0:  5285    192.168.31.22:  7779   9      0   1041
  2:          0.0.0.0:  5286    192.168.31.22:  7779   9      0   1041
  3:          0.0.0.0:  5287    192.168.31.22:  7779   9      0   1041

linux kernel:
https://www.kernel.org/doc/Documentation/networking/proc_net_tcp.txt

Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-09 19:33:46 +08:00
chao an
7190e56a14 net/procfs: add tcp profs support
add proc node /proc/net/tcp to show the active tcp connections from procfs

nuttx style:

server> cat /proc/net/tcp
TCP sl  st flg ref tmr uack nrt   rxsz local_address           remote_address
     1: 04  61   1  12    0   0   1024          0.0.0.0:4855      192.168.31.22:5001
     2: 04  61   1  12    0   0   1024          0.0.0.0:4856      192.168.31.22:5001
     3: 04  61   1   9    0   0      0                      :::4853   fe80::b27b:25ff:fe28:4011:8789
     4: 04  61   1   3    3   0      0                      :::4854   fe80::b27b:25ff:fe28:4011:8789

linux kernel:
https://www.kernel.org/doc/Documentation/networking/proc_net_tcp.txt

Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-09 19:33:46 +08:00
wangbowen6
c754df6411 drivers/mtd: add rpmsg mtd support
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-09 19:27:57 +08:00
wangbowen6
25c2f3e042 driver: move find_mtddriver() to fs.h and add close_mtddriver.c
Rpmsg mtd need a way to find the mtd device according to the
mtd device path.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-09 19:27:57 +08:00
Victor Benso
2892f18f15 Fix some register's values, enable TWAI extended registers and add a missing prototype.
Also, replaced critical_sections with spinlocks.
2022-09-09 15:30:35 +08:00
GD32-MCU
85c8144afa add chip GD32F450 of GD32MCU
Modify the file according to the checks

update the board config files, and modify the gd32f4xx_progmem.c

Add chip GD32F450 of GD32MCU

delete the micro FAR, modify code style

Add chip GD32F450 of GD32MCU
2022-09-09 15:29:35 +08:00
curuvar
e8f4d74ad0 RP2040 Code Cleanup 2022-09-09 12:43:40 +08:00
Nathan Hartman
9b56bb86da Kconfig: EXPERIMENTAL: Add help text and change prompt label 2022-09-08 23:37:48 +08:00
Eero Nurkkala
5cedf1ef2a risc-v/mpfs: usb: fix usb restart
Issuing the following commands doesn't succeed:
  - conn
  - disconn
  - conn
This USB driver doesn't even disconnect without this patch.

If the USB driver has been started from another hart, closing it
will not disable the PLIC interrupt. This means it's possible many
harts get the USB interrupt and thus make the USB look very unstable.

Fix these problems by disconnecting the USB via the USB_POWER
register at shutdown and disabling the interrupt at shutdown. Also
clear the software internals via the mpfs_sw_setup() for the conn /
disconect loop to succeed.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-09-08 22:08:17 +08:00
curuvar
0322a61510 Add watchdog driver support to RP2040 2022-09-08 21:41:13 +08:00
ligd
4bd88acf1b wqueue: fix work_qcancel() judge error caused by the union in struct work_s
in struct work_s:
union
{
  struct
  {
    struct dq_entry_s dq; /* Implements a double linked list */
    clock_t qtime;        /* Time work queued */
  } s;
  struct wdog_s timer;    /* Delay expiry timer */
}

while we use WDOG_ISACTIVE(&work->timer) to decide use dq or timer,
that is error, wd_cancel() maybe modify this area, dq_rem() also can
modify this area.
So we can't use the WDOG_ISACTIVE(&work->timer) to take as the judgement,
when there is a union.

Fix:
swap the order in struct wdog_s, move the arg to the second 32bit

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-08 15:03:54 +02:00