aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fdt
Commit message (Collapse)AuthorAgeFilesLines
* dev/fdt: Use proper prototype for SYSINIT functionsZhenlei Huang2 days1-3/+3
| | | | | | | MFC after: 1 week (cherry picked from commit d82653aee7e357916403147dc21d342e6b543106) (cherry picked from commit d23e3b6e562faee8035f86f099e3319a167daa91)
* Check for errors when detaching children first, not lastJohn Baldwin2025-02-271-1/+6
| | | | | | | | | | | | | | These detach routines in these drivers all ended with 'return (bus_generic_detach())' meaning that if any child device failed to detach, the parent driver was left in a mostly destroyed state, but still marked attached. Instead, bus drivers should detach child drivers first and return errors before destroying driver state in the parent. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47387 (cherry picked from commit d412c07617eb35435668b024bc2cecda05f57f1f)
* simplebus: Implement bus_delete_resourceJohn Baldwin2025-02-271-0/+1
| | | | (cherry picked from commit e89d0785ff1332d234ae4382a849f3c23e23573a)
* simplebus: Map SYS_RES_IOPORT to SYS_RES_MEMORY later in alloc_resourceJohn Baldwin2025-02-271-3/+3
| | | | | | | | | Specifically, the set/get_resource methods do not currently remap resource types, so remap the type in alloc_resource only after looking for a matching resource list entry. Fixes: 3cf553288b96 simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORY (cherry picked from commit 4505c89242025f840023cdf092fdab845586f42d)
* simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORYJohn Baldwin2025-02-271-7/+83
| | | | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43442 (cherry picked from commit 3cf553288b968106e40882bb73b30da652614ba0)
* geom_flashmap: Rename the kernel moduleMark Johnston2024-11-051-1/+1
| | | | | | | | | | | | | | | | | | | Absent a linker.hints, if a module dependency exists on disk, the loader will automatically load it. That is, if something depends on module foo, and foo.ko exists, we'll load foo.ko even though the linker hints file is missing. It's a bit of a hack but it's handy. This breaks with geom_flashmap though, since it's geom_flashmap.ko on disk but the module is called g_flashmap. However, pretty much every other GEOM module is given a "geom_" prefix, so for consistency's sake alone, it seems nice to rename the module. PR: 274388 Reviewed by: jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47311 (cherry picked from commit 2352336ad9b26fd21d9b0013e195e41d6d02b914)
* simple_mfd: don't attach children twiceMitchell Horne2024-04-181-4/+1
| | | | | | | | | | | | | | | | | Trying to probe+attach the child device at the point it is added comes before the syscon handle is set up (if relevant). It will therefore be unavailable to the attach method which is expecting it, and the first attempt to attach the device will fail. Just rely on the call to bus_generic_attach() at the end of the function to perform probe+attach of dev's children. Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44268 (cherry picked from commit accda781531788a814bc438e1e96ef544c12aeaf)
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-165-9/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-169-18/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-126-6/+6
| | | | | | | | | 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
* ofw_cpu_early_foreach: Change callback to return bool instead of boolean_t.John Baldwin2023-05-041-1/+1
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D39926
* sys: Nuke double-semicolonsElliott Mitchell2022-11-021-1/+1
| | | | | | | | | A distinct number of double-semicolons have ended up in FreeBSD. Take a pass at getting rid of many of these harmless typos. Reviewed by: emaste, rrs Pull Request: https://github.com/freebsd/freebsd-src/pull/609 Differential Revision: https://reviews.freebsd.org/D31716
* ofw: add BUS_GET_DEVICE_PATH interface to openfirm/fdt, somewhat incomplete.Takanori Watanabe2022-10-181-0/+1
| | | | | | | | | | | This add BUS_GET_DEVICE_PATH interface, which shows device tree of openfirm/fdt. In qemu-system-arm64 with "virt" machine with device-tree firmware, % devctl getpath OFW cpu0 Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D37031
* device_get_property: add a HANDLE caseBjoern A. Zeeb2022-10-091-2/+17
| | | | | | | | | | This will resolve a reference and return the appropriate handle, a node on the simplebus or an ACPI_HANDLE for ACPI. For now we do not try to further abstract the return type. MFC after: 2 weeks Reviewed by: mw Differential Revision: https://reviews.freebsd.org/D36793
* fdt simple drivers: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-092-9/+5
|
* Extend device_get_property APIKornel Duleba2022-03-101-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* device: add device_get_property and device_has_propertyBartlomiej Grzesik2021-09-201-0/+16
| | | | | | | | | | | Generialize bus specific property accessors. Those functions allow driver code to access device specific information. Currently there is only support for FDT and ACPI buses. Reviewed by: manu, mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31597
* Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrightsEd Maste2021-08-083-3/+0
| | | | | | | These ones were unambiguous cases where the Foundation was the only listed copyright holder (in the associated license block). Sponsored by: The FreeBSD Foundation
* newbus: Move from bus_child_{pnpinfo,location}_src to ↵Warner Losh2021-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | bus_child_{pnpinfo,location} with sbuf Now that the upper layers all go through a layer to tie into these information functions that translates an sbuf into char * and len. The current interface suffers issues of what to do in cases of truncation, etc. Instead, migrate all these functions to using struct sbuf and these issues go away. The caller is also in charge of any memory allocation and/or expansion that's needed during this process. Create a bus_generic_child_{pnpinfo,location} and make it default. It just returns success. This is for those busses that have no information for these items. Migrate the now-empty routines to using this as appropriate. Document these new interfaces with man pages, and oversight from before. Reviewed by: jhb, bcr Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29937
* simple_mfd: switch to controllable locking for syscon provider.Michal Meloun2021-03-041-12/+28
| | | | MFC after 3 weeks
* Correctly handle nodes compatible with "syscon", "simple-bus".Michal Meloun2020-09-251-0/+10
| | | | | | | | | | | | | | | | 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
* Make simplebus friendlier for subclassing.Michal Meloun2020-09-252-2/+29
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=366146
* Allow child classes of simplebus to call attach directlyAndrew Turner2020-08-032-3/+8
| | | | | | | | | | | | | | | | Reduce code duplication when a bus is subclassed from simplebus by allowing them to call simplebus_attach directly. This is useful when the child bus will just implement the same calls. As not all children will expect to have a ranges property, e.g. the Raspberry Pi firmware, allow this property to be missing. Reviewed by: manu Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D25925 Notes: svn path=/head/; revision=363799
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-1/+2
| | | | | | | | | | | | | | | | | | | 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
* fdt_pinctrl: Add new methods for gpiosEmmanuel Vadot2020-01-161-0/+58
| | | | | | | | | | | | | | | | | | | | | Most of the gpio controller cannot configure or get the configuration of the pin muxing as it's usually handled in the pinctrl driver. But they can know what is the pinmuxing driver either because they are child of it or via the gpio-range property. Add some new methods to fdt_pinctrl that a pin controller can implement. Some methods are : fdt_pinctrl_is_gpio: Use to know if the pin in the gpio mode fdt_pinctrl_set_flags: Set the flags of the pin (pullup/pulldown etc ...) fdt_pinctrl_get_flags: Get the flags of the pin (pullup/pulldown etc ...) The defaults method returns EOPNOTSUPP. Reviewed by: ian, bcr (manpages) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D23093 Notes: svn path=/head/; revision=356806
* fdt_slicer: bump to SI_ORDER_THIRD following r347183Kyle Evans2019-09-291-4/+4
| | | | | | | | | | | | | | | | r347183 bumped GEOM classes to SI_ORDER_SECOND to resolve a race between them and the initialization of devsoftc.mtx in devinit, but missed this dependency on g_flashmap that may now lose the race against GEOM classes/g_init. There's a great comment that describes the situation that has also been updated with the new ordering of GEOM classes. Reported by: bdragon MFC after: 4 days Notes: svn path=/head/; revision=352863
* Fix bug introduced by r351184.Michal Meloun2019-08-181-1/+1
| | | | | | | | | | | We should check the returned handle, not the pointer to it. Noticed by: ian X-MFC with: r351184 MFC after: 1 week Notes: svn path=/head/; revision=351189
* Add method for getting of syscon handle from parent device.Michal Meloun2019-08-181-2/+17
| | | | | | | | | | | | If simple multifuction device also provides syscon interface, its childern should be able to consume it. Due to this: - declare coresponding method in syscon interface - implement it in simple multifunction device driver MFC after: 1 week Notes: svn path=/head/; revision=351184
* Revert r351129Emmanuel Vadot2019-08-171-1/+1
| | | | | | | | | | the point of syscon node is to avoid multiple device driver reading/writing to the same area. Reported by: ian Notes: svn path=/head/; revision=351177
* fdt: simple-mfd: Set the syscon memory to SHAREABLEEmmanuel Vadot2019-08-161-1/+1
| | | | | | | | | | Since syscon is usually used with another compatible string (and so another driver), this driver might want to map the memory too. MFC after: 1 week Notes: svn path=/head/; revision=351129
* Extend simple_mfd driver to expose a syscon interface ifGanbold Tsagaankhuu2019-07-022-3/+167
| | | | | | | | | | | | that node is also compatible with syscon. For instance, Rockchip RK3399's GRF (General Register Files) is compatible with simple-mfd as well as syscon and has devices like usb2-phy, emmc-phy and pcie-phy etc. under it. Reviewed by: manu Notes: svn path=/head/; revision=349596
* cpsw: use `phy-handle` in FDT to find PHY addressEd Maste2019-04-031-0/+3
| | | | | | | | | | | | | | | | | | | | In r337703 DTS files were updated to Linux 4.18, including Linux commit 4d8b032d3c03f4e9788a18bbb51b10e6c9e8a56b which removed the `phy_id` property from am335x-bone-common (as the property was deprecated). Use `phy-handle` via fdt_get_phyaddr, keeping the existing code as a fallback for old DTBs. PR: 236624 Submitted by: manu, Gerald Aryeetey <aryeeteygerald_rogers.com> Reported by: Gerald Aryeetey Reviewed by: manu MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19814 Notes: svn path=/head/; revision=345855
* fdt: Explicitly mark fdt_slicer as dependent on geom_flashmapJustin Hibbits2019-03-171-0/+1
| | | | | | | | | | Without this dependency relationship, the linker doesn't find the flash_register_slicer() function, so kldload fails to load fdt_slicer.ko. Discussed with: ian@ Notes: svn path=/head/; revision=345239
* Add support to fdt_slicer for the new style partition data documented inIan Lepore2019-02-271-21/+44
| | | | | | | | | | | | | | devicetree/bindings/mtd/partition.txt. In the old style, all the children of the device node which did not have a compatible property were the partitions. In the new style, there is a child node of the device which has a compatible string of "fixed-partitions", and its children are the individual partitions. Also, support the read-only property by setting the corresponding slice flag. Notes: svn path=/head/; revision=344616
* Child nodes with a compatible property are not slices, according to theIan Lepore2019-02-271-0/+4
| | | | | | | devicetree/bindings/mtd/partitions.txt document, so just ignore them. Notes: svn path=/head/; revision=344615
* Rename some functions and variables to have shorter names, which allowsIan Lepore2019-02-271-28/+18
| | | | | | | | | | unwrapping multiple lines of code. Also, convert some short multiline comments into single-line comments. Change old-school FALSE to false. All in all, no functional changes, it's just more compact and readable. Notes: svn path=/head/; revision=344614
* Make it possible to load fdt_slicer as a module (unloading works too fwiw).Ian Lepore2019-02-261-2/+30
| | | | Notes: svn path=/head/; revision=344609
* fdt: Add support for simple-mfd busEmmanuel Vadot2018-12-123-8/+179
| | | | | | | | | | | | | | Quoting the binding Documentation : "These devices comprise a nexus for heterogeneous hardware blocks containing more than one non-unique yet varying hardware functionality." Reviewed by: loos Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D17751 Notes: svn path=/head/; revision=342008
* fdt_pinctrl: Add some TSLOG annotationsEmmanuel Vadot2018-07-192-1/+21
| | | | | | | | While we see the time spent in the pin controller attach via the hooks in DEVICE_ATTACH, it is useful to see the time spent configuring the pins. Notes: svn path=/head/; revision=336479
* Increase the number of fdt memory regions we support to 16. Some SoCs haveAndrew Turner2018-05-291-1/+1
| | | | | | | | | | | many excluded regions causing a buffer overflow in the early boot code if this value is too small. Obtained from: ABT Systems Ltd Sponsored by: Turing Robotic Industries Notes: svn path=/head/; revision=334341
* Handle reserved memory with the no-map property.Andrew Turner2018-05-222-0/+42
| | | | | | | | | | | | | We shouldn't be mapping this memory, so we need to find it so it can be excluded from the phys_avail map. Reviewed by: manu Obtained from: ABT Systems Ltd Sponsored by: Turing Robotic Industries Differential Revision: https://reviews.freebsd.org/D15518 Notes: svn path=/head/; revision=334056
* Align OF_getencprop_alloc API with OF_getencprop and OF_getprop_allocOleksandr Tymoshenko2018-04-092-4/+4
| | | | | | | | | | | | | | | | | | | | | Change OF_getencprop_alloc semantics to be combination of malloc and OF_getencprop and return size of the property, not number of elements allocated. For the use cases where number of elements is preferred introduce OF_getencprop_alloc_multi helper function that copies semantics of OF_getencprop_alloc prior to this change. This is to make OF_getencprop_alloc and OF_getencprop_alloc_multi function signatures consistent with OF_getencprop_alloc and OF_getencprop_alloc_multi. Functionality-wise this patch is mostly rename of OF_getencprop_alloc to OF_getencprop_alloc_multi except two calls in ofw_bus_setup_iinfo where 1 was used as a block size. Notes: svn path=/head/; revision=332341
* Clean up OF_getprop_alloc APIOleksandr Tymoshenko2018-04-082-3/+3
| | | | | | | | | | | | | | | | | | | | OF_getprop_alloc takes element size argument and returns number of elements in the property. There are valid use cases for such behavior but mostly API consumers pass 1 as element size to get string properties. What API users would expect from OF_getprop_alloc is to be a combination of malloc + OF_getprop with the same semantic of return value. This patch modifies API signature to match these expectations. For the valid use cases with element size != 1 and to reduce modification scope new OF_getprop_alloc_multi function has been introduced that behaves the same way OF_getprop_alloc behaved prior to this patch. Reviewed by: ian, manu Differential Revision: https://reviews.freebsd.org/D14850 Notes: svn path=/head/; revision=332310
* Replace calls to fdt_is_compatible with ofw_bus_node_is_compatible. TheseAndrew Turner2018-04-081-44/+3
| | | | | | | | | are almost identical so there is no need to keep the former around. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=332309
* Revert r332277, it contained an unintended extra changeAndrew Turner2018-04-081-2/+75
| | | | Notes: svn path=/head/; revision=332278
* Replace calls to fdt_is_compatible with ofw_bus_node_is_compatible. TheseAndrew Turner2018-04-081-75/+2
| | | | | | | | | are almost identical so there is no need to keep the former around. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=332277
* Move fdt_is_type to be a Marvell specific function. It's not used by anyAndrew Turner2018-04-082-20/+0
| | | | | | | | | other SoCs. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=332274
* Remove fdt_pm_is_enabled as it's Marvell specific. Replace the only call toAndrew Turner2018-04-042-15/+0
| | | | | | | | | it with a call to the helper function fdt_pm_is_enabled would call. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=332026
* Remove fdt_is_enabled, fdt_reg_to_rl, and fdt_get_unit. These are not usedAndrew Turner2018-04-032-89/+0
| | | | | | | | | by anything in the tree. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=331925