1
0
Fork 0
Commit Graph

20 Commits (redonkable)

Author SHA1 Message Date
Arnd Bergmann a48a7b6b54 ARM SCPI fixes for v4.14
Simple endianness fix for dev_id in dev_pstate_set structure
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJZnaHZAAoJEABBurwxfuKYRUEP/RqQ9JNSemx9ttmhU+hQKV+G
 Drxww+waDzEukRfQQJ09tJNss/1kfjn9N3TP3Y9THj+pmaeHYA2N0h5bkxLeP1xd
 6zupNDo1lunKSXfVz4KU5TggzHEXzv853Y8BgmA++cBbLgqR4lAOhYocrh7GcwjL
 eH4u2SBdECTj7HmkhrdK7sBw1tkETQ5IEPYFVgVgE+HII+McTwMsmYTxFEPO0yhC
 gk3rSGxompREtEwhAUjb1oVghBFYxwV3HQmVdbvZdGYe3ZgqqbgIjBjmQmQ/uZ0k
 MRnXSe+U8kqtv6DOUIfmRCS7F3CkxSG034f8LET5EOI7BK84aQ/OpC6TGXgdy1XI
 9dUekp+muNR7Upj8IZqUgZbdVZQgx56yJw15xhITcbk9PYrgMYd2Z4ft3HToYC0P
 t2MXUY/miiPPJZnDJ13TkyxT0JSV9wSrw9p5c5vk8PpsjBlpg+T+tTTAuzuyO1Dl
 WdE+t2aRh9tiGpUsYCEpV5358p1hJEUFRkWHC1iJcdKmxFs9xeWQrsLurZ7UeJ8y
 fmBl6IpSbpH3xQ+KFaEwEUimR+WD/DUw3T84wqjQvAlxED5nkvVxFrTJcS3MUZ02
 D/4Q/AyAOo4huvSjpzsti9yFobnK6qAOJsgij2WnYRDamvcLluit1XgqP0lgvlha
 5az6V17qohmALLOO24NB
 =nt+y
 -----END PGP SIGNATURE-----

Merge tag 'scpi-fixes-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into next/drivers

Pull "ARM SCPI fixes for v4.14" from Sudeep Holla:

Simple endianness fix for dev_id in dev_pstate_set structure

* tag 'scpi-fixes-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  firmware: arm_scpi: fix endianness of dev_id in struct dev_pstate_set
2017-08-24 15:51:54 +02:00
Sudeep Holla 0d30176819 firmware: arm_scpi: fix endianness of dev_id in struct dev_pstate_set
scpi_device_{g,s}et_power_state correctly handles the conversion of
endianness for dev_id using cpu_to_le16. However dev_id is declared
as u16 in struct dev_pstate_set which is incorrect.

This patch fixes the endianness of dev_id in dev_pstate_set structure.

Fixes: 37a441dcd5 ("firmware: arm_scpi: add support for device power state management")
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2017-08-23 16:36:51 +01:00
Rob Herring 9deee31907 firmware: Convert to using %pOF instead of full_name
Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2017-08-16 17:19:50 +02:00
Sudeep Holla 45ca7df7c3 firmware: arm_scpi: add support to populate OPPs and get transition latency
Currently only CPU devices use the transition latency and the OPPs
populated in the SCPI driver. scpi-cpufreq has logic to handle these.
However, even GPU and other users of SCPI DVFS will need the same logic.

In order to avoid duplication, this patch adds support to get DVFS
transition latency and add all the OPPs to the device using OPP library
helper functions. The helper functions added here can be used for any
device whose DVFS are managed by SCPI.

Also, we also have incorrect dependency on the cluster identifier for
the CPUs. It's fundamentally wrong as the domain id need not match the
cluster id. This patch gets rid of that dependency by making use of the
clock bindings which are already in place.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2017-06-05 11:14:35 +01:00
Alexey Klimov c511fa3f35 firmware: arm_scpi: reinit completion instead of full init_completion()
Instead of performing full initialization of the completion structure
on each transfer in scpi_send_message(), we initialize it at boot time
(more specifically, in the relevant probe() function) and use
reinit_completion() to reset ->done counter on each message transfer.

Signed-off-by: Alexey Klimov <alexey.klimov@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2017-03-31 11:00:23 +01:00
Martin Blumenstingl a766347b15 firmware: arm_scpi: fix reading sensor values on pre-1.0 SCPI firmwares
The pre-1.0 SCPI firmwares are using single __le32 as sensor value,
while the SCPI v1.0 protocol uses two __le32 as sensor values(64bit)
split into 32bit upper and 32bit lower value.

Using an "struct sensor_value" to read the sensor value on a pre-1.0
SCPI firmware gives garbage in the "hi_val" field.

This patch fixes the issue by reading only the lower 32-bit value for
all pre-1.0 SCPI versions.

Suggested-by: Sudeep Holla <Sudeep.Holla@arm.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
[sudeep.holla@arm.com: updated the commit log to reflect the implementation]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-12-30 14:53:36 +00:00
Sudeep Holla 8358c6b5fc firmware: arm_scpi: add support for pre-v1.0 SCPI compatible
This patch adds new DT match table to setup the support for SCPI protocol
versions prior to v1.0 releases. It also adds "arm,scpi-pre-1.0" to the
SCPI match entry.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-11-17 16:31:20 +00:00
Neil Armstrong abd3e80545 firmware: arm_scpi: allow firmware with get_capabilities not implemented
On Amlogic SCPI legacy implementation, the GET_CAPABILITIES command is
not supported, failover by using 0.0.0 version.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
[sudeep.holla@arm.com: changed the subject]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-11-01 14:14:59 -06:00
Neil Armstrong 4dfe32d5cd firmware: arm_scpi: add alternative legacy structures, functions and macros
This patch adds support for the Legacy SCPI protocol that is available
in very early JUNO versions and shipped Amlogic ARMv8 based SoCs. Some
Rockchip SoC are also known to use this version of protocol with
extended vendor commands.

In order to support the legacy SCPI protocol variant, we need to add the
structures and macros definitions that varies against the final SCPI v1.0
specification.

We add the indirection table for legacy commands set so that it can
co-exist with the standard v1.0 command set. It also adds bitmap field
for channel selection since the legacy protocol mandates to send only
selected subset of the commands on the high priority channel.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
[sudeep.holla@arm.com: Updated the changelog]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-11-01 14:14:59 -06:00
Neil Armstrong bb789cd12c firmware: arm_scpi: increase MAX_DVFS_OPPS to 16 entries
Since Amlogic SoCs supports more than 8 OPPs per domains, we need increase
the OPP structure size.

This patch increases the MAX_DVFS_OPPS to 16.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-11-01 14:14:58 -06:00
Sudeep Holla 761d0efee8 firmware: arm_scpi: add command indirection to support legacy commands
Since the legacy SCPI and the SCPI v1.0 differ in the command values,
it's better to create some sort of command indirection in the driver
to avoid repeated version check at multiple places.

This patch adds the indirection command table to allow different values
of the command across SCPI versions.

[narmstrong@baylibre.com: added cmd check in scpi_send_message]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-10-17 09:52:14 +01:00
Peter Chen b079bd555f firmware: arm_scpi: add missing of_node_put after calling of_parse_phandle
of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using it.

Besides, of_address_to_resource always returns -EINVAL for error, delete
the assignment for ret.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-08-08 14:31:09 +01:00
Sudeep Holla 37a441dcd5 firmware: arm_scpi: add support for device power state management
SCPI protocol supports device power state management. This deals with
power states of various peripheral devices in the system other than the
core compute subsystem.

This patch adds support for the power state management of those
peripheral devices.

Tested-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Jon Medhurst <tixy@linaro.org>
Reviewed-by: Jon Medhurst <tixy@linaro.org>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-06-21 10:15:56 +01:00
Sudeep Holla 3678b98f86 firmware: arm_scpi: mark scpi_get_sensor_value as static
scpi_get_sensor_value like other scpi operations needs to be static.
This patch marks it as static to be consistent with others.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-06-13 11:12:55 +01:00
Sudeep Holla f9d91de0ad firmware: arm_scpi: remove dvfs_get packed structure
dvfs_get packed structure is used to read the DVFS/OPP index from the
firmware. It just contains a single byte that needs no packing making
the whole structure defination unnecessary.

This patch replaces the unnecessary dvfs_get packed structure with an
unsigned byte.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-06-13 11:12:55 +01:00
Sudeep Holla 2e8741599c firmware: arm_scpi: add support for 64-bit sensor values
SCPI specification version 1.1 extended the sensor from 32-bit to 64-bit
values in order to accommodate new sensor class with 64-bit requirements

Since the SCPI driver sets the higher 32-bit for older protocol version
to zeros, there's no need to explicitly check the SCPI protocol version
and the backward compatibility is maintainted.

Acked-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-02-16 09:26:27 +00:00
Sudeep Holla 3bdd884371 firmware: arm_scpi: decrease Tx timeout to 20ms
Currently we have Tx timeout of 50ms while Rx timeout of 20 ms. Tx state
machine is maintained by the mailbox framework and Rx by SCPI driver.

It is possible that before msg_submit call tx_prepare(because of other
message in the queue and the channel being active), wait for completion
in scpi_send_message times out and the buffers are freed. In that case
when Tx state machine timer goes off later, poll_txdone calls
scpi_tx_prepare on that message, which adds it to the rx_pending list,
corrupting link pointers.

This patch reduces the Tx timeout to 20ms and increases Rx timeout to
30ms to avoid the above mentioned issue.

Reported-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-02-16 09:26:27 +00:00
Sudeep Holla dd9a1d69ba firmware: arm_scpi: fix send_message and sensor_get_value for big-endian
scpi_process_cmd converts the status word from little endian to cpu
endianness. However scpi_send_message again does the conversion which is
wrong and shows up as a bug only when running in big-endian kernel.

Similarly scpi_sensor_get_value passes the sensor index in the cpu
endianness to SCP which results in SCPI_ERR_RANGE in big-endian mode.

This patch fixes the above mentioned issue for big-endian kernel.

Acked-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-02-16 09:26:27 +00:00
Punit Agrawal 38a1bdc9ff firmware: arm_scpi: Extend to support sensors
ARM System Control Processor (SCP) provides an API to query and use
the sensors available in the system. Extend the SCPI driver to support
 sensor messages.

Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
2015-10-09 11:05:52 +01:00
Sudeep Holla 8cb7cf56c9 firmware: add support for ARM System Control and Power Interface(SCPI) protocol
This patch adds support for System Control and Power Interface (SCPI)
Message Protocol used between the Application Cores(AP) and the System
Control Processor(SCP). The MHU peripheral provides a mechanism for
inter-processor communication between SCP's M3 processor and AP.

SCP offers control and management of the core/cluster power states,
various power domain DVFS including the core/cluster, certain system
clocks configuration, thermal sensors and many others.

This protocol driver provides interface for all the client drivers using
SCPI to make use of the features offered by the SCP.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2015-09-28 11:53:37 +01:00