aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/extres
Commit message (Collapse)AuthorAgeFilesLines
* syscon: Move syscon code in dev/sysconEmmanuel Vadot2024-01-106-996/+0
| | | | | | | | | | | 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-108-1197/+0
| | | | | | | | | | | 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-107-2276/+0
| | | | | | | | | | | 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
* nvmem: Move nvmem code in dev/nvmemEmmanuel Vadot2024-01-103-297/+0
| | | | | | | | | | | 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: dab, imp Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43193
* hwreset: Move reset code in dev/hwresetEmmanuel Vadot2024-01-104-472/+0
| | | | | | | | | | | 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: imp Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43192
* clk: Move clock code in dev/clkEmmanuel Vadot2024-01-1015-3344/+0
| | | | | | | | | | | 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-2712-12/+2
| | | | | | | | | | | | | | | | 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
* clk_fixed: reduce and clarify messages due to missing clk-frequencyMike Karels2023-08-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | The current dts for Raspberry 3B+ and 4B have 2 disabled fixed-clock nodes which have no clock-frequency value. Such nodes are non-standard. This results in about 150 messages during autoconfiguration: clk_fixed2: <Fixed clock> disabled on ofwbus0 clk_fixed2: Cannot FDT parameters. device_attach: clk_fixed2 attach returned 6 Defensively check for clock-frequency in the probe routine, and if none, return an error with a more direct error message (1 line per occurrence, 50 lines total): clk_fixed2: clock-fixed has no clock-frequency Based on a patch by manu. MFC after: 1 week Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D41594
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-169-9/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1615-31/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1615-30/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-125-5/+5
| | | | | | | | | 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
* extres/phy: Add mode setting function.Michal Meloun2023-01-033-9/+105
| | | | | | | | Modern multi-protocol phys are capable of supporting multiple different protocols. Add a method for mode (and/or its variants) setting. Discused with: ganbold, manu, andrew MFC after: 3 weeks
* Add support for an array of hwresetsAndrew Turner2022-12-212-0/+147
| | | | | | | | | | In some drivers we need to assert and deassert a group of hardware resets in any order. To support this add a new hwreset_array that manages all hwresets defined for a device. Reviewed by: bz, manu, mmel Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37357
* Revert "Enable setting the phy id."Ganbold Tsagaankhuu2022-12-192-8/+0
| | | | This reverts commit 6692670f58f9069e59bc0c958fdaefb9bea5f726.
* Enable setting the phy id.Søren Schmidt2022-12-192-0/+8
| | | | It is needed for the RK356X combo phy.
* Only include regdev_if.h when it's neededAndrew Turner2022-10-281-0/+2
| | | | | | We don't need to include regdev_if.h when not building for FDT. Sponsored by: Innovate UK
* Fix the includes in regulator_fixed.cAndrew Turner2022-10-281-1/+2
| | | | | | | Include sys/bus.h directly rather than depend on header pollution. While here fix the order of sys/systm.h. Sponsored by: Innovate UK
* Only include phydev_if.h when neededAndrew Turner2022-10-282-2/+2
| | | | | | | We only need to include phydev_if.h in phy.c when FDT is enabled and don't need it at all in phy_usb.c. Sponsored by: Innovate UK
* Include sys/systm.h in phy_usb.c for KASSERTAndrew Turner2022-10-281-0/+1
| | | | | | Rather than depending on header pollution include systm.h directly. Sponsored by: Innovate UK
* Allow clk_fixed.c to be built without FDTAndrew Turner2022-10-281-0/+4
| | | | | | | Include opt_platform.h to get the FDT definition and only include FDT headers when FDT is defined. Sponsored by: Innovate UK
* Remove unneeded headers from clk_link.cAndrew Turner2022-10-281-2/+0
| | | | | | | There is no OFW/FDT specific code in this file so the ofw headers can be removed. Sponsored by: Innovate UK
* Allow the extres regulator code to build without FDTAndrew Turner2022-10-272-1/+3
| | | | | | This allows drivers that use this to build in an ACPI only kernel. Sponsored by: The FreeBSD Foundation
* Include opt_platform.h to ensure FDT is definedAndrew Turner2022-10-041-0/+2
| | | | | | We need to include opt_platform.h as it's where FDT will be defined. Sponsored by: The FreeBSD Foundation
* Remove unneeded FDT checks from phydev and regdevAndrew Turner2022-10-042-11/+0
| | | | | | | They are only ever built when FDT is enabled so there is no need to check for it in the files. Sponsored by: The FreeBSD Foundation
* extres: regulator: fix the build without FDTKyle Evans2022-09-291-1/+1
| | | | | | | | | The regnode interface is currently only built for FDT, thus not applicable to ACPI-only kernels. Move the "regnode_if.h" include underneath a previously existing FDT cpp segment. Reviewed by: andrew, imp, manu Differential Revision: https://reviews.freebsd.org/D36790
* extres: syscon: pull in sys/malloc.h (fix !FDT)Kyle Evans2022-09-291-0/+1
| | | | | | | | | syscon currently includes sys/malloc.h via header pollution from dev/ofw/ofw_bus.h -> dev/ofw/openfirm.h. Fix the build without FDT defined by including sys/malloc.h directly. Reviewed by: andrew, imp, manu Differential Revision: https://reviews.freebsd.org/D36787
* extres drivers: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-096-17/+9
|
* clk: rename clknode_try_freq to clknode_test_freqAdrian Chadd2021-12-262-2/+2
| | | | This brings it in line with what the clk_*_freq routines are named.
* clk: add call for nodes to get the programmed/decided frequency passed backAdrian Chadd2021-12-262-6/+31
| | | | | | | | | | | | | | | | | | | | | Summary: The existing call can only really be used for a node wishing to configure its parent, but as we don't pass in a pointer to the freq, we can't set it to what it would be for a DRY_RUN pass. So for clock nodes that wish to try setting parent frequencies to see which would be the best for its own target frequency, we really do need a way to call in and pass in a flag /and/ a pointer to freq so it can be updated for us as the clock tree is recursed through. Reviewers: manu Approved by: manu Subscribers: imp Differential Revision: https://reviews.freebsd.org/D33445
* extres/clk: Add a method to detect the HW state of the clock gate.Michal Meloun2021-12-243-14/+63
| | | | | | | - add method to read gate enable/disable staust from HW - show gate status in sysctl clock dump MFC after: 1 week
* extres/clk: Improve sysctl dump of clocks.Michal Meloun2021-12-241-7/+19
| | | | | | | | Always recalculate the frequency, the cache is lazily initialized so it is not always up to date. While I'm in mark sysctl as MPSAFE. Discussed with: manu, adrian MFC after: 1 week
* Fix two typos in source code commentsGordon Bergling2021-10-161-1/+1
| | | | | | | - s/alocated/allocated/ - s/realocated/reallocated/ MFC after: 3 days
* extres: regulator: Fix regulator_status for already enable regulatorsEmmanuel Vadot2021-05-211-0/+4
| | | | | | | | | | If a regulator hasn't been enable by a driver but is enabled in hardware (most likely enabled by U-Boot), regulator_status will returns that it is enabled and so any call to regulator_disable will panic as it wasn't enabled by one of our drivers. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30293
* EXTRES: Ignore index modifier flags for table based clock dividers.Michal Meloun2020-12-271-22/+21
| | | | | | | The divider table already contains the correct HW divider value, it should not be modified by other flags such as 'CLK_DIV_ZERO_BASED'. MFC after: 4 weeks
* syscon: Add syscon_get_by_ofw_nodeEmmanuel Vadot2020-11-172-0/+16
| | | | | | | | This allow to get a syscon node defined under a specific fdt node (which isn't always the device one). Notes: svn path=/head/; revision=367767
* clk: fix indentationBjoern A. Zeeb2020-10-171-1/+1
| | | | | | | | | | Just fix indentation of an if() clause. No functional changes intended. MFC after: 3 days Notes: svn path=/head/; revision=366799
* Fix the inverted condition in mtx_asserts.Michal Meloun2020-10-011-3/+3
| | | | | | | | | | | Mutex should be owned in affected functions. Reborted by: emaste MFC after: 4 weeks MFC with: r366161 Notes: svn path=/head/; revision=366312
* Refine locking inside of syscon driver.Michal Meloun2020-09-253-31/+140
| | | | | | | | | | | | | In some cases, the syscon driver may be used by consumer requiring better control about locking (ie. it may be used as registe file provider for clock driver which needs locked access to multiple registers). Add fine locking protocol methods together with bunch of helper functions in syscon driver and implement this functionality in syscon_generic driver. MFC after: 4 weeks Notes: svn path=/head/; revision=366161
* Correctly handle nodes compatible with "syscon", "simple-bus".Michal Meloun2020-09-252-6/+22
| | | | | | | | | | | | | | | | Syscon can also have child nodes that share a registration file with it. To do this correctly, follow these steps: - subclass syscon from simplebus and expose it if the node is also "simple-bus" compatible. - block simplebus probe for this compatible string, so it's priority (bus pass) doesn't colide with syscon driver. While I'm in, also block "syscon", "simple-mfd" for the same reason. MFC after: 4 weeks Notes: svn path=/head/; revision=366156
* aw_clk_nm: fix incorrect use of abs()Andriy Gapon2020-09-071-0/+6
| | | | | | | | | | | | | | | abs() takes a (signed) int as input. Instead, it was used with unsigned 64-bit integers. So, add and use a new helper function to calculate a difference between two uint64_t-s. Reviewed by: manu MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26307 Notes: svn path=/head/; revision=365395
* Add syscon power and reset control device driverJessica Clarke2020-07-261-0/+198
| | | | | | | | | | | | | | | | | | | | This device driver supports both syscon-power and syscon-reset devices, as specified in [1] and [2]. These provide a very simple interface for power and reset control, and among other things are used by QEMU's virt machine on RISC-V. A separate commit will enable this on RISC-V, as that requires adding a RISC-V-specific riscv_syscon akin to r327936's aw_syscon. [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/power/reset/syscon-poweroff.txt [2] https://www.kernel.org/doc/Documentation/devicetree/bindings/power/reset/syscon-reboot.txt Reviewed by: brooks (mentor), jhb (mentor) Approved by: brooks (mentor), jhb (mentor) Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D25724 Notes: svn path=/head/; revision=363573
* Revert r363123.Michal Meloun2020-07-251-1/+1
| | | | | | | | | | | | | As Emanuel poited me the Linux processes these clock assignments in forward order, not in reversed. I misread the original code. Tha problem with wrong order for assigned clocks found in tegra (and some imx) DT should be reanalyzed and solved by different way. MFC with: r363123 Reported by; manu Notes: svn path=/head/; revision=363510
* Reverse the processing order of assigned clocks property.Michal Meloun2020-07-121-1/+1
| | | | | | | | | | | | Linux processes these clocks in reverse order and some DT relies on this fact. For example, the frequency setting for a given PLL is the last in the list, preceded by the frequency setting of its following divider or so... MFC after: 1 week Notes: svn path=/head/; revision=363123
* Assigned clocks: fix off-by-one bug, don't leak allocated memory.Michal Meloun2020-07-121-2/+4
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=363122
* extres/syscon_generic: Make device quiet if not in boot verboseEmmanuel Vadot2020-07-081-0/+3
| | | | | | | | | | | On some boards there is a lot of of syscon node that are unused as more specific drivers is probed before, no need to flood the console for the mostly-unused generic ones. MFC after: 1 week Notes: svn path=/head/; revision=363015
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-262-14/+15
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* regulator_fixed: Add a get_voltage methodEmmanuel Vadot2020-01-161-0/+16
| | | | | | | | | | | | | Some consumer cannot know the voltage of the regulator without it. While here, refuse to attach is min_voltage != max_voltage, it shouldn't happens anyway. Reviewed by: mmel MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D23003 Notes: svn path=/head/; revision=356803
* regulator: small enhancements to regulator_shutdownKyle Evans2020-01-121-7/+27
| | | | | | | | | | | | | | | | | | | | Highlights: - Exit early if we're not disabling unused regulators; there's no need to take the regulator topology lock and re-evaluate this every iteration, as it's not going to change. - Don't emit a notice that we're shutting down a regulator if it's not enabled, to reduce noise. - Mention the outcome of the shutdown, to aide debugging and easily let developer/user collect list of regulators we actually shutdown to determine problematic one. Reviewed by: manu MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D22213 Notes: svn path=/head/; revision=356649
* regulator: fix regnode_method_get_voltageEmmanuel Vadot2020-01-081-2/+3
| | | | | | | | | | | This method is supposed to write the voltage into uvolt and return an errno compatible value. Reviewed by: mmel Differential Revision: https://reviews.freebsd.org/D23006 Notes: svn path=/head/; revision=356487