kernel: bump 4.19 to 4.19.88

Refreshed all patches.

Remove upstreamed:
- 0004-boot-sq201-from-sda1.patch
- 500-v4.20-ubifs-Fix-default-compression-selection-in-ubifs.patch
- 0003-usb-dwc2-use-a-longer-core-rest-timeout-in-dwc2_core.patch

Altered patches:
- 0011-ARM-dts-Fix-up-SQ201-flash-access.patch
- 400-mtd-add-rootfs-split-support.patch
- 0101-pci-mediatek-backport-fix-pcie.patch

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
This commit is contained in:
Koen Vandeputte 2019-12-06 16:25:06 +01:00
parent d395583d69
commit 88ca372b5a
26 changed files with 57 additions and 358 deletions

View File

@ -8,11 +8,11 @@ endif
LINUX_VERSION-4.9 = .206
LINUX_VERSION-4.14 = .158
LINUX_VERSION-4.19 = .86
LINUX_VERSION-4.19 = .88
LINUX_KERNEL_HASH-4.9.206 = 1df27899a9bc4dd874f3830ab9e7b638f0026dffd67a2e230444e5d2805ccad6
LINUX_KERNEL_HASH-4.14.158 = 0d49ec72e273f6fc7462ad56849b2285f13fd5f4185e8f932a0074fc2eca1bb3
LINUX_KERNEL_HASH-4.19.86 = bf2cbba319d43d1bd9e876ac0b55ab83118d1a1e61cce3c929d5371f7567bff6
LINUX_KERNEL_HASH-4.19.88 = c1923b6bd166e6dd07be860c15f59e8273aaa8692bc2a1fce1d31b826b9b3fbe
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))

View File

@ -214,7 +214,7 @@
#include <linux/uaccess.h>
#include <linux/ipv6.h>
#include <linux/icmpv6.h>
@@ -836,10 +837,10 @@ static void tcp_v6_send_response(const s
@@ -837,10 +838,10 @@ static void tcp_v6_send_response(const s
topt = (__be32 *)(t1 + 1);
if (tsecr) {

View File

@ -14,7 +14,7 @@ Signed-off-by: Eric Anholt <eric@anholt.net>
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7980,8 +7980,6 @@ int alloc_contig_range(unsigned long sta
@@ -7977,8 +7977,6 @@ int alloc_contig_range(unsigned long sta
/* Make sure the range is really isolated. */
if (test_pages_isolated(outer_start, end, false)) {

View File

@ -11,7 +11,7 @@ Signed-off-by: Noralf Tronnes <notro@tronnes.org>
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -352,7 +352,7 @@ static const struct gpio_chip bcm2835_gp
@@ -350,7 +350,7 @@ static const struct gpio_chip bcm2835_gp
.get_direction = bcm2835_gpio_get_direction,
.get = bcm2835_gpio_get,
.set = bcm2835_gpio_set,

View File

@ -125,7 +125,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
static inline int mmc_blk_part_switch(struct mmc_card *card,
unsigned int part_type);
@@ -2919,6 +2926,7 @@ static int mmc_blk_probe(struct mmc_card
@@ -2913,6 +2920,7 @@ static int mmc_blk_probe(struct mmc_card
{
struct mmc_blk_data *md, *part_md;
char cap_str[10];
@ -133,7 +133,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
/*
* Check that the card supports the command class(es) we need.
@@ -2926,7 +2934,16 @@ static int mmc_blk_probe(struct mmc_card
@@ -2920,7 +2928,16 @@ static int mmc_blk_probe(struct mmc_card
if (!(card->csd.cmdclass & CCC_BLOCK_READ))
return -ENODEV;
@ -151,7 +151,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
card->complete_wq = alloc_workqueue("mmc_complete",
WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
@@ -2941,9 +2958,14 @@ static int mmc_blk_probe(struct mmc_card
@@ -2935,9 +2952,14 @@ static int mmc_blk_probe(struct mmc_card
string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2,
cap_str, sizeof(cap_str));

View File

@ -57,7 +57,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
cfg->pwr_save = enabled;
if (!check_vif_up(ifp->vif)) {
@@ -6776,12 +6778,18 @@ static s32 brcmf_translate_country_code(
@@ -6786,12 +6788,18 @@ static s32 brcmf_translate_country_code(
struct brcmfmac_pd_cc *country_codes;
struct brcmfmac_pd_cc_entry *cc;
s32 found_index;
@ -78,7 +78,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
}
if ((alpha2[0] == ccreq->country_abbrev[0]) &&
@@ -6805,10 +6813,14 @@ static s32 brcmf_translate_country_code(
@@ -6815,10 +6823,14 @@ static s32 brcmf_translate_country_code(
brcmf_dbg(TRACE, "No country code match found\n");
return -EINVAL;
}
@ -109,7 +109,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -608,6 +608,7 @@ BRCMF_FW_DEF(4329, "brcmfmac4329-sdio");
@@ -614,6 +614,7 @@ BRCMF_FW_DEF(4329, "brcmfmac4329-sdio");
BRCMF_FW_DEF(4330, "brcmfmac4330-sdio");
BRCMF_FW_DEF(4334, "brcmfmac4334-sdio");
BRCMF_FW_DEF(43340, "brcmfmac43340-sdio");
@ -117,7 +117,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
BRCMF_FW_DEF(4335, "brcmfmac4335-sdio");
BRCMF_FW_DEF(43362, "brcmfmac43362-sdio");
BRCMF_FW_DEF(4339, "brcmfmac4339-sdio");
@@ -628,7 +629,7 @@ static const struct brcmf_firmware_mappi
@@ -634,7 +635,7 @@ static const struct brcmf_firmware_mappi
BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330),
BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334),
BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340),

View File

@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6844,6 +6844,8 @@ static void brcmf_cfg80211_reg_notifier(
@@ -6854,6 +6854,8 @@ static void brcmf_cfg80211_reg_notifier(
/* ignore non-ISO3166 country codes */
for (i = 0; i < 2; i++)
if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {

View File

@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6844,8 +6844,6 @@ static void brcmf_cfg80211_reg_notifier(
@@ -6854,8 +6854,6 @@ static void brcmf_cfg80211_reg_notifier(
/* ignore non-ISO3166 country codes */
for (i = 0; i < 2; i++)
if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {

View File

@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2149,7 +2149,7 @@ static void bcmgenet_init_tx_ring(struct
@@ -2147,7 +2147,7 @@ static void bcmgenet_init_tx_ring(struct
bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_PROD_INDEX);
bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_CONS_INDEX);

View File

@ -20,7 +20,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -285,6 +285,8 @@ int bcmgenet_mii_probe(struct net_device
@@ -318,6 +318,8 @@ int bcmgenet_mii_probe(struct net_device
/* Communicate the integrated PHY revision */
if (priv->internal_phy)
phy_flags = priv->gphy_rev;

View File

@ -28,7 +28,7 @@ compatibility for the device-tree configuration has been retained.
#define FSEL_REG(p) (GPFSEL0 + (((p) / 10) * 4))
#define FSEL_SHIFT(p) (((p) % 10) * 3)
#define GPIO_REG_OFFSET(p) ((p) / 32)
@@ -917,21 +923,45 @@ static void bcm2835_pull_config_set(stru
@@ -915,21 +921,45 @@ static void bcm2835_pull_config_set(stru
unsigned int pin, unsigned int arg)
{
u32 off, bit;

View File

@ -1,20 +0,0 @@
From 95be54e285767c5209bb51df923373f78b8c4099 Mon Sep 17 00:00:00 2001
From: Linus Walleij <linus.walleij@linaro.org>
Date: Mon, 16 Jul 2018 23:36:30 +0200
Subject: [PATCH 04/18] boot sq201 from sda1
---
arch/arm/boot/dts/gemini-sq201.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/arm/boot/dts/gemini-sq201.dts
+++ b/arch/arm/boot/dts/gemini-sq201.dts
@@ -20,7 +20,7 @@
};
chosen {
- bootargs = "console=ttyS0,115200n8";
+ bootargs = "console=ttyS0,115200n8 root=/dev/sda1 rw rootwait";
stdout-path = &uart0;
};

View File

@ -121,7 +121,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
/* 16MB of flash */
reg = <0x30000000 0x01000000>;
@@ -184,9 +177,7 @@
@@ -157,9 +150,7 @@
mux {
function = "gpio0";
groups = "gpio0fgrp",
@ -132,7 +132,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
};
};
/*
@@ -199,6 +190,18 @@
@@ -172,6 +163,18 @@
groups = "gpio1dgrp";
};
};

View File

@ -19,50 +19,8 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
};
chosen {
- bootargs = "console=ttyS0,115200n8 root=/dev/sda1 rw rootwait";
- bootargs = "console=ttyS0,115200n8 root=/dev/mtdblock2 rw rootfstype=squashfs,jffs2 rootwait";
+ bootargs = "console=ttyS0,115200n8 root=/dev/mtdblock3 rw rootfstype=squashfs,jffs2 rootwait";
stdout-path = &uart0;
};
@@ -131,37 +131,10 @@
/* 16MB of flash */
reg = <0x30000000 0x01000000>;
- partition@0 {
- label = "RedBoot";
- reg = <0x00000000 0x00120000>;
- read-only;
- };
- partition@120000 {
- label = "Kernel";
- reg = <0x00120000 0x00200000>;
- };
- partition@320000 {
- label = "Ramdisk";
- reg = <0x00320000 0x00600000>;
- };
- partition@920000 {
- label = "Application";
- reg = <0x00920000 0x00600000>;
- };
- partition@f20000 {
- label = "VCTL";
- reg = <0x00f20000 0x00020000>;
- read-only;
- };
- partition@f40000 {
- label = "CurConf";
- reg = <0x00f40000 0x000a0000>;
- read-only;
- };
- partition@fe0000 {
- label = "FIS directory";
- reg = <0x00fe0000 0x00020000>;
- read-only;
+ partitions {
+ compatible = "redboot-fis";
+ /* Eraseblock at 0xfe0000 */
+ fis-index-block = <0x1fc>;
};
};

View File

@ -1,46 +0,0 @@
From d62e98ed1efcaa94caa004f622944afdce5f1c3c Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sun, 9 Dec 2018 18:12:13 +0100
Subject: [PATCH] ubifs: Fix default compression selection in ubifs
When ubifs is build without the LZO compressor and no compressor is
given the creation of the default file system will fail. before
selection the LZO compressor check if it is present and if not fall back
to the zlib or none.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
---
fs/ubifs/sb.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -63,6 +63,17 @@
/* Default time granularity in nanoseconds */
#define DEFAULT_TIME_GRAN 1000000000
+static int get_default_compressor(struct ubifs_info *c)
+{
+ if (ubifs_compr_present(c, UBIFS_COMPR_LZO))
+ return UBIFS_COMPR_LZO;
+
+ if (ubifs_compr_present(c, UBIFS_COMPR_ZLIB))
+ return UBIFS_COMPR_ZLIB;
+
+ return UBIFS_COMPR_NONE;
+}
+
/**
* create_default_filesystem - format empty UBI volume.
* @c: UBIFS file-system description object
@@ -186,7 +197,7 @@ static int create_default_filesystem(str
if (c->mount_opts.override_compr)
sup->default_compr = cpu_to_le16(c->mount_opts.compr_type);
else
- sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO);
+ sup->default_compr = cpu_to_le16(get_default_compressor(c));
generate_random_uuid(sup->uuid);

View File

@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3485,6 +3485,8 @@ static __net_initdata struct pernet_oper
@@ -3486,6 +3486,8 @@ static __net_initdata struct pernet_oper
static int __init proto_init(void)
{

View File

@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
help
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -117,6 +117,7 @@ obj-$(CONFIG_TORTURE_TEST) += torture.o
@@ -114,6 +114,7 @@ obj-$(CONFIG_TORTURE_TEST) += torture.o
obj-$(CONFIG_HAS_IOMEM) += iomem.o
obj-$(CONFIG_ZONE_DEVICE) += memremap.o
obj-$(CONFIG_RSEQ) += rseq.o

View File

@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf <dev-NTEO@vplace.de>
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6403,7 +6403,7 @@ static void __ref alloc_node_mem_map(str
@@ -6400,7 +6400,7 @@ static void __ref alloc_node_mem_map(str
mem_map = NODE_DATA(0)->node_mem_map;
#if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM)
if (page_to_pfn(mem_map) != pgdat->node_start_pfn)

View File

@ -59,15 +59,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/*
* Given a pointer to the MTD object in the mtd_part structure, we can retrieve
* the pointer to that structure.
@@ -623,6 +627,7 @@ int mtd_add_partition(struct mtd_info *p
mutex_unlock(&mtd_partitions_mutex);
@@ -626,6 +630,7 @@ int mtd_add_partition(struct mtd_info *p
if (ret)
goto err_remove_part;
add_mtd_device(&new->mtd);
+ mtd_partition_split(parent, new);
mtd_add_partition_attrs(new);
@@ -701,6 +706,29 @@ int mtd_del_partition(struct mtd_info *m
return 0;
@@ -712,6 +717,29 @@ int mtd_del_partition(struct mtd_info *m
}
EXPORT_SYMBOL_GPL(mtd_del_partition);
@ -97,10 +97,10 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/*
* This function, given a master MTD object and a partition table, creates
* and registers slave MTD objects which are bound to the master according to
@@ -732,6 +760,7 @@ int add_mtd_partitions(struct mtd_info *
mutex_unlock(&mtd_partitions_mutex);
@@ -752,6 +780,7 @@ int add_mtd_partitions(struct mtd_info *
goto err_del_partitions;
}
add_mtd_device(&slave->mtd);
+ mtd_partition_split(master, slave);
mtd_add_partition_attrs(slave);
/* Look for subpartitions */

View File

@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
/*
* Given a pointer to the MTD object in the mtd_part structure, we can retrieve
@@ -706,6 +710,36 @@ int mtd_del_partition(struct mtd_info *m
@@ -717,6 +721,36 @@ int mtd_del_partition(struct mtd_info *m
}
EXPORT_SYMBOL_GPL(mtd_del_partition);
@ -57,7 +57,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME
#else
@@ -1041,6 +1075,61 @@ void mtd_part_parser_cleanup(struct mtd_
@@ -1066,6 +1100,61 @@ void mtd_part_parser_cleanup(struct mtd_
}
}

View File

@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -748,6 +748,7 @@ run_parsers_by_type(struct mtd_part *sla
@@ -759,6 +759,7 @@ run_parsers_by_type(struct mtd_part *sla
static void split_firmware(struct mtd_info *master, struct mtd_part *part)
{
@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
}
static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part)
@@ -757,6 +758,12 @@ static void mtd_partition_split(struct m
@@ -768,6 +769,12 @@ static void mtd_partition_split(struct m
if (rootfs_found)
return;

View File

@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -1154,6 +1154,24 @@ int mtd_is_partition(const struct mtd_in
@@ -1179,6 +1179,24 @@ int mtd_is_partition(const struct mtd_in
}
EXPORT_SYMBOL_GPL(mtd_is_partition);

View File

@ -31,7 +31,7 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
help
--- a/init/main.c
+++ b/init/main.c
@@ -366,6 +366,29 @@ static inline void setup_nr_cpu_ids(void
@@ -365,6 +365,29 @@ static inline void setup_nr_cpu_ids(void
static inline void smp_prepare_cpus(unsigned int maxcpus) { }
#endif
@ -61,7 +61,7 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
/*
* We need to store the untouched command line for future reference.
* We also need to store the touched command line since the parameter
@@ -558,6 +581,7 @@ asmlinkage __visible void __init start_k
@@ -557,6 +580,7 @@ asmlinkage __visible void __init start_k
add_device_randomness(command_line, strlen(command_line));
boot_init_stack_canary();
mm_init_cpumask(&init_mm);

View File

@ -1,29 +0,0 @@
From 09bbf8c732e7a6ce290fc7c2d5a3e79ec6c3e8d2 Mon Sep 17 00:00:00 2001
From: Mathias Kresin <dev@kresin.me>
Date: Wed, 3 Jul 2019 17:03:02 +0200
Subject: [PATCH] usb: dwc2: use a longer core rest timeout in
dwc2_core_reset()
Testing on different generations of Lantiq MIPS SoC based boards, showed
that it takes up to 1500 us until the core reset bit is cleared.
The driver from the vendor SDK (ifxhcd) uses a 1 second timeout. Use the
same timeout to fix wrong hang detections and make the driver work for
Lantiq MIPS SoCs.
Signed-off-by: Mathias Kresin <dev@kresin.me>
---
drivers/usb/dwc2/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -524,7 +524,7 @@ int dwc2_core_reset(struct dwc2_hsotg *h
greset |= GRSTCTL_CSFTRST;
dwc2_writel(hsotg, greset, GRSTCTL);
- if (dwc2_hsotg_wait_bit_clear(hsotg, GRSTCTL, GRSTCTL_CSFTRST, 50)) {
+ if (dwc2_hsotg_wait_bit_clear(hsotg, GRSTCTL, GRSTCTL_CSFTRST, 10000)) {
dev_warn(hsotg->dev, "%s: HANG! Soft Reset timeout GRSTCTL GRSTCTL_CSFTRST\n",
__func__);
return -EBUSY;

View File

@ -57,83 +57,7 @@
}
static void mtk_pcie_port_free(struct mtk_pcie_port *port)
@@ -394,75 +395,6 @@ static struct pci_ops mtk_pcie_ops_v2 =
.write = mtk_pcie_config_write,
};
-static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port)
-{
- struct mtk_pcie *pcie = port->pcie;
- struct resource *mem = &pcie->mem;
- const struct mtk_pcie_soc *soc = port->pcie->soc;
- u32 val;
- size_t size;
- int err;
-
- /* MT7622 platforms need to enable LTSSM and ASPM from PCIe subsys */
- if (pcie->base) {
- val = readl(pcie->base + PCIE_SYS_CFG_V2);
- val |= PCIE_CSR_LTSSM_EN(port->slot) |
- PCIE_CSR_ASPM_L1_EN(port->slot);
- writel(val, pcie->base + PCIE_SYS_CFG_V2);
- }
-
- /* Assert all reset signals */
- writel(0, port->base + PCIE_RST_CTRL);
-
- /*
- * Enable PCIe link down reset, if link status changed from link up to
- * link down, this will reset MAC control registers and configuration
- * space.
- */
- writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL);
-
- /* De-assert PHY, PE, PIPE, MAC and configuration reset */
- val = readl(port->base + PCIE_RST_CTRL);
- val |= PCIE_PHY_RSTB | PCIE_PERSTB | PCIE_PIPE_SRSTB |
- PCIE_MAC_SRSTB | PCIE_CRSTB;
- writel(val, port->base + PCIE_RST_CTRL);
-
- /* Set up vendor ID and class code */
- if (soc->need_fix_class_id) {
- val = PCI_VENDOR_ID_MEDIATEK;
- writew(val, port->base + PCIE_CONF_VEND_ID);
-
- val = PCI_CLASS_BRIDGE_HOST;
- writew(val, port->base + PCIE_CONF_CLASS_ID);
- }
-
- /* 100ms timeout value should be enough for Gen1/2 training */
- err = readl_poll_timeout(port->base + PCIE_LINK_STATUS_V2, val,
- !!(val & PCIE_PORT_LINKUP_V2), 20,
- 100 * USEC_PER_MSEC);
- if (err)
- return -ETIMEDOUT;
-
- /* Set INTx mask */
- val = readl(port->base + PCIE_INT_MASK);
- val &= ~INTX_MASK;
- writel(val, port->base + PCIE_INT_MASK);
-
- /* Set AHB to PCIe translation windows */
- size = mem->end - mem->start;
- val = lower_32_bits(mem->start) | AHB2PCIE_SIZE(fls(size));
- writel(val, port->base + PCIE_AHB_TRANS_BASE0_L);
-
- val = upper_32_bits(mem->start);
- writel(val, port->base + PCIE_AHB_TRANS_BASE0_H);
-
- /* Set PCIe to AXI translation memory space.*/
- val = fls(0xffffffff) | WIN_ENABLE;
- writel(val, port->base + PCIE_AXI_WINDOW0);
-
- return 0;
-}
-
static void mtk_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
{
struct mtk_pcie_port *port = irq_data_get_irq_chip_data(data);
@@ -601,6 +533,27 @@ static void mtk_pcie_enable_msi(struct m
@@ -532,6 +533,27 @@ static void mtk_pcie_enable_msi(struct m
writel(val, port->base + PCIE_INT_MASK);
}
@ -161,7 +85,7 @@
static int mtk_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
irq_hw_number_t hwirq)
{
@@ -630,6 +583,7 @@ static int mtk_pcie_init_irq_domain(stru
@@ -561,6 +583,7 @@ static int mtk_pcie_init_irq_domain(stru
port->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX,
&intx_domain_ops, port);
@ -169,16 +93,7 @@
if (!port->irq_domain) {
dev_err(dev, "failed to get INTx IRQ domain\n");
return -ENODEV;
@@ -639,8 +593,6 @@ static int mtk_pcie_init_irq_domain(stru
ret = mtk_pcie_allocate_msi_domains(port);
if (ret)
return ret;
-
- mtk_pcie_enable_msi(port);
}
return 0;
@@ -693,7 +645,7 @@ static int mtk_pcie_setup_irq(struct mtk
@@ -622,7 +645,7 @@ static int mtk_pcie_setup_irq(struct mtk
struct mtk_pcie *pcie = port->pcie;
struct device *dev = pcie->dev;
struct platform_device *pdev = to_platform_device(dev);
@ -187,7 +102,7 @@
err = mtk_pcie_init_irq_domain(port, node);
if (err) {
@@ -701,8 +653,81 @@ static int mtk_pcie_setup_irq(struct mtk
@@ -630,8 +653,9 @@ static int mtk_pcie_setup_irq(struct mtk
return err;
}
@ -196,82 +111,10 @@
+ port->irq = platform_get_irq(pdev, port->slot);
+ irq_set_chained_handler_and_data(port->irq,
+ mtk_pcie_intr_handler, port);
+
+ return 0;
+}
+
+static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port)
+{
+ struct mtk_pcie *pcie = port->pcie;
+ struct resource *mem = &pcie->mem;
+ const struct mtk_pcie_soc *soc = port->pcie->soc;
+ u32 val;
+ size_t size;
+ int err;
+
+ /* MT7622 platforms need to enable LTSSM and ASPM from PCIe subsys */
+ if (pcie->base) {
+ val = readl(pcie->base + PCIE_SYS_CFG_V2);
+ val |= PCIE_CSR_LTSSM_EN(port->slot) |
+ PCIE_CSR_ASPM_L1_EN(port->slot);
+ writel(val, pcie->base + PCIE_SYS_CFG_V2);
+ }
+
+ /* Assert all reset signals */
+ writel(0, port->base + PCIE_RST_CTRL);
+
+ /*
+ * Enable PCIe link down reset, if link status changed from link up to
+ * link down, this will reset MAC control registers and configuration
+ * space.
+ */
+ writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL);
+
+ /* De-assert PHY, PE, PIPE, MAC and configuration reset */
+ val = readl(port->base + PCIE_RST_CTRL);
+ val |= PCIE_PHY_RSTB | PCIE_PERSTB | PCIE_PIPE_SRSTB |
+ PCIE_MAC_SRSTB | PCIE_CRSTB;
+ writel(val, port->base + PCIE_RST_CTRL);
+
+ /* Set up vendor ID and class code */
+ if (soc->need_fix_class_id) {
+ val = PCI_VENDOR_ID_MEDIATEK;
+ writew(val, port->base + PCIE_CONF_VEND_ID);
+
+ val = PCI_CLASS_BRIDGE_PCI;
+ writew(val, port->base + PCIE_CONF_CLASS_ID);
+ }
+
+ /* 100ms timeout value should be enough for Gen1/2 training */
+ err = readl_poll_timeout(port->base + PCIE_LINK_STATUS_V2, val,
+ !!(val & PCIE_PORT_LINKUP_V2), 20,
+ 100 * USEC_PER_MSEC);
+ if (err)
+ return -ETIMEDOUT;
+
+ /* Set INTx mask */
+ val = readl(port->base + PCIE_INT_MASK);
+ val &= ~INTX_MASK;
+ writel(val, port->base + PCIE_INT_MASK);
+
+ if (IS_ENABLED(CONFIG_PCI_MSI))
+ mtk_pcie_enable_msi(port);
+
+ /* Set AHB to PCIe translation windows */
+ size = mem->end - mem->start;
+ val = lower_32_bits(mem->start) | AHB2PCIE_SIZE(fls(size));
+ writel(val, port->base + PCIE_AHB_TRANS_BASE0_L);
+
+ val = upper_32_bits(mem->start);
+ writel(val, port->base + PCIE_AHB_TRANS_BASE0_H);
+
+ /* Set PCIe to AXI translation memory space.*/
+ val = fls(0xffffffff) | WIN_ENABLE;
+ writel(val, port->base + PCIE_AXI_WINDOW0);
return 0;
}
@@ -903,49 +928,29 @@ static int mtk_pcie_parse_port(struct mt
@@ -904,49 +928,29 @@ static int mtk_pcie_parse_port(struct mt
/* sys_ck might be divided into the following parts in some chips */
snprintf(name, sizeof(name), "ahb_ck%d", slot);
@ -336,7 +179,7 @@
snprintf(name, sizeof(name), "pcie-rst%d", slot);
port->reset = devm_reset_control_get_optional_exclusive(dev, name);
@@ -998,10 +1003,8 @@ static int mtk_pcie_subsys_powerup(struc
@@ -999,10 +1003,8 @@ static int mtk_pcie_subsys_powerup(struc
pcie->free_ck = NULL;
}
@ -349,7 +192,7 @@
/* enable top level clock */
err = clk_prepare_enable(pcie->free_ck);
@@ -1013,10 +1016,8 @@ static int mtk_pcie_subsys_powerup(struc
@@ -1014,10 +1016,8 @@ static int mtk_pcie_subsys_powerup(struc
return 0;
err_free_ck:
@ -362,19 +205,16 @@
return err;
}
@@ -1122,8 +1122,6 @@
@@ -1122,36 +1122,6 @@ static int mtk_pcie_request_resources(st
return err;
err = devm_pci_remap_iospace(dev, &pcie->pio, pcie->io.start);
- if (err)
- return err;
return 0;
}
@@ -1127,34 +1128,6 @@ static int mtk_pcie_request_resources(st
return 0;
}
-
- return 0;
-}
-
-static int mtk_pcie_register_host(struct pci_host_bridge *host)
-{
- struct mtk_pcie *pcie = pci_host_bridge_priv(host);
@ -399,14 +239,10 @@
- pcie_bus_configure_settings(child);
-
- pci_bus_add_devices(host->bus);
-
- return 0;
-}
-
static int mtk_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -1181,7 +1154,14 @@ static int mtk_pcie_probe(struct platfor
return 0;
}
@@ -1182,7 +1152,14 @@ static int mtk_pcie_probe(struct platfor
if (err)
goto put_resources;
@ -422,7 +258,7 @@
if (err)
goto put_resources;
@@ -1194,6 +1174,80 @@ put_resources:
@@ -1195,6 +1172,80 @@ put_resources:
return err;
}
@ -503,7 +339,7 @@
static const struct mtk_pcie_soc mtk_pcie_soc_v1 = {
.ops = &mtk_pcie_ops,
.startup = mtk_pcie_startup_port,
@@ -1222,10 +1276,13 @@ static const struct of_device_id mtk_pci
@@ -1223,10 +1274,13 @@ static const struct of_device_id mtk_pci
static struct platform_driver mtk_pcie_driver = {
.probe = mtk_pcie_probe,

View File

@ -180,7 +180,7 @@ Signed-off-by: Michael Gray <michael.gray@lantisproject.com>
static int kernel_init(void *);
extern void init_IRQ(void);
@@ -592,6 +596,18 @@ asmlinkage __visible void __init start_k
@@ -591,6 +595,18 @@ asmlinkage __visible void __init start_k
page_alloc_init();
pr_notice("Kernel command line: %s\n", boot_command_line);