clk_fixed: reduce and clarify messages due to missing clk-frequency

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
This commit is contained in:
Mike Karels 2023-08-25 15:11:46 -05:00
parent 7aec088cbc
commit b4ef09b9eb

View File

@ -157,6 +157,11 @@ clk_fixed_probe(device_t dev)
clk_type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
switch (clk_type) {
case CLK_TYPE_FIXED:
if (OF_hasprop(ofw_bus_get_node(dev), "clock-frequency") == 0) {
device_printf(dev,
"clock-fixed has no clock-frequency\n");
return (ENXIO);
}
device_set_desc(dev, "Fixed clock");
return (BUS_PROBE_DEFAULT);
case CLK_TYPE_FIXED_FACTOR: