mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
ARM: SoC drivers for 6.3
As usual, there are lots of minor driver changes across SoC platforms from NXP, Amlogic, AMD Zynq, Mediatek, Qualcomm, Apple and Samsung. These usually add support for additional chip variations in existing drivers, but also add features or bugfixes. The SCMI firmware subsystem gains a unified raw userspace interface through debugfs, which can be used for validation purposes. Newly added drivers include: - New power management drivers for StarFive JH7110, Allwinner D1 and Renesas RZ/V2M - A driver for Qualcomm battery and power supply status - A SoC device driver for identifying Nuvoton WPCM450 chips - A regulator coupler driver for Mediatek MT81xxv -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmPtSN8ACgkQmmx57+YA GNkOSw/+JS5tElm/ZP7c3uWYp6uwvcb0jUlKW/U3aCtPiPEcYDLEqIEXwcNdaDMh m4rW3GYlW0IRL3FsyuYkSLx+EIIUIfs40wldYXJOqRDj0XasndiloIwltOQJGfd9 C/UVM0FpJdxMJrcBMFgwLLQCIbAVnhHP34i6ppDRgxW/MfTeiCaaG6fnS70iv6mC oh2N7FoZSKDtTrFtlR5TqFiK5v/W1CgNJVuglkFB0ceFpjyBpp/8AT0FGS887xCz IYSTqm4Q/79vaZXI1Y2oog257cgdwsVqgPrnK5CuSFhTnAcJMCekiFelHq8Yhyuk Rw7j/B3KO3AOaxmR75c6SZdeZ+VHgUMRC/RKe3fay0sm3Zea2kAIPXA6Zn+r/cxb 8M94V59qBz+f8XmpXRTK1UR3s3EbwFIuNyuDIkeorMtpSKtvqJXmZxGDwNIfXr2F /voo++MKjzdtdxdW/D/5Tc9DC0Pyb4HLi0EYj2QCzA03njmfLDF1w73NfzMec+GD R1zAd3FEbiJQx8Hin0PSPjYXpfMnkjkGAEcE9N9Ralg4ewNWAxfOFsAhHKTZNssL pitTAvHR/+dXtvkX7FUi2l/6fqn8nJUrg/xRazPPp3scRbpuk8m6P4MNr3/lsaHk HTQ/hYwDdecWLvKXjw5y9yIr3yhLmPPcloTVIIFFjsM0t8b+d9E= =p6Xp -----END PGP SIGNATURE----- Merge tag 'soc-drivers-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc Pull ARM SoC driver updates from Arnd Bergmann: "As usual, there are lots of minor driver changes across SoC platforms from NXP, Amlogic, AMD Zynq, Mediatek, Qualcomm, Apple and Samsung. These usually add support for additional chip variations in existing drivers, but also add features or bugfixes. The SCMI firmware subsystem gains a unified raw userspace interface through debugfs, which can be used for validation purposes. Newly added drivers include: - New power management drivers for StarFive JH7110, Allwinner D1 and Renesas RZ/V2M - A driver for Qualcomm battery and power supply status - A SoC device driver for identifying Nuvoton WPCM450 chips - A regulator coupler driver for Mediatek MT81xxv" * tag 'soc-drivers-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (165 commits) power: supply: Introduce Qualcomm PMIC GLINK power supply soc: apple: rtkit: Do not copy the reg state structure to the stack soc: sunxi: SUN20I_PPU should depend on PM memory: renesas-rpc-if: Remove redundant division of dummy soc: qcom: socinfo: Add IDs for IPQ5332 and its variant dt-bindings: arm: qcom,ids: Add IDs for IPQ5332 and its variant dt-bindings: power: qcom,rpmpd: add RPMH_REGULATOR_LEVEL_LOW_SVS_L1 firmware: qcom_scm: Move qcom_scm.h to include/linux/firmware/qcom/ MAINTAINERS: Update qcom CPR maintainer entry dt-bindings: firmware: document Qualcomm SM8550 SCM dt-bindings: firmware: qcom,scm: add qcom,scm-sa8775p compatible soc: qcom: socinfo: Add Soc IDs for IPQ8064 and variants dt-bindings: arm: qcom,ids: Add Soc IDs for IPQ8064 and variants soc: qcom: socinfo: Add support for new field in revision 17 soc: qcom: smd-rpm: Add IPQ9574 compatible soc: qcom: pmic_glink: remove redundant calculation of svid soc: qcom: stats: Populate all subsystem debugfs files dt-bindings: soc: qcom,rpmh-rsc: Update to allow for generic nodes soc: qcom: pmic_glink: add CONFIG_NET/CONFIG_OF dependencies soc: qcom: pmic_glink: Introduce altmode support ...
This commit is contained in:
commit
11c7052998
127
Documentation/ABI/testing/debugfs-driver-dcc
Normal file
127
Documentation/ABI/testing/debugfs-driver-dcc
Normal file
@ -0,0 +1,127 @@
|
||||
What: /sys/kernel/debug/dcc/.../ready
|
||||
Date: December 2022
|
||||
Contact: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
|
||||
Description:
|
||||
This file is used to check the status of the dcc
|
||||
hardware if it's ready to receive user configurations.
|
||||
A 'Y' here indicates dcc is ready.
|
||||
|
||||
What: /sys/kernel/debug/dcc/.../trigger
|
||||
Date: December 2022
|
||||
Contact: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
|
||||
Description:
|
||||
This is the debugfs interface for manual software
|
||||
triggers. The trigger can be invoked by writing '1'
|
||||
to the file.
|
||||
|
||||
What: /sys/kernel/debug/dcc/.../config_reset
|
||||
Date: December 2022
|
||||
Contact: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
|
||||
Description:
|
||||
This file is used to reset the configuration of
|
||||
a dcc driver to the default configuration. When '1'
|
||||
is written to the file, all the previous addresses
|
||||
stored in the driver gets removed and users need to
|
||||
reconfigure addresses again.
|
||||
|
||||
What: /sys/kernel/debug/dcc/.../[list-number]/config
|
||||
Date: December 2022
|
||||
Contact: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
|
||||
Description:
|
||||
This stores the addresses of the registers which
|
||||
can be read in case of a hardware crash or manual
|
||||
software triggers. The input addresses type
|
||||
can be one of following dcc instructions: read,
|
||||
write, read-write, and loop type. The lists need to
|
||||
be configured sequentially and not in a overlapping
|
||||
manner; e.g. users can jump to list x only after
|
||||
list y is configured and enabled. The input format for
|
||||
each type is as follows:
|
||||
|
||||
i) Read instruction
|
||||
|
||||
::
|
||||
|
||||
echo R <addr> <n> <bus> >/sys/kernel/debug/dcc/../[list-number]/config
|
||||
|
||||
where:
|
||||
|
||||
<addr>
|
||||
The address to be read.
|
||||
|
||||
<n>
|
||||
The addresses word count, starting from address <1>.
|
||||
Each word is 32 bits (4 bytes). If omitted, defaulted
|
||||
to 1.
|
||||
|
||||
<bus type>
|
||||
The bus type, which can be either 'apb' or 'ahb'.
|
||||
The default is 'ahb' if leaved out.
|
||||
|
||||
ii) Write instruction
|
||||
|
||||
::
|
||||
|
||||
echo W <addr> <n> <bus type> > /sys/kernel/debug/dcc/../[list-number]/config
|
||||
|
||||
where:
|
||||
|
||||
<addr>
|
||||
The address to be written.
|
||||
|
||||
<n>
|
||||
The value to be written at <addr>.
|
||||
|
||||
<bus type>
|
||||
The bus type, which can be either 'apb' or 'ahb'.
|
||||
|
||||
iii) Read-write instruction
|
||||
|
||||
::
|
||||
|
||||
echo RW <addr> <n> <mask> > /sys/kernel/debug/dcc/../[list-number]/config
|
||||
|
||||
where:
|
||||
|
||||
<addr>
|
||||
The address to be read and written.
|
||||
|
||||
<n>
|
||||
The value to be written at <addr>.
|
||||
|
||||
<mask>
|
||||
The value mask.
|
||||
|
||||
iv) Loop instruction
|
||||
|
||||
::
|
||||
|
||||
echo L <loop count> <address count> <address>... > /sys/kernel/debug/dcc/../[list-number]/config
|
||||
|
||||
where:
|
||||
|
||||
<loop count>
|
||||
Number of iterations
|
||||
|
||||
<address count>
|
||||
total number of addresses to be written
|
||||
|
||||
<address>
|
||||
Space-separated list of addresses.
|
||||
|
||||
What: /sys/kernel/debug/dcc/.../[list-number]/enable
|
||||
Date: December 2022
|
||||
Contact: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
|
||||
Description:
|
||||
This debugfs interface is used for enabling the
|
||||
the dcc hardware. A file named "enable" is in the
|
||||
directory list number where users can enable/disable
|
||||
the specific list by writing boolean (1 or 0) to the
|
||||
file.
|
||||
|
||||
On enabling the dcc, all the addresses specified
|
||||
by the user for the corresponding list is written
|
||||
into dcc sram which is read by the dcc hardware
|
||||
on manual or crash induced triggers. Lists must
|
||||
be configured and enabled sequentially, e.g. list
|
||||
2 can only be enabled when list 1 have so.
|
70
Documentation/ABI/testing/debugfs-scmi
Normal file
70
Documentation/ABI/testing/debugfs-scmi
Normal file
@ -0,0 +1,70 @@
|
||||
What: /sys/kernel/debug/scmi/<n>/instance_name
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: The name of the underlying SCMI instance <n> described by
|
||||
all the debugfs accessors rooted at /sys/kernel/debug/scmi/<n>,
|
||||
expressed as the full name of the top DT SCMI node under which
|
||||
this SCMI instance is rooted.
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/atomic_threshold_us
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: An optional time value, expressed in microseconds, representing,
|
||||
on this SCMI instance <n>, the threshold above which any SCMI
|
||||
command, advertised to have an higher-than-threshold execution
|
||||
latency, should not be considered for atomic mode of operation,
|
||||
even if requested.
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/transport/type
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: A string representing the type of transport configured for this
|
||||
SCMI instance <n>.
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/transport/is_atomic
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: A boolean stating if the transport configured on the underlying
|
||||
SCMI instance <n> is capable of atomic mode of operation.
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/transport/max_rx_timeout_ms
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: Timeout in milliseconds allowed for SCMI synchronous replies
|
||||
for the currently configured SCMI transport for instance <n>.
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/transport/max_msg_size
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: Max message size of allowed SCMI messages for the currently
|
||||
configured SCMI transport for instance <n>.
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/transport/tx_max_msg
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: Max number of concurrently allowed in-flight SCMI messages for
|
||||
the currently configured SCMI transport for instance <n> on the
|
||||
TX channels.
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/transport/rx_max_msg
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: Max number of concurrently allowed in-flight SCMI messages for
|
||||
the currently configured SCMI transport for instance <n> on the
|
||||
RX channels.
|
||||
Users: Debugging, any userspace test suite
|
117
Documentation/ABI/testing/debugfs-scmi-raw
Normal file
117
Documentation/ABI/testing/debugfs-scmi-raw
Normal file
@ -0,0 +1,117 @@
|
||||
What: /sys/kernel/debug/scmi/<n>/raw/message
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: SCMI Raw synchronous message injection/snooping facility; write
|
||||
a complete SCMI synchronous command message (header included)
|
||||
in little-endian binary format to have it sent to the configured
|
||||
backend SCMI server for instance <n>.
|
||||
Any subsequently received response can be read from this same
|
||||
entry if it arrived within the configured timeout.
|
||||
Each write to the entry causes one command request to be built
|
||||
and sent while the replies are read back one message at time
|
||||
(receiving an EOF at each message boundary).
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/raw/message_async
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: SCMI Raw asynchronous message injection/snooping facility; write
|
||||
a complete SCMI asynchronous command message (header included)
|
||||
in little-endian binary format to have it sent to the configured
|
||||
backend SCMI server for instance <n>.
|
||||
Any subsequently received response can be read from this same
|
||||
entry if it arrived within the configured timeout.
|
||||
Any additional delayed response received afterwards can be read
|
||||
from this same entry too if it arrived within the configured
|
||||
timeout.
|
||||
Each write to the entry causes one command request to be built
|
||||
and sent while the replies are read back one message at time
|
||||
(receiving an EOF at each message boundary).
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/raw/errors
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: SCMI Raw message errors facility; any kind of timed-out or
|
||||
generally unexpectedly received SCMI message, for instance <n>,
|
||||
can be read from this entry.
|
||||
Each read gives back one message at time (receiving an EOF at
|
||||
each message boundary).
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/raw/notification
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: SCMI Raw notification snooping facility; any notification
|
||||
emitted by the backend SCMI server, for instance <n>, can be
|
||||
read from this entry.
|
||||
Each read gives back one message at time (receiving an EOF at
|
||||
each message boundary).
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/raw/reset
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: SCMI Raw stack reset facility; writing a value to this entry
|
||||
causes the internal queues of any kind of received message,
|
||||
still pending to be read out for instance <n>, to be immediately
|
||||
flushed.
|
||||
Can be used to reset and clean the SCMI Raw stack between to
|
||||
different test-run.
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/raw/channels/<m>/message
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: SCMI Raw synchronous message injection/snooping facility; write
|
||||
a complete SCMI synchronous command message (header included)
|
||||
in little-endian binary format to have it sent to the configured
|
||||
backend SCMI server for instance <n> through the <m> transport
|
||||
channel.
|
||||
Any subsequently received response can be read from this same
|
||||
entry if it arrived on channel <m> within the configured
|
||||
timeout.
|
||||
Each write to the entry causes one command request to be built
|
||||
and sent while the replies are read back one message at time
|
||||
(receiving an EOF at each message boundary).
|
||||
Channel identifier <m> matches the SCMI protocol number which
|
||||
has been associated with this transport channel in the DT
|
||||
description, with base protocol number 0x10 being the default
|
||||
channel for this instance.
|
||||
Note that these per-channel entries rooted at <..>/channels
|
||||
exist only if the transport is configured to have more than
|
||||
one default channel.
|
||||
Users: Debugging, any userspace test suite
|
||||
|
||||
What: /sys/kernel/debug/scmi/<n>/raw/channels/<m>/message_async
|
||||
Date: March 2023
|
||||
KernelVersion: 6.3
|
||||
Contact: cristian.marussi@arm.com
|
||||
Description: SCMI Raw asynchronous message injection/snooping facility; write
|
||||
a complete SCMI asynchronous command message (header included)
|
||||
in little-endian binary format to have it sent to the configured
|
||||
backend SCMI server for instance <n> through the <m> transport
|
||||
channel.
|
||||
Any subsequently received response can be read from this same
|
||||
entry if it arrived on channel <m> within the configured
|
||||
timeout.
|
||||
Any additional delayed response received afterwards can be read
|
||||
from this same entry too if it arrived within the configured
|
||||
timeout.
|
||||
Each write to the entry causes one command request to be built
|
||||
and sent while the replies are read back one message at time
|
||||
(receiving an EOF at each message boundary).
|
||||
Channel identifier <m> matches the SCMI protocol number which
|
||||
has been associated with this transport channel in the DT
|
||||
description, with base protocol number 0x10 being the default
|
||||
channel for this instance.
|
||||
Note that these per-channel entries rooted at <..>/channels
|
||||
exist only if the transport is configured to have more than
|
||||
one default channel.
|
||||
Users: Debugging, any userspace test suite
|
@ -31,7 +31,11 @@ properties:
|
||||
- mediatek,mt8173-mmsys
|
||||
- mediatek,mt8183-mmsys
|
||||
- mediatek,mt8186-mmsys
|
||||
- mediatek,mt8188-vdosys0
|
||||
- mediatek,mt8192-mmsys
|
||||
- mediatek,mt8195-vdosys1
|
||||
- mediatek,mt8195-vppsys0
|
||||
- mediatek,mt8195-vppsys1
|
||||
- mediatek,mt8365-mmsys
|
||||
- const: syscon
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/firmware/amlogic,meson-gxbb-sm.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Amlogic Secure Monitor (SM)
|
||||
|
||||
description:
|
||||
In the Amlogic SoCs the Secure Monitor code is used to provide access to the
|
||||
NVMEM, enable JTAG, set USB boot, etc...
|
||||
|
||||
maintainers:
|
||||
- Neil Armstrong <neil.armstrong@linaro.org>
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
oneOf:
|
||||
- const: amlogic,meson-gxbb-sm
|
||||
- items:
|
||||
- const: amlogic,meson-gx-sm
|
||||
- const: amlogic,meson-gxbb-sm
|
||||
|
||||
power-controller:
|
||||
type: object
|
||||
$ref: /schemas/power/amlogic,meson-sec-pwrc.yaml#
|
||||
|
||||
required:
|
||||
- compatible
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
firmware {
|
||||
secure-monitor {
|
||||
compatible = "amlogic,meson-gxbb-sm";
|
||||
};
|
||||
};
|
@ -1,15 +0,0 @@
|
||||
* Amlogic Secure Monitor
|
||||
|
||||
In the Amlogic SoCs the Secure Monitor code is used to provide access to the
|
||||
NVMEM, enable JTAG, set USB boot, etc...
|
||||
|
||||
Required properties for the secure monitor node:
|
||||
- compatible: Should be "amlogic,meson-gxbb-sm"
|
||||
|
||||
Example:
|
||||
|
||||
firmware {
|
||||
sm: secure-monitor {
|
||||
compatible = "amlogic,meson-gxbb-sm";
|
||||
};
|
||||
};
|
@ -38,6 +38,8 @@ properties:
|
||||
- qcom,scm-msm8994
|
||||
- qcom,scm-msm8996
|
||||
- qcom,scm-msm8998
|
||||
- qcom,scm-qdu1000
|
||||
- qcom,scm-sa8775p
|
||||
- qcom,scm-sc7180
|
||||
- qcom,scm-sc7280
|
||||
- qcom,scm-sc8280xp
|
||||
@ -53,6 +55,7 @@ properties:
|
||||
- qcom,scm-sm8250
|
||||
- qcom,scm-sm8350
|
||||
- qcom,scm-sm8450
|
||||
- qcom,scm-sm8550
|
||||
- qcom,scm-qcs404
|
||||
- const: qcom,scm
|
||||
|
||||
@ -73,6 +76,12 @@ properties:
|
||||
'#reset-cells':
|
||||
const: 1
|
||||
|
||||
interrupts:
|
||||
description:
|
||||
The wait-queue interrupt that firmware raises as part of handshake
|
||||
protocol to handle sleeping SCM calls.
|
||||
maxItems: 1
|
||||
|
||||
qcom,dload-mode:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle-array
|
||||
items:
|
||||
@ -82,6 +91,32 @@ properties:
|
||||
description: TCSR hardware block
|
||||
|
||||
allOf:
|
||||
# Clocks
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
enum:
|
||||
- qcom,scm-apq8064
|
||||
- qcom,scm-apq8084
|
||||
- qcom,scm-mdm9607
|
||||
- qcom,scm-msm8226
|
||||
- qcom,scm-msm8660
|
||||
- qcom,scm-msm8916
|
||||
- qcom,scm-msm8953
|
||||
- qcom,scm-msm8960
|
||||
- qcom,scm-msm8974
|
||||
- qcom,scm-msm8976
|
||||
- qcom,scm-sm6375
|
||||
then:
|
||||
required:
|
||||
- clocks
|
||||
- clock-names
|
||||
else:
|
||||
properties:
|
||||
clock-names: false
|
||||
clocks: false
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
@ -100,10 +135,6 @@ allOf:
|
||||
clocks:
|
||||
maxItems: 1
|
||||
|
||||
required:
|
||||
- clocks
|
||||
- clock-names
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
@ -111,6 +142,7 @@ allOf:
|
||||
enum:
|
||||
- qcom,scm-apq8084
|
||||
- qcom,scm-mdm9607
|
||||
- qcom,scm-msm8226
|
||||
- qcom,scm-msm8916
|
||||
- qcom,scm-msm8953
|
||||
- qcom,scm-msm8974
|
||||
@ -127,9 +159,31 @@ allOf:
|
||||
minItems: 3
|
||||
maxItems: 3
|
||||
|
||||
required:
|
||||
- clocks
|
||||
- clock-names
|
||||
# Interconnects
|
||||
- if:
|
||||
not:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
enum:
|
||||
- qcom,scm-sm8450
|
||||
- qcom,scm-sm8550
|
||||
then:
|
||||
properties:
|
||||
interconnects: false
|
||||
|
||||
# Interrupts
|
||||
- if:
|
||||
not:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
enum:
|
||||
- qcom,scm-sm8450
|
||||
- qcom,scm-sm8550
|
||||
then:
|
||||
properties:
|
||||
interrupts: false
|
||||
|
||||
required:
|
||||
- compatible
|
||||
|
@ -26,6 +26,7 @@ properties:
|
||||
enum:
|
||||
- mediatek,mt6323-keys
|
||||
- mediatek,mt6331-keys
|
||||
- mediatek,mt6357-keys
|
||||
- mediatek,mt6358-keys
|
||||
- mediatek,mt6397-keys
|
||||
|
||||
|
@ -9,7 +9,7 @@ MT6323 PMIC hardware.
|
||||
For MT6323 MFD bindings see:
|
||||
Documentation/devicetree/bindings/mfd/mt6397.txt
|
||||
For MediaTek PMIC wrapper bindings see:
|
||||
Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
|
||||
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
|
||||
|
||||
Required properties:
|
||||
- compatible : Must be "mediatek,mt6323-led"
|
||||
|
111
Documentation/devicetree/bindings/mfd/mediatek,mt6357.yaml
Normal file
111
Documentation/devicetree/bindings/mfd/mediatek,mt6357.yaml
Normal file
@ -0,0 +1,111 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/mfd/mediatek,mt6357.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: MediaTek MT6357 PMIC
|
||||
|
||||
maintainers:
|
||||
- Flora Fu <flora.fu@mediatek.com>
|
||||
- Alexandre Mergnat <amergnat@baylibre.com>
|
||||
|
||||
description: |
|
||||
MT6357 is a power management system chip containing 5 buck
|
||||
converters and 29 LDOs. Supported features are audio codec,
|
||||
USB battery charging, fuel gauge, RTC
|
||||
|
||||
This is a multifunction device with the following sub modules:
|
||||
- Regulator
|
||||
- RTC
|
||||
- Keys
|
||||
|
||||
It is interfaced to host controller using SPI interface by a proprietary hardware
|
||||
called PMIC wrapper or pwrap. This MFD is a child device of pwrap.
|
||||
See the following for pwrap node definitions:
|
||||
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: mediatek,mt6357
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
interrupt-controller: true
|
||||
|
||||
"#interrupt-cells":
|
||||
const: 2
|
||||
|
||||
regulators:
|
||||
type: object
|
||||
$ref: /schemas/regulator/mediatek,mt6357-regulator.yaml
|
||||
description:
|
||||
List of MT6357 BUCKs and LDOs regulators.
|
||||
|
||||
rtc:
|
||||
type: object
|
||||
$ref: /schemas/rtc/rtc.yaml#
|
||||
description:
|
||||
MT6357 Real Time Clock.
|
||||
properties:
|
||||
compatible:
|
||||
const: mediatek,mt6357-rtc
|
||||
start-year: true
|
||||
required:
|
||||
- compatible
|
||||
|
||||
keys:
|
||||
type: object
|
||||
$ref: /schemas/input/mediatek,pmic-keys.yaml
|
||||
description:
|
||||
MT6357 power and home keys.
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- regulators
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
|
||||
pwrap {
|
||||
pmic {
|
||||
compatible = "mediatek,mt6357";
|
||||
|
||||
interrupt-parent = <&pio>;
|
||||
interrupts = <145 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
|
||||
regulators {
|
||||
mt6357_vproc_reg: buck-vproc {
|
||||
regulator-name = "vproc";
|
||||
regulator-min-microvolt = <518750>;
|
||||
regulator-max-microvolt = <1312500>;
|
||||
regulator-ramp-delay = <6250>;
|
||||
regulator-enable-ramp-delay = <220>;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
// ...
|
||||
|
||||
mt6357_vusb33_reg: ldo-vusb33 {
|
||||
regulator-name = "vusb33";
|
||||
regulator-min-microvolt = <3000000>;
|
||||
regulator-max-microvolt = <3100000>;
|
||||
regulator-enable-ramp-delay = <264>;
|
||||
};
|
||||
};
|
||||
|
||||
rtc {
|
||||
compatible = "mediatek,mt6357-rtc";
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "mediatek,mt6357-keys";
|
||||
};
|
||||
};
|
||||
};
|
@ -13,7 +13,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules:
|
||||
It is interfaced to host controller using SPI interface by a proprietary hardware
|
||||
called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap.
|
||||
See the following for pwarp node definitions:
|
||||
../soc/mediatek/pwrap.txt
|
||||
../soc/mediatek/mediatek,pwrap.yaml
|
||||
|
||||
This document describes the binding for MFD device and its sub module.
|
||||
|
||||
|
@ -1,283 +0,0 @@
|
||||
Qualcomm Resource Power Manager (RPM)
|
||||
|
||||
This driver is used to interface with the Resource Power Manager (RPM) found in
|
||||
various Qualcomm platforms. The RPM allows each component in the system to vote
|
||||
for state of the system resources, such as clocks, regulators and bus
|
||||
frequencies.
|
||||
|
||||
- compatible:
|
||||
Usage: required
|
||||
Value type: <string>
|
||||
Definition: must be one of:
|
||||
"qcom,rpm-apq8064"
|
||||
"qcom,rpm-msm8660"
|
||||
"qcom,rpm-msm8960"
|
||||
"qcom,rpm-ipq8064"
|
||||
"qcom,rpm-mdm9615"
|
||||
|
||||
- reg:
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: base address and size of the RPM's message ram
|
||||
|
||||
- interrupts:
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: three entries specifying the RPM's:
|
||||
1. acknowledgement interrupt
|
||||
2. error interrupt
|
||||
3. wakeup interrupt
|
||||
|
||||
- interrupt-names:
|
||||
Usage: required
|
||||
Value type: <string-array>
|
||||
Definition: must be the three strings "ack", "err" and "wakeup", in order
|
||||
|
||||
- qcom,ipc:
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
|
||||
Definition: three entries specifying the outgoing ipc bit used for
|
||||
signaling the RPM:
|
||||
- phandle to a syscon node representing the apcs registers
|
||||
- u32 representing offset to the register within the syscon
|
||||
- u32 representing the ipc bit within the register
|
||||
|
||||
|
||||
= SUBNODES
|
||||
|
||||
The RPM exposes resources to its subnodes. The below bindings specify the set
|
||||
of valid subnodes that can operate on these resources.
|
||||
|
||||
== Regulators
|
||||
|
||||
Regulator nodes are identified by their compatible:
|
||||
|
||||
- compatible:
|
||||
Usage: required
|
||||
Value type: <string>
|
||||
Definition: must be one of:
|
||||
"qcom,rpm-pm8058-regulators"
|
||||
"qcom,rpm-pm8901-regulators"
|
||||
"qcom,rpm-pm8921-regulators"
|
||||
"qcom,rpm-pm8018-regulators"
|
||||
"qcom,rpm-smb208-regulators"
|
||||
|
||||
- vdd_l0_l1_lvs-supply:
|
||||
- vdd_l2_l11_l12-supply:
|
||||
- vdd_l3_l4_l5-supply:
|
||||
- vdd_l6_l7-supply:
|
||||
- vdd_l8-supply:
|
||||
- vdd_l9-supply:
|
||||
- vdd_l10-supply:
|
||||
- vdd_l13_l16-supply:
|
||||
- vdd_l14_l15-supply:
|
||||
- vdd_l17_l18-supply:
|
||||
- vdd_l19_l20-supply:
|
||||
- vdd_l21-supply:
|
||||
- vdd_l22-supply:
|
||||
- vdd_l23_l24_l25-supply:
|
||||
- vdd_ncp-supply:
|
||||
- vdd_s0-supply:
|
||||
- vdd_s1-supply:
|
||||
- vdd_s2-supply:
|
||||
- vdd_s3-supply:
|
||||
- vdd_s4-supply:
|
||||
Usage: optional (pm8058 only)
|
||||
Value type: <phandle>
|
||||
Definition: reference to regulator supplying the input pin, as
|
||||
described in the data sheet
|
||||
|
||||
- lvs0_in-supply:
|
||||
- lvs1_in-supply:
|
||||
- lvs2_in-supply:
|
||||
- lvs3_in-supply:
|
||||
- mvs_in-supply:
|
||||
- vdd_l0-supply:
|
||||
- vdd_l1-supply:
|
||||
- vdd_l2-supply:
|
||||
- vdd_l3-supply:
|
||||
- vdd_l4-supply:
|
||||
- vdd_l5-supply:
|
||||
- vdd_l6-supply:
|
||||
- vdd_s0-supply:
|
||||
- vdd_s1-supply:
|
||||
- vdd_s2-supply:
|
||||
- vdd_s3-supply:
|
||||
- vdd_s4-supply:
|
||||
Usage: optional (pm8901 only)
|
||||
Value type: <phandle>
|
||||
Definition: reference to regulator supplying the input pin, as
|
||||
described in the data sheet
|
||||
|
||||
- vdd_l1_l2_l12_l18-supply:
|
||||
- vdd_l3_l15_l17-supply:
|
||||
- vdd_l4_l14-supply:
|
||||
- vdd_l5_l8_l16-supply:
|
||||
- vdd_l6_l7-supply:
|
||||
- vdd_l9_l11-supply:
|
||||
- vdd_l10_l22-supply:
|
||||
- vdd_l21_l23_l29-supply:
|
||||
- vdd_l24-supply:
|
||||
- vdd_l25-supply:
|
||||
- vdd_l26-supply:
|
||||
- vdd_l27-supply:
|
||||
- vdd_l28-supply:
|
||||
- vdd_ncp-supply:
|
||||
- vdd_s1-supply:
|
||||
- vdd_s2-supply:
|
||||
- vdd_s4-supply:
|
||||
- vdd_s5-supply:
|
||||
- vdd_s6-supply:
|
||||
- vdd_s7-supply:
|
||||
- vdd_s8-supply:
|
||||
- vin_5vs-supply:
|
||||
- vin_lvs1_3_6-supply:
|
||||
- vin_lvs2-supply:
|
||||
- vin_lvs4_5_7-supply:
|
||||
Usage: optional (pm8921 only)
|
||||
Value type: <phandle>
|
||||
Definition: reference to regulator supplying the input pin, as
|
||||
described in the data sheet
|
||||
|
||||
- vin_lvs1-supply:
|
||||
- vdd_l7-supply:
|
||||
- vdd_l8-supply:
|
||||
- vdd_l9_l10_l11_l12-supply:
|
||||
Usage: optional (pm8018 only)
|
||||
Value type: <phandle>
|
||||
Definition: reference to regulator supplying the input pin, as
|
||||
described in the data sheet
|
||||
|
||||
The regulator node houses sub-nodes for each regulator within the device. Each
|
||||
sub-node is identified using the node's name, with valid values listed for each
|
||||
of the pmics below.
|
||||
|
||||
pm8058:
|
||||
l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15,
|
||||
l16, l17, l18, l19, l20, l21, l22, l23, l24, l25, s0, s1, s2, s3, s4,
|
||||
lvs0, lvs1, ncp
|
||||
|
||||
pm8901:
|
||||
l0, l1, l2, l3, l4, l5, l6, s0, s1, s2, s3, s4, lvs0, lvs1, lvs2, lvs3,
|
||||
mvs
|
||||
|
||||
pm8921:
|
||||
s1, s2, s3, s4, s7, s8, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
|
||||
l12, l14, l15, l16, l17, l18, l21, l22, l23, l24, l25, l26, l27, l28,
|
||||
l29, lvs1, lvs2, lvs3, lvs4, lvs5, lvs6, lvs7, usb-switch, hdmi-switch,
|
||||
ncp
|
||||
|
||||
pm8018:
|
||||
s1, s2, s3, s4, s5, , l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
|
||||
l12, l14, lvs1
|
||||
|
||||
smb208:
|
||||
s1a, s1b, s2a, s2b
|
||||
|
||||
The content of each sub-node is defined by the standard binding for regulators -
|
||||
see regulator.txt - with additional custom properties described below:
|
||||
|
||||
=== Switch-mode Power Supply regulator custom properties
|
||||
|
||||
- bias-pull-down:
|
||||
Usage: optional
|
||||
Value type: <empty>
|
||||
Definition: enable pull down of the regulator when inactive
|
||||
|
||||
- qcom,switch-mode-frequency:
|
||||
Usage: required
|
||||
Value type: <u32>
|
||||
Definition: Frequency (Hz) of the switch-mode power supply;
|
||||
must be one of:
|
||||
19200000, 9600000, 6400000, 4800000, 3840000, 3200000,
|
||||
2740000, 2400000, 2130000, 1920000, 1750000, 1600000,
|
||||
1480000, 1370000, 1280000, 1200000
|
||||
|
||||
- qcom,force-mode:
|
||||
Usage: optional (default if no other qcom,force-mode is specified)
|
||||
Value type: <u32>
|
||||
Definition: indicates that the regulator should be forced to a
|
||||
particular mode, valid values are:
|
||||
QCOM_RPM_FORCE_MODE_NONE - do not force any mode
|
||||
QCOM_RPM_FORCE_MODE_LPM - force into low power mode
|
||||
QCOM_RPM_FORCE_MODE_HPM - force into high power mode
|
||||
QCOM_RPM_FORCE_MODE_AUTO - allow regulator to automatically
|
||||
select its own mode based on
|
||||
realtime current draw, only for:
|
||||
pm8921 smps and ftsmps
|
||||
|
||||
- qcom,power-mode-hysteretic:
|
||||
Usage: optional
|
||||
Value type: <empty>
|
||||
Definition: select that the power supply should operate in hysteretic
|
||||
mode, instead of the default pwm mode
|
||||
|
||||
=== Low-dropout regulator custom properties
|
||||
|
||||
- bias-pull-down:
|
||||
Usage: optional
|
||||
Value type: <empty>
|
||||
Definition: enable pull down of the regulator when inactive
|
||||
|
||||
- qcom,force-mode:
|
||||
Usage: optional
|
||||
Value type: <u32>
|
||||
Definition: indicates that the regulator should not be forced to any
|
||||
particular mode, valid values are:
|
||||
QCOM_RPM_FORCE_MODE_NONE - do not force any mode
|
||||
QCOM_RPM_FORCE_MODE_LPM - force into low power mode
|
||||
QCOM_RPM_FORCE_MODE_HPM - force into high power mode
|
||||
QCOM_RPM_FORCE_MODE_BYPASS - set regulator to use bypass
|
||||
mode, i.e. to act as a switch
|
||||
and not regulate, only for:
|
||||
pm8921 pldo, nldo and nldo1200
|
||||
|
||||
=== Negative Charge Pump custom properties
|
||||
|
||||
- qcom,switch-mode-frequency:
|
||||
Usage: required
|
||||
Value type: <u32>
|
||||
Definition: Frequency (Hz) of the switch mode power supply;
|
||||
must be one of:
|
||||
19200000, 9600000, 6400000, 4800000, 3840000, 3200000,
|
||||
2740000, 2400000, 2130000, 1920000, 1750000, 1600000,
|
||||
1480000, 1370000, 1280000, 1200000
|
||||
|
||||
= EXAMPLE
|
||||
|
||||
#include <dt-bindings/mfd/qcom-rpm.h>
|
||||
|
||||
rpm@108000 {
|
||||
compatible = "qcom,rpm-msm8960";
|
||||
reg = <0x108000 0x1000>;
|
||||
qcom,ipc = <&apcs 0x8 2>;
|
||||
|
||||
interrupts = <0 19 0>, <0 21 0>, <0 22 0>;
|
||||
interrupt-names = "ack", "err", "wakeup";
|
||||
|
||||
regulators {
|
||||
compatible = "qcom,rpm-pm8921-regulators";
|
||||
vdd_l1_l2_l12_l18-supply = <&pm8921_s4>;
|
||||
|
||||
s1 {
|
||||
regulator-min-microvolt = <1225000>;
|
||||
regulator-max-microvolt = <1225000>;
|
||||
|
||||
bias-pull-down;
|
||||
|
||||
qcom,switch-mode-frequency = <3200000>;
|
||||
};
|
||||
|
||||
pm8921_s4: s4 {
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
|
||||
qcom,switch-mode-frequency = <1600000>;
|
||||
bias-pull-down;
|
||||
|
||||
qcom,force-mode = <QCOM_RPM_FORCE_MODE_AUTO>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -22,13 +22,13 @@ properties:
|
||||
|
||||
samsung,pmu-syscon:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
deprecated: true
|
||||
description:
|
||||
Phandle to PMU system controller interface.
|
||||
Phandle to PMU system controller interface (if not a child of PMU).
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- "#phy-cells"
|
||||
- samsung,pmu-syscon
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
@ -36,6 +36,5 @@ examples:
|
||||
- |
|
||||
phy {
|
||||
compatible = "samsung,exynos5420-dp-video-phy";
|
||||
samsung,pmu-syscon = <&pmu_system_controller>;
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
|
@ -35,15 +35,18 @@ properties:
|
||||
|
||||
syscon:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
deprecated: true
|
||||
description:
|
||||
Phandle to PMU system controller interface, valid only for
|
||||
samsung,s5pv210-mipi-video-phy and samsung,exynos5420-mipi-video-phy.
|
||||
samsung,s5pv210-mipi-video-phy and samsung,exynos5420-mipi-video-phy (if
|
||||
not a child of PMU).
|
||||
|
||||
samsung,pmu-syscon:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
deprecated: true
|
||||
description:
|
||||
Phandle to PMU system controller interface, valid for
|
||||
samsung,exynos5433-mipi-video-phy.
|
||||
samsung,exynos5433-mipi-video-phy (if not a child of PMU).
|
||||
|
||||
samsung,disp-sysreg:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
@ -81,13 +84,10 @@ allOf:
|
||||
samsung,disp-sysreg: false
|
||||
samsung,cam0-sysreg: false
|
||||
samsung,cam1-sysreg: false
|
||||
required:
|
||||
- syscon
|
||||
else:
|
||||
properties:
|
||||
syscon: false
|
||||
required:
|
||||
- samsung,pmu-syscon
|
||||
- samsung,disp-sysreg
|
||||
- samsung,cam0-sysreg
|
||||
- samsung,cam1-sysreg
|
||||
@ -99,7 +99,6 @@ examples:
|
||||
phy {
|
||||
compatible = "samsung,exynos5433-mipi-video-phy";
|
||||
#phy-cells = <1>;
|
||||
samsung,pmu-syscon = <&pmu_system_controller>;
|
||||
samsung,cam0-sysreg = <&syscon_cam0>;
|
||||
samsung,cam1-sysreg = <&syscon_cam1>;
|
||||
samsung,disp-sysreg = <&syscon_disp>;
|
||||
|
@ -0,0 +1,54 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/power/allwinner,sun20i-d1-ppu.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Allwinner SoCs PPU power domain controller
|
||||
|
||||
maintainers:
|
||||
- Samuel Holland <samuel@sholland.org>
|
||||
|
||||
description:
|
||||
D1 and related SoCs contain a power domain controller for the CPUs, GPU, and
|
||||
video-related hardware.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- allwinner,sun20i-d1-ppu
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
description: Bus Clock
|
||||
maxItems: 1
|
||||
|
||||
resets:
|
||||
maxItems: 1
|
||||
|
||||
'#power-domain-cells':
|
||||
const: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- clocks
|
||||
- resets
|
||||
- '#power-domain-cells'
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/clock/sun20i-d1-r-ccu.h>
|
||||
#include <dt-bindings/reset/sun20i-d1-r-ccu.h>
|
||||
|
||||
ppu: power-controller@7001000 {
|
||||
compatible = "allwinner,sun20i-d1-ppu";
|
||||
reg = <0x7001000 0x1000>;
|
||||
clocks = <&r_ccu CLK_BUS_R_PPU>;
|
||||
resets = <&r_ccu RST_BUS_R_PPU>;
|
||||
#power-domain-cells = <1>;
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
Amlogic Meson Power Controller
|
||||
==============================
|
||||
Amlogic Meson Power Controller (deprecated)
|
||||
===========================================
|
||||
|
||||
The Amlogic Meson SoCs embeds an internal Power domain controller.
|
||||
|
||||
|
@ -28,6 +28,7 @@ properties:
|
||||
- mediatek,mt8173-power-controller
|
||||
- mediatek,mt8183-power-controller
|
||||
- mediatek,mt8186-power-controller
|
||||
- mediatek,mt8188-power-controller
|
||||
- mediatek,mt8192-power-controller
|
||||
- mediatek,mt8195-power-controller
|
||||
|
||||
@ -84,6 +85,7 @@ $defs:
|
||||
"include/dt-bindings/power/mt8167-power.h" - for MT8167 type power domain.
|
||||
"include/dt-bindings/power/mt8173-power.h" - for MT8173 type power domain.
|
||||
"include/dt-bindings/power/mt8183-power.h" - for MT8183 type power domain.
|
||||
"include/dt-bindings/power/mediatek,mt8188-power.h" - for MT8188 type power domain.
|
||||
"include/dt-bindings/power/mt8192-power.h" - for MT8192 type power domain.
|
||||
"include/dt-bindings/power/mt8195-power.h" - for MT8195 type power domain.
|
||||
maxItems: 1
|
||||
|
@ -30,6 +30,7 @@ properties:
|
||||
- qcom,qcs404-rpmpd
|
||||
- qcom,qdu1000-rpmhpd
|
||||
- qcom,sa8540p-rpmhpd
|
||||
- qcom,sa8775p-rpmhpd
|
||||
- qcom,sdm660-rpmpd
|
||||
- qcom,sc7180-rpmhpd
|
||||
- qcom,sc7280-rpmhpd
|
||||
@ -39,7 +40,6 @@ properties:
|
||||
- qcom,sdm845-rpmhpd
|
||||
- qcom,sdx55-rpmhpd
|
||||
- qcom,sdx65-rpmhpd
|
||||
- qcom,sm4250-rpmpd
|
||||
- qcom,sm6115-rpmpd
|
||||
- qcom,sm6125-rpmpd
|
||||
- qcom,sm6350-rpmhpd
|
||||
|
@ -0,0 +1,45 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/power/starfive,jh7110-pmu.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: StarFive JH7110 Power Management Unit
|
||||
|
||||
maintainers:
|
||||
- Walker Chen <walker.chen@starfivetech.com>
|
||||
|
||||
description: |
|
||||
StarFive JH7110 SoC includes support for multiple power domains which can be
|
||||
powered on/off by software based on different application scenes to save power.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- starfive,jh7110-pmu
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
"#power-domain-cells":
|
||||
const: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- interrupts
|
||||
- "#power-domain-cells"
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
pwrc: power-controller@17030000 {
|
||||
compatible = "starfive,jh7110-pmu";
|
||||
reg = <0x17030000 0x10000>;
|
||||
interrupts = <111>;
|
||||
#power-domain-cells = <1>;
|
||||
};
|
@ -27,9 +27,11 @@ properties:
|
||||
identifier of the client to use this region for buffers
|
||||
|
||||
qcom,vmid:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
$ref: /schemas/types.yaml#/definitions/uint32-array
|
||||
description: >
|
||||
vmid of the remote processor, to set up memory protection
|
||||
Array of vmids of the remote processors, to set up memory protection
|
||||
minItems: 1
|
||||
maxItems: 2
|
||||
|
||||
required:
|
||||
- qcom,client-id
|
||||
|
@ -37,6 +37,10 @@ properties:
|
||||
- sifive,fu540-c000-ccache
|
||||
- sifive,fu740-c000-ccache
|
||||
- const: cache
|
||||
- items:
|
||||
- const: starfive,jh7110-ccache
|
||||
- const: sifive,ccache0
|
||||
- const: cache
|
||||
- items:
|
||||
- const: microchip,mpfs-ccache
|
||||
- const: sifive,fu540-c000-ccache
|
||||
@ -84,6 +88,7 @@ allOf:
|
||||
contains:
|
||||
enum:
|
||||
- sifive,fu740-c000-ccache
|
||||
- starfive,jh7110-ccache
|
||||
- microchip,mpfs-ccache
|
||||
|
||||
then:
|
||||
@ -104,7 +109,9 @@ allOf:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: sifive,fu740-c000-ccache
|
||||
enum:
|
||||
- sifive,fu740-c000-ccache
|
||||
- starfive,jh7110-ccache
|
||||
|
||||
then:
|
||||
properties:
|
||||
|
@ -32,6 +32,7 @@ properties:
|
||||
- mediatek,mt8183-disp-mutex
|
||||
- mediatek,mt8186-disp-mutex
|
||||
- mediatek,mt8186-mdp3-mutex
|
||||
- mediatek,mt8188-disp-mutex
|
||||
- mediatek,mt8192-disp-mutex
|
||||
- mediatek,mt8195-disp-mutex
|
||||
|
||||
|
@ -0,0 +1,147 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/soc/mediatek/mediatek,pwrap.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Mediatek PMIC Wrapper
|
||||
|
||||
maintainers:
|
||||
- Flora Fu <flora.fu@mediatek.com>
|
||||
- Alexandre Mergnat <amergnat@baylibre.com>
|
||||
|
||||
description:
|
||||
On MediaTek SoCs the PMIC is connected via SPI. The SPI master interface
|
||||
is not directly visible to the CPU, but only through the PMIC wrapper
|
||||
inside the SoC. The communication between the SoC and the PMIC can
|
||||
optionally be encrypted. Also a non standard Dual IO SPI mode can be
|
||||
used to increase speed.
|
||||
|
||||
IP Pairing
|
||||
|
||||
On MT8135 the pins of some SoC internal peripherals can be on the PMIC.
|
||||
The signals of these pins are routed over the SPI bus using the pwrap
|
||||
bridge. In the binding description below the properties needed for bridging
|
||||
are marked with "IP Pairing". These are optional on SoCs which do not support
|
||||
IP Pairing
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
oneOf:
|
||||
- items:
|
||||
- enum:
|
||||
- mediatek,mt2701-pwrap
|
||||
- mediatek,mt6765-pwrap
|
||||
- mediatek,mt6779-pwrap
|
||||
- mediatek,mt6797-pwrap
|
||||
- mediatek,mt6873-pwrap
|
||||
- mediatek,mt7622-pwrap
|
||||
- mediatek,mt8135-pwrap
|
||||
- mediatek,mt8173-pwrap
|
||||
- mediatek,mt8183-pwrap
|
||||
- mediatek,mt8186-pwrap
|
||||
- mediatek,mt8188-pwrap
|
||||
- mediatek,mt8195-pwrap
|
||||
- mediatek,mt8365-pwrap
|
||||
- mediatek,mt8516-pwrap
|
||||
- items:
|
||||
- enum:
|
||||
- mediatek,mt8186-pwrap
|
||||
- mediatek,mt8195-pwrap
|
||||
- const: syscon
|
||||
|
||||
reg:
|
||||
minItems: 1
|
||||
items:
|
||||
- description: PMIC wrapper registers
|
||||
- description: IP pairing registers
|
||||
|
||||
reg-names:
|
||||
minItems: 1
|
||||
items:
|
||||
- const: pwrap
|
||||
- const: pwrap-bridge
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
minItems: 2
|
||||
items:
|
||||
- description: SPI bus clock
|
||||
- description: Main module clock
|
||||
- description: System module clock
|
||||
- description: Timer module clock
|
||||
|
||||
clock-names:
|
||||
minItems: 2
|
||||
items:
|
||||
- const: spi
|
||||
- const: wrap
|
||||
- const: sys
|
||||
- const: tmr
|
||||
|
||||
resets:
|
||||
minItems: 1
|
||||
items:
|
||||
- description: PMIC wrapper reset
|
||||
- description: IP pairing reset
|
||||
|
||||
reset-names:
|
||||
minItems: 1
|
||||
items:
|
||||
- const: pwrap
|
||||
- const: pwrap-bridge
|
||||
|
||||
pmic:
|
||||
type: object
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- reg-names
|
||||
- interrupts
|
||||
- clocks
|
||||
- clock-names
|
||||
|
||||
dependentRequired:
|
||||
resets: [reset-names]
|
||||
|
||||
allOf:
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: mediatek,mt8365-pwrap
|
||||
then:
|
||||
properties:
|
||||
clocks:
|
||||
minItems: 4
|
||||
|
||||
clock-names:
|
||||
minItems: 4
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
#include <dt-bindings/reset/mt8135-resets.h>
|
||||
|
||||
soc {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
pwrap@1000f000 {
|
||||
compatible = "mediatek,mt8135-pwrap";
|
||||
reg = <0 0x1000f000 0 0x1000>,
|
||||
<0 0x11017000 0 0x1000>;
|
||||
reg-names = "pwrap", "pwrap-bridge";
|
||||
interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clk26m>, <&clk26m>;
|
||||
clock-names = "spi", "wrap";
|
||||
resets = <&infracfg MT8135_INFRA_PMIC_WRAP_RST>,
|
||||
<&pericfg MT8135_PERI_PWRAP_BRIDGE_SW_RST>;
|
||||
reset-names = "pwrap", "pwrap-bridge";
|
||||
};
|
||||
};
|
@ -1,75 +0,0 @@
|
||||
MediaTek PMIC Wrapper Driver
|
||||
|
||||
This document describes the binding for the MediaTek PMIC wrapper.
|
||||
|
||||
On MediaTek SoCs the PMIC is connected via SPI. The SPI master interface
|
||||
is not directly visible to the CPU, but only through the PMIC wrapper
|
||||
inside the SoC. The communication between the SoC and the PMIC can
|
||||
optionally be encrypted. Also a non standard Dual IO SPI mode can be
|
||||
used to increase speed.
|
||||
|
||||
IP Pairing
|
||||
|
||||
on MT8135 the pins of some SoC internal peripherals can be on the PMIC.
|
||||
The signals of these pins are routed over the SPI bus using the pwrap
|
||||
bridge. In the binding description below the properties needed for bridging
|
||||
are marked with "IP Pairing". These are optional on SoCs which do not support
|
||||
IP Pairing
|
||||
|
||||
Required properties in pwrap device node.
|
||||
- compatible:
|
||||
"mediatek,mt2701-pwrap" for MT2701/7623 SoCs
|
||||
"mediatek,mt6765-pwrap" for MT6765 SoCs
|
||||
"mediatek,mt6779-pwrap" for MT6779 SoCs
|
||||
"mediatek,mt6797-pwrap" for MT6797 SoCs
|
||||
"mediatek,mt6873-pwrap" for MT6873/8192 SoCs
|
||||
"mediatek,mt7622-pwrap" for MT7622 SoCs
|
||||
"mediatek,mt8135-pwrap" for MT8135 SoCs
|
||||
"mediatek,mt8173-pwrap" for MT8173 SoCs
|
||||
"mediatek,mt8183-pwrap" for MT8183 SoCs
|
||||
"mediatek,mt8186-pwrap" for MT8186 SoCs
|
||||
"mediatek,mt8188-pwrap", "mediatek,mt8195-pwrap" for MT8188 SoCs
|
||||
"mediatek,mt8195-pwrap" for MT8195 SoCs
|
||||
"mediatek,mt8365-pwrap" for MT8365 SoCs
|
||||
"mediatek,mt8516-pwrap" for MT8516 SoCs
|
||||
- interrupts: IRQ for pwrap in SOC
|
||||
- reg-names: "pwrap" is required; "pwrap-bridge" is optional.
|
||||
"pwrap": Main registers base
|
||||
"pwrap-bridge": bridge base (IP Pairing)
|
||||
- reg: Must contain an entry for each entry in reg-names.
|
||||
- clock-names: Must include the following entries:
|
||||
"spi": SPI bus clock
|
||||
"wrap": Main module clock
|
||||
"sys": Optional system module clock
|
||||
"tmr": Optional timer module clock
|
||||
- clocks: Must contain an entry for each entry in clock-names.
|
||||
|
||||
Optional properities:
|
||||
- reset-names: Some SoCs include the following entries:
|
||||
"pwrap"
|
||||
"pwrap-bridge" (IP Pairing)
|
||||
- resets: Must contain an entry for each entry in reset-names.
|
||||
- pmic: Using either MediaTek PMIC MFD as the child device of pwrap
|
||||
See the following for child node definitions:
|
||||
Documentation/devicetree/bindings/mfd/mt6397.txt
|
||||
or the regulator-only device as the child device of pwrap, such as MT6380.
|
||||
See the following definitions for such kinds of devices.
|
||||
Documentation/devicetree/bindings/regulator/mt6380-regulator.txt
|
||||
|
||||
Example:
|
||||
pwrap: pwrap@1000f000 {
|
||||
compatible = "mediatek,mt8135-pwrap";
|
||||
reg = <0 0x1000f000 0 0x1000>,
|
||||
<0 0x11017000 0 0x1000>;
|
||||
reg-names = "pwrap", "pwrap-bridge";
|
||||
interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
|
||||
resets = <&infracfg MT8135_INFRA_PMIC_WRAP_RST>,
|
||||
<&pericfg MT8135_PERI_PWRAP_BRIDGE_SW_RST>;
|
||||
reset-names = "pwrap", "pwrap-bridge";
|
||||
clocks = <&clk26m>, <&clk26m>;
|
||||
clock-names = "spi", "wrap";
|
||||
|
||||
pmic {
|
||||
compatible = "mediatek,mt6397";
|
||||
};
|
||||
};
|
44
Documentation/devicetree/bindings/soc/qcom/qcom,dcc.yaml
Normal file
44
Documentation/devicetree/bindings/soc/qcom/qcom,dcc.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/soc/qcom/qcom,dcc.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Data Capture and Compare
|
||||
|
||||
maintainers:
|
||||
- Souradeep Chowdhury <quic_schowdhu@quicinc.com>
|
||||
|
||||
description: |
|
||||
DCC (Data Capture and Compare) is a DMA engine which is used to save
|
||||
configuration data or system memory contents during catastrophic failure
|
||||
or SW trigger. DCC is used to capture and store data for debugging purpose
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
items:
|
||||
- enum:
|
||||
- qcom,sm8150-dcc
|
||||
- qcom,sc7280-dcc
|
||||
- qcom,sc7180-dcc
|
||||
- qcom,sdm845-dcc
|
||||
- const: qcom,dcc
|
||||
|
||||
reg:
|
||||
items:
|
||||
- description: DCC base
|
||||
- description: DCC RAM base
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
dma@10a2000{
|
||||
compatible = "qcom,sm8150-dcc", "qcom,dcc";
|
||||
reg = <0x010a2000 0x1000>,
|
||||
<0x010ad000 0x2000>;
|
||||
};
|
@ -0,0 +1,36 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/soc/qcom/qcom,msm8976-ramp-controller.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Qualcomm Ramp Controller
|
||||
|
||||
maintainers:
|
||||
- AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
|
||||
|
||||
description:
|
||||
The Ramp Controller is used to program the sequence ID for pulse
|
||||
swallowing, enable sequences and link Sequence IDs (SIDs) for the
|
||||
CPU cores on some Qualcomm SoCs.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- qcom,msm8976-ramp-controller
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
cpu-power-controller@b014000 {
|
||||
compatible = "qcom,msm8976-ramp-controller";
|
||||
reg = <0x0b014000 0x68>;
|
||||
};
|
@ -0,0 +1,95 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/soc/qcom/qcom,pmic-glink.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Qualcomm PMIC GLINK firmware interface for battery management, USB
|
||||
Type-C and other things.
|
||||
|
||||
maintainers:
|
||||
- Bjorn Andersson <andersson@kernel.org>
|
||||
|
||||
description:
|
||||
The PMIC GLINK service, running on a coprocessor on some modern Qualcomm
|
||||
platforms and implement USB Type-C handling and battery management. This
|
||||
binding describes the component in the OS used to communicate with the
|
||||
firmware and connect it's resources to those described in the Devicetree,
|
||||
particularly the USB Type-C controllers relationship with USB and DisplayPort
|
||||
components.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
items:
|
||||
- enum:
|
||||
- qcom,sc8180x-pmic-glink
|
||||
- qcom,sc8280xp-pmic-glink
|
||||
- qcom,sm8350-pmic-glink
|
||||
- const: qcom,pmic-glink
|
||||
|
||||
'#address-cells':
|
||||
const: 1
|
||||
|
||||
'#size-cells':
|
||||
const: 0
|
||||
|
||||
patternProperties:
|
||||
'^connector@\d$':
|
||||
$ref: /schemas/connector/usb-connector.yaml#
|
||||
|
||||
properties:
|
||||
reg: true
|
||||
|
||||
required:
|
||||
- reg
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
required:
|
||||
- compatible
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |+
|
||||
pmic-glink {
|
||||
compatible = "qcom,sc8280xp-pmic-glink", "qcom,pmic-glink";
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
connector@0 {
|
||||
compatible = "usb-c-connector";
|
||||
reg = <0>;
|
||||
power-role = "dual";
|
||||
data-role = "dual";
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
endpoint {
|
||||
remote-endpoint = <&usb_role>;
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
endpoint {
|
||||
remote-endpoint = <&ss_phy_out>;
|
||||
};
|
||||
};
|
||||
|
||||
port@2 {
|
||||
reg = <2>;
|
||||
endpoint {
|
||||
remote-endpoint = <&sbu_mux>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
...
|
||||
|
101
Documentation/devicetree/bindings/soc/qcom/qcom,rpm.yaml
Normal file
101
Documentation/devicetree/bindings/soc/qcom/qcom,rpm.yaml
Normal file
@ -0,0 +1,101 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/soc/qcom/qcom,rpm.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Qualcomm Resource Power Manager (RPM)
|
||||
|
||||
description:
|
||||
This driver is used to interface with the Resource Power Manager (RPM) found
|
||||
in various Qualcomm platforms. The RPM allows each component in the system
|
||||
to vote for state of the system resources, such as clocks, regulators and bus
|
||||
frequencies.
|
||||
|
||||
maintainers:
|
||||
- Bjorn Andersson <andersson@kernel.org>
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- qcom,rpm-apq8064
|
||||
- qcom,rpm-msm8660
|
||||
- qcom,rpm-msm8960
|
||||
- qcom,rpm-ipq8064
|
||||
- qcom,rpm-mdm9615
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
interrupts:
|
||||
maxItems: 3
|
||||
|
||||
interrupt-names:
|
||||
items:
|
||||
- const: ack
|
||||
- const: err
|
||||
- const: wakeup
|
||||
|
||||
qcom,ipc:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle-array
|
||||
items:
|
||||
- items:
|
||||
- description: phandle to a syscon node representing the APCS registers
|
||||
- description: u32 representing offset to the register within the syscon
|
||||
- description: u32 representing the ipc bit within the register
|
||||
description:
|
||||
Three entries specifying the outgoing ipc bit used for signaling the RPM.
|
||||
|
||||
patternProperties:
|
||||
"^regulators(-[01])?$":
|
||||
type: object
|
||||
$ref: /schemas/regulator/qcom,rpm-regulator.yaml#
|
||||
unevaluatedProperties: false
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- interrupts
|
||||
- interrupt-names
|
||||
- qcom,ipc
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/mfd/qcom-rpm.h>
|
||||
|
||||
rpm@108000 {
|
||||
compatible = "qcom,rpm-msm8960";
|
||||
reg = <0x108000 0x1000>;
|
||||
qcom,ipc = <&apcs 0x8 2>;
|
||||
|
||||
interrupts = <GIC_SPI 19 IRQ_TYPE_NONE>, <GIC_SPI 21 IRQ_TYPE_NONE>, <GIC_SPI 22 IRQ_TYPE_NONE>;
|
||||
interrupt-names = "ack", "err", "wakeup";
|
||||
|
||||
regulators {
|
||||
compatible = "qcom,rpm-pm8921-regulators";
|
||||
vdd_l1_l2_l12_l18-supply = <&pm8921_s4>;
|
||||
|
||||
s1 {
|
||||
regulator-min-microvolt = <1225000>;
|
||||
regulator-max-microvolt = <1225000>;
|
||||
|
||||
bias-pull-down;
|
||||
|
||||
qcom,switch-mode-frequency = <3200000>;
|
||||
};
|
||||
|
||||
pm8921_s4: s4 {
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
|
||||
qcom,switch-mode-frequency = <1600000>;
|
||||
bias-pull-down;
|
||||
|
||||
qcom,force-mode = <QCOM_RPM_FORCE_MODE_AUTO>;
|
||||
};
|
||||
};
|
||||
};
|
@ -112,8 +112,9 @@ properties:
|
||||
$ref: /schemas/power/qcom,rpmpd.yaml#
|
||||
|
||||
patternProperties:
|
||||
'-regulators$':
|
||||
'^regulators(-[0-9])?$':
|
||||
$ref: /schemas/regulator/qcom,rpmh-regulator.yaml#
|
||||
unevaluatedProperties: false
|
||||
|
||||
required:
|
||||
- compatible
|
||||
|
@ -80,6 +80,7 @@ if:
|
||||
enum:
|
||||
- qcom,rpm-apq8084
|
||||
- qcom,rpm-msm8916
|
||||
- qcom,rpm-msm8936
|
||||
- qcom,rpm-msm8974
|
||||
- qcom,rpm-msm8976
|
||||
- qcom,rpm-msm8953
|
||||
|
16
MAINTAINERS
16
MAINTAINERS
@ -17253,7 +17253,8 @@ F: drivers/clk/qcom/
|
||||
F: include/dt-bindings/clock/qcom,*
|
||||
|
||||
QUALCOMM CORE POWER REDUCTION (CPR) AVS DRIVER
|
||||
M: Niklas Cassel <nks@flawful.org>
|
||||
M: Bjorn Andersson <andersson@kernel.org>
|
||||
M: Konrad Dybcio <konrad.dybcio@linaro.org>
|
||||
L: linux-pm@vger.kernel.org
|
||||
L: linux-arm-msm@vger.kernel.org
|
||||
S: Maintained
|
||||
@ -19947,6 +19948,19 @@ F: Documentation/devicetree/bindings/reset/starfive,jh7100-reset.yaml
|
||||
F: drivers/reset/reset-starfive-jh7100.c
|
||||
F: include/dt-bindings/reset/starfive-jh7100.h
|
||||
|
||||
STARFIVE JH71XX PMU CONTROLLER DRIVER
|
||||
M: Walker Chen <walker.chen@starfivetech.com>
|
||||
S: Supported
|
||||
F: Documentation/devicetree/bindings/power/starfive*
|
||||
F: drivers/soc/starfive/jh71xx_pmu.c
|
||||
F: include/dt-bindings/power/starfive,jh7110-pmu.h
|
||||
|
||||
STARFIVE SOC DRIVERS
|
||||
M: Conor Dooley <conor@kernel.org>
|
||||
S: Maintained
|
||||
T: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/
|
||||
F: drivers/soc/starfive/
|
||||
|
||||
STARFIVE TRNG DRIVER
|
||||
M: Jia Jie Ho <jiajie.ho@starfivetech.com>
|
||||
S: Supported
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
|
||||
#include <asm/smp_plat.h>
|
||||
|
||||
|
@ -263,7 +263,6 @@ static int weim_parse_dt(struct platform_device *pdev)
|
||||
static int weim_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct weim_priv *priv;
|
||||
struct resource *res;
|
||||
struct clk *clk;
|
||||
void __iomem *base;
|
||||
int ret;
|
||||
@ -273,8 +272,7 @@ static int weim_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
/* get the resource */
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
base = devm_ioremap_resource(&pdev->dev, res);
|
||||
base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/cpuidle.h>
|
||||
#include <linux/cpu_pm.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <soc/qcom/spm.h>
|
||||
|
||||
#include <asm/proc-fns.h>
|
||||
|
@ -23,6 +23,38 @@ config ARM_SCMI_PROTOCOL
|
||||
|
||||
if ARM_SCMI_PROTOCOL
|
||||
|
||||
config ARM_SCMI_NEED_DEBUGFS
|
||||
bool
|
||||
help
|
||||
This declares whether at least one SCMI facility is configured
|
||||
which needs debugfs support. When selected causess the creation
|
||||
of a common SCMI debugfs root directory.
|
||||
|
||||
config ARM_SCMI_RAW_MODE_SUPPORT
|
||||
bool "Enable support for SCMI Raw transmission mode"
|
||||
depends on DEBUG_FS
|
||||
select ARM_SCMI_NEED_DEBUGFS
|
||||
help
|
||||
Enable support for SCMI Raw transmission mode.
|
||||
|
||||
If enabled allows the direct injection and snooping of SCMI bare
|
||||
messages through a dedicated debugfs interface.
|
||||
It is meant to be used by SCMI compliance/testing suites.
|
||||
|
||||
When enabled regular SCMI drivers interactions are inhibited in
|
||||
order to avoid unexpected interactions with the SCMI Raw message
|
||||
flow. If unsure say N.
|
||||
|
||||
config ARM_SCMI_RAW_MODE_SUPPORT_COEX
|
||||
bool "Allow SCMI Raw mode coexistence with normal SCMI stack"
|
||||
depends on ARM_SCMI_RAW_MODE_SUPPORT
|
||||
help
|
||||
Allow SCMI Raw transmission mode to coexist with normal SCMI stack.
|
||||
|
||||
This will allow regular SCMI drivers to register with the core and
|
||||
operate normally, thing which could make an SCMI test suite using the
|
||||
SCMI Raw mode support unreliable. If unsure, say N.
|
||||
|
||||
config ARM_SCMI_HAVE_TRANSPORT
|
||||
bool
|
||||
help
|
||||
|
@ -1,6 +1,9 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
scmi-bus-y = bus.o
|
||||
scmi-core-objs := $(scmi-bus-y)
|
||||
|
||||
scmi-driver-y = driver.o notify.o
|
||||
scmi-driver-$(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT) += raw_mode.o
|
||||
scmi-transport-$(CONFIG_ARM_SCMI_HAVE_SHMEM) = shmem.o
|
||||
scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_MAILBOX) += mailbox.o
|
||||
scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_SMC) += smc.o
|
||||
@ -8,9 +11,11 @@ scmi-transport-$(CONFIG_ARM_SCMI_HAVE_MSG) += msg.o
|
||||
scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_VIRTIO) += virtio.o
|
||||
scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_OPTEE) += optee.o
|
||||
scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o system.o voltage.o powercap.o
|
||||
scmi-module-objs := $(scmi-bus-y) $(scmi-driver-y) $(scmi-protocols-y) \
|
||||
$(scmi-transport-y)
|
||||
scmi-module-objs := $(scmi-driver-y) $(scmi-protocols-y) $(scmi-transport-y)
|
||||
|
||||
obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-core.o
|
||||
obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-module.o
|
||||
|
||||
obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o
|
||||
obj-$(CONFIG_ARM_SCMI_POWER_CONTROL) += scmi_power_control.o
|
||||
|
||||
|
@ -7,8 +7,10 @@
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/device.h>
|
||||
@ -16,9 +18,174 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
BLOCKING_NOTIFIER_HEAD(scmi_requested_devices_nh);
|
||||
EXPORT_SYMBOL_GPL(scmi_requested_devices_nh);
|
||||
|
||||
static DEFINE_IDA(scmi_bus_id);
|
||||
static DEFINE_IDR(scmi_protocols);
|
||||
static DEFINE_SPINLOCK(protocol_lock);
|
||||
|
||||
static DEFINE_IDR(scmi_requested_devices);
|
||||
/* Protect access to scmi_requested_devices */
|
||||
static DEFINE_MUTEX(scmi_requested_devices_mtx);
|
||||
|
||||
struct scmi_requested_dev {
|
||||
const struct scmi_device_id *id_table;
|
||||
struct list_head node;
|
||||
};
|
||||
|
||||
/* Track globally the creation of SCMI SystemPower related devices */
|
||||
static atomic_t scmi_syspower_registered = ATOMIC_INIT(0);
|
||||
|
||||
/**
|
||||
* scmi_protocol_device_request - Helper to request a device
|
||||
*
|
||||
* @id_table: A protocol/name pair descriptor for the device to be created.
|
||||
*
|
||||
* This helper let an SCMI driver request specific devices identified by the
|
||||
* @id_table to be created for each active SCMI instance.
|
||||
*
|
||||
* The requested device name MUST NOT be already existent for any protocol;
|
||||
* at first the freshly requested @id_table is annotated in the IDR table
|
||||
* @scmi_requested_devices and then the requested device is advertised to any
|
||||
* registered party via the @scmi_requested_devices_nh notification chain.
|
||||
*
|
||||
* Return: 0 on Success
|
||||
*/
|
||||
static int scmi_protocol_device_request(const struct scmi_device_id *id_table)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int id = 0;
|
||||
struct list_head *head, *phead = NULL;
|
||||
struct scmi_requested_dev *rdev;
|
||||
|
||||
pr_debug("Requesting SCMI device (%s) for protocol %x\n",
|
||||
id_table->name, id_table->protocol_id);
|
||||
|
||||
if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT) &&
|
||||
!IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT_COEX)) {
|
||||
pr_warn("SCMI Raw mode active. Rejecting '%s'/0x%02X\n",
|
||||
id_table->name, id_table->protocol_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Search for the matching protocol rdev list and then search
|
||||
* of any existent equally named device...fails if any duplicate found.
|
||||
*/
|
||||
mutex_lock(&scmi_requested_devices_mtx);
|
||||
idr_for_each_entry(&scmi_requested_devices, head, id) {
|
||||
if (!phead) {
|
||||
/* A list found registered in the IDR is never empty */
|
||||
rdev = list_first_entry(head, struct scmi_requested_dev,
|
||||
node);
|
||||
if (rdev->id_table->protocol_id ==
|
||||
id_table->protocol_id)
|
||||
phead = head;
|
||||
}
|
||||
list_for_each_entry(rdev, head, node) {
|
||||
if (!strcmp(rdev->id_table->name, id_table->name)) {
|
||||
pr_err("Ignoring duplicate request [%d] %s\n",
|
||||
rdev->id_table->protocol_id,
|
||||
rdev->id_table->name);
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* No duplicate found for requested id_table, so let's create a new
|
||||
* requested device entry for this new valid request.
|
||||
*/
|
||||
rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
|
||||
if (!rdev) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
rdev->id_table = id_table;
|
||||
|
||||
/*
|
||||
* Append the new requested device table descriptor to the head of the
|
||||
* related protocol list, eventually creating such head if not already
|
||||
* there.
|
||||
*/
|
||||
if (!phead) {
|
||||
phead = kzalloc(sizeof(*phead), GFP_KERNEL);
|
||||
if (!phead) {
|
||||
kfree(rdev);
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
INIT_LIST_HEAD(phead);
|
||||
|
||||
ret = idr_alloc(&scmi_requested_devices, (void *)phead,
|
||||
id_table->protocol_id,
|
||||
id_table->protocol_id + 1, GFP_KERNEL);
|
||||
if (ret != id_table->protocol_id) {
|
||||
pr_err("Failed to save SCMI device - ret:%d\n", ret);
|
||||
kfree(rdev);
|
||||
kfree(phead);
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
list_add(&rdev->node, phead);
|
||||
|
||||
out:
|
||||
mutex_unlock(&scmi_requested_devices_mtx);
|
||||
|
||||
if (!ret)
|
||||
blocking_notifier_call_chain(&scmi_requested_devices_nh,
|
||||
SCMI_BUS_NOTIFY_DEVICE_REQUEST,
|
||||
(void *)rdev->id_table);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* scmi_protocol_device_unrequest - Helper to unrequest a device
|
||||
*
|
||||
* @id_table: A protocol/name pair descriptor for the device to be unrequested.
|
||||
*
|
||||
* The unrequested device, described by the provided id_table, is at first
|
||||
* removed from the IDR @scmi_requested_devices and then the removal is
|
||||
* advertised to any registered party via the @scmi_requested_devices_nh
|
||||
* notification chain.
|
||||
*/
|
||||
static void scmi_protocol_device_unrequest(const struct scmi_device_id *id_table)
|
||||
{
|
||||
struct list_head *phead;
|
||||
|
||||
pr_debug("Unrequesting SCMI device (%s) for protocol %x\n",
|
||||
id_table->name, id_table->protocol_id);
|
||||
|
||||
mutex_lock(&scmi_requested_devices_mtx);
|
||||
phead = idr_find(&scmi_requested_devices, id_table->protocol_id);
|
||||
if (phead) {
|
||||
struct scmi_requested_dev *victim, *tmp;
|
||||
|
||||
list_for_each_entry_safe(victim, tmp, phead, node) {
|
||||
if (!strcmp(victim->id_table->name, id_table->name)) {
|
||||
list_del(&victim->node);
|
||||
|
||||
mutex_unlock(&scmi_requested_devices_mtx);
|
||||
blocking_notifier_call_chain(&scmi_requested_devices_nh,
|
||||
SCMI_BUS_NOTIFY_DEVICE_UNREQUEST,
|
||||
(void *)victim->id_table);
|
||||
kfree(victim);
|
||||
mutex_lock(&scmi_requested_devices_mtx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (list_empty(phead)) {
|
||||
idr_remove(&scmi_requested_devices,
|
||||
id_table->protocol_id);
|
||||
kfree(phead);
|
||||
}
|
||||
}
|
||||
mutex_unlock(&scmi_requested_devices_mtx);
|
||||
}
|
||||
|
||||
static const struct scmi_device_id *
|
||||
scmi_dev_match_id(struct scmi_device *scmi_dev, struct scmi_driver *scmi_drv)
|
||||
@ -58,11 +225,11 @@ static int scmi_match_by_id_table(struct device *dev, void *data)
|
||||
struct scmi_device_id *id_table = data;
|
||||
|
||||
return sdev->protocol_id == id_table->protocol_id &&
|
||||
!strcmp(sdev->name, id_table->name);
|
||||
(id_table->name && !strcmp(sdev->name, id_table->name));
|
||||
}
|
||||
|
||||
struct scmi_device *scmi_child_dev_find(struct device *parent,
|
||||
int prot_id, const char *name)
|
||||
static struct scmi_device *scmi_child_dev_find(struct device *parent,
|
||||
int prot_id, const char *name)
|
||||
{
|
||||
struct scmi_device_id id_table;
|
||||
struct device *dev;
|
||||
@ -77,30 +244,6 @@ struct scmi_device *scmi_child_dev_find(struct device *parent,
|
||||
return to_scmi_dev(dev);
|
||||
}
|
||||
|
||||
const struct scmi_protocol *scmi_protocol_get(int protocol_id)
|
||||
{
|
||||
const struct scmi_protocol *proto;
|
||||
|
||||
proto = idr_find(&scmi_protocols, protocol_id);
|
||||
if (!proto || !try_module_get(proto->owner)) {
|
||||
pr_warn("SCMI Protocol 0x%x not found!\n", protocol_id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pr_debug("Found SCMI Protocol 0x%x\n", protocol_id);
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
void scmi_protocol_put(int protocol_id)
|
||||
{
|
||||
const struct scmi_protocol *proto;
|
||||
|
||||
proto = idr_find(&scmi_protocols, protocol_id);
|
||||
if (proto)
|
||||
module_put(proto->owner);
|
||||
}
|
||||
|
||||
static int scmi_dev_probe(struct device *dev)
|
||||
{
|
||||
struct scmi_driver *scmi_drv = to_scmi_driver(dev->driver);
|
||||
@ -121,12 +264,13 @@ static void scmi_dev_remove(struct device *dev)
|
||||
scmi_drv->remove(scmi_dev);
|
||||
}
|
||||
|
||||
static struct bus_type scmi_bus_type = {
|
||||
struct bus_type scmi_bus_type = {
|
||||
.name = "scmi_protocol",
|
||||
.match = scmi_dev_match,
|
||||
.probe = scmi_dev_probe,
|
||||
.remove = scmi_dev_remove,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(scmi_bus_type);
|
||||
|
||||
int scmi_driver_register(struct scmi_driver *driver, struct module *owner,
|
||||
const char *mod_name)
|
||||
@ -147,7 +291,7 @@ int scmi_driver_register(struct scmi_driver *driver, struct module *owner,
|
||||
|
||||
retval = driver_register(&driver->driver);
|
||||
if (!retval)
|
||||
pr_debug("registered new scmi driver %s\n", driver->name);
|
||||
pr_debug("Registered new scmi driver %s\n", driver->name);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -165,13 +309,53 @@ static void scmi_device_release(struct device *dev)
|
||||
kfree(to_scmi_dev(dev));
|
||||
}
|
||||
|
||||
struct scmi_device *
|
||||
scmi_device_create(struct device_node *np, struct device *parent, int protocol,
|
||||
const char *name)
|
||||
static void __scmi_device_destroy(struct scmi_device *scmi_dev)
|
||||
{
|
||||
pr_debug("(%s) Destroying SCMI device '%s' for protocol 0x%x (%s)\n",
|
||||
of_node_full_name(scmi_dev->dev.parent->of_node),
|
||||
dev_name(&scmi_dev->dev), scmi_dev->protocol_id,
|
||||
scmi_dev->name);
|
||||
|
||||
if (scmi_dev->protocol_id == SCMI_PROTOCOL_SYSTEM)
|
||||
atomic_set(&scmi_syspower_registered, 0);
|
||||
|
||||
kfree_const(scmi_dev->name);
|
||||
ida_free(&scmi_bus_id, scmi_dev->id);
|
||||
device_unregister(&scmi_dev->dev);
|
||||
}
|
||||
|
||||
static struct scmi_device *
|
||||
__scmi_device_create(struct device_node *np, struct device *parent,
|
||||
int protocol, const char *name)
|
||||
{
|
||||
int id, retval;
|
||||
struct scmi_device *scmi_dev;
|
||||
|
||||
/*
|
||||
* If the same protocol/name device already exist under the same parent
|
||||
* (i.e. SCMI instance) just return the existent device.
|
||||
* This avoids any race between the SCMI driver, creating devices for
|
||||
* each DT defined protocol at probe time, and the concurrent
|
||||
* registration of SCMI drivers.
|
||||
*/
|
||||
scmi_dev = scmi_child_dev_find(parent, protocol, name);
|
||||
if (scmi_dev)
|
||||
return scmi_dev;
|
||||
|
||||
/*
|
||||
* Ignore any possible subsequent failures while creating the device
|
||||
* since we are doomed anyway at that point; not using a mutex which
|
||||
* spans across this whole function to keep things simple and to avoid
|
||||
* to serialize all the __scmi_device_create calls across possibly
|
||||
* different SCMI server instances (parent)
|
||||
*/
|
||||
if (protocol == SCMI_PROTOCOL_SYSTEM &&
|
||||
atomic_cmpxchg(&scmi_syspower_registered, 0, 1)) {
|
||||
dev_warn(parent,
|
||||
"SCMI SystemPower protocol device must be unique !\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scmi_dev = kzalloc(sizeof(*scmi_dev), GFP_KERNEL);
|
||||
if (!scmi_dev)
|
||||
return NULL;
|
||||
@ -201,6 +385,10 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol,
|
||||
if (retval)
|
||||
goto put_dev;
|
||||
|
||||
pr_debug("(%s) Created SCMI device '%s' for protocol 0x%x (%s)\n",
|
||||
of_node_full_name(parent->of_node),
|
||||
dev_name(&scmi_dev->dev), protocol, name);
|
||||
|
||||
return scmi_dev;
|
||||
put_dev:
|
||||
kfree_const(scmi_dev->name);
|
||||
@ -209,77 +397,85 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void scmi_device_destroy(struct scmi_device *scmi_dev)
|
||||
/**
|
||||
* scmi_device_create - A method to create one or more SCMI devices
|
||||
*
|
||||
* @np: A reference to the device node to use for the new device(s)
|
||||
* @parent: The parent device to use identifying a specific SCMI instance
|
||||
* @protocol: The SCMI protocol to be associated with this device
|
||||
* @name: The requested-name of the device to be created; this is optional
|
||||
* and if no @name is provided, all the devices currently known to
|
||||
* be requested on the SCMI bus for @protocol will be created.
|
||||
*
|
||||
* This method can be invoked to create a single well-defined device (like
|
||||
* a transport device or a device requested by an SCMI driver loaded after
|
||||
* the core SCMI stack has been probed), or to create all the devices currently
|
||||
* known to have been requested by the loaded SCMI drivers for a specific
|
||||
* protocol (typically during SCMI core protocol enumeration at probe time).
|
||||
*
|
||||
* Return: The created device (or one of them if @name was NOT provided and
|
||||
* multiple devices were created) or NULL if no device was created;
|
||||
* note that NULL indicates an error ONLY in case a specific @name
|
||||
* was provided: when @name param was not provided, a number of devices
|
||||
* could have been potentially created for a whole protocol, unless no
|
||||
* device was found to have been requested for that specific protocol.
|
||||
*/
|
||||
struct scmi_device *scmi_device_create(struct device_node *np,
|
||||
struct device *parent, int protocol,
|
||||
const char *name)
|
||||
{
|
||||
kfree_const(scmi_dev->name);
|
||||
scmi_handle_put(scmi_dev->handle);
|
||||
ida_free(&scmi_bus_id, scmi_dev->id);
|
||||
device_unregister(&scmi_dev->dev);
|
||||
}
|
||||
struct list_head *phead;
|
||||
struct scmi_requested_dev *rdev;
|
||||
struct scmi_device *scmi_dev = NULL;
|
||||
|
||||
void scmi_device_link_add(struct device *consumer, struct device *supplier)
|
||||
{
|
||||
struct device_link *link;
|
||||
if (name)
|
||||
return __scmi_device_create(np, parent, protocol, name);
|
||||
|
||||
link = device_link_add(consumer, supplier, DL_FLAG_AUTOREMOVE_CONSUMER);
|
||||
|
||||
WARN_ON(!link);
|
||||
}
|
||||
|
||||
void scmi_set_handle(struct scmi_device *scmi_dev)
|
||||
{
|
||||
scmi_dev->handle = scmi_handle_get(&scmi_dev->dev);
|
||||
if (scmi_dev->handle)
|
||||
scmi_device_link_add(&scmi_dev->dev, scmi_dev->handle->dev);
|
||||
}
|
||||
|
||||
int scmi_protocol_register(const struct scmi_protocol *proto)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!proto) {
|
||||
pr_err("invalid protocol\n");
|
||||
return -EINVAL;
|
||||
mutex_lock(&scmi_requested_devices_mtx);
|
||||
phead = idr_find(&scmi_requested_devices, protocol);
|
||||
/* Nothing to do. */
|
||||
if (!phead) {
|
||||
mutex_unlock(&scmi_requested_devices_mtx);
|
||||
return scmi_dev;
|
||||
}
|
||||
|
||||
if (!proto->instance_init) {
|
||||
pr_err("missing init for protocol 0x%x\n", proto->id);
|
||||
return -EINVAL;
|
||||
/* Walk the list of requested devices for protocol and create them */
|
||||
list_for_each_entry(rdev, phead, node) {
|
||||
struct scmi_device *sdev;
|
||||
|
||||
sdev = __scmi_device_create(np, parent,
|
||||
rdev->id_table->protocol_id,
|
||||
rdev->id_table->name);
|
||||
/* Report errors and carry on... */
|
||||
if (sdev)
|
||||
scmi_dev = sdev;
|
||||
else
|
||||
pr_err("(%s) Failed to create device for protocol 0x%x (%s)\n",
|
||||
of_node_full_name(parent->of_node),
|
||||
rdev->id_table->protocol_id,
|
||||
rdev->id_table->name);
|
||||
}
|
||||
mutex_unlock(&scmi_requested_devices_mtx);
|
||||
|
||||
spin_lock(&protocol_lock);
|
||||
ret = idr_alloc(&scmi_protocols, (void *)proto,
|
||||
proto->id, proto->id + 1, GFP_ATOMIC);
|
||||
spin_unlock(&protocol_lock);
|
||||
if (ret != proto->id) {
|
||||
pr_err("unable to allocate SCMI idr slot for 0x%x - err %d\n",
|
||||
proto->id, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pr_debug("Registered SCMI Protocol 0x%x\n", proto->id);
|
||||
|
||||
return 0;
|
||||
return scmi_dev;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(scmi_protocol_register);
|
||||
EXPORT_SYMBOL_GPL(scmi_device_create);
|
||||
|
||||
void scmi_protocol_unregister(const struct scmi_protocol *proto)
|
||||
void scmi_device_destroy(struct device *parent, int protocol, const char *name)
|
||||
{
|
||||
spin_lock(&protocol_lock);
|
||||
idr_remove(&scmi_protocols, proto->id);
|
||||
spin_unlock(&protocol_lock);
|
||||
struct scmi_device *scmi_dev;
|
||||
|
||||
pr_debug("Unregistered SCMI Protocol 0x%x\n", proto->id);
|
||||
|
||||
return;
|
||||
scmi_dev = scmi_child_dev_find(parent, protocol, name);
|
||||
if (scmi_dev)
|
||||
__scmi_device_destroy(scmi_dev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(scmi_protocol_unregister);
|
||||
EXPORT_SYMBOL_GPL(scmi_device_destroy);
|
||||
|
||||
static int __scmi_devices_unregister(struct device *dev, void *data)
|
||||
{
|
||||
struct scmi_device *scmi_dev = to_scmi_dev(dev);
|
||||
|
||||
scmi_device_destroy(scmi_dev);
|
||||
__scmi_device_destroy(scmi_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -288,20 +484,33 @@ static void scmi_devices_unregister(void)
|
||||
bus_for_each_dev(&scmi_bus_type, NULL, NULL, __scmi_devices_unregister);
|
||||
}
|
||||
|
||||
int __init scmi_bus_init(void)
|
||||
static int __init scmi_bus_init(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = bus_register(&scmi_bus_type);
|
||||
if (retval)
|
||||
pr_err("scmi protocol bus register failed (%d)\n", retval);
|
||||
pr_err("SCMI protocol bus register failed (%d)\n", retval);
|
||||
|
||||
pr_info("SCMI protocol bus registered\n");
|
||||
|
||||
return retval;
|
||||
}
|
||||
subsys_initcall(scmi_bus_init);
|
||||
|
||||
void __exit scmi_bus_exit(void)
|
||||
static void __exit scmi_bus_exit(void)
|
||||
{
|
||||
/*
|
||||
* Destroy all remaining devices: just in case the drivers were
|
||||
* manually unbound and at first and then the modules unloaded.
|
||||
*/
|
||||
scmi_devices_unregister();
|
||||
bus_unregister(&scmi_bus_type);
|
||||
ida_destroy(&scmi_bus_id);
|
||||
}
|
||||
module_exit(scmi_bus_exit);
|
||||
|
||||
MODULE_ALIAS("scmi-core");
|
||||
MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>");
|
||||
MODULE_DESCRIPTION("ARM SCMI protocol bus");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -27,6 +27,48 @@
|
||||
#include "protocols.h"
|
||||
#include "notify.h"
|
||||
|
||||
#define SCMI_MAX_CHANNELS 256
|
||||
|
||||
#define SCMI_MAX_RESPONSE_TIMEOUT (2 * MSEC_PER_SEC)
|
||||
|
||||
enum scmi_error_codes {
|
||||
SCMI_SUCCESS = 0, /* Success */
|
||||
SCMI_ERR_SUPPORT = -1, /* Not supported */
|
||||
SCMI_ERR_PARAMS = -2, /* Invalid Parameters */
|
||||
SCMI_ERR_ACCESS = -3, /* Invalid access/permission denied */
|
||||
SCMI_ERR_ENTRY = -4, /* Not found */
|
||||
SCMI_ERR_RANGE = -5, /* Value out of range */
|
||||
SCMI_ERR_BUSY = -6, /* Device busy */
|
||||
SCMI_ERR_COMMS = -7, /* Communication Error */
|
||||
SCMI_ERR_GENERIC = -8, /* Generic Error */
|
||||
SCMI_ERR_HARDWARE = -9, /* Hardware Error */
|
||||
SCMI_ERR_PROTOCOL = -10,/* Protocol Error */
|
||||
};
|
||||
|
||||
static const int scmi_linux_errmap[] = {
|
||||
/* better than switch case as long as return value is continuous */
|
||||
0, /* SCMI_SUCCESS */
|
||||
-EOPNOTSUPP, /* SCMI_ERR_SUPPORT */
|
||||
-EINVAL, /* SCMI_ERR_PARAM */
|
||||
-EACCES, /* SCMI_ERR_ACCESS */
|
||||
-ENOENT, /* SCMI_ERR_ENTRY */
|
||||
-ERANGE, /* SCMI_ERR_RANGE */
|
||||
-EBUSY, /* SCMI_ERR_BUSY */
|
||||
-ECOMM, /* SCMI_ERR_COMMS */
|
||||
-EIO, /* SCMI_ERR_GENERIC */
|
||||
-EREMOTEIO, /* SCMI_ERR_HARDWARE */
|
||||
-EPROTO, /* SCMI_ERR_PROTOCOL */
|
||||
};
|
||||
|
||||
static inline int scmi_to_linux_errno(int errno)
|
||||
{
|
||||
int err_idx = -errno;
|
||||
|
||||
if (err_idx >= SCMI_SUCCESS && err_idx < ARRAY_SIZE(scmi_linux_errmap))
|
||||
return scmi_linux_errmap[err_idx];
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
#define MSG_ID_MASK GENMASK(7, 0)
|
||||
#define MSG_XTRACT_ID(hdr) FIELD_GET(MSG_ID_MASK, (hdr))
|
||||
#define MSG_TYPE_MASK GENMASK(9, 8)
|
||||
@ -96,18 +138,19 @@ static inline void unpack_scmi_header(u32 msg_hdr, struct scmi_msg_hdr *hdr)
|
||||
|
||||
struct scmi_revision_info *
|
||||
scmi_revision_area_get(const struct scmi_protocol_handle *ph);
|
||||
int scmi_handle_put(const struct scmi_handle *handle);
|
||||
void scmi_device_link_add(struct device *consumer, struct device *supplier);
|
||||
struct scmi_handle *scmi_handle_get(struct device *dev);
|
||||
void scmi_set_handle(struct scmi_device *scmi_dev);
|
||||
void scmi_setup_protocol_implemented(const struct scmi_protocol_handle *ph,
|
||||
u8 *prot_imp);
|
||||
|
||||
int __init scmi_bus_init(void);
|
||||
void __exit scmi_bus_exit(void);
|
||||
extern struct bus_type scmi_bus_type;
|
||||
|
||||
const struct scmi_protocol *scmi_protocol_get(int protocol_id);
|
||||
void scmi_protocol_put(int protocol_id);
|
||||
#define SCMI_BUS_NOTIFY_DEVICE_REQUEST 0
|
||||
#define SCMI_BUS_NOTIFY_DEVICE_UNREQUEST 1
|
||||
extern struct blocking_notifier_head scmi_requested_devices_nh;
|
||||
|
||||
struct scmi_device *scmi_device_create(struct device_node *np,
|
||||
struct device *parent, int protocol,
|
||||
const char *name);
|
||||
void scmi_device_destroy(struct device *parent, int protocol, const char *name);
|
||||
|
||||
int scmi_protocol_acquire(const struct scmi_handle *handle, u8 protocol_id);
|
||||
void scmi_protocol_release(const struct scmi_handle *handle, u8 protocol_id);
|
||||
@ -116,6 +159,8 @@ void scmi_protocol_release(const struct scmi_handle *handle, u8 protocol_id);
|
||||
/**
|
||||
* struct scmi_chan_info - Structure representing a SCMI channel information
|
||||
*
|
||||
* @id: An identifier for this channel: this matches the protocol number
|
||||
* used to initialize this channel
|
||||
* @dev: Reference to device in the SCMI hierarchy corresponding to this
|
||||
* channel
|
||||
* @rx_timeout_ms: The configured RX timeout in milliseconds.
|
||||
@ -127,6 +172,7 @@ void scmi_protocol_release(const struct scmi_handle *handle, u8 protocol_id);
|
||||
* @transport_info: Transport layer related information
|
||||
*/
|
||||
struct scmi_chan_info {
|
||||
int id;
|
||||
struct device *dev;
|
||||
unsigned int rx_timeout_ms;
|
||||
struct scmi_handle *handle;
|
||||
@ -153,7 +199,7 @@ struct scmi_chan_info {
|
||||
*/
|
||||
struct scmi_transport_ops {
|
||||
int (*link_supplier)(struct device *dev);
|
||||
bool (*chan_available)(struct device *dev, int idx);
|
||||
bool (*chan_available)(struct device_node *of_node, int idx);
|
||||
int (*chan_setup)(struct scmi_chan_info *cinfo, struct device *dev,
|
||||
bool tx);
|
||||
int (*chan_free)(int id, void *p, void *data);
|
||||
@ -170,11 +216,6 @@ struct scmi_transport_ops {
|
||||
bool (*poll_done)(struct scmi_chan_info *cinfo, struct scmi_xfer *xfer);
|
||||
};
|
||||
|
||||
int scmi_protocol_device_request(const struct scmi_device_id *id_table);
|
||||
void scmi_protocol_device_unrequest(const struct scmi_device_id *id_table);
|
||||
struct scmi_device *scmi_child_dev_find(struct device *parent,
|
||||
int prot_id, const char *name);
|
||||
|
||||
/**
|
||||
* struct scmi_desc - Description of SoC integration
|
||||
*
|
||||
@ -215,6 +256,36 @@ struct scmi_desc {
|
||||
const bool atomic_enabled;
|
||||
};
|
||||
|
||||
static inline bool is_polling_required(struct scmi_chan_info *cinfo,
|
||||
const struct scmi_desc *desc)
|
||||
{
|
||||
return cinfo->no_completion_irq || desc->force_polling;
|
||||
}
|
||||
|
||||
static inline bool is_transport_polling_capable(const struct scmi_desc *desc)
|
||||
{
|
||||
return desc->ops->poll_done || desc->sync_cmds_completed_on_ret;
|
||||
}
|
||||
|
||||
static inline bool is_polling_enabled(struct scmi_chan_info *cinfo,
|
||||
const struct scmi_desc *desc)
|
||||
{
|
||||
return is_polling_required(cinfo, desc) &&
|
||||
is_transport_polling_capable(desc);
|
||||
}
|
||||
|
||||
void scmi_xfer_raw_put(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *xfer);
|
||||
struct scmi_xfer *scmi_xfer_raw_get(const struct scmi_handle *handle);
|
||||
struct scmi_chan_info *
|
||||
scmi_xfer_raw_channel_get(const struct scmi_handle *handle, u8 protocol_id);
|
||||
|
||||
int scmi_xfer_raw_inflight_register(const struct scmi_handle *handle,
|
||||
struct scmi_xfer *xfer);
|
||||
|
||||
int scmi_xfer_raw_wait_for_message_response(struct scmi_chan_info *cinfo,
|
||||
struct scmi_xfer *xfer,
|
||||
unsigned int timeout_ms);
|
||||
#ifdef CONFIG_ARM_SCMI_TRANSPORT_MAILBOX
|
||||
extern const struct scmi_desc scmi_mailbox_desc;
|
||||
#endif
|
||||
@ -229,7 +300,6 @@ extern const struct scmi_desc scmi_optee_desc;
|
||||
#endif
|
||||
|
||||
void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv);
|
||||
void scmi_free_channel(struct scmi_chan_info *cinfo, struct idr *idr, int id);
|
||||
|
||||
/* shmem related declarations */
|
||||
struct scmi_shared_mem;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -46,9 +46,9 @@ static void rx_callback(struct mbox_client *cl, void *m)
|
||||
scmi_rx_callback(smbox->cinfo, shmem_read_header(smbox->shmem), NULL);
|
||||
}
|
||||
|
||||
static bool mailbox_chan_available(struct device *dev, int idx)
|
||||
static bool mailbox_chan_available(struct device_node *of_node, int idx)
|
||||
{
|
||||
return !of_parse_phandle_with_args(dev->of_node, "mboxes",
|
||||
return !of_parse_phandle_with_args(of_node, "mboxes",
|
||||
"#mbox-cells", idx, NULL);
|
||||
}
|
||||
|
||||
@ -120,8 +120,6 @@ static int mailbox_chan_free(int id, void *p, void *data)
|
||||
smbox->cinfo = NULL;
|
||||
}
|
||||
|
||||
scmi_free_channel(cinfo, data, id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -328,11 +328,11 @@ static int scmi_optee_link_supplier(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool scmi_optee_chan_available(struct device *dev, int idx)
|
||||
static bool scmi_optee_chan_available(struct device_node *of_node, int idx)
|
||||
{
|
||||
u32 channel_id;
|
||||
|
||||
return !of_property_read_u32_index(dev->of_node, "linaro,optee-channel-id",
|
||||
return !of_property_read_u32_index(of_node, "linaro,optee-channel-id",
|
||||
idx, &channel_id);
|
||||
}
|
||||
|
||||
@ -481,8 +481,6 @@ static int scmi_optee_chan_free(int id, void *p, void *data)
|
||||
cinfo->transport_info = NULL;
|
||||
channel->cinfo = NULL;
|
||||
|
||||
scmi_free_channel(cinfo, data, id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,7 @@ struct scmi_msg_hdr {
|
||||
* - SCMI_XFER_SENT_OK -> SCMI_XFER_RESP_OK [ -> SCMI_XFER_DRESP_OK ]
|
||||
* - SCMI_XFER_SENT_OK -> SCMI_XFER_DRESP_OK
|
||||
* (Missing synchronous response is assumed OK and ignored)
|
||||
* @flags: Optional flags associated to this xfer.
|
||||
* @lock: A spinlock to protect state and busy fields.
|
||||
* @priv: A pointer for transport private usage.
|
||||
*/
|
||||
@ -135,6 +136,12 @@ struct scmi_xfer {
|
||||
#define SCMI_XFER_RESP_OK 1
|
||||
#define SCMI_XFER_DRESP_OK 2
|
||||
int state;
|
||||
#define SCMI_XFER_FLAG_IS_RAW BIT(0)
|
||||
#define SCMI_XFER_IS_RAW(x) ((x)->flags & SCMI_XFER_FLAG_IS_RAW)
|
||||
#define SCMI_XFER_FLAG_CHAN_SET BIT(1)
|
||||
#define SCMI_XFER_IS_CHAN_SET(x) \
|
||||
((x)->flags & SCMI_XFER_FLAG_CHAN_SET)
|
||||
int flags;
|
||||
/* A lock to protect state and busy fields */
|
||||
spinlock_t lock;
|
||||
void *priv;
|
||||
|
1443
drivers/firmware/arm_scmi/raw_mode.c
Normal file
1443
drivers/firmware/arm_scmi/raw_mode.c
Normal file
File diff suppressed because it is too large
Load Diff
31
drivers/firmware/arm_scmi/raw_mode.h
Normal file
31
drivers/firmware/arm_scmi/raw_mode.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* System Control and Management Interface (SCMI) Message Protocol
|
||||
* Raw mode support header.
|
||||
*
|
||||
* Copyright (C) 2022 ARM Ltd.
|
||||
*/
|
||||
#ifndef _SCMI_RAW_MODE_H
|
||||
#define _SCMI_RAW_MODE_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
enum {
|
||||
SCMI_RAW_REPLY_QUEUE,
|
||||
SCMI_RAW_NOTIF_QUEUE,
|
||||
SCMI_RAW_ERRS_QUEUE,
|
||||
SCMI_RAW_MAX_QUEUE
|
||||
};
|
||||
|
||||
void *scmi_raw_mode_init(const struct scmi_handle *handle,
|
||||
struct dentry *top_dentry, int instance_id,
|
||||
u8 *channels, int num_chans,
|
||||
const struct scmi_desc *desc, int tx_max_msg);
|
||||
void scmi_raw_mode_cleanup(void *raw);
|
||||
|
||||
void scmi_raw_message_report(void *raw, struct scmi_xfer *xfer,
|
||||
unsigned int idx, unsigned int chan_id);
|
||||
void scmi_raw_error_report(void *raw, struct scmi_chan_info *cinfo,
|
||||
u32 msg_hdr, void *priv);
|
||||
|
||||
#endif /* _SCMI_RAW_MODE_H */
|
@ -52,9 +52,9 @@ static irqreturn_t smc_msg_done_isr(int irq, void *data)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static bool smc_chan_available(struct device *dev, int idx)
|
||||
static bool smc_chan_available(struct device_node *of_node, int idx)
|
||||
{
|
||||
struct device_node *np = of_parse_phandle(dev->of_node, "shmem", 0);
|
||||
struct device_node *np = of_parse_phandle(of_node, "shmem", 0);
|
||||
if (!np)
|
||||
return false;
|
||||
|
||||
@ -171,8 +171,6 @@ static int smc_chan_free(int id, void *p, void *data)
|
||||
cinfo->transport_info = NULL;
|
||||
scmi_info->cinfo = NULL;
|
||||
|
||||
scmi_free_channel(cinfo, data, id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ static int virtio_link_supplier(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool virtio_chan_available(struct device *dev, int idx)
|
||||
static bool virtio_chan_available(struct device_node *of_node, int idx)
|
||||
{
|
||||
struct scmi_vio_channel *channels, *vioch = NULL;
|
||||
|
||||
@ -489,8 +489,6 @@ static int virtio_chan_free(int id, void *p, void *data)
|
||||
virtio_break_device(vioch->vqueue->vdev);
|
||||
scmi_vio_channel_cleanup_sync(vioch);
|
||||
|
||||
scmi_free_channel(cinfo, data, id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ static void __iomem *meson_sm_map_shmem(u32 cmd_shmem, unsigned int size)
|
||||
|
||||
sm_phy_base = __meson_sm_call(cmd_shmem, 0, 0, 0, 0, 0);
|
||||
if (!sm_phy_base)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
return ioremap_cache(sm_phy_base, size);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/arm-smccc.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/arm-smccc.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
@ -52,29 +52,97 @@ static void __scm_smc_do_quirk(const struct arm_smccc_args *smc,
|
||||
} while (res->a0 == QCOM_SCM_INTERRUPTED);
|
||||
}
|
||||
|
||||
static void __scm_smc_do(const struct arm_smccc_args *smc,
|
||||
struct arm_smccc_res *res, bool atomic)
|
||||
static void fill_wq_resume_args(struct arm_smccc_args *resume, u32 smc_call_ctx)
|
||||
{
|
||||
int retry_count = 0;
|
||||
memset(resume->args, 0, sizeof(resume->args[0]) * ARRAY_SIZE(resume->args));
|
||||
|
||||
resume->args[0] = ARM_SMCCC_CALL_VAL(ARM_SMCCC_STD_CALL,
|
||||
ARM_SMCCC_SMC_64, ARM_SMCCC_OWNER_SIP,
|
||||
SCM_SMC_FNID(QCOM_SCM_SVC_WAITQ, QCOM_SCM_WAITQ_RESUME));
|
||||
|
||||
resume->args[1] = QCOM_SCM_ARGS(1);
|
||||
|
||||
resume->args[2] = smc_call_ctx;
|
||||
}
|
||||
|
||||
int scm_get_wq_ctx(u32 *wq_ctx, u32 *flags, u32 *more_pending)
|
||||
{
|
||||
int ret;
|
||||
struct arm_smccc_res get_wq_res;
|
||||
struct arm_smccc_args get_wq_ctx = {0};
|
||||
|
||||
get_wq_ctx.args[0] = ARM_SMCCC_CALL_VAL(ARM_SMCCC_STD_CALL,
|
||||
ARM_SMCCC_SMC_64, ARM_SMCCC_OWNER_SIP,
|
||||
SCM_SMC_FNID(QCOM_SCM_SVC_WAITQ, QCOM_SCM_WAITQ_GET_WQ_CTX));
|
||||
|
||||
/* Guaranteed to return only success or error, no WAITQ_* */
|
||||
__scm_smc_do_quirk(&get_wq_ctx, &get_wq_res);
|
||||
ret = get_wq_res.a0;
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*wq_ctx = get_wq_res.a1;
|
||||
*flags = get_wq_res.a2;
|
||||
*more_pending = get_wq_res.a3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __scm_smc_do_quirk_handle_waitq(struct device *dev, struct arm_smccc_args *waitq,
|
||||
struct arm_smccc_res *res)
|
||||
{
|
||||
int ret;
|
||||
u32 wq_ctx, smc_call_ctx;
|
||||
struct arm_smccc_args resume;
|
||||
struct arm_smccc_args *smc = waitq;
|
||||
|
||||
do {
|
||||
__scm_smc_do_quirk(smc, res);
|
||||
|
||||
if (res->a0 == QCOM_SCM_WAITQ_SLEEP) {
|
||||
wq_ctx = res->a1;
|
||||
smc_call_ctx = res->a2;
|
||||
|
||||
ret = qcom_scm_wait_for_wq_completion(wq_ctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fill_wq_resume_args(&resume, smc_call_ctx);
|
||||
smc = &resume;
|
||||
}
|
||||
} while (res->a0 == QCOM_SCM_WAITQ_SLEEP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __scm_smc_do(struct device *dev, struct arm_smccc_args *smc,
|
||||
struct arm_smccc_res *res, bool atomic)
|
||||
{
|
||||
int ret, retry_count = 0;
|
||||
|
||||
if (atomic) {
|
||||
__scm_smc_do_quirk(smc, res);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
do {
|
||||
mutex_lock(&qcom_scm_lock);
|
||||
|
||||
__scm_smc_do_quirk(smc, res);
|
||||
ret = __scm_smc_do_quirk_handle_waitq(dev, smc, res);
|
||||
|
||||
mutex_unlock(&qcom_scm_lock);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (res->a0 == QCOM_SCM_V2_EBUSY) {
|
||||
if (retry_count++ > QCOM_SCM_EBUSY_MAX_RETRY)
|
||||
break;
|
||||
msleep(QCOM_SCM_EBUSY_WAIT_MS);
|
||||
}
|
||||
} while (res->a0 == QCOM_SCM_V2_EBUSY);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +151,7 @@ int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc,
|
||||
struct qcom_scm_res *res, bool atomic)
|
||||
{
|
||||
int arglen = desc->arginfo & 0xf;
|
||||
int i;
|
||||
int i, ret;
|
||||
dma_addr_t args_phys = 0;
|
||||
void *args_virt = NULL;
|
||||
size_t alloc_len;
|
||||
@ -135,13 +203,17 @@ int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc,
|
||||
smc.args[SCM_SMC_LAST_REG_IDX] = args_phys;
|
||||
}
|
||||
|
||||
__scm_smc_do(&smc, &smc_res, atomic);
|
||||
/* ret error check follows after args_virt cleanup*/
|
||||
ret = __scm_smc_do(dev, &smc, &smc_res, atomic);
|
||||
|
||||
if (args_virt) {
|
||||
dma_unmap_single(dev, args_phys, alloc_len, DMA_TO_DEVICE);
|
||||
kfree(args_virt);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (res) {
|
||||
res->result[0] = smc_res.a1;
|
||||
res->result[1] = smc_res.a2;
|
||||
|
@ -4,15 +4,18 @@
|
||||
*/
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/interconnect.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/reset-controller.h>
|
||||
@ -33,6 +36,7 @@ struct qcom_scm {
|
||||
struct clk *iface_clk;
|
||||
struct clk *bus_clk;
|
||||
struct icc_path *path;
|
||||
struct completion waitq_comp;
|
||||
struct reset_controller_dev reset;
|
||||
|
||||
/* control access to the interconnect path */
|
||||
@ -63,6 +67,9 @@ static const u8 qcom_scm_cpu_warm_bits[QCOM_SCM_BOOT_MAX_CPUS] = {
|
||||
BIT(2), BIT(1), BIT(4), BIT(6)
|
||||
};
|
||||
|
||||
#define QCOM_SMC_WAITQ_FLAG_WAKE_ONE BIT(0)
|
||||
#define QCOM_SMC_WAITQ_FLAG_WAKE_ALL BIT(1)
|
||||
|
||||
static const char * const qcom_scm_convention_names[] = {
|
||||
[SMC_CONVENTION_UNKNOWN] = "unknown",
|
||||
[SMC_CONVENTION_ARM_32] = "smc arm 32",
|
||||
@ -1325,11 +1332,79 @@ bool qcom_scm_is_available(void)
|
||||
}
|
||||
EXPORT_SYMBOL(qcom_scm_is_available);
|
||||
|
||||
static int qcom_scm_assert_valid_wq_ctx(u32 wq_ctx)
|
||||
{
|
||||
/* FW currently only supports a single wq_ctx (zero).
|
||||
* TODO: Update this logic to include dynamic allocation and lookup of
|
||||
* completion structs when FW supports more wq_ctx values.
|
||||
*/
|
||||
if (wq_ctx != 0) {
|
||||
dev_err(__scm->dev, "Firmware unexpectedly passed non-zero wq_ctx\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qcom_scm_wait_for_wq_completion(u32 wq_ctx)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = qcom_scm_assert_valid_wq_ctx(wq_ctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
wait_for_completion(&__scm->waitq_comp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qcom_scm_waitq_wakeup(struct qcom_scm *scm, unsigned int wq_ctx)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = qcom_scm_assert_valid_wq_ctx(wq_ctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
complete(&__scm->waitq_comp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static irqreturn_t qcom_scm_irq_handler(int irq, void *data)
|
||||
{
|
||||
int ret;
|
||||
struct qcom_scm *scm = data;
|
||||
u32 wq_ctx, flags, more_pending = 0;
|
||||
|
||||
do {
|
||||
ret = scm_get_wq_ctx(&wq_ctx, &flags, &more_pending);
|
||||
if (ret) {
|
||||
dev_err(scm->dev, "GET_WQ_CTX SMC call failed: %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (flags != QCOM_SMC_WAITQ_FLAG_WAKE_ONE &&
|
||||
flags != QCOM_SMC_WAITQ_FLAG_WAKE_ALL) {
|
||||
dev_err(scm->dev, "Invalid flags found for wq_ctx: %u\n", flags);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = qcom_scm_waitq_wakeup(scm, wq_ctx);
|
||||
if (ret)
|
||||
goto out;
|
||||
} while (more_pending);
|
||||
|
||||
out:
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int qcom_scm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct qcom_scm *scm;
|
||||
unsigned long clks;
|
||||
int ret;
|
||||
int irq, ret;
|
||||
|
||||
scm = devm_kzalloc(&pdev->dev, sizeof(*scm), GFP_KERNEL);
|
||||
if (!scm)
|
||||
@ -1402,6 +1477,19 @@ static int qcom_scm_probe(struct platform_device *pdev)
|
||||
__scm = scm;
|
||||
__scm->dev = &pdev->dev;
|
||||
|
||||
init_completion(&__scm->waitq_comp);
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0) {
|
||||
if (irq != -ENXIO)
|
||||
return irq;
|
||||
} else {
|
||||
ret = devm_request_threaded_irq(__scm->dev, irq, NULL, qcom_scm_irq_handler,
|
||||
IRQF_ONESHOT, "qcom-scm", __scm);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(scm->dev, ret, "Failed to request qcom-scm irq\n");
|
||||
}
|
||||
|
||||
__get_convention();
|
||||
|
||||
/*
|
||||
|
@ -60,6 +60,9 @@ struct qcom_scm_res {
|
||||
u64 result[MAX_QCOM_SCM_RETS];
|
||||
};
|
||||
|
||||
int qcom_scm_wait_for_wq_completion(u32 wq_ctx);
|
||||
int scm_get_wq_ctx(u32 *wq_ctx, u32 *flags, u32 *more_pending);
|
||||
|
||||
#define SCM_SMC_FNID(s, c) ((((s) & 0xFF) << 8) | ((c) & 0xFF))
|
||||
extern int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc,
|
||||
enum qcom_scm_convention qcom_convention,
|
||||
@ -129,6 +132,10 @@ extern int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc,
|
||||
#define QCOM_SCM_SMMU_CONFIG_ERRATA1 0x03
|
||||
#define QCOM_SCM_SMMU_CONFIG_ERRATA1_CLIENT_ALL 0x02
|
||||
|
||||
#define QCOM_SCM_SVC_WAITQ 0x24
|
||||
#define QCOM_SCM_WAITQ_RESUME 0x02
|
||||
#define QCOM_SCM_WAITQ_GET_WQ_CTX 0x03
|
||||
|
||||
/* common error codes */
|
||||
#define QCOM_SCM_V2_EBUSY -12
|
||||
#define QCOM_SCM_ENOMEM -5
|
||||
@ -137,6 +144,7 @@ extern int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc,
|
||||
#define QCOM_SCM_EINVAL_ARG -2
|
||||
#define QCOM_SCM_ERROR -1
|
||||
#define QCOM_SCM_INTERRUPTED 1
|
||||
#define QCOM_SCM_WAITQ_SLEEP 2
|
||||
|
||||
static inline int qcom_scm_remap_error(int err)
|
||||
{
|
||||
|
@ -738,8 +738,31 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_get_pll_frac_data);
|
||||
*/
|
||||
int zynqmp_pm_set_sd_tapdelay(u32 node_id, u32 type, u32 value)
|
||||
{
|
||||
return zynqmp_pm_invoke_fn(PM_IOCTL, node_id, IOCTL_SET_SD_TAPDELAY,
|
||||
type, value, NULL);
|
||||
u32 reg = (type == PM_TAPDELAY_INPUT) ? SD_ITAPDLY : SD_OTAPDLYSEL;
|
||||
u32 mask = (node_id == NODE_SD_0) ? GENMASK(15, 0) : GENMASK(31, 16);
|
||||
|
||||
if (value) {
|
||||
return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
|
||||
IOCTL_SET_SD_TAPDELAY,
|
||||
type, value, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Work around completely misdesigned firmware API on Xilinx ZynqMP.
|
||||
* The IOCTL_SET_SD_TAPDELAY firmware call allows the caller to only
|
||||
* ever set IOU_SLCR SD_ITAPDLY Register SD0_ITAPDLYENA/SD1_ITAPDLYENA
|
||||
* bits, but there is no matching call to clear those bits. If those
|
||||
* bits are not cleared, SDMMC tuning may fail.
|
||||
*
|
||||
* Luckily, there are PM_MMIO_READ/PM_MMIO_WRITE calls which seem to
|
||||
* allow complete unrestricted access to all address space, including
|
||||
* IOU_SLCR SD_ITAPDLY Register and all the other registers, access
|
||||
* to which was supposed to be protected by the current firmware API.
|
||||
*
|
||||
* Use PM_MMIO_READ/PM_MMIO_WRITE to re-implement the missing counter
|
||||
* part of IOCTL_SET_SD_TAPDELAY which clears SDx_ITAPDLYENA bits.
|
||||
*/
|
||||
return zynqmp_pm_invoke_fn(PM_MMIO_WRITE, reg, mask, 0, 0, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(zynqmp_pm_set_sd_tapdelay);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/pm_opp.h>
|
||||
#include <linux/nvmem-consumer.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <linux/ascii85.h>
|
||||
#include <linux/interconnect.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/pm_opp.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
#include "hdmi.h"
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
|
||||
#define HDCP_REG_ENABLE 0x01
|
||||
#define HDCP_REG_DISABLE 0x00
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mfd/mt6323/registers.h>
|
||||
#include <linux/mfd/mt6331/registers.h>
|
||||
#include <linux/mfd/mt6357/registers.h>
|
||||
#include <linux/mfd/mt6358/registers.h>
|
||||
#include <linux/mfd/mt6397/core.h>
|
||||
#include <linux/mfd/mt6397/registers.h>
|
||||
@ -90,6 +91,19 @@ static const struct mtk_pmic_regs mt6331_regs = {
|
||||
.rst_lprst_mask = MTK_PMIC_MT6331_RST_DU_MASK,
|
||||
};
|
||||
|
||||
static const struct mtk_pmic_regs mt6357_regs = {
|
||||
.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
|
||||
MTK_PMIC_KEYS_REGS(MT6357_TOPSTATUS,
|
||||
0x2, MT6357_PSC_TOP_INT_CON0, 0x5,
|
||||
MTK_PMIC_PWRKEY_RST),
|
||||
.keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
|
||||
MTK_PMIC_KEYS_REGS(MT6357_TOPSTATUS,
|
||||
0x8, MT6357_PSC_TOP_INT_CON0, 0xa,
|
||||
MTK_PMIC_HOMEKEY_INDEX),
|
||||
.pmic_rst_reg = MT6357_TOP_RST_MISC,
|
||||
.rst_lprst_mask = MTK_PMIC_RST_DU_MASK,
|
||||
};
|
||||
|
||||
static const struct mtk_pmic_regs mt6358_regs = {
|
||||
.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
|
||||
MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
|
||||
@ -276,6 +290,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = {
|
||||
}, {
|
||||
.compatible = "mediatek,mt6331-keys",
|
||||
.data = &mt6331_regs,
|
||||
}, {
|
||||
.compatible = "mediatek,mt6357-keys",
|
||||
.data = &mt6357_regs,
|
||||
}, {
|
||||
.compatible = "mediatek,mt6358-keys",
|
||||
.data = &mt6358_regs,
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/ratelimit.h>
|
||||
|
||||
#include "arm-smmu.h"
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <linux/adreno-smmu-priv.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
|
||||
#include "arm-smmu.h"
|
||||
#include "arm-smmu-qcom.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/soc/qcom/mdt_loader.h>
|
||||
|
||||
|
@ -163,14 +163,36 @@ static const struct regmap_access_table rpcif_volatile_table = {
|
||||
.n_yes_ranges = ARRAY_SIZE(rpcif_volatile_ranges),
|
||||
};
|
||||
|
||||
struct rpcif_priv {
|
||||
struct device *dev;
|
||||
void __iomem *base;
|
||||
void __iomem *dirmap;
|
||||
struct regmap *regmap;
|
||||
struct reset_control *rstc;
|
||||
struct platform_device *vdev;
|
||||
size_t size;
|
||||
enum rpcif_type type;
|
||||
enum rpcif_data_dir dir;
|
||||
u8 bus_size;
|
||||
u8 xfer_size;
|
||||
void *buffer;
|
||||
u32 xferlen;
|
||||
u32 smcr;
|
||||
u32 smadr;
|
||||
u32 command; /* DRCMR or SMCMR */
|
||||
u32 option; /* DROPR or SMOPR */
|
||||
u32 enable; /* DRENR or SMENR */
|
||||
u32 dummy; /* DRDMCR or SMDMCR */
|
||||
u32 ddr; /* DRDRENR or SMDRENR */
|
||||
};
|
||||
|
||||
/*
|
||||
* Custom accessor functions to ensure SM[RW]DR[01] are always accessed with
|
||||
* proper width. Requires rpcif.xfer_size to be correctly set before!
|
||||
* proper width. Requires rpcif_priv.xfer_size to be correctly set before!
|
||||
*/
|
||||
static int rpcif_reg_read(void *context, unsigned int reg, unsigned int *val)
|
||||
{
|
||||
struct rpcif *rpc = context;
|
||||
struct rpcif_priv *rpc = context;
|
||||
|
||||
switch (reg) {
|
||||
case RPCIF_SMRDR0:
|
||||
@ -206,7 +228,7 @@ static int rpcif_reg_read(void *context, unsigned int reg, unsigned int *val)
|
||||
|
||||
static int rpcif_reg_write(void *context, unsigned int reg, unsigned int val)
|
||||
{
|
||||
struct rpcif *rpc = context;
|
||||
struct rpcif_priv *rpc = context;
|
||||
|
||||
switch (reg) {
|
||||
case RPCIF_SMWDR0:
|
||||
@ -253,39 +275,18 @@ static const struct regmap_config rpcif_regmap_config = {
|
||||
.volatile_table = &rpcif_volatile_table,
|
||||
};
|
||||
|
||||
int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
|
||||
int rpcif_sw_init(struct rpcif *rpcif, struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct resource *res;
|
||||
struct rpcif_priv *rpc = dev_get_drvdata(dev);
|
||||
|
||||
rpc->dev = dev;
|
||||
|
||||
rpc->base = devm_platform_ioremap_resource_byname(pdev, "regs");
|
||||
if (IS_ERR(rpc->base))
|
||||
return PTR_ERR(rpc->base);
|
||||
|
||||
rpc->regmap = devm_regmap_init(&pdev->dev, NULL, rpc, &rpcif_regmap_config);
|
||||
if (IS_ERR(rpc->regmap)) {
|
||||
dev_err(&pdev->dev,
|
||||
"failed to init regmap for rpcif, error %ld\n",
|
||||
PTR_ERR(rpc->regmap));
|
||||
return PTR_ERR(rpc->regmap);
|
||||
}
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap");
|
||||
rpc->dirmap = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(rpc->dirmap))
|
||||
return PTR_ERR(rpc->dirmap);
|
||||
rpc->size = resource_size(res);
|
||||
|
||||
rpc->type = (uintptr_t)of_device_get_match_data(dev);
|
||||
rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
|
||||
|
||||
return PTR_ERR_OR_ZERO(rpc->rstc);
|
||||
rpcif->dev = dev;
|
||||
rpcif->dirmap = rpc->dirmap;
|
||||
rpcif->size = rpc->size;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(rpcif_sw_init);
|
||||
|
||||
static void rpcif_rzg2l_timing_adjust_sdr(struct rpcif *rpc)
|
||||
static void rpcif_rzg2l_timing_adjust_sdr(struct rpcif_priv *rpc)
|
||||
{
|
||||
regmap_write(rpc->regmap, RPCIF_PHYWR, 0xa5390000);
|
||||
regmap_write(rpc->regmap, RPCIF_PHYADD, 0x80000000);
|
||||
@ -299,15 +300,17 @@ static void rpcif_rzg2l_timing_adjust_sdr(struct rpcif *rpc)
|
||||
regmap_write(rpc->regmap, RPCIF_PHYADD, 0x80000032);
|
||||
}
|
||||
|
||||
int rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
|
||||
int rpcif_hw_init(struct device *dev, bool hyperflash)
|
||||
{
|
||||
struct rpcif_priv *rpc = dev_get_drvdata(dev);
|
||||
u32 dummy;
|
||||
int ret;
|
||||
|
||||
pm_runtime_get_sync(rpc->dev);
|
||||
ret = pm_runtime_resume_and_get(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (rpc->type == RPCIF_RZ_G2L) {
|
||||
int ret;
|
||||
|
||||
ret = reset_control_reset(rpc->rstc);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -356,7 +359,7 @@ int rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
|
||||
regmap_write(rpc->regmap, RPCIF_SSLDR, RPCIF_SSLDR_SPNDL(7) |
|
||||
RPCIF_SSLDR_SLNDL(7) | RPCIF_SSLDR_SCKDL(7));
|
||||
|
||||
pm_runtime_put(rpc->dev);
|
||||
pm_runtime_put(dev);
|
||||
|
||||
rpc->bus_size = hyperflash ? 2 : 1;
|
||||
|
||||
@ -364,7 +367,7 @@ int rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
|
||||
}
|
||||
EXPORT_SYMBOL(rpcif_hw_init);
|
||||
|
||||
static int wait_msg_xfer_end(struct rpcif *rpc)
|
||||
static int wait_msg_xfer_end(struct rpcif_priv *rpc)
|
||||
{
|
||||
u32 sts;
|
||||
|
||||
@ -373,7 +376,7 @@ static int wait_msg_xfer_end(struct rpcif *rpc)
|
||||
USEC_PER_SEC);
|
||||
}
|
||||
|
||||
static u8 rpcif_bits_set(struct rpcif *rpc, u32 nbytes)
|
||||
static u8 rpcif_bits_set(struct rpcif_priv *rpc, u32 nbytes)
|
||||
{
|
||||
if (rpc->bus_size == 2)
|
||||
nbytes /= 2;
|
||||
@ -386,9 +389,11 @@ static u8 rpcif_bit_size(u8 buswidth)
|
||||
return buswidth > 4 ? 2 : ilog2(buswidth);
|
||||
}
|
||||
|
||||
void rpcif_prepare(struct rpcif *rpc, const struct rpcif_op *op, u64 *offs,
|
||||
void rpcif_prepare(struct device *dev, const struct rpcif_op *op, u64 *offs,
|
||||
size_t *len)
|
||||
{
|
||||
struct rpcif_priv *rpc = dev_get_drvdata(dev);
|
||||
|
||||
rpc->smcr = 0;
|
||||
rpc->smadr = 0;
|
||||
rpc->enable = 0;
|
||||
@ -430,8 +435,7 @@ void rpcif_prepare(struct rpcif *rpc, const struct rpcif_op *op, u64 *offs,
|
||||
|
||||
if (op->dummy.buswidth) {
|
||||
rpc->enable |= RPCIF_SMENR_DME;
|
||||
rpc->dummy = RPCIF_SMDMCR_DMCYC(op->dummy.ncycles /
|
||||
op->dummy.buswidth);
|
||||
rpc->dummy = RPCIF_SMDMCR_DMCYC(op->dummy.ncycles);
|
||||
}
|
||||
|
||||
if (op->option.buswidth) {
|
||||
@ -472,12 +476,15 @@ void rpcif_prepare(struct rpcif *rpc, const struct rpcif_op *op, u64 *offs,
|
||||
}
|
||||
EXPORT_SYMBOL(rpcif_prepare);
|
||||
|
||||
int rpcif_manual_xfer(struct rpcif *rpc)
|
||||
int rpcif_manual_xfer(struct device *dev)
|
||||
{
|
||||
struct rpcif_priv *rpc = dev_get_drvdata(dev);
|
||||
u32 smenr, smcr, pos = 0, max = rpc->bus_size == 2 ? 8 : 4;
|
||||
int ret = 0;
|
||||
|
||||
pm_runtime_get_sync(rpc->dev);
|
||||
ret = pm_runtime_resume_and_get(dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
regmap_update_bits(rpc->regmap, RPCIF_PHYCNT,
|
||||
RPCIF_PHYCNT_CAL, RPCIF_PHYCNT_CAL);
|
||||
@ -587,13 +594,13 @@ int rpcif_manual_xfer(struct rpcif *rpc)
|
||||
}
|
||||
|
||||
exit:
|
||||
pm_runtime_put(rpc->dev);
|
||||
pm_runtime_put(dev);
|
||||
return ret;
|
||||
|
||||
err_out:
|
||||
if (reset_control_reset(rpc->rstc))
|
||||
dev_err(rpc->dev, "Failed to reset HW\n");
|
||||
rpcif_hw_init(rpc, rpc->bus_size == 2);
|
||||
dev_err(dev, "Failed to reset HW\n");
|
||||
rpcif_hw_init(dev, rpc->bus_size == 2);
|
||||
goto exit;
|
||||
}
|
||||
EXPORT_SYMBOL(rpcif_manual_xfer);
|
||||
@ -640,15 +647,19 @@ static void memcpy_fromio_readw(void *to,
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf)
|
||||
ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf)
|
||||
{
|
||||
struct rpcif_priv *rpc = dev_get_drvdata(dev);
|
||||
loff_t from = offs & (rpc->size - 1);
|
||||
size_t size = rpc->size - from;
|
||||
int ret;
|
||||
|
||||
if (len > size)
|
||||
len = size;
|
||||
|
||||
pm_runtime_get_sync(rpc->dev);
|
||||
ret = pm_runtime_resume_and_get(dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
regmap_update_bits(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_MD, 0);
|
||||
regmap_write(rpc->regmap, RPCIF_DRCR, 0);
|
||||
@ -666,7 +677,7 @@ ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf)
|
||||
else
|
||||
memcpy_fromio(buf, rpc->dirmap + from, len);
|
||||
|
||||
pm_runtime_put(rpc->dev);
|
||||
pm_runtime_put(dev);
|
||||
|
||||
return len;
|
||||
}
|
||||
@ -674,14 +685,17 @@ EXPORT_SYMBOL(rpcif_dirmap_read);
|
||||
|
||||
static int rpcif_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct platform_device *vdev;
|
||||
struct device_node *flash;
|
||||
struct rpcif_priv *rpc;
|
||||
struct resource *res;
|
||||
const char *name;
|
||||
int ret;
|
||||
|
||||
flash = of_get_next_child(pdev->dev.of_node, NULL);
|
||||
flash = of_get_next_child(dev->of_node, NULL);
|
||||
if (!flash) {
|
||||
dev_warn(&pdev->dev, "no flash node found\n");
|
||||
dev_warn(dev, "no flash node found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -691,16 +705,45 @@ static int rpcif_probe(struct platform_device *pdev)
|
||||
name = "rpc-if-hyperflash";
|
||||
} else {
|
||||
of_node_put(flash);
|
||||
dev_warn(&pdev->dev, "unknown flash type\n");
|
||||
dev_warn(dev, "unknown flash type\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
of_node_put(flash);
|
||||
|
||||
rpc = devm_kzalloc(dev, sizeof(*rpc), GFP_KERNEL);
|
||||
if (!rpc)
|
||||
return -ENOMEM;
|
||||
|
||||
rpc->base = devm_platform_ioremap_resource_byname(pdev, "regs");
|
||||
if (IS_ERR(rpc->base))
|
||||
return PTR_ERR(rpc->base);
|
||||
|
||||
rpc->regmap = devm_regmap_init(dev, NULL, rpc, &rpcif_regmap_config);
|
||||
if (IS_ERR(rpc->regmap)) {
|
||||
dev_err(dev, "failed to init regmap for rpcif, error %ld\n",
|
||||
PTR_ERR(rpc->regmap));
|
||||
return PTR_ERR(rpc->regmap);
|
||||
}
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap");
|
||||
rpc->dirmap = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(rpc->dirmap))
|
||||
return PTR_ERR(rpc->dirmap);
|
||||
rpc->size = resource_size(res);
|
||||
|
||||
rpc->type = (uintptr_t)of_device_get_match_data(dev);
|
||||
rpc->rstc = devm_reset_control_get_exclusive(dev, NULL);
|
||||
if (IS_ERR(rpc->rstc))
|
||||
return PTR_ERR(rpc->rstc);
|
||||
|
||||
vdev = platform_device_alloc(name, pdev->id);
|
||||
if (!vdev)
|
||||
return -ENOMEM;
|
||||
vdev->dev.parent = &pdev->dev;
|
||||
platform_set_drvdata(pdev, vdev);
|
||||
vdev->dev.parent = dev;
|
||||
|
||||
rpc->dev = dev;
|
||||
rpc->vdev = vdev;
|
||||
platform_set_drvdata(pdev, rpc);
|
||||
|
||||
ret = platform_device_add(vdev);
|
||||
if (ret) {
|
||||
@ -713,9 +756,9 @@ static int rpcif_probe(struct platform_device *pdev)
|
||||
|
||||
static int rpcif_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct platform_device *vdev = platform_get_drvdata(pdev);
|
||||
struct rpcif_priv *rpc = platform_get_drvdata(pdev);
|
||||
|
||||
platform_device_unregister(vdev);
|
||||
platform_device_unregister(rpc->vdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -277,18 +277,13 @@ static int ti_emif_probe(struct platform_device *pdev)
|
||||
int ret;
|
||||
struct resource *res;
|
||||
struct device *dev = &pdev->dev;
|
||||
const struct of_device_id *match;
|
||||
struct ti_emif_data *emif_data;
|
||||
|
||||
emif_data = devm_kzalloc(dev, sizeof(*emif_data), GFP_KERNEL);
|
||||
if (!emif_data)
|
||||
return -ENOMEM;
|
||||
|
||||
match = of_match_device(ti_emif_of_match, &pdev->dev);
|
||||
if (!match)
|
||||
return -ENODEV;
|
||||
|
||||
emif_data->pm_data.ti_emif_sram_config = (unsigned long)match->data;
|
||||
emif_data->pm_data.ti_emif_sram_config = (unsigned long) device_get_match_data(&pdev->dev);
|
||||
|
||||
emif_data->pm_data.ti_emif_base_addr_virt = devm_platform_get_and_ioremap_resource(pdev,
|
||||
0,
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <linux/rpmsg.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <uapi/misc/fastrpc.h>
|
||||
#include <linux/of_reserved_mem.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <linux/pm_opp.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/interconnect.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
|
@ -56,7 +56,7 @@ static void rpcif_hb_prepare_read(struct rpcif *rpc, void *to,
|
||||
op.data.nbytes = len;
|
||||
op.data.buf.in = to;
|
||||
|
||||
rpcif_prepare(rpc, &op, NULL, NULL);
|
||||
rpcif_prepare(rpc->dev, &op, NULL, NULL);
|
||||
}
|
||||
|
||||
static void rpcif_hb_prepare_write(struct rpcif *rpc, unsigned long to,
|
||||
@ -70,7 +70,7 @@ static void rpcif_hb_prepare_write(struct rpcif *rpc, unsigned long to,
|
||||
op.data.nbytes = len;
|
||||
op.data.buf.out = from;
|
||||
|
||||
rpcif_prepare(rpc, &op, NULL, NULL);
|
||||
rpcif_prepare(rpc->dev, &op, NULL, NULL);
|
||||
}
|
||||
|
||||
static u16 rpcif_hb_read16(struct hyperbus_device *hbdev, unsigned long addr)
|
||||
@ -81,7 +81,7 @@ static u16 rpcif_hb_read16(struct hyperbus_device *hbdev, unsigned long addr)
|
||||
|
||||
rpcif_hb_prepare_read(&hyperbus->rpc, &data, addr, 2);
|
||||
|
||||
rpcif_manual_xfer(&hyperbus->rpc);
|
||||
rpcif_manual_xfer(hyperbus->rpc.dev);
|
||||
|
||||
return data.x[0];
|
||||
}
|
||||
@ -94,7 +94,7 @@ static void rpcif_hb_write16(struct hyperbus_device *hbdev, unsigned long addr,
|
||||
|
||||
rpcif_hb_prepare_write(&hyperbus->rpc, addr, &data, 2);
|
||||
|
||||
rpcif_manual_xfer(&hyperbus->rpc);
|
||||
rpcif_manual_xfer(hyperbus->rpc.dev);
|
||||
}
|
||||
|
||||
static void rpcif_hb_copy_from(struct hyperbus_device *hbdev, void *to,
|
||||
@ -105,7 +105,7 @@ static void rpcif_hb_copy_from(struct hyperbus_device *hbdev, void *to,
|
||||
|
||||
rpcif_hb_prepare_read(&hyperbus->rpc, to, from, len);
|
||||
|
||||
rpcif_dirmap_read(&hyperbus->rpc, from, len, to);
|
||||
rpcif_dirmap_read(hyperbus->rpc.dev, from, len, to);
|
||||
}
|
||||
|
||||
static const struct hyperbus_ops rpcif_hb_ops = {
|
||||
@ -130,9 +130,9 @@ static int rpcif_hb_probe(struct platform_device *pdev)
|
||||
|
||||
platform_set_drvdata(pdev, hyperbus);
|
||||
|
||||
rpcif_enable_rpm(&hyperbus->rpc);
|
||||
pm_runtime_enable(hyperbus->rpc.dev);
|
||||
|
||||
error = rpcif_hw_init(&hyperbus->rpc, true);
|
||||
error = rpcif_hw_init(hyperbus->rpc.dev, true);
|
||||
if (error)
|
||||
goto out_disable_rpm;
|
||||
|
||||
@ -150,7 +150,7 @@ static int rpcif_hb_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
|
||||
out_disable_rpm:
|
||||
rpcif_disable_rpm(&hyperbus->rpc);
|
||||
pm_runtime_disable(hyperbus->rpc.dev);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ static int rpcif_hb_remove(struct platform_device *pdev)
|
||||
|
||||
hyperbus_unregister_device(&hyperbus->hbdev);
|
||||
|
||||
rpcif_disable_rpm(&hyperbus->rpc);
|
||||
pm_runtime_disable(hyperbus->rpc.dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/soc/qcom/mdt_loader.h>
|
||||
|
||||
#include "ipa.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/soc/qcom/smem.h>
|
||||
#include <linux/string.h>
|
||||
#include <net/sock.h>
|
||||
|
@ -83,8 +83,11 @@ static int exynos_dp_video_phy_probe(struct platform_device *pdev)
|
||||
if (!state)
|
||||
return -ENOMEM;
|
||||
|
||||
state->regs = syscon_regmap_lookup_by_phandle(dev->of_node,
|
||||
"samsung,pmu-syscon");
|
||||
state->regs = syscon_node_to_regmap(dev->parent->of_node);
|
||||
if (IS_ERR(state->regs))
|
||||
/* Backwards compatible way */
|
||||
state->regs = syscon_regmap_lookup_by_phandle(dev->of_node,
|
||||
"samsung,pmu-syscon");
|
||||
if (IS_ERR(state->regs)) {
|
||||
dev_err(dev, "Failed to lookup PMU regmap\n");
|
||||
return PTR_ERR(state->regs);
|
||||
|
@ -298,7 +298,7 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev)
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct phy_provider *phy_provider;
|
||||
unsigned int i;
|
||||
unsigned int i = 0;
|
||||
|
||||
phy_dev = of_device_get_match_data(dev);
|
||||
if (!phy_dev)
|
||||
@ -308,7 +308,10 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev)
|
||||
if (!state)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < phy_dev->num_regmaps; i++) {
|
||||
state->regmaps[i] = syscon_node_to_regmap(dev->parent->of_node);
|
||||
if (!IS_ERR(state->regmaps[i]))
|
||||
i++;
|
||||
for (; i < phy_dev->num_regmaps; i++) {
|
||||
state->regmaps[i] = syscon_regmap_lookup_by_phandle(np,
|
||||
phy_dev->regmap_names[i]);
|
||||
if (IS_ERR(state->regmaps[i]))
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -174,6 +174,15 @@ config BATTERY_PMU
|
||||
Say Y here to expose battery information on Apple machines
|
||||
through the generic battery class.
|
||||
|
||||
config BATTERY_QCOM_BATTMGR
|
||||
tristate "Qualcomm PMIC GLINK battery manager support"
|
||||
depends on QCOM_PMIC_GLINK
|
||||
select AUXILIARY_BUS
|
||||
help
|
||||
Say Y here to enable the Qualcomm PMIC GLINK power supply driver,
|
||||
which is used on modern Qualcomm platforms to provide battery and
|
||||
power supply information.
|
||||
|
||||
config BATTERY_OLPC
|
||||
tristate "One Laptop Per Child battery"
|
||||
depends on OLPC_EC
|
||||
|
@ -33,6 +33,7 @@ obj-$(CONFIG_BATTERY_GAUGE_LTC2941) += ltc2941-battery-gauge.o
|
||||
obj-$(CONFIG_BATTERY_GOLDFISH) += goldfish_battery.o
|
||||
obj-$(CONFIG_BATTERY_LEGO_EV3) += lego_ev3_battery.o
|
||||
obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
|
||||
obj-$(CONFIG_BATTERY_QCOM_BATTMGR) += qcom_battmgr.o
|
||||
obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
|
||||
obj-$(CONFIG_BATTERY_SAMSUNG_SDI) += samsung-sdi-battery.o
|
||||
obj-$(CONFIG_BATTERY_COLLIE) += collie_battery.o
|
||||
|
1411
drivers/power/supply/qcom_battmgr.c
Normal file
1411
drivers/power/supply/qcom_battmgr.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@
|
||||
#include "qcom_pil_info.h"
|
||||
#include "qcom_q6v5.h"
|
||||
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
|
||||
#define MPSS_CRASH_REASON_SMEM 421
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_domain.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/remoteproc.h>
|
||||
#include <linux/soc/qcom/mdt_loader.h>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_domain.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/firmware/qcom/qcom_scm.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/remoteproc.h>
|
||||
#include <linux/soc/qcom/mdt_loader.h>
|
||||
|
@ -16,12 +16,14 @@ source "drivers/soc/litex/Kconfig"
|
||||
source "drivers/soc/loongson/Kconfig"
|
||||
source "drivers/soc/mediatek/Kconfig"
|
||||
source "drivers/soc/microchip/Kconfig"
|
||||
source "drivers/soc/nuvoton/Kconfig"
|
||||
source "drivers/soc/pxa/Kconfig"
|
||||
source "drivers/soc/qcom/Kconfig"
|
||||
source "drivers/soc/renesas/Kconfig"
|
||||
source "drivers/soc/rockchip/Kconfig"
|
||||
source "drivers/soc/samsung/Kconfig"
|
||||
source "drivers/soc/sifive/Kconfig"
|
||||
source "drivers/soc/starfive/Kconfig"
|
||||
source "drivers/soc/sunxi/Kconfig"
|
||||
source "drivers/soc/tegra/Kconfig"
|
||||
source "drivers/soc/ti/Kconfig"
|
||||
|
@ -21,13 +21,15 @@ obj-$(CONFIG_LITEX_SOC_CONTROLLER) += litex/
|
||||
obj-y += loongson/
|
||||
obj-y += mediatek/
|
||||
obj-y += microchip/
|
||||
obj-y += nuvoton/
|
||||
obj-y += pxa/
|
||||
obj-y += amlogic/
|
||||
obj-y += qcom/
|
||||
obj-y += renesas/
|
||||
obj-y += rockchip/
|
||||
obj-$(CONFIG_SOC_SAMSUNG) += samsung/
|
||||
obj-$(CONFIG_SOC_SIFIVE) += sifive/
|
||||
obj-y += sifive/
|
||||
obj-$(CONFIG_SOC_STARFIVE) += starfive/
|
||||
obj-y += sunxi/
|
||||
obj-$(CONFIG_ARCH_TEGRA) += tegra/
|
||||
obj-y += ti/
|
||||
|
@ -46,6 +46,9 @@
|
||||
#define HHI_NANOQ_MEM_PD_REG1 (0x47 << 2)
|
||||
#define HHI_VPU_MEM_PD_REG2 (0x4d << 2)
|
||||
|
||||
#define G12A_HHI_NANOQ_MEM_PD_REG0 (0x43 << 2)
|
||||
#define G12A_HHI_NANOQ_MEM_PD_REG1 (0x44 << 2)
|
||||
|
||||
struct meson_ee_pwrc;
|
||||
struct meson_ee_pwrc_domain;
|
||||
|
||||
@ -106,6 +109,13 @@ static struct meson_ee_pwrc_top_domain sm1_pwrc_usb = SM1_EE_PD(17);
|
||||
static struct meson_ee_pwrc_top_domain sm1_pwrc_pci = SM1_EE_PD(18);
|
||||
static struct meson_ee_pwrc_top_domain sm1_pwrc_ge2d = SM1_EE_PD(19);
|
||||
|
||||
static struct meson_ee_pwrc_top_domain g12a_pwrc_nna = {
|
||||
.sleep_reg = GX_AO_RTI_GEN_PWR_SLEEP0,
|
||||
.sleep_mask = BIT(16) | BIT(17),
|
||||
.iso_reg = GX_AO_RTI_GEN_PWR_ISO0,
|
||||
.iso_mask = BIT(16) | BIT(17),
|
||||
};
|
||||
|
||||
/* Memory PD Domains */
|
||||
|
||||
#define VPU_MEMPD(__reg) \
|
||||
@ -217,6 +227,11 @@ static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_audio[] = {
|
||||
{ HHI_AUDIO_MEM_PD_REG0, GENMASK(27, 26) },
|
||||
};
|
||||
|
||||
static struct meson_ee_pwrc_mem_domain g12a_pwrc_mem_nna[] = {
|
||||
{ G12A_HHI_NANOQ_MEM_PD_REG0, GENMASK(31, 0) },
|
||||
{ G12A_HHI_NANOQ_MEM_PD_REG1, GENMASK(23, 0) },
|
||||
};
|
||||
|
||||
#define VPU_PD(__name, __top_pd, __mem, __is_pwr_off, __resets, __clks) \
|
||||
{ \
|
||||
.name = __name, \
|
||||
@ -253,6 +268,8 @@ static struct meson_ee_pwrc_domain_desc g12a_pwrc_domains[] = {
|
||||
[PWRC_G12A_VPU_ID] = VPU_PD("VPU", &gx_pwrc_vpu, g12a_pwrc_mem_vpu,
|
||||
pwrc_ee_is_powered_off, 11, 2),
|
||||
[PWRC_G12A_ETH_ID] = MEM_PD("ETH", meson_pwrc_mem_eth),
|
||||
[PWRC_G12A_NNA_ID] = TOP_PD("NNA", &g12a_pwrc_nna, g12a_pwrc_mem_nna,
|
||||
pwrc_ee_is_powered_off),
|
||||
};
|
||||
|
||||
static struct meson_ee_pwrc_domain_desc gxbb_pwrc_domains[] = {
|
||||
|
@ -116,8 +116,9 @@ static int apple_pmgr_ps_power_off(struct generic_pm_domain *genpd)
|
||||
static int apple_pmgr_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
|
||||
{
|
||||
struct apple_pmgr_ps *ps = rcdev_to_apple_pmgr_ps(rcdev);
|
||||
unsigned long flags;
|
||||
|
||||
mutex_lock(&ps->genpd.mlock);
|
||||
spin_lock_irqsave(&ps->genpd.slock, flags);
|
||||
|
||||
if (ps->genpd.status == GENPD_STATE_OFF)
|
||||
dev_err(ps->dev, "PS 0x%x: asserting RESET while powered down\n", ps->offset);
|
||||
@ -129,7 +130,7 @@ static int apple_pmgr_reset_assert(struct reset_controller_dev *rcdev, unsigned
|
||||
regmap_update_bits(ps->regmap, ps->offset, APPLE_PMGR_FLAGS | APPLE_PMGR_RESET,
|
||||
APPLE_PMGR_RESET);
|
||||
|
||||
mutex_unlock(&ps->genpd.mlock);
|
||||
spin_unlock_irqrestore(&ps->genpd.slock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -137,8 +138,9 @@ static int apple_pmgr_reset_assert(struct reset_controller_dev *rcdev, unsigned
|
||||
static int apple_pmgr_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
|
||||
{
|
||||
struct apple_pmgr_ps *ps = rcdev_to_apple_pmgr_ps(rcdev);
|
||||
unsigned long flags;
|
||||
|
||||
mutex_lock(&ps->genpd.mlock);
|
||||
spin_lock_irqsave(&ps->genpd.slock, flags);
|
||||
|
||||
dev_dbg(ps->dev, "PS 0x%x: deassert reset\n", ps->offset);
|
||||
regmap_update_bits(ps->regmap, ps->offset, APPLE_PMGR_FLAGS | APPLE_PMGR_RESET, 0);
|
||||
@ -147,7 +149,7 @@ static int apple_pmgr_reset_deassert(struct reset_controller_dev *rcdev, unsigne
|
||||
if (ps->genpd.status == GENPD_STATE_OFF)
|
||||
dev_err(ps->dev, "PS 0x%x: RESET was deasserted while powered down\n", ps->offset);
|
||||
|
||||
mutex_unlock(&ps->genpd.mlock);
|
||||
spin_unlock_irqrestore(&ps->genpd.slock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -222,6 +224,7 @@ static int apple_pmgr_ps_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ps->genpd.flags |= GENPD_FLAG_IRQ_SAFE;
|
||||
ps->genpd.name = name;
|
||||
ps->genpd.power_on = apple_pmgr_ps_power_on;
|
||||
ps->genpd.power_off = apple_pmgr_ps_power_off;
|
||||
|
@ -13,6 +13,17 @@
|
||||
#define APPLE_RTKIT_CRASHLOG_VERSION FOURCC('C', 'v', 'e', 'r')
|
||||
#define APPLE_RTKIT_CRASHLOG_MBOX FOURCC('C', 'm', 'b', 'x')
|
||||
#define APPLE_RTKIT_CRASHLOG_TIME FOURCC('C', 't', 'i', 'm')
|
||||
#define APPLE_RTKIT_CRASHLOG_REGS FOURCC('C', 'r', 'g', '8')
|
||||
|
||||
/* For COMPILE_TEST on non-ARM64 architectures */
|
||||
#ifndef PSR_MODE_EL0t
|
||||
#define PSR_MODE_EL0t 0x00000000
|
||||
#define PSR_MODE_EL1t 0x00000004
|
||||
#define PSR_MODE_EL1h 0x00000005
|
||||
#define PSR_MODE_EL2t 0x00000008
|
||||
#define PSR_MODE_EL2h 0x00000009
|
||||
#define PSR_MODE_MASK 0x0000000f
|
||||
#endif
|
||||
|
||||
struct apple_rtkit_crashlog_header {
|
||||
u32 fourcc;
|
||||
@ -31,6 +42,24 @@ struct apple_rtkit_crashlog_mbox_entry {
|
||||
};
|
||||
static_assert(sizeof(struct apple_rtkit_crashlog_mbox_entry) == 0x18);
|
||||
|
||||
struct apple_rtkit_crashlog_regs {
|
||||
u32 unk_0;
|
||||
u32 unk_4;
|
||||
u64 regs[31];
|
||||
u64 sp;
|
||||
u64 pc;
|
||||
u64 psr;
|
||||
u64 cpacr;
|
||||
u64 fpsr;
|
||||
u64 fpcr;
|
||||
u64 unk[64];
|
||||
u64 far;
|
||||
u64 unk_X;
|
||||
u64 esr;
|
||||
u64 unk_Z;
|
||||
} __packed;
|
||||
static_assert(sizeof(struct apple_rtkit_crashlog_regs) == 0x350);
|
||||
|
||||
static void apple_rtkit_crashlog_dump_str(struct apple_rtkit *rtk, u8 *bfr,
|
||||
size_t size)
|
||||
{
|
||||
@ -94,6 +123,66 @@ static void apple_rtkit_crashlog_dump_mailbox(struct apple_rtkit *rtk, u8 *bfr,
|
||||
}
|
||||
}
|
||||
|
||||
static void apple_rtkit_crashlog_dump_regs(struct apple_rtkit *rtk, u8 *bfr,
|
||||
size_t size)
|
||||
{
|
||||
struct apple_rtkit_crashlog_regs *regs;
|
||||
const char *el;
|
||||
int i;
|
||||
|
||||
if (size < sizeof(*regs)) {
|
||||
dev_warn(rtk->dev, "RTKit: Regs section too small: 0x%zx", size);
|
||||
return;
|
||||
}
|
||||
|
||||
regs = (struct apple_rtkit_crashlog_regs *)bfr;
|
||||
|
||||
switch (regs->psr & PSR_MODE_MASK) {
|
||||
case PSR_MODE_EL0t:
|
||||
el = "EL0t";
|
||||
break;
|
||||
case PSR_MODE_EL1t:
|
||||
el = "EL1t";
|
||||
break;
|
||||
case PSR_MODE_EL1h:
|
||||
el = "EL1h";
|
||||
break;
|
||||
case PSR_MODE_EL2t:
|
||||
el = "EL2t";
|
||||
break;
|
||||
case PSR_MODE_EL2h:
|
||||
el = "EL2h";
|
||||
break;
|
||||
default:
|
||||
el = "unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
dev_warn(rtk->dev, "RTKit: Exception dump:");
|
||||
dev_warn(rtk->dev, " == Exception taken from %s ==", el);
|
||||
dev_warn(rtk->dev, " PSR = 0x%llx", regs->psr);
|
||||
dev_warn(rtk->dev, " PC = 0x%llx\n", regs->pc);
|
||||
dev_warn(rtk->dev, " ESR = 0x%llx\n", regs->esr);
|
||||
dev_warn(rtk->dev, " FAR = 0x%llx\n", regs->far);
|
||||
dev_warn(rtk->dev, " SP = 0x%llx\n", regs->sp);
|
||||
dev_warn(rtk->dev, "\n");
|
||||
|
||||
for (i = 0; i < 31; i += 4) {
|
||||
if (i < 28)
|
||||
dev_warn(rtk->dev,
|
||||
" x%02d-x%02d = %016llx %016llx %016llx %016llx\n",
|
||||
i, i + 3,
|
||||
regs->regs[i], regs->regs[i + 1],
|
||||
regs->regs[i + 2], regs->regs[i + 3]);
|
||||
else
|
||||
dev_warn(rtk->dev,
|
||||
" x%02d-x%02d = %016llx %016llx %016llx\n", i, i + 3,
|
||||
regs->regs[i], regs->regs[i + 1], regs->regs[i + 2]);
|
||||
}
|
||||
|
||||
dev_warn(rtk->dev, "\n");
|
||||
}
|
||||
|
||||
void apple_rtkit_crashlog_dump(struct apple_rtkit *rtk, u8 *bfr, size_t size)
|
||||
{
|
||||
size_t offset;
|
||||
@ -140,6 +229,10 @@ void apple_rtkit_crashlog_dump(struct apple_rtkit *rtk, u8 *bfr, size_t size)
|
||||
apple_rtkit_crashlog_dump_time(rtk, bfr + offset + 16,
|
||||
section_size);
|
||||
break;
|
||||
case APPLE_RTKIT_CRASHLOG_REGS:
|
||||
apple_rtkit_crashlog_dump_regs(rtk, bfr + offset + 16,
|
||||
section_size);
|
||||
break;
|
||||
default:
|
||||
dev_warn(rtk->dev,
|
||||
"RTKit: Unknown crashlog section: %x",
|
||||
|
@ -9,6 +9,7 @@
|
||||
enum {
|
||||
APPLE_RTKIT_PWR_STATE_OFF = 0x00, /* power off, cannot be restarted */
|
||||
APPLE_RTKIT_PWR_STATE_SLEEP = 0x01, /* sleeping, can be restarted */
|
||||
APPLE_RTKIT_PWR_STATE_IDLE = 0x201, /* sleeping, retain state */
|
||||
APPLE_RTKIT_PWR_STATE_QUIESCED = 0x10, /* running but no communication */
|
||||
APPLE_RTKIT_PWR_STATE_ON = 0x20, /* normal operating state */
|
||||
};
|
||||
@ -698,7 +699,7 @@ static int apple_rtkit_request_mbox_chan(struct apple_rtkit *rtk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct apple_rtkit *apple_rtkit_init(struct device *dev, void *cookie,
|
||||
struct apple_rtkit *apple_rtkit_init(struct device *dev, void *cookie,
|
||||
const char *mbox_name, int mbox_idx,
|
||||
const struct apple_rtkit_ops *ops)
|
||||
{
|
||||
@ -750,6 +751,7 @@ static struct apple_rtkit *apple_rtkit_init(struct device *dev, void *cookie,
|
||||
kfree(rtk);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(apple_rtkit_init);
|
||||
|
||||
static int apple_rtkit_wait_for_completion(struct completion *c)
|
||||
{
|
||||
@ -881,6 +883,26 @@ int apple_rtkit_shutdown(struct apple_rtkit *rtk)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(apple_rtkit_shutdown);
|
||||
|
||||
int apple_rtkit_idle(struct apple_rtkit *rtk)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* if OFF is used here the co-processor will not wake up again */
|
||||
ret = apple_rtkit_set_ap_power_state(rtk,
|
||||
APPLE_RTKIT_PWR_STATE_IDLE);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = apple_rtkit_set_iop_power_state(rtk, APPLE_RTKIT_PWR_STATE_IDLE);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
rtk->iop_power_state = APPLE_RTKIT_PWR_STATE_IDLE;
|
||||
rtk->ap_power_state = APPLE_RTKIT_PWR_STATE_IDLE;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(apple_rtkit_idle);
|
||||
|
||||
int apple_rtkit_quiesce(struct apple_rtkit *rtk)
|
||||
{
|
||||
int ret;
|
||||
@ -926,10 +948,8 @@ int apple_rtkit_wake(struct apple_rtkit *rtk)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(apple_rtkit_wake);
|
||||
|
||||
static void apple_rtkit_free(void *data)
|
||||
void apple_rtkit_free(struct apple_rtkit *rtk)
|
||||
{
|
||||
struct apple_rtkit *rtk = data;
|
||||
|
||||
mbox_free_channel(rtk->mbox_chan);
|
||||
destroy_workqueue(rtk->wq);
|
||||
|
||||
@ -940,6 +960,12 @@ static void apple_rtkit_free(void *data)
|
||||
kfree(rtk->syslog_msg_buffer);
|
||||
kfree(rtk);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(apple_rtkit_free);
|
||||
|
||||
static void apple_rtkit_free_wrapper(void *data)
|
||||
{
|
||||
apple_rtkit_free(data);
|
||||
}
|
||||
|
||||
struct apple_rtkit *devm_apple_rtkit_init(struct device *dev, void *cookie,
|
||||
const char *mbox_name, int mbox_idx,
|
||||
@ -952,7 +978,7 @@ struct apple_rtkit *devm_apple_rtkit_init(struct device *dev, void *cookie,
|
||||
if (IS_ERR(rtk))
|
||||
return rtk;
|
||||
|
||||
ret = devm_add_action_or_reset(dev, apple_rtkit_free, rtk);
|
||||
ret = devm_add_action_or_reset(dev, apple_rtkit_free_wrapper, rtk);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
|
@ -701,14 +701,8 @@ static int bcm2835_power_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bcm2835_power_remove(struct platform_device *pdev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver bcm2835_power_driver = {
|
||||
.probe = bcm2835_power_probe,
|
||||
.remove = bcm2835_power_remove,
|
||||
.driver = {
|
||||
.name = "bcm2835-power",
|
||||
},
|
||||
|
@ -28,4 +28,15 @@ config SOC_IMX9
|
||||
help
|
||||
If you say yes here, you get support for the NXP i.MX9 family
|
||||
|
||||
config IMX8M_BLK_CTRL
|
||||
bool
|
||||
default SOC_IMX8M && IMX_GPCV2_PM_DOMAINS
|
||||
depends on PM_GENERIC_DOMAINS
|
||||
depends on COMMON_CLK
|
||||
|
||||
config IMX9_BLK_CTRL
|
||||
bool
|
||||
default SOC_IMX9 && IMX_GPCV2_PM_DOMAINS
|
||||
depends on PM_GENERIC_DOMAINS
|
||||
|
||||
endmenu
|
||||
|
@ -5,7 +5,7 @@ endif
|
||||
obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
|
||||
obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o
|
||||
obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o
|
||||
obj-$(CONFIG_SOC_IMX8M) += imx8m-blk-ctrl.o
|
||||
obj-$(CONFIG_SOC_IMX8M) += imx8mp-blk-ctrl.o
|
||||
obj-$(CONFIG_IMX8M_BLK_CTRL) += imx8m-blk-ctrl.o
|
||||
obj-$(CONFIG_IMX8M_BLK_CTRL) += imx8mp-blk-ctrl.o
|
||||
obj-$(CONFIG_SOC_IMX9) += imx93-src.o imx93-pd.o
|
||||
obj-$(CONFIG_SOC_IMX9) += imx93-blk-ctrl.o
|
||||
obj-$(CONFIG_IMX9_BLK_CTRL) += imx93-blk-ctrl.o
|
||||
|
@ -4,6 +4,7 @@
|
||||
* Copyright 2021 Pengutronix, Lucas Stach <kernel@pengutronix.de>
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/interconnect.h>
|
||||
#include <linux/module.h>
|
||||
@ -654,6 +655,10 @@ static const struct imx8m_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = {
|
||||
.num_domains = ARRAY_SIZE(imx8mn_disp_blk_ctl_domain_data),
|
||||
};
|
||||
|
||||
#define LCDIF_ARCACHE_CTRL 0x4c
|
||||
#define LCDIF_1_RD_HURRY GENMASK(15, 13)
|
||||
#define LCDIF_0_RD_HURRY GENMASK(12, 10)
|
||||
|
||||
static int imx8mp_media_power_notifier(struct notifier_block *nb,
|
||||
unsigned long action, void *data)
|
||||
{
|
||||
@ -667,14 +672,24 @@ static int imx8mp_media_power_notifier(struct notifier_block *nb,
|
||||
regmap_set_bits(bc->regmap, BLK_CLK_EN, BIT(8));
|
||||
regmap_set_bits(bc->regmap, BLK_SFT_RSTN, BIT(8));
|
||||
|
||||
/*
|
||||
* On power up we have no software backchannel to the GPC to
|
||||
* wait for the ADB handshake to happen, so we just delay for a
|
||||
* bit. On power down the GPC driver waits for the handshake.
|
||||
*/
|
||||
if (action == GENPD_NOTIFY_ON)
|
||||
if (action == GENPD_NOTIFY_ON) {
|
||||
/*
|
||||
* On power up we have no software backchannel to the GPC to
|
||||
* wait for the ADB handshake to happen, so we just delay for a
|
||||
* bit. On power down the GPC driver waits for the handshake.
|
||||
*/
|
||||
udelay(5);
|
||||
|
||||
/*
|
||||
* Set panic read hurry level for both LCDIF interfaces to
|
||||
* maximum priority to minimize chances of display FIFO
|
||||
* underflow.
|
||||
*/
|
||||
regmap_set_bits(bc->regmap, LCDIF_ARCACHE_CTRL,
|
||||
FIELD_PREP(LCDIF_1_RD_HURRY, 7) |
|
||||
FIELD_PREP(LCDIF_0_RD_HURRY, 7));
|
||||
}
|
||||
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,9 @@
|
||||
* Copyright 2022 Pengutronix, Lucas Stach <kernel@pengutronix.de>
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/interconnect.h>
|
||||
#include <linux/module.h>
|
||||
@ -21,6 +23,15 @@
|
||||
#define USB_CLOCK_MODULE_EN BIT(1)
|
||||
#define PCIE_PHY_APB_RST BIT(4)
|
||||
#define PCIE_PHY_INIT_RST BIT(5)
|
||||
#define GPR_REG1 0x4
|
||||
#define PLL_LOCK BIT(13)
|
||||
#define GPR_REG2 0x8
|
||||
#define P_PLL_MASK GENMASK(5, 0)
|
||||
#define M_PLL_MASK GENMASK(15, 6)
|
||||
#define S_PLL_MASK GENMASK(18, 16)
|
||||
#define GPR_REG3 0xc
|
||||
#define PLL_CKE BIT(17)
|
||||
#define PLL_RST BIT(31)
|
||||
|
||||
struct imx8mp_blk_ctrl_domain;
|
||||
|
||||
@ -60,6 +71,7 @@ struct imx8mp_blk_ctrl_domain {
|
||||
|
||||
struct imx8mp_blk_ctrl_data {
|
||||
int max_reg;
|
||||
int (*probe) (struct imx8mp_blk_ctrl *bc);
|
||||
notifier_fn_t power_notifier_fn;
|
||||
void (*power_off) (struct imx8mp_blk_ctrl *bc, struct imx8mp_blk_ctrl_domain *domain);
|
||||
void (*power_on) (struct imx8mp_blk_ctrl *bc, struct imx8mp_blk_ctrl_domain *domain);
|
||||
@ -73,6 +85,92 @@ to_imx8mp_blk_ctrl_domain(struct generic_pm_domain *genpd)
|
||||
return container_of(genpd, struct imx8mp_blk_ctrl_domain, genpd);
|
||||
}
|
||||
|
||||
struct clk_hsio_pll {
|
||||
struct clk_hw hw;
|
||||
struct regmap *regmap;
|
||||
};
|
||||
|
||||
static inline struct clk_hsio_pll *to_clk_hsio_pll(struct clk_hw *hw)
|
||||
{
|
||||
return container_of(hw, struct clk_hsio_pll, hw);
|
||||
}
|
||||
|
||||
static int clk_hsio_pll_prepare(struct clk_hw *hw)
|
||||
{
|
||||
struct clk_hsio_pll *clk = to_clk_hsio_pll(hw);
|
||||
u32 val;
|
||||
|
||||
/* set the PLL configuration */
|
||||
regmap_update_bits(clk->regmap, GPR_REG2,
|
||||
P_PLL_MASK | M_PLL_MASK | S_PLL_MASK,
|
||||
FIELD_PREP(P_PLL_MASK, 12) |
|
||||
FIELD_PREP(M_PLL_MASK, 800) |
|
||||
FIELD_PREP(S_PLL_MASK, 4));
|
||||
|
||||
/* de-assert PLL reset */
|
||||
regmap_update_bits(clk->regmap, GPR_REG3, PLL_RST, PLL_RST);
|
||||
|
||||
/* enable PLL */
|
||||
regmap_update_bits(clk->regmap, GPR_REG3, PLL_CKE, PLL_CKE);
|
||||
|
||||
return regmap_read_poll_timeout(clk->regmap, GPR_REG1, val,
|
||||
val & PLL_LOCK, 10, 100);
|
||||
}
|
||||
|
||||
static void clk_hsio_pll_unprepare(struct clk_hw *hw)
|
||||
{
|
||||
struct clk_hsio_pll *clk = to_clk_hsio_pll(hw);
|
||||
|
||||
regmap_update_bits(clk->regmap, GPR_REG3, PLL_RST | PLL_CKE, 0);
|
||||
}
|
||||
|
||||
static int clk_hsio_pll_is_prepared(struct clk_hw *hw)
|
||||
{
|
||||
struct clk_hsio_pll *clk = to_clk_hsio_pll(hw);
|
||||
|
||||
return regmap_test_bits(clk->regmap, GPR_REG1, PLL_LOCK);
|
||||
}
|
||||
|
||||
static unsigned long clk_hsio_pll_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return 100000000;
|
||||
}
|
||||
|
||||
static const struct clk_ops clk_hsio_pll_ops = {
|
||||
.prepare = clk_hsio_pll_prepare,
|
||||
.unprepare = clk_hsio_pll_unprepare,
|
||||
.is_prepared = clk_hsio_pll_is_prepared,
|
||||
.recalc_rate = clk_hsio_pll_recalc_rate,
|
||||
};
|
||||
|
||||
static int imx8mp_hsio_blk_ctrl_probe(struct imx8mp_blk_ctrl *bc)
|
||||
{
|
||||
struct clk_hsio_pll *clk_hsio_pll;
|
||||
struct clk_hw *hw;
|
||||
struct clk_init_data init = {};
|
||||
int ret;
|
||||
|
||||
clk_hsio_pll = devm_kzalloc(bc->dev, sizeof(*clk_hsio_pll), GFP_KERNEL);
|
||||
if (!clk_hsio_pll)
|
||||
return -ENOMEM;
|
||||
|
||||
init.name = "hsio_pll";
|
||||
init.ops = &clk_hsio_pll_ops;
|
||||
init.parent_names = (const char *[]){"osc_24m"};
|
||||
init.num_parents = 1;
|
||||
|
||||
clk_hsio_pll->regmap = bc->regmap;
|
||||
clk_hsio_pll->hw.init = &init;
|
||||
|
||||
hw = &clk_hsio_pll->hw;
|
||||
ret = devm_clk_hw_register(bc->dev, hw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return devm_of_clk_add_hw_provider(bc->dev, of_clk_hw_simple_get, hw);
|
||||
}
|
||||
|
||||
static void imx8mp_hsio_blk_ctrl_power_on(struct imx8mp_blk_ctrl *bc,
|
||||
struct imx8mp_blk_ctrl_domain *domain)
|
||||
{
|
||||
@ -187,6 +285,7 @@ static const struct imx8mp_blk_ctrl_domain_data imx8mp_hsio_domain_data[] = {
|
||||
|
||||
static const struct imx8mp_blk_ctrl_data imx8mp_hsio_blk_ctl_dev_data = {
|
||||
.max_reg = 0x24,
|
||||
.probe = imx8mp_hsio_blk_ctrl_probe,
|
||||
.power_on = imx8mp_hsio_blk_ctrl_power_on,
|
||||
.power_off = imx8mp_hsio_blk_ctrl_power_off,
|
||||
.power_notifier_fn = imx8mp_hsio_power_notifier,
|
||||
@ -201,6 +300,7 @@ static const struct imx8mp_blk_ctrl_data imx8mp_hsio_blk_ctl_dev_data = {
|
||||
#define HDMI_RTX_CLK_CTL3 0x70
|
||||
#define HDMI_RTX_CLK_CTL4 0x80
|
||||
#define HDMI_TX_CONTROL0 0x200
|
||||
#define HDMI_LCDIF_NOC_HURRY_MASK GENMASK(14, 12)
|
||||
|
||||
static void imx8mp_hdmi_blk_ctrl_power_on(struct imx8mp_blk_ctrl *bc,
|
||||
struct imx8mp_blk_ctrl_domain *domain)
|
||||
@ -217,6 +317,8 @@ static void imx8mp_hdmi_blk_ctrl_power_on(struct imx8mp_blk_ctrl *bc,
|
||||
regmap_set_bits(bc->regmap, HDMI_RTX_CLK_CTL1, BIT(11));
|
||||
regmap_set_bits(bc->regmap, HDMI_RTX_RESET_CTL0,
|
||||
BIT(4) | BIT(5) | BIT(6));
|
||||
regmap_set_bits(bc->regmap, HDMI_TX_CONTROL0,
|
||||
FIELD_PREP(HDMI_LCDIF_NOC_HURRY_MASK, 7));
|
||||
break;
|
||||
case IMX8MP_HDMIBLK_PD_PAI:
|
||||
regmap_set_bits(bc->regmap, HDMI_RTX_CLK_CTL1, BIT(17));
|
||||
@ -635,6 +737,12 @@ static int imx8mp_blk_ctrl_probe(struct platform_device *pdev)
|
||||
goto cleanup_provider;
|
||||
}
|
||||
|
||||
if (bc_data->probe) {
|
||||
ret = bc_data->probe(bc);
|
||||
if (ret)
|
||||
goto cleanup_provider;
|
||||
}
|
||||
|
||||
dev_set_drvdata(dev, bc);
|
||||
|
||||
return 0;
|
||||
|
@ -164,7 +164,6 @@ MODULE_DEVICE_TABLE(of, imx93_pd_ids);
|
||||
static struct platform_driver imx93_power_domain_driver = {
|
||||
.driver = {
|
||||
.name = "imx93_power_domain",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = imx93_pd_ids,
|
||||
},
|
||||
.probe = imx93_pd_probe,
|
||||
|
@ -21,7 +21,6 @@ MODULE_DEVICE_TABLE(of, imx93_src_ids);
|
||||
static struct platform_driver imx93_src_driver = {
|
||||
.driver = {
|
||||
.name = "imx93_src",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = imx93_src_ids,
|
||||
},
|
||||
.probe = imx93_src_probe,
|
||||
|
@ -44,6 +44,11 @@ config MTK_PMIC_WRAP
|
||||
on different MediaTek SoCs. The PMIC wrapper is a proprietary
|
||||
hardware to connect the PMIC.
|
||||
|
||||
config MTK_REGULATOR_COUPLER
|
||||
bool "MediaTek SoC Regulator Coupler" if COMPILE_TEST
|
||||
default ARCH_MEDIATEK
|
||||
depends on REGULATOR
|
||||
|
||||
config MTK_SCPSYS
|
||||
bool "MediaTek SCPSYS Support"
|
||||
default ARCH_MEDIATEK
|
||||
@ -68,7 +73,7 @@ config MTK_SCPSYS_PM_DOMAINS
|
||||
tasks in the system.
|
||||
|
||||
config MTK_MMSYS
|
||||
bool "MediaTek MMSYS Support"
|
||||
tristate "MediaTek MMSYS Support"
|
||||
default ARCH_MEDIATEK
|
||||
depends on HAS_IOMEM
|
||||
help
|
||||
|
@ -3,6 +3,7 @@ obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq-helper.o
|
||||
obj-$(CONFIG_MTK_DEVAPC) += mtk-devapc.o
|
||||
obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
|
||||
obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
|
||||
obj-$(CONFIG_MTK_REGULATOR_COUPLER) += mtk-regulator-coupler.o
|
||||
obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o
|
||||
obj-$(CONFIG_MTK_SCPSYS_PM_DOMAINS) += mtk-pm-domains.o
|
||||
obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o
|
||||
|
@ -304,7 +304,6 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8186[] = {
|
||||
.ctl_offs = 0x9FC,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8186_POWER_DOMAIN_ADSP_INFRA] = {
|
||||
.name = "adsp_infra",
|
||||
@ -312,7 +311,6 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8186[] = {
|
||||
.ctl_offs = 0x9F8,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8186_POWER_DOMAIN_ADSP_TOP] = {
|
||||
.name = "adsp_top",
|
||||
@ -332,7 +330,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8186[] = {
|
||||
MT8186_TOP_AXI_PROT_EN_3_CLR,
|
||||
MT8186_TOP_AXI_PROT_EN_3_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_SRAM_ISO | MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_ACTIVE_WAKEUP,
|
||||
.caps = MTK_SCPD_SRAM_ISO | MTK_SCPD_ACTIVE_WAKEUP,
|
||||
},
|
||||
};
|
||||
|
||||
|
149
drivers/soc/mediatek/mt8188-mmsys.h
Normal file
149
drivers/soc/mediatek/mt8188-mmsys.h
Normal file
@ -0,0 +1,149 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#ifndef __SOC_MEDIATEK_MT8188_MMSYS_H
|
||||
#define __SOC_MEDIATEK_MT8188_MMSYS_H
|
||||
|
||||
#define MT8188_VDO0_OVL_MOUT_EN 0xf14
|
||||
#define MT8188_MOUT_DISP_OVL0_TO_DISP_RDMA0 BIT(0)
|
||||
#define MT8188_MOUT_DISP_OVL0_TO_DISP_WDMA0 BIT(1)
|
||||
#define MT8188_MOUT_DISP_OVL0_TO_DISP_OVL1 BIT(2)
|
||||
#define MT8188_MOUT_DISP_OVL1_TO_DISP_RDMA1 BIT(4)
|
||||
#define MT8188_MOUT_DISP_OVL1_TO_DISP_WDMA1 BIT(5)
|
||||
#define MT8188_MOUT_DISP_OVL1_TO_DISP_OVL0 BIT(6)
|
||||
|
||||
#define MT8188_VDO0_SEL_IN 0xf34
|
||||
#define MT8188_VDO0_SEL_OUT 0xf38
|
||||
|
||||
#define MT8188_VDO0_DISP_RDMA_SEL 0xf40
|
||||
#define MT8188_SOUT_DISP_RDMA0_TO_MASK GENMASK(2, 0)
|
||||
#define MT8188_SOUT_DISP_RDMA0_TO_DISP_COLOR0 (0 << 0)
|
||||
#define MT8188_SOUT_DISP_RDMA0_TO_DISP_DSI0 (1 << 0)
|
||||
#define MT8188_SOUT_DISP_RDMA0_TO_DISP_DP_INTF0 (5 << 0)
|
||||
#define MT8188_SEL_IN_DISP_RDMA0_FROM_MASK GENMASK(8, 8)
|
||||
#define MT8188_SEL_IN_DISP_RDMA0_FROM_DISP_OVL0 (0 << 8)
|
||||
#define MT8188_SEL_IN_DISP_RDMA0_FROM_DISP_RSZ0 (1 << 8)
|
||||
|
||||
|
||||
#define MT8188_VDO0_DSI0_SEL_IN 0xf44
|
||||
#define MT8188_SEL_IN_DSI0_FROM_MASK BIT(0)
|
||||
#define MT8188_SEL_IN_DSI0_FROM_DSC_WRAP0_OUT (0 << 0)
|
||||
#define MT8188_SEL_IN_DSI0_FROM_DISP_DITHER0 (1 << 0)
|
||||
|
||||
#define MT8188_VDO0_DP_INTF0_SEL_IN 0xf4C
|
||||
#define MT8188_SEL_IN_DP_INTF0_FROM_MASK GENMASK(2, 0)
|
||||
#define MT8188_SEL_IN_DP_INTF0_FROM_DSC_WRAP0C1_OUT (0 << 0)
|
||||
#define MT8188_SEL_IN_DP_INTF0_FROM_VPP_MERGE (1 << 0)
|
||||
#define MT8188_SEL_IN_DP_INTF0_FROM_DISP_DITHER0 (3 << 0)
|
||||
|
||||
#define MT8188_VDO0_DISP_DITHER0_SEL_OUT 0xf58
|
||||
#define MT8188_SOUT_DISP_DITHER0_TO_MASK GENMASK(2, 0)
|
||||
#define MT8188_SOUT_DISP_DITHER0_TO_DSC_WRAP0_IN (0 << 0)
|
||||
#define MT8188_SOUT_DISP_DITHER0_TO_DSI0 (1 << 0)
|
||||
#define MT8188_SOUT_DISP_DITHER0_TO_VPP_MERGE0 (6 << 0)
|
||||
#define MT8188_SOUT_DISP_DITHER0_TO_DP_INTF0 (7 << 0)
|
||||
|
||||
#define MT8188_VDO0_VPP_MERGE_SEL 0xf60
|
||||
#define MT8188_SEL_IN_VPP_MERGE_FROM_MASK GENMASK(1, 0)
|
||||
#define MT8188_SEL_IN_VPP_MERGE_FROM_DSC_WRAP0_OUT (0 << 0)
|
||||
#define MT8188_SEL_IN_VPP_MERGE_FROM_DITHER0_OUT (3 << 0)
|
||||
|
||||
#define MT8188_SOUT_VPP_MERGE_TO_MASK GENMASK(6, 4)
|
||||
#define MT8188_SOUT_VPP_MERGE_TO_DSI1 (0 << 4)
|
||||
#define MT8188_SOUT_VPP_MERGE_TO_DP_INTF0 (1 << 4)
|
||||
#define MT8188_SOUT_VPP_MERGE_TO_SINA_VIRTUAL0 (2 << 4)
|
||||
#define MT8188_SOUT_VPP_MERGE_TO_DISP_WDMA1 (3 << 4)
|
||||
#define MT8188_SOUT_VPP_MERGE_TO_DSC_WRAP0_IN (4 << 4)
|
||||
#define MT8188_SOUT_VPP_MERGE_TO_DISP_WDMA0 (5 << 4)
|
||||
#define MT8188_SOUT_VPP_MERGE_TO_DSC_WRAP1_IN_MASK GENMASK(11, 11)
|
||||
#define MT8188_SOUT_VPP_MERGE_TO_DSC_WRAP1_IN (0 << 11)
|
||||
|
||||
#define MT8188_VDO0_DSC_WARP_SEL 0xf64
|
||||
#define MT8188_SEL_IN_DSC_WRAP0C0_IN_FROM_MASK GENMASK(0, 0)
|
||||
#define MT8188_SEL_IN_DSC_WRAP0C0_IN_FROM_DISP_DITHER0 (0 << 0)
|
||||
#define MT8188_SEL_IN_DSC_WRAP0C0_IN_FROM_VPP_MERGE (1 << 0)
|
||||
#define MT8188_SOUT_DSC_WRAP0_OUT_TO_MASK GENMASK(19, 16)
|
||||
#define MT8188_SOUT_DSC_WRAP0_OUT_TO_DSI0 BIT(16)
|
||||
#define MT8188_SOUT_DSC_WRAP0_OUT_TO_SINB_VIRTUAL0 BIT(17)
|
||||
#define MT8188_SOUT_DSC_WRAP0_OUT_TO_VPP_MERGE BIT(18)
|
||||
#define MT8188_SOUT_DSC_WRAP0_OUT_TO_DISP_WDMA0 BIT(19)
|
||||
|
||||
static const struct mtk_mmsys_routes mmsys_mt8188_routing_table[] = {
|
||||
{
|
||||
DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0,
|
||||
MT8188_VDO0_OVL_MOUT_EN, MT8188_MOUT_DISP_OVL0_TO_DISP_RDMA0,
|
||||
MT8188_MOUT_DISP_OVL0_TO_DISP_RDMA0
|
||||
}, {
|
||||
DDP_COMPONENT_OVL0, DDP_COMPONENT_WDMA0,
|
||||
MT8188_VDO0_OVL_MOUT_EN, MT8188_MOUT_DISP_OVL0_TO_DISP_WDMA0,
|
||||
MT8188_MOUT_DISP_OVL0_TO_DISP_WDMA0
|
||||
}, {
|
||||
DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0,
|
||||
MT8188_VDO0_DISP_RDMA_SEL, MT8188_SEL_IN_DISP_RDMA0_FROM_MASK,
|
||||
MT8188_SEL_IN_DISP_RDMA0_FROM_DISP_OVL0
|
||||
}, {
|
||||
DDP_COMPONENT_DITHER0, DDP_COMPONENT_DSI0,
|
||||
MT8188_VDO0_DSI0_SEL_IN, MT8188_SEL_IN_DSI0_FROM_MASK,
|
||||
MT8188_SEL_IN_DSI0_FROM_DISP_DITHER0
|
||||
}, {
|
||||
DDP_COMPONENT_DITHER0, DDP_COMPONENT_MERGE0,
|
||||
MT8188_VDO0_VPP_MERGE_SEL, MT8188_SEL_IN_VPP_MERGE_FROM_MASK,
|
||||
MT8188_SEL_IN_VPP_MERGE_FROM_DITHER0_OUT
|
||||
}, {
|
||||
DDP_COMPONENT_DITHER0, DDP_COMPONENT_DSC0,
|
||||
MT8188_VDO0_DSC_WARP_SEL,
|
||||
MT8188_SEL_IN_DSC_WRAP0C0_IN_FROM_MASK,
|
||||
MT8188_SEL_IN_DSC_WRAP0C0_IN_FROM_DISP_DITHER0
|
||||
}, {
|
||||
DDP_COMPONENT_DITHER0, DDP_COMPONENT_DP_INTF0,
|
||||
MT8188_VDO0_DP_INTF0_SEL_IN, MT8188_SEL_IN_DP_INTF0_FROM_MASK,
|
||||
MT8188_SEL_IN_DP_INTF0_FROM_DISP_DITHER0
|
||||
}, {
|
||||
DDP_COMPONENT_DSC0, DDP_COMPONENT_MERGE0,
|
||||
MT8188_VDO0_VPP_MERGE_SEL, MT8188_SEL_IN_VPP_MERGE_FROM_MASK,
|
||||
MT8188_SEL_IN_VPP_MERGE_FROM_DSC_WRAP0_OUT
|
||||
}, {
|
||||
DDP_COMPONENT_DSC0, DDP_COMPONENT_DSI0,
|
||||
MT8188_VDO0_DSI0_SEL_IN, MT8188_SEL_IN_DSI0_FROM_MASK,
|
||||
MT8188_SEL_IN_DSI0_FROM_DSC_WRAP0_OUT
|
||||
}, {
|
||||
DDP_COMPONENT_RDMA0, DDP_COMPONENT_COLOR0,
|
||||
MT8188_VDO0_DISP_RDMA_SEL, MT8188_SOUT_DISP_RDMA0_TO_MASK,
|
||||
MT8188_SOUT_DISP_RDMA0_TO_DISP_COLOR0
|
||||
}, {
|
||||
DDP_COMPONENT_DITHER0, DDP_COMPONENT_DSI0,
|
||||
MT8188_VDO0_DISP_DITHER0_SEL_OUT,
|
||||
MT8188_SOUT_DISP_DITHER0_TO_MASK,
|
||||
MT8188_SOUT_DISP_DITHER0_TO_DSI0
|
||||
}, {
|
||||
DDP_COMPONENT_DITHER0, DDP_COMPONENT_DP_INTF0,
|
||||
MT8188_VDO0_DISP_DITHER0_SEL_OUT,
|
||||
MT8188_SOUT_DISP_DITHER0_TO_MASK,
|
||||
MT8188_SOUT_DISP_DITHER0_TO_DP_INTF0
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE0, DDP_COMPONENT_DP_INTF0,
|
||||
MT8188_VDO0_VPP_MERGE_SEL, MT8188_SOUT_VPP_MERGE_TO_MASK,
|
||||
MT8188_SOUT_VPP_MERGE_TO_DP_INTF0
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE0, DDP_COMPONENT_DPI0,
|
||||
MT8188_VDO0_VPP_MERGE_SEL, MT8188_SOUT_VPP_MERGE_TO_MASK,
|
||||
MT8188_SOUT_VPP_MERGE_TO_SINA_VIRTUAL0
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE0, DDP_COMPONENT_WDMA0,
|
||||
MT8188_VDO0_VPP_MERGE_SEL, MT8188_SOUT_VPP_MERGE_TO_MASK,
|
||||
MT8188_SOUT_VPP_MERGE_TO_DISP_WDMA0
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE0, DDP_COMPONENT_DSC0,
|
||||
MT8188_VDO0_VPP_MERGE_SEL, MT8188_SOUT_VPP_MERGE_TO_MASK,
|
||||
MT8188_SOUT_VPP_MERGE_TO_DSC_WRAP0_IN
|
||||
}, {
|
||||
DDP_COMPONENT_DSC0, DDP_COMPONENT_DSI0,
|
||||
MT8188_VDO0_DSC_WARP_SEL, MT8188_SOUT_DSC_WRAP0_OUT_TO_MASK,
|
||||
MT8188_SOUT_DSC_WRAP0_OUT_TO_DSI0
|
||||
}, {
|
||||
DDP_COMPONENT_DSC0, DDP_COMPONENT_MERGE0,
|
||||
MT8188_VDO0_DSC_WARP_SEL, MT8188_SOUT_DSC_WRAP0_OUT_TO_MASK,
|
||||
MT8188_SOUT_DSC_WRAP0_OUT_TO_VPP_MERGE
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* __SOC_MEDIATEK_MT8188_MMSYS_H */
|
623
drivers/soc/mediatek/mt8188-pm-domains.h
Normal file
623
drivers/soc/mediatek/mt8188-pm-domains.h
Normal file
@ -0,0 +1,623 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022 MediaTek Inc.
|
||||
* Author: Garmin Chang <garmin.chang@mediatek.com>
|
||||
*/
|
||||
|
||||
#ifndef __SOC_MEDIATEK_MT8188_PM_DOMAINS_H
|
||||
#define __SOC_MEDIATEK_MT8188_PM_DOMAINS_H
|
||||
|
||||
#include "mtk-pm-domains.h"
|
||||
#include <dt-bindings/power/mediatek,mt8188-power.h>
|
||||
|
||||
/*
|
||||
* MT8188 power domain support
|
||||
*/
|
||||
|
||||
static const struct scpsys_domain_data scpsys_domain_data_mt8188[] = {
|
||||
[MT8188_POWER_DOMAIN_MFG0] = {
|
||||
.name = "mfg0",
|
||||
.sta_mask = BIT(1),
|
||||
.ctl_offs = 0x300,
|
||||
.pwr_sta_offs = 0x174,
|
||||
.pwr_sta2nd_offs = 0x178,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_MFG1] = {
|
||||
.name = "mfg1",
|
||||
.sta_mask = BIT(2),
|
||||
.ctl_offs = 0x304,
|
||||
.pwr_sta_offs = 0x174,
|
||||
.pwr_sta2nd_offs = 0x178,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MFG1_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_MFG1_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_1_MFG1_STEP3,
|
||||
MT8188_TOP_AXI_PROT_EN_1_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_1_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_1_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_MFG1_STEP4,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MFG1_STEP5,
|
||||
MT8188_TOP_AXI_PROT_EN_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_MFG1_STEP6,
|
||||
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_MFG2] = {
|
||||
.name = "mfg2",
|
||||
.sta_mask = BIT(3),
|
||||
.ctl_offs = 0x308,
|
||||
.pwr_sta_offs = 0x174,
|
||||
.pwr_sta2nd_offs = 0x178,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_MFG3] = {
|
||||
.name = "mfg3",
|
||||
.sta_mask = BIT(4),
|
||||
.ctl_offs = 0x30C,
|
||||
.pwr_sta_offs = 0x174,
|
||||
.pwr_sta2nd_offs = 0x178,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_MFG4] = {
|
||||
.name = "mfg4",
|
||||
.sta_mask = BIT(5),
|
||||
.ctl_offs = 0x310,
|
||||
.pwr_sta_offs = 0x174,
|
||||
.pwr_sta2nd_offs = 0x178,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_PEXTP_MAC_P0] = {
|
||||
.name = "pextp_mac_p0",
|
||||
.sta_mask = BIT(10),
|
||||
.ctl_offs = 0x324,
|
||||
.pwr_sta_offs = 0x174,
|
||||
.pwr_sta2nd_offs = 0x178,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_PEXTP_MAC_P0_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_PEXTP_MAC_P0_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_PEXTP_PHY_TOP] = {
|
||||
.name = "pextp_phy_top",
|
||||
.sta_mask = BIT(12),
|
||||
.ctl_offs = 0x328,
|
||||
.pwr_sta_offs = 0x174,
|
||||
.pwr_sta2nd_offs = 0x178,
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_CSIRX_TOP] = {
|
||||
.name = "pextp_csirx_top",
|
||||
.sta_mask = BIT(17),
|
||||
.ctl_offs = 0x3C4,
|
||||
.pwr_sta_offs = 0x174,
|
||||
.pwr_sta2nd_offs = 0x178,
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_ETHER] = {
|
||||
.name = "ether",
|
||||
.sta_mask = BIT(1),
|
||||
.ctl_offs = 0x338,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_ETHER_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_ACTIVE_WAKEUP,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_HDMI_TX] = {
|
||||
.name = "hdmi_tx",
|
||||
.sta_mask = BIT(18),
|
||||
.ctl_offs = 0x37C,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_HDMI_TX_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_ACTIVE_WAKEUP,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_ADSP_AO] = {
|
||||
.name = "adsp_ao",
|
||||
.sta_mask = BIT(10),
|
||||
.ctl_offs = 0x35C,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_ADSP_AO_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_ADSP_AO_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_ALWAYS_ON,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_ADSP_INFRA] = {
|
||||
.name = "adsp_infra",
|
||||
.sta_mask = BIT(9),
|
||||
.ctl_offs = 0x358,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_ADSP_INFRA_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_ADSP_INFRA_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_SRAM_ISO | MTK_SCPD_ALWAYS_ON,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_ADSP] = {
|
||||
.name = "adsp",
|
||||
.sta_mask = BIT(8),
|
||||
.ctl_offs = 0x354,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_ADSP_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_ADSP_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_SRAM_ISO | MTK_SCPD_ACTIVE_WAKEUP,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_AUDIO] = {
|
||||
.name = "audio",
|
||||
.sta_mask = BIT(6),
|
||||
.ctl_offs = 0x34C,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_AUDIO_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_AUDIO_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_ACTIVE_WAKEUP,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_AUDIO_ASRC] = {
|
||||
.name = "audio_asrc",
|
||||
.sta_mask = BIT(7),
|
||||
.ctl_offs = 0x350,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_AUDIO_ASRC_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_AUDIO_ASRC_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_VPPSYS0] = {
|
||||
.name = "vppsys0",
|
||||
.sta_mask = BIT(11),
|
||||
.ctl_offs = 0x360,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_VPPSYS0_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_VPPSYS0_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_VPPSYS0_STEP3,
|
||||
MT8188_TOP_AXI_PROT_EN_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_VPPSYS0_STEP4,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_VPPSYS0_STEP5,
|
||||
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_STA),
|
||||
},
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_VDOSYS0] = {
|
||||
.name = "vdosys0",
|
||||
.sta_mask = BIT(13),
|
||||
.ctl_offs = 0x368,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VDOSYS0_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_VDOSYS0_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_VDOSYS0_STEP3,
|
||||
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_STA),
|
||||
},
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_VDOSYS1] = {
|
||||
.name = "vdosys1",
|
||||
.sta_mask = BIT(14),
|
||||
.ctl_offs = 0x36C,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VDOSYS1_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VDOSYS1_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_VDOSYS1_STEP3,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
},
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_DP_TX] = {
|
||||
.name = "dp_tx",
|
||||
.sta_mask = BIT(16),
|
||||
.ctl_offs = 0x374,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_DP_TX_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_EDP_TX] = {
|
||||
.name = "edp_tx",
|
||||
.sta_mask = BIT(17),
|
||||
.ctl_offs = 0x378,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_EDP_TX_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_INFRA_VDNR_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_VPPSYS1] = {
|
||||
.name = "vppsys1",
|
||||
.sta_mask = BIT(12),
|
||||
.ctl_offs = 0x364,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VPPSYS1_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VPPSYS1_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_VPPSYS1_STEP3,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
},
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_WPE] = {
|
||||
.name = "wpe",
|
||||
.sta_mask = BIT(15),
|
||||
.ctl_offs = 0x370,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_WPE_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_WPE_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_VDEC0] = {
|
||||
.name = "vdec0",
|
||||
.sta_mask = BIT(19),
|
||||
.ctl_offs = 0x380,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VDEC0_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_VDEC0_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_VDEC1] = {
|
||||
.name = "vdec1",
|
||||
.sta_mask = BIT(20),
|
||||
.ctl_offs = 0x384,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VDEC1_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VDEC1_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_VENC] = {
|
||||
.name = "venc",
|
||||
.sta_mask = BIT(22),
|
||||
.ctl_offs = 0x38C,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VENC_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_VENC_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_VENC_STEP3,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_IMG_VCORE] = {
|
||||
.name = "vcore",
|
||||
.sta_mask = BIT(28),
|
||||
.ctl_offs = 0x3A4,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_IMG_VCORE_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_IMG_VCORE_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_IMG_VCORE_STEP3,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_IMG_MAIN] = {
|
||||
.name = "img_main",
|
||||
.sta_mask = BIT(29),
|
||||
.ctl_offs = 0x3A8,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_IMG_MAIN_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_IMG_MAIN_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_DIP] = {
|
||||
.name = "dip",
|
||||
.sta_mask = BIT(30),
|
||||
.ctl_offs = 0x3AC,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_IPE] = {
|
||||
.name = "ipe",
|
||||
.sta_mask = BIT(31),
|
||||
.ctl_offs = 0x3B0,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_CAM_VCORE] = {
|
||||
.name = "cam_vcore",
|
||||
.sta_mask = BIT(27),
|
||||
.ctl_offs = 0x3A0,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_CAM_VCORE_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_CAM_VCORE_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_1_CAM_VCORE_STEP3,
|
||||
MT8188_TOP_AXI_PROT_EN_1_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_1_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_1_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_CAM_VCORE_STEP4,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_CAM_VCORE_STEP5,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_CAM_MAIN] = {
|
||||
.name = "cam_main",
|
||||
.sta_mask = BIT(24),
|
||||
.ctl_offs = 0x394,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.bp_infracfg = {
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_CAM_MAIN_STEP1,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_CAM_MAIN_STEP2,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_MM_2_CAM_MAIN_STEP3,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_MM_2_STA),
|
||||
BUS_PROT_WR(MT8188_TOP_AXI_PROT_EN_2_CAM_MAIN_STEP4,
|
||||
MT8188_TOP_AXI_PROT_EN_2_SET,
|
||||
MT8188_TOP_AXI_PROT_EN_2_CLR,
|
||||
MT8188_TOP_AXI_PROT_EN_2_STA),
|
||||
},
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_CAM_SUBA] = {
|
||||
.name = "cam_suba",
|
||||
.sta_mask = BIT(25),
|
||||
.ctl_offs = 0x398,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
[MT8188_POWER_DOMAIN_CAM_SUBB] = {
|
||||
.name = "cam_subb",
|
||||
.sta_mask = BIT(26),
|
||||
.ctl_offs = 0x39C,
|
||||
.pwr_sta_offs = 0x16C,
|
||||
.pwr_sta2nd_offs = 0x170,
|
||||
.sram_pdn_bits = BIT(8),
|
||||
.sram_pdn_ack_bits = BIT(12),
|
||||
.caps = MTK_SCPD_KEEP_DEFAULT_OFF,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct scpsys_soc_data mt8188_scpsys_data = {
|
||||
.domains_data = scpsys_domain_data_mt8188,
|
||||
.num_domains = ARRAY_SIZE(scpsys_domain_data_mt8188),
|
||||
};
|
||||
|
||||
#endif /* __SOC_MEDIATEK_MT8188_PM_DOMAINS_H */
|
@ -75,6 +75,77 @@
|
||||
#define MT8195_SOUT_DSC_WRAP1_OUT_TO_SINA_VIRTUAL0 (2 << 16)
|
||||
#define MT8195_SOUT_DSC_WRAP1_OUT_TO_VPP_MERGE (3 << 16)
|
||||
|
||||
#define MT8195_VDO1_SW0_RST_B 0x1d0
|
||||
#define MT8195_VDO1_MERGE0_ASYNC_CFG_WD 0xe30
|
||||
#define MT8195_VDO1_HDRBE_ASYNC_CFG_WD 0xe70
|
||||
#define MT8195_VDO1_HDR_TOP_CFG 0xd00
|
||||
#define MT8195_VDO1_MIXER_IN1_ALPHA 0xd30
|
||||
#define MT8195_VDO1_MIXER_IN1_PAD 0xd40
|
||||
|
||||
#define MT8195_VDO1_VPP_MERGE0_P0_SEL_IN 0xf04
|
||||
#define MT8195_VPP_MERGE0_P0_SEL_IN_FROM_MDP_RDMA0 1
|
||||
|
||||
#define MT8195_VDO1_VPP_MERGE0_P1_SEL_IN 0xf08
|
||||
#define MT8195_VPP_MERGE0_P1_SEL_IN_FROM_MDP_RDMA1 1
|
||||
|
||||
#define MT8195_VDO1_DISP_DPI1_SEL_IN 0xf10
|
||||
#define MT8195_DISP_DPI1_SEL_IN_FROM_VPP_MERGE4_MOUT 0
|
||||
|
||||
#define MT8195_VDO1_DISP_DP_INTF0_SEL_IN 0xf14
|
||||
#define MT8195_DISP_DP_INTF0_SEL_IN_FROM_VPP_MERGE4_MOUT 0
|
||||
|
||||
#define MT8195_VDO1_MERGE4_SOUT_SEL 0xf18
|
||||
#define MT8195_MERGE4_SOUT_TO_DPI1_SEL 2
|
||||
#define MT8195_MERGE4_SOUT_TO_DP_INTF0_SEL 3
|
||||
|
||||
#define MT8195_VDO1_MIXER_IN1_SEL_IN 0xf24
|
||||
#define MT8195_MIXER_IN1_SEL_IN_FROM_MERGE0_ASYNC_SOUT 1
|
||||
|
||||
#define MT8195_VDO1_MIXER_IN2_SEL_IN 0xf28
|
||||
#define MT8195_MIXER_IN2_SEL_IN_FROM_MERGE1_ASYNC_SOUT 1
|
||||
|
||||
#define MT8195_VDO1_MIXER_IN3_SEL_IN 0xf2c
|
||||
#define MT8195_MIXER_IN3_SEL_IN_FROM_MERGE2_ASYNC_SOUT 1
|
||||
|
||||
#define MT8195_VDO1_MIXER_IN4_SEL_IN 0xf30
|
||||
#define MT8195_MIXER_IN4_SEL_IN_FROM_MERGE3_ASYNC_SOUT 1
|
||||
|
||||
#define MT8195_VDO1_MIXER_OUT_SOUT_SEL 0xf34
|
||||
#define MT8195_MIXER_SOUT_TO_MERGE4_ASYNC_SEL 1
|
||||
|
||||
#define MT8195_VDO1_VPP_MERGE1_P0_SEL_IN 0xf3c
|
||||
#define MT8195_VPP_MERGE1_P0_SEL_IN_FROM_MDP_RDMA2 1
|
||||
|
||||
#define MT8195_VDO1_MERGE0_ASYNC_SOUT_SEL 0xf40
|
||||
#define MT8195_SOUT_TO_MIXER_IN1_SEL 1
|
||||
|
||||
#define MT8195_VDO1_MERGE1_ASYNC_SOUT_SEL 0xf44
|
||||
#define MT8195_SOUT_TO_MIXER_IN2_SEL 1
|
||||
|
||||
#define MT8195_VDO1_MERGE2_ASYNC_SOUT_SEL 0xf48
|
||||
#define MT8195_SOUT_TO_MIXER_IN3_SEL 1
|
||||
|
||||
#define MT8195_VDO1_MERGE3_ASYNC_SOUT_SEL 0xf4c
|
||||
#define MT8195_SOUT_TO_MIXER_IN4_SEL 1
|
||||
|
||||
#define MT8195_VDO1_MERGE4_ASYNC_SEL_IN 0xf50
|
||||
#define MT8195_MERGE4_ASYNC_SEL_IN_FROM_MIXER_OUT_SOUT 1
|
||||
|
||||
#define MT8195_VDO1_MIXER_IN1_SOUT_SEL 0xf58
|
||||
#define MT8195_MIXER_IN1_SOUT_TO_DISP_MIXER 0
|
||||
|
||||
#define MT8195_VDO1_MIXER_IN2_SOUT_SEL 0xf5c
|
||||
#define MT8195_MIXER_IN2_SOUT_TO_DISP_MIXER 0
|
||||
|
||||
#define MT8195_VDO1_MIXER_IN3_SOUT_SEL 0xf60
|
||||
#define MT8195_MIXER_IN3_SOUT_TO_DISP_MIXER 0
|
||||
|
||||
#define MT8195_VDO1_MIXER_IN4_SOUT_SEL 0xf64
|
||||
#define MT8195_MIXER_IN4_SOUT_TO_DISP_MIXER 0
|
||||
|
||||
#define MT8195_VDO1_MIXER_SOUT_SEL_IN 0xf68
|
||||
#define MT8195_MIXER_SOUT_SEL_IN_FROM_DISP_MIXER 0
|
||||
|
||||
static const struct mtk_mmsys_routes mmsys_mt8195_routing_table[] = {
|
||||
{
|
||||
DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0,
|
||||
@ -367,4 +438,79 @@ static const struct mtk_mmsys_routes mmsys_mt8195_routing_table[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_routes mmsys_mt8195_vdo1_routing_table[] = {
|
||||
{
|
||||
DDP_COMPONENT_MDP_RDMA0, DDP_COMPONENT_MERGE1,
|
||||
MT8195_VDO1_VPP_MERGE0_P0_SEL_IN, GENMASK(0, 0),
|
||||
MT8195_VPP_MERGE0_P0_SEL_IN_FROM_MDP_RDMA0
|
||||
}, {
|
||||
DDP_COMPONENT_MDP_RDMA1, DDP_COMPONENT_MERGE1,
|
||||
MT8195_VDO1_VPP_MERGE0_P1_SEL_IN, GENMASK(0, 0),
|
||||
MT8195_VPP_MERGE0_P1_SEL_IN_FROM_MDP_RDMA1
|
||||
}, {
|
||||
DDP_COMPONENT_MDP_RDMA2, DDP_COMPONENT_MERGE2,
|
||||
MT8195_VDO1_VPP_MERGE1_P0_SEL_IN, GENMASK(0, 0),
|
||||
MT8195_VPP_MERGE1_P0_SEL_IN_FROM_MDP_RDMA2
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE1, DDP_COMPONENT_ETHDR_MIXER,
|
||||
MT8195_VDO1_MERGE0_ASYNC_SOUT_SEL, GENMASK(1, 0),
|
||||
MT8195_SOUT_TO_MIXER_IN1_SEL
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE2, DDP_COMPONENT_ETHDR_MIXER,
|
||||
MT8195_VDO1_MERGE1_ASYNC_SOUT_SEL, GENMASK(1, 0),
|
||||
MT8195_SOUT_TO_MIXER_IN2_SEL
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE3, DDP_COMPONENT_ETHDR_MIXER,
|
||||
MT8195_VDO1_MERGE2_ASYNC_SOUT_SEL, GENMASK(1, 0),
|
||||
MT8195_SOUT_TO_MIXER_IN3_SEL
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE4, DDP_COMPONENT_ETHDR_MIXER,
|
||||
MT8195_VDO1_MERGE3_ASYNC_SOUT_SEL, GENMASK(1, 0),
|
||||
MT8195_SOUT_TO_MIXER_IN4_SEL
|
||||
}, {
|
||||
DDP_COMPONENT_ETHDR_MIXER, DDP_COMPONENT_MERGE5,
|
||||
MT8195_VDO1_MIXER_OUT_SOUT_SEL, GENMASK(0, 0),
|
||||
MT8195_MIXER_SOUT_TO_MERGE4_ASYNC_SEL
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE1, DDP_COMPONENT_ETHDR_MIXER,
|
||||
MT8195_VDO1_MIXER_IN1_SEL_IN, GENMASK(0, 0),
|
||||
MT8195_MIXER_IN1_SEL_IN_FROM_MERGE0_ASYNC_SOUT
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE2, DDP_COMPONENT_ETHDR_MIXER,
|
||||
MT8195_VDO1_MIXER_IN2_SEL_IN, GENMASK(0, 0),
|
||||
MT8195_MIXER_IN2_SEL_IN_FROM_MERGE1_ASYNC_SOUT
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE3, DDP_COMPONENT_ETHDR_MIXER,
|
||||
MT8195_VDO1_MIXER_IN3_SEL_IN, GENMASK(0, 0),
|
||||
MT8195_MIXER_IN3_SEL_IN_FROM_MERGE2_ASYNC_SOUT
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE4, DDP_COMPONENT_ETHDR_MIXER,
|
||||
MT8195_VDO1_MIXER_IN4_SEL_IN, GENMASK(0, 0),
|
||||
MT8195_MIXER_IN4_SEL_IN_FROM_MERGE3_ASYNC_SOUT
|
||||
}, {
|
||||
DDP_COMPONENT_ETHDR_MIXER, DDP_COMPONENT_MERGE5,
|
||||
MT8195_VDO1_MIXER_SOUT_SEL_IN, GENMASK(2, 0),
|
||||
MT8195_MIXER_SOUT_SEL_IN_FROM_DISP_MIXER
|
||||
}, {
|
||||
DDP_COMPONENT_ETHDR_MIXER, DDP_COMPONENT_MERGE5,
|
||||
MT8195_VDO1_MERGE4_ASYNC_SEL_IN, GENMASK(2, 0),
|
||||
MT8195_MERGE4_ASYNC_SEL_IN_FROM_MIXER_OUT_SOUT
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE5, DDP_COMPONENT_DPI1,
|
||||
MT8195_VDO1_DISP_DPI1_SEL_IN, GENMASK(1, 0),
|
||||
MT8195_DISP_DPI1_SEL_IN_FROM_VPP_MERGE4_MOUT
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE5, DDP_COMPONENT_DPI1,
|
||||
MT8195_VDO1_MERGE4_SOUT_SEL, GENMASK(1, 0),
|
||||
MT8195_MERGE4_SOUT_TO_DPI1_SEL
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE5, DDP_COMPONENT_DP_INTF1,
|
||||
MT8195_VDO1_DISP_DP_INTF0_SEL_IN, GENMASK(1, 0),
|
||||
MT8195_DISP_DP_INTF0_SEL_IN_FROM_VPP_MERGE4_MOUT
|
||||
}, {
|
||||
DDP_COMPONENT_MERGE5, DDP_COMPONENT_DP_INTF1,
|
||||
MT8195_VDO1_MERGE4_SOUT_SEL, GENMASK(1, 0),
|
||||
MT8195_MERGE4_SOUT_TO_DP_INTF0_SEL
|
||||
}
|
||||
};
|
||||
#endif /* __SOC_MEDIATEK_MT8195_MMSYS_H */
|
||||
|
@ -276,19 +276,14 @@ static int mtk_devapc_probe(struct platform_device *pdev)
|
||||
if (!devapc_irq)
|
||||
return -EINVAL;
|
||||
|
||||
ctx->infra_clk = devm_clk_get(&pdev->dev, "devapc-infra-clock");
|
||||
ctx->infra_clk = devm_clk_get_enabled(&pdev->dev, "devapc-infra-clock");
|
||||
if (IS_ERR(ctx->infra_clk))
|
||||
return -EINVAL;
|
||||
|
||||
if (clk_prepare_enable(ctx->infra_clk))
|
||||
return -EINVAL;
|
||||
|
||||
ret = devm_request_irq(&pdev->dev, devapc_irq, devapc_violation_irq,
|
||||
IRQF_TRIGGER_NONE, "devapc", ctx);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(ctx->infra_clk);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, ctx);
|
||||
|
||||
@ -303,8 +298,6 @@ static int mtk_devapc_remove(struct platform_device *pdev)
|
||||
|
||||
stop_devapc(ctx);
|
||||
|
||||
clk_disable_unprepare(ctx->infra_clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/reset-controller.h>
|
||||
@ -16,10 +17,13 @@
|
||||
#include "mt8167-mmsys.h"
|
||||
#include "mt8183-mmsys.h"
|
||||
#include "mt8186-mmsys.h"
|
||||
#include "mt8188-mmsys.h"
|
||||
#include "mt8192-mmsys.h"
|
||||
#include "mt8195-mmsys.h"
|
||||
#include "mt8365-mmsys.h"
|
||||
|
||||
#define MMSYS_SW_RESET_PER_REG 32
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt2701_mmsys_driver_data = {
|
||||
.clk_driver = "clk-mt2701-mm",
|
||||
.routes = mmsys_default_routing_table,
|
||||
@ -51,6 +55,7 @@ static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = {
|
||||
.routes = mmsys_default_routing_table,
|
||||
.num_routes = ARRAY_SIZE(mmsys_default_routing_table),
|
||||
.sw0_rst_offset = MT8183_MMSYS_SW0_RST_B,
|
||||
.num_resets = 32,
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = {
|
||||
@ -58,6 +63,7 @@ static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = {
|
||||
.routes = mmsys_mt8183_routing_table,
|
||||
.num_routes = ARRAY_SIZE(mmsys_mt8183_routing_table),
|
||||
.sw0_rst_offset = MT8183_MMSYS_SW0_RST_B,
|
||||
.num_resets = 32,
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt8186_mmsys_driver_data = {
|
||||
@ -65,6 +71,13 @@ static const struct mtk_mmsys_driver_data mt8186_mmsys_driver_data = {
|
||||
.routes = mmsys_mt8186_routing_table,
|
||||
.num_routes = ARRAY_SIZE(mmsys_mt8186_routing_table),
|
||||
.sw0_rst_offset = MT8186_MMSYS_SW0_RST_B,
|
||||
.num_resets = 32,
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt8188_vdosys0_driver_data = {
|
||||
.clk_driver = "clk-mt8188-vdo0",
|
||||
.routes = mmsys_mt8188_routing_table,
|
||||
.num_routes = ARRAY_SIZE(mmsys_mt8188_routing_table),
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = {
|
||||
@ -72,6 +85,7 @@ static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = {
|
||||
.routes = mmsys_mt8192_routing_table,
|
||||
.num_routes = ARRAY_SIZE(mmsys_mt8192_routing_table),
|
||||
.sw0_rst_offset = MT8186_MMSYS_SW0_RST_B,
|
||||
.num_resets = 32,
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = {
|
||||
@ -80,6 +94,24 @@ static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = {
|
||||
.num_routes = ARRAY_SIZE(mmsys_mt8195_routing_table),
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = {
|
||||
.clk_driver = "clk-mt8195-vdo1",
|
||||
.routes = mmsys_mt8195_vdo1_routing_table,
|
||||
.num_routes = ARRAY_SIZE(mmsys_mt8195_vdo1_routing_table),
|
||||
.sw0_rst_offset = MT8195_VDO1_SW0_RST_B,
|
||||
.num_resets = 64,
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt8195_vppsys0_driver_data = {
|
||||
.clk_driver = "clk-mt8195-vpp0",
|
||||
.is_vppsys = true,
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt8195_vppsys1_driver_data = {
|
||||
.clk_driver = "clk-mt8195-vpp1",
|
||||
.is_vppsys = true,
|
||||
};
|
||||
|
||||
static const struct mtk_mmsys_driver_data mt8365_mmsys_driver_data = {
|
||||
.clk_driver = "clk-mt8365-mm",
|
||||
.routes = mt8365_mmsys_routing_table,
|
||||
@ -91,24 +123,44 @@ struct mtk_mmsys {
|
||||
const struct mtk_mmsys_driver_data *data;
|
||||
spinlock_t lock; /* protects mmsys_sw_rst_b reg */
|
||||
struct reset_controller_dev rcdev;
|
||||
struct cmdq_client_reg cmdq_base;
|
||||
};
|
||||
|
||||
static void mtk_mmsys_update_bits(struct mtk_mmsys *mmsys, u32 offset, u32 mask, u32 val,
|
||||
struct cmdq_pkt *cmdq_pkt)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
|
||||
if (cmdq_pkt) {
|
||||
if (mmsys->cmdq_base.size == 0) {
|
||||
pr_err("mmsys lose gce property, failed to update mmsys bits with cmdq");
|
||||
return;
|
||||
}
|
||||
cmdq_pkt_write_mask(cmdq_pkt, mmsys->cmdq_base.subsys,
|
||||
mmsys->cmdq_base.offset + offset, val,
|
||||
mask);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
tmp = readl_relaxed(mmsys->regs + offset);
|
||||
tmp = (tmp & ~mask) | (val & mask);
|
||||
writel_relaxed(tmp, mmsys->regs + offset);
|
||||
}
|
||||
|
||||
void mtk_mmsys_ddp_connect(struct device *dev,
|
||||
enum mtk_ddp_comp_id cur,
|
||||
enum mtk_ddp_comp_id next)
|
||||
{
|
||||
struct mtk_mmsys *mmsys = dev_get_drvdata(dev);
|
||||
const struct mtk_mmsys_routes *routes = mmsys->data->routes;
|
||||
u32 reg;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mmsys->data->num_routes; i++)
|
||||
if (cur == routes[i].from_comp && next == routes[i].to_comp) {
|
||||
reg = readl_relaxed(mmsys->regs + routes[i].addr);
|
||||
reg &= ~routes[i].mask;
|
||||
reg |= routes[i].val;
|
||||
writel_relaxed(reg, mmsys->regs + routes[i].addr);
|
||||
}
|
||||
if (cur == routes[i].from_comp && next == routes[i].to_comp)
|
||||
mtk_mmsys_update_bits(mmsys, routes[i].addr, routes[i].mask,
|
||||
routes[i].val, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_mmsys_ddp_connect);
|
||||
|
||||
@ -118,26 +170,51 @@ void mtk_mmsys_ddp_disconnect(struct device *dev,
|
||||
{
|
||||
struct mtk_mmsys *mmsys = dev_get_drvdata(dev);
|
||||
const struct mtk_mmsys_routes *routes = mmsys->data->routes;
|
||||
u32 reg;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mmsys->data->num_routes; i++)
|
||||
if (cur == routes[i].from_comp && next == routes[i].to_comp) {
|
||||
reg = readl_relaxed(mmsys->regs + routes[i].addr);
|
||||
reg &= ~routes[i].mask;
|
||||
writel_relaxed(reg, mmsys->regs + routes[i].addr);
|
||||
}
|
||||
if (cur == routes[i].from_comp && next == routes[i].to_comp)
|
||||
mtk_mmsys_update_bits(mmsys, routes[i].addr, routes[i].mask, 0, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_mmsys_ddp_disconnect);
|
||||
|
||||
static void mtk_mmsys_update_bits(struct mtk_mmsys *mmsys, u32 offset, u32 mask, u32 val)
|
||||
void mtk_mmsys_merge_async_config(struct device *dev, int idx, int width, int height,
|
||||
struct cmdq_pkt *cmdq_pkt)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl_relaxed(mmsys->regs + offset);
|
||||
tmp = (tmp & ~mask) | val;
|
||||
writel_relaxed(tmp, mmsys->regs + offset);
|
||||
mtk_mmsys_update_bits(dev_get_drvdata(dev), MT8195_VDO1_MERGE0_ASYNC_CFG_WD + 0x10 * idx,
|
||||
~0, height << 16 | width, cmdq_pkt);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_mmsys_merge_async_config);
|
||||
|
||||
void mtk_mmsys_hdr_config(struct device *dev, int be_width, int be_height,
|
||||
struct cmdq_pkt *cmdq_pkt)
|
||||
{
|
||||
mtk_mmsys_update_bits(dev_get_drvdata(dev), MT8195_VDO1_HDRBE_ASYNC_CFG_WD, ~0,
|
||||
be_height << 16 | be_width, cmdq_pkt);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_mmsys_hdr_config);
|
||||
|
||||
void mtk_mmsys_mixer_in_config(struct device *dev, int idx, bool alpha_sel, u16 alpha,
|
||||
u8 mode, u32 biwidth, struct cmdq_pkt *cmdq_pkt)
|
||||
{
|
||||
struct mtk_mmsys *mmsys = dev_get_drvdata(dev);
|
||||
|
||||
mtk_mmsys_update_bits(mmsys, MT8195_VDO1_MIXER_IN1_ALPHA + (idx - 1) * 4, ~0,
|
||||
alpha << 16 | alpha, cmdq_pkt);
|
||||
mtk_mmsys_update_bits(mmsys, MT8195_VDO1_HDR_TOP_CFG, BIT(19 + idx),
|
||||
alpha_sel << (19 + idx), cmdq_pkt);
|
||||
mtk_mmsys_update_bits(mmsys, MT8195_VDO1_MIXER_IN1_PAD + (idx - 1) * 4,
|
||||
GENMASK(31, 16) | GENMASK(1, 0), biwidth << 16 | mode, cmdq_pkt);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_mmsys_mixer_in_config);
|
||||
|
||||
void mtk_mmsys_mixer_in_channel_swap(struct device *dev, int idx, bool channel_swap,
|
||||
struct cmdq_pkt *cmdq_pkt)
|
||||
{
|
||||
mtk_mmsys_update_bits(dev_get_drvdata(dev), MT8195_VDO1_MIXER_IN1_PAD + (idx - 1) * 4,
|
||||
BIT(4), channel_swap << 4, cmdq_pkt);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_mmsys_mixer_in_channel_swap);
|
||||
|
||||
void mtk_mmsys_ddp_dpi_fmt_config(struct device *dev, u32 val)
|
||||
{
|
||||
@ -146,20 +223,20 @@ void mtk_mmsys_ddp_dpi_fmt_config(struct device *dev, u32 val)
|
||||
switch (val) {
|
||||
case MTK_DPI_RGB888_SDR_CON:
|
||||
mtk_mmsys_update_bits(mmsys, MT8186_MMSYS_DPI_OUTPUT_FORMAT,
|
||||
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB888_SDR_CON);
|
||||
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB888_SDR_CON, NULL);
|
||||
break;
|
||||
case MTK_DPI_RGB565_SDR_CON:
|
||||
mtk_mmsys_update_bits(mmsys, MT8186_MMSYS_DPI_OUTPUT_FORMAT,
|
||||
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB565_SDR_CON);
|
||||
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB565_SDR_CON, NULL);
|
||||
break;
|
||||
case MTK_DPI_RGB565_DDR_CON:
|
||||
mtk_mmsys_update_bits(mmsys, MT8186_MMSYS_DPI_OUTPUT_FORMAT,
|
||||
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB565_DDR_CON);
|
||||
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB565_DDR_CON, NULL);
|
||||
break;
|
||||
case MTK_DPI_RGB888_DDR_CON:
|
||||
default:
|
||||
mtk_mmsys_update_bits(mmsys, MT8186_MMSYS_DPI_OUTPUT_FORMAT,
|
||||
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB888_DDR_CON);
|
||||
MT8186_DPI_FORMAT_MASK, MT8186_DPI_RGB888_DDR_CON, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -170,18 +247,19 @@ static int mtk_mmsys_reset_update(struct reset_controller_dev *rcdev, unsigned l
|
||||
{
|
||||
struct mtk_mmsys *mmsys = container_of(rcdev, struct mtk_mmsys, rcdev);
|
||||
unsigned long flags;
|
||||
u32 offset;
|
||||
u32 reg;
|
||||
|
||||
offset = (id / MMSYS_SW_RESET_PER_REG) * sizeof(u32);
|
||||
id = id % MMSYS_SW_RESET_PER_REG;
|
||||
reg = mmsys->data->sw0_rst_offset + offset;
|
||||
|
||||
spin_lock_irqsave(&mmsys->lock, flags);
|
||||
|
||||
reg = readl_relaxed(mmsys->regs + mmsys->data->sw0_rst_offset);
|
||||
|
||||
if (assert)
|
||||
reg &= ~BIT(id);
|
||||
mtk_mmsys_update_bits(mmsys, reg, BIT(id), 0, NULL);
|
||||
else
|
||||
reg |= BIT(id);
|
||||
|
||||
writel_relaxed(reg, mmsys->regs + mmsys->data->sw0_rst_offset);
|
||||
mtk_mmsys_update_bits(mmsys, reg, BIT(id), BIT(id), NULL);
|
||||
|
||||
spin_unlock_irqrestore(&mmsys->lock, flags);
|
||||
|
||||
@ -236,19 +314,28 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
spin_lock_init(&mmsys->lock);
|
||||
mmsys->data = of_device_get_match_data(&pdev->dev);
|
||||
|
||||
mmsys->rcdev.owner = THIS_MODULE;
|
||||
mmsys->rcdev.nr_resets = 32;
|
||||
mmsys->rcdev.ops = &mtk_mmsys_reset_ops;
|
||||
mmsys->rcdev.of_node = pdev->dev.of_node;
|
||||
ret = devm_reset_controller_register(&pdev->dev, &mmsys->rcdev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Couldn't register mmsys reset controller: %d\n", ret);
|
||||
return ret;
|
||||
if (mmsys->data->num_resets > 0) {
|
||||
spin_lock_init(&mmsys->lock);
|
||||
|
||||
mmsys->rcdev.owner = THIS_MODULE;
|
||||
mmsys->rcdev.nr_resets = mmsys->data->num_resets;
|
||||
mmsys->rcdev.ops = &mtk_mmsys_reset_ops;
|
||||
mmsys->rcdev.of_node = pdev->dev.of_node;
|
||||
ret = devm_reset_controller_register(&pdev->dev, &mmsys->rcdev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Couldn't register mmsys reset controller: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
mmsys->data = of_device_get_match_data(&pdev->dev);
|
||||
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
|
||||
ret = cmdq_dev_get_client_reg(dev, &mmsys->cmdq_base, 0);
|
||||
if (ret)
|
||||
dev_dbg(dev, "No mediatek,gce-client-reg!\n");
|
||||
#endif
|
||||
|
||||
platform_set_drvdata(pdev, mmsys);
|
||||
|
||||
clks = platform_device_register_data(&pdev->dev, mmsys->data->clk_driver,
|
||||
@ -256,6 +343,9 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(clks))
|
||||
return PTR_ERR(clks);
|
||||
|
||||
if (mmsys->data->is_vppsys)
|
||||
goto out_probe_done;
|
||||
|
||||
drm = platform_device_register_data(&pdev->dev, "mediatek-drm",
|
||||
PLATFORM_DEVID_AUTO, NULL, 0);
|
||||
if (IS_ERR(drm)) {
|
||||
@ -263,6 +353,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(drm);
|
||||
}
|
||||
|
||||
out_probe_done:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -299,6 +390,10 @@ static const struct of_device_id of_match_mtk_mmsys[] = {
|
||||
.compatible = "mediatek,mt8186-mmsys",
|
||||
.data = &mt8186_mmsys_driver_data,
|
||||
},
|
||||
{
|
||||
.compatible = "mediatek,mt8188-vdosys0",
|
||||
.data = &mt8188_vdosys0_driver_data,
|
||||
},
|
||||
{
|
||||
.compatible = "mediatek,mt8192-mmsys",
|
||||
.data = &mt8192_mmsys_driver_data,
|
||||
@ -311,6 +406,18 @@ static const struct of_device_id of_match_mtk_mmsys[] = {
|
||||
.compatible = "mediatek,mt8195-vdosys0",
|
||||
.data = &mt8195_vdosys0_driver_data,
|
||||
},
|
||||
{
|
||||
.compatible = "mediatek,mt8195-vdosys1",
|
||||
.data = &mt8195_vdosys1_driver_data,
|
||||
},
|
||||
{
|
||||
.compatible = "mediatek,mt8195-vppsys0",
|
||||
.data = &mt8195_vppsys0_driver_data,
|
||||
},
|
||||
{
|
||||
.compatible = "mediatek,mt8195-vppsys1",
|
||||
.data = &mt8195_vppsys1_driver_data,
|
||||
},
|
||||
{
|
||||
.compatible = "mediatek,mt8365-mmsys",
|
||||
.data = &mt8365_mmsys_driver_data,
|
||||
@ -326,4 +433,19 @@ static struct platform_driver mtk_mmsys_drv = {
|
||||
.probe = mtk_mmsys_probe,
|
||||
};
|
||||
|
||||
builtin_platform_driver(mtk_mmsys_drv);
|
||||
static int __init mtk_mmsys_init(void)
|
||||
{
|
||||
return platform_driver_register(&mtk_mmsys_drv);
|
||||
}
|
||||
|
||||
static void __exit mtk_mmsys_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&mtk_mmsys_drv);
|
||||
}
|
||||
|
||||
module_init(mtk_mmsys_init);
|
||||
module_exit(mtk_mmsys_exit);
|
||||
|
||||
MODULE_AUTHOR("Yongqiang Niu <yongqiang.niu@mediatek.com>");
|
||||
MODULE_DESCRIPTION("MediaTek SoC MMSYS driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -91,6 +91,8 @@ struct mtk_mmsys_driver_data {
|
||||
const struct mtk_mmsys_routes *routes;
|
||||
const unsigned int num_routes;
|
||||
const u16 sw0_rst_offset;
|
||||
const u32 num_resets;
|
||||
const bool is_vppsys;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -116,6 +116,21 @@
|
||||
#define MT8173_MUTEX_MOD_DISP_PWM1 24
|
||||
#define MT8173_MUTEX_MOD_DISP_OD 25
|
||||
|
||||
#define MT8188_MUTEX_MOD_DISP_OVL0 0
|
||||
#define MT8188_MUTEX_MOD_DISP_WDMA0 1
|
||||
#define MT8188_MUTEX_MOD_DISP_RDMA0 2
|
||||
#define MT8188_MUTEX_MOD_DISP_COLOR0 3
|
||||
#define MT8188_MUTEX_MOD_DISP_CCORR0 4
|
||||
#define MT8188_MUTEX_MOD_DISP_AAL0 5
|
||||
#define MT8188_MUTEX_MOD_DISP_GAMMA0 6
|
||||
#define MT8188_MUTEX_MOD_DISP_DITHER0 7
|
||||
#define MT8188_MUTEX_MOD_DISP_DSI0 8
|
||||
#define MT8188_MUTEX_MOD_DISP_DSC_WRAP0_CORE0 9
|
||||
#define MT8188_MUTEX_MOD_DISP_VPP_MERGE 20
|
||||
#define MT8188_MUTEX_MOD_DISP_DP_INTF0 21
|
||||
#define MT8188_MUTEX_MOD_DISP_POSTMASK0 24
|
||||
#define MT8188_MUTEX_MOD2_DISP_PWM0 33
|
||||
|
||||
#define MT8195_MUTEX_MOD_DISP_OVL0 0
|
||||
#define MT8195_MUTEX_MOD_DISP_WDMA0 1
|
||||
#define MT8195_MUTEX_MOD_DISP_RDMA0 2
|
||||
@ -130,6 +145,24 @@
|
||||
#define MT8195_MUTEX_MOD_DISP_DP_INTF0 21
|
||||
#define MT8195_MUTEX_MOD_DISP_PWM0 27
|
||||
|
||||
#define MT8195_MUTEX_MOD_DISP1_MDP_RDMA0 0
|
||||
#define MT8195_MUTEX_MOD_DISP1_MDP_RDMA1 1
|
||||
#define MT8195_MUTEX_MOD_DISP1_MDP_RDMA2 2
|
||||
#define MT8195_MUTEX_MOD_DISP1_MDP_RDMA3 3
|
||||
#define MT8195_MUTEX_MOD_DISP1_MDP_RDMA4 4
|
||||
#define MT8195_MUTEX_MOD_DISP1_MDP_RDMA5 5
|
||||
#define MT8195_MUTEX_MOD_DISP1_MDP_RDMA6 6
|
||||
#define MT8195_MUTEX_MOD_DISP1_MDP_RDMA7 7
|
||||
#define MT8195_MUTEX_MOD_DISP1_VPP_MERGE0 8
|
||||
#define MT8195_MUTEX_MOD_DISP1_VPP_MERGE1 9
|
||||
#define MT8195_MUTEX_MOD_DISP1_VPP_MERGE2 10
|
||||
#define MT8195_MUTEX_MOD_DISP1_VPP_MERGE3 11
|
||||
#define MT8195_MUTEX_MOD_DISP1_VPP_MERGE4 12
|
||||
#define MT8195_MUTEX_MOD_DISP1_DISP_MIXER 18
|
||||
#define MT8195_MUTEX_MOD_DISP1_DPI0 25
|
||||
#define MT8195_MUTEX_MOD_DISP1_DPI1 26
|
||||
#define MT8195_MUTEX_MOD_DISP1_DP_INTF0 27
|
||||
|
||||
#define MT8365_MUTEX_MOD_DISP_OVL0 7
|
||||
#define MT8365_MUTEX_MOD_DISP_OVL0_2L 8
|
||||
#define MT8365_MUTEX_MOD_DISP_RDMA0 9
|
||||
@ -180,6 +213,8 @@
|
||||
#define MT8167_MUTEX_SOF_DPI1 3
|
||||
#define MT8183_MUTEX_SOF_DSI0 1
|
||||
#define MT8183_MUTEX_SOF_DPI0 2
|
||||
#define MT8188_MUTEX_SOF_DSI0 1
|
||||
#define MT8188_MUTEX_SOF_DP_INTF0 3
|
||||
#define MT8195_MUTEX_SOF_DSI0 1
|
||||
#define MT8195_MUTEX_SOF_DSI1 2
|
||||
#define MT8195_MUTEX_SOF_DP_INTF0 3
|
||||
@ -189,6 +224,8 @@
|
||||
|
||||
#define MT8183_MUTEX_EOF_DSI0 (MT8183_MUTEX_SOF_DSI0 << 6)
|
||||
#define MT8183_MUTEX_EOF_DPI0 (MT8183_MUTEX_SOF_DPI0 << 6)
|
||||
#define MT8188_MUTEX_EOF_DSI0 (MT8188_MUTEX_SOF_DSI0 << 7)
|
||||
#define MT8188_MUTEX_EOF_DP_INTF0 (MT8188_MUTEX_SOF_DP_INTF0 << 7)
|
||||
#define MT8195_MUTEX_EOF_DSI0 (MT8195_MUTEX_SOF_DSI0 << 7)
|
||||
#define MT8195_MUTEX_EOF_DSI1 (MT8195_MUTEX_SOF_DSI1 << 7)
|
||||
#define MT8195_MUTEX_EOF_DP_INTF0 (MT8195_MUTEX_SOF_DP_INTF0 << 7)
|
||||
@ -344,6 +381,23 @@ static const unsigned int mt8186_mdp_mutex_table_mod[MUTEX_MOD_IDX_MAX] = {
|
||||
[MUTEX_MOD_IDX_MDP_COLOR0] = MT8186_MUTEX_MOD_MDP_COLOR0,
|
||||
};
|
||||
|
||||
static const unsigned int mt8188_mutex_mod[DDP_COMPONENT_ID_MAX] = {
|
||||
[DDP_COMPONENT_OVL0] = MT8188_MUTEX_MOD_DISP_OVL0,
|
||||
[DDP_COMPONENT_WDMA0] = MT8188_MUTEX_MOD_DISP_WDMA0,
|
||||
[DDP_COMPONENT_RDMA0] = MT8188_MUTEX_MOD_DISP_RDMA0,
|
||||
[DDP_COMPONENT_COLOR0] = MT8188_MUTEX_MOD_DISP_COLOR0,
|
||||
[DDP_COMPONENT_CCORR] = MT8188_MUTEX_MOD_DISP_CCORR0,
|
||||
[DDP_COMPONENT_AAL0] = MT8188_MUTEX_MOD_DISP_AAL0,
|
||||
[DDP_COMPONENT_GAMMA] = MT8188_MUTEX_MOD_DISP_GAMMA0,
|
||||
[DDP_COMPONENT_POSTMASK0] = MT8188_MUTEX_MOD_DISP_POSTMASK0,
|
||||
[DDP_COMPONENT_DITHER0] = MT8188_MUTEX_MOD_DISP_DITHER0,
|
||||
[DDP_COMPONENT_MERGE0] = MT8188_MUTEX_MOD_DISP_VPP_MERGE,
|
||||
[DDP_COMPONENT_DSC0] = MT8188_MUTEX_MOD_DISP_DSC_WRAP0_CORE0,
|
||||
[DDP_COMPONENT_DSI0] = MT8188_MUTEX_MOD_DISP_DSI0,
|
||||
[DDP_COMPONENT_PWM0] = MT8188_MUTEX_MOD2_DISP_PWM0,
|
||||
[DDP_COMPONENT_DP_INTF0] = MT8188_MUTEX_MOD_DISP_DP_INTF0,
|
||||
};
|
||||
|
||||
static const unsigned int mt8192_mutex_mod[DDP_COMPONENT_ID_MAX] = {
|
||||
[DDP_COMPONENT_AAL0] = MT8192_MUTEX_MOD_DISP_AAL0,
|
||||
[DDP_COMPONENT_CCORR] = MT8192_MUTEX_MOD_DISP_CCORR0,
|
||||
@ -372,6 +426,21 @@ static const unsigned int mt8195_mutex_mod[DDP_COMPONENT_ID_MAX] = {
|
||||
[DDP_COMPONENT_DSI0] = MT8195_MUTEX_MOD_DISP_DSI0,
|
||||
[DDP_COMPONENT_PWM0] = MT8195_MUTEX_MOD_DISP_PWM0,
|
||||
[DDP_COMPONENT_DP_INTF0] = MT8195_MUTEX_MOD_DISP_DP_INTF0,
|
||||
[DDP_COMPONENT_MDP_RDMA0] = MT8195_MUTEX_MOD_DISP1_MDP_RDMA0,
|
||||
[DDP_COMPONENT_MDP_RDMA1] = MT8195_MUTEX_MOD_DISP1_MDP_RDMA1,
|
||||
[DDP_COMPONENT_MDP_RDMA2] = MT8195_MUTEX_MOD_DISP1_MDP_RDMA2,
|
||||
[DDP_COMPONENT_MDP_RDMA3] = MT8195_MUTEX_MOD_DISP1_MDP_RDMA3,
|
||||
[DDP_COMPONENT_MDP_RDMA4] = MT8195_MUTEX_MOD_DISP1_MDP_RDMA4,
|
||||
[DDP_COMPONENT_MDP_RDMA5] = MT8195_MUTEX_MOD_DISP1_MDP_RDMA5,
|
||||
[DDP_COMPONENT_MDP_RDMA6] = MT8195_MUTEX_MOD_DISP1_MDP_RDMA6,
|
||||
[DDP_COMPONENT_MDP_RDMA7] = MT8195_MUTEX_MOD_DISP1_MDP_RDMA7,
|
||||
[DDP_COMPONENT_MERGE1] = MT8195_MUTEX_MOD_DISP1_VPP_MERGE0,
|
||||
[DDP_COMPONENT_MERGE2] = MT8195_MUTEX_MOD_DISP1_VPP_MERGE1,
|
||||
[DDP_COMPONENT_MERGE3] = MT8195_MUTEX_MOD_DISP1_VPP_MERGE2,
|
||||
[DDP_COMPONENT_MERGE4] = MT8195_MUTEX_MOD_DISP1_VPP_MERGE3,
|
||||
[DDP_COMPONENT_ETHDR_MIXER] = MT8195_MUTEX_MOD_DISP1_DISP_MIXER,
|
||||
[DDP_COMPONENT_MERGE5] = MT8195_MUTEX_MOD_DISP1_VPP_MERGE4,
|
||||
[DDP_COMPONENT_DP_INTF1] = MT8195_MUTEX_MOD_DISP1_DP_INTF0,
|
||||
};
|
||||
|
||||
static const unsigned int mt8365_mutex_mod[DDP_COMPONENT_ID_MAX] = {
|
||||
@ -435,6 +504,14 @@ static const unsigned int mt8186_mutex_sof[MUTEX_SOF_DSI3 + 1] = {
|
||||
* but also detect the error at end of frame(EAEOF) when EOF signal
|
||||
* arrives.
|
||||
*/
|
||||
static const unsigned int mt8188_mutex_sof[DDP_MUTEX_SOF_MAX] = {
|
||||
[MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE,
|
||||
[MUTEX_SOF_DSI0] =
|
||||
MT8188_MUTEX_SOF_DSI0 | MT8188_MUTEX_EOF_DSI0,
|
||||
[MUTEX_SOF_DP_INTF0] =
|
||||
MT8188_MUTEX_SOF_DP_INTF0 | MT8188_MUTEX_EOF_DP_INTF0,
|
||||
};
|
||||
|
||||
static const unsigned int mt8195_mutex_sof[DDP_MUTEX_SOF_MAX] = {
|
||||
[MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE,
|
||||
[MUTEX_SOF_DSI0] = MT8195_MUTEX_SOF_DSI0 | MT8195_MUTEX_EOF_DSI0,
|
||||
@ -505,6 +582,13 @@ static const struct mtk_mutex_data mt8186_mutex_driver_data = {
|
||||
.mutex_sof_reg = MT8183_MUTEX0_SOF0,
|
||||
};
|
||||
|
||||
static const struct mtk_mutex_data mt8188_mutex_driver_data = {
|
||||
.mutex_mod = mt8188_mutex_mod,
|
||||
.mutex_sof = mt8188_mutex_sof,
|
||||
.mutex_mod_reg = MT8183_MUTEX0_MOD0,
|
||||
.mutex_sof_reg = MT8183_MUTEX0_SOF0,
|
||||
};
|
||||
|
||||
static const struct mtk_mutex_data mt8192_mutex_driver_data = {
|
||||
.mutex_mod = mt8192_mutex_mod,
|
||||
.mutex_sof = mt8183_mutex_sof,
|
||||
@ -602,6 +686,9 @@ void mtk_mutex_add_comp(struct mtk_mutex *mutex,
|
||||
case DDP_COMPONENT_DP_INTF0:
|
||||
sof_id = MUTEX_SOF_DP_INTF0;
|
||||
break;
|
||||
case DDP_COMPONENT_DP_INTF1:
|
||||
sof_id = MUTEX_SOF_DP_INTF1;
|
||||
break;
|
||||
default:
|
||||
if (mtx->data->mutex_mod[id] < 32) {
|
||||
offset = DISP_REG_MUTEX_MOD(mtx->data->mutex_mod_reg,
|
||||
@ -642,6 +729,7 @@ void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
|
||||
case DDP_COMPONENT_DPI0:
|
||||
case DDP_COMPONENT_DPI1:
|
||||
case DDP_COMPONENT_DP_INTF0:
|
||||
case DDP_COMPONENT_DP_INTF1:
|
||||
writel_relaxed(MUTEX_SOF_SINGLE_MODE,
|
||||
mtx->regs +
|
||||
DISP_REG_MUTEX_SOF(mtx->data->mutex_sof_reg,
|
||||
@ -832,11 +920,6 @@ static int mtk_mutex_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mtk_mutex_remove(struct platform_device *pdev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id mutex_driver_dt_match[] = {
|
||||
{ .compatible = "mediatek,mt2701-disp-mutex",
|
||||
.data = &mt2701_mutex_driver_data},
|
||||
@ -854,6 +937,8 @@ static const struct of_device_id mutex_driver_dt_match[] = {
|
||||
.data = &mt8186_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8186-mdp3-mutex",
|
||||
.data = &mt8186_mdp_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8188-disp-mutex",
|
||||
.data = &mt8188_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8192-disp-mutex",
|
||||
.data = &mt8192_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8195-disp-mutex",
|
||||
@ -866,7 +951,6 @@ MODULE_DEVICE_TABLE(of, mutex_driver_dt_match);
|
||||
|
||||
static struct platform_driver mtk_mutex_driver = {
|
||||
.probe = mtk_mutex_probe,
|
||||
.remove = mtk_mutex_remove,
|
||||
.driver = {
|
||||
.name = "mediatek-mutex",
|
||||
.owner = THIS_MODULE,
|
||||
@ -874,4 +958,19 @@ static struct platform_driver mtk_mutex_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(mtk_mutex_driver);
|
||||
static int __init mtk_mutex_init(void)
|
||||
{
|
||||
return platform_driver_register(&mtk_mutex_driver);
|
||||
}
|
||||
|
||||
static void __exit mtk_mutex_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&mtk_mutex_driver);
|
||||
}
|
||||
|
||||
module_init(mtk_mutex_init);
|
||||
module_exit(mtk_mutex_exit);
|
||||
|
||||
MODULE_AUTHOR("Yongqiang Niu <yongqiang.niu@mediatek.com>");
|
||||
MODULE_DESCRIPTION("MediaTek SoC MUTEX driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "mt8173-pm-domains.h"
|
||||
#include "mt8183-pm-domains.h"
|
||||
#include "mt8186-pm-domains.h"
|
||||
#include "mt8188-pm-domains.h"
|
||||
#include "mt8192-pm-domains.h"
|
||||
#include "mt8195-pm-domains.h"
|
||||
|
||||
@ -218,6 +219,10 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
|
||||
if (ret)
|
||||
goto err_reg;
|
||||
|
||||
if (pd->data->ext_buck_iso_offs && MTK_SCPD_CAPS(pd, MTK_SCPD_EXT_BUCK_ISO))
|
||||
regmap_clear_bits(scpsys->base, pd->data->ext_buck_iso_offs,
|
||||
pd->data->ext_buck_iso_mask);
|
||||
|
||||
/* subsys power on */
|
||||
regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT);
|
||||
regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT);
|
||||
@ -272,6 +277,10 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (pd->data->ext_buck_iso_offs && MTK_SCPD_CAPS(pd, MTK_SCPD_EXT_BUCK_ISO))
|
||||
regmap_set_bits(scpsys->base, pd->data->ext_buck_iso_offs,
|
||||
pd->data->ext_buck_iso_mask);
|
||||
|
||||
clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks);
|
||||
|
||||
/* subsys power off */
|
||||
@ -579,6 +588,10 @@ static const struct of_device_id scpsys_of_match[] = {
|
||||
.compatible = "mediatek,mt8186-power-controller",
|
||||
.data = &mt8186_scpsys_data,
|
||||
},
|
||||
{
|
||||
.compatible = "mediatek,mt8188-power-controller",
|
||||
.data = &mt8188_scpsys_data,
|
||||
},
|
||||
{
|
||||
.compatible = "mediatek,mt8192-power-controller",
|
||||
.data = &mt8192_scpsys_data,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user