aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/extres
Commit message (Collapse)AuthorAgeFilesLines
* clk_fixed: call clkdom_dump() for verbose bootMitchell Horne2024-04-181-3/+4
| | | | | | | | | | | | | | | This is standard practice for clock drivers that register clocks dynamically. Nothing else uses the CLK_DEBUG macro. The result is that the name and frequency of the fixed clock is printed for a verbose boot, which may aid in debugging. Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44265 (cherry picked from commit 6e66bb9fc3d026765113fa1258cd12292da9309a)
* clk_fixed: quiet by defaultMitchell Horne2024-04-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We may attach several of these devices, but there is no meaningful information added to dmesg. For example: ofwbus0: <Open Firmware Device Tree> clk_fixed0: <Fixed clock> on ofwbus0 clk_fixed1: <Fixed clock> on ofwbus0 clk_fixed2: <Fixed clock> on ofwbus0 clk_fixed3: <Fixed clock> on ofwbus0 clk_fixed4: <Fixed clock> on ofwbus0 clk_fixed5: <Fixed clock> on ofwbus0 clk_fixed6: <Fixed clock> on ofwbus0 clk_fixed7: <Fixed clock> on ofwbus0 clk_fixed8: <Fixed clock> on ofwbus0 clk_fixed9: <Fixed clock> on ofwbus0 clk_fixed10: <Fixed clock> on ofwbus0 clk_fixed11: <Fixed clock> on ofwbus0 To reduce this noise, quiet the devices for by default. For verbose boot, the message will be emitted. Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44266 (cherry picked from commit 1cb9f6f6413e9d242de47e730ec7d4ce3e5688fe)
* clkdom_dump(): improve output textMitchell Horne2024-04-181-4/+14
| | | | | | | | | | | | | | | | If the call to clknode_get_freq() returns an error (unlikely), report this, rather than printing the error code as the clock frequency. If the clock has no parent (e.g. a fixed reference clock), print "none" rather than "(NULL)(-1)". This is a more human-legible presentation of the same information. Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44267 (cherry picked from commit 08635c51d1e34f8a3e42c7cf35dc7264a5b68118)
* syscon_power: do reboot after shutdown_panic is executedAndriy Gapon2024-03-161-1/+3
| | | | | | | | | | A syscon_power instance can handle either poweroff or reboot, but not both. If the instance handles reboot then set its priority to be after shutdown_panic. This is to provide uniform experience with other platforms. (cherry picked from commit 5f7312a0d70c607afa9ce24ccd757321d043e02c)
* clk_fixed: reduce and clarify messages due to missing clk-frequencyMike Karels2023-09-211-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. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D41594 (cherry picked from commit b4ef09b9eb117d622bb274448e5cffcae0ba3488)
* 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-23/+22
| | | | | | | 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
* Implement support for (soft)linked clocks.Michal Meloun2019-11-084-10/+255
| | | | | | | | | | | This kind of clock nodes represent temporary placeholder for clocks defined later in boot process. Also, these are necessary to break circular dependencies occasionally occurring in complex clock graphs. MFC after: 3 weeks Notes: svn path=/head/; revision=354554
* regulator: Add regulator_check_voltage functionEmmanuel Vadot2019-11-064-0/+42
| | | | | | | | | | | | | | This function will call the regnode_check_voltage method for a given regulator and check if the desired voltage in reachable by it. Also adds a default method that check the std_param and which should be enough for most regulators and add it as the method for axp* rk805 and fixed regulators. Reviewed by: mmel MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22260 Notes: svn path=/head/; revision=354396
* regulator: Add a regnode_set_constraint functionEmmanuel Vadot2019-10-232-0/+70
| | | | | | | | | | | | | | | | | | | This method check that boot_on or always_on is set to 1 and if it is it will try to enable the regulator. The binding docs aren't clear on what to do but Linux enable the regulator if any of those properties is set so we want to do the same. The function first check the status to see if the regulator is already enabled it then get the voltage to check if it is in a acceptable range and then enables it. This will be either called from the regnode_init method (if it's needed by the platform) or by a SYSINIT at SI_SUB_LAST Reviewed by: mmel MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22106 Notes: svn path=/head/; revision=353919