Commit Graph

1071209 Commits

Author SHA1 Message Date
Can Guo
ca2f49515f defconfig: pineapple-gki: Add UFS configuration options
Add support for UFS configuration options for Pineapple platforms.

Change-Id: Iaed29e97450d9d76e2e3752e2bbbbe57a6c9ecc3
Signed-off-by: Can Guo <quic_cang@quicinc.com>
2022-04-11 02:01:11 -07:00
Can Guo
0c8d891fc4 build.config: modules.list.msm.pineapple: add ufs modules
Add UFS's modules so that they are loaded automatically during Linux kernel
boot up.

Change-Id: I19075a910eea5355de8c484fa234957d74db4ee5
Signed-off-by: Can Guo <quic_cang@quicinc.com>
2022-04-11 02:00:57 -07:00
Can Guo
6c9748a869 scsi: ufs-qcom: Port UFSHCI qcom specific changes from Kalama to Pineapple
Add UFSHCI qcom specific changes to support Pineapple platforms.
This is a snapshot of kernel msm-5.15 taken at commit <bb44a08e52736>
("sched/walt: Account for changing task affinity"). However, due to IPC
logging support is not yet available on Pineapple at this point, this
change has the IPC logging related lines in ufs-qcom.c neutralized.

Change-Id: I9bc5c8521014897fb44954209f5353d09b7f1164
Signed-off-by: Can Guo <quic_cang@quicinc.com>
2022-04-11 02:00:12 -07:00
Can Guo
99cbf18fa9 scsi: ufs-qcom: Add ICE NOP supporting functions
Currently the ICE is disabled. Adding nop functions to Pineapple platforms
for UFS to build. The actual support of the ICE will be addressed later
when the ICE is enabled.

Change-Id: I011ec23a6ffc43fae892685740b8632a94b917f2
Signed-off-by: Can Guo <quic_cang@quicinc.com>
2022-04-11 01:59:15 -07:00
Can Guo
fd375a80ad phy: qcom: Add fundamental UFS PHY drivers
Add fundamental UFS PHY drivers to support Pineapple pre-sil.

Change-Id: Ie90db61aee04c7d57632b41df69341b75350f635
Signed-off-by: Can Guo <quic_cang@quicinc.com>
2022-04-07 02:58:06 -07:00
qctecmdr
250faa59b7 Merge "defconfig: arm64: Enable the SMMU V2 driver" 2022-04-05 12:27:12 -07:00
qctecmdr
5f98f3c00e Merge "iommu/arm-smmu: Modify upstream SMMU V2 driver to support our SMMU" 2022-04-05 11:08:07 -07:00
Chris Goldsworthy
cdced925d0 defconfig: arm64: Enable the SMMU V2 driver
Enable the SMMU V2 driver.

Change-Id: I4f8ca33bf1cea6eedfa79d4da005a36f8697cf70
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2022-04-04 19:38:29 -07:00
Chris Goldsworthy
1916de1d2a modules.list.msm.pineapple: Load the SMMU module in the first stage
Load the SMMU module during the first stage init period.

Change-Id: Ic45ff739ca4c781434db3607d4d2d60bf37bd2d5
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2022-04-04 19:38:20 -07:00
Chris Goldsworthy
d18610604d iommu/arm-smmu: Modify upstream SMMU V2 driver to support our SMMU
Modify arm-smmu.c to allow for basic usage of our SMMU.

Change-Id: Ib541f02895e631b5f371513a1ba775ff7b710f38
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2022-04-01 16:18:31 -07:00
Taniya Das
bad04e2e90 clk: qcom: common: Check for rclks before access
The critical devices or critical clocks where the clocks of the device
node requires to be kept enabled should be checked for valid rclk before
update. Thus check for NULL before accessing the rclk.

Change-Id: Ie0cf1486f8cc422de8fce0241bd6e81fd9d7ca2b
Signed-off-by: Taniya Das <tdas@codeaurora.org>
2022-03-29 15:13:23 -07:00
Vivek Aknurwar
66d30da10f clk: qcom: Check clk_is_regmap() before accessing its data members
The clk_hw pointer can only be treated as a clk_regmap if the clk_hw is
known to be embedded within a clk_regmap structure. So first check that
before casting and accessing its data members.

Change-Id: Icad375b036ffa44c441ef16c45307bd2c0603de0
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
Signed-off-by: Mike Tipton <quic_mdtipton@quicinc.com>
2022-03-29 15:13:22 -07:00
Veera Vegivada
0804c7e037 clk: qcom: common: Add set_flags op in clk_regmap_ops
Add set_flags op in clk_regmap_ops and update the
set_flags op for branch's clk_regmap_ops.
Update qcom_clk_set_flags to use clk_regmap_ops
for invoking the set_flags op.

Change-Id: I82b699e04854e5d9dcc0e82caccf33fe3dd85315
Signed-off-by: Veera Vegivada <vvegivad@codeaurora.org>
2022-03-29 15:13:22 -07:00
Vivek Aknurwar
542b46b065 clk: qcom: rpmh: Add support for fixed-factor clocks
Usually xo_pad and bi_tcxo frequencies are identical. However, some chips
include an extra clock divider between xo_pad and bi_tcxo to provide
reference clocks to chip peripherals (PHY's).

Add support for fixed-factor clocks to capture this extra divide factor.

Change-Id: I3d32a4b708f1dd1ee37ca4e7557094e77a6db808
Signed-off-by: Vivek Aknurwar <quic_viveka@quicinc.com>
2022-03-29 15:13:22 -07:00
Taniya Das
a1dca775aa clk: qcom: clk-alpha-pll: Update the Lucid OLE PLL registers
The Lucid OLE PLL has an additional test control register which
is required to be programmed, thus introduce the register.

Change-Id: Ied541ef266e8423c0f4f67b3b816159044a17f2c
Signed-off-by: Taniya Das <tdas@codeaurora.org>
2022-03-29 15:13:22 -07:00
Vivek Aknurwar
cc59dbb6d2 clk: qcom: Add QCOM_CLK_BOOT_CRITICAL flag
Some clks are critical and required to be on during probe to sync-state,
and also later needs to controlled by consumers. Add QCOM_CLK_BOOT_CRITICAL
flag to achieve turning on clk during probe and also register wih clk
framework so consumers can control after boot.

Change-Id: I7465828ede6cea5614cada6b49f428f84780e995
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2022-03-29 15:13:22 -07:00
Mike Tipton
f0e9ac4de0 clk: qcom: clk-alpha-pll: Add support for rivian_ole
Add support for the rivian_ole PLL.

Change-Id: I245a31dde694d291e2ed30f750c877f8f6b3b0b8
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:22 -07:00
Vivek Aknurwar
e8ab729668 clk: qcom: clk-alpha-pll: Add support for controlling lucid_ole
Add programming sequence support for managing lucid_ole.

Change-Id: Id230731d0c58663ab1244ce9046c9083f7004b90
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2022-03-29 15:13:22 -07:00
Mike Tipton
dec56fe0c0 clk: qcom: Round parent rate in clk_rcg2_determine_rate
We currently set best_parent_rate to the ideal frequency wanted by the
RCG. This doesn't always align to the exact frequency the parent can
provide. If they differ, then clk_calc_new_rates() will return the
parent as top, even if the rounded parent frequency isn't changing.
This causes clk_propagate_rate_change() to return before being called
for its children, which means children aren't notified of the
PRE_RATE_CHANGE events.

Set best_parent_rate to the rounded rate so that we don't unnecessarily
try to change the parent.

Change-Id: Ic976db7a13dfbc63cb66b032a45060565ca90b43
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:22 -07:00
Mike Tipton
b2062dc9f4 clk: qcom: clk-alpha-pll: Add rivian_evo snapshot from msm-5.15
Add rivian_evo snapshot from msm-5.15 commit 123f6f081248 ("Merge "spi:
spi-msm-geni: clear qn_err flag before transfer"").

Change-Id: Ie55a247e3ca6b7167c29f3ac74262c18dc1d99ce
Signed-off-by: Mike Tipton <quic_mdtipton@quicinc.com>
2022-03-29 15:13:22 -07:00
Mike Tipton
a537a3a2aa clk: qcom: clk-alpha-pll: Add lucid_evo snapshot from msm-5.15
Add lucid_evo snapshot from msm-5.15 commit 123f6f081248 ("Merge "spi:
spi-msm-geni: clear qn_err flag before transfer"").

Change-Id: I494357d26a31ad0509da3a1112a324151acf4993
Signed-off-by: Mike Tipton <quic_mdtipton@quicinc.com>
2022-03-29 15:13:22 -07:00
Mike Tipton
fc35036bbb clk: qcom: clk-alpha-pll: Add regera snapshot from msm-5.15
Add regera snapshot from msm-5.15 commit 123f6f081248 ("Merge "spi:
spi-msm-geni: clear qn_err flag before transfer"").

Change-Id: Ifa6c2ab8ecf4c73c842f11c793d83f72c158b49c
Signed-off-by: Mike Tipton <quic_mdtipton@quicinc.com>
2022-03-29 15:13:22 -07:00
Mike Tipton
28cf7f26bb clk: qcom: clk-alpha-pll: Add zonda_5lpe snapshot from msm-5.15
Add zonda_5lpe snapshot from msm-5.15 commit 123f6f081248 ("Merge "spi:
spi-msm-geni: clear qn_err flag before transfer"").

Change-Id: Iba36588f34fb04aa9f1ec1b81cd5862b85b98613
Signed-off-by: Mike Tipton <quic_mdtipton@quicinc.com>
2022-03-29 15:13:22 -07:00
Taniya Das
38dc424af0 clk: qcom: alpha-pll: Add odd/even support for Trion PLL
Add support for odd and even configuration for PLL and also clean up few
issues with the post div mask.

Change-Id: Idd4ca99d7812d3328beadbebae45faa77111a4ff
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:22 -07:00
Taniya Das
51389014be clk: qcom: clk-alpha-pll: Add support for Legacy FSM Mode
The Legacy FSM Mode is required to be set when the Fabia PLL needs to be
used in non-FSM mode, thus add support for same.

Change-Id: I23d491cb33391dce1eb21d9ced298001da9ef907
Signed-off-by: Taniya Das <tdas@codeaurora.org>
2022-03-29 15:13:22 -07:00
Vivek Aknurwar
bb497bef8b clk: qcom: Add WARN_CLK support for PLL, RCG and Branch clocks
Add support for WARN_CLK to dump the clock registers and
calltrace in case of failure in the kernel message.

Change-Id: If7452aaa02cc50deafd6f3721921f66cad9ab932
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:22 -07:00
Mike Tipton
b35ea3ffcd clk: qcom: Fix crashes accessing divider registers
There are a couple circumstances where divider registers can be accessed
without first resuming their provider device. This can result in bus
errors due to necessary resources being disabled.

Call clk_runtime_get_regmap() from these places to ensure the device is
resumed and any necessary resources are enabled before touching the
registers.

Change-Id: I61e2c1b78fd47891ecc5b2e8ced54124d40b69e4
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:21 -07:00
Jagadeesh Kona
f1c72f51d5 clk: qcom: Add clk_list_rates support for divider clocks
Add clk_list_rates debugfs support for divider clocks to get all
the rates supported on divider clock.

Change-Id: Iebb18cfad4fded9a2704549a2b6429e06c2de36c
Signed-off-by: Jagadeesh Kona <jkona@codeaurora.org>
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:21 -07:00
Vivek Aknurwar
458b80c9b3 clk: qcom: clk-rcg2: Add support to print rcg's CMD_DFSR register
Add support to print rcg's CMD_DFSR register. DFS_EN bit 0 of CMD_DFSR
register indicates clk DFS mode.

Change-Id: I5d98550f89bdd14496f94edc455d67f61a1566a4
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2022-03-29 15:13:21 -07:00
Taniya Das
39024b050c clk: qcom: Add additional clock debugfs support
Update QCOM clock debugfs to support the below functionalities.
 - Display the register contents of all the clocks which support
   this operation.
 - Display the frequency to voltage mapping of a clock.
 - Display the list of clock frequencies supported by the root
   clocks.
 - Display the clk_rate_max associated with enabled clocks list.

Also add the clock list_rate_vdd_level operation, which is required
for the "clk_enabled_list" and "trace_clocks" debugfs nodes to print
the current voltage.

Change-Id: I3b4cf83e776750d993d53331142223109bf0862e
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
Signed-off-by: David Dai <daidavid1@codeaurora.org>
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:21 -07:00
Mike Tipton
0028e0c356 clk: qcom: clk-debug: Add snapshot from msm-5.15
Add clk-debug snapshot from msm-5.15 commit 123f6f081248 ("Merge "spi:
spi-msm-geni: clear qn_err flag before transfer"").

Change-Id: I64896c4b92424366e7ecb600126f4510ab5c63ad
Signed-off-by: Mike Tipton <quic_mdtipton@quicinc.com>
2022-03-29 15:13:21 -07:00
Mike Tipton
9f321957e3 clk: qcom: gdsc-regulator: Add snapshot from msm-5.15
Add gdsc-regulator snapshot from msm-5.15 commit 123f6f081248 ("Merge
"spi: spi-msm-geni: clear qn_err flag before transfer"").

Change-Id: I4d8989102564d0a6101bb54eb10055407531d61f
Signed-off-by: Mike Tipton <quic_mdtipton@quicinc.com>
2022-03-29 15:13:21 -07:00
Vivek Aknurwar
e798c45c00 clk: qcom: clk-rpmh: Update probe debug messages to WARN
Missing RPMh resources error causes various dependent drivers to fail,
resulting unknown behaviour of device during kernel boot. Adding WARN
message emphasizes more to debug wrt clk-rpmh, which overall saves efforts
to analyze failure kernel logs.

Change-Id: Ic210f04f9d2051519bc870712bfb006e12617d9b
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2022-03-29 15:13:21 -07:00
Vivek Aknurwar
dd46dee8b9 clk: qcom: guard qcom_regmap_list from corruption
qcom_regmap_list can get corrupted if multiple clock controllers
probe at same time. Add mutex lock to avoid list corruption.

Change-Id: I693d74a20807450008235e6ef6bfe6fa7061f781
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2022-03-29 15:13:21 -07:00
Mike Tipton
bca835dfe3 clk: qcom: Fix NULL deref when deteremine_rate called on orphan
Some of the determine_rate callbacks rely on the clock parent to
determine the rate. This isn't possible if the clock is orphaned without
a parent. So return an error in this case instead of dereferencing NULL.

Change-Id: Ifaa8f2a85a8f8d4e37895c0b130e4eaefb0374cb
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:21 -07:00
Vivek Aknurwar
5031c00a34 clk: qcom: Update corner voltage api for multiple vdd class
Return correct corner voltage for qcom_clk_get_voltage api for
a clock which supports multiple vdd class.

Change-Id: Ic2faa12ae85730aa1025ed342effa3052adc1062
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2022-03-29 15:13:21 -07:00
Vivek Aknurwar
c480ab75e3 clk: qcom: Add clk_get_vdd_corner api for multiple clk_vdd_class
Add clk_get_vdd_corner as some clocks have requirement to vote on
multiple clk_vdd_class for clock operations.

Change-Id: I03da2134f9a8439a734f7638b61479269a9cec89
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2022-03-29 15:13:21 -07:00
Mike Tipton
31a720c522 clk: qcom: Add properties for marking clocks as critical
Some clocks are critical only on specific boards, i.e. clocks used to
interface with external PMICs over I2C. Which clocks are critical depend
on which I2C bus is chosen to connect the PMICs. To support this, add
properties to set QCOM_CLK_IS_CRITICAL on a per-board basis.

The qcom,critical-clocks property can be used to set
QCOM_CLK_IS_CRITICAL on individual clocks.

The qcom,critical-devices property can be used to set
QCOM_CLK_IS_CRITICAL on all clocks used by specified devices.

Change-Id: I42d61ec13225026ba7d0b78079cf7a2ab67339f2
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:21 -07:00
Mike Tipton
9102085a93 clk: qcom: Add QCOM_CLK_IS_CRITICAL flag
Add QCOM_CLK_IS_CRITICAL, which can be used to enable a clock by default
in HW and to skip registering it with the framework.

Change-Id: I803a447fae742ca2e20973046090d2b8331ab598
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:21 -07:00
Mike Tipton
f7f04fbfc6 clk: qcom: Add qcom_clk_hw_get_name()
The existing clk_hw_get_name() only works after the clock has been
registered with the framework since it relies on hw->core->name and
hw->core is NULL pre-registration. hw->init->name can be used
pre-registration, but this doesn't work post-registration since the
framework sets hw->init to NULL.

Provide qcom_clk_hw_get_name(), which can be called in both pre and
post-registration contexts.

Change-Id: I334e545f5112961b7ab6879daca55c70236338d6
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:21 -07:00
Naveen Yadav
9c9f3ff339 clk: qcom: Add support for voting to multiple clk_vdd_class
Some clocks have requirement to vote on multiple clk_vdd_class for clock
operations. So add the support to pass multiple vdd_class within the clock
structure to support this functionality. A new clk_vdd_classes list is
added in clk_vdd_class_data structure to pass clk_vdd_class as an array
to support voting on multiple rail.

Change-Id: I11732a39ef99fdbcb7874e1042776e7007bed35f
Signed-off-by: Naveen Yadav <naveenky@codeaurora.org>
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:21 -07:00
Mike Tipton
9bb68c3604 clk: qcom: Fix race condition when unvoting regulators in sync_state
Normally clk_vote_vdd_level() and clk_unvote_vdd_level() are called
while holding the clock framework's prepare_lock since they are called
in the prepare paths. However, we're also calling clk_unvote_vdd_level()
from qcom_cc_sync_state() when removing proxy votes. This happens
outside of the clock framework, so the prepare_lock isn't protecting
this case. If the sync_state callback fires while another thread is
voting/unvoting voltage from a normal clock call, then there's a race
condition that can result in regulators being set to the incorrect
voltage or being pre-maturely disabled.

Add a mutex to protect this case.

Change-Id: Ib979e2edaaa5824dc80f7d4f065d72ca0b1a4444
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:21 -07:00
Mike Tipton
2ffa8360f4 clk: qcom: Add functions to suspend or resume a clk_regmap's device
Add helper functions to suspend or resume the device associated with a
clk_regmap.

Change-Id: Ie4e47fce64e2052ffacdc3a8cd56fc69758d70fb
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:20 -07:00
Mike Tipton
5d36546f55 clk: qcom: Add common runtime_pm support
Add common runtime_pm initialization and callback functions to allow
clock providers to vote clocks, interconnects, and regulators in
runtime_suspend and runtime_resume.

Change-Id: I97588feae47016b8375849c5926495c1d73f792d
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:20 -07:00
Vivek Aknurwar
9530c87bec clk: qcom: Add support to proxy vote until clk controllers sync states
Clock consumers gets deferred due to their dependencies during device
boot/probes, and can not put essential vdd vote before clock late init
clk_disable_unused() un-votes them. This behavior breaks functionality of
keeping clocks/feature continuously enabled from boot to HLOS. Putting
proxy vdd votes will ensure that votes are hold till consumer sync states
and it gives chance to consumers act on necessary votes when it's ready.

Also clock controller can not rely on consumers to vote vdd votes during
boot/probe sequence in all paths of clk provided consumed APIs. Putting
proxy votes makes sure that clk driver can access it's provided register
access.

Change-Id: I79301ff354b3ab53cc7c05db5e1dc75223228de6
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2022-03-29 15:13:20 -07:00
Vivek Aknurwar
95882c4f49 clk: qcom: Add common regulator handle initialization
To clean up clock controllers probe function, move to common regulator
handle initialization.

Also add common multiple regulator initialization support within
single clk_vdd_class.

Change-Id: I999966d3bc877e0e8bcbb54839c0dd86f41869bd
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
2022-03-29 15:13:20 -07:00
Taniya Das
0fb891f9e5 clk: Add support to provide OPP tables for clocks
Some clock driver clients need the frequency to voltage
mapping to be exposed. Add support to load and expose
these values through OPP tables associating to a device.

Change-Id: Iab3e34f53cab1db07fb2e78b378ed18a4dd8d90b
Signed-off-by: Taniya Das <tdas@codeaurora.org>
2022-03-29 15:13:20 -07:00
Vivek Aknurwar
fefe0954a4 clk: qcom: clk-branch: Add clk_branch2_force_off_ops to force off a clock
This ops is used to force off a clock when clk_disable() is called. CLK_DIS
bit can be used to force off respective clock.

Change-Id: Iec4204fe3bf24965d1603d0f86e74cc2818e3d1c
Signed-off-by: Vivek Aknurwar <viveka@codeaurora.org>
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
2022-03-29 15:13:20 -07:00
Taniya Das
67fa1d9c20 clk: qcom: clk-branch: Add clock ops for Voltage voting
In the cases where the branch clocks requires to vote on a voltage rail
add the clock ops callbacks for the same.

Change-Id: If7ffbc4fdda1fb71c1d097f56a5eb762859eb2c4
Signed-off-by: Taniya Das <tdas@codeaurora.org>
2022-03-29 15:13:20 -07:00
Taniya Das
45055bdb07 clk: qcom: Add qcom implementation of qcom_clk_set_flags
The qcom_clk_set_flags API would be used to set/clear the memory
flags for the desired branches.

Change-Id: I58b2347f63d382168b61dd04ead57ad114559eb2
Signed-off-by: Taniya Das <tdas@codeaurora.org>
2022-03-29 15:13:20 -07:00