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-2022 Linaro Ltd.
24 * The microcontroller can generate two interrupts to the AP. One interrupt
27 * addition, the AP can interrupt the microcontroller by writing a register.
31 * AP and the IPA microcontroller. Each side writes data to the shared area
33 * to the interrupt. Some information found in the shared area is currently
34 * unused. All remaining space in the shared area is reserved, and must not
43 * struct ipa_uc_mem_area - AP/microcontroller shared memory area
44 * @command: command code (AP->microcontroller)
46 * @command_param: low 32 bits of command parameter (AP->microcontroller)
47 * @command_param_hi: high 32 bits of command parameter (AP->microcontroller)
49 * @response: response code (microcontroller->AP)
51 * @response_param: response parameter (microcontroller->AP)
53 * @event: event code (microcontroller->AP)
55 * @event_param: event parameter (microcontroller->AP)
57 * @first_error_address: address of first error-source on SNOC
59 * @warning_counter: counter of non-fatal hardware errors
61 * @interface_version: hardware-reported interface version
64 * A shared memory area at the base of IPA resident memory is used for
88 /** enum ipa_uc_command - commands from the AP to the microcontroller */
103 /** enum ipa_uc_response - microcontroller response codes */
111 /** enum ipa_uc_event - common cpu events reported by the microcontroller */
121 u32 offset = ipa->mem_offset + mem->offset; in ipa_uc_shared()
123 return ipa->mem_virt + offset; in ipa_uc_shared()
126 /* Microcontroller event IPA interrupt handler */
129 struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); in ipa_uc_event_handler() local
130 struct device *dev = &ipa->pdev->dev; in ipa_uc_event_handler()
132 if (shared->event == IPA_UC_EVENT_ERROR) in ipa_uc_event_handler()
134 else if (shared->event != IPA_UC_EVENT_LOG_INFO) in ipa_uc_event_handler()
136 shared->event); in ipa_uc_event_handler()
140 /* Microcontroller response IPA interrupt handler */
143 struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); in ipa_uc_response_hdlr() local
144 struct device *dev = &ipa->pdev->dev; in ipa_uc_response_hdlr()
154 switch (shared->response) { in ipa_uc_response_hdlr()
156 if (ipa->uc_powered) { in ipa_uc_response_hdlr()
157 ipa->uc_loaded = true; in ipa_uc_response_hdlr()
161 ipa->uc_powered = false; in ipa_uc_response_hdlr()
168 shared->response); in ipa_uc_response_hdlr()
176 ipa->uc_powered = false; in ipa_uc_config()
177 ipa->uc_loaded = false; in ipa_uc_config()
178 ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_0, ipa_uc_event_handler); in ipa_uc_config()
179 ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_1, ipa_uc_response_hdlr); in ipa_uc_config()
185 struct device *dev = &ipa->pdev->dev; in ipa_uc_deconfig()
187 ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); in ipa_uc_deconfig()
188 ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); in ipa_uc_deconfig()
189 if (ipa->uc_loaded) in ipa_uc_deconfig()
192 if (!ipa->uc_powered) in ipa_uc_deconfig()
211 dev = &ipa->pdev->dev; in ipa_uc_power()
217 ipa->uc_powered = true; in ipa_uc_power()
224 struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); in send_uc_command() local
229 shared->command = command; in send_uc_command()
230 shared->command_param = cpu_to_le32(command_param); in send_uc_command()
231 shared->command_param_hi = 0; in send_uc_command()
232 shared->response = 0; in send_uc_command()
233 shared->response_param = 0; in send_uc_command()
235 /* Use an interrupt to tell the microcontroller the command is ready */ in send_uc_command()
239 iowrite32(val, ipa->reg_virt + ipa_reg_offset(reg)); in send_uc_command()
245 if (!ipa->uc_loaded) in ipa_uc_panic_notifier()