diff --git a/arch/loongarch/boot/dts/loongson/loongson2p500.dtsi b/arch/loongarch/boot/dts/loongson/loongson2p500.dtsi index 0afc7e3a3..e09b35cd5 100644 --- a/arch/loongarch/boot/dts/loongson/loongson2p500.dtsi +++ b/arch/loongarch/boot/dts/loongson/loongson2p500.dtsi @@ -497,8 +497,6 @@ clock-frequency = <0 200000000>; dma-mask = <0xffffffff 0xffffffff>; bus-width = <1>; - cap-sd-highspeed; - cap-mmc-highspeed; //no-mmc; status = "disabled"; }; diff --git a/arch/loongarch/boot/dts/loongson/ls2k300_pai.dts b/arch/loongarch/boot/dts/loongson/ls2k300_pai.dts index 73a5a73dd..b765259e0 100644 --- a/arch/loongarch/boot/dts/loongson/ls2k300_pai.dts +++ b/arch/loongarch/boot/dts/loongson/ls2k300_pai.dts @@ -3,139 +3,7 @@ #include #include -#include "loongson2k300.dtsi" -#include "loongson_panel_param.dtsi" - -/ { - model = "LS2K300-PAI"; - - 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; - }; - }; - - leds { - compatible = "gpio-leds"; - - led1 { - label = "led1"; - gpios = <&gpio 54 GPIO_ACTIVE_LOW>; - linux,default-trigger = "heartbeat"; - default-state = "on"; - }; - }; - - lcd_backlight: backlight { - compatible = "gpio-backlight"; - gpios = <&gpio 43 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 = <11289600>; - #clock-cells = <1>; - }; -}; - -&uart0 { - status = "okay"; -}; +#include "ls2k300_pai_common.dtsi" &uart2 { status = "ok"; @@ -157,16 +25,6 @@ status = "disabled"; }; -&spi0 { - status = "okay"; - - spi-flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <25000000>; - reg = <0>; - }; -}; - &spi1 { status = "okay"; @@ -197,74 +55,6 @@ }; }; -&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>; //有数据时闪烁 - }; - }; -}; - -&dc { - status = "ok"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - dc_out_rgb0: endpoint { - remote-endpoint = <&dvo_connector_in>; - }; - }; - }; -}; - -&i2c0 { - status = "ok"; - - touchpad: gt9147@14 { - compatible = "goodix,gt9147"; - reg = <0x14>; - // 2K300 GPIO 支持中断控制 - // GPIO 中断号为 vhwirq-base + pinnum (170 = 128 + 42) - interrupt-parent = <&gpio>; - interrupts = <170 IRQ_TYPE_EDGE_FALLING>; - irq-gpios = <&gpio 42 GPIO_ACTIVE_LOW>; - reset-gpios = <&gpio 55 GPIO_ACTIVE_LOW>; - }; -}; - -&i2c1 { - status = "ok"; -}; - -&i2c2 { - status = "okay"; - - 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>; - }; -}; - - &can0 { status = "disabled"; }; @@ -281,36 +71,6 @@ status = "disabled"; }; -&adc { - status = "okay"; -}; - -&rtc0 { - status = "okay"; -}; - -&sdio1 { - pinctrl-0 = <&sdio1_pins>; - pinctrl-names = "default"; - cap-sd-highspeed; - cap-mmc-highspeed; - bus-width = <4>; - cd-gpios = <&gpio 82 GPIO_ACTIVE_LOW>; - status = "okay"; -}; - -&i2s { - status = "okay"; -}; - -&audio { - status = "okay"; -}; - -&sound { - status = "okay"; -}; - &pwm0 { status = "okay"; }; diff --git a/arch/loongarch/boot/dts/loongson/ls2k300_pai_common.dtsi b/arch/loongarch/boot/dts/loongson/ls2k300_pai_common.dtsi new file mode 100644 index 000000000..d8f7a5c13 --- /dev/null +++ b/arch/loongarch/boot/dts/loongson/ls2k300_pai_common.dtsi @@ -0,0 +1,265 @@ +#include +#include +#include +#include + +#include "loongson2k300.dtsi" +#include "loongson_panel_param.dtsi" + +/ { + model = "LS2K300-PAI"; + + 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; + }; + }; + + leds { + compatible = "gpio-leds"; + + led1 { + label = "led1"; + gpios = <&gpio 54 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + default-state = "on"; + }; + }; + + lcd_backlight: backlight { + compatible = "gpio-backlight"; + gpios = <&gpio 43 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>; + }; +}; + +&uart0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + spi-flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <25000000>; + reg = <0>; + }; +}; + +&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>; //有数据时闪烁 + }; + }; +}; + +&dc { + status = "ok"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dc_out_rgb0: endpoint { + remote-endpoint = <&dvo_connector_in>; + }; + }; + }; +}; + +&i2c0 { + status = "ok"; + + touchpad: gt9147@14 { + compatible = "goodix,gt9147"; + reg = <0x14>; + // 2K300 GPIO 支持中断控制 + // GPIO 中断号为 vhwirq-base + pinnum (170 = 128 + 42) + interrupt-parent = <&gpio>; + interrupts = <170 IRQ_TYPE_EDGE_FALLING>; + irq-gpios = <&gpio 42 GPIO_ACTIVE_LOW>; + reset-gpios = <&gpio 55 GPIO_ACTIVE_LOW>; + }; +}; + +&i2c1 { + status = "ok"; +}; + +&i2c2 { + status = "okay"; + + 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>; + }; +}; + + +&can0 { + status = "disabled"; +}; + +&can1 { + status = "disabled"; +}; + +&can2 { + status = "disabled"; +}; + +&can3 { + status = "disabled"; +}; + +&adc { + status = "okay"; +}; + +&rtc0 { + status = "okay"; +}; + +&sdio1 { + pinctrl-0 = <&sdio1_pins>; + pinctrl-names = "default"; + cap-sd-highspeed; + cap-mmc-highspeed; + bus-width = <4>; + cd-gpios = <&gpio 82 GPIO_ACTIVE_LOW>; + status = "okay"; +}; + +&i2s { + status = "okay"; + slave-mode; + mclk-fixed = <12288000>; +}; + +&audio { + status = "okay"; +}; + +&sound { + status = "okay"; +}; + diff --git a/arch/loongarch/boot/dts/loongson/ls2k300_pai_func2.dts b/arch/loongarch/boot/dts/loongson/ls2k300_pai_func2.dts index bb724ee1e..eafac702e 100644 --- a/arch/loongarch/boot/dts/loongson/ls2k300_pai_func2.dts +++ b/arch/loongarch/boot/dts/loongson/ls2k300_pai_func2.dts @@ -3,139 +3,7 @@ #include #include -#include "loongson2k300.dtsi" -#include "loongson_panel_param.dtsi" - -/ { - model = "LS2K300-PAI"; - - 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; - }; - }; - - leds { - compatible = "gpio-leds"; - - led1 { - label = "led1"; - gpios = <&gpio 54 GPIO_ACTIVE_LOW>; - linux,default-trigger = "heartbeat"; - default-state = "on"; - }; - }; - - lcd_backlight: backlight { - compatible = "gpio-backlight"; - gpios = <&gpio 43 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 = <11289600>; - #clock-cells = <1>; - }; -}; - -&uart0 { - status = "okay"; -}; +#include "ls2k300_pai_common.dtsi" &uart2 { status = "okay"; @@ -165,16 +33,6 @@ status = "okay"; }; -&spi0 { - status = "okay"; - - spi-flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <25000000>; - reg = <0>; - }; -}; - &spi1 { status = "disabled"; }; @@ -183,74 +41,6 @@ status = "disabled"; }; -&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>; //有数据时闪烁 - }; - }; -}; - -&dc { - status = "ok"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - dc_out_rgb0: endpoint { - remote-endpoint = <&dvo_connector_in>; - }; - }; - }; -}; - -&i2c0 { - status = "ok"; - - touchpad: gt9147@14 { - compatible = "goodix,gt9147"; - reg = <0x14>; - // 2K300 GPIO 支持中断控制 - // GPIO 中断号为 vhwirq-base + pinnum (170 = 128 + 42) - interrupt-parent = <&gpio>; - interrupts = <170 IRQ_TYPE_EDGE_FALLING>; - irq-gpios = <&gpio 42 GPIO_ACTIVE_LOW>; - reset-gpios = <&gpio 55 GPIO_ACTIVE_LOW>; - }; -}; - -&i2c1 { - status = "ok"; -}; - -&i2c2 { - status = "okay"; - - 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>; - }; -}; - - &can0 { status = "okay"; }; @@ -267,32 +57,3 @@ status = "okay"; }; -&adc { - status = "okay"; -}; - -&rtc0 { - status = "okay"; -}; - -&sdio1 { - pinctrl-0 = <&sdio1_pins>; - pinctrl-names = "default"; - cap-sd-highspeed; - cap-mmc-highspeed; - bus-width = <4>; - cd-gpios = <&gpio 82 GPIO_ACTIVE_LOW>; - status = "okay"; -}; - -&i2s { - status = "okay"; -}; - -&audio { - status = "okay"; -}; - -&sound { - status = "okay"; -}; diff --git a/arch/loongarch/boot/dts/loongson/ls2k300_pai_pihat.dts b/arch/loongarch/boot/dts/loongson/ls2k300_pai_pihat.dts index 554d41b6b..d9d6cb2cd 100644 --- a/arch/loongarch/boot/dts/loongson/ls2k300_pai_pihat.dts +++ b/arch/loongarch/boot/dts/loongson/ls2k300_pai_pihat.dts @@ -3,151 +3,21 @@ #include #include -#include "loongson2k300.dtsi" -#include "loongson_panel_param.dtsi" +#include "ls2k300_pai_common.dtsi" / { - model = "LS2K300-PAI"; - - 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; - }; - }; - - leds { - compatible = "gpio-leds"; - - led1 { - label = "led1"; - gpios = <&gpio 54 GPIO_ACTIVE_LOW>; - linux,default-trigger = "heartbeat"; - default-state = "on"; - }; - }; - - lcd_backlight: backlight { - compatible = "gpio-backlight"; - gpios = <&gpio 43 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; - }; - humidity_sensor { compatible = "dht11-sensor"; SHT11-gpios = <&gpio 61 GPIO_ACTIVE_HIGH>; status = "okay"; }; - // 虽然这个时钟在从模式下没用,但 es8388 驱动必须指定这个时钟 - es8388_clk: es8388-clock { - compatible = "fixed-clock"; - clock-frequency = <11289600>; - #clock-cells = <1>; - }; - onewire { compatible = "w1-gpio"; gpios = <&gpio 68 GPIO_ACTIVE_HIGH>; }; }; -&uart0 { - status = "okay"; -}; - &uart2 { status = "ok"; }; @@ -168,16 +38,6 @@ status = "disabled"; }; -&spi0 { - status = "okay"; - - spi-flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <25000000>; - reg = <0>; - }; -}; - &spi1 { status = "okay"; @@ -209,74 +69,6 @@ }; }; -&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>; //有数据时闪烁 - }; - }; -}; - -&dc { - status = "ok"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - dc_out_rgb0: endpoint { - remote-endpoint = <&dvo_connector_in>; - }; - }; - }; -}; - -&i2c0 { - status = "ok"; - - touchpad: gt9147@14 { - compatible = "goodix,gt9147"; - reg = <0x14>; - // 2K300 GPIO 支持中断控制 - // GPIO 中断号为 vhwirq-base + pinnum (170 = 128 + 42) - interrupt-parent = <&gpio>; - interrupts = <170 IRQ_TYPE_EDGE_FALLING>; - irq-gpios = <&gpio 42 GPIO_ACTIVE_LOW>; - reset-gpios = <&gpio 55 GPIO_ACTIVE_LOW>; - }; -}; - -&i2c1 { - status = "ok"; -}; - -&i2c2 { - status = "okay"; - - 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>; - }; -}; - - &can0 { status = "disabled"; }; @@ -292,33 +84,3 @@ &can3 { status = "disabled"; }; - -&adc { - status = "okay"; -}; - -&rtc0 { - status = "okay"; -}; - -&sdio1 { - pinctrl-0 = <&sdio1_pins>; - pinctrl-names = "default"; - cap-sd-highspeed; - cap-mmc-highspeed; - bus-width = <4>; - cd-gpios = <&gpio 82 GPIO_ACTIVE_LOW>; - status = "okay"; -}; - -&i2s { - status = "okay"; -}; - -&audio { - status = "okay"; -}; - -&sound { - status = "okay"; -}; diff --git a/arch/loongarch/configs/loongson_2k300_defconfig b/arch/loongarch/configs/loongson_2k300_defconfig index 522213461..dfe37250b 100644 --- a/arch/loongarch/configs/loongson_2k300_defconfig +++ b/arch/loongarch/configs/loongson_2k300_defconfig @@ -203,6 +203,8 @@ CONFIG_NETLINK_DIAG=y CONFIG_CGROUP_NET_PRIO=y CONFIG_BPF_JIT=y CONFIG_CAN=y +CONFIG_CAN_LSCANFD=y +CONFIG_CAN_LSCANFD_PLATFORM=y CONFIG_CFG80211=y CONFIG_MAC80211=y CONFIG_RFKILL=y diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index 424970939..c2b20cadc 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig @@ -177,6 +177,7 @@ source "drivers/net/can/sja1000/Kconfig" source "drivers/net/can/softing/Kconfig" source "drivers/net/can/spi/Kconfig" source "drivers/net/can/usb/Kconfig" +source "drivers/net/can/ls_canfd/Kconfig" endif diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile index 221643001..06150fb43 100644 --- a/drivers/net/can/Makefile +++ b/drivers/net/can/Makefile @@ -34,5 +34,6 @@ obj-$(CONFIG_CAN_SUN4I) += sun4i_can.o obj-$(CONFIG_CAN_TI_HECC) += ti_hecc.o obj-$(CONFIG_CAN_XILINXCAN) += xilinx_can.o obj-$(CONFIG_PCH_CAN) += pch_can.o +obj-$(CONFIG_CAN_LSCANFD) += ls_canfd/ subdir-ccflags-$(CONFIG_CAN_DEBUG_DEVICES) += -DDEBUG diff --git a/drivers/net/can/ls_canfd/Kconfig b/drivers/net/can/ls_canfd/Kconfig new file mode 100644 index 000000000..7ddfd5292 --- /dev/null +++ b/drivers/net/can/ls_canfd/Kconfig @@ -0,0 +1,18 @@ +menuconfig CAN_LSCANFD + tristate "Support LSCAN devices" + depends on HAS_IOMEM + +if CAN_LSCANFD + +config CAN_LSCANFD_PLATFORM + tristate "Generic Platform Bus based LSCAN driver" + help + This driver adds support for the 2K chips connected to + the "platform bus" (Linux abstraction for directly to the + processor attached devices). Which can be found on various + boards from Phytec (http://www.phytec.de) like the PCM027, + PCM038. It also provides the OpenFirmware "platform bus" found + on embedded systems with OpenFirmware bindings, e.g. if you + have a PowerPC based system you may want to enable this option. +endif + diff --git a/drivers/net/can/ls_canfd/Makefile b/drivers/net/can/ls_canfd/Makefile new file mode 100644 index 000000000..c822ba53e --- /dev/null +++ b/drivers/net/can/ls_canfd/Makefile @@ -0,0 +1,13 @@ +# LS CAN FD ip core Linux driver Makefile + +# Invoked make without parameters for native build for current running kernel +# Set KERNEL_VERSION variable to compile for specific installed kernel version +# Exact location of Linux kernel build tree can be chosen by KDIR variable +# If you build for different CPU architecture than native and you do not +# use GNUmakefile trick to set CROSS_COMPILE and ARCH then set these to +# matching values else you do not screw only LS CAN FD build but even +# base kernel build + +obj-$(CONFIG_CAN_LSCANFD) := lscanfd.o +lscanfd-y := lscanfd_dma.elfbin +obj-$(CONFIG_CAN_LSCANFD_PLATFORM) += lscanfd_platform.elfbin diff --git a/drivers/net/can/ls_canfd/lscanfd_dma.elfbin b/drivers/net/can/ls_canfd/lscanfd_dma.elfbin new file mode 100644 index 000000000..5030c9691 Binary files /dev/null and b/drivers/net/can/ls_canfd/lscanfd_dma.elfbin differ diff --git a/drivers/net/can/ls_canfd/lscanfd_platform.elfbin b/drivers/net/can/ls_canfd/lscanfd_platform.elfbin new file mode 100644 index 000000000..43a227acc Binary files /dev/null and b/drivers/net/can/ls_canfd/lscanfd_platform.elfbin differ diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c index 875cc6c00..e179a0724 100644 --- a/sound/soc/codecs/es8328.c +++ b/sound/soc/codecs/es8328.c @@ -23,36 +23,6 @@ #include #include "es8328.h" -#ifdef CONFIG_LOONGARCH -static struct reg_default es8328_reg_defaults[] = { - {ES8328_ADCPOWER, 0x00}, - {ES8328_DACPOWER, - BIT(ES8328_DACPOWER_ROUT2_ON) | - BIT(ES8328_DACPOWER_LOUT2_ON) | - BIT(ES8328_DACPOWER_ROUT1_ON) | - BIT(ES8328_DACPOWER_LOUT1_ON)}, - //{ES8328_DACCONTROL2, 0x03}, - // - {ES8328_LDACVOL, 0x00}, - {ES8328_RDACVOL, 0x00}, - // - //{ES8328_DACCONTROL17, 0xb8}, - //{ES8328_DACCONTROL20, 0xb8}, - {ES8328_DACCONTROL17, ES8328_DACCONTROL17_LD2LO}, - {ES8328_DACCONTROL20, ES8328_DACCONTROL20_RD2RO}, - {ES8328_LOUT1VOL , 0x21}, - {ES8328_ROUT1VOL , 0x21}, -}; - -static void es8328_use_default_regs(struct snd_soc_component *component) -{ - int i = 0; - for (i = 0; i < ARRAY_SIZE(es8328_reg_defaults); i++) { - snd_soc_component_write(component, es8328_reg_defaults[i].reg, - es8328_reg_defaults[i].def); - } -} -#endif static const unsigned int rates_12288[] = { 8000, 12000, 16000, 24000, 32000, 48000, 96000, }; @@ -96,6 +66,11 @@ static const char * const supply_names[ES8328_SUPPLY_NUM] = { "HPVDD", }; +#ifdef CONFIG_LOONGARCH +// MASTER MODE Temperary Fix +#define ES8328_RATES (SNDRV_PCM_RATE_8000) +#define ES8328_FORMATS (SNDRV_PCM_FMTBIT_S16_LE) +#else #define ES8328_RATES (SNDRV_PCM_RATE_192000 | \ SNDRV_PCM_RATE_96000 | \ SNDRV_PCM_RATE_88200 | \ @@ -105,6 +80,7 @@ static const char * const supply_names[ES8328_SUPPLY_NUM] = { SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S32_LE) +#endif struct es8328_priv { struct regmap *regmap; @@ -197,7 +173,7 @@ static int es8328_put_deemph(struct snd_kcontrol *kcontrol, es8328->deemph = deemph; - return 0; + return 1; } @@ -574,7 +550,10 @@ static int es8328_hw_params(struct snd_pcm_substream *substream, snd_soc_component_update_bits(component, ES8328_ADCCONTROL4, ES8328_ADCCONTROL4_ADCWL_MASK, wl << ES8328_ADCCONTROL4_ADCWL_SHIFT); - +#ifdef CONFIG_LOONGARCH + // alsamixer 中暂时没找到调整该配置选项,临时处理 + snd_soc_component_write(component, ES8328_ADCPOWER, 0x00); +#endif return snd_soc_component_update_bits(component, reg, ES8328_RATEMASK, ratio); } @@ -825,7 +804,15 @@ static int es8328_component_probe(struct snd_soc_component *component) goto clk_fail; } #ifdef CONFIG_LOONGARCH - es8328_use_default_regs(component); + es8328->sysclk_constraints = &constraints_12288; + es8328->mclk_ratios = ratios_12288; + + // RESET CODEC + snd_soc_component_write(component, ES8328_CHIPPOWER, + ES8328_CHIPPOWER_ADCDIG_OFF | + ES8328_CHIPPOWER_DACDIG_OFF | + ES8328_CHIPPOWER_ADCSTM_RESET | + ES8328_CHIPPOWER_DACSTM_RESET); #endif return 0; diff --git a/sound/soc/loongson/ls-i2s.c b/sound/soc/loongson/ls-i2s.c index d5f78bed3..9b88b6c8b 100644 --- a/sound/soc/loongson/ls-i2s.c +++ b/sound/soc/loongson/ls-i2s.c @@ -31,7 +31,8 @@ #define PSC_I2S_RATES SNDRV_PCM_RATE_8000_96000 -#define PSC_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ +#define PSC_I2S_FORMATS ( SNDRV_PCM_FMTBIT_S8 | \ + SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S32_LE) diff --git a/sound/soc/loongson/ls-sound-es8388.c b/sound/soc/loongson/ls-sound-es8388.c index c7fa4ba2d..257c939a1 100644 --- a/sound/soc/loongson/ls-sound-es8388.c +++ b/sound/soc/loongson/ls-sound-es8388.c @@ -21,12 +21,9 @@ enum { PRI_PLAYBACK = 0, PRI_CAPTURE, }; -/* - *SND_SOC_DAIFMT_CBS_CFS play ok, volume ok - *SND_SOC_DAIFMT_CBM_CFM Codec's BCLK is Master,LRCLK is Master - */ #define LOONGSON_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \ - SND_SOC_DAIFMT_CBS_CFS) + SND_SOC_DAIFMT_CBM_CFM) +// SND_SOC_DAIFMT_CBS_CFS) SND_SOC_DAILINK_DEFS(es8388_hifi, DAILINK_COMP_ARRAY(COMP_CPU("loongson-i2s-dai")),