[PATCH linux dev-4.17 3/7] mmc: Aspeed: Add Aspeed sdhci core driver
Benjamin Herrenschmidt
benh at kernel.crashing.org
Fri Jul 27 08:37:44 AEST 2018
On Thu, 2018-07-26 at 17:10 +0800, Ryan Chen wrote:
> 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 at 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 at 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 at 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";
> };
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.
> };
>
>
>
> > > +MODULE_DEVICE_TABLE(of, irq_aspeed_sdhci_dt_ids);
> > > +
> > > +static struct platform_driver irq_aspeed_sdhci_device_driver = {
> > > + .probe = irq_aspeed_sdhci_probe,
> > > + .driver = {
> > > + .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.
> >
> > > +
> > > +MODULE_AUTHOR("Ryan Chen");
> > > +MODULE_DESCRIPTION("ASPEED SOC SDHCI IRQ Driver");
> > > +MODULE_LICENSE("GPL v2");
> > > diff --git a/include/linux/mmc/sdhci-aspeed-data.h b/include/linux/mmc/sdhci-aspeed-data.h
> > > new file mode 100644
> > > index 0000000..fba2bf2
> > > --- /dev/null
> > > +++ b/include/linux/mmc/sdhci-aspeed-data.h
> > > @@ -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
More information about the openbmc
mailing list