Skip to contentSkip to conversation

drivers/mmc/host: Add Aspeed SDIO driver

PATCH Superseded Ryan Chen 3 participants 18 messages Jul 11, 2018 – Jul 18, 2018

Subsystems (8)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ryan Chen

author
#0 lore raw

cover drivers/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.

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
author
#1 lore raw

PATCH 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
#2 lore raw

Re: [PATCH linux dev-4.17 1/7] clk: Aspeed: Modify clk-aspeed.c driver probe sequence

Quoted 17 lines · Ryan Chen

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 +0 -0
index 8796b8a..9e55743 100644
@@ -573,7 +573,12 @@ static struct platform_driver aspeed_clk_driver = {
 		.suppress_bind_attrs = true,
 	},
 };

drivers/clk/clk-aspeed.c static struct platform_driver aspeed_clk_driver = { · line 584

Quoted 10 lines
drivers/clk/clk-aspeed.c +6 -1
-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)
 {

It's generally considered dangerous to register drivers at core initcall time.

Any reason we don't use the generic clock driver registration mechanism that runs at of_clk_init() time ?

Cheers,
Ben.

author
#3 lore raw

Re: [PATCH linux dev-4.17 1/7] clk: Aspeed: Modify clk-aspeed.c driver probe sequence

Quoted 26 lines · Benjamin Herrenschmidt
Quoted 25 lines · Ryan Chen

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);
 
Quoted 5 lines

drivers/clk/clk-aspeed.c static struct platform_driver aspeed_clk_driver = { · line 584

Quoted 2 lines
drivers/clk/clk-aspeed.c +0 -0
 static void __init aspeed_ast2400_cc(struct regmap *map)
 {

It's generally considered dangerous to register drivers at core initcall time.

Understand.

But if interrupt controller have clk gating.
the scu driver should be eraly than irq chip driver probe. Is this point is reasonable?

Quoted 3 lines

Any reason we don't use the generic clock driver registration mechanism that runs at of_clk_init() time ?

I will use "if (gate->reset_idx == aspeed_resets[ASPEED_RESET_SDHCI])", is it suitable ?

Ryan Chen

Quoted 4 lines

Cheers,
Ben.

#4 lore raw

Re: [PATCH linux dev-4.17 1/7] clk: Aspeed: Modify clk-aspeed.c driver probe sequence

Quoted 33 lines · Ryan Chen
Quoted 26 lines · Benjamin Herrenschmidt
Quoted 25 lines · Ryan Chen

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);
 
Quoted 5 lines

drivers/clk/clk-aspeed.c static struct platform_driver aspeed_clk_driver = { · line 584

Quoted 2 lines
drivers/clk/clk-aspeed.c +0 -0
 static void __init aspeed_ast2400_cc(struct regmap *map)
 {

It's generally considered dangerous to register drivers at core initcall time.

Quoted 5 lines

Understand.

But if interrupt controller have clk gating.
the scu driver should be eraly than irq chip driver probe. Is this point is reasonable?

I'm not sure I understand what you are trying to solve other than making sure the clock driver is loaded before everything else. Joel, do we have a way to ensure that ? I noticed all other clock drivers use that macro to be initialized at of_clk_init, any reason we don't ?

Quoted 7 lines
Quoted 4 lines

Any reason we don't use the generic clock driver registration mechanism that runs at of_clk_init() time ?

I will use "if (gate->reset_idx == aspeed_resets[ASPEED_RESET_SDHCI])", is it suitable ?

I'm on holiday, I don't have the code at hand to check. Joel ? What do you reckon ?

Quoted 7 lines

Ryan Chen

Quoted 4 lines

Cheers,
Ben.

maintainer
#5 lore raw

Re: [PATCH linux dev-4.17 1/7] clk: Aspeed: Modify clk-aspeed.c driver probe sequence

Quoted 46 lines · Benjamin Herrenschmidt
Quoted 33 lines · Ryan Chen
Quoted 26 lines · Benjamin Herrenschmidt
Quoted 25 lines · Ryan Chen

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);
 
Quoted 5 lines

drivers/clk/clk-aspeed.c static struct platform_driver aspeed_clk_driver = { · line 584

Quoted 2 lines
drivers/clk/clk-aspeed.c +0 -0
 static void __init aspeed_ast2400_cc(struct regmap *map)
 {

It's generally considered dangerous to register drivers at core initcall time.

Quoted 5 lines

Understand.

But if interrupt controller have clk gating.
the scu driver should be eraly than irq chip driver probe. Is this point is reasonable?

I'm not sure I understand what you are trying to solve other than making sure the clock driver is loaded before everything else. Joel, do we have a way to ensure that ? I noticed all other clock drivers use that macro to be initialized at of_clk_init, any reason we don't ?

Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Any reason we don't use the generic clock driver registration mechanism that runs at of_clk_init() time ?

I will use "if (gate->reset_idx == aspeed_resets[ASPEED_RESET_SDHCI])", is it suitable ?

I'm on holiday, I don't have the code at hand to check. Joel ? What do you reckon ?

We don't need to do this. I mentioned this in my review; we have the reset added to the clk driver already. With this, reset can be released via the normal reset controller call in the sdhci driver.

author
#6 lore raw

Re: [PATCH linux dev-4.17 1/7] clk: Aspeed: Modify clk-aspeed.c driver probe sequence

Quoted 54 lines · Joel Stanley
Quoted 52 lines · Benjamin Herrenschmidt
Quoted 33 lines · Ryan Chen
Quoted 26 lines · Benjamin Herrenschmidt
Quoted 25 lines · Ryan Chen

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);
 
Quoted 5 lines

drivers/clk/clk-aspeed.c static struct platform_driver aspeed_clk_driver = { · line 584

Quoted 2 lines
drivers/clk/clk-aspeed.c +0 -0
 static void __init aspeed_ast2400_cc(struct regmap *map)
 {

It's generally considered dangerous to register drivers at core initcall time.

Quoted 5 lines

Understand.

But if interrupt controller have clk gating.
the scu driver should be eraly than irq chip driver probe. Is this point is reasonable?

I'm not sure I understand what you are trying to solve other than making sure the clock driver is loaded before everything else. Joel, do we have a way to ensure that ? I noticed all other clock drivers use that macro to be initialized at of_clk_init, any reason we don't ?

Quoted 7 lines
Quoted 4 lines

Any reason we don't use the generic clock driver registration mechanism that runs at of_clk_init() time ?

I will use "if (gate->reset_idx == aspeed_resets[ASPEED_RESET_SDHCI])", is it suitable ?

Quoted 6 lines
Quoted 2 lines

I'm on holiday, I don't have the code at hand to check. Joel ? What do you reckon ?

We don't need to do this. I mentioned this in my review; we have the reset added to the clk driver already. With this, reset can be released via the normal reset controller call in the sdhci driver.

In my new patch will use following in aspeed_clk_enable function
.....

	- Put in reset
	- enable sd clk
	/* 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);
	}
	- Out of reset

.....
Do you think is it suitable, Joel?

author
#7 lore raw

PATCH 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.

---
 drivers/clk/clk-aspeed.c                 | 8 +++++++-
 include/dt-bindings/clock/aspeed-clock.h | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/clk/clk-aspeed.c +7 -1
index 9e55743..cd1f3b2 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
@@ -260,6 +261,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 == 16) {
+		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);
@@ -317,7 +323,7 @@ static const u8 aspeed_resets[] = {
 	[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.
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
maintainer
#8 lore raw

Re: [PATCH linux dev-4.17 2/7] clk: Aspeed: Add sdhci reset and clock

Quoted 24 lines · 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.

---
 drivers/clk/clk-aspeed.c                 | 8 +++++++-
 include/dt-bindings/clock/aspeed-clock.h | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/clk/clk-aspeed.c +1 -0
index 9e55743..cd1f3b2 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

drivers/clk/clk-aspeed.c static int aspeed_clk_enable(struct clk_hw *hw) · line 266

Quoted 6 lines
drivers/clk/clk-aspeed.c +3 -0
@@ -260,6 +261,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 == 16) {
+               regmap_update_bits(gate->map, ASPEED_CLK_SELECTION, ASPEED_SDIO_CLK_EN, ASPEED_SDIO_CLK_EN);

We do not special case individual clocks. The reset should instead be added to the aspeed_gates structure above.

In fact, it already is:

        [ASPEED_CLK_GATE_SDCLKCLK] =    { 27, 16, "sdclk-gate",

NULL, 0 }, /* SDIO/SD */

Although in that table it is 16, and you specify bit 15. The data sheet I have says SD/SDIO is bit 16.

Quoted 28 lines
drivers/clk/clk-aspeed.c +3 -1
+       }
+
        if (gate->reset_idx >= 0) {
                /* A delay of 10ms is specified by the ASPEED docs */
                mdelay(10);
@@ -317,7 +323,7 @@ static const u8 aspeed_resets[] = {
        [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.
include/dt-bindings/clock/aspeed-clock.h +1 -2
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
--

2.7.4

#9 lore raw

Re: [PATCH linux dev-4.17 2/7] clk: Aspeed: Add sdhci reset and clock

In reply to Ryan Chen
Quoted 4 lines · 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.

You should expose this as two different clocks instead of putting a hack inside aspeed_clk_enable().

Quoted 50 lines
---
 drivers/clk/clk-aspeed.c                 | 8 +++++++-
 include/dt-bindings/clock/aspeed-clock.h | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/clk/clk-aspeed.c +7 -1
index 9e55743..cd1f3b2 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
@@ -260,6 +261,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 == 16) {
+		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);
@@ -317,7 +323,7 @@ static const u8 aspeed_resets[] = {
 	[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.
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
author
#10 lore raw

PATCH 3/7 irqchip: Aspeed: Add Aspeed sdhci irq 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. so it need a sdhci irq driver probe defore sdhci driver probe

---
 drivers/irqchip/Makefile              |   2 +-
 drivers/irqchip/irq-aspeed-sdhci-ic.c | 147 ++++++++++++++++++++++++++++++++++
 include/linux/mmc/sdhci-aspeed-data.h |  28 +++++++
 3 files changed, 176 insertions(+), 1 deletion(-)
 create mode 100644 drivers/irqchip/irq-aspeed-sdhci-ic.c
 create mode 100644 include/linux/mmc/sdhci-aspeed-data.h
drivers/irqchip/Makefile +1 -1
index 5ed465a..579c4fb 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 irq-aspeed-sdhci-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/irqchip/irq-aspeed-sdhci-ic.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
maintainer
#11 lore raw

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

Quoted 3 lines · Ryan Chen

In Aspeed SoC's sdhci have two slots and have a interrupt status and general information in top for register. so it need a sdhci irq driver probe defore sdhci driver probe

I suggest we keep the irq handing within in the sdhci driver instead of creating a separate sdhci irqchip driver.

author
#12 lore raw

PATCH 4/7 dts: Aspeed: Add Aspeed sdhci dts document

In reply to Ryan Chen

This add Aspeed sdhci irq driver's dts file and devicetree document

---
 .../aspeed,aspeed-sdhci-ic.txt                     | 25 ++++++++++++++++++++++
 arch/arm/boot/dts/aspeed-g4.dtsi                   | 20 +++++++++++++++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   | 20 +++++++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/aspeed,aspeed-sdhci-ic.txt
Documentation/devicetree/bindings/interrupt-controller/aspeed,aspeed-sdhci-ic.txt new file +25 -0
new file mode 100644
index 0000000..e3393c3
@@ -0,0 +1,25 @@
+Device tree configuration for the SDHCI Interrupt Controller on the AST24XX and
+AST25XX SoCs.
+
+Required Properties:
+- #address-cells	: should be 1
+- #size-cells 		: should be 1
+- #interrupt-cells 	: should be 1
+- compatible 		: should be "aspeed,aspeed-sdhci-ic"
+- reg			: address start and range of controller
+- interrupts		: interrupt number
+- interrupt-controller	: denotes that the controller receives and fires
+			  new interrupts for child busses
+
+Example:
+
+sdhci_ic: interrupt-controller@0 {
+	#interrupt-cells = <1>;
+	#size-cells = <1>;
+	#interrupt-cells = <1>;
+	compatible = "aspeed,aspeed-sdhci-irq";
+	reg = <0x0 0x100>;
+	interrupts = <26>;
+	interrupt-controller;
+	clocks = <&syscon ASPEED_CLK_GATE_SDCLKCLK>;
+};
\ No newline at end of file
arch/arm/boot/dts/aspeed-g4.dtsi +20 -0
index e86fa80..7ad646d 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,19 @@
 	};
 };
 
+&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>;
+	};
+
+};
+
 &i2c {
 	i2c_ic: interrupt-controller@0 {
 		#interrupt-cells = <1>;
arch/arm/boot/dts/aspeed-g5.dtsi +20 -0
index d92f047..ba850ca 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,19 @@
 	};
 };
 
+&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>;
+	};
+
+};
+
 &i2c {
 	i2c_ic: interrupt-controller@0 {
 		#interrupt-cells = <1>;
Signature · 1 line
2.7.4
maintainer
#13 lore raw

Re: [PATCH linux dev-4.17 4/7] dts: Aspeed: Add Aspeed sdhci dts document

Quoted 1 line · Ryan Chen

This add Aspeed sdhci irq driver's dts file and devicetree document

The bindings document (Documentation/devicetree) should be a separate patch to the device tree changes (arch/arm/boot/dts). The bindings will be merged with the code, while the device tree changes are merged by the architecture maintainer.

Quoted 120 lines
---
 .../aspeed,aspeed-sdhci-ic.txt                     | 25 ++++++++++++++++++++++
 arch/arm/boot/dts/aspeed-g4.dtsi                   | 20 +++++++++++++++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   | 20 +++++++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/aspeed,aspeed-sdhci-ic.txt
Documentation/devicetree/bindings/interrupt-controller/aspeed,aspeed-sdhci-ic.txt new file +25 -0
new file mode 100644
index 0000000..e3393c3
@@ -0,0 +1,25 @@
+Device tree configuration for the SDHCI Interrupt Controller on the AST24XX and
+AST25XX SoCs.
+
+Required Properties:
+- #address-cells       : should be 1
+- #size-cells          : should be 1
+- #interrupt-cells     : should be 1
+- compatible           : should be "aspeed,aspeed-sdhci-ic"
+- reg                  : address start and range of controller
+- interrupts           : interrupt number
+- interrupt-controller : denotes that the controller receives and fires
+                         new interrupts for child busses
+
+Example:
+
+sdhci_ic: interrupt-controller@0 {
+       #interrupt-cells = <1>;
+       #size-cells = <1>;
+       #interrupt-cells = <1>;
+       compatible = "aspeed,aspeed-sdhci-irq";
+       reg = <0x0 0x100>;
+       interrupts = <26>;
+       interrupt-controller;
+       clocks = <&syscon ASPEED_CLK_GATE_SDCLKCLK>;
+};
\ No newline at end of file
arch/arm/boot/dts/aspeed-g4.dtsi +20 -0
index e86fa80..7ad646d 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,19 @@
        };
 };
 
+&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>;
+       };
+
+};
+
 &i2c {
        i2c_ic: interrupt-controller@0 {
                #interrupt-cells = <1>;
arch/arm/boot/dts/aspeed-g5.dtsi +20 -1
index d92f047..ba850ca 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,19 @@
        };
 };
 
+&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>;
+       };
+
+};
+
 &i2c {
        i2c_ic: interrupt-controller@0 {
                #interrupt-cells = <1>;
--

2.7.4

author
#14 lore raw

PATCH 5/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          |   1 +
 drivers/mmc/host/sdhci-of-aspeed.c | 178 +++++++++++++++++++++++++++++++++++++
 3 files changed, 191 insertions(+)
 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 -0
index 6aead24..084193b 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)	+= 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
maintainer
#15 lore raw

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

Quoted 1 line · Ryan Chen

Add a driver for Aspeed's sdhci controller core.

This looks good. You should add some more description of the sdhci core. eg. it supports two slots, the different modes it supports, etc.

Quoted 50 lines
---
 drivers/mmc/host/Kconfig           |  12 +++
 drivers/mmc/host/Makefile          |   1 +
 drivers/mmc/host/sdhci-of-aspeed.c | 178 +++++++++++++++++++++++++++++++++++++
 3 files changed, 191 insertions(+)
 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 -0
index 6aead24..084193b 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)      += 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 +0 -0
new file mode 100644
index 0000000..8e609e1

drivers/mmc/host/sdhci-of-aspeed.c line 1

Quoted 1 line
drivers/mmc/host/sdhci-of-aspeed.c new file +1 -0
@@ -0,0 +1,178 @@
+// SPDX-License-Identifier: GPL-2.0

This text here replaces the text below.

You can have your headers look something like:

// SPDX-License-Identifier: GPL-2.0
// Copyright (C) Some Company Ltd

Some people chose to omit it, but you can also have:

// Author's name <email>

Quoted 180 lines
drivers/mmc/host/sdhci-of-aspeed.c new file +177 -1
+/*
+ * ASPEED Secure Digital Host Controller Interface.
+ * 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/dma-mapping.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/mmc/host.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/mmc/sdhci-aspeed-data.h>
+#include <linux/reset.h>
+#include "sdhci-pltfm.h"
+
+static void sdhci_aspeed_set_clock(struct sdhci_host *host, unsigned int clock)
+{
+       int div;
+       u16 clk;
+       unsigned long timeout;
+
+       if (clock == host->clock)
+               return;
+
+       sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
+
+       if (clock == 0)
+               goto out;
+
+       for (div = 1; div < 256; div *= 2) {
+               if ((host->max_clk / div) <= clock)
+                       break;
+       }
+       div >>= 1;
+
+       clk = div << SDHCI_DIVIDER_SHIFT;
+       clk |= SDHCI_CLOCK_INT_EN;
+       sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
+
+       /* Wait max 20 ms */
+       timeout = 20;
+       while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
+                & SDHCI_CLOCK_INT_STABLE)) {
+               if (timeout == 0) {
+                       pr_err("%s: Internal clock never stabilised.\n",
+                              mmc_hostname(host->mmc));
+                       return;
+               }
+               timeout--;
+               mdelay(1);
+       }
+
+       clk |= SDHCI_CLOCK_CARD_EN;
+       sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
+
+out:
+       host->clock = clock;
+}
+
+static void sdhci_aspeed_set_bus_width(struct sdhci_host *host, int width)
+{
+       struct sdhci_pltfm_host *pltfm_priv = sdhci_priv(host);
+       struct aspeed_sdhci_irq *sdhci_irq = sdhci_pltfm_priv(pltfm_priv);
+
+       u8 ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
+
+       if (sdhci_irq->regs) {
+               if (width == MMC_BUS_WIDTH_8)
+                       aspeed_sdhci_set_8bit_mode(sdhci_irq, 1);
+               else
+                       aspeed_sdhci_set_8bit_mode(sdhci_irq, 0);
+       }
+       if (width == MMC_BUS_WIDTH_4)
+               ctrl |= SDHCI_CTRL_4BITBUS;
+       else
+               ctrl &= ~SDHCI_CTRL_4BITBUS;
+
+       sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
+
+}
+
+static struct sdhci_ops  sdhci_aspeed_ops = {
+       .set_clock = sdhci_aspeed_set_clock,
+       .get_max_clock = sdhci_pltfm_clk_get_max_clock,
+       .set_bus_width = sdhci_aspeed_set_bus_width,
+       .get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
+       .reset = sdhci_reset,
+       .set_uhs_signaling = sdhci_set_uhs_signaling,
+};
+
+static struct sdhci_pltfm_data sdhci_aspeed_pdata = {
+       .ops = &sdhci_aspeed_ops,
+       .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+       .quirks2 = SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN,
+};
+
+static int sdhci_aspeed_probe(struct platform_device *pdev)
+{
+       struct sdhci_host *host;
+       struct device_node *pnode;
+       struct device_node *np = pdev->dev.of_node;
+       struct sdhci_pltfm_host *pltfm_host;
+       struct aspeed_sdhci_irq *sdhci_irq;
+
+       int ret;
+
+       host = sdhci_pltfm_init(pdev, &sdhci_aspeed_pdata, sizeof(struct aspeed_sdhci_irq));
+       if (IS_ERR(host))
+               return PTR_ERR(host);
+
+       pltfm_host = sdhci_priv(host);
+       sdhci_irq = sdhci_pltfm_priv(pltfm_host);
+
+       sdhci_get_of_property(pdev);
+
+       pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
+
+       pnode = of_parse_phandle(np, "interrupt-parent", 0);
+       if (pnode)
+               memcpy(sdhci_irq, pnode->data, sizeof(struct aspeed_sdhci_irq));
+
+       ret = mmc_of_parse(host->mmc);
+       if (ret)
+               goto err_sdhci_add;
+
+       ret = sdhci_add_host(host);
+       if (ret)
+               goto err_sdhci_add;
+
+       return 0;
+
+err_sdhci_add:
+       sdhci_pltfm_free(pdev);
+       return ret;
+}
+
+static int sdhci_aspeed_remove(struct platform_device *pdev)
+{
+       struct sdhci_host       *host = platform_get_drvdata(pdev);
+       int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
+
+       sdhci_remove_host(host, dead);
+       sdhci_pltfm_free(pdev);
+       return 0;
+}
+
+static const struct of_device_id sdhci_aspeed_of_match[] = {
+       { .compatible = "aspeed,sdhci-ast2400", .data = &sdhci_aspeed_pdata },
+       { .compatible = "aspeed,sdhci-ast2500", .data = &sdhci_aspeed_pdata },
+       {}
+};
+
+MODULE_DEVICE_TABLE(of, sdhci_aspeed_of_match);
+
+static struct platform_driver sdhci_aspeed_driver = {
+       .driver         = {
+               .name   = "sdhci-aspeed",
+               .pm     = &sdhci_pltfm_pmops,
+               .of_match_table = sdhci_aspeed_of_match,
+       },
+       .probe          = sdhci_aspeed_probe,
+       .remove         = sdhci_aspeed_remove,
+};
+
+module_platform_driver(sdhci_aspeed_driver);
+
+MODULE_DESCRIPTION("Driver for the ASPEED SDHCI Controller");
+MODULE_AUTHOR("Ryan Chen <[email protected]>");
+MODULE_LICENSE("GPL v2");
--

2.7.4

author
#16 lore raw

PATCH 6/7 dts: Aspeed: Add devicetree for Aspeed sdhci

In reply to Ryan Chen

Add devicetree for Aspeed's sdhci

---
 .../bindings/mmc/aspeed,aspeed-sdhci.txt           | 42 ++++++++++++++++++++++
 arch/arm/boot/dts/aspeed-ast2500-evb.dts           | 14 ++++++++
 arch/arm/boot/dts/aspeed-g4.dtsi                   | 20 +++++++++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   | 20 +++++++++++
 4 files changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt
Documentation/devicetree/bindings/mmc/aspeed,aspeed-sdhci.txt new file +42 -0
new file mode 100644
index 0000000..c7cb985
@@ -0,0 +1,42 @@
+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
+
+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>;
+		clock-names = "sdclk", "sd_extclk";
+	};
+
+	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>;
+	};
+};
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 +20 -0
index 7ad646d..f4a8d7d 100644
@@ -387,6 +387,26 @@
 		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 {
arch/arm/boot/dts/aspeed-g5.dtsi +20 -0
index ba850ca..effe631 100644
@@ -464,6 +464,26 @@
 		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 {
Signature · 1 line
2.7.4
author
#17 lore raw

PATCH 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