| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
While here do not attempt to disable regulators if they are meant
to be always on.
Reviewed by: mmel
Approved by: re (kib)
Notes:
svn path=/head/; revision=338457
|
| |
|
|
|
|
|
|
|
| |
We didn't allowed a divider register value of 0 which can exists and
also didn't wrote the value but the divider, which result of a wrong
frequency to be selected
Notes:
svn path=/head/; revision=337346
|
| |
|
|
|
|
|
|
|
|
|
| |
The nvmem interface helps provider of nvmem data to expose themselves to consumer.
NVMEM is generally present on some embedded board in a form of eeprom or fuses.
The nvmem api are helpers for consumer to read/write the cell data from a provider.
Differential Revision: https://reviews.freebsd.org/D16419
Notes:
svn path=/head/; revision=336996
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For most regulators, the regulator_stop() method can be transformed to
regulator disable. But, in some cases, we needs to maintain shared data
across multiple regulators (e.g. single GPIO pin which works as enable
for multiple regulates). In this case, the implementation of regulator
should perform his own enable counting therefore it is necessary to
distinguish between the regulator enable/disable method (which
increments/decrements enable counter for shared resource) and regulator
stop method (which don't affect it).
So:
- add regnode_stop() method to regulator framework and default it to
regnode_enable(..., false, ...)
- implement it in regulator_fixed with proper enable counting.
While I'm in, also fix handling of always_on property. If any of regulators
sharing same GPIO pin have it enabled, then none of them can disable regulator.
Tested by: kevans
MFC after: 3 weeks
Notes:
svn path=/head/; revision=335249
|
| |
|
|
|
|
|
|
|
|
|
|
| |
These are represented as booleans on the kernel-side, but were being exposed
as int. This was causing some funky things to happen when read later with
sysctl(8), e.g. randomly reading super-high when the value was actually
'0'/false.
Reviewed by: manu
Notes:
svn path=/head/; revision=335220
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This was the wrong solution to the problem; regulator_shutdown invokes
regnode_stop. regulator_stop is not a refcounting method, but it invokes
regnode_enable, which is.
mmel@ has a proposed patch/solution to instead provide regnode_fixed_stop
behavior that properly takes shared GPIO pins into account.
Notes:
svn path=/head/; revision=335195
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
regnode::enable_cnt is generally used to refcount regulator nodes. For
GPIOs, the refcount was done on the gpio_entry since more than one regulator
can share a GPIO.
GPIO regulators were not taking part in the node refcount, since they had
their own mechanism. This caused some fallout after manu started disabling
everybody's unused regulators in r331989.
Refcount it.
Glanced over by: manu
Notes:
svn path=/head/; revision=335173
|
| |
|
|
|
|
|
| |
Submitted by: Jose Luis Duran (github pull #151)
Notes:
svn path=/head/; revision=334386
|
| |
|
|
|
|
|
|
| |
See r333391 for more detail; in summary: it holds no weight and may be
removed.
Notes:
svn path=/head/; revision=333418
|
| |
|
|
|
|
|
|
| |
A frequency of value 0 mean that we don't want to change the frequency so
skip it.
Notes:
svn path=/head/; revision=333320
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The properties 'assigned-clocks', 'assigned-clock-parents' and
'assigned-clock-rates' all work together.
'assigned-clocks' holds the list of clock for which we need to either
assign a new parent or a new frequency.
The old code just supported assigning a new parents, add support for
assigning a new frequency too.
Notes:
svn path=/head/; revision=333318
|
| |
|
|
|
|
|
|
| |
This is more consistant with hw.regulator and other hardware related
sysctls.
Notes:
svn path=/head/; revision=333047
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When disabling regulator when they are unused, check before is they are
enabled.
While here don't check the enable_cnt on the regulator entry as it is
checked by regnode_stop.
This solve the panic on any board using a fixed regulator that is driven
by a gpio when the regulator is unused.
Tested On: OrangePi One
Pointy Hat to: myself
Reported by: kevans, Milan Obuch (freebsd-arm@dino.sk)
Notes:
svn path=/head/; revision=332843
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bootloaders such as u-boot might enable regulators, or simply regulators could
be enabled by default by the PMIC, even if we don't have a driver for
the device or subsystem.
Disable unused regulators just before going to userland.
A tunable hw.regulator.disable_unused is added to not disable them in case
this causes problems on some board but the default behavior is to disable
everything unused.
I prefer to break thinks now and fix them rather than never switch to the
case were we disable regulators.
Tested on : Pine64-LTS (an idle board goes from ~0.33A to ~0.27A)
Tested on : BananaPi M2
Differential Revision: https://reviews.freebsd.org/D14781
Notes:
svn path=/head/; revision=331989
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For each regulators create an hw.regulator.<regname>. :
uvolt: Current value
always_on: 1 If the reg is always on
boot_on: 1 If the reg is set at boot time
enable_cnt: Number of consumer(s)
enable_delay: Delay before enabling the regulator
ramp_delay: The Ramp delay
max_uamp: The maximum value of the regulator in uAmps
min_uamp: The minimal value of the regulator in uAmps
max_uvolt: The maximum value of the regulator in uVolts
min_uvolt: The minimal value of the regulator in uVolts
Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D14578
Notes:
svn path=/head/; revision=330758
|
| |
|
|
|
|
|
| |
MFC after: 2 weeks
Notes:
svn path=/head/; revision=330074
|
| |
|
|
|
|
|
| |
MFC after: 2 weeks
Notes:
svn path=/head/; revision=328586
|
| |
|
|
|
|
|
| |
commit log.
Notes:
svn path=/head/; revision=328585
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
index c6a1f466ceb..c3708a0ce27 100644
--- a/sys/dev/extres/clk/clk.c
+++ b/sys/dev/extres/clk/clk.c
@@ -642,10 +642,11 @@ clknode_adjust_parent(struct clknode *clknode, int idx)
if (clknode->parent_cnt == 0)
return;
if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt))
- panic("Invalid clock parent index\n");
+ panic("%s: Invalid parent index %d for clock %s",
+ __func__, idx, clknode->name);
if (clknode->parents[idx] == NULL)
- panic("%s: Attempt to set invalid parent %d for clock %s",
+ panic("%s: Invalid parent index %d for clock %s",
__func__, idx, clknode->name);
/* Remove me from old children list. */
@@ -674,8 +675,8 @@ clknode_init_parent_idx(struct clknode *clknode, int idx)
if ((idx == CLKNODE_IDX_NONE) ||
(idx >= clknode->parent_cnt) ||
(clknode->parent_names[idx] == NULL))
- panic("%s: Invalid clock parent index: %d\n", __func__, idx);
-
+ panic("%s: Invalid parent index %d for clock %s",
+ __func__, idx, clknode->name);
clknode->parent_idx = idx;
}
Notes:
svn path=/head/; revision=328511
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Similarly as other extres pseudo-drivers, implement phy by using kobj model.
This detaches it from provider device, so single device driver can export
multiple different phys. Additionally, this allows phy to be subclassed to
more specialized drivers, like is USB OTG phy, or PCIe phy with hot-plug
capability.
Tested by: manu (previous version, on Allwinner board)
MFC after: 1 month
Notes:
svn path=/head/; revision=328201
|
| |
|
|
|
|
|
|
|
|
|
| |
During set_freq a clknode might have reparent (using a better parent that
have a higher frequency for example), before refreshing the cache, re-get
the parent frequency.
Reviewed by: mmel
Notes:
svn path=/head/; revision=328198
|
| |
|
|
| |
Notes:
svn path=/head/; revision=327938
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Attaching syscon_generic earlier than BUS_PASS_DEFAULT makes it more
difficult for specific syscon drivers to attach to the syscon node and to
get ordering right. Further discussion yielded the following set of
decisions:
- Move syscon_generic to BUS_PASS_DEFAULT
- If a platform needs a syscon with different attach order or probe
behavior, it should subclass syscon_generic and match on the SoC specific
compat string
- When we come across a need for a syscon that attaches earlier but only
specifies compatible = "syscon", we should create a syscon_exclusive driver
that provides generic access but probes earlier and only matches if "syscon"
is the only compatible. Such fdt nodes do exist in the wild right now, but
we don't really use them at the moment.
Additionally:
- Any syscon provider that has needs any more complex than a spinlock solely
for syscon access and a single memory resource should subclass syscon
directly rather than attempting to subclass syscon_generic or add complexity
to it. syscon_generic's attach/detach methods may be made public should the
need arise to subclass it with additional attach/detach behavior.
We introduce aw_syscon(4) that just subclasses syscon_generic but probes
earlier to meet our requirements for if_awg and implements #2 above for this
specific situation. It currently only matches a64/a83t/h3 since these are
the only platforms that really need it at the time being.
Discussed with: ian
Reviewed by: manu, andrew, bcr (manpages, content unchanged since review)
Differential Revision: https://reviews.freebsd.org/D13793
Notes:
svn path=/head/; revision=327936
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
ian@ pointed out that BUS_PASS_DEFAULT + $anything is bogus, given that
BUS_PASS_DEFAULT is defined as __INT_MAX. Instead, we take a page out of
imx6_usbphy's book and use BUS_PASS_DEFAULT - 1000 to achieve the desired
effect of syscon_generic attaching before if_awg and other potential
consumers, but late enough that more specialized implementations should have
no problem attaching instead.
Reported by: ian
Notes:
svn path=/head/; revision=327665
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It still needs to be before if_awg at least in order to be available for
other operations, but it should not be attaching before interrupt
controllers at the very least.
This should make errors involving syscon register space colliding with other
devices a little more innocent, but these conflicts should really be tracked
down and resolved. One such conflict is with the Raspberry Pi 3 local
interrupt controller, noticed by tuexen@
Reported by: tuexen
Notes:
svn path=/head/; revision=327621
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
r327106 introduced kobj to syscon so it can be subclassed and fit in with
the rest of the syscon framework. The diff for syscon.c was misapplied in a
clean tree prior to commit, so bring it back to what was included in the
review and tested. The entire file has basically been rewritten from what
was present prior to the kobj work.
Pointy hat to: me
Notes:
svn path=/head/; revision=327215
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This reduces noise when kernel is compiled by newer GCC versions,
such as one used by external toolchain ports.
Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial)
Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c)
Differential Revision: https://reviews.freebsd.org/D10385
Notes:
svn path=/head/; revision=327173
|
| |
|
|
|
|
|
|
|
| |
This should help reduce confusion between syscon/syscons a little bit.
syscon is a resource generally modeled by FDT platforms, and not to be
confused with syscons.
Notes:
svn path=/head/; revision=327107
|
| |
|
|
|
|
|
|
|
| |
fail when building with -Werror.
Sponsored by: DARPA, AFRL
Notes:
svn path=/head/; revision=322697
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
all the clocks that they provide.
Each clocks are exported under the node 'clock.<clkname>' and have the following
children nodes :
- frequency
- parent (The selected parent, if any)
- parents (The list of parents, if any)
- childrens (The list of childrens, if any)
- enable_cnt (The enabled counter)
This give us the possibility to examine clocks at runtime and make graph of
the clock flow.
Reviewed by: mmel
MFC after: 2 month
Differential Revision: https://reviews.freebsd.org/D9833
Notes:
svn path=/head/; revision=314699
|
| |
|
|
|
|
|
| |
Reviewed by: mmel
Notes:
svn path=/head/; revision=314119
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Some clocks on SoC have a diff between the value written in the register
and the real divider.
Add a table that where we can lookup the real value of the divider.
Reviewed by: mmel (earlier revision)
Differential Revision: https://reviews.freebsd.org/D8728
Notes:
svn path=/head/; revision=309894
|
| |
|
|
|
|
|
|
|
|
|
| |
- The clk_test_freq() (aka CLK_SET_DRYRUN) doesn't change frequency,
don't cache it result.
- Fix busy condition for clk_set_freq().
MFC after: 3 weeks
Notes:
svn path=/head/; revision=309537
|
| |
|
|
|
|
|
| |
MFC after: 2 weeks
Notes:
svn path=/head/; revision=308440
|
| |
|
|
|
|
|
|
|
|
|
| |
assigned-clock-parents are DT properties used to configure
some default parent clocks on one node.
Reviewed by: mmel
MFC after: 2 weeks
Notes:
svn path=/head/; revision=308298
|
| |
|
|
|
|
|
|
|
| |
common file. They can be useful for other PMICs.
MFC after: 2 weeks
Notes:
svn path=/head/; revision=307558
|
| |
|
|
|
|
|
|
|
|
|
| |
In some cases, the driver must handle given properties located in
specific OF subnode. Instead of creating duplicate set of function, add
'node' as argument to existing functions, defaulting it to device OF node.
MFC after: 3 weeks
Notes:
svn path=/head/; revision=302528
|
| |
|
|
|
|
|
|
|
|
| |
operates on a specific OF node instead of the pass in device's OF node.
Reviewed by: andrew, mmel
Differential Revision: https://reviews.freebsd.org/D6957
Notes:
svn path=/head/; revision=302523
|
| |
|
|
|
|
|
|
| |
fact that the caller is requesting exclusive use of the pin, and also to
better match the inverse operation which is named gpiobus_release_pin().
Notes:
svn path=/head/; revision=300750
|
| |
|
|
|
|
|
| |
Reviewed by: mmel@
Notes:
svn path=/head/; revision=299714
|
| |
|
|
|
|
|
| |
through uintmax_t.
Notes:
svn path=/head/; revision=297550
|
| |
|
|
|
|
|
|
|
| |
Reviewed by: mmel, adrian (mentor)
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D5750
Notes:
svn path=/head/; revision=297350
|
| |
|
|
|
|
|
| |
Reviewed by: mmel
Notes:
svn path=/head/; revision=297328
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Use a different device description for fixed and fixed factor clocks.
- Fix a bug where the "clock-div" property was stored in the "mult" field
of the clock definition.
- Get the fixed factor parent clock by index instead of by name, as a
clock-names property is not required to be present here.
Reviewed by: mmel, adrian (mentor)
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D5703
Notes:
svn path=/head/; revision=297215
|
| |
|
|
|
|
|
|
|
|
|
|
| |
clock-indices property is present, so change the "uint32_t *indices" parameter
to "uint32_t **indices" to allow this.
Reviewed by: mmel, adrian (mentor)
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D5702
Notes:
svn path=/head/; revision=297214
|
| |
|
|
|
|
|
|
|
|
|
| |
platform specific drivers a chance to override the generic driver.
Reviewed by: mmel, adrian (mentor)
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D5701
Notes:
svn path=/head/; revision=297213
|
| |
|
|
|
|
|
|
|
|
| |
support frameworks (i.e. clk/regulators/tsensors/fuses...).
It provides simple unified consumers interface for manipulations with
phy (USB/SATA/PCIe) resources.
Notes:
svn path=/head/; revision=296907
|
| |
|
|
|
|
|
|
|
|
|
| |
support frameworks(i.e. clk/reset/phy/tsensors/fuses...).
The framework is still far from perfect and probably doesn't have stable
interface yet, but we want to start testing it on more real boards and
different architectures.
Notes:
svn path=/head/; revision=296906
|