ramips: 6.18: manually rebuild patches

Manually rebuild patches:
 - 102-01-pwm-mediatek-set-mt7628-pwm45_fixup-flag-to-false.patch
 - 102-02-pwm-mediatek-correct-mt7628-clock-source-setting.patch
 - 312-MIPS-ralink-add-cpu-frequency-scaling.patch
 - 810-uvc-add-iPassion-iP2970-support.patch
 - 821-SPI-ralink-add-Ralink-SoC-spi-driver.patch
 - 831-01-mmc-mtk-sd-add-tuning-parameters-for-legacy-MIPS-MT7.patch
 - 831-02-mmc-mtk-sd-disable-auto-CMD23-support-for-mt7620.patch
 - 835-asoc-add-mt7620-support.patch

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/21418
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Mieczyslaw Nalewaj 2026-01-06 11:00:39 +01:00 committed by Robert Marko
parent 7429b5a8d6
commit 69a4371020
8 changed files with 90 additions and 81 deletions

View File

@ -14,12 +14,12 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -324,7 +324,7 @@ static const struct pwm_mediatek_of_data
@@ -458,7 +458,7 @@ static const struct pwm_mediatek_of_data
static const struct pwm_mediatek_of_data mt7628_pwm_data = {
.num_pwms = 4,
- .pwm45_fixup = true,
+ .pwm45_fixup = false,
.has_ck_26m_sel = false,
.reg_offset = mtk_pwm_reg_offset_v1,
.chanreg_base = 0x10,
.chanreg_width = 0x40,
};

View File

@ -16,34 +16,34 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -21,6 +21,8 @@
@@ -22,6 +22,8 @@
/* PWM registers and bits definitions */
#define PWMCON 0x00
+#define PWMCON_CLKSEL BIT(3)
+#define PWMCON_OLD_PWM_MODE BIT(15)
#define PWMCON_CLKDIV GENMASK(2, 0)
#define PWMHDUR 0x04
#define PWMLDUR 0x08
#define PWMGDUR 0x0c
@@ -35,6 +37,7 @@
@@ -38,6 +40,7 @@
struct pwm_mediatek_of_data {
unsigned int num_pwms;
+ bool clksel_fixup;
bool pwm45_fixup;
bool has_ck_26m_sel;
const unsigned int *reg_offset;
@@ -141,6 +144,7 @@ static int pwm_mediatek_config(struct pw
struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip);
u32 clkdiv = 0, cnt_period, cnt_duty, reg_width = PWMDWIDTH,
reg_thres = PWMTHRES;
u16 pwm_ck_26m_sel_reg;
unsigned int chanreg_base;
@@ -162,6 +165,7 @@ static int pwm_mediatek_config(struct pw
u32 clkdiv, enable;
u32 reg_width = PWMDWIDTH, reg_thres = PWMTHRES;
u64 cnt_period, cnt_duty;
+ u32 con_val;
unsigned long clk_rate;
u64 resolution;
int ret;
@@ -191,7 +195,12 @@ static int pwm_mediatek_config(struct pw
cnt_duty = DIV_ROUND_CLOSEST_ULL((u64)duty_ns * 1000, resolution);
@@ -218,7 +222,12 @@ static int pwm_mediatek_config(struct pw
reg_thres = PWM45THRES_FIXUP;
}
- pwm_mediatek_writel(pc, pwm->hwpwm, PWMCON, BIT(15) | clkdiv);
+ con_val = PWMCON_OLD_PWM_MODE | clkdiv;
@ -52,14 +52,14 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
+ con_val |= PWMCON_CLKSEL;
+
+ pwm_mediatek_writel(pc, pwm->hwpwm, PWMCON, con_val);
pwm_mediatek_writel(pc, pwm->hwpwm, reg_width, cnt_period - 1);
pwm_mediatek_writel(pc, pwm->hwpwm, reg_width, cnt_period);
if (cnt_duty) {
@@ -324,6 +333,7 @@ static const struct pwm_mediatek_of_data
if (enable) {
@@ -458,6 +467,7 @@ static const struct pwm_mediatek_of_data
static const struct pwm_mediatek_of_data mt7628_pwm_data = {
.num_pwms = 4,
+ .clksel_fixup = true,
.pwm45_fixup = false,
.has_ck_26m_sel = false,
.reg_offset = mtk_pwm_reg_offset_v1,
.chanreg_base = 0x10,
.chanreg_width = 0x40,

View File

@ -139,7 +139,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
return 0;
}
@@ -113,33 +161,46 @@ static int systick_set_oneshot(struct cl
@@ -113,20 +161,37 @@ static int systick_set_oneshot(struct cl
return 0;
}
@ -150,7 +150,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
static int __init ralink_systick_init(struct device_node *np)
{
- int ret;
int ret;
+ const struct of_device_id *match;
+ int rating = 200;
@ -183,14 +183,15 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
systick.dev.irq = irq_of_parse_and_map(np, 0);
if (!systick.dev.irq) {
pr_err("%pOFn: request_irq failed", np);
return -EINVAL;
@@ -134,21 +199,16 @@ static int __init ralink_systick_init(st
goto err_iounmap;
}
- ret = clocksource_mmio_init(systick.membase + SYSTICK_COUNT, np->name,
- SYSTICK_FREQ, 301, 16,
- clocksource_mmio_readl_up);
- if (ret)
- return ret;
- goto err_free_irq;
-
- clockevents_register_device(&systick.dev);
+ systick.dev.name = np->name;
@ -200,3 +201,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
pr_info("%pOFn: running - mult: %d, shift: %d\n",
np, systick.dev.mult, systick.dev.shift);
return 0;
-err_free_irq:
- irq_dispose_mapping(systick.dev.irq);
err_iounmap:
iounmap(systick.membase);
return ret;

View File

@ -13,7 +13,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -3229,6 +3229,18 @@ static const struct usb_device_id uvc_id
@@ -3248,6 +3248,18 @@ static const struct usb_device_id uvc_id
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) },
@ -34,7 +34,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) },
--- a/drivers/media/usb/uvc/uvc_status.c
+++ b/drivers/media/usb/uvc/uvc_status.c
@@ -228,6 +228,7 @@ static void uvc_status_complete(struct u
@@ -229,6 +229,7 @@ static void uvc_status_complete(struct u
if (uvc_event_control(urb, dev->status, len))
/* The URB will be resubmitted in work context. */
return;
@ -42,7 +42,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
break;
}
@@ -274,6 +275,7 @@ int uvc_status_init(struct uvc_device *d
@@ -275,6 +276,7 @@ int uvc_status_init(struct uvc_device *d
}
pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress);
@ -64,7 +64,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
#include <media/jpeg.h>
#include <media/v4l2-common.h>
@@ -1353,9 +1358,149 @@ static void uvc_video_decode_data(struct
@@ -1344,9 +1349,149 @@ static void uvc_video_decode_data(struct
uvc_urb->async_operations++;
}
@ -214,7 +214,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
/* Mark the buffer as done if the EOF marker is set. */
if (data[1] & UVC_STREAM_EOF && buf->bytesused != 0) {
uvc_dbg(stream->dev, FRAME, "Frame complete (EOF found)\n");
@@ -1938,6 +2083,8 @@ static int uvc_init_video_isoc(struct uv
@@ -1890,6 +2035,8 @@ static int uvc_init_video_isoc(struct uv
if (npackets == 0)
return -ENOMEM;
@ -225,16 +225,16 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
for_each_uvc_urb(uvc_urb, stream) {
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -79,6 +79,8 @@
#define UVC_QUIRK_DISABLE_AUTOSUSPEND 0x00008000
@@ -81,6 +81,8 @@
#define UVC_QUIRK_INVALID_DEVICE_SOF 0x00010000
#define UVC_QUIRK_MJPEG_NO_EOF 0x00020000
+#define UVC_QUIRK_MOTION 0x00040000
+#define UVC_QUIRK_SINGLE_ISO 0x00080000
#define UVC_QUIRK_MSXU_META 0x00040000
+#define UVC_QUIRK_MOTION 0x00080000
+#define UVC_QUIRK_SINGLE_ISO 0x00100000
/* Format flags */
#define UVC_FMT_FLAG_COMPRESSED 0x00000001
@@ -598,6 +600,7 @@ struct uvc_device {
@@ -614,6 +616,7 @@ struct uvc_device {
struct input_dev *input;
char input_phys[64];

View File

@ -16,7 +16,7 @@ Acked-by: John Crispin <blogic@openwrt.org>
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -932,6 +932,12 @@ config SPI_QCOM_GENI
@@ -999,6 +999,12 @@ config SPI_QCOM_GENI
This driver can also be built as a module. If so, the module
will be called spi-geni-qcom.
@ -31,14 +31,14 @@ Acked-by: John Crispin <blogic@openwrt.org>
depends on (PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST)
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -122,6 +122,7 @@ obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o
obj-$(CONFIG_MACH_REALTEK_RTL) += spi-realtek-rtl.o
@@ -128,6 +128,7 @@ obj-$(CONFIG_MACH_REALTEK_RTL) += spi-r
obj-$(CONFIG_SPI_REALTEK_SNAND) += spi-realtek-rtl-snand.o
obj-$(CONFIG_SPI_RPCIF) += spi-rpc-if.o
obj-$(CONFIG_SPI_RSPI) += spi-rspi.o
+obj-$(CONFIG_SPI_RT2880) += spi-rt2880.o
obj-$(CONFIG_SPI_RZV2H_RSPI) += spi-rzv2h-rspi.o
obj-$(CONFIG_SPI_RZV2M_CSI) += spi-rzv2m-csi.o
obj-$(CONFIG_SPI_S3C64XX) += spi-s3c64xx.o
obj-$(CONFIG_SPI_SC18IS602) += spi-sc18is602.o
--- /dev/null
+++ b/drivers/spi/spi-rt2880.c
@@ -0,0 +1,473 @@
@ -464,7 +464,7 @@ Acked-by: John Crispin <blogic@openwrt.org>
+ if (IS_ERR(clk))
+ return dev_err_probe(dev, PTR_ERR(clk), "unable to get SYS clock");
+
+ master = devm_spi_alloc_master(dev, sizeof(*rs));
+ master = devm_spi_alloc_host(dev, sizeof(*rs));
+ if (!master) {
+ dev_err(dev, "master allocation failed\n");
+ return -ENOMEM;

View File

@ -16,7 +16,7 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -75,8 +75,13 @@
@@ -77,8 +77,13 @@
#define MSDC_PATCH_BIT 0xb0
#define MSDC_PATCH_BIT1 0xb4
#define MSDC_PATCH_BIT2 0xb8
@ -30,15 +30,15 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
#define PAD_DS_TUNE 0x188
#define PAD_CMD_TUNE 0x18c
#define EMMC51_CFG0 0x204
@@ -408,6 +413,7 @@ struct mtk_mmc_compatible {
bool enhance_rx;
bool support_64g;
@@ -448,6 +453,7 @@ struct mtk_mmc_compatible {
bool use_internal_cd;
bool support_new_tx;
bool support_new_rx;
+ bool mips_mt762x;
};
struct msdc_tune_para {
@@ -547,6 +553,7 @@ static const struct mtk_mmc_compatible m
@@ -589,6 +595,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = false,
.enhance_rx = false,
.use_internal_cd = true,
@ -46,7 +46,7 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
};
static const struct mtk_mmc_compatible mt7622_compat = {
@@ -975,7 +982,12 @@ static void msdc_set_mclk(struct msdc_ho
@@ -1083,7 +1090,12 @@ static void msdc_set_mclk(struct msdc_ho
* mmc_select_hs400() will drop to 50Mhz and High speed mode,
* tune result of hs200/200Mhz is not suitable for 50Mhz
*/
@ -60,7 +60,7 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
writel(host->def_tune_para.iocon, host->base + MSDC_IOCON);
if (host->top_base) {
writel(host->def_tune_para.emmc_top_control,
@@ -1856,6 +1868,18 @@ static void msdc_init_hw(struct msdc_hos
@@ -2032,6 +2044,18 @@ static void msdc_init_hw(struct msdc_hos
MSDC_PAD_TUNE_RXDLYSEL);
}

View File

@ -28,15 +28,15 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -412,6 +412,7 @@ struct mtk_mmc_compatible {
bool stop_clk_fix;
@@ -450,6 +450,7 @@ struct mtk_mmc_compatible {
u8 pop_en_cnt;
bool enhance_rx;
bool support_64g;
+ bool support_cmd23;
bool use_internal_cd;
bool mips_mt762x;
};
@@ -501,6 +502,7 @@ static const struct mtk_mmc_compatible m
bool support_new_tx;
bool support_new_rx;
@@ -541,6 +542,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = false,
.enhance_rx = false,
.support_64g = false,
@ -44,23 +44,23 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
};
static const struct mtk_mmc_compatible mt2712_compat = {
@@ -514,6 +516,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
@@ -555,6 +557,7 @@ static const struct mtk_mmc_compatible m
.stop_dly_sel = 3,
.enhance_rx = true,
.support_64g = true,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt6779_compat = {
@@ -527,6 +530,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
@@ -569,6 +572,7 @@ static const struct mtk_mmc_compatible m
.stop_dly_sel = 3,
.enhance_rx = true,
.support_64g = true,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt6795_compat = {
@@ -540,6 +544,7 @@ static const struct mtk_mmc_compatible m
@@ -582,6 +586,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = false,
.enhance_rx = false,
.support_64g = false,
@ -68,7 +68,7 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
};
static const struct mtk_mmc_compatible mt7620_compat = {
@@ -552,6 +557,7 @@ static const struct mtk_mmc_compatible m
@@ -594,6 +599,7 @@ static const struct mtk_mmc_compatible m
.busy_check = false,
.stop_clk_fix = false,
.enhance_rx = false,
@ -76,23 +76,23 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
.use_internal_cd = true,
.mips_mt762x = true,
};
@@ -567,6 +573,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
@@ -610,6 +616,7 @@ static const struct mtk_mmc_compatible m
.stop_dly_sel = 3,
.enhance_rx = true,
.support_64g = false,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt7986_compat = {
@@ -580,6 +587,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
@@ -625,6 +632,7 @@ static const struct mtk_mmc_compatible m
.stop_dly_sel = 3,
.enhance_rx = true,
.support_64g = true,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt8135_compat = {
@@ -593,6 +601,7 @@ static const struct mtk_mmc_compatible m
@@ -638,6 +646,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = false,
.enhance_rx = false,
.support_64g = false,
@ -100,7 +100,7 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
};
static const struct mtk_mmc_compatible mt8173_compat = {
@@ -606,6 +615,7 @@ static const struct mtk_mmc_compatible m
@@ -651,6 +660,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = false,
.enhance_rx = false,
.support_64g = false,
@ -108,23 +108,23 @@ Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
};
static const struct mtk_mmc_compatible mt8183_compat = {
@@ -619,6 +629,7 @@ static const struct mtk_mmc_compatible m
.stop_clk_fix = true,
@@ -666,6 +676,7 @@ static const struct mtk_mmc_compatible m
.stop_dly_sel = 3,
.enhance_rx = true,
.support_64g = true,
+ .support_cmd23 = true,
};
static const struct mtk_mmc_compatible mt8516_compat = {
@@ -630,6 +641,7 @@ static const struct mtk_mmc_compatible m
.data_tune = true,
@@ -678,6 +689,7 @@ static const struct mtk_mmc_compatible m
.busy_check = true,
.stop_clk_fix = true,
.stop_dly_sel = 3,
+ .support_cmd23 = true,
};
static const struct of_device_id msdc_of_ids[] = {
@@ -2913,7 +2925,9 @@ static int msdc_drv_probe(struct platfor
static const struct mtk_mmc_compatible mt8196_compat = {
@@ -3095,7 +3107,9 @@ static int msdc_drv_probe(struct platfor
if (mmc->caps & MMC_CAP_SDIO_IRQ)
mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;

View File

@ -19,23 +19,23 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
--- a/sound/soc/Kconfig
+++ b/sound/soc/Kconfig
@@ -107,6 +107,7 @@ source "sound/soc/mxs/Kconfig"
source "sound/soc/pxa/Kconfig"
@@ -125,6 +125,7 @@ source "sound/soc/pxa/Kconfig"
source "sound/soc/qcom/Kconfig"
source "sound/soc/renesas/Kconfig"
source "sound/soc/rockchip/Kconfig"
+source "sound/soc/ralink/Kconfig"
source "sound/soc/samsung/Kconfig"
source "sound/soc/sh/Kconfig"
source "sound/soc/sof/Kconfig"
source "sound/soc/sdca/Kconfig"
source "sound/soc/spear/Kconfig"
--- a/sound/soc/Makefile
+++ b/sound/soc/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_SND_SOC) += kirkwood/
obj-$(CONFIG_SND_SOC) += pxa/
@@ -67,6 +67,7 @@ obj-$(CONFIG_SND_SOC) += pxa/
obj-$(CONFIG_SND_SOC) += qcom/
obj-$(CONFIG_SND_SOC) += renesas/
obj-$(CONFIG_SND_SOC) += rockchip/
+obj-$(CONFIG_SND_SOC) += ralink/
obj-$(CONFIG_SND_SOC) += samsung/
obj-$(CONFIG_SND_SOC) += sh/
obj-$(CONFIG_SND_SOC) += sdca/
obj-$(CONFIG_SND_SOC) += sof/
--- /dev/null
+++ b/sound/soc/ralink/Kconfig
@ -234,7 +234,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ /* disable clock at slave mode */
+ if ((i2s->fmt & SND_SOC_DAIFMT_MASTER_MASK) ==
+ SND_SOC_DAIFMT_CBM_CFM) {
+ SND_SOC_DAIFMT_CBP_CFP) {
+ regmap_update_bits(i2s->regmap, I2S_REG_CFG0,
+ I2S_REG_CFG0_CLK_DIS,
+ I2S_REG_CFG0_CLK_DIS);
@ -266,7 +266,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ /* disable clock at slave mode */
+ if ((i2s->fmt & SND_SOC_DAIFMT_MASTER_MASK) ==
+ SND_SOC_DAIFMT_CBM_CFM) {
+ SND_SOC_DAIFMT_CBP_CFP) {
+ regmap_update_bits(i2s->regmap, I2S_REG_DIVCMP,
+ I2S_REG_DIVCMP_CLKEN, 0);
+ return 0;
@ -303,13 +303,13 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ /* set master/slave audio interface */
+ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+ case SND_SOC_DAIFMT_CBM_CFM:
+ case SND_SOC_DAIFMT_CBP_CFP:
+ if (i2s->flags & RALINK_FLAGS_TXONLY)
+ cfg0 |= I2S_REG_CFG0_SLAVE_EN;
+ else
+ cfg0 |= I2S_REG_CFG0_SLAVE;
+ break;
+ case SND_SOC_DAIFMT_CBS_CFS:
+ case SND_SOC_DAIFMT_CBC_CFC:
+ break;
+ default:
+ return -EINVAL;
@ -969,7 +969,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+static struct platform_driver ralink_i2s_driver = {
+ .probe = ralink_i2s_probe,
+ .remove_new = ralink_i2s_remove,
+ .remove = ralink_i2s_remove,
+ .driver = {
+ .name = DRV_NAME,
+ .of_match_table = ralink_i2s_match_table,