Update to 1ace04931c77df9

1. Add 2k300_gongkong board support
This commit is contained in:
maoxiaochuan
2025-02-20 10:02:07 +08:00
parent 00959b6bb2
commit 1c67e978cf
14 changed files with 437 additions and 38 deletions
+2 -1
View File
@@ -3,7 +3,8 @@
# dtb-y = loongson-2k0500-ref.dtb loongson-2k1000-ref.dtb loongson-2k2000-ref.dtb
ifdef CONFIG_DTB_MATCH_BY_BOARD_NAME
dtb-$(CONFIG_LOONGSON_2K300) += ls2k300_mini_dp.dtb ls2k300_vanguard_pi.dtb
dtb-$(CONFIG_LOONGSON_2K300) += ls2k300_mini_dp.dtb ls2k300_vanguard_pi.dtb ls2k300_gongkong_gbkpgk0.dtb
obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
else
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_NAME))
+15 -5
View File
@@ -1,6 +1,10 @@
/dts-v1/;
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/clock/loongson2k300-clock.h>
#include <dt-bindings/usb/dwc2-loongson-fix.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/input/linux-event-codes.h>
/ {
model = "loongson,generic";
@@ -184,10 +188,18 @@
pinctrl-single,bits = <0xc 0x00000f00 0x00000f00>;
};
i2c2_G82_G83_pins: pinmux_G82_G83_as_i2c2 {
pinctrl-single,bits = <0x14 0x000000a0 0x000000f0>;
};
i2c3_pins: pinmux_G54_G55_as_i2c3 {
pinctrl-single,bits = <0xc 0x0000f000 0x0000f000>;
};
i2c3_G84_G85_pins: pinmux_G84_G85_as_i2c3 {
pinctrl-single,bits = <0x14 0x00000a00 0x000000f00>;
};
spi1_pins: pinmux_G60_G63_as_spi1 {
pinctrl-single,bits = <0xc 0xff000000 0xff000000>;
};
@@ -833,11 +845,9 @@
clock-frequency = <0 200000000>;
bus-width = <8>;
cap-mmc-highspeed;
#if CONFIG_LOONGSON_MMC_HIGH_PERFORMANCE
mmc-hs200-1_8v;
#endif
no-sd;
no-sdio;
non-removable;
};
sdio1: sdio@0x16148000 {
@@ -868,13 +878,13 @@
dma-mask = <0x0 0xffffffff>;
};
otg@0x16040000 {
otg: otg@0x16040000 {
compatible = "loongson,loongson2-dwc2";
reg = <0 0x16040000 0 0x40000>;
interrupt-parent = <&liointc1>;
interrupts = <16 IRQ_TYPE_LEVEL_HIGH>; // 48 - 32 = 16
dma-mask = <0x0 0xffffffff>;
loongson,dwc2-fix = <DWC2_LOONGSON_FIX_DELAY>;
loongson,dwc2-fix = <DWC2_LOONGSON_FIX_NONE>;
//dr_mode = "peripheral";
/* Optional for that dr_mode = "host" or dr_mode = "peripheral" */
};
@@ -1,8 +1,3 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "loongson2k300.dtsi"
/ {
@@ -64,3 +59,7 @@
};
};
};
// &emmc {
// mmc-hs200-1_8v;
// };
@@ -0,0 +1,53 @@
#include "loongson2k300.dtsi"
/ {
chosen {
stdout-path = "serial0:115200n8";
bootargs = "earlycon";
};
/* not need memory node, we get memory info from boot params. */
//memory {
// name = "memory";
// device_type = "memory";
// reg = <0 0x00200000 0 0x0ee00000
// 0 0x90000000 0 0x10000000>;
//};
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
linux,cma {
compatible = "shared-dma-pool";
reusable;
size = <0 0x02000000>;
linux,cma-default;
};
};
};
&uart0 {
status = "okay";
};
&spi0 {
status = "okay";
spi-flash@0 {
compatible = "jedec,spi-nor";
spi-max-frequency = <25000000>;
reg = <0>;
};
};
&i2c2 {
status = "okay";
pinctrl-0 = <&i2c2_G82_G83_pins>;
};
&i2c3 {
status = "okay";
pinctrl-0 = <&i2c3_G84_G85_pins>;
};
@@ -0,0 +1,345 @@
#include "ls2k300_gongkong_g2k03z2_core.dtsi"
#include "loongson_panel_param.dtsi"
/ {
model = "LS2K300-GONGKONG-GBKPGK0";
leds {
compatible = "gpio-leds";
sys_stat {
label = "sys_stat";
gpios = <&io_expander_a 8 GPIO_ACTIVE_LOW>;
linux,default-trigger = "heartbeat";
default-state = "on";
};
led1 {
label = "led1";
gpios = <&io_expander_a 5 GPIO_ACTIVE_LOW>;
default-state = "off";
};
led2 {
label = "led2";
gpios = <&io_expander_a 7 GPIO_ACTIVE_LOW>;
default-state = "off";
};
led3 {
label = "led3";
gpios = <&io_expander_a 6 GPIO_ACTIVE_LOW>;
default-state = "off";
};
};
lcd_backlight: backlight {
compatible = "gpio-backlight";
gpios = <&gpio 89 GPIO_ACTIVE_HIGH>;
default-on;
};
panel: dvo-connector@0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "panel-lvds", "auo,b101ean01";
backlight = <&lcd_backlight>;
/* lcd power on control gpio */
// enable-gpios = <&pioA 3 GPIO_ACTIVE_HIGH>;
// power-supply = <&vdd_lcd>;
#if 0 // 4.3' LCD
width-mm = <223>;
height-mm = <125>;
label = "ATK-MD0430R-800x480";
data-mapping = "jeida-24";
panel-timing {
clock-frequency = <27000000>;
hactive = <800>;
vactive = <480>;
hsync-len = <40>;
hfront-porch = <48>;
hback-porch = <40>;
vfront-porch = <13>;
vback-porch = <32>;
vsync-len = <1>;
de-active = <1>;
hsync-active = <0>;
vsync-active = <0>;
pixelclk-active = <0>;
};
#else // 7' LCD
width-mm = <223>;
height-mm = <125>;
label = "ATK-MD0700R-1024x600";
data-mapping = "jeida-24";
panel-timing {
clock-frequency = <51200000>;
hactive = <1024>;
vactive = <600>;
hsync-len = <20>;
hfront-porch = <160>;
hback-porch = <140>;
vfront-porch = <12>;
vback-porch = <20>;
vsync-len = <3>;
de-active = <1>;
hsync-active = <0>;
vsync-active = <0>;
pixelclk-active = <0>;
};
#endif
port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
dvo_connector_in: endpoint@0 {
reg = <0>;
remote-endpoint = <&dc_out_rgb0>;
};
};
};
vccio_codec: 3_3V{
compatible = "regulator-fixed";
regulator-name = "VCC_IO";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
// 虽然这个时钟在从模式下没用,但 es8388 驱动必须指定这个时钟
es8388_clk: es8388-clock {
compatible = "fixed-clock";
clock-frequency = <12288000>;
#clock-cells = <1>;
};
};
&dc {
status = "ok"
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dc_out_rgb0: endpoint {
remote-endpoint = <&dvo_connector_in>;
};
};
};
};
&gmac0 {
status = "okay";
phy-handle = <&yt8511h0>;
mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;
yt8511h0: ethernet-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0>;
motorcomm,led0_cfg = <0x40>; //千兆常亮
motorcomm,led1_cfg = <0x30>; //百兆 十兆常亮
motorcomm,led2_cfg = <0x2600>; //有数据时闪烁
};
};
};
&gmac1 {
status = "okay";
phy-handle = <&yt8511h1>;
mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;
yt8511h1: ethernet-phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0>;
motorcomm,led0_cfg = <0x40>; //千兆常亮
motorcomm,led1_cfg = <0x30>; //百兆 十兆常亮
motorcomm,led2_cfg = <0x2600>; //有数据时闪烁
};
};
};
&i2c2 {
//i2c-speed = <400000>;
codec: es8388@11{
compatible = "everest,es8388";
reg = <0x11>;
AVDD-supply = <&vccio_codec>;
DVDD-supply = <&vccio_codec>;
HPVDD-supply = <&vccio_codec>;
PVDD-supply = <&vccio_codec>;
clocks = <&es8388_clk 0>;
};
dido_A000: xl9555@20 {
compatible = "nxp,pca9555";
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
interrupt-parent = <&io_expander_a>;
interrupts = <10 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
};
dido_A001: xl9555@21 {
compatible = "nxp,pca9555";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
interrupt-parent = <&io_expander_a>;
interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
};
dido_A010: xl9555@22 {
compatible = "nxp,pca9555";
reg = <0x22>;
gpio-controller;
#gpio-cells = <2>;
interrupt-parent = <&io_expander_a>;
interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
};
rtc_ds1307@68 {
compatible = "dallas,ds1307";
reg = <0x68>;
};
};
&i2c3 {
i2c-speed = <400000>;
touchpad: gt9147@14 {
compatible = "goodix,gt9147";
reg = <0x14>;
interrupt-parent = <&io_expander_a>;
interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
irq-gpios = <&io_expander_a 2 GPIO_ACTIVE_LOW>;
reset-gpios = <&io_expander_a 3 GPIO_ACTIVE_LOW>;
};
io_expander_b: xl9555@26 {
compatible = "nxp,pca9555";
reg = <0x26>;
gpio-controller;
#gpio-cells = <2>;
// 2K300 GPIO 支持中断控制
// GPIO 中断号为 vhwirq-base + pinnum (195 = 128 + 67)
interrupt-parent = <&gpio>;
interrupts = <195 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
};
io_expander_a: xl9555@27 {
compatible = "nxp,pca9555";
reg = <0x27>;
gpio-controller;
#gpio-cells = <2>;
// 2K300 GPIO 支持中断控制
// GPIO 中断号为 vhwirq-base + pinnum (194 = 128 + 66)
interrupt-parent = <&gpio>;
interrupts = <194 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
};
dido_B000: xl9555@20 {
compatible = "nxp,pca9555";
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
interrupt-parent = <&io_expander_a>;
interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
};
dido_B001: xl9555@21 {
compatible = "nxp,pca9555";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
interrupt-parent = <&io_expander_a>;
interrupts = <14 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
};
dido_B010: xl9555@22 {
compatible = "nxp,pca9555";
reg = <0x22>;
gpio-controller;
#gpio-cells = <2>;
interrupt-parent = <&io_expander_a>;
interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
};
};
&uart1 {
status = "okay";
};
&uart5 {
status = "okay";
};
&can2 {
status = "ok"
ls,canfd-stb-gpio = <&gpio 60 GPIO_ACTIVE_HIGH>;
};
&can3 {
status = "ok"
ls,canfd-stb-gpio = <&gpio 60 GPIO_ACTIVE_HIGH>;
};
&adc {
status = "okay";
};
&sdio1 {
pinctrl-0 = <&sdio1_pins>;
pinctrl-names = "default";
cap-sd-highspeed;
cap-mmc-highspeed;
bus-width = <4>;
//cd-gpios = <&io_expander_a 4 GPIO_ACTIVE_LOW>;
status = "okay";
};
&i2s {
status = "okay";
};
&audio {
status = "okay";
};
&sound {
status = "okay";
loongson,audio-codec = <&codec>;
// Easy Compatible for asound.state Configure
loongson,sound-card-name = "ES8388";
};
@@ -1,7 +1,5 @@
#include "ls2k300_g2k03z0_core_v10.dtsi"
#include "loongson_panel_param.dtsi"
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/pwm/pwm.h>
/ {
model = "LS2K300-MINI-DP";
@@ -1,8 +1,3 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "ls2k300_vanguard_pi_common.dtsi"
&uart2 {
@@ -1,8 +1,3 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "loongson2k300.dtsi"
#include "loongson_panel_param.dtsi"
@@ -1,8 +1,3 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "ls2k300_vanguard_pi_common.dtsi"
&uart2 {
@@ -1,8 +1,3 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "ls2k300_vanguard_pi_common.dtsi"
/ {
@@ -539,6 +539,8 @@ CONFIG_PINCTRL_SINGLE=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_LOONGSON_IRQCHIP=y
CONFIG_GPIO_LOONGSON_64BIT=y
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_RESTART=y
CONFIG_POWER_RESET_SYSCON=y
@@ -692,6 +694,7 @@ CONFIG_LEDS_GPIO=y
CONFIG_LEDS_PWM=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=y
CONFIG_RTC_DRV_EFI=y
CONFIG_RTC_DRV_LOONGSON=y
CONFIG_DMADEVICES=y
@@ -113,6 +113,7 @@ extern u32 __dtb_ls2k1000_dp_i2s_begin[];
extern u32 __dtb_ls2p500_gbkpjm0_v10_begin[];
extern u32 __dtb_ls2k300_mini_dp_begin[];
extern u32 __dtb_ls2k300_vanguard_pi_begin[];
extern u32 __dtb_ls2k300_gongkong_gbkpgk0_begin[];
extern char __dtb_start[];
extern struct boot_params *efi_bp;
extern struct loongson_board_info b_info;
+2
View File
@@ -345,6 +345,8 @@ static void* __init get_fdt_by_board_name(void)
fdt = &__dtb_ls2k300_mini_dp_begin;
else if (!strncmp(board_name, "LS2K300-PAI", 11))
fdt = &__dtb_ls2k300_vanguard_pi_begin;
else if (!strncmp(board_name, "LS2K300-GONGKONG-GBKPGK0", 24))
fdt = &__dtb_ls2k300_gongkong_gbkpgk0_begin;
else
fdt = &__dtb_ls2k300_mini_dp_begin;
#endif
+7
View File
@@ -1033,6 +1033,10 @@ probe_free_host:
static void ls2k_mci_shutdown(struct platform_device *pdev)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct ls2k_mci_host *host = mmc_priv(mmc);
if (mmc->caps & MMC_CAP_NONREMOVABLE)
return;
if (mmc->card)
mmc->card->state &= ~1;
@@ -1045,6 +1049,9 @@ static void ls2k_mci_remove(struct platform_device *pdev)
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct ls2k_mci_host *host = mmc_priv(mmc);
if (mmc->caps & MMC_CAP_NONREMOVABLE)
return;
ls2k_mci_shutdown(pdev);