2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 06:34:11 +08:00
linux-next/include/linux/remoteproc/st_slim_rproc.h
Peter Griffin bb6869b214 remoteproc: st_slim_rproc: add a slimcore rproc driver
slim core is used as a basis for many IPs in the STi
chipsets such as fdma and demux. To avoid duplicating
the elf loading code in each device driver a slim
rproc driver has been created.

This driver is designed to be used by other device drivers
such as fdma, or demux whose IP is based around a slim core.
The device driver can call slim_rproc_alloc() to allocate
a slim rproc and slim_rproc_put() when finished.

This driver takes care of ioremapping the slim
registers (dmem, imem, slimcore, peripherals), whose offsets
and sizes can change between IP's. It also obtains and enables
any clocks used by the device. This approach avoids having
a double mapping of the registers as slim_rproc does not register
its own platform device. It also maps well to device tree
abstraction as it allows us to have one dt node for the whole
device.

All of the generic rproc elf loading code can be reused, and
we provide start() stop() hooks to start and stop the slim
core once the firmware has been loaded. This has been tested
successfully with fdma driver.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2016-10-18 20:12:05 +05:30

59 lines
1.4 KiB
C

/*
* SLIM core rproc driver header
*
* Copyright (C) 2016 STMicroelectronics
*
* Author: Peter Griffin <peter.griffin@linaro.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef _ST_REMOTEPROC_SLIM_H
#define _ST_REMOTEPROC_SLIM_H
#define ST_SLIM_MEM_MAX 2
#define ST_SLIM_MAX_CLK 4
enum {
ST_SLIM_DMEM,
ST_SLIM_IMEM,
};
/**
* struct st_slim_mem - slim internal memory structure
* @cpu_addr: MPU virtual address of the memory region
* @bus_addr: Bus address used to access the memory region
* @size: Size of the memory region
*/
struct st_slim_mem {
void __iomem *cpu_addr;
phys_addr_t bus_addr;
size_t size;
};
/**
* struct st_slim_rproc - SLIM slim core
* @rproc: rproc handle
* @mem: slim memory information
* @slimcore: slim slimcore regs
* @peri: slim peripheral regs
* @clks: slim clocks
*/
struct st_slim_rproc {
struct rproc *rproc;
struct st_slim_mem mem[ST_SLIM_MEM_MAX];
void __iomem *slimcore;
void __iomem *peri;
/* st_slim_rproc private */
struct clk *clks[ST_SLIM_MAX_CLK];
};
struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev,
char *fw_name);
void st_slim_rproc_put(struct st_slim_rproc *slim_rproc);
#endif