mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Add kernel 6.1 support for BPI-R64
This commit is contained in:
parent
91028220c3
commit
49e5717c77
73 changed files with 7015 additions and 10 deletions
|
@ -0,0 +1,107 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
- * Copyright (c) 2017 MediaTek Inc.
|
||||
- * Author: Ming Huang <ming.huang@mediatek.com>
|
||||
- * Sean Wang <sean.wang@mediatek.com>
|
||||
+ * Copyright (c) 2018 MediaTek Inc.
|
||||
+ * Author: Ryder Lee <ryder.lee@mediatek.com>
|
||||
*
|
||||
* SPDX-License-Identifier: (GPL-2.0 OR MIT)
|
||||
*/
|
||||
@@ -23,7 +22,7 @@
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
- bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512";
|
||||
+ bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512";
|
||||
};
|
||||
|
||||
cpus {
|
||||
@@ -44,18 +43,18 @@
|
||||
key-factory {
|
||||
label = "factory";
|
||||
linux,code = <BTN_0>;
|
||||
- gpios = <&pio 0 0>;
|
||||
+ gpios = <&pio 0 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
key-wps {
|
||||
label = "wps";
|
||||
linux,code = <KEY_WPS_BUTTON>;
|
||||
- gpios = <&pio 102 0>;
|
||||
+ gpios = <&pio 102 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
memory {
|
||||
- reg = <0 0x40000000 0 0x20000000>;
|
||||
+ reg = <0 0x40000000 0 0x40000000>;
|
||||
};
|
||||
|
||||
reg_1p8v: regulator-1p8v {
|
||||
@@ -131,22 +130,22 @@
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
- label = "lan0";
|
||||
+ label = "lan1";
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
- label = "lan1";
|
||||
+ label = "lan2";
|
||||
};
|
||||
|
||||
port@2 {
|
||||
reg = <2>;
|
||||
- label = "lan2";
|
||||
+ label = "lan3";
|
||||
};
|
||||
|
||||
port@3 {
|
||||
reg = <3>;
|
||||
- label = "lan3";
|
||||
+ label = "lan4";
|
||||
};
|
||||
|
||||
port@4 {
|
||||
@@ -239,7 +238,22 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&pcie1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pcie1_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&pio {
|
||||
+ /* Attention: GPIO 90 is used to switch between PCIe@1,0 and
|
||||
+ * SATA functions. i.e. output-high: PCIe, output-low: SATA
|
||||
+ */
|
||||
+ asm_sel {
|
||||
+ gpio-hog;
|
||||
+ gpios = <90 GPIO_ACTIVE_HIGH>;
|
||||
+ output-high;
|
||||
+ };
|
||||
+
|
||||
/* eMMC is shared pin with parallel NAND */
|
||||
emmc_pins_default: emmc-pins-default {
|
||||
mux {
|
||||
@@ -516,11 +530,11 @@
|
||||
};
|
||||
|
||||
&sata {
|
||||
- status = "okay";
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
&sata_phy {
|
||||
- status = "okay";
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
&spi0 {
|
|
@ -0,0 +1,60 @@
|
|||
--- a/arch/arm/boot/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/boot/dts/mt7629-rfb.dts
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
+ bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8";
|
||||
};
|
||||
|
||||
gpio-keys {
|
||||
@@ -70,6 +71,10 @@
|
||||
compatible = "mediatek,eth-mac";
|
||||
reg = <0>;
|
||||
phy-mode = "2500base-x";
|
||||
+
|
||||
+ nvmem-cells = <&macaddr_factory_2a>;
|
||||
+ nvmem-cell-names = "mac-address";
|
||||
+
|
||||
fixed-link {
|
||||
speed = <2500>;
|
||||
full-duplex;
|
||||
@@ -82,6 +87,9 @@
|
||||
reg = <1>;
|
||||
phy-mode = "gmii";
|
||||
phy-handle = <&phy0>;
|
||||
+
|
||||
+ nvmem-cells = <&macaddr_factory_24>;
|
||||
+ nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
mdio: mdio-bus {
|
||||
@@ -133,8 +141,9 @@
|
||||
};
|
||||
|
||||
partition@b0000 {
|
||||
- label = "kernel";
|
||||
+ label = "firmware";
|
||||
reg = <0xb0000 0xb50000>;
|
||||
+ compatible = "denx,fit";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -272,3 +281,17 @@
|
||||
pinctrl-0 = <&watchdog_pins>;
|
||||
status = "okay";
|
||||
};
|
||||
+
|
||||
+&factory {
|
||||
+ compatible = "nvmem-cells";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ macaddr_factory_24: macaddr@24 {
|
||||
+ reg = <0x24 0x6>;
|
||||
+ };
|
||||
+
|
||||
+ macaddr_factory_2a: macaddr@2a {
|
||||
+ reg = <0x2a 0x6>;
|
||||
+ };
|
||||
+};
|
|
@ -0,0 +1,20 @@
|
|||
From d6a596012150960f0f3a214d31bbac4b607dbd1e Mon Sep 17 00:00:00 2001
|
||||
From: Chuanhong Guo <gch981213@gmail.com>
|
||||
Date: Fri, 29 Apr 2022 10:40:56 +0800
|
||||
Subject: [PATCH] arm: mediatek: select arch timer for mt7623
|
||||
|
||||
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
|
||||
---
|
||||
arch/arm/mach-mediatek/Kconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/arm/mach-mediatek/Kconfig
|
||||
+++ b/arch/arm/mach-mediatek/Kconfig
|
||||
@@ -26,6 +26,7 @@ config MACH_MT6592
|
||||
config MACH_MT7623
|
||||
bool "MediaTek MT7623 SoCs support"
|
||||
default ARCH_MEDIATEK
|
||||
+ select HAVE_ARM_ARCH_TIMER
|
||||
|
||||
config MACH_MT7629
|
||||
bool "MediaTek MT7629 SoCs support"
|
|
@ -0,0 +1,10 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -558,6 +558,7 @@
|
||||
compatible = "mediatek,mt7622-nor",
|
||||
"mediatek,mt8173-nor";
|
||||
reg = <0 0x11014000 0 0xe0>;
|
||||
+ interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_LOW>;
|
||||
clocks = <&pericfg CLK_PERI_FLASH_PD>,
|
||||
<&topckgen CLK_TOP_FLASH_SEL>;
|
||||
clock-names = "spi", "sf";
|
|
@ -0,0 +1,25 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -118,7 +118,7 @@
|
||||
};
|
||||
|
||||
psci {
|
||||
- compatible = "arm,psci-0.2";
|
||||
+ compatible = "arm,psci-1.0";
|
||||
method = "smc";
|
||||
};
|
||||
|
||||
@@ -134,6 +134,13 @@
|
||||
#size-cells = <2>;
|
||||
ranges;
|
||||
|
||||
+ /* 64 KiB reserved for ramoops/pstore */
|
||||
+ ramoops@42ff0000 {
|
||||
+ compatible = "ramoops";
|
||||
+ reg = <0 0x42ff0000 0 0x10000>;
|
||||
+ record-size = <0x1000>;
|
||||
+ };
|
||||
+
|
||||
/* 192 KiB reserved for ARM Trusted Firmware (BL31) */
|
||||
secmon_reserved: secmon@43000000 {
|
||||
reg = <0 0x43000000 0 0x30000>;
|
|
@ -0,0 +1,10 @@
|
|||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial2:115200n8";
|
||||
+ bootargs = "console=ttyS2,115200n8 console=tty1";
|
||||
};
|
||||
|
||||
connector {
|
|
@ -0,0 +1,11 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
- bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512";
|
||||
+ bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512";
|
||||
};
|
||||
|
||||
cpus {
|
|
@ -0,0 +1,37 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
aliases {
|
||||
serial0 = &uart0;
|
||||
+ ethernet0 = &gmac0;
|
||||
};
|
||||
|
||||
chosen {
|
||||
@@ -160,22 +161,22 @@
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
- label = "lan0";
|
||||
+ label = "lan1";
|
||||
};
|
||||
|
||||
port@2 {
|
||||
reg = <2>;
|
||||
- label = "lan1";
|
||||
+ label = "lan2";
|
||||
};
|
||||
|
||||
port@3 {
|
||||
reg = <3>;
|
||||
- label = "lan2";
|
||||
+ label = "lan3";
|
||||
};
|
||||
|
||||
port@4 {
|
||||
reg = <4>;
|
||||
- label = "lan3";
|
||||
+ label = "lan4";
|
||||
};
|
||||
|
||||
port@6 {
|
|
@ -0,0 +1,58 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -20,6 +20,10 @@
|
||||
aliases {
|
||||
serial0 = &uart0;
|
||||
ethernet0 = &gmac0;
|
||||
+ led-boot = &led_system_green;
|
||||
+ led-failsafe = &led_system_blue;
|
||||
+ led-running = &led_system_green;
|
||||
+ led-upgrade = &led_system_blue;
|
||||
};
|
||||
|
||||
chosen {
|
||||
@@ -43,8 +47,8 @@
|
||||
compatible = "gpio-keys";
|
||||
|
||||
factory-key {
|
||||
- label = "factory";
|
||||
- linux,code = <BTN_0>;
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
gpios = <&pio 0 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
@@ -58,19 +62,25 @@
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
- led-0 {
|
||||
- label = "bpi-r64:pio:green";
|
||||
- color = <LED_COLOR_ID_GREEN>;
|
||||
- gpios = <&pio 89 GPIO_ACTIVE_HIGH>;
|
||||
+ led_system_blue: blue {
|
||||
+ label = "bpi-r64:pio:blue";
|
||||
+ gpios = <&pio 85 GPIO_ACTIVE_HIGH>;
|
||||
default-state = "off";
|
||||
};
|
||||
|
||||
- led-1 {
|
||||
- label = "bpi-r64:pio:red";
|
||||
- color = <LED_COLOR_ID_RED>;
|
||||
- gpios = <&pio 88 GPIO_ACTIVE_HIGH>;
|
||||
+ led_system_green: green {
|
||||
+ label = "bpi-r64:pio:green";
|
||||
+ gpios = <&pio 89 GPIO_ACTIVE_HIGH>;
|
||||
default-state = "off";
|
||||
};
|
||||
+
|
||||
+/*
|
||||
+ * red {
|
||||
+ * label = "bpi-r64:pio:red";
|
||||
+ * gpios = <&pio 88 GPIO_ACTIVE_HIGH>;
|
||||
+ * default-state = "off";
|
||||
+ * };
|
||||
+ */
|
||||
};
|
||||
|
||||
memory {
|
|
@ -0,0 +1,21 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -564,12 +564,16 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&rtc {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
&sata {
|
||||
- status = "disable";
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
&sata_phy {
|
||||
- status = "disable";
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
&spi0 {
|
|
@ -0,0 +1,50 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -259,14 +259,42 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
-&nor_flash {
|
||||
- pinctrl-names = "default";
|
||||
- pinctrl-0 = <&spi_nor_pins>;
|
||||
- status = "disabled";
|
||||
+&bch {
|
||||
+ status = "okay";
|
||||
+};
|
||||
|
||||
+&snfi {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&serial_nand_pins>;
|
||||
+ status = "okay";
|
||||
flash@0 {
|
||||
- compatible = "jedec,spi-nor";
|
||||
+ compatible = "spi-nand";
|
||||
reg = <0>;
|
||||
+ spi-tx-bus-width = <4>;
|
||||
+ spi-rx-bus-width = <4>;
|
||||
+ nand-ecc-engine = <&snfi>;
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x80000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ partition@80000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x80000 0x200000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ partition@280000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x280000 0x7d80000>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -714,7 +714,7 @@ static int spinand_mtd_write(struct mtd_
|
||||
static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos)
|
||||
{
|
||||
struct spinand_device *spinand = nand_to_spinand(nand);
|
||||
- u8 marker[2] = { };
|
||||
+ u8 marker[1] = { };
|
||||
struct nand_page_io_req req = {
|
||||
.pos = *pos,
|
||||
.ooblen = sizeof(marker),
|
||||
@@ -725,7 +725,7 @@ static bool spinand_isbad(struct nand_de
|
||||
|
||||
spinand_select_target(spinand, pos->target);
|
||||
spinand_read_page(spinand, &req);
|
||||
- if (marker[0] != 0xff || marker[1] != 0xff)
|
||||
+ if (marker[0] != 0xff)
|
||||
return true;
|
||||
|
||||
return false;
|
|
@ -0,0 +1,94 @@
|
|||
From c813fbe806257c574240770ef716fbee19f7dbfa Mon Sep 17 00:00:00 2001
|
||||
From: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
Date: Thu, 6 Jun 2019 16:29:04 +0800
|
||||
Subject: [PATCH] spi: spi-mem: Mediatek: Add SPI Nand support for MT7629
|
||||
|
||||
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
---
|
||||
arch/arm/boot/dts/mt7629-rfb.dts | 45 ++++++++++++++++++++++++++++++++
|
||||
arch/arm/boot/dts/mt7629.dtsi | 22 ++++++++++++++++
|
||||
3 files changed, 79 insertions(+)
|
||||
|
||||
--- a/arch/arm/boot/dts/mt7629.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7629.dtsi
|
||||
@@ -272,6 +272,27 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ snfi: spi@1100d000 {
|
||||
+ compatible = "mediatek,mt7629-snand";
|
||||
+ reg = <0x1100d000 0x1000>;
|
||||
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>, <&pericfg CLK_PERI_SNFI_PD>;
|
||||
+ clock-names = "nfi_clk", "pad_clk";
|
||||
+ nand-ecc-engine = <&bch>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ bch: ecc@1100e000 {
|
||||
+ compatible = "mediatek,mt7622-ecc";
|
||||
+ reg = <0x1100e000 0x1000>;
|
||||
+ interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfiecc_clk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
spi: spi@1100a000 {
|
||||
compatible = "mediatek,mt7629-spi",
|
||||
"mediatek,mt7622-spi";
|
||||
--- a/arch/arm/boot/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/boot/dts/mt7629-rfb.dts
|
||||
@@ -254,6 +254,50 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&bch {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&snfi {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&serial_nand_pins>;
|
||||
+ status = "okay";
|
||||
+ flash@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-tx-bus-width = <4>;
|
||||
+ spi-rx-bus-width = <4>;
|
||||
+ nand-ecc-engine = <&snfi>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "Bootloader";
|
||||
+ reg = <0x00000 0x0100000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "Config";
|
||||
+ reg = <0x100000 0x0040000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@140000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x140000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@1c0000 {
|
||||
+ label = "firmware";
|
||||
+ reg = <0x1c0000 0x1000000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&spi {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&spi_pins>;
|
|
@ -0,0 +1,68 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
@@ -539,6 +539,65 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+&bch {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&snfi {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&serial_nand_pins>;
|
||||
+ status = "okay";
|
||||
+ flash@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-tx-bus-width = <4>;
|
||||
+ spi-rx-bus-width = <4>;
|
||||
+ nand-ecc-engine = <&snfi>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "Preloader";
|
||||
+ reg = <0x00000 0x0080000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ partition@80000 {
|
||||
+ label = "ATF";
|
||||
+ reg = <0x80000 0x0040000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@c0000 {
|
||||
+ label = "Bootloader";
|
||||
+ reg = <0xc0000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@140000 {
|
||||
+ label = "Config";
|
||||
+ reg = <0x140000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@1c0000 {
|
||||
+ label = "Factory";
|
||||
+ reg = <0x1c0000 0x0100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@200000 {
|
||||
+ label = "firmware";
|
||||
+ reg = <0x2c0000 0x2000000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@2200000 {
|
||||
+ label = "User_data";
|
||||
+ reg = <0x22c0000 0x4000000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&spi0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&spic0_pins>;
|
|
@ -0,0 +1,18 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
@@ -580,7 +580,7 @@
|
||||
reg = <0x140000 0x0080000>;
|
||||
};
|
||||
|
||||
- partition@1c0000 {
|
||||
+ factory: partition@1c0000 {
|
||||
label = "Factory";
|
||||
reg = <0x1c0000 0x0100000>;
|
||||
};
|
||||
@@ -641,5 +641,6 @@
|
||||
&wmac {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&wmac_pins>;
|
||||
+ mediatek,mtd-eeprom = <&factory 0x0000>;
|
||||
status = "okay";
|
||||
};
|
|
@ -0,0 +1,24 @@
|
|||
--- a/arch/arm/boot/dts/mt7623.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7623.dtsi
|
||||
@@ -951,17 +951,15 @@
|
||||
};
|
||||
|
||||
crypto: crypto@1b240000 {
|
||||
- compatible = "mediatek,eip97-crypto";
|
||||
+ compatible = "inside-secure,safexcel-eip97";
|
||||
reg = <0 0x1b240000 0 0x20000>;
|
||||
interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_LOW>,
|
||||
<GIC_SPI 83 IRQ_TYPE_LEVEL_LOW>,
|
||||
<GIC_SPI 84 IRQ_TYPE_LEVEL_LOW>,
|
||||
- <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>,
|
||||
- <GIC_SPI 97 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupt-names = "ring0", "ring1", "ring2", "ring3";
|
||||
clocks = <ðsys CLK_ETHSYS_CRYPTO>;
|
||||
- clock-names = "cryp";
|
||||
- power-domains = <&scpsys MT2701_POWER_DOMAIN_ETH>;
|
||||
- status = "disabled";
|
||||
+ status = "okay";
|
||||
};
|
||||
|
||||
bdpsys: syscon@1c000000 {
|
|
@ -0,0 +1,11 @@
|
|||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial2:115200n8";
|
||||
- bootargs = "console=ttyS2,115200n8 console=tty1";
|
||||
+ bootargs = "earlycon=uart8250,mmio32,0x11004000 console=ttyS2,115200n8 console=tty1";
|
||||
};
|
||||
|
||||
connector {
|
|
@ -0,0 +1,11 @@
|
|||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
aliases {
|
||||
serial2 = &uart2;
|
||||
+ mmc0 = &mmc0;
|
||||
+ mmc1 = &mmc1;
|
||||
};
|
||||
|
||||
chosen {
|
|
@ -0,0 +1,29 @@
|
|||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -17,6 +17,10 @@
|
||||
serial2 = &uart2;
|
||||
mmc0 = &mmc0;
|
||||
mmc1 = &mmc1;
|
||||
+ led-boot = &led_system_green;
|
||||
+ led-failsafe = &led_system_blue;
|
||||
+ led-running = &led_system_green;
|
||||
+ led-upgrade = &led_system_blue;
|
||||
};
|
||||
|
||||
chosen {
|
||||
@@ -112,13 +116,13 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&led_pins_a>;
|
||||
|
||||
- blue {
|
||||
+ led_system_blue: blue {
|
||||
label = "bpi-r2:pio:blue";
|
||||
gpios = <&pio 240 GPIO_ACTIVE_LOW>;
|
||||
default-state = "off";
|
||||
};
|
||||
|
||||
- green {
|
||||
+ led_system_green: green {
|
||||
label = "bpi-r2:pio:green";
|
||||
gpios = <&pio 241 GPIO_ACTIVE_LOW>;
|
||||
default-state = "off";
|
|
@ -0,0 +1,10 @@
|
|||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
aliases {
|
||||
serial2 = &uart2;
|
||||
+ ethernet0 = &gmac0;
|
||||
mmc0 = &mmc0;
|
||||
mmc1 = &mmc1;
|
||||
led-boot = &led_system_green;
|
|
@ -0,0 +1,69 @@
|
|||
From 21d106f15262f5a2ef7531636e0703ee61c33c61 Mon Sep 17 00:00:00 2001
|
||||
From: Sungbo Eo <mans0n@gorani.run>
|
||||
Date: Sun, 8 Aug 2021 21:38:40 +0900
|
||||
Subject: [PATCH 2/2] arm: dts: mt7623: add musb device nodes
|
||||
|
||||
MT7623 has an musb controller that is compatible with the one from MT2701.
|
||||
|
||||
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
|
||||
---
|
||||
arch/arm/boot/dts/mt7623.dtsi | 34 ++++++++++++++++++++++++++++++++++
|
||||
arch/arm/boot/dts/mt7623a.dtsi | 4 ++++
|
||||
2 files changed, 38 insertions(+)
|
||||
|
||||
--- a/arch/arm/boot/dts/mt7623.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7623.dtsi
|
||||
@@ -585,6 +585,40 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ usb0: usb@11200000 {
|
||||
+ compatible = "mediatek,mt7623-musb",
|
||||
+ "mediatek,mtk-musb";
|
||||
+ reg = <0 0x11200000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupt-names = "mc";
|
||||
+ phys = <&u2port2 PHY_TYPE_USB2>;
|
||||
+ dr_mode = "otg";
|
||||
+ clocks = <&pericfg CLK_PERI_USB0>,
|
||||
+ <&pericfg CLK_PERI_USB0_MCU>,
|
||||
+ <&pericfg CLK_PERI_USB_SLV>;
|
||||
+ clock-names = "main","mcu","univpll";
|
||||
+ power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ u2phy1: t-phy@11210000 {
|
||||
+ compatible = "mediatek,mt7623-tphy",
|
||||
+ "mediatek,generic-tphy-v1";
|
||||
+ reg = <0 0x11210000 0 0x0800>;
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ u2port2: usb-phy@11210800 {
|
||||
+ reg = <0 0x11210800 0 0x0100>;
|
||||
+ clocks = <&topckgen CLK_TOP_USB_PHY48M>;
|
||||
+ clock-names = "ref";
|
||||
+ #phy-cells = <1>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
audsys: clock-controller@11220000 {
|
||||
compatible = "mediatek,mt7623-audsys",
|
||||
"mediatek,mt2701-audsys",
|
||||
--- a/arch/arm/boot/dts/mt7623a.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7623a.dtsi
|
||||
@@ -35,6 +35,10 @@
|
||||
clock-names = "ethif";
|
||||
};
|
||||
|
||||
+&usb0 {
|
||||
+ power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
|
||||
+};
|
||||
+
|
||||
&usb1 {
|
||||
power-domains = <&scpsys MT7623A_POWER_DOMAIN_HIF>;
|
||||
};
|
|
@ -0,0 +1,13 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -160,6 +160,10 @@
|
||||
switch@0 {
|
||||
compatible = "mediatek,mt7531";
|
||||
reg = <0>;
|
||||
+ interrupt-controller;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-parent = <&pio>;
|
||||
+ interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reset-gpios = <&pio 54 0>;
|
||||
|
||||
ports {
|
|
@ -0,0 +1,106 @@
|
|||
From patchwork Tue Apr 26 19:51:36 2022
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org>
|
||||
X-Patchwork-Id: 12827872
|
||||
Return-Path:
|
||||
<linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org>
|
||||
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
|
||||
aws-us-west-2-korg-lkml-1.web.codeaurora.org
|
||||
Received: from bombadil.infradead.org (bombadil.infradead.org
|
||||
[198.137.202.133])
|
||||
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
|
||||
(No client certificate requested)
|
||||
by smtp.lore.kernel.org (Postfix) with ESMTPS id BACF3C433EF
|
||||
for <linux-arm-kernel@archiver.kernel.org>;
|
||||
Tue, 26 Apr 2022 19:53:05 +0000 (UTC)
|
||||
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
|
||||
d=lists.infradead.org; s=bombadil.20210309; h=Sender:
|
||||
Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:
|
||||
List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To:
|
||||
From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:
|
||||
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:
|
||||
List-Owner; bh=OWGSxvlKoyPWz6b629RNINucULo6oOdFssAIiJETWRg=; b=T0HEjee0FX3hlb
|
||||
x5jl7xLK5sKM0pkE2oRgwzthbFlNg8ST1j/2GkgcgT0S2Bi0vRfFxHeu/RKzS9RmiVnKJnPGL8ctg
|
||||
WoBLyO5i+NcmosGoy6MmoOjGTNhj/+3q3Z1jRLBSJ4ySSP22X77YeuJTmVzySPUllQhWvDhjMVCR9
|
||||
QBRmQdc6gCAg3IYGEbWwS2TG+UHveDCeZRWxMzrwI8UPadNCRFROwugmiQ3mdU41lHCTDpnlfuRJh
|
||||
o1igLKfMBLz+D8rFYvDh7FfkcKkY6lNoswA2HKUun1MEzgoyQKmITPnG2maX/BvJJuj/B3ZJShh4k
|
||||
AZHmXoQxq1mrsm2FxfnQ==;
|
||||
Received: from localhost ([::1] helo=bombadil.infradead.org)
|
||||
by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux))
|
||||
id 1njRE5-00G05D-9z; Tue, 26 Apr 2022 19:51:57 +0000
|
||||
Received: from fudo.makrotopia.org ([2a07:2ec0:3002::71])
|
||||
by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux))
|
||||
id 1njRE1-00G03h-9H; Tue, 26 Apr 2022 19:51:55 +0000
|
||||
Received: from local
|
||||
by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256)
|
||||
(Exim 4.94.2) (envelope-from <daniel@makrotopia.org>)
|
||||
id 1njRDu-0006aF-4F; Tue, 26 Apr 2022 21:51:46 +0200
|
||||
Date: Tue, 26 Apr 2022 20:51:36 +0100
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
To: devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org,
|
||||
linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
|
||||
Cc: Rob Herring <robh+dt@kernel.org>,
|
||||
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
|
||||
Matthias Brugger <matthias.bgg@gmail.com>
|
||||
Subject: [PATCH] arm64: dts: mediatek: mt7622: fix GICv2 range
|
||||
Message-ID: <YmhNSLgp/yg8Vr1F@makrotopia.org>
|
||||
MIME-Version: 1.0
|
||||
Content-Disposition: inline
|
||||
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
|
||||
X-CRM114-CacheID: sfid-20220426_125153_359242_EA3D452C
|
||||
X-CRM114-Status: GOOD ( 12.45 )
|
||||
X-BeenThere: linux-arm-kernel@lists.infradead.org
|
||||
X-Mailman-Version: 2.1.34
|
||||
Precedence: list
|
||||
List-Id: <linux-arm-kernel.lists.infradead.org>
|
||||
List-Unsubscribe:
|
||||
<http://lists.infradead.org/mailman/options/linux-arm-kernel>,
|
||||
<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>
|
||||
List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/>
|
||||
List-Post: <mailto:linux-arm-kernel@lists.infradead.org>
|
||||
List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>
|
||||
List-Subscribe:
|
||||
<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,
|
||||
<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>
|
||||
Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org>
|
||||
Errors-To:
|
||||
linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org
|
||||
|
||||
With the current range specified for the CPU interface there is an
|
||||
error message at boot:
|
||||
|
||||
GIC: GICv2 detected, but range too small and irqchip.gicv2_force_probe not set
|
||||
|
||||
Setting irqchip.gicv2_force_probe=1 in bootargs results in:
|
||||
|
||||
GIC: Aliased GICv2 at 0x0000000010320000, trying to find the canonical range over 128kB
|
||||
GIC: Adjusting CPU interface base to 0x000000001032f000
|
||||
GIC: Using split EOI/Deactivate mode
|
||||
|
||||
Using the adjusted CPU interface base and 8K size results in only the
|
||||
final line remaining and fully working system as well as /proc/interrupts
|
||||
showing additional IPI3,4,5,6:
|
||||
|
||||
IPI3: 0 0 CPU stop (for crash dump) interrupts
|
||||
IPI4: 0 0 Timer broadcast interrupts
|
||||
IPI5: 0 0 IRQ work interrupts
|
||||
IPI6: 0 0 CPU wake-up interrupts
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -339,7 +339,7 @@
|
||||
#interrupt-cells = <3>;
|
||||
interrupt-parent = <&gic>;
|
||||
reg = <0 0x10310000 0 0x1000>,
|
||||
- <0 0x10320000 0 0x1000>,
|
||||
+ <0 0x1032f000 0 0x2000>,
|
||||
<0 0x10340000 0 0x2000>,
|
||||
<0 0x10360000 0 0x2000>;
|
||||
};
|
|
@ -0,0 +1,48 @@
|
|||
From 824d56e753a588fcfd650db1822e34a02a48bb77 Mon Sep 17 00:00:00 2001
|
||||
From: Bruno Umuarama <anonimou_eu@hotmail.com>
|
||||
Date: Thu, 13 Oct 2022 21:18:21 +0000
|
||||
Subject: [PATCH] mediatek: mt7623: fix thermal zone
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Raising the temperatures for passive and active trips. @VA1DER
|
||||
proposed at issue 9396 to remove passive trip. This commit relates to
|
||||
his suggestion.
|
||||
|
||||
Without this patch. the CPU will be throttled all the way down to 98MHz
|
||||
if the temperature rises even a degree above the trip point, and it was
|
||||
further discovered that if the internal temperature of the device is
|
||||
above the first trip point temperature when it boots then it will start
|
||||
in a throttled state and even
|
||||
$ echo disabled > /sys/class/thermal/thermal_zone0/mode
|
||||
will have no effect.
|
||||
|
||||
The patch increases the passive trip point and active cooling map. The
|
||||
throttling temperature will then be at 77°C and 82°C, which is still a
|
||||
low enough temperature for ARM devices to not be in the real danger
|
||||
zone, and gives some operational headroom.
|
||||
|
||||
Signed-off-by: Bruno Umuarama <anonimou_eu@hotmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/mt7623.dtsi | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/arch/arm/boot/dts/mt7623.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7623.dtsi
|
||||
@@ -160,13 +160,13 @@
|
||||
|
||||
trips {
|
||||
cpu_passive: cpu-passive {
|
||||
- temperature = <57000>;
|
||||
+ temperature = <77000>;
|
||||
hysteresis = <2000>;
|
||||
type = "passive";
|
||||
};
|
||||
|
||||
cpu_active: cpu-active {
|
||||
- temperature = <67000>;
|
||||
+ temperature = <82000>;
|
||||
hysteresis = <2000>;
|
||||
type = "active";
|
||||
};
|
|
@ -0,0 +1,66 @@
|
|||
From 28f9a5e2a3f5441ab5594669ed82da11e32277a9 Mon Sep 17 00:00:00 2001
|
||||
From: Kristian Evensen <kristian.evensen@gmail.com>
|
||||
Date: Mon, 30 Apr 2018 14:38:01 +0200
|
||||
Subject: [PATCH] phy: phy-mtk-tphy: Add hifsys-support
|
||||
|
||||
---
|
||||
drivers/phy/mediatek/phy-mtk-tphy.c | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
|
||||
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
+#include <linux/mfd/syscon.h>
|
||||
+#include <linux/regmap.h>
|
||||
|
||||
#include "phy-mtk-io.h"
|
||||
|
||||
@@ -264,6 +266,9 @@
|
||||
|
||||
#define TPHY_CLKS_CNT 2
|
||||
|
||||
+#define HIF_SYSCFG1 0x14
|
||||
+#define HIF_SYSCFG1_PHY2_MASK (0x3 << 20)
|
||||
+
|
||||
enum mtk_phy_version {
|
||||
MTK_PHY_V1 = 1,
|
||||
MTK_PHY_V2,
|
||||
@@ -331,6 +336,7 @@ struct mtk_tphy {
|
||||
void __iomem *sif_base; /* only shared sif */
|
||||
const struct mtk_phy_pdata *pdata;
|
||||
struct mtk_phy_instance **phys;
|
||||
+ struct regmap *hif;
|
||||
int nphys;
|
||||
int src_ref_clk; /* MHZ, reference clock for slew rate calibrate */
|
||||
int src_coef; /* coefficient for slew rate calibrate */
|
||||
@@ -596,6 +602,10 @@ static void pcie_phy_instance_init(struc
|
||||
if (tphy->pdata->version != MTK_PHY_V1)
|
||||
return;
|
||||
|
||||
+ if (tphy->hif)
|
||||
+ regmap_update_bits(tphy->hif, HIF_SYSCFG1,
|
||||
+ HIF_SYSCFG1_PHY2_MASK, 0);
|
||||
+
|
||||
mtk_phy_update_bits(phya + U3P_U3_PHYA_DA_REG0,
|
||||
P3A_RG_XTAL_EXT_PE1H | P3A_RG_XTAL_EXT_PE2H,
|
||||
FIELD_PREP(P3A_RG_XTAL_EXT_PE1H, 0x2) |
|
||||
@@ -1241,6 +1251,16 @@ static int mtk_tphy_probe(struct platfor
|
||||
&tphy->src_coef);
|
||||
}
|
||||
|
||||
+ if (of_find_property(np, "mediatek,phy-switch", NULL)) {
|
||||
+ tphy->hif = syscon_regmap_lookup_by_phandle(np,
|
||||
+ "mediatek,phy-switch");
|
||||
+ if (IS_ERR(tphy->hif)) {
|
||||
+ dev_err(&pdev->dev,
|
||||
+ "missing \"mediatek,phy-switch\" phandle\n");
|
||||
+ return PTR_ERR(tphy->hif);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
port = 0;
|
||||
for_each_child_of_node(np, child_np) {
|
||||
struct mtk_phy_instance *instance;
|
|
@ -0,0 +1,44 @@
|
|||
From 1a7963e9843f6f1e4b02a30926d20b314c03e4df Mon Sep 17 00:00:00 2001
|
||||
From: Sam Shih <sam.shih@mediatek.com>
|
||||
Date: Sat, 25 Jun 2022 02:10:13 +0800
|
||||
Subject: [PATCH] mmc: mediatek: add support for MT7986 SoC
|
||||
|
||||
Adding mt7986 own characteristics and of_device_id to have support
|
||||
of MT7986 SoC.
|
||||
|
||||
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
|
||||
Change-Id: I07cf8406cbe8c1a7114b304f35fc3e689e512e5a
|
||||
---
|
||||
drivers/mmc/host/mtk-sd.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
--- a/drivers/mmc/host/mtk-sd.c
|
||||
+++ b/drivers/mmc/host/mtk-sd.c
|
||||
@@ -591,6 +591,19 @@ static const struct mtk_mmc_compatible m
|
||||
.support_64g = true,
|
||||
};
|
||||
|
||||
+static const struct mtk_mmc_compatible mt7986_compat = {
|
||||
+ .clk_div_bits = 12,
|
||||
+ .recheck_sdio_irq = true,
|
||||
+ .hs400_tune = false,
|
||||
+ .pad_tune_reg = MSDC_PAD_TUNE0,
|
||||
+ .async_fifo = true,
|
||||
+ .data_tune = true,
|
||||
+ .busy_check = true,
|
||||
+ .stop_clk_fix = true,
|
||||
+ .enhance_rx = true,
|
||||
+ .support_64g = true,
|
||||
+};
|
||||
+
|
||||
static const struct mtk_mmc_compatible mt8516_compat = {
|
||||
.clk_div_bits = 12,
|
||||
.recheck_sdio_irq = true,
|
||||
@@ -609,6 +622,7 @@ static const struct of_device_id msdc_of
|
||||
{ .compatible = "mediatek,mt6795-mmc", .data = &mt6795_compat},
|
||||
{ .compatible = "mediatek,mt7620-mmc", .data = &mt7620_compat},
|
||||
{ .compatible = "mediatek,mt7622-mmc", .data = &mt7622_compat},
|
||||
+ { .compatible = "mediatek,mt7986-mmc", .data = &mt7986_compat},
|
||||
{ .compatible = "mediatek,mt8135-mmc", .data = &mt8135_compat},
|
||||
{ .compatible = "mediatek,mt8173-mmc", .data = &mt8173_compat},
|
||||
{ .compatible = "mediatek,mt8183-mmc", .data = &mt8183_compat},
|
|
@ -0,0 +1,34 @@
|
|||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <linux/string.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/spi/spi-mem.h>
|
||||
+#include <linux/mtd/mtk_bmt.h>
|
||||
|
||||
static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
|
||||
{
|
||||
@@ -1333,6 +1334,7 @@ static int spinand_probe(struct spi_mem
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ mtk_bmt_attach(mtd);
|
||||
ret = mtd_device_register(mtd, NULL, 0);
|
||||
if (ret)
|
||||
goto err_spinand_cleanup;
|
||||
@@ -1340,6 +1342,7 @@ static int spinand_probe(struct spi_mem
|
||||
return 0;
|
||||
|
||||
err_spinand_cleanup:
|
||||
+ mtk_bmt_detach(mtd);
|
||||
spinand_cleanup(spinand);
|
||||
|
||||
return ret;
|
||||
@@ -1358,6 +1361,7 @@ static int spinand_remove(struct spi_mem
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ mtk_bmt_detach(mtd);
|
||||
spinand_cleanup(spinand);
|
||||
|
||||
return 0;
|
|
@ -0,0 +1,10 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
@@ -553,6 +553,7 @@
|
||||
spi-tx-bus-width = <4>;
|
||||
spi-rx-bus-width = <4>;
|
||||
nand-ecc-engine = <&snfi>;
|
||||
+ mediatek,bmt-v2;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
|
@ -0,0 +1,122 @@
|
|||
From 5f49a5c9b16330e0df8f639310e4715dcad71947 Mon Sep 17 00:00:00 2001
|
||||
From: Davide Fioravanti <pantanastyle@gmail.com>
|
||||
Date: Fri, 8 Jan 2021 15:35:24 +0100
|
||||
Subject: [PATCH] mtd: spinand: Add support for the Fidelix FM35X1GA
|
||||
|
||||
Datasheet: http://www.hobos.com.cn/upload/datasheet/DS35X1GAXXX_100_rev00.pdf
|
||||
|
||||
Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
|
||||
---
|
||||
drivers/mtd/nand/spi/Makefile | 2 +-
|
||||
drivers/mtd/nand/spi/core.c | 1 +
|
||||
drivers/mtd/nand/spi/fidelix.c | 76 ++++++++++++++++++++++++++++++++++
|
||||
include/linux/mtd/spinand.h | 1 +
|
||||
4 files changed, 79 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/mtd/nand/spi/fidelix.c
|
||||
|
||||
--- a/drivers/mtd/nand/spi/Makefile
|
||||
+++ b/drivers/mtd/nand/spi/Makefile
|
||||
@@ -1,3 +1,3 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
-spinand-objs := core.o ato.o esmt.o etron.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o xtx.o
|
||||
+spinand-objs := core.o ato.o esmt.o etron.o fidelix.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o xtx.o
|
||||
obj-$(CONFIG_MTD_SPI_NAND) += spinand.o
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -940,6 +940,7 @@ static const struct nand_ops spinand_ops
|
||||
static const struct spinand_manufacturer *spinand_manufacturers[] = {
|
||||
&ato_spinand_manufacturer,
|
||||
&esmt_c8_spinand_manufacturer,
|
||||
+ &fidelix_spinand_manufacturer,
|
||||
&etron_spinand_manufacturer,
|
||||
&gigadevice_spinand_manufacturer,
|
||||
¯onix_spinand_manufacturer,
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nand/spi/fidelix.c
|
||||
@@ -0,0 +1,76 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2020 Davide Fioravanti <pantanastyle@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/mtd/spinand.h>
|
||||
+
|
||||
+#define SPINAND_MFR_FIDELIX 0xE5
|
||||
+#define FIDELIX_ECCSR_MASK 0x0F
|
||||
+
|
||||
+static SPINAND_OP_VARIANTS(read_cache_variants,
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
|
||||
+
|
||||
+static SPINAND_OP_VARIANTS(write_cache_variants,
|
||||
+ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
|
||||
+ SPINAND_PROG_LOAD(true, 0, NULL, 0));
|
||||
+
|
||||
+static SPINAND_OP_VARIANTS(update_cache_variants,
|
||||
+ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
|
||||
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
|
||||
+
|
||||
+static int fm35x1ga_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||
+ struct mtd_oob_region *region)
|
||||
+{
|
||||
+ if (section > 3)
|
||||
+ return -ERANGE;
|
||||
+
|
||||
+ region->offset = (16 * section) + 8;
|
||||
+ region->length = 8;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int fm35x1ga_ooblayout_free(struct mtd_info *mtd, int section,
|
||||
+ struct mtd_oob_region *region)
|
||||
+{
|
||||
+ if (section > 3)
|
||||
+ return -ERANGE;
|
||||
+
|
||||
+ region->offset = (16 * section) + 2;
|
||||
+ region->length = 6;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct mtd_ooblayout_ops fm35x1ga_ooblayout = {
|
||||
+ .ecc = fm35x1ga_ooblayout_ecc,
|
||||
+ .free = fm35x1ga_ooblayout_free,
|
||||
+};
|
||||
+
|
||||
+static const struct spinand_info fidelix_spinand_table[] = {
|
||||
+ SPINAND_INFO("FM35X1GA",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x71),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&fm35x1ga_ooblayout, NULL)),
|
||||
+};
|
||||
+
|
||||
+static const struct spinand_manufacturer_ops fidelix_spinand_manuf_ops = {
|
||||
+};
|
||||
+
|
||||
+const struct spinand_manufacturer fidelix_spinand_manufacturer = {
|
||||
+ .id = SPINAND_MFR_FIDELIX,
|
||||
+ .name = "Fidelix",
|
||||
+ .chips = fidelix_spinand_table,
|
||||
+ .nchips = ARRAY_SIZE(fidelix_spinand_table),
|
||||
+ .ops = &fidelix_spinand_manuf_ops,
|
||||
+};
|
||||
--- a/include/linux/mtd/spinand.h
|
||||
+++ b/include/linux/mtd/spinand.h
|
||||
@@ -263,6 +263,7 @@ struct spinand_manufacturer {
|
||||
extern const struct spinand_manufacturer ato_spinand_manufacturer;
|
||||
extern const struct spinand_manufacturer esmt_c8_spinand_manufacturer;
|
||||
extern const struct spinand_manufacturer etron_spinand_manufacturer;
|
||||
+extern const struct spinand_manufacturer fidelix_spinand_manufacturer;
|
||||
extern const struct spinand_manufacturer gigadevice_spinand_manufacturer;
|
||||
extern const struct spinand_manufacturer macronix_spinand_manufacturer;
|
||||
extern const struct spinand_manufacturer micron_spinand_manufacturer;
|
|
@ -0,0 +1,27 @@
|
|||
--- a/drivers/crypto/inside-secure/safexcel.c
|
||||
+++ b/drivers/crypto/inside-secure/safexcel.c
|
||||
@@ -600,6 +600,14 @@ static int safexcel_hw_init(struct safex
|
||||
val |= EIP197_MST_CTRL_TX_MAX_CMD(5);
|
||||
writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
|
||||
}
|
||||
+ /*
|
||||
+ * Set maximum number of TX commands to 2^4 = 16 for EIP97 HW2.1/HW2.3
|
||||
+ */
|
||||
+ else {
|
||||
+ val = 0;
|
||||
+ val |= EIP97_MST_CTRL_TX_MAX_CMD(4);
|
||||
+ writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
|
||||
+ }
|
||||
|
||||
/* Configure wr/rd cache values */
|
||||
writel(EIP197_MST_CTRL_RD_CACHE(RD_CACHE_4BITS) |
|
||||
--- a/drivers/crypto/inside-secure/safexcel.h
|
||||
+++ b/drivers/crypto/inside-secure/safexcel.h
|
||||
@@ -315,6 +315,7 @@
|
||||
#define EIP197_MST_CTRL_RD_CACHE(n) (((n) & 0xf) << 0)
|
||||
#define EIP197_MST_CTRL_WD_CACHE(n) (((n) & 0xf) << 4)
|
||||
#define EIP197_MST_CTRL_TX_MAX_CMD(n) (((n) & 0xf) << 20)
|
||||
+#define EIP97_MST_CTRL_TX_MAX_CMD(n) (((n) & 0xf) << 4)
|
||||
#define EIP197_MST_CTRL_BYTE_SWAP BIT(24)
|
||||
#define EIP197_MST_CTRL_NO_BYTE_SWAP BIT(25)
|
||||
#define EIP197_MST_CTRL_BYTE_SWAP_BITS GENMASK(25, 24)
|
|
@ -0,0 +1,26 @@
|
|||
--- a/drivers/crypto/inside-secure/safexcel.h
|
||||
+++ b/drivers/crypto/inside-secure/safexcel.h
|
||||
@@ -737,6 +737,9 @@ enum safexcel_eip_version {
|
||||
/* Priority we use for advertising our algorithms */
|
||||
#define SAFEXCEL_CRA_PRIORITY 300
|
||||
|
||||
+/* System cache line size */
|
||||
+#define SYSTEM_CACHELINE_SIZE 64
|
||||
+
|
||||
/* SM3 digest result for zero length message */
|
||||
#define EIP197_SM3_ZEROM_HASH "\x1A\xB2\x1D\x83\x55\xCF\xA1\x7F" \
|
||||
"\x8E\x61\x19\x48\x31\xE8\x1A\x8F" \
|
||||
--- a/drivers/crypto/inside-secure/safexcel_hash.c
|
||||
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
|
||||
@@ -55,9 +55,9 @@ struct safexcel_ahash_req {
|
||||
u8 block_sz; /* block size, only set once */
|
||||
u8 digest_sz; /* output digest size, only set once */
|
||||
__le32 state[SHA3_512_BLOCK_SIZE /
|
||||
- sizeof(__le32)] __aligned(sizeof(__le32));
|
||||
+ sizeof(__le32)] __aligned(SYSTEM_CACHELINE_SIZE);
|
||||
|
||||
- u64 len;
|
||||
+ u64 len __aligned(SYSTEM_CACHELINE_SIZE);
|
||||
u64 processed;
|
||||
|
||||
u8 cache[HASH_CACHE_SIZE] __aligned(sizeof(u32));
|
|
@ -0,0 +1,41 @@
|
|||
From f6ba5e17bee38f8ffe118c47fbfef3cf90eb87ff Mon Sep 17 00:00:00 2001
|
||||
From: "Mingming.Su" <Mingming.Su@mediatek.com>
|
||||
Date: Wed, 30 Jun 2021 16:59:32 +0800
|
||||
Subject: [PATCH] mt7986: trng: add rng support
|
||||
|
||||
1. Add trng compatible name for MT7986
|
||||
2. Fix mtk_rng_wait_ready() function
|
||||
|
||||
Signed-off-by: Mingming.Su <Mingming.Su@mediatek.com>
|
||||
---
|
||||
drivers/char/hw_random/mtk-rng.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/char/hw_random/mtk-rng.c
|
||||
+++ b/drivers/char/hw_random/mtk-rng.c
|
||||
@@ -22,7 +22,7 @@
|
||||
#define RNG_AUTOSUSPEND_TIMEOUT 100
|
||||
|
||||
#define USEC_POLL 2
|
||||
-#define TIMEOUT_POLL 20
|
||||
+#define TIMEOUT_POLL 60
|
||||
|
||||
#define RNG_CTRL 0x00
|
||||
#define RNG_EN BIT(0)
|
||||
@@ -77,7 +77,7 @@ static bool mtk_rng_wait_ready(struct hw
|
||||
readl_poll_timeout_atomic(priv->base + RNG_CTRL, ready,
|
||||
ready & RNG_READY, USEC_POLL,
|
||||
TIMEOUT_POLL);
|
||||
- return !!ready;
|
||||
+ return !!(ready & RNG_READY);
|
||||
}
|
||||
|
||||
static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
|
||||
@@ -179,6 +179,7 @@ static const struct dev_pm_ops mtk_rng_p
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
static const struct of_device_id mtk_rng_match[] = {
|
||||
+ { .compatible = "mediatek,mt7986-rng" },
|
||||
{ .compatible = "mediatek,mt7623-rng" },
|
||||
{},
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
--- a/drivers/tty/serial/8250/8250.h
|
||||
+++ b/drivers/tty/serial/8250/8250.h
|
||||
@@ -85,6 +85,7 @@ struct serial8250_config {
|
||||
#define UART_CAP_MINI BIT(17) /* Mini UART on BCM283X family lacks:
|
||||
* STOP PARITY EPAR SPAR WLEN5 WLEN6
|
||||
*/
|
||||
+#define UART_CAP_NMOD (1 << 18) /* UART doesn't do termios */
|
||||
#define UART_CAP_NOTEMT BIT(18) /* UART without interrupt on TEMT available */
|
||||
|
||||
#define UART_BUG_QUOT BIT(0) /* UART has buggy quot LSB */
|
||||
--- a/drivers/tty/serial/8250/8250_port.c
|
||||
+++ b/drivers/tty/serial/8250/8250_port.c
|
||||
@@ -286,7 +286,7 @@ static const struct serial8250_config ua
|
||||
.tx_loadsz = 16,
|
||||
.fcr = UART_FCR_ENABLE_FIFO |
|
||||
UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
|
||||
- .flags = UART_CAP_FIFO,
|
||||
+ .flags = UART_CAP_FIFO | UART_CAP_NMOD,
|
||||
},
|
||||
[PORT_NPCM] = {
|
||||
.name = "Nuvoton 16550",
|
||||
@@ -2754,6 +2754,11 @@ serial8250_do_set_termios(struct uart_po
|
||||
unsigned long flags;
|
||||
unsigned int baud, quot, frac = 0;
|
||||
|
||||
+ if (up->capabilities & UART_CAP_NMOD) {
|
||||
+ termios->c_cflag = 0;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (up->capabilities & UART_CAP_MINI) {
|
||||
termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CMSPAR);
|
||||
if ((termios->c_cflag & CSIZE) == CS5 ||
|
|
@ -0,0 +1,27 @@
|
|||
From: David Bauer <mail@david-bauer.net>
|
||||
To: linux-mtd@lists.infradead.org
|
||||
Subject: [PATCH] mtd: spi-nor: add support for Winbond W25Q512JV
|
||||
Date: Sat, 13 Feb 2021 16:10:47 +0100
|
||||
|
||||
The Winbond W25Q512JV is a 512mb SPI-NOR chip. It supports 4K
|
||||
sectors as well as block protection and Dual-/Quad-read.
|
||||
|
||||
Tested on: Ubiquiti UniFi 6 LR
|
||||
|
||||
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
---
|
||||
drivers/mtd/spi-nor/winbond.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/drivers/mtd/spi-nor/winbond.c
|
||||
+++ b/drivers/mtd/spi-nor/winbond.c
|
||||
@@ -130,6 +130,9 @@ static const struct flash_info winbond_n
|
||||
{ "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512)
|
||||
NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
|
||||
SPI_NOR_QUAD_READ) },
|
||||
+ { "w25q512jv", INFO(0xef4020, 0, 64 * 1024, 1024)
|
||||
+ FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP)
|
||||
+ NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
{ "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024)
|
||||
NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ |
|
||||
SPI_NOR_DUAL_READ) },
|
|
@ -0,0 +1,25 @@
|
|||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -366,6 +366,12 @@ config ROCKCHIP_PHY
|
||||
help
|
||||
Currently supports the integrated Ethernet PHY.
|
||||
|
||||
+config RTL8367S_GSW
|
||||
+ tristate "rtl8367 Gigabit Switch support for mt7622"
|
||||
+ depends on NET_VENDOR_MEDIATEK
|
||||
+ help
|
||||
+ This driver supports rtl8367s in mt7622
|
||||
+
|
||||
config SMSC_PHY
|
||||
tristate "SMSC PHYs"
|
||||
help
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -95,6 +95,7 @@ obj-$(CONFIG_QSEMI_PHY) += qsemi.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
obj-$(CONFIG_RENESAS_PHY) += uPD60620.o
|
||||
obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o
|
||||
+obj-$(CONFIG_RTL8367S_GSW) += rtk/
|
||||
obj-$(CONFIG_SMSC_PHY) += smsc.o
|
||||
obj-$(CONFIG_STE10XP) += ste10Xp.o
|
||||
obj-$(CONFIG_TERANETICS_PHY) += teranetics.o
|
|
@ -0,0 +1,34 @@
|
|||
From: qizhong cheng <qizhong.cheng@mediatek.com>
|
||||
Date: Mon, 27 Dec 2021 21:31:10 +0800
|
||||
Subject: [PATCH] PCI: mediatek: Assert PERST# for 100ms for power and clock to
|
||||
stabilize
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Described in PCIe CEM specification sections 2.2 (PERST# Signal) and
|
||||
2.2.1 (Initial Power-Up (G3 to S0)). The deassertion of PERST# should
|
||||
be delayed 100ms (TPVPERL) for the power and clock to become stable.
|
||||
|
||||
Link: https://lore.kernel.org/r/20211227133110.14500-1-qizhong.cheng@mediatek.com
|
||||
Signed-off-by: qizhong cheng <qizhong.cheng@mediatek.com>
|
||||
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
|
||||
Acked-by: Pali Rohár <pali@kernel.org>
|
||||
---
|
||||
|
||||
--- a/drivers/pci/controller/pcie-mediatek.c
|
||||
+++ b/drivers/pci/controller/pcie-mediatek.c
|
||||
@@ -702,6 +702,13 @@ static int mtk_pcie_startup_port_v2(stru
|
||||
*/
|
||||
writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL);
|
||||
|
||||
+ /*
|
||||
+ * Described in PCIe CEM specification sections 2.2 (PERST# Signal) and
|
||||
+ * 2.2.1 (Initial Power-Up (G3 to S0)). The deassertion of PERST# should
|
||||
+ * be delayed 100ms (TPVPERL) for the power and clock to become stable.
|
||||
+ */
|
||||
+ msleep(100);
|
||||
+
|
||||
/* De-assert PHY, PE, PIPE, MAC and configuration reset */
|
||||
val = readl(port->base + PCIE_RST_CTRL);
|
||||
val |= PCIE_PHY_RSTB | PCIE_PERSTB | PCIE_PIPE_SRSTB |
|
|
@ -0,0 +1,28 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -848,6 +848,12 @@
|
||||
#address-cells = <0>;
|
||||
#interrupt-cells = <1>;
|
||||
};
|
||||
+
|
||||
+ slot0: pcie@0,0 {
|
||||
+ reg = <0x0000 0 0 0 0>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ };
|
||||
};
|
||||
|
||||
pcie1: pcie@1a145000 {
|
||||
@@ -886,6 +892,12 @@
|
||||
#address-cells = <0>;
|
||||
#interrupt-cells = <1>;
|
||||
};
|
||||
+
|
||||
+ slot1: pcie@1,0 {
|
||||
+ reg = <0x0800 0 0 0 0>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ };
|
||||
};
|
||||
|
||||
sata: sata@1a200000 {
|
|
@ -0,0 +1,23 @@
|
|||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 4 Sep 2020 18:33:27 +0200
|
||||
Subject: [PATCH] pcie-mediatek: fix clearing interrupt status
|
||||
|
||||
Clearing the status needs to happen after running the handler, otherwise
|
||||
we will get an extra spurious interrupt after the cause has been cleared
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/drivers/pci/controller/pcie-mediatek.c
|
||||
+++ b/drivers/pci/controller/pcie-mediatek.c
|
||||
@@ -614,9 +614,9 @@ static void mtk_pcie_intr_handler(struct
|
||||
if (status & INTX_MASK) {
|
||||
for_each_set_bit_from(bit, &status, PCI_NUM_INTX + INTX_SHIFT) {
|
||||
/* Clear the INTx */
|
||||
- writel(1 << bit, port->base + PCIE_INT_STATUS);
|
||||
generic_handle_domain_irq(port->irq_domain,
|
||||
bit - INTX_SHIFT);
|
||||
+ writel(1 << bit, port->base + PCIE_INT_STATUS);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 4 Sep 2020 18:42:42 +0200
|
||||
Subject: [PATCH] pci: pcie-mediatek: add support for coherent DMA
|
||||
|
||||
It improves performance by eliminating the need for a cache flush for DMA on
|
||||
attached devices
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -836,6 +836,9 @@
|
||||
bus-range = <0x00 0xff>;
|
||||
ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x8000000>;
|
||||
status = "disabled";
|
||||
+ dma-coherent;
|
||||
+ mediatek,hifsys = <&hifsys>;
|
||||
+ mediatek,cci-control = <&cci_control2>;
|
||||
|
||||
#interrupt-cells = <1>;
|
||||
interrupt-map-mask = <0 0 0 7>;
|
||||
@@ -880,6 +883,9 @@
|
||||
bus-range = <0x00 0xff>;
|
||||
ranges = <0x82000000 0 0x28000000 0x0 0x28000000 0 0x8000000>;
|
||||
status = "disabled";
|
||||
+ dma-coherent;
|
||||
+ mediatek,hifsys = <&hifsys>;
|
||||
+ mediatek,cci-control = <&cci_control2>;
|
||||
|
||||
#interrupt-cells = <1>;
|
||||
interrupt-map-mask = <0 0 0 7>;
|
||||
--- a/drivers/pci/controller/pcie-mediatek.c
|
||||
+++ b/drivers/pci/controller/pcie-mediatek.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_pci.h>
|
||||
#include <linux/of_platform.h>
|
||||
+#include <linux/of_address.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/platform_device.h>
|
||||
@@ -139,6 +140,11 @@
|
||||
#define PCIE_LINK_STATUS_V2 0x804
|
||||
#define PCIE_PORT_LINKUP_V2 BIT(10)
|
||||
|
||||
+/* DMA channel mapping */
|
||||
+#define HIFSYS_DMA_AG_MAP 0x008
|
||||
+#define HIFSYS_DMA_AG_MAP_PCIE0 BIT(0)
|
||||
+#define HIFSYS_DMA_AG_MAP_PCIE1 BIT(1)
|
||||
+
|
||||
struct mtk_pcie_port;
|
||||
|
||||
/**
|
||||
@@ -1054,6 +1060,27 @@ static int mtk_pcie_setup(struct mtk_pci
|
||||
struct mtk_pcie_port *port, *tmp;
|
||||
int err, slot;
|
||||
|
||||
+ if (of_dma_is_coherent(node)) {
|
||||
+ struct regmap *con;
|
||||
+ u32 mask;
|
||||
+
|
||||
+ con = syscon_regmap_lookup_by_phandle(node,
|
||||
+ "mediatek,cci-control");
|
||||
+ /* enable CPU/bus coherency */
|
||||
+ if (!IS_ERR(con))
|
||||
+ regmap_write(con, 0, 3);
|
||||
+
|
||||
+ con = syscon_regmap_lookup_by_phandle(node,
|
||||
+ "mediatek,hifsys");
|
||||
+ if (IS_ERR(con)) {
|
||||
+ dev_err(dev, "missing hifsys node\n");
|
||||
+ return PTR_ERR(con);
|
||||
+ }
|
||||
+
|
||||
+ mask = HIFSYS_DMA_AG_MAP_PCIE0 | HIFSYS_DMA_AG_MAP_PCIE1;
|
||||
+ regmap_update_bits(con, HIFSYS_DMA_AG_MAP, mask, mask);
|
||||
+ }
|
||||
+
|
||||
slot = of_get_pci_domain_nr(dev->of_node);
|
||||
if (slot < 0) {
|
||||
for_each_available_child_of_node(node, child) {
|
|
@ -0,0 +1,27 @@
|
|||
From: Jip de Beer <gpk6x3591g0l@opayq.com>
|
||||
Date: Sun, 9 Jan 2022 13:14:04 +0100
|
||||
Subject: [PATCH] mediatek mt7622: fix 300mhz typo in dts
|
||||
|
||||
The lowest frequency should be 300MHz, since that is the label
|
||||
assigned to the OPP in the mt7622.dtsi device tree, while there is one
|
||||
missing zero in the actual value.
|
||||
|
||||
To be clear, the lowest frequency should be 300MHz instead of 30MHz.
|
||||
|
||||
As mentioned @dangowrt on the OpenWrt forum there is no benefit in
|
||||
leaving 30MHz as the lowest frequency.
|
||||
|
||||
Signed-off-by: Jip de Beer <gpk6x3591g0l@opayq.com>
|
||||
Signed-off-by: Fritz D. Ansel <fdansel@yandex.ru>
|
||||
---
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -24,7 +24,7 @@
|
||||
compatible = "operating-points-v2";
|
||||
opp-shared;
|
||||
opp-300000000 {
|
||||
- opp-hz = /bits/ 64 <30000000>;
|
||||
+ opp-hz = /bits/ 64 <300000000>;
|
||||
opp-microvolt = <950000>;
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -23,11 +23,17 @@
|
||||
cpu_opp_table: opp-table {
|
||||
compatible = "operating-points-v2";
|
||||
opp-shared;
|
||||
- opp-300000000 {
|
||||
- opp-hz = /bits/ 64 <300000000>;
|
||||
- opp-microvolt = <950000>;
|
||||
- };
|
||||
-
|
||||
+ /* Due to the bug described at the link below, remove the 300 MHz clock to avoid a low
|
||||
+ * voltage condition that can cause a hang when rebooting the RT3200/E8450.
|
||||
+ *
|
||||
+ * https://forum.openwrt.org/t/belkin-rt3200-linksys-e8450-wifi-ax-discussion/94302/1490
|
||||
+ *
|
||||
+ * opp-300000000 {
|
||||
+ * opp-hz = /bits/ 64 <300000000>;
|
||||
+ * opp-microvolt = <950000>;
|
||||
+ * };
|
||||
+ *
|
||||
+ */
|
||||
opp-437500000 {
|
||||
opp-hz = /bits/ 64 <437500000>;
|
||||
opp-microvolt = <1000000>;
|
|
@ -0,0 +1,30 @@
|
|||
--- a/drivers/i2c/busses/i2c-mt65xx.c
|
||||
+++ b/drivers/i2c/busses/i2c-mt65xx.c
|
||||
@@ -431,6 +431,19 @@ static const struct mtk_i2c_compatible m
|
||||
.max_dma_support = 33,
|
||||
};
|
||||
|
||||
+static const struct mtk_i2c_compatible mt7986_compat = {
|
||||
+ .quirks = &mt7622_i2c_quirks,
|
||||
+ .regs = mt_i2c_regs_v1,
|
||||
+ .pmic_i2c = 0,
|
||||
+ .dcm = 1,
|
||||
+ .auto_restart = 1,
|
||||
+ .aux_len_reg = 1,
|
||||
+ .max_dma_support = 32,
|
||||
+ .timing_adjust = 0,
|
||||
+ .dma_sync = 1,
|
||||
+ .ltiming_adjust = 0,
|
||||
+};
|
||||
+
|
||||
static const struct mtk_i2c_compatible mt8173_compat = {
|
||||
.regs = mt_i2c_regs_v1,
|
||||
.pmic_i2c = 0,
|
||||
@@ -503,6 +516,7 @@ static const struct of_device_id mtk_i2c
|
||||
{ .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat },
|
||||
{ .compatible = "mediatek,mt6589-i2c", .data = &mt6589_compat },
|
||||
{ .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat },
|
||||
+ { .compatible = "mediatek,mt7986-i2c", .data = &mt7986_compat },
|
||||
{ .compatible = "mediatek,mt8168-i2c", .data = &mt8168_compat },
|
||||
{ .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat },
|
||||
{ .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat },
|
|
@ -0,0 +1,23 @@
|
|||
--- a/drivers/pwm/pwm-mediatek.c
|
||||
+++ b/drivers/pwm/pwm-mediatek.c
|
||||
@@ -302,6 +302,12 @@ static const struct pwm_mediatek_of_data
|
||||
.has_ck_26m_sel = true,
|
||||
};
|
||||
|
||||
+static const struct pwm_mediatek_of_data mt7986_pwm_data = {
|
||||
+ .num_pwms = 2,
|
||||
+ .pwm45_fixup = false,
|
||||
+ .has_ck_26m_sel = true,
|
||||
+};
|
||||
+
|
||||
static const struct pwm_mediatek_of_data mt8516_pwm_data = {
|
||||
.num_pwms = 5,
|
||||
.pwm45_fixup = false,
|
||||
@@ -314,6 +320,7 @@ static const struct of_device_id pwm_med
|
||||
{ .compatible = "mediatek,mt7623-pwm", .data = &mt7623_pwm_data },
|
||||
{ .compatible = "mediatek,mt7628-pwm", .data = &mt7628_pwm_data },
|
||||
{ .compatible = "mediatek,mt7629-pwm", .data = &mt7629_pwm_data },
|
||||
+ { .compatible = "mediatek,mt7986-pwm", .data = &mt7986_pwm_data },
|
||||
{ .compatible = "mediatek,mt8183-pwm", .data = &mt8183_pwm_data },
|
||||
{ .compatible = "mediatek,mt8516-pwm", .data = &mt8516_pwm_data },
|
||||
{ },
|
|
@ -0,0 +1,223 @@
|
|||
From cd47d86ab09f1f3ec5c86441d4fe95e0cf597c06 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Tue, 13 Sep 2022 00:56:24 +0100
|
||||
Subject: [PATCH] thermal/drivers/mediatek: add support for MT7986 and MT7981
|
||||
|
||||
Add support for V3 generation thermal found in MT7986 and MT7981 SoCs.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
drivers/thermal/mtk_thermal.c | 202 +++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 198 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/thermal/mtk_thermal.c
|
||||
+++ b/drivers/thermal/mtk_thermal.c
|
||||
@@ -150,6 +150,21 @@
|
||||
#define CALIB_BUF1_VALID_V2(x) (((x) >> 4) & 0x1)
|
||||
#define CALIB_BUF1_O_SLOPE_SIGN_V2(x) (((x) >> 3) & 0x1)
|
||||
|
||||
+/*
|
||||
+ * Layout of the fuses providing the calibration data
|
||||
+ * These macros could be used for MT7981 and MT7986.
|
||||
+ */
|
||||
+#define CALIB_BUF0_ADC_GE_V3(x) (((x) >> 0) & 0x3ff)
|
||||
+#define CALIB_BUF0_ADC_OE_V3(x) (((x) >> 10) & 0x3ff)
|
||||
+#define CALIB_BUF0_DEGC_CALI_V3(x) (((x) >> 20) & 0x3f)
|
||||
+#define CALIB_BUF0_O_SLOPE_V3(x) (((x) >> 26) & 0x3f)
|
||||
+#define CALIB_BUF1_VTS_TS1_V3(x) (((x) >> 0) & 0x1ff)
|
||||
+#define CALIB_BUF1_VTS_TS2_V3(x) (((x) >> 21) & 0x1ff)
|
||||
+#define CALIB_BUF1_VTS_TSABB_V3(x) (((x) >> 9) & 0x1ff)
|
||||
+#define CALIB_BUF1_VALID_V3(x) (((x) >> 18) & 0x1)
|
||||
+#define CALIB_BUF1_O_SLOPE_SIGN_V3(x) (((x) >> 19) & 0x1)
|
||||
+#define CALIB_BUF1_ID_V3(x) (((x) >> 20) & 0x1)
|
||||
+
|
||||
enum {
|
||||
VTS1,
|
||||
VTS2,
|
||||
@@ -163,6 +178,7 @@ enum {
|
||||
enum mtk_thermal_version {
|
||||
MTK_THERMAL_V1 = 1,
|
||||
MTK_THERMAL_V2,
|
||||
+ MTK_THERMAL_V3,
|
||||
};
|
||||
|
||||
/* MT2701 thermal sensors */
|
||||
@@ -245,6 +261,27 @@ enum mtk_thermal_version {
|
||||
/* The calibration coefficient of sensor */
|
||||
#define MT8183_CALIBRATION 153
|
||||
|
||||
+/* AUXADC channel 11 is used for the temperature sensors */
|
||||
+#define MT7986_TEMP_AUXADC_CHANNEL 11
|
||||
+
|
||||
+/* The total number of temperature sensors in the MT7986 */
|
||||
+#define MT7986_NUM_SENSORS 1
|
||||
+
|
||||
+/* The number of banks in the MT7986 */
|
||||
+#define MT7986_NUM_ZONES 1
|
||||
+
|
||||
+/* The number of sensing points per bank */
|
||||
+#define MT7986_NUM_SENSORS_PER_ZONE 1
|
||||
+
|
||||
+/* MT7986 thermal sensors */
|
||||
+#define MT7986_TS1 0
|
||||
+
|
||||
+/* The number of controller in the MT7986 */
|
||||
+#define MT7986_NUM_CONTROLLER 1
|
||||
+
|
||||
+/* The calibration coefficient of sensor */
|
||||
+#define MT7986_CALIBRATION 165
|
||||
+
|
||||
struct mtk_thermal;
|
||||
|
||||
struct thermal_bank_cfg {
|
||||
@@ -386,6 +423,14 @@ static const int mt7622_mux_values[MT762
|
||||
static const int mt7622_vts_index[MT7622_NUM_SENSORS] = { VTS1 };
|
||||
static const int mt7622_tc_offset[MT7622_NUM_CONTROLLER] = { 0x0, };
|
||||
|
||||
+/* MT7986 thermal sensor data */
|
||||
+static const int mt7986_bank_data[MT7986_NUM_SENSORS] = { MT7986_TS1, };
|
||||
+static const int mt7986_msr[MT7986_NUM_SENSORS_PER_ZONE] = { TEMP_MSR0, };
|
||||
+static const int mt7986_adcpnp[MT7986_NUM_SENSORS_PER_ZONE] = { TEMP_ADCPNP0, };
|
||||
+static const int mt7986_mux_values[MT7986_NUM_SENSORS] = { 0, };
|
||||
+static const int mt7986_vts_index[MT7986_NUM_SENSORS] = { VTS1 };
|
||||
+static const int mt7986_tc_offset[MT7986_NUM_CONTROLLER] = { 0x0, };
|
||||
+
|
||||
/*
|
||||
* The MT8173 thermal controller has four banks. Each bank can read up to
|
||||
* four temperature sensors simultaneously. The MT8173 has a total of 5
|
||||
@@ -549,6 +594,30 @@ static const struct mtk_thermal_data mt8
|
||||
.version = MTK_THERMAL_V1,
|
||||
};
|
||||
|
||||
+/*
|
||||
+ * MT7986 uses AUXADC Channel 11 for raw data access.
|
||||
+ */
|
||||
+static const struct mtk_thermal_data mt7986_thermal_data = {
|
||||
+ .auxadc_channel = MT7986_TEMP_AUXADC_CHANNEL,
|
||||
+ .num_banks = MT7986_NUM_ZONES,
|
||||
+ .num_sensors = MT7986_NUM_SENSORS,
|
||||
+ .vts_index = mt7986_vts_index,
|
||||
+ .cali_val = MT7986_CALIBRATION,
|
||||
+ .num_controller = MT7986_NUM_CONTROLLER,
|
||||
+ .controller_offset = mt7986_tc_offset,
|
||||
+ .need_switch_bank = true,
|
||||
+ .bank_data = {
|
||||
+ {
|
||||
+ .num_sensors = 1,
|
||||
+ .sensors = mt7986_bank_data,
|
||||
+ },
|
||||
+ },
|
||||
+ .msr = mt7986_msr,
|
||||
+ .adcpnp = mt7986_adcpnp,
|
||||
+ .sensor_mux_values = mt7986_mux_values,
|
||||
+ .version = MTK_THERMAL_V3,
|
||||
+};
|
||||
+
|
||||
/**
|
||||
* raw_to_mcelsius - convert a raw ADC value to mcelsius
|
||||
* @mt: The thermal controller
|
||||
@@ -603,6 +672,22 @@ static int raw_to_mcelsius_v2(struct mtk
|
||||
return (format_2 - tmp) * 100;
|
||||
}
|
||||
|
||||
+static int raw_to_mcelsius_v3(struct mtk_thermal *mt, int sensno, s32 raw)
|
||||
+{
|
||||
+ s32 tmp;
|
||||
+
|
||||
+ if (raw == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ raw &= 0xfff;
|
||||
+ tmp = 100000 * 15 / 16 * 10000;
|
||||
+ tmp /= 4096 - 512 + mt->adc_ge;
|
||||
+ tmp /= 1490;
|
||||
+ tmp *= raw - mt->vts[sensno] - 2900 - mt->adc_oe + 512;
|
||||
+
|
||||
+ return mt->degc_cali * 500 - tmp;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* mtk_thermal_get_bank - get bank
|
||||
* @bank: The bank
|
||||
@@ -659,9 +744,12 @@ static int mtk_thermal_bank_temperature(
|
||||
if (mt->conf->version == MTK_THERMAL_V1) {
|
||||
temp = raw_to_mcelsius_v1(
|
||||
mt, conf->bank_data[bank->id].sensors[i], raw);
|
||||
- } else {
|
||||
+ } else if (mt->conf->version == MTK_THERMAL_V2) {
|
||||
temp = raw_to_mcelsius_v2(
|
||||
mt, conf->bank_data[bank->id].sensors[i], raw);
|
||||
+ } else {
|
||||
+ temp = raw_to_mcelsius_v3(
|
||||
+ mt, conf->bank_data[bank->id].sensors[i], raw);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -887,6 +975,26 @@ static int mtk_thermal_extract_efuse_v2(
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int mtk_thermal_extract_efuse_v3(struct mtk_thermal *mt, u32 *buf)
|
||||
+{
|
||||
+ if (!CALIB_BUF1_VALID_V3(buf[1]))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ mt->adc_oe = CALIB_BUF0_ADC_OE_V3(buf[0]);
|
||||
+ mt->adc_ge = CALIB_BUF0_ADC_GE_V3(buf[0]);
|
||||
+ mt->degc_cali = CALIB_BUF0_DEGC_CALI_V3(buf[0]);
|
||||
+ mt->o_slope = CALIB_BUF0_O_SLOPE_V3(buf[0]);
|
||||
+ mt->vts[VTS1] = CALIB_BUF1_VTS_TS1_V3(buf[1]);
|
||||
+ mt->vts[VTS2] = CALIB_BUF1_VTS_TS2_V3(buf[1]);
|
||||
+ mt->vts[VTSABB] = CALIB_BUF1_VTS_TSABB_V3(buf[1]);
|
||||
+ mt->o_slope_sign = CALIB_BUF1_O_SLOPE_SIGN_V3(buf[1]);
|
||||
+
|
||||
+ if (CALIB_BUF1_ID_V3(buf[1]) == 0)
|
||||
+ mt->o_slope = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int mtk_thermal_get_calibration_data(struct device *dev,
|
||||
struct mtk_thermal *mt)
|
||||
{
|
||||
@@ -897,6 +1005,7 @@ static int mtk_thermal_get_calibration_d
|
||||
|
||||
/* Start with default values */
|
||||
mt->adc_ge = 512;
|
||||
+ mt->adc_oe = 512;
|
||||
for (i = 0; i < mt->conf->num_sensors; i++)
|
||||
mt->vts[i] = 260;
|
||||
mt->degc_cali = 40;
|
||||
@@ -924,8 +1033,10 @@ static int mtk_thermal_get_calibration_d
|
||||
|
||||
if (mt->conf->version == MTK_THERMAL_V1)
|
||||
ret = mtk_thermal_extract_efuse_v1(mt, buf);
|
||||
- else
|
||||
+ else if (mt->conf->version == MTK_THERMAL_V2)
|
||||
ret = mtk_thermal_extract_efuse_v2(mt, buf);
|
||||
+ else
|
||||
+ ret = mtk_thermal_extract_efuse_v3(mt, buf);
|
||||
|
||||
if (ret) {
|
||||
dev_info(dev, "Device not calibrated, using default calibration values\n");
|
||||
@@ -956,6 +1067,10 @@ static const struct of_device_id mtk_the
|
||||
.data = (void *)&mt7622_thermal_data,
|
||||
},
|
||||
{
|
||||
+ .compatible = "mediatek,mt7986-thermal",
|
||||
+ .data = (void *)&mt7986_thermal_data,
|
||||
+ },
|
||||
+ {
|
||||
.compatible = "mediatek,mt8183-thermal",
|
||||
.data = (void *)&mt8183_thermal_data,
|
||||
}, {
|
||||
@@ -1070,7 +1185,8 @@ static int mtk_thermal_probe(struct plat
|
||||
goto err_disable_clk_auxadc;
|
||||
}
|
||||
|
||||
- if (mt->conf->version == MTK_THERMAL_V2) {
|
||||
+ if (mt->conf->version == MTK_THERMAL_V2 ||
|
||||
+ mt->conf->version == MTK_THERMAL_V3) {
|
||||
mtk_thermal_turn_on_buffer(apmixed_base);
|
||||
mtk_thermal_release_periodic_ts(mt, auxadc_base);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -318,7 +318,7 @@
|
||||
/* Attention: GPIO 90 is used to switch between PCIe@1,0 and
|
||||
* SATA functions. i.e. output-high: PCIe, output-low: SATA
|
||||
*/
|
||||
- asm_sel {
|
||||
+ asmsel: asm_sel {
|
||||
gpio-hog;
|
||||
gpios = <90 GPIO_ACTIVE_HIGH>;
|
||||
output-high;
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-sata.dts
|
||||
@@ -0,0 +1,31 @@
|
||||
+/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
|
||||
+
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+/dts-v1/;
|
||||
+/plugin/;
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "bananapi,bpi-r64", "mediatek,mt7622";
|
||||
+
|
||||
+ fragment@0 {
|
||||
+ target = <&asmsel>;
|
||||
+ __overlay__ {
|
||||
+ gpios = <90 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ fragment@1 {
|
||||
+ target = <&sata>;
|
||||
+ __overlay__ {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ fragment@2 {
|
||||
+ target = <&sata_phy>;
|
||||
+ __overlay__ {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-pcie1.dts
|
||||
@@ -0,0 +1,17 @@
|
||||
+/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
|
||||
+
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+/dts-v1/;
|
||||
+/plugin/;
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "bananapi,bpi-r64", "mediatek,mt7622";
|
||||
+
|
||||
+ fragment@0 {
|
||||
+ target = <&asmsel>;
|
||||
+ __overlay__ {
|
||||
+ gpios = <90 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
|
@ -0,0 +1,37 @@
|
|||
--- a/arch/arm/Kconfig
|
||||
+++ b/arch/arm/Kconfig
|
||||
@@ -1729,6 +1729,14 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN
|
||||
|
||||
endchoice
|
||||
|
||||
+config CMDLINE_OVERRIDE
|
||||
+ bool "Use alternative cmdline from device tree"
|
||||
+ help
|
||||
+ Some bootloaders may have uneditable bootargs. While CMDLINE_FORCE can
|
||||
+ be used, this is not a good option for kernels that are shared across
|
||||
+ devices. This setting enables using "chosen/cmdline-override" as the
|
||||
+ cmdline if it exists in the device tree.
|
||||
+
|
||||
config CMDLINE
|
||||
string "Default kernel command string"
|
||||
default ""
|
||||
--- a/drivers/of/fdt.c
|
||||
+++ b/drivers/of/fdt.c
|
||||
@@ -1162,6 +1162,17 @@ int __init early_init_dt_scan_chosen(uns
|
||||
if (p != NULL && l > 0)
|
||||
strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE));
|
||||
|
||||
+ /* CONFIG_CMDLINE_OVERRIDE is used to fallback to a different
|
||||
+ * device tree option of chosen/bootargs-override. This is
|
||||
+ * helpful on boards where u-boot sets bootargs, and is unable
|
||||
+ * to be modified.
|
||||
+ */
|
||||
+#ifdef CONFIG_CMDLINE_OVERRIDE
|
||||
+ p = of_get_flat_dt_prop(node, "bootargs-override", &l);
|
||||
+ if (p != NULL && l > 0)
|
||||
+ strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* CONFIG_CMDLINE is meant to be a default in case nothing else
|
||||
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
|
|
@ -0,0 +1,31 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -645,5 +645,28 @@
|
||||
};
|
||||
|
||||
&wmac {
|
||||
+ mediatek,eeprom-data = <0x22760500 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x0 0x44000020 0x0 0x10002000
|
||||
+ 0x4400 0x4000000 0x0 0x0
|
||||
+ 0x200000b3 0x40b6c3c3 0x26000000 0x41c42600
|
||||
+ 0x41c4 0x26000000 0xc0c52600 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0xc6c6
|
||||
+ 0xc3c3c2c1 0xc300c3 0x818181 0x83c1c182
|
||||
+ 0x83838382 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x84002e00 0x90000087 0x8a000000 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0xb000009 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x0
|
||||
+ 0x0 0x0 0x0 0x7707>;
|
||||
+
|
||||
status = "okay";
|
||||
};
|
|
@ -0,0 +1,240 @@
|
|||
From 71fd1c93f34b21e79ef18e83ce8fd40566fd7a71 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Hainke <vincent@systemli.org>
|
||||
Date: Mon, 7 Nov 2022 13:09:29 +0100
|
||||
Subject: [PATCH] Revert "cpufreq: mediatek: Refine
|
||||
mtk_cpufreq_voltage_tracking()"
|
||||
|
||||
This reverts commit 6a17b3876bc8303612d7ad59ecf7cbc0db418bcd.
|
||||
---
|
||||
drivers/cpufreq/mediatek-cpufreq.c | 147 +++++++++++++++++++----------
|
||||
1 file changed, 96 insertions(+), 51 deletions(-)
|
||||
|
||||
diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
|
||||
index 7f2680bc9a0f..4466d0c91a6a 100644
|
||||
--- a/drivers/cpufreq/mediatek-cpufreq.c
|
||||
+++ b/drivers/cpufreq/mediatek-cpufreq.c
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/cpumask.h>
|
||||
-#include <linux/minmax.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
@@ -16,6 +15,8 @@
|
||||
#include <linux/pm_opp.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
+#define VOLT_TOL (10000)
|
||||
+
|
||||
struct mtk_cpufreq_platform_data {
|
||||
int min_volt_shift;
|
||||
int max_volt_shift;
|
||||
@@ -55,7 +56,6 @@ struct mtk_cpu_dvfs_info {
|
||||
unsigned int opp_cpu;
|
||||
unsigned long current_freq;
|
||||
const struct mtk_cpufreq_platform_data *soc_data;
|
||||
- int vtrack_max;
|
||||
bool ccifreq_bound;
|
||||
};
|
||||
|
||||
@@ -82,7 +82,6 @@ static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info,
|
||||
struct regulator *proc_reg = info->proc_reg;
|
||||
struct regulator *sram_reg = info->sram_reg;
|
||||
int pre_vproc, pre_vsram, new_vsram, vsram, vproc, ret;
|
||||
- int retry = info->vtrack_max;
|
||||
|
||||
pre_vproc = regulator_get_voltage(proc_reg);
|
||||
if (pre_vproc < 0) {
|
||||
@@ -90,44 +89,91 @@ static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info,
|
||||
"invalid Vproc value: %d\n", pre_vproc);
|
||||
return pre_vproc;
|
||||
}
|
||||
+ /* Vsram should not exceed the maximum allowed voltage of SoC. */
|
||||
+ new_vsram = min(new_vproc + soc_data->min_volt_shift,
|
||||
+ soc_data->sram_max_volt);
|
||||
+
|
||||
+ if (pre_vproc < new_vproc) {
|
||||
+ /*
|
||||
+ * When scaling up voltages, Vsram and Vproc scale up step
|
||||
+ * by step. At each step, set Vsram to (Vproc + 200mV) first,
|
||||
+ * then set Vproc to (Vsram - 100mV).
|
||||
+ * Keep doing it until Vsram and Vproc hit target voltages.
|
||||
+ */
|
||||
+ do {
|
||||
+ pre_vsram = regulator_get_voltage(sram_reg);
|
||||
+ if (pre_vsram < 0) {
|
||||
+ dev_err(info->cpu_dev,
|
||||
+ "invalid Vsram value: %d\n", pre_vsram);
|
||||
+ return pre_vsram;
|
||||
+ }
|
||||
+ pre_vproc = regulator_get_voltage(proc_reg);
|
||||
+ if (pre_vproc < 0) {
|
||||
+ dev_err(info->cpu_dev,
|
||||
+ "invalid Vproc value: %d\n", pre_vproc);
|
||||
+ return pre_vproc;
|
||||
+ }
|
||||
|
||||
- pre_vsram = regulator_get_voltage(sram_reg);
|
||||
- if (pre_vsram < 0) {
|
||||
- dev_err(info->cpu_dev, "invalid Vsram value: %d\n", pre_vsram);
|
||||
- return pre_vsram;
|
||||
- }
|
||||
+ vsram = min(new_vsram,
|
||||
+ pre_vproc + soc_data->min_volt_shift);
|
||||
|
||||
- new_vsram = clamp(new_vproc + soc_data->min_volt_shift,
|
||||
- soc_data->sram_min_volt, soc_data->sram_max_volt);
|
||||
+ if (vsram + VOLT_TOL >= soc_data->sram_max_volt) {
|
||||
+ vsram = soc_data->sram_max_volt;
|
||||
|
||||
- do {
|
||||
- if (pre_vproc <= new_vproc) {
|
||||
- vsram = clamp(pre_vproc + soc_data->max_volt_shift,
|
||||
- soc_data->sram_min_volt, new_vsram);
|
||||
- ret = regulator_set_voltage(sram_reg, vsram,
|
||||
- soc_data->sram_max_volt);
|
||||
+ /*
|
||||
+ * If the target Vsram hits the maximum voltage,
|
||||
+ * try to set the exact voltage value first.
|
||||
+ */
|
||||
+ ret = regulator_set_voltage(sram_reg, vsram,
|
||||
+ vsram);
|
||||
+ if (ret)
|
||||
+ ret = regulator_set_voltage(sram_reg,
|
||||
+ vsram - VOLT_TOL,
|
||||
+ vsram);
|
||||
|
||||
- if (ret)
|
||||
- return ret;
|
||||
-
|
||||
- if (vsram == soc_data->sram_max_volt ||
|
||||
- new_vsram == soc_data->sram_min_volt)
|
||||
vproc = new_vproc;
|
||||
- else
|
||||
+ } else {
|
||||
+ ret = regulator_set_voltage(sram_reg, vsram,
|
||||
+ vsram + VOLT_TOL);
|
||||
+
|
||||
vproc = vsram - soc_data->min_volt_shift;
|
||||
+ }
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
|
||||
ret = regulator_set_voltage(proc_reg, vproc,
|
||||
- soc_data->proc_max_volt);
|
||||
+ vproc + VOLT_TOL);
|
||||
if (ret) {
|
||||
regulator_set_voltage(sram_reg, pre_vsram,
|
||||
- soc_data->sram_max_volt);
|
||||
+ pre_vsram);
|
||||
return ret;
|
||||
}
|
||||
- } else if (pre_vproc > new_vproc) {
|
||||
+ } while (vproc < new_vproc || vsram < new_vsram);
|
||||
+ } else if (pre_vproc > new_vproc) {
|
||||
+ /*
|
||||
+ * When scaling down voltages, Vsram and Vproc scale down step
|
||||
+ * by step. At each step, set Vproc to (Vsram - 200mV) first,
|
||||
+ * then set Vproc to (Vproc + 100mV).
|
||||
+ * Keep doing it until Vsram and Vproc hit target voltages.
|
||||
+ */
|
||||
+ do {
|
||||
+ pre_vproc = regulator_get_voltage(proc_reg);
|
||||
+ if (pre_vproc < 0) {
|
||||
+ dev_err(info->cpu_dev,
|
||||
+ "invalid Vproc value: %d\n", pre_vproc);
|
||||
+ return pre_vproc;
|
||||
+ }
|
||||
+ pre_vsram = regulator_get_voltage(sram_reg);
|
||||
+ if (pre_vsram < 0) {
|
||||
+ dev_err(info->cpu_dev,
|
||||
+ "invalid Vsram value: %d\n", pre_vsram);
|
||||
+ return pre_vsram;
|
||||
+ }
|
||||
+
|
||||
vproc = max(new_vproc,
|
||||
pre_vsram - soc_data->max_volt_shift);
|
||||
ret = regulator_set_voltage(proc_reg, vproc,
|
||||
- soc_data->proc_max_volt);
|
||||
+ vproc + VOLT_TOL);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -137,24 +183,32 @@ static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info,
|
||||
vsram = max(new_vsram,
|
||||
vproc + soc_data->min_volt_shift);
|
||||
|
||||
- ret = regulator_set_voltage(sram_reg, vsram,
|
||||
- soc_data->sram_max_volt);
|
||||
+ if (vsram + VOLT_TOL >= soc_data->sram_max_volt) {
|
||||
+ vsram = soc_data->sram_max_volt;
|
||||
+
|
||||
+ /*
|
||||
+ * If the target Vsram hits the maximum voltage,
|
||||
+ * try to set the exact voltage value first.
|
||||
+ */
|
||||
+ ret = regulator_set_voltage(sram_reg, vsram,
|
||||
+ vsram);
|
||||
+ if (ret)
|
||||
+ ret = regulator_set_voltage(sram_reg,
|
||||
+ vsram - VOLT_TOL,
|
||||
+ vsram);
|
||||
+ } else {
|
||||
+ ret = regulator_set_voltage(sram_reg, vsram,
|
||||
+ vsram + VOLT_TOL);
|
||||
+ }
|
||||
+
|
||||
if (ret) {
|
||||
regulator_set_voltage(proc_reg, pre_vproc,
|
||||
- soc_data->proc_max_volt);
|
||||
+ pre_vproc);
|
||||
return ret;
|
||||
}
|
||||
- }
|
||||
-
|
||||
- pre_vproc = vproc;
|
||||
- pre_vsram = vsram;
|
||||
-
|
||||
- if (--retry < 0) {
|
||||
- dev_err(info->cpu_dev,
|
||||
- "over loop count, failed to set voltage\n");
|
||||
- return -EINVAL;
|
||||
- }
|
||||
- } while (vproc != new_vproc || vsram != new_vsram);
|
||||
+ } while (vproc > new_vproc + VOLT_TOL ||
|
||||
+ vsram > new_vsram + VOLT_TOL);
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -250,8 +304,8 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
|
||||
* If the new voltage or the intermediate voltage is higher than the
|
||||
* current voltage, scale up voltage first.
|
||||
*/
|
||||
- target_vproc = max(inter_vproc, vproc);
|
||||
- if (pre_vproc <= target_vproc) {
|
||||
+ target_vproc = (inter_vproc > vproc) ? inter_vproc : vproc;
|
||||
+ if (pre_vproc < target_vproc) {
|
||||
ret = mtk_cpufreq_set_voltage(info, target_vproc);
|
||||
if (ret) {
|
||||
dev_err(cpu_dev,
|
||||
@@ -513,15 +567,6 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
|
||||
*/
|
||||
info->need_voltage_tracking = (info->sram_reg != NULL);
|
||||
|
||||
- /*
|
||||
- * We assume min voltage is 0 and tracking target voltage using
|
||||
- * min_volt_shift for each iteration.
|
||||
- * The vtrack_max is 3 times of expeted iteration count.
|
||||
- */
|
||||
- info->vtrack_max = 3 * DIV_ROUND_UP(max(info->soc_data->sram_max_volt,
|
||||
- info->soc_data->proc_max_volt),
|
||||
- info->soc_data->min_volt_shift);
|
||||
-
|
||||
return 0;
|
||||
|
||||
out_disable_inter_clock:
|
||||
--
|
||||
2.38.1
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue