Skip to contentSkip to conversation

mmc/host: Add Aspeed SDIO driver

PATCH In review Ryan Chen 6 participants 25 messages Jul 17, 2018 – Apr 18, 2019

Subsystems (8)
lore
Share & tools
lore

Ryan Chen

author
#0 lore raw

v2 cover mmc/host: Add Aspeed SDIO driver

This series implements Aspeed SDIO driver. In Aspeed SDIO controller with two slots and have a global register for interrupt status and other general information.

v2
Change irqchip driver(irq-aspeed-sdhci-ic.c) to aspeed sdhci core driver aspeed-sdhci-core.c

v0
For implements this, it will have have irq-aspeed-sdhci-ic.c for sdhci each slot irq dispatch, and then go to sdhci driver handle (sdhci.c).

Another is sdhci-of-aspeed.c for specific function call.

Ryan Chen

Ryan Chen (7):
clk: Aspeed: Modify clk-aspeed.c driver probe sequence
clk: Aspeed: Add sdhci reset and clock
mmc: Aspeed: Add Aspeed sdhci core driver
mmc: Aspeed: Add driver for Aspeed sdhci
dts: Aspeed: Add devicetree for Aspeed sdhci
Documentation: mmc: add aspeed sdhci binding document
configs: Aspeed: enable mmc host in defconfig

 .../bindings/mmc/aspeed,aspeed-sdhci.txt           |  54 +++++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           |  14 ++
 arch/arm/boot/dts/aspeed-g4.dtsi                   |  40 +++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   |  40 +++++
 arch/arm/configs/aspeed_g5_defconfig               |   6 +
 drivers/clk/clk-aspeed.c                           |  51 +++---
 drivers/irqchip/Makefile                           |   2 +-
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c               | 147 +++++++++++++++++
 drivers/mmc/host/sdhci-of-aspeed.c                 | 178 +++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |   2 +-
 include/linux/mmc/sdhci-aspeed-data.h              |  28 ++++
 13 files changed, 553 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/7 clk: Aspeed: Modify clk-aspeed.c driver probe sequence

In Aspeed's SoC, all IP clk gating and pll parameter is in scu controller, before IP driver probe, scu driver need prepare for it. So buildin_platform_driver to core_initcall.

---
 drivers/clk/clk-aspeed.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/clk-aspeed.c +6 -1
index 8796b8a..9e55743 100644
@@ -573,7 +573,12 @@ static struct platform_driver aspeed_clk_driver = {
 		.suppress_bind_attrs = true,
 	},
 };
-builtin_platform_driver(aspeed_clk_driver);
+
+static int __init aspeed_clk_init(void)
+{
+	return platform_driver_register(&aspeed_clk_driver);
+}
+core_initcall(aspeed_clk_init);
 
 static void __init aspeed_ast2400_cc(struct regmap *map)
 {
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 2/7 clk: Aspeed: Add sdhci reset and clock

In reply to Ryan Chen

1.Add Aspeed sdhci reset for SCU04 bit 16
2.Aspeed sdhci have two clock one is for controller clock, another is for SD card clock. so when enable sdhci need enable both.

v0->V2
Use aspeed_resets[ASPEED_RESET_SDHCI] replace the maginc number 16 move aspeed_resets in front of aspeed_clk_enable function

---
 drivers/clk/clk-aspeed.c                 | 44 ++++++++++++++++++--------------
 include/dt-bindings/clock/aspeed-clock.h |  2 +-
 2 files changed, 26 insertions(+), 20 deletions(-)
drivers/clk/clk-aspeed.c +25 -19
index 9e55743..f399da2 100644
@@ -20,6 +20,7 @@
 
 #define ASPEED_RESET_CTRL	0x04
 #define ASPEED_CLK_SELECTION	0x08
+#define  ASPEED_SDIO_CLK_EN BIT(15)
 #define ASPEED_CLK_STOP_CTRL	0x0c
 #define ASPEED_MPLL_PARAM	0x20
 #define ASPEED_HPLL_PARAM	0x24
@@ -208,6 +209,25 @@ static const struct aspeed_clk_soc_data ast2400_data = {
 	.calc_pll = aspeed_ast2400_calc_pll,
 };
 
+static const u8 aspeed_resets[] = {
+	/* SCU04 resets */
+	[ASPEED_RESET_XDMA]	= 25,
+	[ASPEED_RESET_MCTP]	= 24,
+	[ASPEED_RESET_ADC]	= 23,
+	[ASPEED_RESET_JTAG_MASTER] = 22,
+	[ASPEED_RESET_MIC]	= 18,
+	[ASPEED_RESET_PWM]	=  9,
+	[ASPEED_RESET_PECI]	= 10,
+	[ASPEED_RESET_I2C]	=  2,
+	[ASPEED_RESET_AHB]	=  1,
+	[ASPEED_RESET_SDHCI]	= 16,
+	/*
+	 * SCUD4 resets start at an offset to separate them from
+	 * the SCU04 resets.
+	 */
+	[ASPEED_RESET_CRT1]	= ASPEED_RESET2_OFFSET + 5,
+};
+
 static int aspeed_clk_is_enabled(struct clk_hw *hw)
 {
 	struct aspeed_clk_gate *gate = to_aspeed_clk_gate(hw);
@@ -260,6 +280,11 @@ static int aspeed_clk_enable(struct clk_hw *hw)
 	enval = (gate->flags & CLK_GATE_SET_TO_DISABLE) ? 0 : clk;
 	regmap_update_bits(gate->map, ASPEED_CLK_STOP_CTRL, clk, enval);
 
+	/* sd ext clk */
+	if (gate->reset_idx == aspeed_resets[ASPEED_RESET_SDHCI]) {
+		regmap_update_bits(gate->map, ASPEED_CLK_SELECTION, ASPEED_SDIO_CLK_EN, ASPEED_SDIO_CLK_EN);
+	}
+
 	if (gate->reset_idx >= 0) {
 		/* A delay of 10ms is specified by the ASPEED docs */
 		mdelay(10);
@@ -306,25 +331,6 @@ struct aspeed_reset {
 
 #define to_aspeed_reset(p) container_of((p), struct aspeed_reset, rcdev)
 
-static const u8 aspeed_resets[] = {
-	/* SCU04 resets */
-	[ASPEED_RESET_XDMA]	= 25,
-	[ASPEED_RESET_MCTP]	= 24,
-	[ASPEED_RESET_ADC]	= 23,
-	[ASPEED_RESET_JTAG_MASTER] = 22,
-	[ASPEED_RESET_MIC]	= 18,
-	[ASPEED_RESET_PWM]	=  9,
-	[ASPEED_RESET_PECI]	= 10,
-	[ASPEED_RESET_I2C]	=  2,
-	[ASPEED_RESET_AHB]	=  1,
-
-	/*
-	 * SCUD4 resets start at an offset to separate them from
-	 * the SCU04 resets.
-	 */
-	[ASPEED_RESET_CRT1]	= ASPEED_RESET2_OFFSET + 5,
-};
-
 static int aspeed_reset_deassert(struct reset_controller_dev *rcdev,
 				 unsigned long id)
 {
include/dt-bindings/clock/aspeed-clock.h +1 -1
index 4476184..088553f 100644
@@ -50,5 +50,5 @@
 #define ASPEED_RESET_I2C		7
 #define ASPEED_RESET_AHB		8
 #define ASPEED_RESET_CRT1		9
-
+#define ASPEED_RESET_SDHCI		10
 #endif
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 3/7 mmc: Aspeed: Add Aspeed sdhci core driver

In reply to Ryan Chen

In Aspeed SoC's sdhci have two slots and have a interrupt status and general information in top for register. add sdhci core driver defore sdhci driver probe

V0->V1
move irqchip/irq-aspeed-sdhci-ic.c to drivers/mmc/host/aspeed-sdhci-core.c

---
 drivers/irqchip/Makefile              |   2 +-
 drivers/mmc/host/Makefile             |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c  | 147 ++++++++++++++++++++++++++++++++++
 include/linux/mmc/sdhci-aspeed-data.h |  28 +++++++
 4 files changed, 177 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
drivers/irqchip/Makefile +1 -1
index 5ed465a..d99cb1d 100644
@@ -78,7 +78,7 @@ obj-$(CONFIG_MVEBU_ODMI)		+= irq-mvebu-odmi.o
 obj-$(CONFIG_MVEBU_PIC)			+= irq-mvebu-pic.o
 obj-$(CONFIG_LS_SCFG_MSI)		+= irq-ls-scfg-msi.o
 obj-$(CONFIG_EZNPS_GIC)			+= irq-eznps.o
-obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o
+obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o 
 obj-$(CONFIG_STM32_EXTI) 		+= irq-stm32-exti.o
 obj-$(CONFIG_QCOM_IRQ_COMBINER)		+= qcom-irq-combiner.o
 obj-$(CONFIG_IRQ_UNIPHIER_AIDET)	+= irq-uniphier-aidet.o
drivers/mmc/host/Makefile +1 -0
index 6aead24..c3e5a1f 100644
@@ -78,6 +78,7 @@ obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)	+= sdhci-esdhc-imx.o
 obj-$(CONFIG_MMC_SDHCI_DOVE)		+= sdhci-dove.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)		+= sdhci-tegra.o
 obj-$(CONFIG_MMC_SDHCI_OF_ARASAN)	+= sdhci-of-arasan.o
+obj-$(CONFIG_MMC_SDHCI_OF_ASPEED)	+= aspeed-sdhci-core.o
 obj-$(CONFIG_MMC_SDHCI_OF_AT91)		+= sdhci-of-at91.o
 obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)	+= sdhci-of-esdhc.o
 obj-$(CONFIG_MMC_SDHCI_OF_HLWD)		+= sdhci-of-hlwd.o
drivers/mmc/host/aspeed-sdhci-core.c new file +147 -0

147 lines not on this page · raw message

include/linux/mmc/sdhci-aspeed-data.h new file +28 -0
new file mode 100644
index 0000000..fba2bf2
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef LINUX_MMC_SDHCI_ASPEED_DATA_H
+#define LINUX_MMC_SDHCI_ASPEED_DATA_H
+
+#include <linux/io.h>
+
+#define ASPEED_SDHCI_INFO			0x00
+#define  ASPEED_SDHCI_S1MMC8			BIT(25)
+#define  ASPEED_SDHCI_S0MMC8			BIT(24)
+#define ASPEED_SDHCI_BLOCK			0x04
+#define ASPEED_SDHCI_CTRL			0xF0
+#define ASPEED_SDHCI_ISR			0xFC
+
+struct aspeed_sdhci_irq {
+	void __iomem *regs;
+	int parent_irq;
+	struct irq_domain *irq_domain;
+};
+
+static inline void aspeed_sdhci_set_8bit_mode(struct aspeed_sdhci_irq *sdhci_irq, int mode)
+{
+	if (mode)
+		writel(ASPEED_SDHCI_S0MMC8 | readl(sdhci_irq->regs), sdhci_irq->regs);
+	else
+		writel(~ASPEED_SDHCI_S0MMC8 & readl(sdhci_irq->regs), sdhci_irq->regs);
+}
+
+#endif
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH linux dev-4.17 3/7] mmc: Aspeed: Add Aspeed sdhci core driver

Quoted 69 lines · Ryan Chen

In Aspeed SoC's sdhci have two slots and have a interrupt status and general information in top for register. add sdhci core driver defore sdhci driver probe

V0->V1
move irqchip/irq-aspeed-sdhci-ic.c to drivers/mmc/host/aspeed-sdhci-core.c

---
 drivers/irqchip/Makefile              |   2 +-
 drivers/mmc/host/Makefile             |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c  | 147 ++++++++++++++++++++++++++++++++++
 include/linux/mmc/sdhci-aspeed-data.h |  28 +++++++
 4 files changed, 177 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
drivers/irqchip/Makefile +1 -1
index 5ed465a..d99cb1d 100644
@@ -78,7 +78,7 @@ obj-$(CONFIG_MVEBU_ODMI)		+= irq-mvebu-odmi.o
 obj-$(CONFIG_MVEBU_PIC)			+= irq-mvebu-pic.o
 obj-$(CONFIG_LS_SCFG_MSI)		+= irq-ls-scfg-msi.o
 obj-$(CONFIG_EZNPS_GIC)			+= irq-eznps.o
-obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o
+obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o 
 obj-$(CONFIG_STM32_EXTI) 		+= irq-stm32-exti.o
 obj-$(CONFIG_QCOM_IRQ_COMBINER)		+= qcom-irq-combiner.o
 obj-$(CONFIG_IRQ_UNIPHIER_AIDET)	+= irq-uniphier-aidet.o
drivers/mmc/host/Makefile +1 -0
index 6aead24..c3e5a1f 100644
@@ -78,6 +78,7 @@ obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)	+= sdhci-esdhc-imx.o
 obj-$(CONFIG_MMC_SDHCI_DOVE)		+= sdhci-dove.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)		+= sdhci-tegra.o
 obj-$(CONFIG_MMC_SDHCI_OF_ARASAN)	+= sdhci-of-arasan.o
+obj-$(CONFIG_MMC_SDHCI_OF_ASPEED)	+= aspeed-sdhci-core.o
 obj-$(CONFIG_MMC_SDHCI_OF_AT91)		+= sdhci-of-at91.o
 obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)	+= sdhci-of-esdhc.o
 obj-$(CONFIG_MMC_SDHCI_OF_HLWD)		+= sdhci-of-hlwd.o
drivers/mmc/host/aspeed-sdhci-core.c new file +20 -0
new file mode 100644
index 0000000..c3d9d45
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SDHCI IRQCHIP driver for the Aspeed SoC
+ *
+ * Copyright (C) ASPEED Technology Inc.
+ * Ryan Chen <[email protected]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ */
+
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/irq.h>
+#include <linux/irqchip.h>

drivers/mmc/host/aspeed-sdhci-core.c line 30

Quoted 10 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +10 -0
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/mmc/sdhci-aspeed-data.h>
+
+#define ASPEED_SDHCI_SLOT_NUM			2

Change the "irq" prefixes on the functions.. Dont' do a chained handler, that will be too much overhead for no benefit. Your SoC aren't very fast and you want to avoid that overhead.

Just do a normal interrupt handler, and have it call each port interrupts.

This isn't really an interrupt controller, it has no enable/disable/masking ability, I would just create the ports directly from the same driver and process the interrupts.

I don't think there's benefit in keeping the ports as separate drivers.

Quoted 87 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +87 -0
+static void aspeed_sdhci_irq_handler(struct irq_desc *desc)
+{
+	struct aspeed_sdhci_irq *sdhci_irq = irq_desc_get_handler_data(desc);
+	struct irq_chip *chip = irq_desc_get_chip(desc);
+	unsigned long bit, status;
+	unsigned int slot_irq;
+
+	chained_irq_enter(chip, desc);
+	status = readl(sdhci_irq->regs + ASPEED_SDHCI_ISR);
+	for_each_set_bit(bit, &status, ASPEED_SDHCI_SLOT_NUM) {
+		slot_irq = irq_find_mapping(sdhci_irq->irq_domain, bit);
+		generic_handle_irq(slot_irq);
+	}
+	chained_irq_exit(chip, desc);
+}
+
+static void noop(struct irq_data *data) { }
+
+static unsigned int noop_ret(struct irq_data *data)
+{
+	return 0;
+}
+
+struct irq_chip sdhci_irq_chip = {
+	.name		= "sdhci-ic",
+	.irq_startup	= noop_ret,
+	.irq_shutdown	= noop,
+	.irq_enable	= noop,
+	.irq_disable	= noop,
+	.irq_ack	= noop,
+	.irq_mask	= noop,
+	.irq_unmask	= noop,
+	.flags		= IRQCHIP_SKIP_SET_WAKE,
+};
+
+static int ast_sdhci_map_irq_domain(struct irq_domain *domain,
+				    unsigned int irq, irq_hw_number_t hwirq)
+{
+	irq_set_chip_and_handler(irq, &sdhci_irq_chip, handle_simple_irq);
+	irq_set_chip_data(irq, domain->host_data);
+
+	return 0;
+}
+
+static const struct irq_domain_ops aspeed_sdhci_irq_domain_ops = {
+	.map = ast_sdhci_map_irq_domain,
+};
+
+static int irq_aspeed_sdhci_probe(struct platform_device *pdev)
+{
+	struct aspeed_sdhci_irq *sdhci_irq;
+	struct clk *sdclk;
+
+	sdhci_irq = kzalloc(sizeof(*sdhci_irq), GFP_KERNEL);
+	if (!sdhci_irq)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, sdhci_irq);
+	//node->data = sdhci_irq;
+	pdev->dev.of_node->data = sdhci_irq;
+
+	sdhci_irq->regs = of_iomap(pdev->dev.of_node, 0);
+	if (IS_ERR(sdhci_irq->regs))
+		return PTR_ERR(sdhci_irq->regs);
+
+	sdclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(sdclk)) {
+		dev_err(&pdev->dev, "no sdclk clock defined\n");
+		return PTR_ERR(sdclk);
+	}
+
+	clk_prepare_enable(sdclk);
+
+	sdhci_irq->parent_irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+	if (sdhci_irq->parent_irq < 0)
+		return sdhci_irq->parent_irq;
+
+	sdhci_irq->irq_domain = irq_domain_add_linear(
+					pdev->dev.of_node, ASPEED_SDHCI_SLOT_NUM,
+					&aspeed_sdhci_irq_domain_ops, NULL);
+	if (!sdhci_irq->irq_domain)
+		return -ENOMEM;
+
+	sdhci_irq->irq_domain->name = "aspeed-sdhci-irq";
+
+	irq_set_chained_handler_and_data(sdhci_irq->parent_irq,
+					 aspeed_sdhci_irq_handler, sdhci_irq);

drivers/mmc/host/aspeed-sdhci-core.c line 128

Quoted 10 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +10 -0
+
+	pr_info("sdhci irq controller registered, irq %d\n", sdhci_irq->parent_irq);
+
+	return 0;
+}
+
+static const struct of_device_id irq_aspeed_sdhci_dt_ids[] = {
+	{ .compatible = "aspeed,aspeed-sdhci-irq", },
+	{},
+};

You should call this aspeed,ast2{4,5}00-sdhci-core. I would change your device-tree representation as follow (add back all the reg & properties):

	sdhci-core {
		reg = <common regs>
		ranges = either empty prop or the 2 ranges goign to the children
		compatible = <aspeed,ast2400-sdhci-core>;

		sdhci-slot@xxx {
			compatible = <aspeed,ast2400-sdhci-slot>;
		};

		sdhci-slot@yyy {
			compatible = <aspeed,ast2400-sdhci-slot>;
		};
	}
Quoted 5 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +5 -0
+MODULE_DEVICE_TABLE(of, irq_aspeed_sdhci_dt_ids);
+
+static struct platform_driver irq_aspeed_sdhci_device_driver = {
+	.probe		= irq_aspeed_sdhci_probe,
+	.driver		= {

drivers/mmc/host/aspeed-sdhci-core.c line 143

Quoted 10 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +10 -0
+		.name   = KBUILD_MODNAME,
+		.of_match_table	= irq_aspeed_sdhci_dt_ids,
+	}
+};
+
+static int __init irq_aspeed_sdhci_init(void)
+{
+	return platform_driver_register(&irq_aspeed_sdhci_device_driver);
+}
+core_initcall(irq_aspeed_sdhci_init);

This should be a normal device init call, thus module_platform_driver is all you need here.

Quoted 38 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +4 -0
+
+MODULE_AUTHOR("Ryan Chen");
+MODULE_DESCRIPTION("ASPEED SOC SDHCI IRQ Driver");
+MODULE_LICENSE("GPL v2");
include/linux/mmc/sdhci-aspeed-data.h new file +28 -0
new file mode 100644
index 0000000..fba2bf2
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef LINUX_MMC_SDHCI_ASPEED_DATA_H
+#define LINUX_MMC_SDHCI_ASPEED_DATA_H
+
+#include <linux/io.h>
+
+#define ASPEED_SDHCI_INFO			0x00
+#define  ASPEED_SDHCI_S1MMC8			BIT(25)
+#define  ASPEED_SDHCI_S0MMC8			BIT(24)
+#define ASPEED_SDHCI_BLOCK			0x04
+#define ASPEED_SDHCI_CTRL			0xF0
+#define ASPEED_SDHCI_ISR			0xFC
+
+struct aspeed_sdhci_irq {
+	void __iomem *regs;
+	int parent_irq;
+	struct irq_domain *irq_domain;
+};
+
+static inline void aspeed_sdhci_set_8bit_mode(struct aspeed_sdhci_irq *sdhci_irq, int mode)
+{
+	if (mode)
+		writel(ASPEED_SDHCI_S0MMC8 | readl(sdhci_irq->regs), sdhci_irq->regs);
+	else
+		writel(~ASPEED_SDHCI_S0MMC8 & readl(sdhci_irq->regs), sdhci_irq->regs);
+}
+
+#endif
#5 lore raw

Re: [PATCH linux dev-4.17 3/7] mmc: Aspeed: Add Aspeed sdhci core driver

Quoted 4 lines · Benjamin Herrenschmidt

Change the "irq" prefixes on the functions.. Dont' do a chained handler, that will be too much overhead for no benefit. Your SoC aren't very fast and you want to avoid that overhead.

Quoted 8 lines

Just do a normal interrupt handler, and have it call each port interrupts.

This isn't really an interrupt controller, it has no enable/disable/masking ability, I would just create the ports directly from the same driver and process the interrupts.

I don't think there's benefit in keeping the ports as separate drivers.

Look at how shdci-pci does it, sdhci-acpi as well, they have multiple slots. You can just register multiple slots from a single driver I think. You can still use device-tree sub-nodes and iterate them from the core driver to create the slots if you want, in case you may add slots in the future, but it's not even that a big deal.

Ben.

author
#6 lore raw

Re: [PATCH linux dev-4.17 3/7] mmc: Aspeed: Add Aspeed sdhci core driver

Quoted 14 lines · Benjamin Herrenschmidt
Quoted 4 lines · Benjamin Herrenschmidt

Change the "irq" prefixes on the functions.. Dont' do a chained handler, that will be too much overhead for no benefit. Your SoC aren't very fast and you want to avoid that overhead.

Quoted 8 lines

Just do a normal interrupt handler, and have it call each port interrupts.

This isn't really an interrupt controller, it has no enable/disable/masking ability, I would just create the ports directly from the same driver and process the interrupts.

I don't think there's benefit in keeping the ports as separate drivers.

Quoted 9 lines

Look at how shdci-pci does it, sdhci-acpi as well, they have multiple slots. You can just register multiple slots from a single driver I think. You can still use device-tree sub-nodes and iterate them from the core driver to create the slots if you want, in case you may add slots in the future, but it's not even that a big deal.

Ben.

Thanks, after look into sdhci-pci, it should only request one pci_irq, But, i am wondering where is the slot dispatch. could you help me point out it?

#7 lore raw

Re: [PATCH linux dev-4.17 3/7] mmc: Aspeed: Add Aspeed sdhci core driver

Quoted 21 lines · Ryan Chen
Quoted 20 lines · Benjamin Herrenschmidt
Quoted 4 lines · Benjamin Herrenschmidt

Change the "irq" prefixes on the functions.. Dont' do a chained handler, that will be too much overhead for no benefit. Your SoC aren't very fast and you want to avoid that overhead.

Quoted 8 lines

Just do a normal interrupt handler, and have it call each port interrupts.

This isn't really an interrupt controller, it has no enable/disable/masking ability, I would just create the ports directly from the same driver and process the interrupts.

I don't think there's benefit in keeping the ports as separate drivers.

Look at how shdci-pci does it, sdhci-acpi as well, they have multiple slots. You can just register multiple slots from a single driver I think. You can still use device-tree sub-nodes and iterate them from the core driver to create the slots if you want, in case you may add slots in the future, but it's not even that a big deal.

Quoted 6 lines
Quoted 3 lines

Ben.

Thanks, after look into sdhci-pci, it should only request one pci_irq, But, i am wondering where is the slot dispatch. could you help me point out it?

So the PCI one just uses the same IRQ number for all the slots in sdhci_pci_probe_slot(), so the IRQ ends up shared.

So on every irq it will jsut check all slots.

Not sure if that's a problem. Due to how sdhci is organized, if you really want to make sure it only accesses the one slot, then you indeed do have to use a cascaded interrupt controller as you are doing, but I'm not sure it's really worthwhile.

Cheers,
Ben.

author
#8 lore raw

Re: [PATCH linux dev-4.17 3/7] mmc: Aspeed: Add Aspeed sdhci core driver

Quoted 34 lines · Benjamin Herrenschmidt
Quoted 21 lines · Ryan Chen
Quoted 20 lines · Benjamin Herrenschmidt
Quoted 4 lines · Benjamin Herrenschmidt

Change the "irq" prefixes on the functions.. Dont' do a chained handler, that will be too much overhead for no benefit. Your SoC aren't very fast and you want to avoid that overhead.

Quoted 8 lines

Just do a normal interrupt handler, and have it call each port interrupts.

This isn't really an interrupt controller, it has no enable/disable/masking ability, I would just create the ports directly from the same driver and process the interrupts.

I don't think there's benefit in keeping the ports as separate drivers.

Look at how shdci-pci does it, sdhci-acpi as well, they have multiple slots. You can just register multiple slots from a single driver I think. You can still use device-tree sub-nodes and iterate them from the core driver to create the slots if you want, in case you may add slots in the future, but it's not even that a big deal.

Quoted 6 lines
Quoted 3 lines

Ben.

Thanks, after look into sdhci-pci, it should only request one pci_irq, But, i am wondering where is the slot dispatch. could you help me point out it?

So the PCI one just uses the same IRQ number for all the slots in sdhci_pci_probe_slot(), so the IRQ ends up shared.

So on every irq it will jsut check all slots.

Quoted 9 lines

Not sure if that's a problem. Due to how sdhci is organized, if you really want to make sure it only accesses the one slot, then you indeed do have to use a cascaded interrupt controller as you are doing, but I'm not sure it's really worthwhile.

Cheers,
Ben.

Yes, there is two way, to handle irq.
One is use share irq, so my sdhci driver have following outcome when share irq,

	cat /proc/interrupt
	----------
	34:         82      AVIC  26 Edge      mmc0, mmc1
	---------
when use cascaded interrupt. 
	.........
	292:         35  sdhci-ic   0 Edge      mmc0
	293:         42  sdhci-ic   1 Edge      mmc1
	---------

use separate slot (actually it is) interrupt, it have advantage for each slot debug. if use share. the debug will not easy.

#9 lore raw

Re: [PATCH linux dev-4.17 3/7] mmc: Aspeed: Add Aspeed sdhci core driver

Quoted 10 lines · Ryan Chen
Quoted 2 lines

Yes, there is two way, to handle irq.
One is use share irq, so my sdhci driver have following outcome when share irq,

        cat /proc/interrupt
        ----------
        34:         82      AVIC  26 Edge      mmc0, mmc1
        ---------
Quoted 7 lines

when use cascaded interrupt.
.........
292: 35 sdhci-ic 0 Edge mmc0
293: 42 sdhci-ic 1 Edge mmc1
---------
use separate slot (actually it is) interrupt, it have advantage for each slot debug. if use share. the debug will not easy.

I see ... well, you can then continue doing a cascaded controller if you wish then. I sitll don't think you need to have separate drivers however, but that's up to you.

You definitely don't want to use core initcalls. Also having a single driver might make it easier to implement the card detect stuff which is done by the "common" part, isn't it ?

Cheers,
Ben.

author
#10 lore raw

Re: [PATCH linux dev-4.17 3/7] mmc: Aspeed: Add Aspeed sdhci core driver

In reply to Benjamin Herrenschmidt
Quoted 196 lines · Benjamin Herrenschmidt
Quoted 69 lines · Ryan Chen

In Aspeed SoC's sdhci have two slots and have a interrupt status and general information in top for register. add sdhci core driver defore sdhci driver probe

V0->V1
move irqchip/irq-aspeed-sdhci-ic.c to drivers/mmc/host/aspeed-sdhci-core.c

---
 drivers/irqchip/Makefile              |   2 +-
 drivers/mmc/host/Makefile             |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c  | 147 ++++++++++++++++++++++++++++++++++
 include/linux/mmc/sdhci-aspeed-data.h |  28 +++++++
 4 files changed, 177 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
drivers/irqchip/Makefile +1 -1
index 5ed465a..d99cb1d 100644
@@ -78,7 +78,7 @@ obj-$(CONFIG_MVEBU_ODMI)		+= irq-mvebu-odmi.o
 obj-$(CONFIG_MVEBU_PIC)			+= irq-mvebu-pic.o
 obj-$(CONFIG_LS_SCFG_MSI)		+= irq-ls-scfg-msi.o
 obj-$(CONFIG_EZNPS_GIC)			+= irq-eznps.o
-obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o
+obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o 
 obj-$(CONFIG_STM32_EXTI) 		+= irq-stm32-exti.o
 obj-$(CONFIG_QCOM_IRQ_COMBINER)		+= qcom-irq-combiner.o
 obj-$(CONFIG_IRQ_UNIPHIER_AIDET)	+= irq-uniphier-aidet.o
drivers/mmc/host/Makefile +1 -0
index 6aead24..c3e5a1f 100644
@@ -78,6 +78,7 @@ obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)	+= sdhci-esdhc-imx.o
 obj-$(CONFIG_MMC_SDHCI_DOVE)		+= sdhci-dove.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)		+= sdhci-tegra.o
 obj-$(CONFIG_MMC_SDHCI_OF_ARASAN)	+= sdhci-of-arasan.o
+obj-$(CONFIG_MMC_SDHCI_OF_ASPEED)	+= aspeed-sdhci-core.o
 obj-$(CONFIG_MMC_SDHCI_OF_AT91)		+= sdhci-of-at91.o
 obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)	+= sdhci-of-esdhc.o
 obj-$(CONFIG_MMC_SDHCI_OF_HLWD)		+= sdhci-of-hlwd.o
drivers/mmc/host/aspeed-sdhci-core.c new file +20 -0
new file mode 100644
index 0000000..c3d9d45
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SDHCI IRQCHIP driver for the Aspeed SoC
+ *
+ * Copyright (C) ASPEED Technology Inc.
+ * Ryan Chen <[email protected]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ */
+
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/irq.h>
+#include <linux/irqchip.h>

drivers/mmc/host/aspeed-sdhci-core.c line 30

Quoted 10 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +10 -0
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/mmc/sdhci-aspeed-data.h>
+
+#define ASPEED_SDHCI_SLOT_NUM			2

Change the "irq" prefixes on the functions.. Dont' do a chained handler, that will be too much overhead for no benefit. Your SoC aren't very fast and you want to avoid that overhead.

Just do a normal interrupt handler, and have it call each port interrupts.

This isn't really an interrupt controller, it has no enable/disable/masking ability, I would just create the ports directly from the same driver and process the interrupts.

I don't think there's benefit in keeping the ports as separate drivers.

Quoted 87 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +87 -0
+static void aspeed_sdhci_irq_handler(struct irq_desc *desc)
+{
+	struct aspeed_sdhci_irq *sdhci_irq = irq_desc_get_handler_data(desc);
+	struct irq_chip *chip = irq_desc_get_chip(desc);
+	unsigned long bit, status;
+	unsigned int slot_irq;
+
+	chained_irq_enter(chip, desc);
+	status = readl(sdhci_irq->regs + ASPEED_SDHCI_ISR);
+	for_each_set_bit(bit, &status, ASPEED_SDHCI_SLOT_NUM) {
+		slot_irq = irq_find_mapping(sdhci_irq->irq_domain, bit);
+		generic_handle_irq(slot_irq);
+	}
+	chained_irq_exit(chip, desc);
+}
+
+static void noop(struct irq_data *data) { }
+
+static unsigned int noop_ret(struct irq_data *data)
+{
+	return 0;
+}
+
+struct irq_chip sdhci_irq_chip = {
+	.name		= "sdhci-ic",
+	.irq_startup	= noop_ret,
+	.irq_shutdown	= noop,
+	.irq_enable	= noop,
+	.irq_disable	= noop,
+	.irq_ack	= noop,
+	.irq_mask	= noop,
+	.irq_unmask	= noop,
+	.flags		= IRQCHIP_SKIP_SET_WAKE,
+};
+
+static int ast_sdhci_map_irq_domain(struct irq_domain *domain,
+				    unsigned int irq, irq_hw_number_t hwirq)
+{
+	irq_set_chip_and_handler(irq, &sdhci_irq_chip, handle_simple_irq);
+	irq_set_chip_data(irq, domain->host_data);
+
+	return 0;
+}
+
+static const struct irq_domain_ops aspeed_sdhci_irq_domain_ops = {
+	.map = ast_sdhci_map_irq_domain,
+};
+
+static int irq_aspeed_sdhci_probe(struct platform_device *pdev)
+{
+	struct aspeed_sdhci_irq *sdhci_irq;
+	struct clk *sdclk;
+
+	sdhci_irq = kzalloc(sizeof(*sdhci_irq), GFP_KERNEL);
+	if (!sdhci_irq)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, sdhci_irq);
+	//node->data = sdhci_irq;
+	pdev->dev.of_node->data = sdhci_irq;
+
+	sdhci_irq->regs = of_iomap(pdev->dev.of_node, 0);
+	if (IS_ERR(sdhci_irq->regs))
+		return PTR_ERR(sdhci_irq->regs);
+
+	sdclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(sdclk)) {
+		dev_err(&pdev->dev, "no sdclk clock defined\n");
+		return PTR_ERR(sdclk);
+	}
+
+	clk_prepare_enable(sdclk);
+
+	sdhci_irq->parent_irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+	if (sdhci_irq->parent_irq < 0)
+		return sdhci_irq->parent_irq;
+
+	sdhci_irq->irq_domain = irq_domain_add_linear(
+					pdev->dev.of_node, ASPEED_SDHCI_SLOT_NUM,
+					&aspeed_sdhci_irq_domain_ops, NULL);
+	if (!sdhci_irq->irq_domain)
+		return -ENOMEM;
+
+	sdhci_irq->irq_domain->name = "aspeed-sdhci-irq";
+
+	irq_set_chained_handler_and_data(sdhci_irq->parent_irq,
+					 aspeed_sdhci_irq_handler, sdhci_irq);

drivers/mmc/host/aspeed-sdhci-core.c line 128

Quoted 10 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +10 -0
+
+	pr_info("sdhci irq controller registered, irq %d\n", sdhci_irq->parent_irq);
+
+	return 0;
+}
+
+static const struct of_device_id irq_aspeed_sdhci_dt_ids[] = {
+	{ .compatible = "aspeed,aspeed-sdhci-irq", },
+	{},
+};

You should call this aspeed,ast2{4,5}00-sdhci-core. I would change your device-tree representation as follow (add back all the reg & properties):

Quoted 14 lines
	sdhci-core {
		reg = <common regs>
		ranges = either empty prop or the 2 ranges goign to the children
		compatible = <aspeed,ast2400-sdhci-core>;

		sdhci-slot@xxx {
			compatible = <aspeed,ast2400-sdhci-slot>;
		};

		sdhci-slot@yyy {
			compatible = <aspeed,ast2400-sdhci-slot>;
		};
	}

If i keep the interrupt controller for dispatch slot. Is the following is compromise way for dts? Each slot need interrupt-parent.

&sdhci {

	sdhci_core: interrupt-controller@0 {
		#interrupt-cells = <1>;
		compatible = "aspeed,ast2500-sdhci-core";
		reg = <0x0 0x100>;
		interrupts = <26>;
		interrupt-controller;
		clocks = <&syscon ASPEED_CLK_GATE_SDCLKCLK>;
	};

	sdhci_slot0: sdhci_slot@100 {
		compatible = "aspeed,ast2500-sdhci-slot";
		reg = <0x100 0x100>;
		interrupts = <0>;
		interrupt-parent = <&sdhci_core>;
		sdhci,auto-cmd12;
		clocks = <&syscon ASPEED_CLK_SDIO>;
		status = "disabled";
	};

	sdhci_slot1: sdhci_slot@200 {
		compatible = "aspeed,ast2500-sdhci-slot";
		reg = <0x200 0x100>;
		interrupts = <1>;
		interrupt-parent = <&sdhci_core>;
		sdhci,auto-cmd12;
		clocks = <&syscon ASPEED_CLK_SDIO>;
		status = "disabled";
	};

};

Quoted 58 lines
Quoted 5 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +5 -0
+MODULE_DEVICE_TABLE(of, irq_aspeed_sdhci_dt_ids);
+
+static struct platform_driver irq_aspeed_sdhci_device_driver = {
+	.probe		= irq_aspeed_sdhci_probe,
+	.driver		= {

drivers/mmc/host/aspeed-sdhci-core.c line 143

Quoted 10 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +10 -0
+		.name   = KBUILD_MODNAME,
+		.of_match_table	= irq_aspeed_sdhci_dt_ids,
+	}
+};
+
+static int __init irq_aspeed_sdhci_init(void)
+{
+	return platform_driver_register(&irq_aspeed_sdhci_device_driver);
+}
+core_initcall(irq_aspeed_sdhci_init);

This should be a normal device init call, thus module_platform_driver is all you need here.

Quoted 38 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +4 -0
+
+MODULE_AUTHOR("Ryan Chen");
+MODULE_DESCRIPTION("ASPEED SOC SDHCI IRQ Driver");
+MODULE_LICENSE("GPL v2");
include/linux/mmc/sdhci-aspeed-data.h new file +28 -0
new file mode 100644
index 0000000..fba2bf2
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef LINUX_MMC_SDHCI_ASPEED_DATA_H
+#define LINUX_MMC_SDHCI_ASPEED_DATA_H
+
+#include <linux/io.h>
+
+#define ASPEED_SDHCI_INFO			0x00
+#define  ASPEED_SDHCI_S1MMC8			BIT(25)
+#define  ASPEED_SDHCI_S0MMC8			BIT(24)
+#define ASPEED_SDHCI_BLOCK			0x04
+#define ASPEED_SDHCI_CTRL			0xF0
+#define ASPEED_SDHCI_ISR			0xFC
+
+struct aspeed_sdhci_irq {
+	void __iomem *regs;
+	int parent_irq;
+	struct irq_domain *irq_domain;
+};
+
+static inline void aspeed_sdhci_set_8bit_mode(struct aspeed_sdhci_irq *sdhci_irq, int mode)
+{
+	if (mode)
+		writel(ASPEED_SDHCI_S0MMC8 | readl(sdhci_irq->regs), sdhci_irq->regs);
+	else
+		writel(~ASPEED_SDHCI_S0MMC8 & readl(sdhci_irq->regs), sdhci_irq->regs);
+}
+
+#endif
#11 lore raw

Re: [PATCH linux dev-4.17 3/7] mmc: Aspeed: Add Aspeed sdhci core driver

Quoted 28 lines · Ryan Chen

On

If i keep the interrupt controller for dispatch slot. Is the following is compromise way for dts? Each slot need interrupt-parent.

&sdhci {

	sdhci_core: interrupt-controller@0 {
		#interrupt-cells = <1>;
		compatible = "aspeed,ast2500-sdhci-core";
		reg = <0x0 0x100>;
		interrupts = <26>;
		interrupt-controller;
		clocks = <&syscon ASPEED_CLK_GATE_SDCLKCLK>;
	};

	sdhci_slot0: sdhci_slot@100 {
		compatible = "aspeed,ast2500-sdhci-slot";
		reg = <0x100 0x100>;
		interrupts = <0>;
		interrupt-parent = <&sdhci_core>;
		sdhci,auto-cmd12;
		clocks = <&syscon ASPEED_CLK_SDIO>;
		status = "disabled";
	};

	sdhci_slot1: sdhci_slot@200 {
Quoted 8 lines
		compatible = "aspeed,ast2500-sdhci-slot";
		reg = <0x200 0x100>;
		interrupts = <1>;
		interrupt-parent = <&sdhci_core>;
		sdhci,auto-cmd12;
		clocks = <&syscon ASPEED_CLK_SDIO>;
		status = "disabled";
	};

I think the "core" is more than just the interrupt controller. The slots should be the children of it.

You don't necessarily need to treat the slots as being matched by a separate driver, it complicates things imho, but up to you.

Ben.

Quoted 61 lines

};

Quoted 57 lines
Quoted 5 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +5 -0
+MODULE_DEVICE_TABLE(of, irq_aspeed_sdhci_dt_ids);
+
+static struct platform_driver irq_aspeed_sdhci_device_driver = {
+	.probe		= irq_aspeed_sdhci_probe,
+	.driver		= {

drivers/mmc/host/aspeed-sdhci-core.c line 143

Quoted 10 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +10 -0
+		.name   = KBUILD_MODNAME,
+		.of_match_table	= irq_aspeed_sdhci_dt_ids,
+	}
+};
+
+static int __init irq_aspeed_sdhci_init(void)
+{
+	return platform_driver_register(&irq_aspeed_sdhci_device_driver);
+}
+core_initcall(irq_aspeed_sdhci_init);

This should be a normal device init call, thus module_platform_driver is all you need here.

Quoted 38 lines
drivers/mmc/host/aspeed-sdhci-core.c new file +4 -0
+
+MODULE_AUTHOR("Ryan Chen");
+MODULE_DESCRIPTION("ASPEED SOC SDHCI IRQ Driver");
+MODULE_LICENSE("GPL v2");
include/linux/mmc/sdhci-aspeed-data.h new file +28 -0
new file mode 100644
index 0000000..fba2bf2
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef LINUX_MMC_SDHCI_ASPEED_DATA_H
+#define LINUX_MMC_SDHCI_ASPEED_DATA_H
+
+#include <linux/io.h>
+
+#define ASPEED_SDHCI_INFO			0x00
+#define  ASPEED_SDHCI_S1MMC8			BIT(25)
+#define  ASPEED_SDHCI_S0MMC8			BIT(24)
+#define ASPEED_SDHCI_BLOCK			0x04
+#define ASPEED_SDHCI_CTRL			0xF0
+#define ASPEED_SDHCI_ISR			0xFC
+
+struct aspeed_sdhci_irq {
+	void __iomem *regs;
+	int parent_irq;
+	struct irq_domain *irq_domain;
+};
+
+static inline void aspeed_sdhci_set_8bit_mode(struct aspeed_sdhci_irq *sdhci_irq, int mode)
+{
+	if (mode)
+		writel(ASPEED_SDHCI_S0MMC8 | readl(sdhci_irq->regs), sdhci_irq->regs);
+	else
+		writel(~ASPEED_SDHCI_S0MMC8 & readl(sdhci_irq->regs), sdhci_irq->regs);
+}
+
+#endif
author
#12 lore raw

PATCH v2 4/7 mmc: Aspeed: Add driver for Aspeed sdhci

In reply to Ryan Chen

Add a driver for Aspeed's sdhci controller core.

---
 drivers/mmc/host/Kconfig           |  12 +++
 drivers/mmc/host/Makefile          |   2 +-
 drivers/mmc/host/sdhci-of-aspeed.c | 178 +++++++++++++++++++++++++++++++++++++
 3 files changed, 191 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
drivers/mmc/host/Kconfig +12 -0
index 9589f9c..5056e6e 100644
@@ -142,6 +142,18 @@ config MMC_SDHCI_OF_ARASAN
 
 	  If unsure, say N.
 
+config MMC_SDHCI_OF_ASPEED
+	tristate "SDHCI OF support for the ASPEED SDHCI controller"
+	depends on MMC_SDHCI_PLTFM
+	depends on OF
+	help
+	  This selects the ASPEED Secure Digital Host Controller Interface.
+
+	  If you have a controller with this interface, say Y or M here. You
+	  also need to enable an appropriate bus interface.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_OF_AT91
 	tristate "SDHCI OF support for the Atmel SDMMC controller"
 	depends on MMC_SDHCI_PLTFM
drivers/mmc/host/Makefile +1 -1
index c3e5a1f..6214d11 100644
@@ -78,7 +78,7 @@ obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)	+= sdhci-esdhc-imx.o
 obj-$(CONFIG_MMC_SDHCI_DOVE)		+= sdhci-dove.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)		+= sdhci-tegra.o
 obj-$(CONFIG_MMC_SDHCI_OF_ARASAN)	+= sdhci-of-arasan.o
-obj-$(CONFIG_MMC_SDHCI_OF_ASPEED)	+= aspeed-sdhci-core.o
+obj-$(CONFIG_MMC_SDHCI_OF_ASPEED)	+= aspeed-sdhci-core.o sdhci-of-aspeed.o
 obj-$(CONFIG_MMC_SDHCI_OF_AT91)		+= sdhci-of-at91.o
 obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)	+= sdhci-of-esdhc.o
 obj-$(CONFIG_MMC_SDHCI_OF_HLWD)		+= sdhci-of-hlwd.o
drivers/mmc/host/sdhci-of-aspeed.c new file +178 -0

178 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#13 lore raw

PATCH v2 5/7 dts: Aspeed: Add devicetree for Aspeed sdhci

In reply to Ryan Chen

Add devicetree for Aspeed's sdhci

V0->V1
separete patch toe device tree and binding document

---
 arch/arm/boot/dts/aspeed-ast2500-evb.dts | 14 +++++++++++
 arch/arm/boot/dts/aspeed-g4.dtsi         | 40 ++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/aspeed-g5.dtsi         | 40 ++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+)
arch/arm/boot/dts/aspeed-ast2500-evb.dts +14 -0
index 5dbb33c..5578ae0 100644
@@ -97,6 +97,20 @@
 	};
 };
 
+&sdhci_slot0 {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_sd1_default>;
+};
+
+&sdhci_slot1 {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_sd2_default>;
+};
+
 /*
  * Enable port A as device (via the virtual hub) and port B as
  * host by default on the eval board. This can be easily changed
arch/arm/boot/dts/aspeed-g4.dtsi +40 -0
index e86fa80..f4a8d7d 100644
@@ -190,6 +190,13 @@
 				reg = <0x1e720000 0x8000>;	// 32K
 			};
 
+			sdhci: sdhci@1e740000 {
+				compatible = "simple-bus";
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges = <0 0x1e740000 0x1000>;
+			};
+
 			gpio: gpio@1e780000 {
 				#gpio-cells = <2>;
 				gpio-controller;
@@ -369,6 +376,39 @@
 	};
 };
 
+&sdhci {
+
+	sdhci_ic: interrupt-controller@0 {
+		#interrupt-cells = <1>;
+		compatible = "aspeed,aspeed-sdhci-irq";
+		reg = <0x0 0x100>;
+		interrupts = <26>;
+		interrupt-controller;
+		clocks = <&syscon ASPEED_CLK_GATE_SDCLKCLK>;
+	};
+
+	sdhci_slot0: sdhci_slot0@100 {
+		compatible = "aspeed,sdhci-ast2400";
+		reg = <0x100 0x100>;
+		interrupts = <0>;
+		interrupt-parent = <&sdhci_ic>;
+		sdhci,auto-cmd12;
+		clocks = <&syscon ASPEED_CLK_SDIO>;
+		status = "disabled";
+	};
+
+	sdhci_slot1: sdhci_slot1@200 {
+		compatible = "aspeed,sdhci-ast2400";
+		reg = <0x200 0x100>;
+		interrupts = <1>;
+		interrupt-parent = <&sdhci_ic>;
+		sdhci,auto-cmd12;
+		clocks = <&syscon ASPEED_CLK_SDIO>;
+		status = "disabled";
+	};
+
+};
+
 &i2c {
 	i2c_ic: interrupt-controller@0 {
 		#interrupt-cells = <1>;
arch/arm/boot/dts/aspeed-g5.dtsi +40 -0
index d92f047..effe631 100644
@@ -256,6 +256,13 @@
 				reg = <0x1e720000 0x9000>;	// 36K
 			};
 
+			sdhci: sdhci@1e740000 {
+				compatible = "simple-bus";
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges = <0 0x1e740000 0x1000>;
+			};
+
 			gpio: gpio@1e780000 {
 				#gpio-cells = <2>;
 				gpio-controller;
@@ -446,6 +453,39 @@
 	};
 };
 
+&sdhci {
+
+	sdhci_ic: interrupt-controller@0 {
+		#interrupt-cells = <1>;
+		compatible = "aspeed,aspeed-sdhci-irq";
+		reg = <0x0 0x100>;
+		interrupts = <26>;
+		interrupt-controller;
+		clocks = <&syscon ASPEED_CLK_GATE_SDCLKCLK>;
+	};
+
+	sdhci_slot0: sdhci_slot0@100 {
+		compatible = "aspeed,sdhci-ast2500";
+		reg = <0x100 0x100>;
+		interrupts = <0>;
+		interrupt-parent = <&sdhci_ic>;
+		sdhci,auto-cmd12;
+		clocks = <&syscon ASPEED_CLK_SDIO>;
+		status = "disabled";
+	};
+
+	sdhci_slot1: sdhci_slot1@200 {
+		compatible = "aspeed,sdhci-ast2500";
+		reg = <0x200 0x100>;
+		interrupts = <1>;
+		interrupt-parent = <&sdhci_ic>;
+		sdhci,auto-cmd12;
+		clocks = <&syscon ASPEED_CLK_SDIO>;
+		status = "disabled";
+	};
+
+};
+
 &i2c {
 	i2c_ic: interrupt-controller@0 {
 		#interrupt-cells = <1>;
Signature · 1 line
2.7.4
author
#14 lore raw

PATCH v2 6/7 Documentation: mmc: add aspeed sdhci binding document

In reply to Ryan Chen

add aspeed sdhci binding document

V0->V1
add independent patch for binding document

---
 .../bindings/mmc/aspeed,aspeed-sdhci.txt           | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt new file +54 -0
new file mode 100644
index 0000000..6ad30e5
@@ -0,0 +1,54 @@
+Device Tree Bindings for the Aspeed SoC SDHCI Controller
+
+This file documents differences between the core properties in mmc.txt
+and the properties present in the Aspeed SDHCI
+Aspeed SD/SDIO Host controller have have general information in front of controller.
+In ast25xx/ast24xx have two slots, and each slot have own register.
+
+Required properties:
+- compatible : should be "aspeed,ast2500-sdhci" or "aspeed,ast2400-sdhci"
+- clocks : phandle + clock specifier pair of the external clock
+- interrupts : interrupt number
+- interrupt-parent : interrupt controller for bus, should reference a
+                     aspeed,aspeed-sdhci-ic interrupt controller
+
+Example:
+
+sdhci {
+	compatible = "simple-bus";
+	#address-cells = <1>;
+	#size-cells = <1>;
+	ranges = <0 0x1e740000 0x1000>;
+
+	sdhci_ic: interrupt-controller@0 {
+		#interrupt-cells = <1>;
+		compatible = "aspeed,aspeed-sdhci-irq";
+		reg = <0x0 0x100>;
+		interrupts = <26>;
+		interrupt-controller;
+		clocks = <&syscon ASPEED_CLK_GATE_SDCLKCLK>;
+	};
+
+	sdhci_slot0: sdhci_slot0@100 {
+		compatible = "aspeed,sdhci-ast2500";
+		reg = <0x100 0x100>;
+		interrupts = <0>;
+		interrupt-parent = <&sdhci_ic>;
+		slot = <0>;
+		sdhci,auto-cmd12;
+		clocks = <&syscon ASPEED_CLK_SDIO>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_sd1_default>;
+	};
+
+	sdhci_slot1: sdhci_slot1@200 {
+		compatible = "aspeed,sdhci-ast2500";
+		reg = <0x200 0x100>;
+		interrupts = <1>;
+		interrupt-parent = <&sdhci_ic>;
+		sdhci,auto-cmd12;
+		clocks = <&syscon ASPEED_CLK_SDIO>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_sd2_default>;
+	};
+};
Signature · 1 line
2.7.4
author
#15 lore raw

PATCH v2 7/7 configs: Aspeed: enable mmc host in defconfig

In reply to Ryan Chen

Enable mmc host in aspeed_g5_defconfig

---
 arch/arm/configs/aspeed_g5_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/configs/aspeed_g5_defconfig +6 -0
index b7f8fa1..7b99aa9 100644
@@ -197,6 +197,12 @@ CONFIG_USB_CONFIGFS_F_LB_SS=y
 CONFIG_USB_CONFIGFS_F_FS=y
 CONFIG_USB_CONFIGFS_F_HID=y
 CONFIG_USB_CONFIGFS_F_PRINTER=y
+CONFIG_MMC=y
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=8
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_PLTFM=y
+CONFIG_MMC_SDHCI_OF_ASPEED=y
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_CLASS_FLASH=y
Signature · 1 line
2.7.4
#16 lore raw
In reply to Ryan Chen
Quoted 7 lines · Ryan Chen

This series implements Aspeed SDIO driver. In Aspeed SDIO controller with two slots and have a global register for interrupt status and other general information.

v2
Change irqchip driver(irq-aspeed-sdhci-ic.c) to aspeed sdhci core driver aspeed-sdhci-core.c

Thanks, that's much better I think.

Cheers,
Ben.

Quoted 39 lines

v0
For implements this, it will have have irq-aspeed-sdhci-ic.c for sdhci each slot irq dispatch, and then go to sdhci driver handle (sdhci.c).

Another is sdhci-of-aspeed.c for specific function call.

Ryan Chen

Ryan Chen (7):
clk: Aspeed: Modify clk-aspeed.c driver probe sequence
clk: Aspeed: Add sdhci reset and clock
mmc: Aspeed: Add Aspeed sdhci core driver
mmc: Aspeed: Add driver for Aspeed sdhci
dts: Aspeed: Add devicetree for Aspeed sdhci
Documentation: mmc: add aspeed sdhci binding document
configs: Aspeed: enable mmc host in defconfig

 .../bindings/mmc/aspeed,aspeed-sdhci.txt           |  54 +++++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           |  14 ++
 arch/arm/boot/dts/aspeed-g4.dtsi                   |  40 +++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   |  40 +++++
 arch/arm/configs/aspeed_g5_defconfig               |   6 +
 drivers/clk/clk-aspeed.c                           |  51 +++---
 drivers/irqchip/Makefile                           |   2 +-
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c               | 147 +++++++++++++++++
 drivers/mmc/host/sdhci-of-aspeed.c                 | 178 +++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |   2 +-
 include/linux/mmc/sdhci-aspeed-data.h              |  28 ++++
 13 files changed, 553 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
#17 lore raw
In reply to Ryan Chen

Guys, what's the fate of this patch set?
Is going to be merged into openbmc linux?
We have an SD card slot on our BMC card and so would like to know whether or not to await arrival of SDIO support from upstream or import this patch set locally.

Thank you.

Quoted 46 lines · Ryan Chen

This series implements Aspeed SDIO driver. In Aspeed SDIO controller with two slots and have a global register for interrupt status and other general information.

v2
Change irqchip driver(irq-aspeed-sdhci-ic.c) to aspeed sdhci core driver aspeed-sdhci-core.c

v0
For implements this, it will have have irq-aspeed-sdhci-ic.c for sdhci each slot irq dispatch, and then go to sdhci driver handle (sdhci.c).

Another is sdhci-of-aspeed.c for specific function call.

Ryan Chen

Ryan Chen (7):
clk: Aspeed: Modify clk-aspeed.c driver probe sequence
clk: Aspeed: Add sdhci reset and clock
mmc: Aspeed: Add Aspeed sdhci core driver
mmc: Aspeed: Add driver for Aspeed sdhci
dts: Aspeed: Add devicetree for Aspeed sdhci
Documentation: mmc: add aspeed sdhci binding document
configs: Aspeed: enable mmc host in defconfig

 .../bindings/mmc/aspeed,aspeed-sdhci.txt           |  54 +++++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           |  14 ++
 arch/arm/boot/dts/aspeed-g4.dtsi                   |  40 +++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   |  40 +++++
 arch/arm/configs/aspeed_g5_defconfig               |   6 +
 drivers/clk/clk-aspeed.c                           |  51 +++---
 drivers/irqchip/Makefile                           |   2 +-
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c               | 147 +++++++++++++++++
 drivers/mmc/host/sdhci-of-aspeed.c                 | 178 +++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |   2 +-
 include/linux/mmc/sdhci-aspeed-data.h              |  28 ++++
 13 files changed, 553 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
reviewer
#18 lore raw

Hello,
I got some feedback from maintainer. I will modify for new architecture, hopeful, I will apply new patch at March.

Rayn

-----Original Message-----
From: openbmc [mailto:[email protected]] On Behalf Of Alexander Amelkin
Sent: Friday, February 15, 2019 6:36 PM
To: [email protected]
Subject: Re: [PATCHv2 linux dev-4.17 0/7] mmc/host: Add Aspeed SDIO driver

Guys, what's the fate of this patch set?
Is going to be merged into openbmc linux?
We have an SD card slot on our BMC card and so would like to know whether or not to await arrival of SDIO support from upstream or import this patch set locally.

Thank you.

Quoted 46 lines · Ryan Chen

This series implements Aspeed SDIO driver. In Aspeed SDIO controller with two slots and have a global register for interrupt status and other general information.

v2
Change irqchip driver(irq-aspeed-sdhci-ic.c) to aspeed sdhci core driver aspeed-sdhci-core.c

v0
For implements this, it will have have irq-aspeed-sdhci-ic.c for sdhci each slot irq dispatch, and then go to sdhci driver handle (sdhci.c).

Another is sdhci-of-aspeed.c for specific function call.

Ryan Chen

Ryan Chen (7):
clk: Aspeed: Modify clk-aspeed.c driver probe sequence
clk: Aspeed: Add sdhci reset and clock
mmc: Aspeed: Add Aspeed sdhci core driver
mmc: Aspeed: Add driver for Aspeed sdhci
dts: Aspeed: Add devicetree for Aspeed sdhci
Documentation: mmc: add aspeed sdhci binding document
configs: Aspeed: enable mmc host in defconfig

 .../bindings/mmc/aspeed,aspeed-sdhci.txt           |  54 +++++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           |  14 ++
 arch/arm/boot/dts/aspeed-g4.dtsi                   |  40 +++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   |  40 +++++
 arch/arm/configs/aspeed_g5_defconfig               |   6 +
 drivers/clk/clk-aspeed.c                           |  51 +++---
 drivers/irqchip/Makefile                           |   2 +-
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c               | 147 +++++++++++++++++
 drivers/mmc/host/sdhci-of-aspeed.c                 | 178 +++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |   2 +-
 include/linux/mmc/sdhci-aspeed-data.h              |  28 ++++
 13 files changed, 553 insertions(+), 22 deletions(-)  create mode 
100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
#19 lore raw

Hi, Ryan!

How is it going? We've tried the original version of your patch and it didn't apply for us due to a typo. We've fixed the typo, but it still doesn't work. We're not sure yet why. Have you verified that old patch on any real hardware? When do you think you'll be able to come up with the new version of the patch?

Thank you.

Alexander.

Quoted 64 lines · Ryan Chen

Hello,
I got some feedback from maintainer. I will modify for new architecture, hopeful, I will apply new patch at March.

Rayn

-----Original Message-----
From: openbmc [mailto:[email protected]] On Behalf Of Alexander Amelkin
Sent: Friday, February 15, 2019 6:36 PM
To: [email protected]
Subject: Re: [PATCHv2 linux dev-4.17 0/7] mmc/host: Add Aspeed SDIO driver

Guys, what's the fate of this patch set?
Is going to be merged into openbmc linux?
We have an SD card slot on our BMC card and so would like to know whether or not to await arrival of SDIO support from upstream or import this patch set locally.

Thank you.

Quoted 46 lines · Ryan Chen

This series implements Aspeed SDIO driver. In Aspeed SDIO controller with two slots and have a global register for interrupt status and other general information.

v2
Change irqchip driver(irq-aspeed-sdhci-ic.c) to aspeed sdhci core driver aspeed-sdhci-core.c

v0
For implements this, it will have have irq-aspeed-sdhci-ic.c for sdhci each slot irq dispatch, and then go to sdhci driver handle (sdhci.c).

Another is sdhci-of-aspeed.c for specific function call.

Ryan Chen

Ryan Chen (7):
clk: Aspeed: Modify clk-aspeed.c driver probe sequence
clk: Aspeed: Add sdhci reset and clock
mmc: Aspeed: Add Aspeed sdhci core driver
mmc: Aspeed: Add driver for Aspeed sdhci
dts: Aspeed: Add devicetree for Aspeed sdhci
Documentation: mmc: add aspeed sdhci binding document
configs: Aspeed: enable mmc host in defconfig

 .../bindings/mmc/aspeed,aspeed-sdhci.txt           |  54 +++++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           |  14 ++
 arch/arm/boot/dts/aspeed-g4.dtsi                   |  40 +++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   |  40 +++++
 arch/arm/configs/aspeed_g5_defconfig               |   6 +
 drivers/clk/clk-aspeed.c                           |  51 +++---
 drivers/irqchip/Makefile                           |   2 +-
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c               | 147 +++++++++++++++++
 drivers/mmc/host/sdhci-of-aspeed.c                 | 178 +++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |   2 +-
 include/linux/mmc/sdhci-aspeed-data.h              |  28 ++++
 13 files changed, 553 insertions(+), 22 deletions(-)  create mode 
100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
reviewer
#20 lore raw

Hello Alexander,
The original version is patch on v4.17.4, it can build with the patch. Does there have any message? Currently I am ongoing on new version SOC chip also with new adhci, and will apply patch at June.
Ryan

Quoted 5 lines
Quoted 5 lines

How is it going? We've tried the original version of your patch and it didn't apply for us due to a typo. We've fixed the typo, but it still doesn't work. >>We're not sure yet why. Have you verified that old patch on any real hardware? When do you think you'll be able to come up with the new version of >>the patch?

Thank you.

Alexander.

Quoted 67 lines · Ryan Chen

Hello,
I got some feedback from maintainer. I will modify for new architecture, hopeful, I will apply new patch at March.

Rayn

-----Original Message-----
From: openbmc [mailto:[email protected]] On Behalf Of Alexander Amelkin
Sent: Friday, February 15, 2019 6:36 PM
To: [email protected]
Subject: Re: [PATCHv2 linux dev-4.17 0/7] mmc/host: Add Aspeed SDIO driver

Guys, what's the fate of this patch set?
Is going to be merged into openbmc linux?
We have an SD card slot on our BMC card and so would like to know whether or not to await arrival of SDIO support from upstream or import this patch set locally.

Thank you.

Quoted 46 lines · Ryan Chen

This series implements Aspeed SDIO driver. In Aspeed SDIO controller with two slots and have a global register for interrupt status and other general information.

v2
Change irqchip driver(irq-aspeed-sdhci-ic.c) to aspeed sdhci core driver aspeed-sdhci-core.c

v0
For implements this, it will have have irq-aspeed-sdhci-ic.c for sdhci each slot irq dispatch, and then go to sdhci driver handle (sdhci.c).

Another is sdhci-of-aspeed.c for specific function call.

Ryan Chen

Ryan Chen (7):
clk: Aspeed: Modify clk-aspeed.c driver probe sequence
clk: Aspeed: Add sdhci reset and clock
mmc: Aspeed: Add Aspeed sdhci core driver
mmc: Aspeed: Add driver for Aspeed sdhci
dts: Aspeed: Add devicetree for Aspeed sdhci
Documentation: mmc: add aspeed sdhci binding document
configs: Aspeed: enable mmc host in defconfig

 .../bindings/mmc/aspeed,aspeed-sdhci.txt           |  54 +++++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           |  14 ++
 arch/arm/boot/dts/aspeed-g4.dtsi                   |  40 +++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   |  40 +++++
 arch/arm/configs/aspeed_g5_defconfig               |   6 +
 drivers/clk/clk-aspeed.c                           |  51 +++---
 drivers/irqchip/Makefile                           |   2 +-
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c               | 147 +++++++++++++++++
 drivers/mmc/host/sdhci-of-aspeed.c                 | 178 +++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |   2 +-
 include/linux/mmc/sdhci-aspeed-data.h              |  28 ++++
 13 files changed, 553 insertions(+), 22 deletions(-)  create mode
100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
#21 lore raw

Thanks Ryan.

After fixing a typo in your patch (ASPEED_CLK_GATE_SDCLKLK instead of ASPEED_CLK_GATE_SDCLK) and building the driver, we've found a minor hardware issue in our design that prevented the driver from working with our board. We've fixed it and it works for us now. Anyway, it would be great to see the driver upstreamed.

Alexander.

Quoted 76 lines · Ryan Chen

Hello Alexander,
The original version is patch on v4.17.4, it can build with the patch. Does there have any message? Currently I am ongoing on new version SOC chip also with new adhci, and will apply patch at June.
Ryan

Quoted 3 lines
Quoted 3 lines

How is it going? We've tried the original version of your patch and it didn't apply for us due to a typo. We've fixed the typo, but it still doesn't work. >>We're not sure yet why. Have you verified that old patch on any real hardware? When do you think you'll be able to come up with the new version of >>the patch? Thank you.
Alexander.

Quoted 67 lines · Ryan Chen

Hello,
I got some feedback from maintainer. I will modify for new architecture, hopeful, I will apply new patch at March.

Rayn

-----Original Message-----
From: openbmc [mailto:[email protected]] On Behalf Of Alexander Amelkin
Sent: Friday, February 15, 2019 6:36 PM
To: [email protected]
Subject: Re: [PATCHv2 linux dev-4.17 0/7] mmc/host: Add Aspeed SDIO driver

Guys, what's the fate of this patch set?
Is going to be merged into openbmc linux?
We have an SD card slot on our BMC card and so would like to know whether or not to await arrival of SDIO support from upstream or import this patch set locally.

Thank you.

Quoted 46 lines · Ryan Chen

This series implements Aspeed SDIO driver. In Aspeed SDIO controller with two slots and have a global register for interrupt status and other general information.

v2
Change irqchip driver(irq-aspeed-sdhci-ic.c) to aspeed sdhci core driver aspeed-sdhci-core.c

v0
For implements this, it will have have irq-aspeed-sdhci-ic.c for sdhci each slot irq dispatch, and then go to sdhci driver handle (sdhci.c).

Another is sdhci-of-aspeed.c for specific function call.

Ryan Chen

Ryan Chen (7):
clk: Aspeed: Modify clk-aspeed.c driver probe sequence
clk: Aspeed: Add sdhci reset and clock
mmc: Aspeed: Add Aspeed sdhci core driver
mmc: Aspeed: Add driver for Aspeed sdhci
dts: Aspeed: Add devicetree for Aspeed sdhci
Documentation: mmc: add aspeed sdhci binding document
configs: Aspeed: enable mmc host in defconfig

 .../bindings/mmc/aspeed,aspeed-sdhci.txt           |  54 +++++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           |  14 ++
 arch/arm/boot/dts/aspeed-g4.dtsi                   |  40 +++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   |  40 +++++
 arch/arm/configs/aspeed_g5_defconfig               |   6 +
 drivers/clk/clk-aspeed.c                           |  51 +++---
 drivers/irqchip/Makefile                           |   2 +-
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/aspeed-sdhci-core.c               | 147 +++++++++++++++++
 drivers/mmc/host/sdhci-of-aspeed.c                 | 178 +++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |   2 +-
 include/linux/mmc/sdhci-aspeed-data.h              |  28 ++++
 13 files changed, 553 insertions(+), 22 deletions(-)  create mode
100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
 create mode 100644 drivers/mmc/host/aspeed-sdhci-core.c
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
maintainer
#22 lore raw
Quoted 3 lines · Alexander Amelkin

After fixing a typo in your patch (ASPEED_CLK_GATE_SDCLKLK instead of ASPEED_CLK_GATE_SDCLK) and building the driver, we've found a minor hardware issue in our design that prevented the driver from working with our board. We've fixed it and it works for us now. Anyway, it would be great to see the driver upstreamed.

We can apply it to the openbmc tree if that would help. I can't seem to find Ryan's v2.

Alexander, if you want to post the version that you tested to the openbmc list I can apply that.

Cheers,

Joel

#23 lore raw

cover Add support for ASPEED SDHCI controller

Quoted 2 lines · Joel Stanley

Alexander, if you want to post the version that you tested to the openbmc list I can apply that.

Sure, Joel, that would be great!

This series of patches is based on the original patchwork submitted by Ryan Chen here: https://patchwork.ozlabs.org/cover/942313/

The patch set has been updated by YADRO to cleanly apply and build for dev-4.19 branch of OpenBMC linux kernel.

This patch works fine for us with our AST2400 BMC on VESNIN.

With best regards,
Alexander Amelkin,
Leading BMC Software Engineer,
YADRO, https://yadro.com

Original cover letter:
----------------------------
This series implements Aspeed SDIO driver. In Aspeed SDIO controller with two slots and have a global register for interrupt status and other general information.

For implements this, it will have have irq-aspeed-sdhci-ic.c for sdhci each slot irq dispatch, and then go to sdhci driver handle (sdhci.c).

Another is sdhci-of-aspeed.c for specific function call.

Ryan Chen
----------------------------

Ryan Chen (7):
clk: Aspeed: Modify clk-aspeed.c driver probe sequence
clk: Aspeed: Add sdhci reset and clock
irqchip: Aspeed: Add Aspeed sdhci irq driver
dts: Aspeed: Add Aspeed sdhci dts document
mmc: Aspeed: Add driver for Aspeed sdhci
dts: Aspeed: Add devicetree for Aspeed sdhci
configs: Aspeed: enable mmc host in defconfig

 .../aspeed,aspeed-sdhci-ic.txt                     |  25 +++
 .../bindings/mmc/aspeed,aspeed-sdhci.txt           |  42 +++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           |  14 ++
 arch/arm/boot/dts/aspeed-g4.dtsi                   |  40 +++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   |  40 +++++
 arch/arm/configs/aspeed_g5_defconfig               |   6 +
 drivers/clk/clk-aspeed.c                           |  15 +-
 drivers/irqchip/Makefile                           |   2 +-
 drivers/irqchip/irq-aspeed-sdhci-ic.c              | 147 +++++++++++++++++
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-of-aspeed.c                 | 178 +++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |   2 +-
 include/linux/mmc/sdhci-aspeed-data.h              |  28 ++++
 14 files changed, 548 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/aspeed,aspeed-sdhci-ic.txt
 create mode 100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
 create mode 100644 drivers/irqchip/irq-aspeed-sdhci-ic.c
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
Signature · 1 line
2.7.4
#24 lore raw

Re: [PATCHv2-modified dev-4.19 0/7] Add support for ASPEED SDHCI controller

Quoted 6 lines · Alexander Amelkin
Quoted 2 lines · Joel Stanley

Alexander, if you want to post the version that you tested to the openbmc list I can apply that.

Sure, Joel, that would be great!

Quoted 7 lines

This series of patches is based on the original patchwork submitted by Ryan Chen here: https://patchwork.ozlabs.org/cover/942313/

The patch set has been updated by YADRO to cleanly apply and build for dev-4.19 branch of OpenBMC linux kernel.

This patch works fine for us with our AST2400 BMC on VESNIN.

Thanks for posting the tested series.

Any chance you can rebase on dev-5.0?

Andrew

Quoted 62 lines

With best regards,
Alexander Amelkin,
Leading BMC Software Engineer,
YADRO, https://yadro.com

Original cover letter:
----------------------------
This series implements Aspeed SDIO driver. In Aspeed SDIO controller with two slots and have a global register for interrupt status and other general information.

For implements this, it will have have irq-aspeed-sdhci-ic.c for sdhci each slot irq dispatch, and then go to sdhci driver handle (sdhci.c).

Another is sdhci-of-aspeed.c for specific function call.

Ryan Chen
----------------------------

Ryan Chen (7):
clk: Aspeed: Modify clk-aspeed.c driver probe sequence
clk: Aspeed: Add sdhci reset and clock
irqchip: Aspeed: Add Aspeed sdhci irq driver
dts: Aspeed: Add Aspeed sdhci dts document
mmc: Aspeed: Add driver for Aspeed sdhci
dts: Aspeed: Add devicetree for Aspeed sdhci
configs: Aspeed: enable mmc host in defconfig

 .../aspeed,aspeed-sdhci-ic.txt                     |  25 +++
 .../bindings/mmc/aspeed,aspeed-sdhci.txt           |  42 +++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           |  14 ++
 arch/arm/boot/dts/aspeed-g4.dtsi                   |  40 +++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   |  40 +++++
 arch/arm/configs/aspeed_g5_defconfig               |   6 +
 drivers/clk/clk-aspeed.c                           |  15 +-
 drivers/irqchip/Makefile                           |   2 +-
 drivers/irqchip/irq-aspeed-sdhci-ic.c              | 147 
+++++++++++++++++
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-of-aspeed.c                 | 178 
+++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |   2 +-
 include/linux/mmc/sdhci-aspeed-data.h              |  28 ++++
 14 files changed, 548 insertions(+), 4 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/interrupt-controller/aspeed,aspeed-sdhci-ic.txt
 create mode 100644 
Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
 create mode 100644 drivers/irqchip/irq-aspeed-sdhci-ic.c
 create mode 100644 drivers/mmc/host/sdhci-of-aspeed.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
Signature · 6 lines
2.7.4



Attachments:
* signature.asc