Lines Matching +full:shared +full:- +full:interrupt
1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2018-2024 Linaro Ltd.
26 * The microcontroller can generate two interrupts to the AP. One interrupt
29 * addition, the AP can interrupt the microcontroller by writing a register.
33 * AP and the IPA microcontroller. Each side writes data to the shared area
35 * to the interrupt. Some information found in the shared area is currently
36 * unused. All remaining space in the shared area is reserved, and must not
45 * struct ipa_uc_mem_area - AP/microcontroller shared memory area
46 * @command: command code (AP->microcontroller)
48 * @command_param: low 32 bits of command parameter (AP->microcontroller)
49 * @command_param_hi: high 32 bits of command parameter (AP->microcontroller)
51 * @response: response code (microcontroller->AP)
53 * @response_param: response parameter (microcontroller->AP)
55 * @event: event code (microcontroller->AP)
57 * @event_param: event parameter (microcontroller->AP)
59 * @first_error_address: address of first error-source on SNOC
61 * @warning_counter: counter of non-fatal hardware errors
63 * @interface_version: hardware-reported interface version
66 * A shared memory area at the base of IPA resident memory is used for
90 /** enum ipa_uc_command - commands from the AP to the microcontroller */
105 /** enum ipa_uc_response - microcontroller response codes */
113 /** enum ipa_uc_event - common cpu events reported by the microcontroller */
123 u32 offset = ipa->mem_offset + mem->offset; in ipa_uc_shared()
125 return ipa->mem_virt + offset; in ipa_uc_shared()
128 /* Microcontroller event IPA interrupt handler */
131 struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); in ipa_uc_event_handler() local
132 struct device *dev = ipa->dev; in ipa_uc_event_handler()
134 if (shared->event == IPA_UC_EVENT_ERROR) in ipa_uc_event_handler()
136 else if (shared->event != IPA_UC_EVENT_LOG_INFO) in ipa_uc_event_handler()
138 shared->event); in ipa_uc_event_handler()
142 /* Microcontroller response IPA interrupt handler */
145 struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); in ipa_uc_response_hdlr() local
146 struct device *dev = ipa->dev; in ipa_uc_response_hdlr()
156 switch (shared->response) { in ipa_uc_response_hdlr()
158 if (ipa->uc_powered) { in ipa_uc_response_hdlr()
159 ipa->uc_loaded = true; in ipa_uc_response_hdlr()
163 ipa->uc_powered = false; in ipa_uc_response_hdlr()
170 shared->response); in ipa_uc_response_hdlr()
187 ipa->uc_powered = false; in ipa_uc_config()
188 ipa->uc_loaded = false; in ipa_uc_config()
196 struct device *dev = ipa->dev; in ipa_uc_deconfig()
200 if (ipa->uc_loaded) in ipa_uc_deconfig()
203 if (!ipa->uc_powered) in ipa_uc_deconfig()
213 struct device *dev = ipa->dev; in ipa_uc_power()
227 ipa->uc_powered = true; in ipa_uc_power()
234 struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); in send_uc_command() local
239 shared->command = command; in send_uc_command()
240 shared->command_param = cpu_to_le32(command_param); in send_uc_command()
241 shared->command_param_hi = 0; in send_uc_command()
242 shared->response = 0; in send_uc_command()
243 shared->response_param = 0; in send_uc_command()
245 /* Use an interrupt to tell the microcontroller the command is ready */ in send_uc_command()
249 iowrite32(val, ipa->reg_virt + reg_offset(reg)); in send_uc_command()
255 if (!ipa->uc_loaded) in ipa_uc_panic_notifier()