[PATCH 00/29] Add support for MediaTek MT7988 SoC

2023-07-19 Thread Weijie Gao
://www.mediatek.com/products/broadband-wifi/mediatek-filogic-880 Weijie Gao (29): arm: mediatek: retrieve ram_base from dts node for armv8 platform board: mediatek: update config headers spi: mtk_spim: get spi clk rate only once spi: mtk_spim: clear IRQ enable bits serial: mtk: initial

[PATCH 02/29] board: mediatek: update config headers

2023-07-19 Thread Weijie Gao
Remove unused information from include/configs/mt.h Signed-off-by: Weijie Gao --- include/configs/mt7620.h | 3 +-- include/configs/mt7621.h | 6 ++ include/configs/mt7623.h | 8 include/configs/mt7628.h | 5 ++--- include/configs/mt7629.h | 13 + 5 files

[PATCH 03/29] spi: mtk_spim: get spi clk rate only once

2023-07-19 Thread Weijie Gao
We don't really need to switch clk rate during operating SPIM controller. Get clk rate only once at driver probing. Signed-off-by: SkyLake.Huang Signed-off-by: Weijie Gao --- drivers/spi/mtk_spim.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --

[PATCH 01/29] arm: mediatek: retrieve ram_base from dts node for armv8 platform

2023-07-19 Thread Weijie Gao
Now we use fdtdec_setup_mem_size_base() to get DRAM base from fdt ram node and update gd->ram_base. CFG_SYS_SDRAM_BASE is unused and will be removed. Also, since mt7622 always passes fdt to linux kernel, there's no need to assign value to gd->bd->bi_boot_params. Signed-off-

[PATCH 04/29] spi: mtk_spim: clear IRQ enable bits

2023-07-19 Thread Weijie Gao
izing the spim driver due to IRQ event happens before IRQ handler is properly setup. This patch clear IRQ bits to prevent this from happening. Signed-off-by: SkyLake.Huang Signed-off-by: Weijie Gao --- drivers/spi/mtk_spim.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/spi/mtk_s

[PATCH 05/29] serial: mtk: initial priv data before using

2023-07-19 Thread Weijie Gao
This patch ensures driver private data being fully initialized in _debug_uart_init which is not covered by .priv_auto ops. Signed-off-by: Sam Shih Signed-off-by: Weijie Gao --- drivers/serial/serial_mtk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/serial/serial_mtk.c b/drivers

[PATCH 06/29] reset: mediatek: check malloc return valaue before use

2023-07-19 Thread Weijie Gao
This patch add missing return value check for allocating the driver's private data. -ENOMEM will be returned if malloc() fails. Signed-off-by: Sam Shih Signed-off-by: Weijie Gao --- drivers/reset/reset-mediatek.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/reset/

[PATCH 07/29] i2c: mediatek: fix I2C usability for MT7981

2023-07-19 Thread Weijie Gao
MT7981 actually uses MediaTek I2C controller v3 instead of v1. This patch adds support for I2C controller v3 fix fixes the I2C usability for MT7981. Signed-off-by: Sam Shih Signed-off-by: Weijie Gao --- drivers/i2c/mtk_i2c.c | 45 +-- 1 file changed, 43

[PATCH 08/29] arm: dts: enable i2c support for MediaTek MT7981

2023-07-19 Thread Weijie Gao
This patch enables i2c support for MediaTek MT7981 Signed-off-by: Sam Shih Signed-off-by: Weijie Gao --- arch/arm/dts/mt7981.dtsi | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/dts/mt7981.dtsi b/arch/arm/dts/mt7981.dtsi index 2c8ef14f98..2053e2ca00 100644 --- a

[PATCH 09/29] pwm: mtk: add support for MediaTek MT7988 SoC

2023-07-19 Thread Weijie Gao
This patch adds PWM support for MediaTek MT7988 SoC. Signed-off-by: Weijie Gao --- drivers/pwm/pwm-mtk.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/pwm/pwm-mtk.c b/drivers/pwm/pwm-mtk.c index 605142eab0..11e7444019 100644 --- a/drivers/pwm/pwm-mtk.c +++ b/drivers/pwm/pwm

[PATCH 11/29] reset: mediatek: add reset definition for MediaTek MT7988 SoC

2023-07-19 Thread Weijie Gao
This patch adds reset bits for MediaTek MT7988 Signed-off-by: Sam Shih Signed-off-by: Weijie Gao --- include/dt-bindings/reset/mt7988-reset.h | 31 1 file changed, 31 insertions(+) create mode 100644 include/dt-bindings/reset/mt7988-reset.h diff --git a/include/dt

[PATCH 10/29] clk: mediatek: add clock driver support for MediaTek MT7988 SoC

2023-07-19 Thread Weijie Gao
This patch adds clock driver support for MediaTek MT7988 SoC Signed-off-by: Weijie Gao --- drivers/clk/mediatek/Makefile |1 + drivers/clk/mediatek/clk-mt7988.c | 1123 include/dt-bindings/clock/mt7988-clk.h | 349 3 files changed, 1473

[PATCH 13/29] pinctrl: mediatek: fix the return value in driving configuration functions

2023-07-19 Thread Weijie Gao
The original mediatek pinctrl functions for driving configuration 'mtk_pinconf_drive_set_*' do not return -ENOSUPP even if input parameters are not supported. This patch fixes the return value in those functions. Signed-off-by: Sam Shih Signed-off-by: Weijie Gao --- drivers/pinctr

[PATCH 14/29] pinctrl: mediatek: add pinmux_set ops support

2023-07-19 Thread Weijie Gao
This patch adds pinmux_set ops for mediatek pinctrl framework Signed-off-by: Sam Shih Signed-off-by: Weijie Gao --- drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl

[PATCH 15/29] pinctrl: mediatek: add pinctrl driver for MT7988 SoC

2023-07-19 Thread Weijie Gao
This patch adds pinctrl and gpio support for MT7988 SoC Signed-off-by: Weijie Gao --- drivers/pinctrl/mediatek/Kconfig |4 + drivers/pinctrl/mediatek/Makefile |1 + drivers/pinctrl/mediatek/pinctrl-mt7988.c | 1274 + 3 files changed, 1279 insertions

[PATCH 17/29] net: mediatek: optimize the switch reset delay wait time

2023-07-19 Thread Weijie Gao
Not all switches requires 1 second delay after deasserting reset. MT7531 requires only maximum 200ms. This patch defines dedicated reset wait time for each switch chip, and will significantly improve the boot time for boards using MT7531. Signed-off-by: Weijie Gao --- drivers/net/mtk_eth.c | 7

[PATCH 16/29] net: mediatek: connect switch to PSE only when starting eth is requested

2023-07-19 Thread Weijie Gao
disconnect it with PSE - Connect switch with PSE on eth start - Disconnect on eth stop Signed-off-by: Weijie Gao --- drivers/net/mtk_eth.c | 44 --- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c index

[PATCH 18/29] net: mediatek: fix direct MDIO clause 45 access via SoC

2023-07-19 Thread Weijie Gao
The original direct MDIO clause 45 access via SoC is missing the data output. This patch adds it back to ensure MDIO clause 45 can work properly for external PHYs. Signed-off-by: Weijie Gao --- drivers/net/mtk_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers

[PATCH 19/29] net: mediatek: add missing static qualifier

2023-07-19 Thread Weijie Gao
mt7531_mmd_ind_read and mt753x_switch_init are defined without static. Since they're not used outside this file, we should add them back. Signed-off-by: Weijie Gao fixup to add static qualifier --- drivers/net/mtk_eth.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --

[PATCH 20/29] net: mediatek: add support for SGMII 1Gbps auto-negotiation mode

2023-07-19 Thread Weijie Gao
Existing SGMII support of mtk-eth is actually a MediaTek-specific 2.5Gbps high-speed SGMII (HSGMII) which does not support auto-negotiation mode. This patch adds SGMII 1Gbps auto-negotiation mode and rename the existing HSGMII to 2500basex. Signed-off-by: Weijie Gao --- drivers/net/mtk_eth.c

[PATCH 21/29] arm: dts: medaitek: convert gmac link mode to 2500base-x

2023-07-19 Thread Weijie Gao
Now that individual 2.5Gbps SGMII support has been added to mtk-eth, all boards that use 2.5Gbps link with mt7531 must be converted to use "2500base-x" instead of "sgmii". Signed-off-by: Weijie Gao --- arch/arm/dts/mt7622-bananapi-bpi-r64.dts | 4 ++-- arch/ar

[PATCH 22/29] net: mediatek: add support for GMAC/USB3 PHY mux mode for MT7981

2023-07-19 Thread Weijie Gao
MT7981 has its GMAC2 PHY shared with USB3. To enable GMAC2, mux register must be set to connect the SGMII phy to GMAC2. Signed-off-by: Weijie Gao --- drivers/net/mtk_eth.c | 33 - drivers/net/mtk_eth.h | 16 2 files changed, 48 insertions(+), 1

[PATCH 23/29] arm: dts: mediatek: add infracfg registers to support GMAC/USB3 Co-PHY

2023-07-19 Thread Weijie Gao
This patch adds infracfg to eth node to support enabling GMAC2. Signed-off-by: Weijie Gao --- arch/arm/dts/mt7981.dtsi | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/dts/mt7981.dtsi b/arch/arm/dts/mt7981.dtsi index 2053e2ca00..7aaa7770f8 100644 --- a/arch/arm/dts/mt7981

[PATCH 24/29] net: mediatek: add USXGMII support

2023-07-19 Thread Weijie Gao
This patch adds support for USXGMII of SoC. Signed-off-by: Weijie Gao --- drivers/net/mtk_eth.c | 230 +- drivers/net/mtk_eth.h | 24 + 2 files changed, 251 insertions(+), 3 deletions(-) diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c

[PATCH 25/29] net: mediatek: add support for NETSYS v3

2023-07-19 Thread Weijie Gao
This patch adds support for NETSYS v3 hardware. Comparing to NETSYS v2, NETSYS v3 has three GMACs. Signed-off-by: Weijie Gao --- drivers/net/mtk_eth.c | 49 --- drivers/net/mtk_eth.h | 7 +++ 2 files changed, 44 insertions(+), 12 deletions(-) diff

[PATCH 26/29] net: mediatek: add support for MediaTek MT7988 SoC

2023-07-19 Thread Weijie Gao
This patch adds support for MediaTek MT7988. MT7988 features MediaTek NETSYS v3, including three GMACs, and two of them supports 10Gbps USXGMII. MT7988 embeds a MT7531 switch (not MCM) which supports accessing internal registers through MMIO instead of MDIO. Signed-off-by: Weijie Gao

[PATCH 27/29] tools: mtk_image: use uint32_t for ghf header magic and version

2023-07-19 Thread Weijie Gao
This patch converts magic and version fields of ghf common header to one field with the type of uint32_t to make this header flexible for futher updates. Signed-off-by: Weijie Gao --- tools/mtk_image.c | 10 ++ tools/mtk_image.h | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions

[PATCH 28/29] arm: mediatek: add support for MediaTek MT7988 SoC

2023-07-19 Thread Weijie Gao
This patch adds basic support for MediaTek MT7988 SoC. This includes files that will initialize the SoC after boot and its device tree. Signed-off-by: Weijie Gao --- arch/arm/dts/mt7988-u-boot.dtsi | 25 ++ arch/arm/dts/mt7988.dtsi | 391

[PATCH 29/29] board: mediatek: add MT7988 reference boards

2023-07-19 Thread Weijie Gao
, SPI-NAND and eMMC 2. mt7988_sd_rfb_defconfig - SPI-NAND and SD Signed-off-by: Weijie Gao --- arch/arm/dts/Makefile | 2 + arch/arm/dts/mt7988-rfb.dts| 182 + arch/arm/dts/mt7988-sd-rfb.dts | 134 + board/mediatek/mt7988

[PATCH 12/29] pinctrl: mediatek: convert most definitions to const

2023-07-19 Thread Weijie Gao
This will force all pinctrl data being put into .rodata section. Since .rodata has "a" attribute, even the all-zero data will be allocated and filled with correct value in to u-boot binary. Signed-off-by: Weijie Gao --- drivers/pinctrl/mediatek/pinctrl-mt7622.c | 474 ++

[PATCH v3 00/32] Add support for MediaTek MT7981/MT7986 SoCs - v3

2022-09-09 Thread Weijie Gao
MT7986: https://www.mediatek.com/products/home-networking/mediatek-filogic-830 Changes of v3: - Use regmap for cpu driver to access hwver registers Changes of v2: - Add cpu driver for print_cpuinfo() - Fix NULL pointer dereference in mtk_image - Fix coding style - Minor changes Weijie Gao (32): arm

[PATCH v3 01/32] arm: mediatek: add support for MediaTek MT7986 SoC

2022-09-09 Thread Weijie Gao
This patch adds basic support for MediaTek MT7986 SoC. This include the file that will initialize the SoC after boot and its device tree. Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: Add syscon to hwver node Add reference of hwver to cpu nodes

[PATCH v3 02/32] arm: mediatek: add support for MediaTek MT7981 SoC

2022-09-09 Thread Weijie Gao
This patch adds basic support for MediaTek MT7981 SoC. This include the file that will initialize the SoC after boot and its device tree. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: Add syscon to hwver node Add reference of hwver to cpu nodes v2 changes: Sort

[PATCH v3 03/32] board: mediatek: add MT7986 reference boards

2022-09-09 Thread Weijie Gao
. mt7986a_bpir3_emmc_defconfig - eMMC for MT7986A only 3. mt7986a_bpir3_sd_defconfig - SD for MT7986A only Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Rename mt7986a_emmc_rfb_defconfig to mt7986a_bpir3_emmc_defconfig Rename mt7986a_sd_rfb_defconfig to mt7986a_bpir3_sd_defconfig

[PATCH v3 04/32] board: mediatek: add MT7981 reference boards

2022-09-09 Thread Weijie Gao
. mt7981_emmc_rfb_defconfig - eMMC only 3. mt7981_sd_rfb_defconfig - SD only Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Remove mt7981_spim_nand_rfb_defconfig and mt7981_spim_nor_rfb_defconfig --- arch/arm/dts/Makefile | 3 + arch/arm/dts/mt7981

[PATCH v3 05/32] mmc: mediatek: add support for MediaTek MT7891/MT7986 SoCs

2022-09-09 Thread Weijie Gao
Add eMMC and SDXC support for MediaTek MT7981/MT7986 SoCs Both chips support SDXC and eMMC 4.5. MT7986A supports eMMC 5.1. Reviewed-by: Jaehoon Chung Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- drivers/mmc/mtk-sd.c | 68

[PATCH v3 07/32] net: mediatek: stop using bitfileds for DMA descriptors

2022-09-09 Thread Weijie Gao
: Weijie Gao --- v3 changes: none v2 changes: Fix typo in commit message --- drivers/net/mtk_eth.c | 144 ++ drivers/net/mtk_eth.h | 32 ++ 2 files changed, 80 insertions(+), 96 deletions(-) diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c

[PATCH v3 06/32] net: mediatek: use a struct to cover variations of all SoCs

2022-09-09 Thread Weijie Gao
Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Add description for new struct --- drivers/net/mtk_eth.c | 56 ++- drivers/net/mtk_eth.h | 25 ++- 2 files changed, 64 insertions(+), 17 deletions

[PATCH v3 08/32] net: mediatek: add support for PDMA v2

2022-09-09 Thread Weijie Gao
This patch adds support for PDMA v2 hardware. The PDMA v2 has extended the DMA descriptor to 8-words, and some of its fields have changed comparing to the v1 hardware. Reviewed-by: Ramon Fried Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2

[PATCH v3 10/32] serial: mtk: add support for using dynamic baud clock souce

2022-09-09 Thread Weijie Gao
the baud clk struct to the driver's priv, and changes the driver's flow to get the clock rate before calling _mtk_serial_setbrg(). Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Add description for priv struct Fix t

[PATCH v3 09/32] net: mediatek: add support for MediaTek MT7981/MT7986

2022-09-09 Thread Weijie Gao
This patch adds support for MediaTek MT7981 and MT7986. Both chips uses PDMA v2. Reviewed-by: Ramon Fried Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- drivers/net/mtk_eth.c | 27 +++ drivers/net/mtk_eth.h | 5 + 2

[PATCH v3 12/32] pwm: mtk: add support for MediaTek MT7986 SoC

2022-09-09 Thread Weijie Gao
This patch adds PWM support for MediaTek MT7986 SoC. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- drivers/pwm/pwm-mtk.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/pwm/pwm-mtk.c b/drivers/pwm/pwm-mtk.c index aee1d825a0

[PATCH v3 11/32] arm: dts: mt7622: force high-speed mode for uart

2022-09-09 Thread Weijie Gao
The input clock for uart is too slow (25MHz) which introduces frequent data error on both receiving and transmitting even if the baudrate is 115200. Using high-speed can significantly solve this issue. Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes

[PATCH v3 13/32] pwm: mtk: add support for MediaTek MT7981 SoC

2022-09-09 Thread Weijie Gao
This patch adds PWM support for MediaTek MT7981 SoC. MT7981 uses a different register offset so we have to add a version field to indicate the IP core version. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- drivers/pwm/pwm-mtk.c | 34

[PATCH v3 14/32] timer: mtk: add support for MediaTek MT7981/MT7986 SoCs

2022-09-09 Thread Weijie Gao
This patch add general-purpose timer support for MediaTek MT7981/MT7986. These two SoCs uses a newer version of timer with its register definition slightly changed. Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- drivers

[PATCH v3 15/32] watchdog: mediatek: add support for MediaTek MT7986 SoC

2022-09-09 Thread Weijie Gao
Add watchdog support for MediaTek MT7986 SoC Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- drivers/watchdog/mtk_wdt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog

[PATCH v3 17/32] i2c: add support for MediaTek I2C interface

2022-09-09 Thread Weijie Gao
This patch adds support for MediaTek I2C interface Reviewed-by: Heiko Schocher Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Reorganize code to reduce duplicated code Rename mtk_i2c_ofdata_to_platdata to mtk_i2c_of_to_plat --- drivers/i2c/Kconfig

[PATCH v3 18/32] arm: dts: mt7622: add i2c support

2022-09-09 Thread Weijie Gao
Add both hardware and software i2c support for mt7622. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- arch/arm/dts/mt7622-rfb.dts | 18 ++ arch/arm/dts/mt7622.dtsi| 24 2 files changed, 42 insertions

[PATCH v3 16/32] spi: add support for MediaTek spi-mem controller

2022-09-09 Thread Weijie Gao
This patch adds support for spi-mem controller found on newer MediaTek SoCs This controller supports Single/Dual/Quad SPI mode. Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: SkyLake.Huang --- v3 changes: none v2 changes: Remove unused code Fix coding style Add descriptio

[PATCH v3 19/32] dt-bindings: pinctrl: mediatek: add a header for common pinconf parameters

2022-09-09 Thread Weijie Gao
This patch adds a pinctrl header for common pinconf parameters such as pull-up/pull-down resistors and drive strengths. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- include/dt-bindings/pinctrl/mt65xx.h | 41 1 file

[PATCH v3 22/32] clk: mediatek: add CLK_BYPASS_XTAL flag to allow bypassing searching clock parent of xtal clock

2022-09-09 Thread Weijie Gao
driver needs clocks with ID=0 to call mtk_topckgen_get_mux_rate. Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Add comment for flags Fix the if condition of CLK_BYPASS_XTAL --- drivers/clk/mediatek/clk-mtk.c | 4 +++- drivers/clk

[PATCH v3 21/32] pinctrl: mediatek: add pinctrl driver for MT7986 SoC

2022-09-09 Thread Weijie Gao
This patch adds pinctrl and gpio support for MT7986 SoC Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- drivers/pinctrl/mediatek/Kconfig | 4 + drivers/pinctrl/mediatek/Makefile | 1 + drivers/pinctrl

[PATCH v3 23/32] clk: mediatek: add support to configure clock driver parent

2022-09-09 Thread Weijie Gao
This patch adds support for a clock node to configure its parent clock where possible. Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- drivers/clk/mediatek/clk-mtk.c | 79 -- drivers/clk

[PATCH v3 25/32] clk: mediatek: add CLK_XTAL support for clock driver

2022-09-09 Thread Weijie Gao
This adds the CLK_XTAL macro/flag to allow modeling clocks which are directly connected to the xtal clock. Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Fix incorrect fallback in mtk_infrasys_get_factor_rate Fix commit

[PATCH v3 24/32] clk: mediatek: add infrasys clock mux support

2022-09-09 Thread Weijie Gao
This patch adds infrasys clock mux support for mediatek clock drivers. Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Fix the if condition of CLK_BYPASS_XTAL --- drivers/clk/mediatek/clk-mtk.c | 71

[PATCH v3 20/32] pinctrl: mediatek: add pinctrl driver for MT7981 SoC

2022-09-09 Thread Weijie Gao
This patch adds pinctrl and gpio support for MT7981 SoC Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- drivers/pinctrl/mediatek/Kconfig |4 + drivers/pinctrl/mediatek/Makefile |1 + drivers/pinctrl/mediatek/pinctrl-mt7981.c

[PATCH v3 26/32] clk: mediatek: add clock driver support for MediaTek MT7986 SoC

2022-09-09 Thread Weijie Gao
This patch adds clock driver support for MediaTek MT7986 SoC Reviewed-by: Sean Anderson Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Fix coding style --- drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk

[PATCH v3 28/32] cpu: add basic cpu driver for MediaTek ARM chips

2022-09-09 Thread Weijie Gao
Add basic CPU driver used to retrieve CPU model information. Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: Use regmap to read hwver registers v2 changes: new --- drivers/cpu/Makefile | 1 + drivers/cpu/mtk_cpu.c | 86 +++ 2 files

[PATCH v3 29/32] tools: mtk_image: split gfh header verification into a new function

2022-09-09 Thread Weijie Gao
The verification code of gfh header for NAND and non-NAND are identical. It's better to define a individual function to reduce redundancy. Reviewed-by: Simon Glass Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: none --- tools/mtk_image.c

[PATCH v3 32/32] MAINTAINERS: update maintainer for MediaTek ARM platform

2022-09-09 Thread Weijie Gao
Add new files for MediaTek ARM platform Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: v2 changes: Add cpu driver file --- MAINTAINERS | 6 ++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 36a2b69fcb..d47674c476 100644 --- a/MAINTAINERS

[PATCH v3 27/32] clk: mediatek: add clock driver support for MediaTek MT7981 SoC

2022-09-09 Thread Weijie Gao
This patch adds clock driver support for MediaTek MT7981 SoC Reviewed-by: Sean Anderson Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Fix coding style --- drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt7981.c | 683

[PATCH v3 31/32] tools: mtk_image: add support for nand headers used by newer chips

2022-09-09 Thread Weijie Gao
This patch adds more nand headers in two new types: 1. HSM header, used for spi-nand thru SNFI interface 2. SPIM header, used for spi-nand thru spi-mem interface The original nand header is renamed to AP header. Tested-by: Daniel Golle Signed-off-by: Weijie Gao --- v3 changes: none v2 changes

[PATCH v3 30/32] tools: mtk_image: split the code of generating NAND header into a new file

2022-09-09 Thread Weijie Gao
Signed-off-by: Weijie Gao --- v3 changes: none v2 changes: Add comments Call mtk_nand_header_size only for NAND/SNAND to avoid NULL pointer access --- tools/Makefile | 1 + tools/mtk_image.c| 305 ++- tools/mtk_image.h| 25

Re: [PATCH 17/31] i2c: add support for MediaTek I2C interface

2022-08-12 Thread Weijie Gao
On Wed, 2022-08-10 at 13:24 +0200, Michael Nazzareno Trimarchi wrote: > Hi > > On Thu, Aug 4, 2022 at 5:38 AM Weijie Gao > wrote: > > > > This patch adds support for MediaTek I2C interface > > > > Signed-off-by: Weijie Gao > > --- > > drivers

Re: [PATCH 03/31] board: mediatek: add MT7986 reference boards

2022-08-12 Thread Weijie Gao
On Tue, 2022-08-09 at 11:10 +0200, Daniel Golle wrote: > Hi Weijie, > > On Thu, Aug 04, 2022 at 11:35:03AM +0800, Weijie Gao wrote: > > This patch adds general board files based on MT7986 SoCs. > > > > The SD/eMMC controller on MT7986A and MT7986B have different pin

Re: [PATCH 24/31] clk: mediatek: add infrasys clock mux support

2022-08-17 Thread Weijie Gao
On Sat, 2022-08-13 at 00:21 -0400, Sean Anderson wrote: > On 8/3/22 11:36 PM, Weijie Gao wrote: > > This patch adds infrasys clock mux support for mediatek clock > > drivers. > > > > Signed-off-by: Weijie Gao > > --- > >

Re: [PATCH 25/31] clk: mediatek: add CLK_XTAL support for clock driver

2022-08-17 Thread Weijie Gao
On Sat, 2022-08-13 at 00:25 -0400, Sean Anderson wrote: > On 8/3/22 11:36 PM, Weijie Gao wrote: > > This add CLK_XTAL macro and flag to mediatek clock driver common > > part, > > to make thi SoC that has clock directlly connect to XTAL working. > > nit: this.. directly

Re: [PATCH 27/31] clk: mediatek: add clock driver support for MediaTek MT7981 SoC

2022-08-17 Thread Weijie Gao
On Sat, 2022-08-13 at 00:31 -0400, Sean Anderson wrote: > On 8/3/22 11:36 PM, Weijie Gao wrote: > > This patch adds clock driver support for MediaTek MT7981 SoC > > > > Signed-off-by: Weijie Gao > > --- > > drivers/clk/mediatek/Makefile | 1 + > &

Re: [PATCH 23/31] clk: mediatek: add support to configure clock driver parent

2022-08-23 Thread Weijie Gao
On Sat, 2022-08-13 at 00:18 -0400, Sean Anderson wrote: > On 8/3/22 11:36 PM, Weijie Gao wrote: > > This patch adds support for a clock node to configure its parent > > clock > > where possible. > > > > Signed-off-by: Weijie Gao > > --- &g

[PATCH v2 02/32] arm: mediatek: add support for MediaTek MT7981 SoC

2022-08-31 Thread Weijie Gao
This patch adds basic support for MediaTek MT7981 SoC. This include the file that will initialize the SoC after boot and its device tree. Signed-off-by: Weijie Gao --- v2 changes: Sort include lines Add reference link for armv8_el2_to_aarch32 in lowlevel_init.S Remove print_cpuinfo and use

[PATCH v2 00/32] Add support for MediaTek MT7981/MT7986 SoCs - v2

2022-08-31 Thread Weijie Gao
MT7986: https://www.mediatek.com/products/home-networking/mediatek-filogic-830 Changes of v2: - Add cpu driver for print_cpuinfo() - Fix NULL pointer dereference in mtk_image - Fix coding style - Minor changes Weijie Gao (32): arm: mediatek: add support for MediaTek MT7986 SoC arm: mediatek: add

[PATCH v2 03/32] board: mediatek: add MT7986 reference boards

2022-08-31 Thread Weijie Gao
. mt7986a_bpir3_emmc_defconfig - eMMC for MT7986A only 3. mt7986a_bpir3_sd_defconfig - SD for MT7986A only Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: Rename mt7986a_emmc_rfb_defconfig to mt7986a_bpir3_emmc_defconfig Rename mt7986a_sd_rfb_defconfig to mt7986a_bpir3_sd_defconfig Remove mt7986b

[PATCH v2 04/32] board: mediatek: add MT7981 reference boards

2022-08-31 Thread Weijie Gao
. mt7981_emmc_rfb_defconfig - eMMC only 3. mt7981_sd_rfb_defconfig - SD only Signed-off-by: Weijie Gao --- v2 changes: Remove mt7981_spim_nand_rfb_defconfig and mt7981_spim_nor_rfb_defconfig --- arch/arm/dts/Makefile | 3 + arch/arm/dts/mt7981-emmc-rfb.dts | 139

[PATCH v2 01/32] arm: mediatek: add support for MediaTek MT7986 SoC

2022-08-31 Thread Weijie Gao
This patch adds basic support for MediaTek MT7986 SoC. This include the file that will initialize the SoC after boot and its device tree. Signed-off-by: Weijie Gao --- v2 changes: Sort include lines Add reference link for armv8_el2_to_aarch32 in lowlevel_init.S Remove print_cpuinfo and use

[PATCH v2 05/32] mmc: mediatek: add support for MediaTek MT7891/MT7986 SoCs

2022-08-31 Thread Weijie Gao
Add eMMC and SDXC support for MediaTek MT7981/MT7986 SoCs Both chips support SDXC and eMMC 4.5. MT7986A supports eMMC 5.1. Reviewed-by: Jaehoon Chung Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- drivers/mmc/mtk-sd.c | 68

[PATCH v2 06/32] net: mediatek: use a struct to cover variations of all SoCs

2022-08-31 Thread Weijie Gao
Signed-off-by: Weijie Gao --- v2c changes: Add description for new struct --- drivers/net/mtk_eth.c | 56 ++- drivers/net/mtk_eth.h | 25 ++- 2 files changed, 64 insertions(+), 17 deletions(-) diff --git a/drivers/net/mtk_eth.c b/drivers

[PATCH v2 08/32] net: mediatek: add support for PDMA v2

2022-08-31 Thread Weijie Gao
This patch adds support for PDMA v2 hardware. The PDMA v2 has extended the DMA descriptor to 8-words, and some of its fields have changed comparing to the v1 hardware. Reviewed-by: Ramon Fried Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: Add description for new fields

[PATCH v2 07/32] net: mediatek: stop using bitfileds for DMA descriptors

2022-08-31 Thread Weijie Gao
This patch is a preparation for adding a new version of PDMA of which the DMA descriptor fields has changed. Using bitfields will result in a complex modification. Convert bitfields to u32 units can solve this problem easily. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes

[PATCH v2 09/32] net: mediatek: add support for MediaTek MT7981/MT7986

2022-08-31 Thread Weijie Gao
This patch adds support for MediaTek MT7981 and MT7986. Both chips uses PDMA v2. Reviewed-by: Ramon Fried Signed-off-by: Weijie Gao --- v2 changes: none --- drivers/net/mtk_eth.c | 27 +++ drivers/net/mtk_eth.h | 5 + 2 files changed, 32 insertions(+) diff --git a

[PATCH v2 10/32] serial: mtk: add support for using dynamic baud clock souce

2022-08-31 Thread Weijie Gao
the baud clk struct to the driver's priv, and changes the driver's flow to get the clock rate before calling _mtk_serial_setbrg(). Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: Add description for priv struct Fix the type of clk_rate --- drivers/serial/serial_

[PATCH v2 11/32] arm: dts: mt7622: force high-speed mode for uart

2022-08-31 Thread Weijie Gao
The input clock for uart is too slow (25MHz) which introduces frequent data error on both receiving and transmitting even if the baudrate is 115200. Using high-speed can significantly solve this issue. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- arch/arm/dts

[PATCH v2 12/32] pwm: mtk: add support for MediaTek MT7986 SoC

2022-08-31 Thread Weijie Gao
This patch adds PWM support for MediaTek MT7986 SoC. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- drivers/pwm/pwm-mtk.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/pwm/pwm-mtk.c b/drivers/pwm/pwm-mtk.c index aee1d825a0..3100b5caaf 100644

[PATCH v2 15/32] watchdog: mediatek: add support for MediaTek MT7986 SoC

2022-08-31 Thread Weijie Gao
Add watchdog support for MediaTek MT7986 SoC Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- drivers/watchdog/mtk_wdt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c index b098b2e3cf..368b36849c 100644

[PATCH v2 13/32] pwm: mtk: add support for MediaTek MT7981 SoC

2022-08-31 Thread Weijie Gao
This patch adds PWM support for MediaTek MT7981 SoC. MT7981 uses a different register offset so we have to add a version field to indicate the IP core version. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- drivers/pwm/pwm-mtk.c | 34

[PATCH v2 14/32] timer: mtk: add support for MediaTek MT7981/MT7986 SoCs

2022-08-31 Thread Weijie Gao
This patch add general-purpose timer support for MediaTek MT7981/MT7986. These two SoCs uses a newer version of timer with its register definition slightly changed. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- drivers/timer/mtk_timer.c | 59

[PATCH v2 16/32] spi: add support for MediaTek spi-mem controller

2022-08-31 Thread Weijie Gao
This patch adds support for spi-mem controller found on newer MediaTek SoCs This controller supports Single/Dual/Quad SPI mode. Reviewed-by: Simon Glass Signed-off-by: SkyLake.Huang --- v2 changes: Remove unused code Fix coding style Add description for struct fields --- drivers/spi/Kconf

[PATCH v2 18/32] arm: dts: mt7622: add i2c support

2022-08-31 Thread Weijie Gao
Add both hardware and software i2c support for mt7622. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- arch/arm/dts/mt7622-rfb.dts | 18 ++ arch/arm/dts/mt7622.dtsi| 24 2 files changed, 42 insertions(+) diff --git a

[PATCH v2 19/32] dt-bindings: pinctrl: mediatek: add a header for common pinconf parameters

2022-08-31 Thread Weijie Gao
This patch adds a pinctrl header for common pinconf parameters such as pull-up/pull-down resistors and drive strengths. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- include/dt-bindings/pinctrl/mt65xx.h | 41 1 file changed, 41

[PATCH v2 17/32] i2c: add support for MediaTek I2C interface

2022-08-31 Thread Weijie Gao
This patch adds support for MediaTek I2C interface Reviewed-by: Heiko Schocher Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: Reorganize code to reduce duplicated code Rename mtk_i2c_ofdata_to_platdata to mtk_i2c_of_to_plat --- drivers/i2c/Kconfig | 9 + drivers

[PATCH v2 21/32] pinctrl: mediatek: add pinctrl driver for MT7986 SoC

2022-08-31 Thread Weijie Gao
This patch adds pinctrl and gpio support for MT7986 SoC Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- drivers/pinctrl/mediatek/Kconfig | 4 + drivers/pinctrl/mediatek/Makefile | 1 + drivers/pinctrl/mediatek/pinctrl-mt7986.c | 775

[PATCH v2 22/32] clk: mediatek: add CLK_BYPASS_XTAL flag to allow bypassing searching clock parent of xtal clock

2022-08-31 Thread Weijie Gao
driver needs clocks with ID=0 to call mtk_topckgen_get_mux_rate. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: Add comment for flags Fix the if condition of CLK_BYPASS_XTAL --- drivers/clk/mediatek/clk-mtk.c | 4 +++- drivers/clk/mediatek/clk-mtk.h | 6 ++ 2 files changed

[PATCH v2 20/32] pinctrl: mediatek: add pinctrl driver for MT7981 SoC

2022-08-31 Thread Weijie Gao
This patch adds pinctrl and gpio support for MT7981 SoC Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- drivers/pinctrl/mediatek/Kconfig |4 + drivers/pinctrl/mediatek/Makefile |1 + drivers/pinctrl/mediatek/pinctrl-mt7981.c | 1049

[PATCH v2 24/32] clk: mediatek: add infrasys clock mux support

2022-08-31 Thread Weijie Gao
This patch adds infrasys clock mux support for mediatek clock drivers. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: Fix the if condition of CLK_BYPASS_XTAL --- drivers/clk/mediatek/clk-mtk.c | 71 ++ drivers/clk/mediatek/clk-mtk.h | 4

[PATCH v2 23/32] clk: mediatek: add support to configure clock driver parent

2022-08-31 Thread Weijie Gao
This patch adds support for a clock node to configure its parent clock where possible. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- drivers/clk/mediatek/clk-mtk.c | 79 -- drivers/clk/mediatek/clk-mtk.h | 2 + 2 files changed, 48

[PATCH v2 25/32] clk: mediatek: add CLK_XTAL support for clock driver

2022-08-31 Thread Weijie Gao
This adds the CLK_XTAL macro/flag to allow modeling clocks which are directly connected to the xtal clock. Signed-off-by: Weijie Gao --- v2 changes: Fix incorrect fallback in mtk_infrasys_get_factor_rate Fix commit description --- drivers/clk/mediatek/clk-mtk.c | 4 drivers/clk

[PATCH v2 28/32] cpu: add basic cpu driver for MediaTek ARM chips

2022-08-31 Thread Weijie Gao
Add basic CPU driver used to retrieve CPU model information. Signed-off-by: Weijie Gao --- v2 changes: new --- drivers/cpu/Makefile | 1 + drivers/cpu/mtk_cpu.c | 106 ++ 2 files changed, 107 insertions(+) create mode 100644 drivers/cpu/mtk_cpu.c

[PATCH v2 26/32] clk: mediatek: add clock driver support for MediaTek MT7986 SoC

2022-08-31 Thread Weijie Gao
This patch adds clock driver support for MediaTek MT7986 SoC Reviewed-by: Sean Anderson Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: Fix coding style --- drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt7986.c | 672

[PATCH v2 29/32] tools: mtk_image: split gfh header verification into a new function

2022-08-31 Thread Weijie Gao
The verification code of gfh header for NAND and non-NAND are identical. It's better to define a individual function to reduce redundancy. Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: none --- tools/mtk_image.c | 51 +++ 1

[PATCH v2 27/32] clk: mediatek: add clock driver support for MediaTek MT7981 SoC

2022-08-31 Thread Weijie Gao
This patch adds clock driver support for MediaTek MT7981 SoC Reviewed-by: Sean Anderson Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: Fix coding style --- drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt7981.c | 683

[PATCH v2 32/32] MAINTAINERS: update maintainer for MediaTek ARM platform

2022-08-31 Thread Weijie Gao
Add new files for MediaTek ARM platform Reviewed-by: Simon Glass Signed-off-by: Weijie Gao --- v2 changes: Add cpu driver file --- MAINTAINERS | 6 ++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 36a2b69fcb..d47674c476 100644 --- a/MAINTAINERS +++ b

  1   2   3   4   5   6   7   8   >