ipa_uc.c (8701cb00d78a41a222fd770691e297c47ecbb218) | ipa_uc.c (716a115b4f5c78c2919437bf875fc3ba46087c57) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2 3/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. 4 * Copyright (C) 2018-2020 Linaro Ltd. 5 */ 6 7#include <linux/types.h> 8#include <linux/io.h> --- 178 unchanged lines hidden (view full) --- 187 if (!ipa->uc_loaded) 188 ipa_clock_put(ipa); 189} 190 191/* Send a command to the microcontroller */ 192static void send_uc_command(struct ipa *ipa, u32 command, u32 command_param) 193{ 194 struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); | 1// SPDX-License-Identifier: GPL-2.0 2 3/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. 4 * Copyright (C) 2018-2020 Linaro Ltd. 5 */ 6 7#include <linux/types.h> 8#include <linux/io.h> --- 178 unchanged lines hidden (view full) --- 187 if (!ipa->uc_loaded) 188 ipa_clock_put(ipa); 189} 190 191/* Send a command to the microcontroller */ 192static void send_uc_command(struct ipa *ipa, u32 command, u32 command_param) 193{ 194 struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); |
195 u32 val; |
|
195 | 196 |
197 /* Fill in the command data */ |
|
196 shared->command = command; 197 shared->command_param = cpu_to_le32(command_param); 198 shared->command_param_hi = 0; 199 shared->response = 0; 200 shared->response_param = 0; 201 | 198 shared->command = command; 199 shared->command_param = cpu_to_le32(command_param); 200 shared->command_param_hi = 0; 201 shared->response = 0; 202 shared->response_param = 0; 203 |
202 iowrite32(1, ipa->reg_virt + IPA_REG_IRQ_UC_OFFSET); | 204 /* Use an interrupt to tell the microcontroller the command is ready */ 205 val = u32_encode_bits(1, UC_INTR_FMASK); 206 207 iowrite32(val, ipa->reg_virt + IPA_REG_IRQ_UC_OFFSET); |
203} 204 205/* Tell the microcontroller the AP is shutting down */ 206void ipa_uc_panic_notifier(struct ipa *ipa) 207{ 208 if (!ipa->uc_loaded) 209 return; 210 211 send_uc_command(ipa, IPA_UC_COMMAND_ERR_FATAL, 0); 212 213 /* give uc enough time to save state */ 214 udelay(IPA_SEND_DELAY); 215} | 208} 209 210/* Tell the microcontroller the AP is shutting down */ 211void ipa_uc_panic_notifier(struct ipa *ipa) 212{ 213 if (!ipa->uc_loaded) 214 return; 215 216 send_uc_command(ipa, IPA_UC_COMMAND_ERR_FATAL, 0); 217 218 /* give uc enough time to save state */ 219 udelay(IPA_SEND_DELAY); 220} |