mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Add mediatek 5.15 support
This commit is contained in:
parent
a034777bad
commit
bd2a3759f5
182 changed files with 105691 additions and 0 deletions
|
@ -0,0 +1,119 @@
|
|||
--- 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 {
|
||||
@@ -40,23 +39,22 @@
|
||||
|
||||
gpio-keys {
|
||||
compatible = "gpio-keys";
|
||||
- poll-interval = <100>;
|
||||
|
||||
factory {
|
||||
label = "factory";
|
||||
linux,code = <BTN_0>;
|
||||
- gpios = <&pio 0 0>;
|
||||
+ gpios = <&pio 0 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
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 {
|
||||
@@ -132,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 {
|
||||
@@ -236,15 +234,28 @@
|
||||
|
||||
&pcie {
|
||||
pinctrl-names = "default";
|
||||
- pinctrl-0 = <&pcie0_pins>;
|
||||
+ pinctrl-0 = <&pcie0_pins>, <&pcie1_pins>;
|
||||
status = "okay";
|
||||
|
||||
pcie@0,0 {
|
||||
status = "okay";
|
||||
};
|
||||
+
|
||||
+ pcie@1,0 {
|
||||
+ 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 {
|
||||
@@ -511,11 +522,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,25 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -111,7 +111,7 @@
|
||||
};
|
||||
|
||||
psci {
|
||||
- compatible = "arm,psci-0.2";
|
||||
+ compatible = "arm,psci-1.0";
|
||||
method = "smc";
|
||||
};
|
||||
|
||||
@@ -127,6 +127,13 @@
|
||||
#size-cells = <2>;
|
||||
ranges;
|
||||
|
||||
+ /* 64 KiB reserved for ramoops/pstore */
|
||||
+ ramoops@0x42ff0000 {
|
||||
+ 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,56 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -19,6 +19,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 {
|
||||
@@ -42,8 +46,8 @@
|
||||
compatible = "gpio-keys";
|
||||
|
||||
factory {
|
||||
- label = "factory";
|
||||
- linux,code = <BTN_0>;
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
gpios = <&pio 0 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
@@ -57,17 +61,25 @@
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
- green {
|
||||
- label = "bpi-r64:pio: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";
|
||||
};
|
||||
|
||||
- red {
|
||||
- label = "bpi-r64:pio: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
|
||||
@@ -559,12 +559,16 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&rtc {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
&sata {
|
||||
- status = "disable";
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
&sata_phy {
|
||||
- status = "disable";
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
&spi0 {
|
|
@ -0,0 +1,41 @@
|
|||
--- 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,32 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
-&nor_flash {
|
||||
+&snand {
|
||||
pinctrl-names = "default";
|
||||
- pinctrl-0 = <&spi_nor_pins>;
|
||||
- status = "disabled";
|
||||
+ pinctrl-0 = <&serial_nand_pins>;
|
||||
+ mediatek,quad-spi;
|
||||
+ status = "okay";
|
||||
+ 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;
|
||||
+ };
|
||||
|
||||
- flash@0 {
|
||||
- compatible = "jedec,spi-nor";
|
||||
- reg = <0>;
|
||||
+ partition@280000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x280000 0x7d80000>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
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,22 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ snand: snfi@1100d000 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&serial_nand_pins>;
|
||||
+ compatible = "mediatek,mt7629-snand";
|
||||
+ reg = <0x1100d000 0x1000>, <0x1100e000 0x1000>;
|
||||
+ reg-names = "nfi", "ecc";
|
||||
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>,
|
||||
+ <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ 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,38 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&snand {
|
||||
+ status = "okay";
|
||||
+ mediatek,quad-spi;
|
||||
+
|
||||
+ 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,81 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -561,6 +561,20 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ snand: snfi@1100d000 {
|
||||
+ compatible = "mediatek,mt7622-snand";
|
||||
+ reg = <0 0x1100d000 0 0x1000>, <0 0x1100e000 0 0x1000>;
|
||||
+ reg-names = "nfi", "ecc";
|
||||
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>,
|
||||
+ <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
nor_flash: spi@11014000 {
|
||||
compatible = "mediatek,mt7622-nor",
|
||||
"mediatek,mt8173-nor";
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
@@ -529,6 +529,55 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+&snand {
|
||||
+ mediatek,quad-spi;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&serial_nand_pins>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ 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,23 @@
|
|||
--- a/arch/arm/boot/dts/mt7623.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7623.dtsi
|
||||
@@ -949,17 +949,14 @@
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
|
||||
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,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,864 @@
|
|||
--- a/drivers/mtd/nand/Kconfig
|
||||
+++ b/drivers/mtd/nand/Kconfig
|
||||
@@ -15,6 +15,10 @@ config MTD_NAND_ECC
|
||||
bool
|
||||
depends on MTD_NAND_CORE
|
||||
|
||||
+config MTD_NAND_MTK_BMT
|
||||
+ bool "Support MediaTek NAND Bad-block Management Table"
|
||||
+ default n
|
||||
+
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
--- a/drivers/mtd/nand/Makefile
|
||||
+++ b/drivers/mtd/nand/Makefile
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
nandcore-objs := core.o bbt.o
|
||||
obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
|
||||
+obj-$(CONFIG_MTD_NAND_MTK_BMT) += mtk_bmt.o
|
||||
|
||||
obj-y += onenand/
|
||||
obj-y += raw/
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nand/mtk_bmt.c
|
||||
@@ -0,0 +1,781 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2017 MediaTek Inc.
|
||||
+ * Author: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
+ * Copyright (c) 2020 Felix Fietkau <nbd@nbd.name>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License version 2 as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/gfp.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/mtd/nand.h>
|
||||
+#include <linux/mtd/partitions.h>
|
||||
+#include <linux/mtd/mtk_bmt.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/debugfs.h>
|
||||
+
|
||||
+#define MAIN_SIGNATURE_OFFSET 0
|
||||
+#define OOB_SIGNATURE_OFFSET 1
|
||||
+#define BBPOOL_RATIO 2
|
||||
+
|
||||
+#define BBT_LOG(fmt, ...) pr_debug("[BBT][%s|%d] "fmt"\n", __func__, __LINE__, ##__VA_ARGS__)
|
||||
+
|
||||
+/* Maximum 8k blocks */
|
||||
+#define BB_TABLE_MAX bmtd.table_size
|
||||
+#define BMT_TABLE_MAX (BB_TABLE_MAX * BBPOOL_RATIO / 100)
|
||||
+#define BMT_TBL_DEF_VAL 0x0
|
||||
+
|
||||
+/*
|
||||
+ * Burner Bad Block Table
|
||||
+ * --------- Only support SLC Nand Chips!!!!!!!!!!! ----------
|
||||
+ */
|
||||
+
|
||||
+struct bbbt {
|
||||
+ char signature[3];
|
||||
+ /* This version is used to distinguish the legacy and new algorithm */
|
||||
+#define BBMT_VERSION 2
|
||||
+ unsigned char version;
|
||||
+ /* Below 2 tables will be written in SLC */
|
||||
+ u16 bb_tbl[];
|
||||
+};
|
||||
+
|
||||
+struct bbmt {
|
||||
+ u16 block;
|
||||
+#define NO_MAPPED 0
|
||||
+#define NORMAL_MAPPED 1
|
||||
+#define BMT_MAPPED 2
|
||||
+ u16 mapped;
|
||||
+};
|
||||
+
|
||||
+static struct bmt_desc {
|
||||
+ struct mtd_info *mtd;
|
||||
+
|
||||
+ int (*_read_oob) (struct mtd_info *mtd, loff_t from,
|
||||
+ struct mtd_oob_ops *ops);
|
||||
+ int (*_write_oob) (struct mtd_info *mtd, loff_t to,
|
||||
+ struct mtd_oob_ops *ops);
|
||||
+ const struct nand_ops *nand_ops;
|
||||
+
|
||||
+ struct bbbt *bbt;
|
||||
+
|
||||
+ struct dentry *debugfs_dir;
|
||||
+
|
||||
+ u32 table_size;
|
||||
+ u32 pg_size;
|
||||
+ u32 blk_size;
|
||||
+ u16 pg_shift;
|
||||
+ u16 blk_shift;
|
||||
+ /* bbt logical address */
|
||||
+ u16 pool_lba;
|
||||
+ /* bbt physical address */
|
||||
+ u16 pool_pba;
|
||||
+ /* Maximum count of bad blocks that the vendor guaranteed */
|
||||
+ u16 bb_max;
|
||||
+ /* Total blocks of the Nand Chip */
|
||||
+ u16 total_blks;
|
||||
+ /* The block(n) BMT is located at (bmt_tbl[n]) */
|
||||
+ u16 bmt_blk_idx;
|
||||
+ /* How many pages needs to store 'struct bbbt' */
|
||||
+ u32 bmt_pgs;
|
||||
+
|
||||
+ /* to compensate for driver level remapping */
|
||||
+ u8 oob_offset;
|
||||
+} bmtd = {0};
|
||||
+
|
||||
+static unsigned char *nand_bbt_buf;
|
||||
+static unsigned char *nand_data_buf;
|
||||
+
|
||||
+/* -------- Unit conversions -------- */
|
||||
+static inline u32 blk_pg(u16 block)
|
||||
+{
|
||||
+ return (u32)(block << (bmtd.blk_shift - bmtd.pg_shift));
|
||||
+}
|
||||
+
|
||||
+/* -------- Nand operations wrapper -------- */
|
||||
+static inline int
|
||||
+bbt_nand_read(u32 page, unsigned char *dat, int dat_len,
|
||||
+ unsigned char *fdm, int fdm_len)
|
||||
+{
|
||||
+ struct mtd_oob_ops ops = {
|
||||
+ .mode = MTD_OPS_PLACE_OOB,
|
||||
+ .ooboffs = bmtd.oob_offset,
|
||||
+ .oobbuf = fdm,
|
||||
+ .ooblen = fdm_len,
|
||||
+ .datbuf = dat,
|
||||
+ .len = dat_len,
|
||||
+ };
|
||||
+
|
||||
+ return bmtd._read_oob(bmtd.mtd, page << bmtd.pg_shift, &ops);
|
||||
+}
|
||||
+
|
||||
+static inline int bbt_nand_erase(u16 block)
|
||||
+{
|
||||
+ struct nand_device *nand = mtd_to_nanddev(bmtd.mtd);
|
||||
+ loff_t addr = (loff_t)block << bmtd.blk_shift;
|
||||
+ struct nand_pos pos;
|
||||
+
|
||||
+ nanddev_offs_to_pos(nand, addr, &pos);
|
||||
+ return bmtd.nand_ops->erase(nand, &pos);
|
||||
+}
|
||||
+
|
||||
+/* -------- Bad Blocks Management -------- */
|
||||
+static inline struct bbmt *bmt_tbl(struct bbbt *bbbt)
|
||||
+{
|
||||
+ return (struct bbmt *)&bbbt->bb_tbl[bmtd.table_size];
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+read_bmt(u16 block, unsigned char *dat, unsigned char *fdm, int fdm_len)
|
||||
+{
|
||||
+ u32 len = bmtd.bmt_pgs << bmtd.pg_shift;
|
||||
+
|
||||
+ return bbt_nand_read(blk_pg(block), dat, len, fdm, fdm_len);
|
||||
+}
|
||||
+
|
||||
+static int write_bmt(u16 block, unsigned char *dat)
|
||||
+{
|
||||
+ struct mtd_oob_ops ops = {
|
||||
+ .mode = MTD_OPS_PLACE_OOB,
|
||||
+ .ooboffs = OOB_SIGNATURE_OFFSET + bmtd.oob_offset,
|
||||
+ .oobbuf = "bmt",
|
||||
+ .ooblen = 3,
|
||||
+ .datbuf = dat,
|
||||
+ .len = bmtd.bmt_pgs << bmtd.pg_shift,
|
||||
+ };
|
||||
+ loff_t addr = (loff_t)block << bmtd.blk_shift;
|
||||
+
|
||||
+ return bmtd._write_oob(bmtd.mtd, addr, &ops);
|
||||
+}
|
||||
+
|
||||
+static u16 find_valid_block(u16 block)
|
||||
+{
|
||||
+ u8 fdm[4];
|
||||
+ int ret;
|
||||
+ int loop = 0;
|
||||
+
|
||||
+retry:
|
||||
+ if (block >= bmtd.total_blks)
|
||||
+ return 0;
|
||||
+
|
||||
+ ret = bbt_nand_read(blk_pg(block), nand_data_buf, bmtd.pg_size,
|
||||
+ fdm, sizeof(fdm));
|
||||
+ /* Read the 1st byte of FDM to judge whether it's a bad
|
||||
+ * or not
|
||||
+ */
|
||||
+ if (ret || fdm[0] != 0xff) {
|
||||
+ pr_info("nand: found bad block 0x%x\n", block);
|
||||
+ if (loop >= bmtd.bb_max) {
|
||||
+ pr_info("nand: FATAL ERR: too many bad blocks!!\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ loop++;
|
||||
+ block++;
|
||||
+ goto retry;
|
||||
+ }
|
||||
+
|
||||
+ return block;
|
||||
+}
|
||||
+
|
||||
+/* Find out all bad blocks, and fill in the mapping table */
|
||||
+static int scan_bad_blocks(struct bbbt *bbt)
|
||||
+{
|
||||
+ int i;
|
||||
+ u16 block = 0;
|
||||
+
|
||||
+ /* First time download, the block0 MUST NOT be a bad block,
|
||||
+ * this is guaranteed by vendor
|
||||
+ */
|
||||
+ bbt->bb_tbl[0] = 0;
|
||||
+
|
||||
+ /*
|
||||
+ * Construct the mapping table of Normal data area(non-PMT/BMTPOOL)
|
||||
+ * G - Good block; B - Bad block
|
||||
+ * ---------------------------
|
||||
+ * physical |G|G|B|G|B|B|G|G|G|G|B|G|B|
|
||||
+ * ---------------------------
|
||||
+ * What bb_tbl[i] looks like:
|
||||
+ * physical block(i):
|
||||
+ * 0 1 2 3 4 5 6 7 8 9 a b c
|
||||
+ * mapped block(bb_tbl[i]):
|
||||
+ * 0 1 3 6 7 8 9 b ......
|
||||
+ * ATTENTION:
|
||||
+ * If new bad block ocurred(n), search bmt_tbl to find
|
||||
+ * a available block(x), and fill in the bb_tbl[n] = x;
|
||||
+ */
|
||||
+ for (i = 1; i < bmtd.pool_lba; i++) {
|
||||
+ bbt->bb_tbl[i] = find_valid_block(bbt->bb_tbl[i - 1] + 1);
|
||||
+ BBT_LOG("bb_tbl[0x%x] = 0x%x", i, bbt->bb_tbl[i]);
|
||||
+ if (bbt->bb_tbl[i] == 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* Physical Block start Address of BMT pool */
|
||||
+ bmtd.pool_pba = bbt->bb_tbl[i - 1] + 1;
|
||||
+ if (bmtd.pool_pba >= bmtd.total_blks - 2) {
|
||||
+ pr_info("nand: FATAL ERR: Too many bad blocks!!\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ BBT_LOG("pool_pba=0x%x", bmtd.pool_pba);
|
||||
+ i = 0;
|
||||
+ block = bmtd.pool_pba;
|
||||
+ /*
|
||||
+ * The bmt table is used for runtime bad block mapping
|
||||
+ * G - Good block; B - Bad block
|
||||
+ * ---------------------------
|
||||
+ * physical |G|G|B|G|B|B|G|G|G|G|B|G|B|
|
||||
+ * ---------------------------
|
||||
+ * block: 0 1 2 3 4 5 6 7 8 9 a b c
|
||||
+ * What bmt_tbl[i] looks like in initial state:
|
||||
+ * i:
|
||||
+ * 0 1 2 3 4 5 6 7
|
||||
+ * bmt_tbl[i].block:
|
||||
+ * 0 1 3 6 7 8 9 b
|
||||
+ * bmt_tbl[i].mapped:
|
||||
+ * N N N N N N N B
|
||||
+ * N - Not mapped(Available)
|
||||
+ * M - Mapped
|
||||
+ * B - BMT
|
||||
+ * ATTENTION:
|
||||
+ * BMT always in the last valid block in pool
|
||||
+ */
|
||||
+ while ((block = find_valid_block(block)) != 0) {
|
||||
+ bmt_tbl(bbt)[i].block = block;
|
||||
+ bmt_tbl(bbt)[i].mapped = NO_MAPPED;
|
||||
+ BBT_LOG("bmt_tbl[%d].block = 0x%x", i, block);
|
||||
+ block++;
|
||||
+ i++;
|
||||
+ }
|
||||
+
|
||||
+ /* i - How many available blocks in pool, which is the length of bmt_tbl[]
|
||||
+ * bmtd.bmt_blk_idx - bmt_tbl[bmtd.bmt_blk_idx].block => the BMT block
|
||||
+ */
|
||||
+ bmtd.bmt_blk_idx = i - 1;
|
||||
+ bmt_tbl(bbt)[bmtd.bmt_blk_idx].mapped = BMT_MAPPED;
|
||||
+
|
||||
+ if (i < 1) {
|
||||
+ pr_info("nand: FATAL ERR: no space to store BMT!!\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ pr_info("[BBT] %d available blocks in BMT pool\n", i);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static bool is_valid_bmt(unsigned char *buf, unsigned char *fdm)
|
||||
+{
|
||||
+ struct bbbt *bbt = (struct bbbt *)buf;
|
||||
+ u8 *sig = (u8*)bbt->signature + MAIN_SIGNATURE_OFFSET;
|
||||
+
|
||||
+
|
||||
+ if (memcmp(bbt->signature + MAIN_SIGNATURE_OFFSET, "BMT", 3) == 0 &&
|
||||
+ memcmp(fdm + OOB_SIGNATURE_OFFSET, "bmt", 3) == 0) {
|
||||
+ if (bbt->version == BBMT_VERSION)
|
||||
+ return true;
|
||||
+ }
|
||||
+ BBT_LOG("[BBT] BMT Version not match,upgrage preloader and uboot please! sig=%02x%02x%02x, fdm=%02x%02x%02x",
|
||||
+ sig[0], sig[1], sig[2],
|
||||
+ fdm[1], fdm[2], fdm[3]);
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static u16 get_bmt_index(struct bbmt *bmt)
|
||||
+{
|
||||
+ int i = 0;
|
||||
+
|
||||
+ while (bmt[i].block != BMT_TBL_DEF_VAL) {
|
||||
+ if (bmt[i].mapped == BMT_MAPPED)
|
||||
+ return i;
|
||||
+ i++;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct bbbt *scan_bmt(u16 block)
|
||||
+{
|
||||
+ u8 fdm[4];
|
||||
+
|
||||
+ if (block < bmtd.pool_lba)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (read_bmt(block, nand_bbt_buf, fdm, sizeof(fdm)))
|
||||
+ return scan_bmt(block - 1);
|
||||
+
|
||||
+ if (is_valid_bmt(nand_bbt_buf, fdm)) {
|
||||
+ bmtd.bmt_blk_idx = get_bmt_index(bmt_tbl((struct bbbt *)nand_bbt_buf));
|
||||
+ if (bmtd.bmt_blk_idx == 0) {
|
||||
+ pr_info("[BBT] FATAL ERR: bmt block index is wrong!\n");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ pr_info("[BBT] BMT.v2 is found at 0x%x\n", block);
|
||||
+ return (struct bbbt *)nand_bbt_buf;
|
||||
+ } else
|
||||
+ return scan_bmt(block - 1);
|
||||
+}
|
||||
+
|
||||
+/* Write the Burner Bad Block Table to Nand Flash
|
||||
+ * n - write BMT to bmt_tbl[n]
|
||||
+ */
|
||||
+static u16 upload_bmt(struct bbbt *bbt, int n)
|
||||
+{
|
||||
+ u16 block;
|
||||
+
|
||||
+retry:
|
||||
+ if (n < 0 || bmt_tbl(bbt)[n].mapped == NORMAL_MAPPED) {
|
||||
+ pr_info("nand: FATAL ERR: no space to store BMT!\n");
|
||||
+ return (u16)-1;
|
||||
+ }
|
||||
+
|
||||
+ block = bmt_tbl(bbt)[n].block;
|
||||
+ BBT_LOG("n = 0x%x, block = 0x%x", n, block);
|
||||
+ if (bbt_nand_erase(block)) {
|
||||
+ bmt_tbl(bbt)[n].block = 0;
|
||||
+ /* erase failed, try the previous block: bmt_tbl[n - 1].block */
|
||||
+ n--;
|
||||
+ goto retry;
|
||||
+ }
|
||||
+
|
||||
+ /* The signature offset is fixed set to 0,
|
||||
+ * oob signature offset is fixed set to 1
|
||||
+ */
|
||||
+ memcpy(bbt->signature + MAIN_SIGNATURE_OFFSET, "BMT", 3);
|
||||
+ bbt->version = BBMT_VERSION;
|
||||
+
|
||||
+ if (write_bmt(block, (unsigned char *)bbt)) {
|
||||
+ bmt_tbl(bbt)[n].block = 0;
|
||||
+
|
||||
+ /* write failed, try the previous block in bmt_tbl[n - 1] */
|
||||
+ n--;
|
||||
+ goto retry;
|
||||
+ }
|
||||
+
|
||||
+ /* Return the current index(n) of BMT pool (bmt_tbl[n]) */
|
||||
+ return n;
|
||||
+}
|
||||
+
|
||||
+static u16 find_valid_block_in_pool(struct bbbt *bbt)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ if (bmtd.bmt_blk_idx == 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ for (i = 0; i < bmtd.bmt_blk_idx; i++) {
|
||||
+ if (bmt_tbl(bbt)[i].block != 0 && bmt_tbl(bbt)[i].mapped == NO_MAPPED) {
|
||||
+ bmt_tbl(bbt)[i].mapped = NORMAL_MAPPED;
|
||||
+ return bmt_tbl(bbt)[i].block;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+error:
|
||||
+ pr_info("nand: FATAL ERR: BMT pool is run out!\n");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* We met a bad block, mark it as bad and map it to a valid block in pool,
|
||||
+ * if it's a write failure, we need to write the data to mapped block
|
||||
+ */
|
||||
+static bool update_bmt(u16 block)
|
||||
+{
|
||||
+ u16 mapped_blk;
|
||||
+ struct bbbt *bbt;
|
||||
+
|
||||
+ bbt = bmtd.bbt;
|
||||
+ mapped_blk = find_valid_block_in_pool(bbt);
|
||||
+ if (mapped_blk == 0)
|
||||
+ return false;
|
||||
+
|
||||
+ /* Map new bad block to available block in pool */
|
||||
+ bbt->bb_tbl[block] = mapped_blk;
|
||||
+ bmtd.bmt_blk_idx = upload_bmt(bbt, bmtd.bmt_blk_idx);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+u16 get_mapping_block_index(int block)
|
||||
+{
|
||||
+ int mapping_block;
|
||||
+
|
||||
+ if (block < bmtd.pool_lba)
|
||||
+ mapping_block = bmtd.bbt->bb_tbl[block];
|
||||
+ else
|
||||
+ mapping_block = block;
|
||||
+ BBT_LOG("0x%x mapped to 0x%x", block, mapping_block);
|
||||
+
|
||||
+ return mapping_block;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+mtk_bmt_read(struct mtd_info *mtd, loff_t from,
|
||||
+ struct mtd_oob_ops *ops)
|
||||
+{
|
||||
+ struct mtd_oob_ops cur_ops = *ops;
|
||||
+ int retry_count = 0;
|
||||
+ loff_t cur_from;
|
||||
+ int ret;
|
||||
+
|
||||
+ ops->retlen = 0;
|
||||
+ ops->oobretlen = 0;
|
||||
+
|
||||
+ while (ops->retlen < ops->len || ops->oobretlen < ops->ooblen) {
|
||||
+ u32 offset = from & (bmtd.blk_size - 1);
|
||||
+ u32 block = from >> bmtd.blk_shift;
|
||||
+ u32 cur_block;
|
||||
+
|
||||
+ cur_block = get_mapping_block_index(block);
|
||||
+ cur_from = ((loff_t)cur_block << bmtd.blk_shift) + offset;
|
||||
+
|
||||
+ cur_ops.oobretlen = 0;
|
||||
+ cur_ops.retlen = 0;
|
||||
+ cur_ops.len = min_t(u32, mtd->erasesize - offset,
|
||||
+ ops->len - ops->retlen);
|
||||
+ ret = bmtd._read_oob(mtd, cur_from, &cur_ops);
|
||||
+ if (ret < 0) {
|
||||
+ update_bmt(block);
|
||||
+ if (retry_count++ < 10)
|
||||
+ continue;
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ops->retlen += cur_ops.retlen;
|
||||
+ ops->oobretlen += cur_ops.oobretlen;
|
||||
+
|
||||
+ cur_ops.ooboffs = 0;
|
||||
+ cur_ops.datbuf += cur_ops.retlen;
|
||||
+ cur_ops.oobbuf += cur_ops.oobretlen;
|
||||
+ cur_ops.ooblen -= cur_ops.oobretlen;
|
||||
+
|
||||
+ if (!cur_ops.len)
|
||||
+ cur_ops.len = mtd->erasesize - offset;
|
||||
+
|
||||
+ from += cur_ops.len;
|
||||
+ retry_count = 0;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+mtk_bmt_write(struct mtd_info *mtd, loff_t to,
|
||||
+ struct mtd_oob_ops *ops)
|
||||
+{
|
||||
+ struct mtd_oob_ops cur_ops = *ops;
|
||||
+ int retry_count = 0;
|
||||
+ loff_t cur_to;
|
||||
+ int ret;
|
||||
+
|
||||
+ ops->retlen = 0;
|
||||
+ ops->oobretlen = 0;
|
||||
+
|
||||
+ while (ops->retlen < ops->len || ops->oobretlen < ops->ooblen) {
|
||||
+ u32 offset = to & (bmtd.blk_size - 1);
|
||||
+ u32 block = to >> bmtd.blk_shift;
|
||||
+ u32 cur_block;
|
||||
+
|
||||
+ cur_block = get_mapping_block_index(block);
|
||||
+ cur_to = ((loff_t)cur_block << bmtd.blk_shift) + offset;
|
||||
+
|
||||
+ cur_ops.oobretlen = 0;
|
||||
+ cur_ops.retlen = 0;
|
||||
+ cur_ops.len = min_t(u32, bmtd.blk_size - offset,
|
||||
+ ops->len - ops->retlen);
|
||||
+ ret = bmtd._write_oob(mtd, cur_to, &cur_ops);
|
||||
+ if (ret < 0) {
|
||||
+ update_bmt(block);
|
||||
+ if (retry_count++ < 10)
|
||||
+ continue;
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ops->retlen += cur_ops.retlen;
|
||||
+ ops->oobretlen += cur_ops.oobretlen;
|
||||
+
|
||||
+ cur_ops.ooboffs = 0;
|
||||
+ cur_ops.datbuf += cur_ops.retlen;
|
||||
+ cur_ops.oobbuf += cur_ops.oobretlen;
|
||||
+ cur_ops.ooblen -= cur_ops.oobretlen;
|
||||
+
|
||||
+ if (!cur_ops.len)
|
||||
+ cur_ops.len = mtd->erasesize - offset;
|
||||
+
|
||||
+ to += cur_ops.len;
|
||||
+ retry_count = 0;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+mtk_bmt_erase(struct nand_device *nand, const struct nand_pos *pos)
|
||||
+{
|
||||
+ struct nand_pos new_pos = *pos;
|
||||
+ int retry_count = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+retry:
|
||||
+ new_pos.eraseblock = get_mapping_block_index(pos->eraseblock);
|
||||
+
|
||||
+ ret = bmtd.nand_ops->erase(nand, &new_pos);
|
||||
+ if (ret) {
|
||||
+ update_bmt(pos->eraseblock);
|
||||
+ if (retry_count++ < 10)
|
||||
+ goto retry;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+mtk_bmt_isbad(struct nand_device *nand, const struct nand_pos *pos)
|
||||
+{
|
||||
+ struct nand_pos new_pos = *pos;
|
||||
+ int retry_count = 0;
|
||||
+ bool ret;
|
||||
+
|
||||
+retry:
|
||||
+ new_pos.eraseblock = get_mapping_block_index(pos->eraseblock);
|
||||
+
|
||||
+ ret = bmtd.nand_ops->isbad(nand, &new_pos);
|
||||
+ if (ret) {
|
||||
+ update_bmt(pos->eraseblock);
|
||||
+ if (retry_count++ < 10)
|
||||
+ goto retry;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+mtk_bmt_markbad(struct nand_device *nand, const struct nand_pos *pos)
|
||||
+{
|
||||
+ struct nand_pos new_pos = *pos;
|
||||
+
|
||||
+ new_pos.eraseblock = get_mapping_block_index(new_pos.eraseblock);
|
||||
+ update_bmt(pos->eraseblock);
|
||||
+
|
||||
+ return bmtd.nand_ops->markbad(nand, &new_pos);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+mtk_bmt_replace_ops(struct mtd_info *mtd)
|
||||
+{
|
||||
+ static const struct nand_ops mtk_bmt_nand_ops = {
|
||||
+ .erase = mtk_bmt_erase,
|
||||
+ .isbad = mtk_bmt_isbad,
|
||||
+ .markbad = mtk_bmt_markbad,
|
||||
+ };
|
||||
+ struct nand_device *nand = mtd_to_nanddev(mtd);
|
||||
+
|
||||
+ bmtd.nand_ops = nand->ops;
|
||||
+ bmtd._read_oob = mtd->_read_oob;
|
||||
+ bmtd._write_oob = mtd->_write_oob;
|
||||
+
|
||||
+ mtd->_read_oob = mtk_bmt_read;
|
||||
+ mtd->_write_oob = mtk_bmt_write;
|
||||
+ nand->ops = &mtk_bmt_nand_ops;
|
||||
+}
|
||||
+
|
||||
+static int mtk_bmt_debug_mark_good(void *data, u64 val)
|
||||
+{
|
||||
+ u32 block = val >> bmtd.blk_shift;
|
||||
+
|
||||
+ bmtd.bbt->bb_tbl[block] = block;
|
||||
+ bmtd.bmt_blk_idx = upload_bmt(bmtd.bbt, bmtd.bmt_blk_idx);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mtk_bmt_debug_mark_bad(void *data, u64 val)
|
||||
+{
|
||||
+ u32 block = val >> bmtd.blk_shift;
|
||||
+
|
||||
+ update_bmt(block);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+DEFINE_DEBUGFS_ATTRIBUTE(fops_mark_good, NULL, mtk_bmt_debug_mark_good, "%llu\n");
|
||||
+DEFINE_DEBUGFS_ATTRIBUTE(fops_mark_bad, NULL, mtk_bmt_debug_mark_bad, "%llu\n");
|
||||
+
|
||||
+static void
|
||||
+mtk_bmt_add_debugfs(void)
|
||||
+{
|
||||
+ struct dentry *dir;
|
||||
+
|
||||
+ dir = bmtd.debugfs_dir = debugfs_create_dir("mtk-bmt", NULL);
|
||||
+ if (!dir)
|
||||
+ return;
|
||||
+
|
||||
+ debugfs_create_file_unsafe("mark_good", S_IWUSR, dir, NULL, &fops_mark_good);
|
||||
+ debugfs_create_file_unsafe("mark_bad", S_IWUSR, dir, NULL, &fops_mark_bad);
|
||||
+}
|
||||
+
|
||||
+void mtk_bmt_detach(struct mtd_info *mtd)
|
||||
+{
|
||||
+ struct nand_device *nand = mtd_to_nanddev(mtd);
|
||||
+
|
||||
+ if (bmtd.mtd != mtd)
|
||||
+ return;
|
||||
+
|
||||
+ if (bmtd.debugfs_dir)
|
||||
+ debugfs_remove_recursive(bmtd.debugfs_dir);
|
||||
+ bmtd.debugfs_dir = NULL;
|
||||
+
|
||||
+ kfree(nand_bbt_buf);
|
||||
+ kfree(nand_data_buf);
|
||||
+
|
||||
+ mtd->_read_oob = bmtd._read_oob;
|
||||
+ mtd->_write_oob = bmtd._write_oob;
|
||||
+ mtd->size = bmtd.total_blks << bmtd.blk_shift;
|
||||
+ nand->ops = bmtd.nand_ops;
|
||||
+
|
||||
+ memset(&bmtd, 0, sizeof(bmtd));
|
||||
+}
|
||||
+
|
||||
+/* total_blocks - The total count of blocks that the Nand Chip has */
|
||||
+int mtk_bmt_attach(struct mtd_info *mtd)
|
||||
+{
|
||||
+ struct device_node *np;
|
||||
+ struct bbbt *bbt;
|
||||
+ u32 bufsz;
|
||||
+ u32 block;
|
||||
+ u16 total_blocks, pmt_block;
|
||||
+ int ret = 0;
|
||||
+ u32 bmt_pool_size, bmt_table_size;
|
||||
+
|
||||
+ if (bmtd.mtd)
|
||||
+ return -ENOSPC;
|
||||
+
|
||||
+ np = mtd_get_of_node(mtd);
|
||||
+ if (!np)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (!of_property_read_bool(np, "mediatek,bmt-v2"))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (of_property_read_u32(np, "mediatek,bmt-pool-size",
|
||||
+ &bmt_pool_size) != 0)
|
||||
+ bmt_pool_size = 80;
|
||||
+
|
||||
+ if (of_property_read_u8(np, "mediatek,bmt-oob-offset",
|
||||
+ &bmtd.oob_offset) != 0)
|
||||
+ bmtd.oob_offset = 0;
|
||||
+
|
||||
+ if (of_property_read_u32(np, "mediatek,bmt-table-size",
|
||||
+ &bmt_table_size) != 0)
|
||||
+ bmt_table_size = 0x2000U;
|
||||
+
|
||||
+ bmtd.mtd = mtd;
|
||||
+ mtk_bmt_replace_ops(mtd);
|
||||
+
|
||||
+ bmtd.table_size = bmt_table_size;
|
||||
+ bmtd.blk_size = mtd->erasesize;
|
||||
+ bmtd.blk_shift = ffs(bmtd.blk_size) - 1;
|
||||
+ bmtd.pg_size = mtd->writesize;
|
||||
+ bmtd.pg_shift = ffs(bmtd.pg_size) - 1;
|
||||
+ total_blocks = mtd->size >> bmtd.blk_shift;
|
||||
+ pmt_block = total_blocks - bmt_pool_size - 2;
|
||||
+
|
||||
+ mtd->size = pmt_block << bmtd.blk_shift;
|
||||
+
|
||||
+ /*
|
||||
+ * ---------------------------------------
|
||||
+ * | PMT(2blks) | BMT POOL(totalblks * 2%) |
|
||||
+ * ---------------------------------------
|
||||
+ * ^ ^
|
||||
+ * | |
|
||||
+ * pmt_block pmt_block + 2blocks(pool_lba)
|
||||
+ *
|
||||
+ * ATTETION!!!!!!
|
||||
+ * The blocks ahead of the boundary block are stored in bb_tbl
|
||||
+ * and blocks behind are stored in bmt_tbl
|
||||
+ */
|
||||
+
|
||||
+ bmtd.pool_lba = (u16)(pmt_block + 2);
|
||||
+ bmtd.total_blks = total_blocks;
|
||||
+ bmtd.bb_max = bmtd.total_blks * BBPOOL_RATIO / 100;
|
||||
+
|
||||
+ /* 3 buffers we need */
|
||||
+ bufsz = round_up(sizeof(struct bbbt) +
|
||||
+ bmt_table_size * sizeof(struct bbmt), bmtd.pg_size);
|
||||
+ bmtd.bmt_pgs = bufsz >> bmtd.pg_shift;
|
||||
+
|
||||
+ nand_bbt_buf = kzalloc(bufsz, GFP_KERNEL);
|
||||
+ nand_data_buf = kzalloc(bmtd.pg_size, GFP_KERNEL);
|
||||
+
|
||||
+ if (!nand_bbt_buf || !nand_data_buf) {
|
||||
+ pr_info("nand: FATAL ERR: allocate buffer failed!\n");
|
||||
+ ret = -1;
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ memset(nand_bbt_buf, 0xff, bufsz);
|
||||
+ memset(nand_data_buf, 0xff, bmtd.pg_size);
|
||||
+
|
||||
+ BBT_LOG("bbtbuf=0x%p(0x%x) dat=0x%p(0x%x)",
|
||||
+ nand_bbt_buf, bufsz, nand_data_buf, bmtd.pg_size);
|
||||
+ BBT_LOG("pool_lba=0x%x total_blks=0x%x bb_max=0x%x",
|
||||
+ bmtd.pool_lba, bmtd.total_blks, bmtd.bb_max);
|
||||
+
|
||||
+ /* Scanning start from the first page of the last block
|
||||
+ * of whole flash
|
||||
+ */
|
||||
+ bbt = scan_bmt(bmtd.total_blks - 1);
|
||||
+ if (!bbt) {
|
||||
+ /* BMT not found */
|
||||
+ if (bmtd.total_blks > BB_TABLE_MAX + BMT_TABLE_MAX) {
|
||||
+ pr_info("nand: FATAL: Too many blocks, can not support!\n");
|
||||
+ ret = -1;
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ bbt = (struct bbbt *)nand_bbt_buf;
|
||||
+ memset(bmt_tbl(bbt), BMT_TBL_DEF_VAL, bmtd.table_size * sizeof(struct bbmt));
|
||||
+
|
||||
+ if (scan_bad_blocks(bbt)) {
|
||||
+ ret = -1;
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ /* BMT always in the last valid block in pool */
|
||||
+ bmtd.bmt_blk_idx = upload_bmt(bbt, bmtd.bmt_blk_idx);
|
||||
+ block = bmt_tbl(bbt)[bmtd.bmt_blk_idx].block;
|
||||
+ pr_notice("[BBT] BMT.v2 is written into PBA:0x%x\n", block);
|
||||
+
|
||||
+ if (bmtd.bmt_blk_idx == 0)
|
||||
+ pr_info("nand: Warning: no available block in BMT pool!\n");
|
||||
+ else if (bmtd.bmt_blk_idx == (u16)-1) {
|
||||
+ ret = -1;
|
||||
+ goto error;
|
||||
+ }
|
||||
+ }
|
||||
+ mtk_bmt_add_debugfs();
|
||||
+
|
||||
+ bmtd.bbt = bbt;
|
||||
+ return 0;
|
||||
+
|
||||
+error:
|
||||
+ mtk_bmt_detach(mtd);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_AUTHOR("Xiangsheng Hou <xiangsheng.hou@mediatek.com>, Felix Fietkau <nbd@nbd.name>");
|
||||
+MODULE_DESCRIPTION("Bad Block mapping management v2 for MediaTek NAND Flash Driver");
|
||||
+
|
||||
--- /dev/null
|
||||
+++ b/include/linux/mtd/mtk_bmt.h
|
||||
@@ -0,0 +1,18 @@
|
||||
+#ifndef __MTK_BMT_H
|
||||
+#define __MTK_BMT_H
|
||||
+
|
||||
+#ifdef CONFIG_MTD_NAND_MTK_BMT
|
||||
+int mtk_bmt_attach(struct mtd_info *mtd);
|
||||
+void mtk_bmt_detach(struct mtd_info *mtd);
|
||||
+#else
|
||||
+static inline int mtk_bmt_attach(struct mtd_info *mtd)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static inline void mtk_bmt_detach(struct mtd_info *mtd)
|
||||
+{
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#endif
|
||||
--- a/drivers/mtd/mtk-snand/mtk-snand-mtd.c
|
||||
+++ b/drivers/mtd/mtk-snand/mtk-snand-mtd.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
+#include <linux/mtd/mtk_bmt.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/of_platform.h>
|
||||
|
||||
@@ -612,6 +613,8 @@ static int mtk_snand_probe(struct platfo
|
||||
mtd->_block_isbad = mtk_snand_mtd_block_isbad;
|
||||
mtd->_block_markbad = mtk_snand_mtd_block_markbad;
|
||||
|
||||
+ mtk_bmt_attach(mtd);
|
||||
+
|
||||
ret = mtd_device_register(mtd, NULL, 0);
|
||||
if (ret) {
|
||||
dev_err(msm->pdev.dev, "failed to register mtd partition\n");
|
||||
@@ -623,6 +626,7 @@ static int mtk_snand_probe(struct platfo
|
||||
return 0;
|
||||
|
||||
errout4:
|
||||
+ mtk_bmt_detach(mtd);
|
||||
devm_kfree(msm->pdev.dev, msm->page_cache);
|
||||
|
||||
errout3:
|
||||
@@ -650,6 +654,8 @@ static int mtk_snand_remove(struct platf
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ mtk_bmt_detach(mtd);
|
||||
+
|
||||
mtk_snand_cleanup(msm->snf);
|
||||
|
||||
if (msm->irq >= 0)
|
|
@ -0,0 +1,32 @@
|
|||
From a4d82940ff85a7e307953dfa715f65d5ab487e10 Mon Sep 17 00:00:00 2001
|
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Sun, 18 Apr 2021 23:46:14 +0200
|
||||
Subject: dt-bindings: mtd: brcm,trx: Add brcm,trx-magic
|
||||
|
||||
This adds the description of an additional property which allows to
|
||||
specify a custom partition parser magic to detect a trx partition.
|
||||
Buffalo has multiple device which are using the trx format, but with
|
||||
different magic values.
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Acked-by: Rob Herring <robh@kernel.org>
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Link: https://lore.kernel.org/linux-mtd/20210418214616.239574-2-hauke@hauke-m.de
|
||||
---
|
||||
.../devicetree/bindings/mtd/partitions/brcm,trx.txt | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
|
||||
+++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
|
||||
@@ -28,6 +28,11 @@ detected by a software parsing TRX heade
|
||||
Required properties:
|
||||
- compatible : (required) must be "brcm,trx"
|
||||
|
||||
+Optional properties:
|
||||
+
|
||||
+- brcm,trx-magic: TRX magic, if it is different from the default magic
|
||||
+ 0x30524448 as a u32.
|
||||
+
|
||||
Example:
|
||||
|
||||
flash@0 {
|
|
@ -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
|
||||
@@ -314,6 +314,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
|
||||
@@ -736,6 +736,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
|
||||
@@ -53,9 +53,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,33 @@
|
|||
--- a/drivers/tty/serial/8250/8250.h
|
||||
+++ b/drivers/tty/serial/8250/8250.h
|
||||
@@ -82,6 +82,7 @@ struct serial8250_config {
|
||||
#define UART_CAP_MINI (1 << 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_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
|
||||
#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
|
||||
--- a/drivers/tty/serial/8250/8250_port.c
|
||||
+++ b/drivers/tty/serial/8250/8250_port.c
|
||||
@@ -287,7 +287,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",
|
||||
@@ -2718,6 +2718,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,28 @@
|
|||
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
|
||||
@@ -95,6 +95,10 @@ static const struct flash_info winbond_p
|
||||
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
{ "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512,
|
||||
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
+ { "w25q512jv", INFO(0xef4020, 0, 64 * 1024, 1024,
|
||||
+ SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ |
|
||||
+ SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 |
|
||||
+ SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) },
|
||||
{ "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024,
|
||||
SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) },
|
||||
};
|
|
@ -0,0 +1,25 @@
|
|||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -334,6 +334,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
|
||||
@@ -88,6 +88,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,24 @@
|
|||
From 4823778b116c08e9c55dbc5b5042223289ea6a0c Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Wed, 31 Mar 2021 15:34:37 +0200
|
||||
Subject: [PATCH] net: mediatek: add flow offload for mt7623
|
||||
|
||||
mt7623 uses offload version 2 too
|
||||
|
||||
tested on Bananapi-R2
|
||||
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
---
|
||||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -3269,6 +3269,7 @@ static const struct mtk_soc_data mt7623_
|
||||
.hw_features = MTK_HW_FEATURES,
|
||||
.required_clks = MT7623_CLKS_BITMAP,
|
||||
.required_pctl = true,
|
||||
+ .offload_version = 2,
|
||||
};
|
||||
|
||||
static const struct mtk_soc_data mt7629_data = {
|
|
@ -0,0 +1,417 @@
|
|||
From patchwork Thu May 28 06:16:47 2020
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
X-Patchwork-Submitter: Chuanjia Liu <chuanjia.liu@mediatek.com>
|
||||
X-Patchwork-Id: 11574785
|
||||
Return-Path:
|
||||
<SRS0=ftSA=7K=lists.infradead.org=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@kernel.org>
|
||||
Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
|
||||
[172.30.200.123])
|
||||
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 933301391
|
||||
for <patchwork-linux-mediatek@patchwork.kernel.org>;
|
||||
Thu, 28 May 2020 06:19:16 +0000 (UTC)
|
||||
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 mail.kernel.org (Postfix) with ESMTPS id D19F02078C
|
||||
for <patchwork-linux-mediatek@patchwork.kernel.org>;
|
||||
Thu, 28 May 2020 06:19:15 +0000 (UTC)
|
||||
Authentication-Results: mail.kernel.org;
|
||||
dkim=pass (2048-bit key) header.d=lists.infradead.org
|
||||
header.i=@lists.infradead.org header.b="s8K7t7DF";
|
||||
dkim=fail reason="signature verification failed" (1024-bit key)
|
||||
header.d=mediatek.com header.i=@mediatek.com header.b="RhX81Iqp"
|
||||
DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D19F02078C
|
||||
Authentication-Results: mail.kernel.org;
|
||||
dmarc=fail (p=none dis=none) header.from=mediatek.com
|
||||
Authentication-Results: mail.kernel.org;
|
||||
spf=none
|
||||
smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org
|
||||
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
|
||||
d=lists.infradead.org; s=bombadil.20170209; h=Sender:
|
||||
Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:
|
||||
List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:
|
||||
Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description:
|
||||
Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
|
||||
List-Owner; bh=NHyHqNMcE7LW10MwduOJoKiWe8cv+XayY+L6WDZeSu0=; b=s8K7t7DFh1iQ5w
|
||||
eGvuMRgXEQv/YWRuSZRyX8lx8R2H9IuawEIgkhO6lEo6xv0VdsRuj8SptfoWg5afCItMhih373M21
|
||||
6sUy3tEiuKGgklfxLU0reLEkaATkKRGLJDY3eSSs1mvZDrydKuZLDTka+YDGaiESlOhqMr95Nm6YM
|
||||
yK8O00qTwSRPJUILRsBv1e/Kz8NRCmYhs56snABJkKeJ51NRAkb20R6qGTEd6UyBlz3jTVYwluLgF
|
||||
bdqzywDT6+BNg/Agh6Zd+v2PpO4cmwCpGm62+3UUyZkfi/aQ4qZ/AFAfSQI+3ZBAgsKMC1PGifOi/
|
||||
FgGxIvAUk6atBy7DAHuw==;
|
||||
Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org)
|
||||
by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux))
|
||||
id 1jeBsn-00025C-EF; Thu, 28 May 2020 06:19:13 +0000
|
||||
Received: from mailgw01.mediatek.com ([216.200.240.184])
|
||||
by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux))
|
||||
id 1jeBsZ-0001s4-6j; Thu, 28 May 2020 06:19:01 +0000
|
||||
X-UUID: c6210e6371fa445db0ae40a8b8a7a0a1-20200527
|
||||
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
|
||||
d=mediatek.com;
|
||||
s=dk;
|
||||
h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From;
|
||||
bh=X9AwTdbhpWmlWY4LjTm8KLq4Cca3YI9UnyCX3O0BAak=;
|
||||
b=RhX81Iqp0mWhBDyMQMFSEtt23+DGAWoin1SrFGP1bzp6GEtu38b2pK5RJVBshJtuxi/a1uMXZjeDsHJn02VGdNA07FrzZ7jq6YYEL+8cJs2DnhySmNElZazXPv2vKu9TWygfilTT24h/u8V/eszuRuhkdoUKWol8LwDlPl9gskg=;
|
||||
X-UUID: c6210e6371fa445db0ae40a8b8a7a0a1-20200527
|
||||
Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com
|
||||
(envelope-from <chuanjia.liu@mediatek.com>)
|
||||
(musrelay.mediatek.com ESMTP with TLS)
|
||||
with ESMTP id 7561992; Wed, 27 May 2020 22:19:17 -0800
|
||||
Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by
|
||||
MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id
|
||||
15.0.1497.2; Wed, 27 May 2020 23:18:47 -0700
|
||||
Received: from mtkcas07.mediatek.inc (172.21.101.84) by
|
||||
mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id
|
||||
15.0.1497.2; Thu, 28 May 2020 14:18:52 +0800
|
||||
Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc
|
||||
(172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
|
||||
Transport; Thu, 28 May 2020 14:18:51 +0800
|
||||
From: <chuanjia.liu@mediatek.com>
|
||||
To: <robh+dt@kernel.org>, <ryder.lee@mediatek.com>, <matthias.bgg@gmail.com>
|
||||
Subject: [PATCH v2 3/4] arm64: dts: mediatek: Split PCIe node for
|
||||
MT2712/MT7622
|
||||
Date: Thu, 28 May 2020 14:16:47 +0800
|
||||
Message-ID: <20200528061648.32078-4-chuanjia.liu@mediatek.com>
|
||||
X-Mailer: git-send-email 2.18.0
|
||||
In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com>
|
||||
References: <20200528061648.32078-1-chuanjia.liu@mediatek.com>
|
||||
MIME-Version: 1.0
|
||||
X-MTK: N
|
||||
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
|
||||
X-CRM114-CacheID: sfid-20200527_231859_253529_B6751C5A
|
||||
X-CRM114-Status: GOOD ( 12.20 )
|
||||
X-Spam-Score: -0.2 (/)
|
||||
X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary:
|
||||
Content analysis details: (-0.2 points)
|
||||
pts rule name description
|
||||
---- ----------------------
|
||||
--------------------------------------------------
|
||||
-0.0 SPF_PASS SPF: sender matches SPF record
|
||||
0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
|
||||
0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64
|
||||
encoding
|
||||
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
|
||||
author's domain
|
||||
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
|
||||
not necessarily
|
||||
valid
|
||||
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
|
||||
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
|
||||
envelope-from domain
|
||||
0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay
|
||||
lines
|
||||
X-BeenThere: linux-mediatek@lists.infradead.org
|
||||
X-Mailman-Version: 2.1.29
|
||||
Precedence: list
|
||||
List-Id: <linux-mediatek.lists.infradead.org>
|
||||
List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mediatek>,
|
||||
<mailto:linux-mediatek-request@lists.infradead.org?subject=unsubscribe>
|
||||
List-Archive: <http://lists.infradead.org/pipermail/linux-mediatek/>
|
||||
List-Post: <mailto:linux-mediatek@lists.infradead.org>
|
||||
List-Help: <mailto:linux-mediatek-request@lists.infradead.org?subject=help>
|
||||
List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mediatek>,
|
||||
<mailto:linux-mediatek-request@lists.infradead.org?subject=subscribe>
|
||||
Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com,
|
||||
srv_heupstream@mediatek.com, "chuanjia.liu" <Chuanjia.Liu@mediatek.com>,
|
||||
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org,
|
||||
yong.wu@mediatek.com, bhelgaas@google.com,
|
||||
linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk
|
||||
Sender: "Linux-mediatek" <linux-mediatek-bounces@lists.infradead.org>
|
||||
Errors-To:
|
||||
linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org
|
||||
|
||||
From: "chuanjia.liu" <Chuanjia.Liu@mediatek.com>
|
||||
|
||||
There are two independent PCIe controllers in MT2712/MT7622 platform,
|
||||
and each of them should contain an independent MSI domain.
|
||||
|
||||
In current architecture, MSI domain will be inherited from the root
|
||||
bridge, and all of the devices will share the same MSI domain.
|
||||
Hence that, the PCIe devices will not work properly if the irq number
|
||||
which required is more than 32.
|
||||
|
||||
Split the PCIe node for MT2712/MT7622 platform to fix MSI issue and
|
||||
comply with the hardware design.
|
||||
|
||||
Signed-off-by: chuanjia.liu <Chuanjia.Liu@mediatek.com>
|
||||
---
|
||||
arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 75 +++++++++++--------
|
||||
.../dts/mediatek/mt7622-bananapi-bpi-r64.dts | 16 ++--
|
||||
arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 6 +-
|
||||
arch/arm64/boot/dts/mediatek/mt7622.dtsi | 68 +++++++++++------
|
||||
4 files changed, 96 insertions(+), 69 deletions(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi
|
||||
@@ -915,60 +915,73 @@
|
||||
};
|
||||
};
|
||||
|
||||
- pcie: pcie@11700000 {
|
||||
+ pcie1: pcie@112ff000 {
|
||||
compatible = "mediatek,mt2712-pcie";
|
||||
device_type = "pci";
|
||||
- reg = <0 0x11700000 0 0x1000>,
|
||||
- <0 0x112ff000 0 0x1000>;
|
||||
- reg-names = "port0", "port1";
|
||||
+ reg = <0 0x112ff000 0 0x1000>;
|
||||
+ reg-names = "port1";
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
- interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
|
||||
- <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>,
|
||||
- <&topckgen CLK_TOP_PE2_MAC_P1_SEL>,
|
||||
- <&pericfg CLK_PERI_PCIE0>,
|
||||
+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "pcie_irq";
|
||||
+ clocks = <&topckgen CLK_TOP_PE2_MAC_P1_SEL>,
|
||||
<&pericfg CLK_PERI_PCIE1>;
|
||||
- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1";
|
||||
- phys = <&u3port0 PHY_TYPE_PCIE>, <&u3port1 PHY_TYPE_PCIE>;
|
||||
- phy-names = "pcie-phy0", "pcie-phy1";
|
||||
+ clock-names = "sys_ck1", "ahb_ck1";
|
||||
+ phys = <&u3port1 PHY_TYPE_PCIE>;
|
||||
+ phy-names = "pcie-phy1";
|
||||
bus-range = <0x00 0xff>;
|
||||
- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>;
|
||||
+ ranges = <0x82000000 0 0x11400000 0x0 0x11400000 0 0x300000>;
|
||||
+ status = "disabled";
|
||||
|
||||
- pcie0: pcie@0,0 {
|
||||
- device_type = "pci";
|
||||
- status = "disabled";
|
||||
- reg = <0x0000 0 0 0 0>;
|
||||
+ slot1: pcie@1,0 {
|
||||
+ reg = <0x0800 0 0 0 0>;
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
#interrupt-cells = <1>;
|
||||
ranges;
|
||||
interrupt-map-mask = <0 0 0 7>;
|
||||
- interrupt-map = <0 0 0 1 &pcie_intc0 0>,
|
||||
- <0 0 0 2 &pcie_intc0 1>,
|
||||
- <0 0 0 3 &pcie_intc0 2>,
|
||||
- <0 0 0 4 &pcie_intc0 3>;
|
||||
- pcie_intc0: interrupt-controller {
|
||||
+ interrupt-map = <0 0 0 1 &pcie_intc1 0>,
|
||||
+ <0 0 0 2 &pcie_intc1 1>,
|
||||
+ <0 0 0 3 &pcie_intc1 2>,
|
||||
+ <0 0 0 4 &pcie_intc1 3>;
|
||||
+ pcie_intc1: interrupt-controller {
|
||||
interrupt-controller;
|
||||
#address-cells = <0>;
|
||||
#interrupt-cells = <1>;
|
||||
};
|
||||
};
|
||||
+ };
|
||||
|
||||
- pcie1: pcie@1,0 {
|
||||
- device_type = "pci";
|
||||
- status = "disabled";
|
||||
- reg = <0x0800 0 0 0 0>;
|
||||
+ pcie0: pcie@11700000 {
|
||||
+ compatible = "mediatek,mt2712-pcie";
|
||||
+ device_type = "pci";
|
||||
+ reg = <0 0x11700000 0 0x1000>;
|
||||
+ reg-names = "port0";
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "pcie_irq";
|
||||
+ clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>,
|
||||
+ <&pericfg CLK_PERI_PCIE0>;
|
||||
+ clock-names = "sys_ck0", "ahb_ck0";
|
||||
+ phys = <&u3port0 PHY_TYPE_PCIE>;
|
||||
+ phy-names = "pcie-phy0";
|
||||
+ bus-range = <0x00 0xff>;
|
||||
+ ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ slot0: pcie@0,0 {
|
||||
+ reg = <0x0000 0 0 0 0>;
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
#interrupt-cells = <1>;
|
||||
ranges;
|
||||
interrupt-map-mask = <0 0 0 7>;
|
||||
- interrupt-map = <0 0 0 1 &pcie_intc1 0>,
|
||||
- <0 0 0 2 &pcie_intc1 1>,
|
||||
- <0 0 0 3 &pcie_intc1 2>,
|
||||
- <0 0 0 4 &pcie_intc1 3>;
|
||||
- pcie_intc1: interrupt-controller {
|
||||
+ interrupt-map = <0 0 0 1 &pcie_intc0 0>,
|
||||
+ <0 0 0 2 &pcie_intc0 1>,
|
||||
+ <0 0 0 3 &pcie_intc0 2>,
|
||||
+ <0 0 0 4 &pcie_intc0 3>;
|
||||
+ pcie_intc0: interrupt-controller {
|
||||
interrupt-controller;
|
||||
#address-cells = <0>;
|
||||
#interrupt-cells = <1>;
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -288,18 +288,16 @@
|
||||
};
|
||||
};
|
||||
|
||||
-&pcie {
|
||||
+&pcie0 {
|
||||
pinctrl-names = "default";
|
||||
- pinctrl-0 = <&pcie0_pins>, <&pcie1_pins>;
|
||||
+ pinctrl-0 = <&pcie0_pins>;
|
||||
status = "okay";
|
||||
+};
|
||||
|
||||
- pcie@0,0 {
|
||||
- status = "okay";
|
||||
- };
|
||||
-
|
||||
- pcie@1,0 {
|
||||
- status = "okay";
|
||||
- };
|
||||
+&pcie1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pcie1_pins>;
|
||||
+ status = "okay";
|
||||
};
|
||||
|
||||
&pio {
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -802,45 +802,41 @@
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
- pcie: pcie@1a140000 {
|
||||
+ pciecfg: pciecfg@1a140000 {
|
||||
+ compatible = "mediatek,mt7622-pciecfg", "syscon";
|
||||
+ reg = <0 0x1a140000 0 0x1000>;
|
||||
+ };
|
||||
+
|
||||
+ pcie0: pcie@1a143000 {
|
||||
compatible = "mediatek,mt7622-pcie";
|
||||
device_type = "pci";
|
||||
- reg = <0 0x1a140000 0 0x1000>,
|
||||
- <0 0x1a143000 0 0x1000>,
|
||||
- <0 0x1a145000 0 0x1000>;
|
||||
- reg-names = "subsys", "port0", "port1";
|
||||
+ reg = <0 0x1a143000 0 0x1000>;
|
||||
+ reg-names = "port0";
|
||||
+ mediatek,pcie-cfg = <&pciecfg>;
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
- interrupts = <GIC_SPI 228 IRQ_TYPE_LEVEL_LOW>,
|
||||
- <GIC_SPI 229 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupts = <GIC_SPI 228 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupt-names = "pcie_irq";
|
||||
clocks = <&pciesys CLK_PCIE_P0_MAC_EN>,
|
||||
- <&pciesys CLK_PCIE_P1_MAC_EN>,
|
||||
- <&pciesys CLK_PCIE_P0_AHB_EN>,
|
||||
<&pciesys CLK_PCIE_P0_AHB_EN>,
|
||||
<&pciesys CLK_PCIE_P0_AUX_EN>,
|
||||
- <&pciesys CLK_PCIE_P1_AUX_EN>,
|
||||
<&pciesys CLK_PCIE_P0_AXI_EN>,
|
||||
- <&pciesys CLK_PCIE_P1_AXI_EN>,
|
||||
<&pciesys CLK_PCIE_P0_OBFF_EN>,
|
||||
- <&pciesys CLK_PCIE_P1_OBFF_EN>,
|
||||
- <&pciesys CLK_PCIE_P0_PIPE_EN>,
|
||||
- <&pciesys CLK_PCIE_P1_PIPE_EN>;
|
||||
- clock-names = "sys_ck0", "sys_ck1", "ahb_ck0", "ahb_ck1",
|
||||
- "aux_ck0", "aux_ck1", "axi_ck0", "axi_ck1",
|
||||
- "obff_ck0", "obff_ck1", "pipe_ck0", "pipe_ck1";
|
||||
+ <&pciesys CLK_PCIE_P0_PIPE_EN>;
|
||||
+ clock-names = "sys_ck0", "ahb_ck0", "aux_ck0",
|
||||
+ "axi_ck0", "obff_ck0", "pipe_ck0";
|
||||
+
|
||||
power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>;
|
||||
bus-range = <0x00 0xff>;
|
||||
- ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>;
|
||||
+ ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x8000000>;
|
||||
status = "disabled";
|
||||
|
||||
- pcie0: pcie@0,0 {
|
||||
+ slot0: pcie@0,0 {
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
#interrupt-cells = <1>;
|
||||
ranges;
|
||||
- status = "disabled";
|
||||
-
|
||||
interrupt-map-mask = <0 0 0 7>;
|
||||
interrupt-map = <0 0 0 1 &pcie_intc0 0>,
|
||||
<0 0 0 2 &pcie_intc0 1>,
|
||||
@@ -852,15 +848,39 @@
|
||||
#interrupt-cells = <1>;
|
||||
};
|
||||
};
|
||||
+ };
|
||||
|
||||
- pcie1: pcie@1,0 {
|
||||
+ pcie1: pcie@1a145000 {
|
||||
+ compatible = "mediatek,mt7622-pcie";
|
||||
+ device_type = "pci";
|
||||
+ reg = <0 0x1a145000 0 0x1000>;
|
||||
+ reg-names = "port1";
|
||||
+ mediatek,pcie-cfg = <&pciecfg>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ interrupts = <GIC_SPI 229 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupt-names = "pcie_irq";
|
||||
+ clocks = <&pciesys CLK_PCIE_P1_MAC_EN>,
|
||||
+ /* designer has connect RC1 with p0_ahb clock */
|
||||
+ <&pciesys CLK_PCIE_P0_AHB_EN>,
|
||||
+ <&pciesys CLK_PCIE_P1_AUX_EN>,
|
||||
+ <&pciesys CLK_PCIE_P1_AXI_EN>,
|
||||
+ <&pciesys CLK_PCIE_P1_OBFF_EN>,
|
||||
+ <&pciesys CLK_PCIE_P1_PIPE_EN>;
|
||||
+ clock-names = "sys_ck1", "ahb_ck1", "aux_ck1",
|
||||
+ "axi_ck1", "obff_ck1", "pipe_ck1";
|
||||
+
|
||||
+ power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>;
|
||||
+ bus-range = <0x00 0xff>;
|
||||
+ ranges = <0x82000000 0 0x28000000 0x0 0x28000000 0 0x8000000>;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ slot1: pcie@1,0 {
|
||||
reg = <0x0800 0 0 0 0>;
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
#interrupt-cells = <1>;
|
||||
ranges;
|
||||
- status = "disabled";
|
||||
-
|
||||
interrupt-map-mask = <0 0 0 7>;
|
||||
interrupt-map = <0 0 0 1 &pcie_intc1 0>,
|
||||
<0 0 0 2 &pcie_intc1 1>,
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
@@ -232,18 +232,16 @@
|
||||
};
|
||||
};
|
||||
|
||||
-&pcie {
|
||||
+&pcie0 {
|
||||
pinctrl-names = "default";
|
||||
- pinctrl-0 = <&pcie0_pins>, <&pcie1_pins>;
|
||||
+ pinctrl-0 = <&pcie0_pins>;
|
||||
status = "okay";
|
||||
+};
|
||||
|
||||
- pcie@0,0 {
|
||||
- status = "okay";
|
||||
- };
|
||||
-
|
||||
- pcie@1,0 {
|
||||
- status = "okay";
|
||||
- };
|
||||
+&pcie1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pcie1_pins>;
|
||||
+ status = "okay";
|
||||
};
|
||||
|
||||
&pio {
|
|
@ -0,0 +1,203 @@
|
|||
From patchwork Thu May 28 06:16:48 2020
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
X-Patchwork-Submitter: Chuanjia Liu <chuanjia.liu@mediatek.com>
|
||||
X-Patchwork-Id: 11574797
|
||||
Return-Path:
|
||||
<SRS0=ftSA=7K=lists.infradead.org=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@kernel.org>
|
||||
Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
|
||||
[172.30.200.123])
|
||||
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30A5E1392
|
||||
for <patchwork-linux-mediatek@patchwork.kernel.org>;
|
||||
Thu, 28 May 2020 06:29:05 +0000 (UTC)
|
||||
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 mail.kernel.org (Postfix) with ESMTPS id 08B6320721
|
||||
for <patchwork-linux-mediatek@patchwork.kernel.org>;
|
||||
Thu, 28 May 2020 06:29:05 +0000 (UTC)
|
||||
Authentication-Results: mail.kernel.org;
|
||||
dkim=pass (2048-bit key) header.d=lists.infradead.org
|
||||
header.i=@lists.infradead.org header.b="auhxDafY";
|
||||
dkim=fail reason="signature verification failed" (1024-bit key)
|
||||
header.d=mediatek.com header.i=@mediatek.com header.b="Kj09Arxb"
|
||||
DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08B6320721
|
||||
Authentication-Results: mail.kernel.org;
|
||||
dmarc=fail (p=none dis=none) header.from=mediatek.com
|
||||
Authentication-Results: mail.kernel.org;
|
||||
spf=none
|
||||
smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org
|
||||
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
|
||||
d=lists.infradead.org; s=bombadil.20170209; h=Sender:
|
||||
Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:
|
||||
List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:
|
||||
Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description:
|
||||
Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
|
||||
List-Owner; bh=+QPxF1vlOH7StIZYuXJa3V40x8QVDxCLF9AFXHblB9M=; b=auhxDafYBeaUZO
|
||||
aYp2KVO8Aie0v4tYtRwBon7hF+x55JwD78SAxQR2RsSvrlOo9cMYYby+ToUWflVUWQ60FapAl+w+l
|
||||
nkEjIOrLBErHwxNOcsD8T5kjyCBMqlz4OMAQYUDNJ3fSugRlGhOtxkjCGd9ebB8N2Rvu6/U8P1A9n
|
||||
P15mEQoc+RLonR1+9mBgwTEXErjsraxkimTD4Txsp4IvMs3UdsMkP+r3OT5S/p+Uj6O9ES0h7xIon
|
||||
aL79KaVqRLHrfZxnrVwuGiecAiTp8qLy9clHuJU32NA6ZcXH1OnWipKApgp8Ck7ys80WPKaMrat9B
|
||||
XuskJ63w13DZAbCVvuGQ==;
|
||||
Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org)
|
||||
by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux))
|
||||
id 1jeC2J-00014n-M9; Thu, 28 May 2020 06:29:03 +0000
|
||||
Received: from mailgw02.mediatek.com ([216.200.240.185])
|
||||
by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux))
|
||||
id 1jeC2H-00013t-Li; Thu, 28 May 2020 06:29:03 +0000
|
||||
X-UUID: a4877c1586e64afeb2d6172e10605d2b-20200527
|
||||
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
|
||||
d=mediatek.com;
|
||||
s=dk;
|
||||
h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From;
|
||||
bh=CIwcBFK1x0LbOjDt1BG6/knHFxDHRiqj8ov/jWEZDBY=;
|
||||
b=Kj09ArxbnLVTc9bpaVPT3jQrIVjhL87sSYyVF9dFypS976k78Ce9gZd0f4K3zAZbYZHYoQtuyOQ9TOeufQfgD+Cr+j5VR7pTdO2E1iXHFs/eQAz5gAjvjlK01z1JiunrLnn9dvIr6c1gEkjQHny0VpuZ1duxx79jwYusg/Nw6Wc=;
|
||||
X-UUID: a4877c1586e64afeb2d6172e10605d2b-20200527
|
||||
Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by
|
||||
mailgw02.mediatek.com
|
||||
(envelope-from <chuanjia.liu@mediatek.com>)
|
||||
(musrelay.mediatek.com ESMTP with TLS)
|
||||
with ESMTP id 899663677; Wed, 27 May 2020 22:29:21 -0800
|
||||
Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by
|
||||
MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id
|
||||
15.0.1497.2; Wed, 27 May 2020 23:18:50 -0700
|
||||
Received: from mtkcas07.mediatek.inc (172.21.101.84) by
|
||||
mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id
|
||||
15.0.1497.2; Thu, 28 May 2020 14:18:54 +0800
|
||||
Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc
|
||||
(172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
|
||||
Transport; Thu, 28 May 2020 14:18:52 +0800
|
||||
From: <chuanjia.liu@mediatek.com>
|
||||
To: <robh+dt@kernel.org>, <ryder.lee@mediatek.com>, <matthias.bgg@gmail.com>
|
||||
Subject: [PATCH v2 4/4] ARM: dts: mediatek: Update mt7629 PCIe node
|
||||
Date: Thu, 28 May 2020 14:16:48 +0800
|
||||
Message-ID: <20200528061648.32078-5-chuanjia.liu@mediatek.com>
|
||||
X-Mailer: git-send-email 2.18.0
|
||||
In-Reply-To: <20200528061648.32078-1-chuanjia.liu@mediatek.com>
|
||||
References: <20200528061648.32078-1-chuanjia.liu@mediatek.com>
|
||||
MIME-Version: 1.0
|
||||
X-MTK: N
|
||||
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
|
||||
X-CRM114-CacheID: sfid-20200527_232901_719172_E5A99C62
|
||||
X-CRM114-Status: GOOD ( 11.61 )
|
||||
X-Spam-Score: -0.2 (/)
|
||||
X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary:
|
||||
Content analysis details: (-0.2 points)
|
||||
pts rule name description
|
||||
---- ----------------------
|
||||
--------------------------------------------------
|
||||
-0.0 SPF_PASS SPF: sender matches SPF record
|
||||
0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
|
||||
0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64
|
||||
encoding
|
||||
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
|
||||
author's domain
|
||||
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
|
||||
not necessarily
|
||||
valid
|
||||
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
|
||||
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
|
||||
envelope-from domain
|
||||
0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay
|
||||
lines
|
||||
X-BeenThere: linux-mediatek@lists.infradead.org
|
||||
X-Mailman-Version: 2.1.29
|
||||
Precedence: list
|
||||
List-Id: <linux-mediatek.lists.infradead.org>
|
||||
List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mediatek>,
|
||||
<mailto:linux-mediatek-request@lists.infradead.org?subject=unsubscribe>
|
||||
List-Archive: <http://lists.infradead.org/pipermail/linux-mediatek/>
|
||||
List-Post: <mailto:linux-mediatek@lists.infradead.org>
|
||||
List-Help: <mailto:linux-mediatek-request@lists.infradead.org?subject=help>
|
||||
List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mediatek>,
|
||||
<mailto:linux-mediatek-request@lists.infradead.org?subject=subscribe>
|
||||
Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com,
|
||||
srv_heupstream@mediatek.com, "chuanjia.liu" <Chuanjia.Liu@mediatek.com>,
|
||||
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org,
|
||||
yong.wu@mediatek.com, bhelgaas@google.com,
|
||||
linux-arm-kernel@lists.infradead.org, amurray@thegoodpenguin.co.uk
|
||||
Sender: "Linux-mediatek" <linux-mediatek-bounces@lists.infradead.org>
|
||||
Errors-To:
|
||||
linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org
|
||||
|
||||
From: "chuanjia.liu" <Chuanjia.Liu@mediatek.com>
|
||||
|
||||
Remove unused property and add pciecfg node.
|
||||
|
||||
Signed-off-by: chuanjia.liu <Chuanjia.Liu@mediatek.com>
|
||||
---
|
||||
arch/arm/boot/dts/mt7629-rfb.dts | 3 ++-
|
||||
arch/arm/boot/dts/mt7629.dtsi | 23 +++++++++++++----------
|
||||
2 files changed, 15 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/arch/arm/boot/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/boot/dts/mt7629-rfb.dts
|
||||
@@ -149,9 +149,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
-&pcie {
|
||||
+&pcie1 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pcie_pins>;
|
||||
+ status = "okay";
|
||||
};
|
||||
|
||||
&pciephy1 {
|
||||
--- a/arch/arm/boot/dts/mt7629.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7629.dtsi
|
||||
@@ -376,16 +376,21 @@
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
- pcie: pcie@1a140000 {
|
||||
+ pciecfg: pciecfg@1a140000 {
|
||||
+ compatible = "mediatek,mt7629-pciecfg", "syscon";
|
||||
+ reg = <0x1a140000 0x1000>;
|
||||
+ };
|
||||
+
|
||||
+ pcie1: pcie@1a145000 {
|
||||
compatible = "mediatek,mt7629-pcie";
|
||||
device_type = "pci";
|
||||
- reg = <0x1a140000 0x1000>,
|
||||
- <0x1a145000 0x1000>;
|
||||
- reg-names = "subsys","port1";
|
||||
+ reg = <0x1a145000 0x1000>;
|
||||
+ reg-names = "port1";
|
||||
+ mediatek,pcie-cfg = <&pciecfg>;
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
- interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_LOW>,
|
||||
- <GIC_SPI 229 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupts = <GIC_SPI 229 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupt-names = "pcie_irq";
|
||||
clocks = <&pciesys CLK_PCIE_P1_MAC_EN>,
|
||||
<&pciesys CLK_PCIE_P0_AHB_EN>,
|
||||
<&pciesys CLK_PCIE_P1_AUX_EN>,
|
||||
@@ -406,21 +411,19 @@
|
||||
power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>;
|
||||
bus-range = <0x00 0xff>;
|
||||
ranges = <0x82000000 0 0x20000000 0x20000000 0 0x10000000>;
|
||||
+ status = "disabled";
|
||||
|
||||
- pcie1: pcie@1,0 {
|
||||
- device_type = "pci";
|
||||
+ slot1: pcie@1,0 {
|
||||
reg = <0x0800 0 0 0 0>;
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
#interrupt-cells = <1>;
|
||||
ranges;
|
||||
- num-lanes = <1>;
|
||||
interrupt-map-mask = <0 0 0 7>;
|
||||
interrupt-map = <0 0 0 1 &pcie_intc1 0>,
|
||||
<0 0 0 2 &pcie_intc1 1>,
|
||||
<0 0 0 3 &pcie_intc1 2>,
|
||||
<0 0 0 4 &pcie_intc1 3>;
|
||||
-
|
||||
pcie_intc1: interrupt-controller {
|
||||
interrupt-controller;
|
||||
#address-cells = <0>;
|
|
@ -0,0 +1,85 @@
|
|||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 4 Sep 2020 18:36:06 +0200
|
||||
Subject: [PATCH] net: ethernet: mtk_eth_soc: add support for coherent DMA
|
||||
|
||||
It improves performance by eliminating the need for a cache flush on rx and tx
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
@@ -364,7 +364,7 @@
|
||||
};
|
||||
|
||||
cci_control2: slave-if@5000 {
|
||||
- compatible = "arm,cci-400-ctrl-if";
|
||||
+ compatible = "arm,cci-400-ctrl-if", "syscon";
|
||||
interface-type = "ace";
|
||||
reg = <0x5000 0x1000>;
|
||||
};
|
||||
@@ -977,6 +977,8 @@
|
||||
power-domains = <&scpsys MT7622_POWER_DOMAIN_ETHSYS>;
|
||||
mediatek,ethsys = <ðsys>;
|
||||
mediatek,sgmiisys = <&sgmiisys>;
|
||||
+ mediatek,cci-control = <&cci_control2>;
|
||||
+ dma-coherent;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
status = "disabled";
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_mdio.h>
|
||||
#include <linux/of_net.h>
|
||||
+#include <linux/of_address.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/clk.h>
|
||||
@@ -2494,6 +2495,13 @@ static int mtk_hw_init(struct mtk_eth *e
|
||||
if (ret)
|
||||
goto err_disable_pm;
|
||||
|
||||
+ if (of_dma_is_coherent(eth->dev->of_node)) {
|
||||
+ u32 mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA |
|
||||
+ ETHSYS_DMA_AG_MAP_PPE;
|
||||
+
|
||||
+ regmap_update_bits(eth->ethsys, ETHSYS_DMA_AG_MAP, mask, mask);
|
||||
+ }
|
||||
+
|
||||
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
|
||||
ret = device_reset(eth->dev);
|
||||
if (ret) {
|
||||
@@ -3071,6 +3079,16 @@ static int mtk_probe(struct platform_dev
|
||||
}
|
||||
}
|
||||
|
||||
+ if (of_dma_is_coherent(pdev->dev.of_node)) {
|
||||
+ struct regmap *cci;
|
||||
+
|
||||
+ cci = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
|
||||
+ "mediatek,cci-control");
|
||||
+ /* enable CPU/bus coherency */
|
||||
+ if (!IS_ERR(cci))
|
||||
+ regmap_write(cci, 0, 3);
|
||||
+ }
|
||||
+
|
||||
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) {
|
||||
eth->sgmii = devm_kzalloc(eth->dev, sizeof(*eth->sgmii),
|
||||
GFP_KERNEL);
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -450,6 +450,12 @@
|
||||
#define RSTCTRL_FE BIT(6)
|
||||
#define RSTCTRL_PPE BIT(31)
|
||||
|
||||
+/* ethernet dma channel agent map */
|
||||
+#define ETHSYS_DMA_AG_MAP 0x408
|
||||
+#define ETHSYS_DMA_AG_MAP_PDMA BIT(0)
|
||||
+#define ETHSYS_DMA_AG_MAP_QDMA BIT(1)
|
||||
+#define ETHSYS_DMA_AG_MAP_PPE BIT(2)
|
||||
+
|
||||
/* SGMII subsystem config registers */
|
||||
/* Register to auto-negotiation restart */
|
||||
#define SGMSYS_PCS_CONTROL_1 0x0
|
|
@ -0,0 +1,29 @@
|
|||
--- a/drivers/leds/Kconfig
|
||||
+++ b/drivers/leds/Kconfig
|
||||
@@ -929,6 +929,16 @@ config LEDS_ACER_A500
|
||||
This option enables support for the Power Button LED of
|
||||
Acer Iconia Tab A500.
|
||||
|
||||
+config LEDS_UBNT_LEDBAR
|
||||
+ tristate "LED support for Ubiquiti UniFi 6 LR"
|
||||
+ depends on LEDS_CLASS && I2C && OF
|
||||
+ help
|
||||
+ This option enables support for the Ubiquiti LEDBAR
|
||||
+ LED driver.
|
||||
+
|
||||
+ To compile this driver as a module, choose M here: the module
|
||||
+ will be called leds-ubnt-ledbar.
|
||||
+
|
||||
comment "LED Triggers"
|
||||
source "drivers/leds/trigger/Kconfig"
|
||||
|
||||
--- a/drivers/leds/Makefile
|
||||
+++ b/drivers/leds/Makefile
|
||||
@@ -93,6 +93,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds
|
||||
obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o
|
||||
obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o
|
||||
obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
|
||||
+obj-$(CONFIG_LEDS_UBNT_LEDBAR) += leds-ubnt-ledbar.o
|
||||
|
||||
# LED SPI Drivers
|
||||
obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o
|
|
@ -0,0 +1,80 @@
|
|||
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -297,14 +297,14 @@
|
||||
&pcie1 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pcie1_pins>;
|
||||
- status = "okay";
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
&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 {
|
||||
+ 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,24 @@
|
||||
+/* 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>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ fragment@1 {
|
||||
+ target = <&pcie1>;
|
||||
+ __overlay__ {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
Loading…
Add table
Add a link
Reference in a new issue