Module Name: src Committed By: dyoung Date: Thu May 9 01:33:13 UTC 2024
Modified Files: src/sys/dev/acpi: sdhc_acpi.c src/sys/dev/sdmmc: sdhc.c sdhcvar.h Log Message: If the ACPI flag "non-removable" is present and true for an SD/MMC slot, then set a new flag on that slot to indicate that the media is non-removable. Make sdhc_card_detect always return true for a slot if its non-removable media flag is set. This change lets the kernel automatically configure the permanently-installed MMC slot on the NXP LX2160-based HoneyComb LX2 board. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/acpi/sdhc_acpi.c cvs rdiff -u -r1.118 -r1.119 src/sys/dev/sdmmc/sdhc.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sdmmc/sdhcvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/acpi/sdhc_acpi.c diff -u src/sys/dev/acpi/sdhc_acpi.c:1.20 src/sys/dev/acpi/sdhc_acpi.c:1.21 --- src/sys/dev/acpi/sdhc_acpi.c:1.20 Sun Feb 6 15:52:20 2022 +++ src/sys/dev/acpi/sdhc_acpi.c Thu May 9 01:33:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc_acpi.c,v 1.20 2022/02/06 15:52:20 jmcneill Exp $ */ +/* $NetBSD: sdhc_acpi.c,v 1.21 2024/05/09 01:33:12 dyoung Exp $ */ /* * Copyright (c) 2016 Kimihiro Nonaka <non...@netbsd.org> @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.20 2022/02/06 15:52:20 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.21 2024/05/09 01:33:12 dyoung Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -166,6 +166,7 @@ sdhc_acpi_attach(device_t parent, device ACPI_INTEGER clock_freq; ACPI_INTEGER caps, caps_mask; ACPI_INTEGER funcs; + bool non_removable; sc->sc.sc_dev = self; sc->sc.sc_dmat = aa->aa_dmat; @@ -234,6 +235,11 @@ sdhc_acpi_attach(device_t parent, device /* Enable DMA transfer */ sc->sc.sc_flags |= SDHC_FLAG_USE_DMA; + rv = acpi_dsd_bool(aa->aa_node->ad_handle, "non-removable", + &non_removable); + if (ACPI_SUCCESS(rv) && non_removable) + sc->sc.sc_flags |= SDHC_FLAG_NON_REMOVABLE; + /* Read clock frequency from device properties */ rv = acpi_dsd_integer(aa->aa_node->ad_handle, "clock-frequency", &clock_freq); Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.118 src/sys/dev/sdmmc/sdhc.c:1.119 --- src/sys/dev/sdmmc/sdhc.c:1.118 Sat Jan 20 00:22:11 2024 +++ src/sys/dev/sdmmc/sdhc.c Thu May 9 01:33:13 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.118 2024/01/20 00:22:11 jmcneill Exp $ */ +/* $NetBSD: sdhc.c,v 1.119 2024/05/09 01:33:13 dyoung Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.118 2024/01/20 00:22:11 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.119 2024/05/09 01:33:13 dyoung Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -897,6 +897,9 @@ sdhc_card_detect(sdmmc_chipset_handle_t struct sdhc_host *hp = (struct sdhc_host *)sch; int r; + if (ISSET(hp->sc->sc_flags, SDHC_FLAG_NON_REMOVABLE)) + return 1; + if (hp->sc->sc_vendor_card_detect) return (*hp->sc->sc_vendor_card_detect)(hp->sc); Index: src/sys/dev/sdmmc/sdhcvar.h diff -u src/sys/dev/sdmmc/sdhcvar.h:1.34 src/sys/dev/sdmmc/sdhcvar.h:1.35 --- src/sys/dev/sdmmc/sdhcvar.h:1.34 Sat Jan 20 00:22:11 2024 +++ src/sys/dev/sdmmc/sdhcvar.h Thu May 9 01:33:13 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhcvar.h,v 1.34 2024/01/20 00:22:11 jmcneill Exp $ */ +/* $NetBSD: sdhcvar.h,v 1.35 2024/05/09 01:33:13 dyoung Exp $ */ /* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */ /* @@ -52,6 +52,10 @@ struct sdhc_softc { #define SDHC_FLAG_NO_HS_BIT 0x00002000 /* Don't set SDHC_HIGH_SPEED bit */ #define SDHC_FLAG_EXTERNAL_DMA 0x00004000 #define SDHC_FLAG_EXTDMA_DMAEN 0x00008000 /* ext. dma need SDHC_DMA_ENABLE */ +#define SDHC_FLAG_NON_REMOVABLE \ + 0x00010000 /* slot has no card detect, behave + * as if a card is always present + */ #define SDHC_FLAG_NO_CLKBASE 0x00020000 /* ignore clkbase register */ #define SDHC_FLAG_SINGLE_POWER_WRITE 0x00040000 #define SDHC_FLAG_NO_TIMEOUT 0x00080000 /* ignore timeout interrupts */