mmc: meson-axg: initial support for AXG SoC platform
cover mmc: meson-axg: initial support for AXG SoC platform
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(-)
Signature · 1 line
2.16.2
PATCH 1/3 mmc: dt-bindings: update bindings doc to support Meson-AXG SoC
From: Nan Li <[email protected]>
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.
--- Documentation/devicetree/bindings/mmc/amlogic,meson-gx.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mmc/amlogic,meson-gx.txt +1 -0
@@ -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
Signature · 1 line
2.16.2
PATCH 2/3 mmc: meson-axg: add support for the Meson-AXG platform
In reply to Yixun LanFrom: Nan Li <[email protected]>
Introduce the compatible data to cover the register offset & mask change of the eMMC controller in Amlogic's Meson-AXG SoC.
--- drivers/mmc/host/meson-gx-mmc.c | 61 ++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 10 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +51 -10
@@ -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);
Signature · 1 line
2.16.2
PATCH 3/3 mmc: meson: update doc to support Meson-AXG platform
In reply to Yixun LanFrom: Nan Li <[email protected]>
Explicitly update the docomentation to support the Meson-AXG platform.
--- drivers/mmc/host/Kconfig | 4 ++-- drivers/mmc/host/meson-gx-mmc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/Kconfig +2 -2
@@ -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.
drivers/mmc/host/meson-gx-mmc.c +1 -1
@@ -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 <[email protected]>" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.16.2
Ulf Hansson
AppliedQuoted 12 lines · Yixun Lan
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
Quoted 8 lines
.../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