Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Documentation/devicetree/bindings/soc/sophgo/sophgo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ properties:
- milkv,duo-module-01-evb
- const: milkv,duo-module-01
- const: sophgo,sg2000
- items:
- enum:
- milkv,duo256m
- const: sophgo,sg2002
- items:
- enum:
- sipeed,licheerv-nano-b
Expand Down
1 change: 1 addition & 0 deletions arch/riscv/boot/dts/sophgo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
dtb-$(CONFIG_ARCH_SOPHGO) += cv1800b-milkv-duo.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += cv1812h-huashan-pi.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-licheerv-nano-b.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-milkv-duo-256m.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-evb-v1.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-evb-v2.dtb
Expand Down
9 changes: 9 additions & 0 deletions arch/riscv/boot/dts/sophgo/cv1800b-milkv-duo.dts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

/dts-v1/;

#include <dt-bindings/leds/common.h>
#include "cv1800b.dtsi"

/ {
Expand Down Expand Up @@ -33,6 +34,14 @@
no-map;
};
};

gpio-leds {
compatible = "gpio-leds";

blue_led {
gpios = <&portc 22 GPIO_ACTIVE_HIGH>;
};
};
};

&osc {
Expand Down
23 changes: 21 additions & 2 deletions arch/riscv/boot/dts/sophgo/cv180x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,25 @@
};
};

gpio4: gpio@5021000 {
compatible = "snps,dw-apb-gpio";
reg = <0x5021000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
resets = <&rst RST_GPIO4>;

porte: gpio-controller@0 {
compatible = "snps,dw-apb-gpio-port";
gpio-controller;
#gpio-cells = <2>;
ngpios = <32>;
reg = <0>;
interrupt-controller;
#interrupt-cells = <2>;
interrupts = <SOC_PERIPHERAL_IRQ(48) IRQ_TYPE_LEVEL_HIGH>;
};
};

saradc: adc@30f0000 {
compatible = "sophgo,cv1800b-saradc";
reg = <0x030f0000 0x1000>;
Expand Down Expand Up @@ -438,8 +457,8 @@
clocks = <&clk CLK_AXI4_USB>, <&clk CLK_APB_USB>;
clock-names = "otg", "utmi";
g-np-tx-fifo-size = <32>;
g-rx-fifo-size = <536>;
g-tx-fifo-size = <768 512 512 384 128 128>;
g-rx-fifo-size = <1536>;
g-tx-fifo-size = <128 128 64 64 64 64 32 32>;
interrupts = <SOC_PERIPHERAL_IRQ(14) IRQ_TYPE_LEVEL_HIGH>;
phys = <&usbphy>;
phy-names = "usb2-phy";
Expand Down
1 change: 1 addition & 0 deletions arch/riscv/boot/dts/sophgo/cv18xx-reset.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#define RST_PWM1 33
#define RST_PWM2 34
#define RST_PWM3 35
#define RST_GPIO4 36
#define RST_SPI0 40
#define RST_SPI1 41
#define RST_SPI2 42
Expand Down
109 changes: 109 additions & 0 deletions arch/riscv/boot/dts/sophgo/sg2002-milkv-duo-256m.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/*
* Copyright (C) 2025 Amir Dahan <system64fumo@tuta.io>
*/

/dts-v1/;

#include <dt-bindings/leds/common.h>
#include "sg2002.dtsi"

/ {
model = "Milk-V Duo256M";
compatible = "milkv,duo256m", "sophgo,sg2002";

aliases {
gpio0 = &gpio0;
gpio1 = &gpio1;
gpio2 = &gpio2;
gpio3 = &gpio3;
serial0 = &uart0;
serial1 = &uart1;
serial2 = &uart2;
serial3 = &uart3;
serial4 = &uart4;
};

chosen {
stdout-path = "serial0:115200n8";
};

gpio-leds {
compatible = "gpio-leds";

blue_led {
gpios = <&porte 2 GPIO_ACTIVE_HIGH>;
};
};
};

&osc {
clock-frequency = <25000000>;
};

&pinctrl {
uart0_cfg: uart0-cfg {
uart0-pins {
pinmux = <PINMUX(PIN_UART0_TX, 0)>,
<PINMUX(PIN_UART0_RX, 0)>;
bias-pull-up;
drive-strength-microamp = <10800>;
power-source = <3300>;
};
};

sdhci0_cfg: sdhci0-cfg {
sdhci0-clk-pins {
pinmux = <PINMUX(PIN_SD0_CLK, 0)>;
bias-pull-up;
drive-strength-microamp = <16100>;
power-source = <3300>;
};

sdhci0-cmd-pins {
pinmux = <PINMUX(PIN_SD0_CMD, 0)>;
bias-pull-up;
drive-strength-microamp = <10800>;
power-source = <3300>;
};

sdhci0-data-pins {
pinmux = <PINMUX(PIN_SD0_D0, 0)>,
<PINMUX(PIN_SD0_D1, 0)>,
<PINMUX(PIN_SD0_D2, 0)>,
<PINMUX(PIN_SD0_D3, 0)>;
bias-pull-up;
drive-strength-microamp = <10800>;
power-source = <3300>;
};

sdhci0-cd-pins {
pinmux = <PINMUX(PIN_SD0_CD, 0)>;
bias-pull-up;
drive-strength-microamp = <10800>;
power-source = <3300>;
};
};
};

&sdhci0 {
pinctrl-0 = <&sdhci0_cfg>;
pinctrl-names = "default";
status = "okay";
bus-width = <4>;
no-1-8-v;
no-mmc;
no-sdio;
disable-wp;
};

&uart0 {
pinctrl-0 = <&uart0_cfg>;
pinctrl-names = "default";
status = "okay";
};

&usb {
dr_mode = "host";
status = "okay";
};