Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
fsl_sdhci: ACPI attachment
Browse files Browse the repository at this point in the history
lx2160 recognizes the card, but "Controller timeout"

mmcsd0: 32GB <SDHC SB32G 8.0 SN DD1242F8 MFG 09/2017 by 3 SD> at mmc0 43.7MHz/4bit/65535-block

https://gist.github.com/agrajag9/f4e8186e4cea7da1e5d8887a8d74dd7a
  • Loading branch information
valpackett committed May 19, 2020
1 parent a2e2e3c commit 4abb606
Show file tree
Hide file tree
Showing 10 changed files with 533 additions and 282 deletions.
1 change: 1 addition & 0 deletions sys/arm/freescale/imx/files.imx5
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dev/ata/chipsets/ata-fsl.c optional imxata

# SDHCI/MMC
dev/sdhci/fsl_sdhci.c optional sdhci
dev/sdhci/fsl_sdhci_fdt.c optional sdhci

# USB OH3 controller (1 OTG, 3 EHCI)
arm/freescale/imx/imx_nop_usbphy.c optional ehci
Expand Down
1 change: 1 addition & 0 deletions sys/arm/freescale/imx/files.imx6
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ arm/freescale/imx/imx6_ipu.c optional vt
# Optional devices.
#
dev/sdhci/fsl_sdhci.c optional sdhci
dev/sdhci/fsl_sdhci_fdt.c optional sdhci

arm/freescale/imx/imx_wdog.c optional imxwdt

Expand Down
1 change: 1 addition & 0 deletions sys/arm64/conf/GENERIC
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ device nvd # expose NVMe namespaces as disks, depends on nvme
# MMC/SD/SDIO Card slot support
device sdhci
device sdhci_xenon # Marvell Xenon SD/MMC controller
device fsl_sdhci # Freescale eSDHC/uSDHC controller
device aw_mmc # Allwinner SD/MMC controller
device mmc # mmc/sd bus
device mmcsd # mmc/sd flash cards
Expand Down
1 change: 1 addition & 0 deletions sys/arm64/conf/NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ device nvd # expose NVMe namespaces as disks, depends on nvme

# MMC/SD/SDIO Card slot support
device sdhci_xenon # Marvell Xenon SD/MMC controller
device fsl_sdhci # Freescale eSDHC/uSDHC controller
device aw_mmc # Allwinner SD/MMC controller
device dwmmc
device dwmmc_altera
Expand Down
2 changes: 2 additions & 0 deletions sys/conf/files.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ dev/psci/psci.c standard
dev/psci/smccc_arm64.S standard
dev/psci/smccc.c standard
dev/sdhci/sdhci_xenon.c optional sdhci_xenon sdhci fdt
dev/sdhci/fsl_sdhci.c optional fsl_sdhci acpi
dev/sdhci/fsl_sdhci_acpi.c optional fsl_sdhci acpi
dev/uart/uart_cpu_arm64.c optional uart
dev/uart/uart_dev_mu.c optional uart uart_mu
dev/uart/uart_dev_pl011.c optional uart pl011
Expand Down
1 change: 1 addition & 0 deletions sys/conf/files.powerpc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ dev/quicc/quicc_bfe_fdt.c optional quicc mpc85xx
dev/random/darn.c optional powerpc64 !random_loadable
dev/scc/scc_bfe_macio.c optional scc powermac
dev/sdhci/fsl_sdhci.c optional mpc85xx sdhci
dev/sdhci/fsl_sdhci_fdt.c optional mpc85xx sdhci
dev/sec/sec.c optional sec mpc85xx
dev/sound/macio/aoa.c optional snd_davbus | snd_ai2s powermac
dev/sound/macio/davbus.c optional snd_davbus powermac
Expand Down

3 comments on commit 4abb606

@agrajag9
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you pull this out of your builds for any reason other than interrupts? If so, I think we can start testing this driver again.

@valpackett
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agrajag9 it's probably not the right way to go, this driver is ehhh :/

netbsd just has some little quirks in the main sdhci driver, that might be better. Also let's see where Semihalf's LS1046A work goes in terms of this.

@agrajag9
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you're right. I'm seeing in the DSDT:

            Name (_HID, "NXP0003")  // _HID: Hardware ID
            Name (_CID, "PNP0D40" /* SDA Standard Compliant SD Host Controller */)  // _CID: Compatible ID

A quick dig through their sources...

The _CID here: https://github.com/NetBSD/src/blob/62cc427439461ee2ed17fed0e4387d1d691ebde0/sys/external/bsd/acpica/dist/common/ahids.c#L203

A few defines here: https://github.com/NetBSD/src/blob/8c5437c0a8286cd843628f19da03672d963973ad/sys/dev/sdmmc/sdhcvar.h#L41

All mashed together: https://github.com/NetBSD/src/blob/f8904ef67c2808483f4f8a16e6e3a19c1dc2aad8/sys/dev/acpi/sdhc_acpi.c#L45

For the uSD and eMMC: https://github.com/NetBSD/src/blob/f8904ef67c2808483f4f8a16e6e3a19c1dc2aad8/sys/dev/acpi/sdhc_acpi.c#L92

And a few more here: https://github.com/NetBSD/src/blob/88684cc12fcd304844663f1fec92bd1c7ae7832f/sys/dev/sdmmc/sdhc.c#L303

That's much cleaner than a custom driver. If I'm not missing anything, I'll patch those in this weekend and see what happens.

Please sign in to comment.