Merge tag 'ti-driver-soc-for-v6.13' of https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux into soc/drivers

TI SoC driver updates for v6.13

- knav_qmss_queue: Cleanups around request_irq params and redundant code.
- ti_sci: Power management ops in preperation for suspend/resume capability.
  Also includes dependency patch to export dev_pm_qos_read_value
  (acked by Rafael).

* tag 'ti-driver-soc-for-v6.13' of https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux:
  firmware: ti_sci: Remove use of of_match_ptr() helper
  firmware: ti_sci: add CPU latency constraint management
  firmware: ti_sci: Introduce Power Management Ops
  firmware: ti_sci: Add system suspend and resume call
  firmware: ti_sci: Add support for querying the firmware caps
  PM: QoS: Export dev_pm_qos_read_value
  soc: ti: knav_qmss_queue: Drop redundant continue statement
  soc: ti: knav_qmss_queue: Use IRQF_NO_AUTOEN flag in request_irq()

Link: https://lore.kernel.org/r/20241106121708.rso5wvc7wbhfi6xk@maverick
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann
2024-11-12 16:01:09 +01:00
5 changed files with 662 additions and 7 deletions

View File

@@ -137,6 +137,7 @@ s32 dev_pm_qos_read_value(struct device *dev, enum dev_pm_qos_req_type type)
return ret;
}
EXPORT_SYMBOL_GPL(dev_pm_qos_read_value);
/**
* apply_constraint - Add/modify/remove device PM QoS request.

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
* The system works in a message response protocol
* See: https://software-dl.ti.com/tisci/esd/latest/index.html for details
*
* Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/
* Copyright (C) 2015-2024 Texas Instruments Incorporated - https://www.ti.com/
*/
#ifndef __TI_SCI_H
@@ -19,6 +19,7 @@
#define TI_SCI_MSG_WAKE_REASON 0x0003
#define TI_SCI_MSG_GOODBYE 0x0004
#define TI_SCI_MSG_SYS_RESET 0x0005
#define TI_SCI_MSG_QUERY_FW_CAPS 0x0022
/* Device requests */
#define TI_SCI_MSG_SET_DEVICE_STATE 0x0200
@@ -35,6 +36,13 @@
#define TI_SCI_MSG_QUERY_CLOCK_FREQ 0x010d
#define TI_SCI_MSG_GET_CLOCK_FREQ 0x010e
/* Low Power Mode Requests */
#define TI_SCI_MSG_PREPARE_SLEEP 0x0300
#define TI_SCI_MSG_LPM_WAKE_REASON 0x0306
#define TI_SCI_MSG_SET_IO_ISOLATION 0x0307
#define TI_SCI_MSG_LPM_SET_DEVICE_CONSTRAINT 0x0309
#define TI_SCI_MSG_LPM_SET_LATENCY_CONSTRAINT 0x030A
/* Resource Management Requests */
#define TI_SCI_MSG_GET_RESOURCE_RANGE 0x1500
@@ -132,6 +140,27 @@ struct ti_sci_msg_req_reboot {
struct ti_sci_msg_hdr hdr;
} __packed;
/**
* struct ti_sci_msg_resp_query_fw_caps - Response for query firmware caps
* @hdr: Generic header
* @fw_caps: Each bit in fw_caps indicating one FW/SOC capability
* MSG_FLAG_CAPS_GENERIC: Generic capability (LPM not supported)
* MSG_FLAG_CAPS_LPM_PARTIAL_IO: Partial IO in LPM
* MSG_FLAG_CAPS_LPM_DM_MANAGED: LPM can be managed by DM
*
* Response to a generic message with message type TI_SCI_MSG_QUERY_FW_CAPS
* providing currently available SOC/firmware capabilities. SoC that don't
* support low power modes return only MSG_FLAG_CAPS_GENERIC capability.
*/
struct ti_sci_msg_resp_query_fw_caps {
struct ti_sci_msg_hdr hdr;
#define MSG_FLAG_CAPS_GENERIC TI_SCI_MSG_FLAG(0)
#define MSG_FLAG_CAPS_LPM_PARTIAL_IO TI_SCI_MSG_FLAG(4)
#define MSG_FLAG_CAPS_LPM_DM_MANAGED TI_SCI_MSG_FLAG(5)
#define MSG_MASK_CAPS_LPM GENMASK_ULL(4, 1)
u64 fw_caps;
} __packed;
/**
* struct ti_sci_msg_req_set_device_state - Set the desired state of the device
* @hdr: Generic header
@@ -545,6 +574,118 @@ struct ti_sci_msg_resp_get_clock_freq {
u64 freq_hz;
} __packed;
/**
* struct tisci_msg_req_prepare_sleep - Request for TISCI_MSG_PREPARE_SLEEP.
*
* @hdr TISCI header to provide ACK/NAK flags to the host.
* @mode Low power mode to enter.
* @ctx_lo Low 32-bits of physical pointer to address to use for context save.
* @ctx_hi High 32-bits of physical pointer to address to use for context save.
* @debug_flags Flags that can be set to halt the sequence during suspend or
* resume to allow JTAG connection and debug.
*
* This message is used as the first step of entering a low power mode. It
* allows configurable information, including which state to enter to be
* easily shared from the application, as this is a non-secure message and
* therefore can be sent by anyone.
*/
struct ti_sci_msg_req_prepare_sleep {
struct ti_sci_msg_hdr hdr;
#define TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED 0xfd
u8 mode;
u32 ctx_lo;
u32 ctx_hi;
u32 debug_flags;
} __packed;
/**
* struct tisci_msg_set_io_isolation_req - Request for TI_SCI_MSG_SET_IO_ISOLATION.
*
* @hdr: Generic header
* @state: The deseared state of the IO isolation.
*
* This message is used to enable/disable IO isolation for low power modes.
* Response is generic ACK / NACK message.
*/
struct ti_sci_msg_req_set_io_isolation {
struct ti_sci_msg_hdr hdr;
u8 state;
} __packed;
/**
* struct ti_sci_msg_resp_lpm_wake_reason - Response for TI_SCI_MSG_LPM_WAKE_REASON.
*
* @hdr: Generic header.
* @wake_source: The wake up source that woke soc from LPM.
* @wake_timestamp: Timestamp at which soc woke.
* @wake_pin: The pin that has triggered wake up.
* @mode: The last entered low power mode.
* @rsvd: Reserved for future use.
*
* Response to a generic message with message type TI_SCI_MSG_LPM_WAKE_REASON,
* used to query the wake up source, pin and entered low power mode.
*/
struct ti_sci_msg_resp_lpm_wake_reason {
struct ti_sci_msg_hdr hdr;
u32 wake_source;
u64 wake_timestamp;
u8 wake_pin;
u8 mode;
u32 rsvd[2];
} __packed;
/**
* struct ti_sci_msg_req_lpm_set_device_constraint - Request for
* TISCI_MSG_LPM_SET_DEVICE_CONSTRAINT.
*
* @hdr: TISCI header to provide ACK/NAK flags to the host.
* @id: Device ID of device whose constraint has to be modified.
* @state: The desired state of device constraint: set or clear.
* @rsvd: Reserved for future use.
*
* This message is used by host to set constraint on the device. This can be
* sent anytime after boot before prepare sleep message. Any device can set a
* constraint on the low power mode that the SoC can enter. It allows
* configurable information to be easily shared from the application, as this
* is a non-secure message and therefore can be sent by anyone. By setting a
* constraint, the device ensures that it will not be powered off or reset in
* the selected mode. Note: Access Restriction: Exclusivity flag of Device will
* be honored. If some other host already has constraint on this device ID,
* NACK will be returned.
*/
struct ti_sci_msg_req_lpm_set_device_constraint {
struct ti_sci_msg_hdr hdr;
u32 id;
u8 state;
u32 rsvd[2];
} __packed;
/**
* struct ti_sci_msg_req_lpm_set_latency_constraint - Request for
* TISCI_MSG_LPM_SET_LATENCY_CONSTRAINT.
*
* @hdr: TISCI header to provide ACK/NAK flags to the host.
* @wkup_latency: The maximum acceptable latency to wake up from low power mode
* in milliseconds. The deeper the state, the higher the latency.
* @state: The desired state of wakeup latency constraint: set or clear.
* @rsvd: Reserved for future use.
*
* This message is used by host to set wakeup latency from low power mode. This can
* be sent anytime after boot before prepare sleep message, and can be sent after
* current low power mode is exited. Any device can set a constraint on the low power
* mode that the SoC can enter. It allows configurable information to be easily shared
* from the application, as this is a non-secure message and therefore can be sent by
* anyone. By setting a wakeup latency constraint, the host ensures that the resume time
* from selected low power mode will be less than the constraint value.
*/
struct ti_sci_msg_req_lpm_set_latency_constraint {
struct ti_sci_msg_hdr hdr;
u16 latency;
u8 state;
u32 rsvd;
} __packed;
#define TI_SCI_IRQ_SECONDARY_HOST_INVALID 0xff
/**

View File

@@ -119,11 +119,10 @@ static int knav_queue_setup_irq(struct knav_range_info *range,
if (range->flags & RANGE_HAS_IRQ) {
irq = range->irqs[queue].irq;
ret = request_irq(irq, knav_queue_int_handler, 0,
inst->irq_name, inst);
ret = request_irq(irq, knav_queue_int_handler, IRQF_NO_AUTOEN,
inst->irq_name, inst);
if (ret)
return ret;
disable_irq(irq);
if (range->irqs[queue].cpu_mask) {
ret = irq_set_affinity_hint(irq, range->irqs[queue].cpu_mask);
if (ret) {
@@ -723,7 +722,6 @@ static void kdesc_empty_pool(struct knav_pool *pool)
if (!desc) {
dev_dbg(pool->kdev->dev,
"couldn't unmap desc, continuing\n");
continue;
}
}
WARN_ON(i != pool->num_desc);

View File

@@ -195,6 +195,35 @@ struct ti_sci_clk_ops {
u64 *current_freq);
};
/* TISCI LPM IO isolation control values */
#define TISCI_MSG_VALUE_IO_ENABLE 1
#define TISCI_MSG_VALUE_IO_DISABLE 0
/* TISCI LPM constraint state values */
#define TISCI_MSG_CONSTRAINT_SET 1
#define TISCI_MSG_CONSTRAINT_CLR 0
/**
* struct ti_sci_pm_ops - Low Power Mode (LPM) control operations
* @lpm_wake_reason: Get the wake up source that woke the SoC from LPM
* - source: The wake up source that woke soc from LPM.
* - timestamp: Timestamp at which soc woke.
* @set_device_constraint: Set LPM constraint on behalf of a device
* - id: Device Identifier
* - state: The desired state of device constraint: set or clear.
* @set_latency_constraint: Set LPM resume latency constraint
* - latency: maximum acceptable latency to wake up from low power mode
* - state: The desired state of latency constraint: set or clear.
*/
struct ti_sci_pm_ops {
int (*lpm_wake_reason)(const struct ti_sci_handle *handle,
u32 *source, u64 *timestamp, u8 *pin, u8 *mode);
int (*set_device_constraint)(const struct ti_sci_handle *handle,
u32 id, u8 state);
int (*set_latency_constraint)(const struct ti_sci_handle *handle,
u16 latency, u8 state);
};
/**
* struct ti_sci_resource_desc - Description of TI SCI resource instance range.
* @start: Start index of the first resource range.
@@ -539,6 +568,7 @@ struct ti_sci_ops {
struct ti_sci_core_ops core_ops;
struct ti_sci_dev_ops dev_ops;
struct ti_sci_clk_ops clk_ops;
struct ti_sci_pm_ops pm_ops;
struct ti_sci_rm_core_ops rm_core_ops;
struct ti_sci_rm_irq_ops rm_irq_ops;
struct ti_sci_rm_ringacc_ops rm_ring_ops;