* [PATCH 1/3] mmc: dt-bindings: update bindings doc to support Meson-AXG SoC
2018-04-03 10:06 [PATCH 0/3] mmc: meson-axg: initial support for AXG SoC platform Yixun Lan
@ 2018-04-03 10:06 ` Yixun Lan
2018-04-03 10:06 ` [PATCH 2/3] mmc: meson-axg: add support for the Meson-AXG platform Yixun Lan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Yixun Lan @ 2018-04-03 10:06 UTC (permalink / raw)
To: Ulf Hansson
Cc: Nan Li, Yixun Lan, Kevin Hilman, Carlo Caione, Jerome Brunet,
Heiner Kallweit, Rob Herring, linux-mmc, linux-amlogic,
linux-arm-kernel, linux-kernel, devicetree
From: Nan Li <nan.li@amlogic.com>
Update the documentation to list support for Meson-AXG SoC explicitly.
The new binding string is necessary since this SoC introduce a few
IP difference comparing to previous old generation.
Signed-off-by: Nan Li <nan.li@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
Documentation/devicetree/bindings/mmc/amlogic,meson-gx.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/mmc/amlogic,meson-gx.txt b/Documentation/devicetree/bindings/mmc/amlogic,meson-gx.txt
index 50bf611a4d2c..5add8d7d855f 100644
--- a/Documentation/devicetree/bindings/mmc/amlogic,meson-gx.txt
+++ b/Documentation/devicetree/bindings/mmc/amlogic,meson-gx.txt
@@ -12,6 +12,7 @@ Required properties:
- "amlogic,meson-gxbb-mmc"
- "amlogic,meson-gxl-mmc"
- "amlogic,meson-gxm-mmc"
+ - "amlogic,meson-axg-mmc"
- clocks : A list of phandle + clock-specifier pairs for the clocks listed in clock-names.
- clock-names: Should contain the following:
"core" - Main peripheral bus clock
--
2.16.2
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/3] mmc: meson-axg: add support for the Meson-AXG platform
2018-04-03 10:06 [PATCH 0/3] mmc: meson-axg: initial support for AXG SoC platform Yixun Lan
2018-04-03 10:06 ` [PATCH 1/3] mmc: dt-bindings: update bindings doc to support Meson-AXG SoC Yixun Lan
@ 2018-04-03 10:06 ` Yixun Lan
2018-04-03 10:06 ` [PATCH 3/3] mmc: meson: update doc to support " Yixun Lan
2018-04-04 12:46 ` [PATCH 0/3] mmc: meson-axg: initial support for AXG SoC platform Ulf Hansson
3 siblings, 0 replies; 5+ messages in thread
From: Yixun Lan @ 2018-04-03 10:06 UTC (permalink / raw)
To: Ulf Hansson
Cc: Nan Li, Yixun Lan, Kevin Hilman, Carlo Caione, Jerome Brunet,
Heiner Kallweit, Rob Herring, linux-mmc, linux-amlogic,
linux-arm-kernel, linux-kernel
From: Nan Li <nan.li@amlogic.com>
Introduce the compatible data to cover the register offset & mask
change of the eMMC controller in Amlogic's Meson-AXG SoC.
Signed-off-by: Nan Li <nan.li@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
drivers/mmc/host/meson-gx-mmc.c | 61 ++++++++++++++++++++++++++++++++++-------
1 file changed, 51 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 4f972b879fe6..56c90542ac29 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -47,15 +47,29 @@
#define CLK_CORE_PHASE_MASK GENMASK(9, 8)
#define CLK_TX_PHASE_MASK GENMASK(11, 10)
#define CLK_RX_PHASE_MASK GENMASK(13, 12)
-#define CLK_TX_DELAY_MASK GENMASK(19, 16)
-#define CLK_RX_DELAY_MASK GENMASK(23, 20)
+#define CLK_V2_TX_DELAY_MASK GENMASK(19, 16)
+#define CLK_V2_RX_DELAY_MASK GENMASK(23, 20)
+#define CLK_V2_ALWAYS_ON BIT(24)
+
+#define CLK_V3_TX_DELAY_MASK GENMASK(21, 16)
+#define CLK_V3_RX_DELAY_MASK GENMASK(27, 22)
+#define CLK_V3_ALWAYS_ON BIT(28)
+
#define CLK_DELAY_STEP_PS 200
#define CLK_PHASE_STEP 30
#define CLK_PHASE_POINT_NUM (360 / CLK_PHASE_STEP)
-#define CLK_ALWAYS_ON BIT(24)
+
+#define CLK_TX_DELAY_MASK(h) (h->data->tx_delay_mask)
+#define CLK_RX_DELAY_MASK(h) (h->data->rx_delay_mask)
+#define CLK_ALWAYS_ON(h) (h->data->always_on)
#define SD_EMMC_DELAY 0x4
#define SD_EMMC_ADJUST 0x8
+
+#define SD_EMMC_DELAY1 0x4
+#define SD_EMMC_DELAY2 0x8
+#define SD_EMMC_V3_ADJUST 0xc
+
#define SD_EMMC_CALOUT 0x10
#define SD_EMMC_START 0x40
#define START_DESC_INIT BIT(0)
@@ -122,6 +136,12 @@
#define MUX_CLK_NUM_PARENTS 2
+struct meson_mmc_data {
+ unsigned int tx_delay_mask;
+ unsigned int rx_delay_mask;
+ unsigned int always_on;
+};
+
struct sd_emmc_desc {
u32 cmd_cfg;
u32 cmd_arg;
@@ -131,6 +151,7 @@ struct sd_emmc_desc {
struct meson_host {
struct device *dev;
+ struct meson_mmc_data *data;
struct mmc_host *mmc;
struct mmc_command *cmd;
@@ -474,7 +495,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
/* init SD_EMMC_CLOCK to sane defaults w/min clock rate */
clk_reg = 0;
- clk_reg |= CLK_ALWAYS_ON;
+ clk_reg |= CLK_ALWAYS_ON(host);
clk_reg |= CLK_DIV_MASK;
writel(clk_reg, host->regs + SD_EMMC_CLOCK);
@@ -574,7 +595,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
tx->reg = host->regs + SD_EMMC_CLOCK;
tx->phase_mask = CLK_TX_PHASE_MASK;
- tx->delay_mask = CLK_TX_DELAY_MASK;
+ tx->delay_mask = CLK_TX_DELAY_MASK(host);
tx->delay_step_ps = CLK_DELAY_STEP_PS;
tx->hw.init = &init;
@@ -597,7 +618,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
rx->reg = host->regs + SD_EMMC_CLOCK;
rx->phase_mask = CLK_RX_PHASE_MASK;
- rx->delay_mask = CLK_RX_DELAY_MASK;
+ rx->delay_mask = CLK_RX_DELAY_MASK(host);
rx->delay_step_ps = CLK_DELAY_STEP_PS;
rx->hw.init = &init;
@@ -1184,6 +1205,13 @@ static int meson_mmc_probe(struct platform_device *pdev)
goto free_host;
}
+ host->data = (struct meson_mmc_data *)
+ of_device_get_match_data(&pdev->dev);
+ if (!host->data) {
+ ret = -EINVAL;
+ goto free_host;
+ }
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
host->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(host->regs)) {
@@ -1315,11 +1343,24 @@ static int meson_mmc_remove(struct platform_device *pdev)
return 0;
}
+static const struct meson_mmc_data meson_gx_data = {
+ .tx_delay_mask = CLK_V2_TX_DELAY_MASK,
+ .rx_delay_mask = CLK_V2_RX_DELAY_MASK,
+ .always_on = CLK_V2_ALWAYS_ON,
+};
+
+static const struct meson_mmc_data meson_axg_data = {
+ .tx_delay_mask = CLK_V3_TX_DELAY_MASK,
+ .rx_delay_mask = CLK_V3_RX_DELAY_MASK,
+ .always_on = CLK_V3_ALWAYS_ON,
+};
+
static const struct of_device_id meson_mmc_of_match[] = {
- { .compatible = "amlogic,meson-gx-mmc", },
- { .compatible = "amlogic,meson-gxbb-mmc", },
- { .compatible = "amlogic,meson-gxl-mmc", },
- { .compatible = "amlogic,meson-gxm-mmc", },
+ { .compatible = "amlogic,meson-gx-mmc", .data = &meson_gx_data },
+ { .compatible = "amlogic,meson-gxbb-mmc", .data = &meson_gx_data },
+ { .compatible = "amlogic,meson-gxl-mmc", .data = &meson_gx_data },
+ { .compatible = "amlogic,meson-gxm-mmc", .data = &meson_gx_data },
+ { .compatible = "amlogic,meson-axg-mmc", .data = &meson_axg_data },
{}
};
MODULE_DEVICE_TABLE(of, meson_mmc_of_match);
--
2.16.2
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 3/3] mmc: meson: update doc to support Meson-AXG platform
2018-04-03 10:06 [PATCH 0/3] mmc: meson-axg: initial support for AXG SoC platform Yixun Lan
2018-04-03 10:06 ` [PATCH 1/3] mmc: dt-bindings: update bindings doc to support Meson-AXG SoC Yixun Lan
2018-04-03 10:06 ` [PATCH 2/3] mmc: meson-axg: add support for the Meson-AXG platform Yixun Lan
@ 2018-04-03 10:06 ` Yixun Lan
2018-04-04 12:46 ` [PATCH 0/3] mmc: meson-axg: initial support for AXG SoC platform Ulf Hansson
3 siblings, 0 replies; 5+ messages in thread
From: Yixun Lan @ 2018-04-03 10:06 UTC (permalink / raw)
To: Ulf Hansson
Cc: Nan Li, Yixun Lan, Kevin Hilman, Carlo Caione, Jerome Brunet,
Heiner Kallweit, Rob Herring, linux-mmc, linux-amlogic,
linux-arm-kernel, linux-kernel
From: Nan Li <nan.li@amlogic.com>
Explicitly update the docomentation to support the Meson-AXG platform.
Signed-off-by: Nan Li <nan.li@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
---
drivers/mmc/host/Kconfig | 4 ++--
drivers/mmc/host/meson-gx-mmc.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 620c2d90a646..751090d1d94c 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -345,11 +345,11 @@ config MMC_SDHCI_IPROC
If unsure, say N.
config MMC_MESON_GX
- tristate "Amlogic S905/GX* SD/MMC Host Controller support"
+ tristate "Amlogic S905/GX*/AXG SD/MMC Host Controller support"
depends on ARCH_MESON && MMC
help
This selects support for the Amlogic SD/MMC Host Controller
- found on the S905/GX* family of SoCs. This controller is
+ found on the S905/GX*/AXG family of SoCs. This controller is
MMC 5.1 compliant and supports SD, eMMC and SDIO interfaces.
If you have a controller with this interface, say Y here.
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 56c90542ac29..55bbd67177df 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1376,6 +1376,6 @@ static struct platform_driver meson_mmc_driver = {
module_platform_driver(meson_mmc_driver);
-MODULE_DESCRIPTION("Amlogic S905*/GX* SD/eMMC driver");
+MODULE_DESCRIPTION("Amlogic S905*/GX*/AXG SD/eMMC driver");
MODULE_AUTHOR("Kevin Hilman <khilman@baylibre.com>");
MODULE_LICENSE("GPL v2");
--
2.16.2
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] mmc: meson-axg: initial support for AXG SoC platform
2018-04-03 10:06 [PATCH 0/3] mmc: meson-axg: initial support for AXG SoC platform Yixun Lan
` (2 preceding siblings ...)
2018-04-03 10:06 ` [PATCH 3/3] mmc: meson: update doc to support " Yixun Lan
@ 2018-04-04 12:46 ` Ulf Hansson
3 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2018-04-04 12:46 UTC (permalink / raw)
To: Yixun Lan
Cc: Kevin Hilman, Carlo Caione, Jerome Brunet, Heiner Kallweit,
Rob Herring, linux-mmc, open list:ARM/Amlogic Meson...,
Linux ARM, Linux Kernel Mailing List, devicetree
On 3 April 2018 at 12:06, Yixun Lan <yixun.lan@amlogic.com> wrote:
> The patches series try to enable basic eMMC support in the Meson-AXG platfrom.
>
> Currently HS200 mode is tested with clock running at 166MHz, since
> not all boards are stable to running 200MHz (due to tuning phase error),
> we will further improve the tuning phase driver in the future,
> but in my opiton, this patch series itself is pretty good to go.
>
> Nan Li (3):
> mmc: dt-bindings: update bindings doc to support Meson-AXG SoC
> mmc: meson-axg: add support for the Meson-AXG platform
> mmc: meson: update doc to support Meson-AXG platform
>
> .../devicetree/bindings/mmc/amlogic,meson-gx.txt | 1 +
> drivers/mmc/host/Kconfig | 4 +-
> drivers/mmc/host/meson-gx-mmc.c | 63 ++++++++++++++++++----
> 3 files changed, 55 insertions(+), 13 deletions(-)
>
> --
> 2.16.2
>
Queued up for 3.18, thanks!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 5+ messages in thread