aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-11-16 09:51:16 -0500
committerTom Rini <trini@konsulko.com>2020-11-16 09:51:16 -0500
commitbcdaec13dff18a7ecf0aa0fc9395dc4c3f3a5438 (patch)
tree9b1b570e40ffccf587f0e0cd019bd9a11e0c425a
parentdd070751b50ce4ed1a430c09e639ac9dfa40da9f (diff)
parentc87eab81616d671a6004ffc95847bad21b7eb005 (diff)
downloadu-boot-WIP/16Nov2020.zip
u-boot-WIP/16Nov2020.tar.gz
u-boot-WIP/16Nov2020.tar.bz2
Merge tag 'u-boot-amlogic-20201116' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogicWIP/16Nov2020
- Clock fix MMC driver for SM1 based platforms - sync SOC Ids from Linux 5.10-rc1 - fix potential build warning on meson_dw_hdmi and meson-g12a-usb2 phy
-rw-r--r--arch/arm/dts/meson-g12b-a311d-khadas-vim3-u-boot.dtsi1
-rw-r--r--arch/arm/dts/meson-khadas-vim3-u-boot.dtsi2
-rw-r--r--arch/arm/dts/meson-sm1-khadas-vim3l-u-boot.dtsi1
-rw-r--r--arch/arm/dts/meson-sm1-odroid-c4-u-boot.dtsi2
-rw-r--r--arch/arm/dts/meson-sm1-sei610-u-boot.dtsi2
-rw-r--r--arch/arm/dts/meson-sm1-u-boot.dtsi20
-rw-r--r--arch/arm/mach-meson/board-info.c7
-rw-r--r--drivers/mmc/meson_gx_mmc.c29
-rw-r--r--drivers/mmc/meson_gx_mmc.h (renamed from arch/arm/include/asm/arch-meson/sd_emmc.h)10
-rw-r--r--drivers/phy/meson-g12a-usb2.c4
-rw-r--r--drivers/video/meson/meson_dw_hdmi.c2
11 files changed, 64 insertions, 16 deletions
diff --git a/arch/arm/dts/meson-g12b-a311d-khadas-vim3-u-boot.dtsi b/arch/arm/dts/meson-g12b-a311d-khadas-vim3-u-boot.dtsi
index f66eca1..489efa1 100644
--- a/arch/arm/dts/meson-g12b-a311d-khadas-vim3-u-boot.dtsi
+++ b/arch/arm/dts/meson-g12b-a311d-khadas-vim3-u-boot.dtsi
@@ -4,4 +4,5 @@
* Author: Neil Armstrong <narmstrong@baylibre.com>
*/
+#include "meson-g12-common-u-boot.dtsi"
#include "meson-khadas-vim3-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-khadas-vim3-u-boot.dtsi b/arch/arm/dts/meson-khadas-vim3-u-boot.dtsi
index b5da4fd..81fd5be 100644
--- a/arch/arm/dts/meson-khadas-vim3-u-boot.dtsi
+++ b/arch/arm/dts/meson-khadas-vim3-u-boot.dtsi
@@ -4,8 +4,6 @@
* Author: Neil Armstrong <narmstrong@baylibre.com>
*/
-#include "meson-g12-common-u-boot.dtsi"
-
/ {
aliases {
spi0 = &spifc;
diff --git a/arch/arm/dts/meson-sm1-khadas-vim3l-u-boot.dtsi b/arch/arm/dts/meson-sm1-khadas-vim3l-u-boot.dtsi
index f66eca1..a591c0c 100644
--- a/arch/arm/dts/meson-sm1-khadas-vim3l-u-boot.dtsi
+++ b/arch/arm/dts/meson-sm1-khadas-vim3l-u-boot.dtsi
@@ -4,4 +4,5 @@
* Author: Neil Armstrong <narmstrong@baylibre.com>
*/
+#include "meson-sm1-u-boot.dtsi"
#include "meson-khadas-vim3-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-sm1-odroid-c4-u-boot.dtsi b/arch/arm/dts/meson-sm1-odroid-c4-u-boot.dtsi
index 2a8f054..c431988 100644
--- a/arch/arm/dts/meson-sm1-odroid-c4-u-boot.dtsi
+++ b/arch/arm/dts/meson-sm1-odroid-c4-u-boot.dtsi
@@ -4,7 +4,7 @@
* Author: Neil Armstrong <narmstrong@baylibre.com>
*/
-#include "meson-g12-common-u-boot.dtsi"
+#include "meson-sm1-u-boot.dtsi"
&ethmac {
snps,reset-gpio = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
diff --git a/arch/arm/dts/meson-sm1-sei610-u-boot.dtsi b/arch/arm/dts/meson-sm1-sei610-u-boot.dtsi
index 236f246..8ebc1ca 100644
--- a/arch/arm/dts/meson-sm1-sei610-u-boot.dtsi
+++ b/arch/arm/dts/meson-sm1-sei610-u-boot.dtsi
@@ -4,4 +4,4 @@
* Author: Neil Armstrong <narmstrong@baylibre.com>
*/
-#include "meson-g12-common-u-boot.dtsi"
+#include "meson-sm1-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-sm1-u-boot.dtsi b/arch/arm/dts/meson-sm1-u-boot.dtsi
new file mode 100644
index 0000000..e05d4c3
--- /dev/null
+++ b/arch/arm/dts/meson-sm1-u-boot.dtsi
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 BayLibre, SAS.
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include "meson-g12-common-u-boot.dtsi"
+
+&sd_emmc_a {
+ compatible = "amlogic,meson-sm1-mmc";
+};
+
+&sd_emmc_b {
+ compatible = "amlogic,meson-sm1-mmc";
+};
+
+&sd_emmc_c {
+ compatible = "amlogic,meson-sm1-mmc";
+};
+
diff --git a/arch/arm/mach-meson/board-info.c b/arch/arm/mach-meson/board-info.c
index 3abb27e..e61d1ad 100644
--- a/arch/arm/mach-meson/board-info.c
+++ b/arch/arm/mach-meson/board-info.c
@@ -38,6 +38,7 @@ static const struct meson_gx_soc_id {
{ "G12A", 0x28 },
{ "G12B", 0x29 },
{ "SM1", 0x2b },
+ { "A1", 0x2c },
};
static const struct meson_gx_package_id {
@@ -65,7 +66,11 @@ static const struct meson_gx_package_id {
{ "S905X2", 0x28, 0x40, 0xf0 },
{ "A311D", 0x29, 0x10, 0xf0 },
{ "S922X", 0x29, 0x40, 0xf0 },
- { "S905X3", 0x2b, 0x5, 0xf },
+ { "S905D3", 0x2b, 0x4, 0xf5 },
+ { "S905X3", 0x2b, 0x5, 0xf5 },
+ { "S905X3", 0x2b, 0x10, 0x3f },
+ { "S905D3", 0x2b, 0x30, 0x3f },
+ { "A113L", 0x2c, 0x0, 0xf8 },
};
DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c
index 719dd1e..a5e9ac5 100644
--- a/drivers/mmc/meson_gx_mmc.c
+++ b/drivers/mmc/meson_gx_mmc.c
@@ -13,9 +13,17 @@
#include <mmc.h>
#include <asm/io.h>
#include <asm/gpio.h>
-#include <asm/arch/sd_emmc.h>
#include <linux/delay.h>
#include <linux/log2.h>
+#include "meson_gx_mmc.h"
+
+bool meson_gx_mmc_is_compatible(struct udevice *dev,
+ enum meson_gx_mmc_compatible family)
+{
+ enum meson_gx_mmc_compatible compat = dev_get_driver_data(dev);
+
+ return compat == family;
+}
static inline void *get_regbase(const struct mmc *mmc)
{
@@ -42,6 +50,8 @@ static void meson_mmc_config_clock(struct mmc *mmc)
if (!mmc->clock)
return;
+ /* TOFIX This should use the proper clock taken from DT */
+
/* 1GHz / CLK_MAX_DIV = 15,9 MHz */
if (mmc->clock > 16000000) {
clk = SD_EMMC_CLKSRC_DIV2;
@@ -52,8 +62,16 @@ static void meson_mmc_config_clock(struct mmc *mmc)
}
clk_div = DIV_ROUND_UP(clk, mmc->clock);
- /* 180 phase core clock */
- meson_mmc_clk |= CLK_CO_PHASE_180;
+ /*
+ * SM1 SoCs doesn't work fine over 50MHz with CLK_CO_PHASE_180
+ * If CLK_CO_PHASE_270 is used, it's more stable than other.
+ * Other SoCs use CLK_CO_PHASE_180 by default.
+ * It needs to find what is a proper value about each SoCs.
+ */
+ if (meson_gx_mmc_is_compatible(mmc->dev, MMC_COMPATIBLE_SM1))
+ meson_mmc_clk |= CLK_CO_PHASE_270;
+ else
+ meson_mmc_clk |= CLK_CO_PHASE_180;
/* 180 phase tx clock */
meson_mmc_clk |= CLK_TX_PHASE_000;
@@ -308,8 +326,9 @@ int meson_mmc_bind(struct udevice *dev)
}
static const struct udevice_id meson_mmc_match[] = {
- { .compatible = "amlogic,meson-gx-mmc" },
- { .compatible = "amlogic,meson-axg-mmc" },
+ { .compatible = "amlogic,meson-gx-mmc", .data = MMC_COMPATIBLE_GX },
+ { .compatible = "amlogic,meson-axg-mmc", .data = MMC_COMPATIBLE_GX },
+ { .compatible = "amlogic,meson-sm1-mmc", .data = MMC_COMPATIBLE_SM1 },
{ /* sentinel */ }
};
diff --git a/arch/arm/include/asm/arch-meson/sd_emmc.h b/drivers/mmc/meson_gx_mmc.h
index 1e9f8cf..92aec53 100644
--- a/arch/arm/include/asm/arch-meson/sd_emmc.h
+++ b/drivers/mmc/meson_gx_mmc.h
@@ -3,14 +3,16 @@
* (C) Copyright 2016 Carlo Caione <carlo@caione.org>
*/
-#ifndef __SD_EMMC_H__
-#define __SD_EMMC_H__
+#ifndef __MESON_GX_MMC_H__
+#define __MESON_GX_MMC_H__
#include <mmc.h>
-#ifndef __ASSEMBLY__
#include <linux/bitops.h>
-#endif
+enum meson_gx_mmc_compatible {
+ MMC_COMPATIBLE_GX,
+ MMC_COMPATIBLE_SM1,
+};
#define SDIO_PORT_A 0
#define SDIO_PORT_B 1
diff --git a/drivers/phy/meson-g12a-usb2.c b/drivers/phy/meson-g12a-usb2.c
index a1e6219..447ce72 100644
--- a/drivers/phy/meson-g12a-usb2.c
+++ b/drivers/phy/meson-g12a-usb2.c
@@ -66,10 +66,10 @@ struct phy_meson_g12a_usb2_priv {
static int phy_meson_g12a_usb2_power_on(struct phy *phy)
{
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
struct udevice *dev = phy->dev;
struct phy_meson_g12a_usb2_priv *priv = dev_get_priv(dev);
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
if (priv->phy_supply) {
int ret = regulator_set_enable(priv->phy_supply, true);
if (ret)
@@ -82,10 +82,10 @@ static int phy_meson_g12a_usb2_power_on(struct phy *phy)
static int phy_meson_g12a_usb2_power_off(struct phy *phy)
{
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
struct udevice *dev = phy->dev;
struct phy_meson_g12a_usb2_priv *priv = dev_get_priv(dev);
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
if (priv->phy_supply) {
int ret = regulator_set_enable(priv->phy_supply, false);
if (ret) {
diff --git a/drivers/video/meson/meson_dw_hdmi.c b/drivers/video/meson/meson_dw_hdmi.c
index 7b2ff94..5d74f7f 100644
--- a/drivers/video/meson/meson_dw_hdmi.c
+++ b/drivers/video/meson/meson_dw_hdmi.c
@@ -379,7 +379,9 @@ static int meson_dw_hdmi_probe(struct udevice *dev)
struct meson_dw_hdmi *priv = dev_get_priv(dev);
struct reset_ctl_bulk resets;
struct clk_bulk clocks;
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
struct udevice *supply;
+#endif
int ret;
priv->dev = dev;