2025年10月29日 星期三

WE310K6 on NV Orin

The main chip is RTL8852be.
Found another driver below, not tested yet


The drive comes from Telit, not downloaded from above.
  • WiFi
source/kernel/kernel-jammy-src/drivers/net/wireless/Makefile
...
...
obj-$(CONFIG_RTL8852BE) += we310k6/

source/kernel/kernel-jammy-src/drivers/net/wireless/Kconfig
...
...
source "drivers/net/wireless/we310k6/Kconfig"

source/kernel/kernel-jammy-src/drivers/net/wireless/we310k6/Makefile
...
...
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
EXTRA_CFLAGS += -DCONFIG_RADIO_WORK -DCONFIG_PLATFORM_OPS
...
...
EXTRA_CFLAGS += -I$(src)/platform
...
...
CONFIG_PLATFORM_I386_PC = n
...
...
########### PLATFORM OPS  ##########################
# Import platform specific compile options
EXTRA_CFLAGS += -I$(src)/platform

# Explicitly select platform-specific PCI operations file
# Based on your system (Orin is AArch64 Linux), we'll assume platform_linux_pc_pci.c is correct.
# You might need to adjust this logic if you have a more specific platform configuration macro.
# Check the ARCH variable that the kernel build system passes.

# Clear _PLATFORM_FILES to prevent unintended inclusions from .mk files if they re-assign it.
_PLATFORM_FILES =

ifeq ($(ARCH),arm64) # For NVIDIA Orin
    # This assumes platform_linux_pc_pci.c is the correct file for ARM64 Linux
    _PLATFORM_FILES += platform/platform_linux_pc_pci.o platform/platform_ops.o
    EXTRA_CFLAGS += -DCONFIG_PLATFORM_LINUX_PC # If this define is used in your code
    # Comment out other platform-specific configs if they are set to 'y' earlier
    # For example, ensure CONFIG_PLATFORM_I386_PC is 'n'
endif
ifeq ($(ARCH),x86) # For generic Linux PC (i386/x86_64)
    _PLATFORM_FILES += platform/platform_linux_pc_pci.o
    EXTRA_CFLAGS += -DCONFIG_PLATFORM_I386_PC # If this define is used in your code
endif
ifeq ($(ARCH),mips) # For MIPS platforms
    _PLATFORM_FILES += platform/platform_mips_98d_pci.o
    EXTRA_CFLAGS += -DCONFIG_PLATFORM_RTL8198D # If this define is used in your code
endif
# Add more conditions for other platforms if needed, following the same pattern.
# Make sure only one of these blocks evaluates to true for your target system.

# Add the selected platform files to the build objects
OBJS += $(_PLATFORM_FILES)
...
...

  • BT
Note: BT is working on UART
Since the default setting is PCIE+USB via M.2 on NV Orin, WE310K6 BT didn't work on it.
source/kernel/kernel-jammy-src/drivers/bluetooth/Kconfig
config BT_WE310K6
        tristate "WE310K6 Bluetooth driver support"
        depends on BT
        help
          This is a driver for the WE310K6 Bluetooth controller.
          If you have this hardware, say Y or M here.
          Say N otherwise.

source "drivers/bluetooth/we310k6/Kconfig"


source/kernel/kernel-jammy-src/drivers/bluetooth/Makefile
obj-$(CONFIG_BT_WE310K6) += we310k6/


source/kernel/kernel-jammy-src/drivers/bluetooth/we310k6/Makefile
obj-$(config_bt_we310k6) += bt_we310k6.o

bt_we310k6-y := hci_h4.o hci_ldisc.o hci_rtk_h5.o rtk_coex.o


Telit's document.
Bluetooth® controller. For WE310K6 Bluetooth UART, please use rtk_hciattach.
Do not use the hciattach compiled by BlueZ.
Initialization is performed by rtk_hciattach -n -s 115200 ttyUSB0 rtk_h5 
or 
rtk_hciattach -n -s 115200 ttyUSB0 rtk_h4 commands, where the serial device name will be different on each platform. 
We are using 3 wire protocol So please use the below command to Initialization.

2025年10月15日 星期三

STM32MP257f-EV1 enable SPI3

Board: STM32MP257f-EV1
OS: buildroot (branch: remotes/origin/st/2022.02)
patch: buildroot-external-st (branch: st/2022.02.7)


enable SPI3
$ vim buildroot-external-st/board/stmicroelectronics/stm32mp2/linux-dts/st/stm32mp257f-ev1-mx.dts

...
...
#include "stm32mp25-pinctrl.dtsi"

aliases{
		ethernet0 = ð2;
		ethernet1 = ð1;
		serial0 = &usart2;
		serial1 = &usart6;
		serial2 = &lpuart1;
        spi3 = &spi3;
	};
...
...
&spi3 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&spi3_pins_a>;
	pinctrl-1 = <&spi3_sleep_pins_a>;
	status = "okay";

    spidev@0 {
        compatible = "lwn,bk4";
        reg = <0>;
        spi-max-frequency = <10000000>;
    };
};

Kernel code
CONFIG_SPI_SPIDEV=m or y


drivers/spi/spidev.c
static const struct of_device_id spidev_dt_ids[] = {
	{ .compatible = "cisco,spi-petra", .data = &spidev_of_check },
	{ .compatible = "dh,dhcom-board", .data = &spidev_of_check },
	{ .compatible = "lineartechnology,ltc2488", .data = &spidev_of_check },
	{ .compatible = "lwn,bk4", .data = &spidev_of_check },
	{ .compatible = "menlo,m53cpld", .data = &spidev_of_check },
	{ .compatible = "micron,spi-authenta", .data = &spidev_of_check },
	{ .compatible = "rohm,bh2228fv", .data = &spidev_of_check },
	{ .compatible = "rohm,dh2228fv", .data = &spidev_of_check },
	{ .compatible = "semtech,sx1301", .data = &spidev_of_check },
	{ .compatible = "silabs,em3581", .data = &spidev_of_check },
	{ .compatible = "silabs,si3210", .data = &spidev_of_check },
	{},
};
MODULE_DEVICE_TABLE(of, spidev_dt_ids);


drivers/spi/spi-stm32.c
static const struct of_device_id stm32_spi_of_match[] = {
	{ .compatible = "st,stm32mp25-spi", .data = (void *)&stm32mp25_spi_cfg },
	{ .compatible = "st,stm32h7-spi", .data = (void *)&stm32h7_spi_cfg },
	{ .compatible = "st,stm32f4-spi", .data = (void *)&stm32f4_spi_cfg },
	{},
};
MODULE_DEVICE_TABLE(of, stm32_spi_of_match);

on EV-1 board
# dtc -I fs -O dts /proc/device-tree > dts

# vi dts

...
...
 aliases {
                ethernet0 = "/soc@0/bus@42080000/eth2@482d0000";
                serial1 = "/soc@0/bus@42080000/serial@40220000";
                ethernet1 = "/soc@0/bus@42080000/eth1@482c0000";
                spi3 = "/soc@0/bus@42080000/spi@400c0000";
                serial2 = "/soc@0/bus@42080000/serial@46030000";
                serial0 = "/soc@0/bus@42080000/serial@400e0000";
        };
...
...
spi@400c0000 {
                                power-domains = <0x0c>;
                                pinctrl-names = "default\0sleep";
                                #address-cells = <0x01>;
                                pinctrl-0 = <0x27>;
                                resets = <0x16 0x18>;
                                interrupts = <0x00 0x7d 0x04>;
                                clocks = <0x16 0x104>;
                                #size-cells = <0x00>;
                                dma-names = "rx\0tx";
                                compatible = "st,stm32mp25-spi";
                                pinctrl-1 = <0x28>;
                                status = "okay";
                                reg = <0x400c0000 0x400>;
                                phandle = <0xbc>;
                                dmas = <0x23 0x35 0x20 0x3012 0x23 0x36 0x20 0x3021>;
                                access-controllers = <0x1b 0x18>;

                                spidev@0 {
                                        spi-max-frequency = <0x989680>;
                                        compatible = "lwn,bk4";
                                        reg = <0x00>;
                                };
                        };
install spidev.ko
# modprobe spidev.ko

# ls /dev/spidev3.0
/dev/spidev3.0

2025年9月18日 星期四

QMDL to Pcap


scat
https://github.com/fgsect/scat

Install
Install the necessary package via pip:
$ pip3 install pyusb pyserial bitstring packaging


$ cd src/
$ pip3 install -e .
$ python3 -m scat.main --help

Usage
$ scat --version
$ scat --help

$ scat -t qc -d 250812-174032_250812-174109.qmdl -F output.pcap