aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sdhci
Commit message (Collapse)AuthorAgeFilesLines
* sdhci_pci(4): Remove incorrect __unusedMarius Strobl5 days1-13/+13
| | | | | | The slot parameter actually is used as index into the memory resource. Fixes: c11bbc7d
* sdhci: Try to complete the last transaction if dumpingJustin Hibbits2025-12-171-0/+12
| | | | | | | | | | If the kernel panics while a thread is in the middle of an SDHCI transaction, trying to dump to a dump target on the MMC would result in a hang. Fix this by completing the transaction first. Reviewed by: imp Obtained from: Hewlett Packard Enterprise Differential Revision: https://reviews.freebsd.org/D54255
* gpio_alloc_intr_resource: Pass rid by valueJohn Baldwin2025-12-091-1/+1
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53407
* sdhci: Add driver for the cvitek sdhci controllerBojan Novković2025-08-011-0/+144
| | | | | | | | This patch add support for cvitek SDHCI controller (only SD card mode). This controller is present on Milk-V's riscv SoCs. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D48528
* machine/stdarg.h -> sys/stdarg.hBrooks Davis2025-06-111-1/+1
| | | | | | | | | | | | | Switch to using sys/stdarg.h for va_list type and va_* builtins. Make an attempt to insert the include in a sensible place. Where style(9) was followed this is easy, where it was ignored, aim for the first block of sys/*.h headers and don't get too fussy or try to fix other style bugs. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
* sdhci: Use bus_topo_lock and taskqueue_bus for hotplug eventsJohn Baldwin2025-03-101-6/+10
| | | | | | | | Drop SDHCI_LOCK and instead acquire bus_topo_lock when adding and removing new-bus devices. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D49271
* sdhci: Fixes for sdhci_fdt_rockchip.cBojan Novković2025-02-161-7/+6
| | | | | | | | | | | This change fixes a couple of issues in the Rockchip SDHCI driver: - Fix a panic caused by sdhci_fdt_rockchip_attach not populating the softc's dev variable before initializing clocks - Fix a bug where sdhci_fdt_rockchip_set_clock fails to call sdhci_fdt_set_clock Fixes: e17e33f997d6 Reported by: Alonso Cárdenas Márquez (acardenas@bsd-peru.org)
* sdhci: Refactor the generic FDT driverBojan Novković2025-02-074-235/+502
| | | | | | | | | | This patch refactors the 'sdhci_fdt.c' driver by moving all vendor specific routines into separate files and making the base 'sdhci_fdt' driver subclassable. The goal is to make adding new FDT-based drivers easier and more maintainable. No functional change intended. Reviewed by: manu, imp Differential Revision: https://reviews.freebsd.org/D48527
* Use bus_detach_children instead of bus_generic_detachJohn Baldwin2025-01-022-2/+2
| | | | | | | These drivers perform additional teardown steps in between detaching child devices and deleting child devices. Differential Revision: https://reviews.freebsd.org/D47957
* sdhci: add missing bus_add_child DEVMETHOD.Bjoern A. Zeeb2024-12-201-0/+1
| | | | | | | | | | | Add the missing bus_add_child DEVMETHOD. This is needed for the RPi5 running with a MMCCAM kernel and the worproject/rpi5-uefi to avoid a kernel panic on boot when SDIO tries to attach to a 'Intel Bay Trail' controller. Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D48152
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-062-2/+3
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* Replace calls to bus_generic_probe with bus_identify_childrenJohn Baldwin2024-12-061-1/+1
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47674
* sdhci: Add sysctl to report quirks on the slotJustin Hibbits2024-09-261-0/+3
| | | | | | | | | Summary: It can be useful to see what quirks are applied on an SDHCI slot. Obtained from: Juniper Networks, Inc. Reviewed By: manu Differential Revision: https://reviews.freebsd.org/D46790
* sdhci: Match quirk_set/quirk_clear sysctls to typeJustin Hibbits2024-09-051-2/+2
| | | | | | | | | These quirk fields are u_int, so match the sysctl type to the actual types, and use SYSCTL_UINT. This provides room for setting bit 31 quirk as needed. Sponsored by: Juniper Networks, Inc. MFC after: 1 week
* sdhci(4): Stop checking for failures from malloc(M_WAITOK)Zhenlei Huang2024-09-031-2/+0
| | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852
* newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh2024-07-251-1/+1
| | | | Sponsored by: Netflix
* sdhci_fsl_fdt(4): Actually use modified SDHCI capabilitiesMarius Strobl2024-02-051-1/+1
| | | | | | | SDHCI_QUIRK_MISSING_CAPS needs to be set unconditionally so sdhci(4) adheres to the slot caps and caps2 set by sdhci_fsl_fdt(4). However, so far this bug didn't have an impact as the front-end only filters SDHCI_CAN_DO_SUSPEND, which in turn isn't used, yet.
* syscon: Move syscon code in dev/sysconEmmanuel Vadot2024-01-102-2/+2
| | | | | | | | | | | We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: mhorne Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43196
* phy: Move phy code in dev/phyEmmanuel Vadot2024-01-101-1/+1
| | | | | | | | | | | We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: emaste, imp Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43195
* regulator: Move regulator code in dev/regulatorEmmanuel Vadot2024-01-102-2/+2
| | | | | | | | | | | We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: emaste, imp Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43194
* clk: Move clock code in dev/clkEmmanuel Vadot2024-01-102-3/+3
| | | | | | | | | | | We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: mhorne Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43191
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-278-10/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sdhci: fdt: Correctly export clock per the bindingEmmanuel Vadot2023-09-181-57/+35
| | | | | | | | | | | | | The binding says that we can have one or two clocks to export. The first one is the actual sdclock while the second is the sample clock. Both have the same parent, clk_xin. Correctly export the clocks for RK3399 and ZynqMP. No need to use a high ID as before, we have our own clock domain so use ids starting at 1 as all exported clocks should be. Reviewed-by: bz Differential Revision: https://reviews.freebsd.org/D41810 Sponsored by: Beckhoff Automation GmbH & Co. KG
* sdhci: fdt: Always try to get the phy and the sysconEmmanuel Vadot2023-09-181-24/+51
| | | | | | | | | Per the bindings the phy and the syscon can always be present not just for RK3399. Reviewed-by: bz Differiential Revision: https://reviews.freebsd.org/D41809 Sponsored by: Beckhoff Automation GmbH & Co. KG
* sdhci: fdt: Always enable clock for ZynqMP and RK3399Emmanuel Vadot2023-09-181-20/+39
| | | | | | | | | Those two (in fact all of the supported one in this driver except RK3568) always needs the clocks to be enabled. Reviewed-by: bz Differential Revision: https://reviews.freebsd.org/D41808 Sponsored by: Beckhoff Automation GmbH & Co. KG
* sdhci: fdt: Remove sdhci_generic compatible stringEmmanuel Vadot2023-09-181-10/+5
| | | | | | | | This was used when we had our own DTS, it's not used anymore. Reviewed-by: bz Differential Revision: https://reviews.freebsd.org/D41807 Sponsored by: Beckhoff Automation GmbH & Co. KG
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1610-20/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-163-6/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* sdhci: Add support for disable-wpEmmanuel Vadot2023-08-101-0/+5
| | | | | | | Some platform needs it when the WP pin is broken. Sponsored by: Beckhoff Automation GmbH & Co. KG MFC after: 2 weeks
* sdhci: xilinx: Add compatible and quirks for ZynqMPEmmanuel Vadot2023-08-101-0/+5
| | | | | Sponsored by: Beckhoff Automation GmbH & Co. KG MFC after: 2 weeks
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-128-8/+8
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* mmc(4): Don't call bridge driver for timings not requiring tuningMarius Strobl2023-04-182-16/+7
| | | | | | | | | | | | The original idea behind calling into the bridge driver was to have the logic deciding whether tuning is actually required for a particular bus timing in a given slot as well as doing the sanity checking only on the controller layer which also generally is better suited for these due to say SDHCI_SDR50_NEEDS_TUNING. On another thought, not every such driver should need to check whether tuning is required at all, though, and not everything is SDHCI in the first place. Adjust sdhci{,_fsl_fdt}(4) accordingly, but keep sdhci_generic_tune() a bit cautious still.
* Add support for Rockchip RK3568 SDHCI controller.Søren Schmidt2022-12-243-0/+119
|
* Stop relying on header pollution in sdhci_xenon.cAndrew Turner2022-10-061-0/+1
| | | | | | | Include sys/malloc.h directly in sdhci_xenon.c to get the malloc(9) definition rather than depend on header pollution. Sponsored by: The FreeBSD Foundation
* sdhci(4): Fix a typo in asource code commentGordon Bergling2022-09-031-1/+1
| | | | | | - s/overriden/overridden/ MFC after: 3 days
* sdhci: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-067-24/+7
|
* sdhci_card_task: d is only used in the non-MMCCAM case.John Baldwin2022-04-131-1/+3
|
* Extend device_get_property APIKornel Duleba2022-03-101-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | In order to support various types of data stored in device tree properties or ACPI _DSD packages, create a new enum so the caller can specify the expected type of a property they want to read, according to the binding. The bus logic will use that information to process the underlying data. For example in DT all integer properties are stored in BE format. In order to get constant results across different platforms we need to convert its endianness to match the host. Another example are ACPI_TYPE_INTEGER properties stored as uint64_t. Before this patch the ACPI logic would refuse to read them if the provided buffer was smaller than 8 bytes. Now this can be handled by using DEVICE_PROP_UINT32 type. Modify the existing consumers of this API to reflect the changes and update the man pages accordingly. Reviewed by: mw Obtained from: Semihalf MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33457
* Revert "sdhci: extend bus_dma_tag boundary to 64-bit space"Marcin Wojtas2022-03-071-5/+4
| | | | | | | | | | | This reverts commit 7d8700bc291b4b3be1a592cae539f9e682592d9d. Reason for revert: the patch is incomplete. 64-bit operation is supported fully in SDHCI v4.0, v3.0 does it only for ADMA mode. This differentiation is missing and should be taken into consideration in case the reverted code is re-introduced. Reported by: mmel
* sdhci_fsl_fdt: Add voltage switching through sysconHubert Mazur2022-02-221-9/+90
| | | | | | | | | | | | Some SoCs does not have a fixed regulator to handle voltage switching automatically. Add support for voltage switching through syscon register when necessary. Add new errata flag indicating missing regulator. Apply errata to SoCs, which are known to be affected, i.e. LS1046 and LS1012. Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D34029
* sdhci_fsl_fdt: Apply errata for LX2160AHubert Mazur2022-02-221-3/+20
| | | | | | | | | | | | LX2160A is affected by two erratum regarding SDHCI. However this board has generic compat string in DTS for SDHCI which means erratum cannot be simply applied. Compare compat string from "/" path with LX2160A compat string when attaching device and apply erratum. Reviewed by: mmel, imp Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D34028
* sdhci_fsl_fdt: Fix tuning codeKornel Duleba2022-02-221-214/+209
| | | | | | | | | | | | | | | | | | | | - Some of the register writes were already done in the generic tuning code. Remove them. - Increase the polling timeout. The previous value is probably fine, but since timeouts are treated as fatal errors increasing it to 200ms won't hurt. - Rework the HS400 switching code. Make sure that the switch happens at the right time. Reset the DLL0 block. We need to do that if u-boot has previously configured the controller in HS400 mode. - Check current timing before tuning. The tuning devmethod is always called, even for timings that don't require the tuning procedure. - Rework software tuning routine code. Use inner formula for clock divider calculation, as previous one was incorrect. - Implement custom re-tune procedure. Co-authored-by: Hubert Mazur <hum@semihalf.com> Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D34027
* sdhci_fsl_fdt: Fix pulse width errata applicationKornel Duleba2022-02-221-10/+10
| | | | | | | | | | The errata has to be applied every time after SDHCI_RESET_ALL is done. Move it from attach to the custom reset routine. Reviewed by: wma, mmel Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D33981
* sdhci: Make ext_resources non-optionalEmmanuel Vadot2022-02-212-14/+0
| | | | | | | | EXT_RESOURCES have been introduced in 12-CURRENT and all supported releases have it enabled in their kernel config. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D33824
* sdhci: fix dumping support in MMCCAM configurationAndriy Gapon2022-01-261-7/+1
| | | | | | This change fixes interaction with recently added sddadump. MFC after: 1 week
* sdhci: plug set-but-not-unused varsMateusz Guzik2021-12-141-2/+0
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* sdhci_fsl_fdt: Add support for HS200/HS400 modesHubert Mazur2021-12-081-2/+534
| | | | | | | | | | | | | | | | | | | | The controller requires some custom logic to perform MMC tuning and to later switch to HS400 mode. Implement it supplying mmcbr_tune and sdhci_set_uhs_timing devmethods respectivly. Since the latter is called unconditionally when the ios is updated we need to keep track of the tuning state in sc and execute the HS400 switch logic only when required. Two HS200/HS400 related errata were implemented. 1. In HS400 modes the clock divisors are limited to 4, 8, 12. Apply it by falling back to the closes, higher divider when needed. 2. Hardware tuning procedure can sometimes fails. If that is the case fallback to the software tuning. Reviewed by: manu, mw Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D33320
* sdhci_fsl_fdt: Fix vccq reconfigurationArtur Rojek2021-12-081-14/+30
| | | | | | | | | | | | | | | | | | | As `vqmmc-supply` is an optional Device Tree property, don't skip vccq reconfiguration when the regulator is not specified. Instead, accept voltage specified by the `voltage-ranges` property. The actual voltage switch is done through a hw register in LS1028A. Add errata flag for other boards, as they are not supported. Return not supported error code when switching to 1.8V on affected platforms. Fixes: b08bf4c35ca ("sdhci_fsl_fdt: Skip vccq reconfiguration without regulator") Co-authored-by: Artur Rojek <ar@semihalf.com> Reviewed by: manu, mw Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D33319
* sdhci_fsl_fdt: Add LS1012A compat stringHubert Mazur2021-12-081-0/+7
| | | | | | | | | | Add compat string for LS1012A board and fill SoC specific structure data. Reviewed by: manu, mw Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D33318