// SPDX-License-Identifier: GPL-2.0-only/* * OMAP Remote Processor driver * * Copyright (C) 2011-2020 Texas Instruments Incorporated - http://www.ti.com/ * Copyright (C) 2011 Google, Inc. * * Ohad Ben-Cohen <ohad@wizery.com> * Brian Swetland <swetland@google.com> * Fernando Guzman Lugo <fernando.lugo@ti.com> * Mark Grosen <mgrosen@ti.com> * Suman Anna <s-anna@ti.com> * Hari Kanigeri <h-kanigeri2@ti.com> */#include<linux/kernel.h>#include<linux/module.h>#include<linux/clk.h>#include<linux/clk/ti.h>#include<linux/err.h>#include<linux/io.h>#include<linux/of_device.h>#include<linux/of_reserved_mem.h>#include<linux/platform_device.h>#include<linux/pm_runtime.h>#include<linux/dma-mapping.h>#include<linux/interrupt.h>#include<linux/remoteproc.h>#include<linux/mailbox_client.h>#include<linux/omap-iommu.h>#include<linux/omap-mailbox.h>#include<linux/regmap.h>#include<linux/mfd/syscon.h>#include<linux/reset.h>#include<clocksource/timer-ti-dm.h>#include<linux/platform_data/dmtimer-omap.h>#include"omap_remoteproc.h"#include"remoteproc_internal.h"/* default auto-suspend delay (ms) */#define DEFAULT_AUTOSUSPEND_DELAY 10000/** * struct omap_rproc_boot_data - boot data structure for the DSP omap rprocs * @syscon: regmap handle for the system control configuration module * @boot_reg: boot register offset within the @syscon regmap * @boot_reg_shift: bit-field shift required for the boot address value in * @boot_reg */structomap_rproc_boot_data{structregmap*syscon;unsignedintboot_reg;unsignedintboot_reg_shift;};/** * struct omap_rproc_mem - internal memory structure * @cpu_addr: MPU virtual address of the memory region * @bus_addr: bus address used to access the memory region * @dev_addr: device address of the memory region from DSP view * @size: size of the memory region */structomap_rproc_mem{void__iomem*cpu_addr;phys_addr_tbus_addr;u32dev_addr;size_tsize;};/** * struct omap_rproc_timer - data structure for a timer used by a omap rproc * @odt: timer pointer * @timer_ops: OMAP dmtimer ops for @odt timer * @irq: timer irq */structomap_rproc_timer{structomap_dm_timer*odt;conststructomap_dm_timer_ops*timer_ops;intirq;};/** * struct omap_rproc - omap remote processor state * @mbox: mailbox channel handle * @client: mailbox client to request the mailbox channel * @boot_data: boot data structure for setting processor boot address * @mem: internal memory regions data * @num_mems: number of internal memory regions * @num_timers: number of rproc timer(s) * @num_wd_timers: number of rproc watchdog timers * @timers: timer(s) info used by rproc * @autosuspend_delay: auto-suspend delay value to be used for runtime pm * @need_resume: if true a resume is needed in the system resume callback * @rproc: rproc handle * @reset: reset handle * @pm_comp: completion primitive to sync for suspend response * @fck: functional clock for the remoteproc * @suspend_acked: state machine flag to store the suspend request ac