clk: Aspeed: Modify clk-aspeed.c driver probe sequence
Subsystems (8)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/7 clk: Aspeed: Modify clk-aspeed.c driver probe sequence
From: Ryan Chen <[email protected]>
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
@@ -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
PATCH 2/7 clk: Aspeed: Add sdhci reset and clock
In reply to a message not in the archiveFrom: Ryan Chen <[email protected]>
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
@@ -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
@@ -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
PATCH 3/7 irqchip: Aspeed: Add Aspeed sdhci irq driver
In reply to a message not in the archiveFrom: Ryan Chen <[email protected]>
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
@@ -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
@@ -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
PATCH 4/7 dts: Aspeed: Add Aspeed sdhci dts document
In reply to a message not in the archiveFrom: Ryan Chen <[email protected]>
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
@@ -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_SDCLK>; +};
arch/arm/boot/dts/aspeed-g4.dtsi +20 -0
@@ -191,6 +191,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;
@@ -406,6 +413,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_SDCLK>; + }; + +}; + &i2c { i2c_ic: interrupt-controller@0 { #interrupt-cells = <1>;
arch/arm/boot/dts/aspeed-g5.dtsi +20 -0
@@ -257,6 +257,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;
@@ -510,6 +517,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_SDCLK>; + }; + +}; + &i2c { i2c_ic: interrupt-controller@0 { #interrupt-cells = <1>;
Signature · 1 line
2.7.4
PATCH 5/7 mmc: Aspeed: Add driver for Aspeed sdhci
In reply to a message not in the archiveFrom: Ryan Chen <[email protected]>
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
@@ -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
@@ -80,6 +80,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
PATCH 6/7 dts: Aspeed: Add devicetree for Aspeed sdhci
In reply to a message not in the archiveFrom: Ryan Chen <[email protected]>
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
@@ -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_SDCLK>; + 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
@@ -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
@@ -424,6 +424,26 @@ clocks = <&syscon ASPEED_CLK_GATE_SDCLK>; }; + 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
@@ -528,6 +528,26 @@ clocks = <&syscon ASPEED_CLK_GATE_SDCLK>; }; + 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
PATCH 7/7 configs: Aspeed: enable mmc host in defconfig
In reply to a message not in the archiveFrom: Ryan Chen <[email protected]>
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
@@ -213,6 +213,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