summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-08-24 20:24:21 -0400
committerTom Rini <trini@konsulko.com>2020-08-25 08:12:05 -0400
commit8ee3a24fdc237c76cead618a173740594287dd96 (patch)
treea19a58ee49166c02dce5bdb35262bb48c2078e8c /drivers
parent3c0cec035e5b06b638fb52ccd7383bbd5bcede35 (diff)
parent3337b291442e31b1db0ff5975f74fec7d9741794 (diff)
Merge branch '2020-08-24-misc-improvements'
- Squashfs compression support - Coverity fixes - XEN guest updates - Finish previous MediaTek updates - Arm Total Compute platform support
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/mtk_ahci.c6
-rw-r--r--drivers/clk/mediatek/clk-mt7622.c43
-rw-r--r--drivers/firmware/psci.c6
-rw-r--r--drivers/phy/phy-mtk-tphy.c5
-rw-r--r--drivers/virtio/virtio_blk.c1
-rw-r--r--drivers/xen/gnttab.c3
-rw-r--r--drivers/xen/pvblock.c12
7 files changed, 61 insertions, 15 deletions
diff --git a/drivers/ata/mtk_ahci.c b/drivers/ata/mtk_ahci.c
index 8e09c5f9e6..4ad260a5bb 100644
--- a/drivers/ata/mtk_ahci.c
+++ b/drivers/ata/mtk_ahci.c
@@ -2,12 +2,10 @@
/*
* MTK SATA platform driver
*
- * (C) Copyright 2020
- * Mediatek
+ * Copyright (C) 2020 MediaTek Inc.
*
- * Author: Frank Wunderlich <frank-w@public-files.de>
- * based on https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/ata/ahci_mtk.c
* Author: Ryder Lee <ryder.lee@mediatek.com>
+ * Author: Frank Wunderlich <frank-w@public-files.de>
*/
#include <common.h>
diff --git a/drivers/clk/mediatek/clk-mt7622.c b/drivers/clk/mediatek/clk-mt7622.c
index d53ed69189..0246149107 100644
--- a/drivers/clk/mediatek/clk-mt7622.c
+++ b/drivers/clk/mediatek/clk-mt7622.c
@@ -521,6 +521,20 @@ static const struct mtk_gate_regs sgmii_cg_regs = {
.flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \
}
+static const struct mtk_gate_regs ssusb_cg_regs = {
+ .set_ofs = 0x30,
+ .clr_ofs = 0x30,
+ .sta_ofs = 0x30,
+};
+
+#define GATE_SSUSB(_id, _parent, _shift) { \
+ .id = _id, \
+ .parent = _parent, \
+ .regs = &ssusb_cg_regs, \
+ .shift = _shift, \
+ .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \
+}
+
static const struct mtk_gate sgmii_cgs[] = {
GATE_SGMII(CLK_SGMII_TX250M_EN, CLK_TOP_SSUSB_TX250M, 2),
GATE_SGMII(CLK_SGMII_RX250M_EN, CLK_TOP_SSUSB_EQ_RX250M, 3),
@@ -528,6 +542,15 @@ static const struct mtk_gate sgmii_cgs[] = {
GATE_SGMII(CLK_SGMII_CDR_FB, CLK_TOP_SSUSB_CDR_FB, 5),
};
+static const struct mtk_gate ssusb_cgs[] = {
+ GATE_SSUSB(CLK_SSUSB_U2_PHY_1P_EN, CLK_TOP_TO_U2_PHY_1P, 0),
+ GATE_SSUSB(CLK_SSUSB_U2_PHY_EN, CLK_TOP_TO_U2_PHY, 1),
+ GATE_SSUSB(CLK_SSUSB_REF_EN, CLK_TOP_TO_USB3_REF, 5),
+ GATE_SSUSB(CLK_SSUSB_SYS_EN, CLK_TOP_TO_USB3_SYS, 6),
+ GATE_SSUSB(CLK_SSUSB_MCU_EN, CLK_TOP_AXI_SEL, 7),
+ GATE_SSUSB(CLK_SSUSB_DMA_EN, CLK_TOP_HIF_SEL, 8),
+};
+
static const struct mtk_clk_tree mt7622_clk_tree = {
.xtal_rate = 25 * MHZ,
.xtal2_rate = 25 * MHZ,
@@ -599,7 +622,6 @@ static int mt7622_pciesys_bind(struct udevice *dev)
int ret = 0;
if (IS_ENABLED(CONFIG_RESET_MEDIATEK)) {
-// PCIESYS uses in linux also 0x34 = ETHSYS reset controller
ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1);
if (ret)
debug("Warning: failed to bind reset controller\n");
@@ -631,6 +653,11 @@ static int mt7622_sgmiisys_probe(struct udevice *dev)
return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, sgmii_cgs);
}
+static int mt7622_ssusbsys_probe(struct udevice *dev)
+{
+ return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, ssusb_cgs);
+}
+
static const struct udevice_id mt7622_apmixed_compat[] = {
{ .compatible = "mediatek,mt7622-apmixedsys" },
{ }
@@ -671,6 +698,11 @@ static const struct udevice_id mt7622_mcucfg_compat[] = {
{ }
};
+static const struct udevice_id mt7622_ssusbsys_compat[] = {
+ { .compatible = "mediatek,mt7622-ssusbsys" },
+ { }
+};
+
U_BOOT_DRIVER(mtk_mcucfg) = {
.name = "mt7622-mcucfg",
.id = UCLASS_SYSCON,
@@ -747,3 +779,12 @@ U_BOOT_DRIVER(mtk_clk_sgmiisys) = {
.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
.ops = &mtk_clk_gate_ops,
};
+
+U_BOOT_DRIVER(mtk_clk_ssusbsys) = {
+ .name = "mt7622-clock-ssusbsys",
+ .id = UCLASS_CLK,
+ .of_match = mt7622_ssusbsys_compat,
+ .probe = mt7622_ssusbsys_probe,
+ .priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
+ .ops = &mtk_clk_gate_ops,
+};
diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index 7d2e49fd3e..68953cc4f4 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -19,6 +19,7 @@
#include <linux/errno.h>
#include <linux/printk.h>
#include <linux/psci.h>
+#include <asm/system.h>
#define DRIVER_NAME "psci"
@@ -73,6 +74,11 @@ static int psci_probe(struct udevice *dev)
{
const char *method;
+#if defined(CONFIG_ARM64)
+ if (current_el() == 3)
+ return -EINVAL;
+#endif
+
method = ofnode_read_string(dev_ofnode(dev), "method");
if (!method) {
pr_warn("missing \"method\" property\n");
diff --git a/drivers/phy/phy-mtk-tphy.c b/drivers/phy/phy-mtk-tphy.c
index 326227a30d..3d7b9cd2b1 100644
--- a/drivers/phy/phy-mtk-tphy.c
+++ b/drivers/phy/phy-mtk-tphy.c
@@ -698,11 +698,10 @@ static int mtk_tphy_probe(struct udevice *dev)
tphy->dev = dev;
tphy->version = dev_get_driver_data(dev);
- /* v1 has shared banks */
+ /* v1 has shared banks for usb/pcie mode, */
+ /* but not for sata mode */
if (tphy->version == MTK_TPHY_V1) {
tphy->sif_base = dev_read_addr_ptr(dev);
- if (!tphy->sif_base)
- return -ENOENT;
}
dev_for_each_subnode(subnode, dev) {
diff --git a/drivers/virtio/virtio_blk.c b/drivers/virtio/virtio_blk.c
index 992118c607..1799f5c5eb 100644
--- a/drivers/virtio/virtio_blk.c
+++ b/drivers/virtio/virtio_blk.c
@@ -115,6 +115,7 @@ static int virtio_blk_probe(struct udevice *dev)
return ret;
desc->blksz = 512;
+ desc->log2blksz = 9;
virtio_cread(dev, struct virtio_blk_config, capacity, &cap);
desc->lba = cap;
diff --git a/drivers/xen/gnttab.c b/drivers/xen/gnttab.c
index becf7a79fb..9bf1091ab3 100644
--- a/drivers/xen/gnttab.c
+++ b/drivers/xen/gnttab.c
@@ -100,7 +100,8 @@ int gnttab_end_access(grant_ref_t ref)
nflags = gnttab_table[ref].flags;
do {
- if ((flags = nflags) & (GTF_reading | GTF_writing)) {
+ flags = nflags;
+ if ((flags) & (GTF_reading | GTF_writing)) {
printf("WARNING: g.e. still in use! (%x)\n", flags);
return 0;
}
diff --git a/drivers/xen/pvblock.c b/drivers/xen/pvblock.c
index 76e82fbf41..1b3325bbe2 100644
--- a/drivers/xen/pvblock.c
+++ b/drivers/xen/pvblock.c
@@ -294,8 +294,8 @@ static void shutdown_blkfront(struct blkfront_dev *dev)
snprintf(path, sizeof(path), "%s/state", dev->backend);
snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
- if ((err = xenbus_switch_state(XBT_NIL, nodename,
- XenbusStateClosing)) != NULL) {
+ err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing);
+ if (err) {
printf("%s: error changing state to %d: %s\n", __func__,
XenbusStateClosing, err);
goto close;
@@ -306,8 +306,8 @@ static void shutdown_blkfront(struct blkfront_dev *dev)
err = xenbus_wait_for_state_change(path, &state);
free(err);
- if ((err = xenbus_switch_state(XBT_NIL, nodename,
- XenbusStateClosed)) != NULL) {
+ err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed);
+ if (err) {
printf("%s: error changing state to %d: %s\n", __func__,
XenbusStateClosed, err);
goto close;
@@ -319,8 +319,8 @@ static void shutdown_blkfront(struct blkfront_dev *dev)
free(err);
}
- if ((err = xenbus_switch_state(XBT_NIL, nodename,
- XenbusStateInitialising)) != NULL) {
+ err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateInitialising);
+ if (err) {
printf("%s: error changing state to %d: %s\n", __func__,
XenbusStateInitialising, err);
goto close;