mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
TI SoC driver updates for v6.5
* pruss: Add helper functions for ethernet client driver usage, add compile-testing, fixup function pointer casts * smartreflex: Cosmetic optimization for using devm_ioremap_resource * wkup_m3_ipc: Fix error checking around debugfs_create_dir -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE+KKGk1TrgjIXoxo03bWEnRc2JJ0FAmSLPWMACgkQ3bWEnRc2 JJ0bUQ//YjHvITXq33UCszxgV5acwvLdYpqElaTxnnB7Q3hIq7CMT3++BgCUY6SN hELY6rrvU8yvgPmf3w/yhDcGafUBq/fWr2HoXe6Vn/Rd7yBXp9LWp6BtgBCnpBRX 2J+wY17w43vbPwxaEV7/NorYQeV8o4okysk3NIVBpGEyA9BlnjpMC2ZA/PEYmDmm rn55yRI4X9N8eaYg6YO1Ve/UFhVQ+u8lL3GBrlIiwOfn2/Og1u4RLzJ91cr7JugJ f1qaLzWmIOLp9M47nH+N6mtYHo+zAZnZWgAs95r5ghOXJw0rWscRX7j0n+ZsTIRs uf0Nt1yzku4gvJazAk6Z9O8nlt8iXkADPSsCeUNspS9ZuUl0Dn6st8yqqNzhHOBx 80lveUcGheROvaF9cwgQz+PR7QvEgu7y5rIGgNXiPbPdQSP48jHpPzjhVdBe4Jm5 w+uQMgOp84CLVJt0jRTrWeYt0zI6z0SgqcM0p4I2uA0jHpF/Ib1ZL+rKCef5utFP Z02h8f1J0qf7YnrNKxY19P+dZWdGtyzMsn7CIxZw5bPfQuohTa2RTQ7eIM0gcmR6 +cQ5qZmDRNphi9kda3p26d42FOWRmxtIaZoHK+3O+iqvgEaro/HpniMgY4LGoTny q5HSRDPWWVQ8HdX3fLAHJvCWgcQOvkDA+sqI9dDeBe4L+K1HNEk= =FN1i -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmSTWvMACgkQYKtH/8kJ UifYYg/9HRDAi9nHyBBJI02/8kSR3u6v4+qcnl4fngP2oij4kBS2VGdpdV8Y2wTt 7LlemtBzqXIRU7tkvKkO1GW9H1fADzGCaW3IwiLieFmbNS/FQUL3tvWyFloqF1hw t6FhMhV9flHDfKsI0pkG3optd9u1Evrcnll+ZsQM9kmTl9XAn61812UYXif973Zl 8SqXZtXmxZ52+FrV+8bURE4FJ9VyVJw7rrjJveAC9hIQ45Ohd1UDtW3wE0R/qWy1 lbkxIDn12ewNKHpZuuF5VKtTj+ba5weciyOW2SCdl2Lc3Hp/lqgMW/geWAUvXBNX HwnG2mzC/tD/yNUVxlmKepItyyZU4TvLx8syYQq900h6ysTDAzmeA68IGjuej5f9 ZlpGnn12p6dD/LsYeFRv7dmVrvz8yKLZtqA37TCHbDUyRN831NckskYYI9KhY/XD +JVLifqXMAUjXS84By469hrYigtEy1CeVCSyunvIkkksih4bnsFnN8hHpZNcQBBb fTTObTipPyeXDY3e6oAMgp/Ni7da6zu0b5KSiDX6rWb1kfySBMQHyMkIynP8AYJW lp7HUuTYQ6odq5lsNgXF0Z7T3DYcd2nqwYdNh36wajAVCC4HIov5WzIt+Dn9jJpm 87Dy4UZhD/ZFKu7PoAXuOgTtvtDEVsRTOXTznt2QDvPFHZSTff0= =UvY7 -----END PGP SIGNATURE----- Merge tag 'ti-driver-soc-for-v6.5' of https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux into soc/drivers TI SoC driver updates for v6.5 * pruss: Add helper functions for ethernet client driver usage, add compile-testing, fixup function pointer casts * smartreflex: Cosmetic optimization for using devm_ioremap_resource * wkup_m3_ipc: Fix error checking around debugfs_create_dir * tag 'ti-driver-soc-for-v6.5' of https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux: wkup_m3_ipc.c: Fix error checking for debugfs_create_dir soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR soc: ti: pruss: Add pruss_cfg_read()/update(), pruss_cfg_get_gpmux()/set_gpmux() APIs soc: ti: pruss: Add pruss_{request,release}_mem_region() API soc: ti: pruss: Add pruss_get()/put() API soc: ti: pruss: Allow compile-testing soc: ti: pruss: Avoid cast to incompatible function type soc: ti: smartreflex: Use devm_platform_ioremap_resource() Link: https://lore.kernel.org/r/20230615164134.6sd5hudyadq3fvk4@garage Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
0feedcaa0a
@ -81,21 +81,6 @@ enum pru_iomem {
|
||||
PRU_IOMEM_MAX,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum pru_type - PRU core type identifier
|
||||
*
|
||||
* @PRU_TYPE_PRU: Programmable Real-time Unit
|
||||
* @PRU_TYPE_RTU: Auxiliary Programmable Real-Time Unit
|
||||
* @PRU_TYPE_TX_PRU: Transmit Programmable Real-Time Unit
|
||||
* @PRU_TYPE_MAX: just keep this one at the end
|
||||
*/
|
||||
enum pru_type {
|
||||
PRU_TYPE_PRU = 0,
|
||||
PRU_TYPE_RTU,
|
||||
PRU_TYPE_TX_PRU,
|
||||
PRU_TYPE_MAX,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pru_private_data - device data for a PRU core
|
||||
* @type: type of the PRU core (PRU, RTU, Tx_PRU)
|
||||
|
@ -85,7 +85,7 @@ config TI_K3_SOCINFO
|
||||
|
||||
config TI_PRUSS
|
||||
tristate "TI PRU-ICSS Subsystem Platform drivers"
|
||||
depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
|
||||
depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
|
||||
select MFD_SYSCON
|
||||
help
|
||||
TI PRU-ICSS Subsystem platform specific support.
|
||||
|
@ -6,6 +6,7 @@
|
||||
* Author(s):
|
||||
* Suman Anna <s-anna@ti.com>
|
||||
* Andrew F. Davis <afd@ti.com>
|
||||
* Tero Kristo <t-kristo@ti.com>
|
||||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
@ -18,7 +19,9 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/pruss_driver.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/remoteproc.h>
|
||||
#include <linux/slab.h>
|
||||
#include "pruss.h"
|
||||
|
||||
/**
|
||||
* struct pruss_private_data - PRUSS driver private data
|
||||
@ -30,6 +33,257 @@ struct pruss_private_data {
|
||||
bool has_core_mux_clock;
|
||||
};
|
||||
|
||||
/**
|
||||
* pruss_get() - get the pruss for a given PRU remoteproc
|
||||
* @rproc: remoteproc handle of a PRU instance
|
||||
*
|
||||
* Finds the parent pruss device for a PRU given the @rproc handle of the
|
||||
* PRU remote processor. This function increments the pruss device's refcount,
|
||||
* so always use pruss_put() to decrement it back once pruss isn't needed
|
||||
* anymore.
|
||||
*
|
||||
* This API doesn't check if @rproc is valid or not. It is expected the caller
|
||||
* will have done a pru_rproc_get() on @rproc, before calling this API to make
|
||||
* sure that @rproc is valid.
|
||||
*
|
||||
* Return: pruss handle on success, and an ERR_PTR on failure using one
|
||||
* of the following error values
|
||||
* -EINVAL if invalid parameter
|
||||
* -ENODEV if PRU device or PRUSS device is not found
|
||||
*/
|
||||
struct pruss *pruss_get(struct rproc *rproc)
|
||||
{
|
||||
struct pruss *pruss;
|
||||
struct device *dev;
|
||||
struct platform_device *ppdev;
|
||||
|
||||
if (IS_ERR_OR_NULL(rproc))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
dev = &rproc->dev;
|
||||
|
||||
/* make sure it is PRU rproc */
|
||||
if (!dev->parent || !is_pru_rproc(dev->parent))
|
||||
return ERR_PTR(-ENODEV);
|
||||
|
||||
ppdev = to_platform_device(dev->parent->parent);
|
||||
pruss = platform_get_drvdata(ppdev);
|
||||
if (!pruss)
|
||||
return ERR_PTR(-ENODEV);
|
||||
|
||||
get_device(pruss->dev);
|
||||
|
||||
return pruss;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pruss_get);
|
||||
|
||||
/**
|
||||
* pruss_put() - decrement pruss device's usecount
|
||||
* @pruss: pruss handle
|
||||
*
|
||||
* Complimentary function for pruss_get(). Needs to be called
|
||||
* after the PRUSS is used, and only if the pruss_get() succeeds.
|
||||
*/
|
||||
void pruss_put(struct pruss *pruss)
|
||||
{
|
||||
if (IS_ERR_OR_NULL(pruss))
|
||||
return;
|
||||
|
||||
put_device(pruss->dev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pruss_put);
|
||||
|
||||
/**
|
||||
* pruss_request_mem_region() - request a memory resource
|
||||
* @pruss: the pruss instance
|
||||
* @mem_id: the memory resource id
|
||||
* @region: pointer to memory region structure to be filled in
|
||||
*
|
||||
* This function allows a client driver to request a memory resource,
|
||||
* and if successful, will let the client driver own the particular
|
||||
* memory region until released using the pruss_release_mem_region()
|
||||
* API.
|
||||
*
|
||||
* Return: 0 if requested memory region is available (in such case pointer to
|
||||
* memory region is returned via @region), an error otherwise
|
||||
*/
|
||||
int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id,
|
||||
struct pruss_mem_region *region)
|
||||
{
|
||||
if (!pruss || !region || mem_id >= PRUSS_MEM_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&pruss->lock);
|
||||
|
||||
if (pruss->mem_in_use[mem_id]) {
|
||||
mutex_unlock(&pruss->lock);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
*region = pruss->mem_regions[mem_id];
|
||||
pruss->mem_in_use[mem_id] = region;
|
||||
|
||||
mutex_unlock(&pruss->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pruss_request_mem_region);
|
||||
|
||||
/**
|
||||
* pruss_release_mem_region() - release a memory resource
|
||||
* @pruss: the pruss instance
|
||||
* @region: the memory region to release
|
||||
*
|
||||
* This function is the complimentary function to
|
||||
* pruss_request_mem_region(), and allows the client drivers to
|
||||
* release back a memory resource.
|
||||
*
|
||||
* Return: 0 on success, an error code otherwise
|
||||
*/
|
||||
int pruss_release_mem_region(struct pruss *pruss,
|
||||
struct pruss_mem_region *region)
|
||||
{
|
||||
int id;
|
||||
|
||||
if (!pruss || !region)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&pruss->lock);
|
||||
|
||||
/* find out the memory region being released */
|
||||
for (id = 0; id < PRUSS_MEM_MAX; id++) {
|
||||
if (pruss->mem_in_use[id] == region)
|
||||
break;
|
||||
}
|
||||
|
||||
if (id == PRUSS_MEM_MAX) {
|
||||
mutex_unlock(&pruss->lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pruss->mem_in_use[id] = NULL;
|
||||
|
||||
mutex_unlock(&pruss->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pruss_release_mem_region);
|
||||
|
||||
/**
|
||||
* pruss_cfg_get_gpmux() - get the current GPMUX value for a PRU device
|
||||
* @pruss: pruss instance
|
||||
* @pru_id: PRU identifier (0-1)
|
||||
* @mux: pointer to store the current mux value into
|
||||
*
|
||||
* Return: 0 on success, or an error code otherwise
|
||||
*/
|
||||
int pruss_cfg_get_gpmux(struct pruss *pruss, enum pruss_pru_id pru_id, u8 *mux)
|
||||
{
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
if (pru_id >= PRUSS_NUM_PRUS || !mux)
|
||||
return -EINVAL;
|
||||
|
||||
ret = pruss_cfg_read(pruss, PRUSS_CFG_GPCFG(pru_id), &val);
|
||||
if (!ret)
|
||||
*mux = (u8)((val & PRUSS_GPCFG_PRU_MUX_SEL_MASK) >>
|
||||
PRUSS_GPCFG_PRU_MUX_SEL_SHIFT);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pruss_cfg_get_gpmux);
|
||||
|
||||
/**
|
||||
* pruss_cfg_set_gpmux() - set the GPMUX value for a PRU device
|
||||
* @pruss: pruss instance
|
||||
* @pru_id: PRU identifier (0-1)
|
||||
* @mux: new mux value for PRU
|
||||
*
|
||||
* Return: 0 on success, or an error code otherwise
|
||||
*/
|
||||
int pruss_cfg_set_gpmux(struct pruss *pruss, enum pruss_pru_id pru_id, u8 mux)
|
||||
{
|
||||
if (mux >= PRUSS_GP_MUX_SEL_MAX ||
|
||||
pru_id >= PRUSS_NUM_PRUS)
|
||||
return -EINVAL;
|
||||
|
||||
return pruss_cfg_update(pruss, PRUSS_CFG_GPCFG(pru_id),
|
||||
PRUSS_GPCFG_PRU_MUX_SEL_MASK,
|
||||
(u32)mux << PRUSS_GPCFG_PRU_MUX_SEL_SHIFT);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pruss_cfg_set_gpmux);
|
||||
|
||||
/**
|
||||
* pruss_cfg_gpimode() - set the GPI mode of the PRU
|
||||
* @pruss: the pruss instance handle
|
||||
* @pru_id: id of the PRU core within the PRUSS
|
||||
* @mode: GPI mode to set
|
||||
*
|
||||
* Sets the GPI mode for a given PRU by programming the
|
||||
* corresponding PRUSS_CFG_GPCFGx register
|
||||
*
|
||||
* Return: 0 on success, or an error code otherwise
|
||||
*/
|
||||
int pruss_cfg_gpimode(struct pruss *pruss, enum pruss_pru_id pru_id,
|
||||
enum pruss_gpi_mode mode)
|
||||
{
|
||||
if (pru_id >= PRUSS_NUM_PRUS || mode >= PRUSS_GPI_MODE_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
return pruss_cfg_update(pruss, PRUSS_CFG_GPCFG(pru_id),
|
||||
PRUSS_GPCFG_PRU_GPI_MODE_MASK,
|
||||
mode << PRUSS_GPCFG_PRU_GPI_MODE_SHIFT);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pruss_cfg_gpimode);
|
||||
|
||||
/**
|
||||
* pruss_cfg_miirt_enable() - Enable/disable MII RT Events
|
||||
* @pruss: the pruss instance
|
||||
* @enable: enable/disable
|
||||
*
|
||||
* Enable/disable the MII RT Events for the PRUSS.
|
||||
*
|
||||
* Return: 0 on success, or an error code otherwise
|
||||
*/
|
||||
int pruss_cfg_miirt_enable(struct pruss *pruss, bool enable)
|
||||
{
|
||||
u32 set = enable ? PRUSS_MII_RT_EVENT_EN : 0;
|
||||
|
||||
return pruss_cfg_update(pruss, PRUSS_CFG_MII_RT,
|
||||
PRUSS_MII_RT_EVENT_EN, set);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pruss_cfg_miirt_enable);
|
||||
|
||||
/**
|
||||
* pruss_cfg_xfr_enable() - Enable/disable XIN XOUT shift functionality
|
||||
* @pruss: the pruss instance
|
||||
* @pru_type: PRU core type identifier
|
||||
* @enable: enable/disable
|
||||
*
|
||||
* Return: 0 on success, or an error code otherwise
|
||||
*/
|
||||
int pruss_cfg_xfr_enable(struct pruss *pruss, enum pru_type pru_type,
|
||||
bool enable)
|
||||
{
|
||||
u32 mask, set;
|
||||
|
||||
switch (pru_type) {
|
||||
case PRU_TYPE_PRU:
|
||||
mask = PRUSS_SPP_XFER_SHIFT_EN;
|
||||
break;
|
||||
case PRU_TYPE_RTU:
|
||||
mask = PRUSS_SPP_RTU_XFR_SHIFT_EN;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
set = enable ? mask : 0;
|
||||
|
||||
return pruss_cfg_update(pruss, PRUSS_CFG_SPP, mask, set);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pruss_cfg_xfr_enable);
|
||||
|
||||
static void pruss_of_free_clk_provider(void *data)
|
||||
{
|
||||
struct device_node *clk_mux_np = data;
|
||||
@ -38,6 +292,11 @@ static void pruss_of_free_clk_provider(void *data)
|
||||
of_node_put(clk_mux_np);
|
||||
}
|
||||
|
||||
static void pruss_clk_unregister_mux(void *data)
|
||||
{
|
||||
clk_unregister_mux(data);
|
||||
}
|
||||
|
||||
static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux,
|
||||
char *mux_name, struct device_node *clks_np)
|
||||
{
|
||||
@ -93,8 +352,7 @@ static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux,
|
||||
goto put_clk_mux_np;
|
||||
}
|
||||
|
||||
ret = devm_add_action_or_reset(dev, (void(*)(void *))clk_unregister_mux,
|
||||
clk_mux);
|
||||
ret = devm_add_action_or_reset(dev, pruss_clk_unregister_mux, clk_mux);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to add clkmux unregister action %d", ret);
|
||||
goto put_clk_mux_np;
|
||||
@ -232,6 +490,7 @@ static int pruss_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
pruss->dev = dev;
|
||||
mutex_init(&pruss->lock);
|
||||
|
||||
child = of_get_child_by_name(np, "memories");
|
||||
if (!child) {
|
||||
|
88
drivers/soc/ti/pruss.h
Normal file
88
drivers/soc/ti/pruss.h
Normal file
@ -0,0 +1,88 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* PRU-ICSS Subsystem user interfaces
|
||||
*
|
||||
* Copyright (C) 2015-2023 Texas Instruments Incorporated - http://www.ti.com
|
||||
* MD Danish Anwar <danishanwar@ti.com>
|
||||
*/
|
||||
|
||||
#ifndef _SOC_TI_PRUSS_H_
|
||||
#define _SOC_TI_PRUSS_H_
|
||||
|
||||
#include <linux/bits.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
/*
|
||||
* PRU_ICSS_CFG registers
|
||||
* SYSCFG, ISRP, ISP, IESP, IECP, SCRP applicable on AMxxxx devices only
|
||||
*/
|
||||
#define PRUSS_CFG_REVID 0x00
|
||||
#define PRUSS_CFG_SYSCFG 0x04
|
||||
#define PRUSS_CFG_GPCFG(x) (0x08 + (x) * 4)
|
||||
#define PRUSS_CFG_CGR 0x10
|
||||
#define PRUSS_CFG_ISRP 0x14
|
||||
#define PRUSS_CFG_ISP 0x18
|
||||
#define PRUSS_CFG_IESP 0x1C
|
||||
#define PRUSS_CFG_IECP 0x20
|
||||
#define PRUSS_CFG_SCRP 0x24
|
||||
#define PRUSS_CFG_PMAO 0x28
|
||||
#define PRUSS_CFG_MII_RT 0x2C
|
||||
#define PRUSS_CFG_IEPCLK 0x30
|
||||
#define PRUSS_CFG_SPP 0x34
|
||||
#define PRUSS_CFG_PIN_MX 0x40
|
||||
|
||||
/* PRUSS_GPCFG register bits */
|
||||
#define PRUSS_GPCFG_PRU_GPI_MODE_MASK GENMASK(1, 0)
|
||||
#define PRUSS_GPCFG_PRU_GPI_MODE_SHIFT 0
|
||||
|
||||
#define PRUSS_GPCFG_PRU_MUX_SEL_SHIFT 26
|
||||
#define PRUSS_GPCFG_PRU_MUX_SEL_MASK GENMASK(29, 26)
|
||||
|
||||
/* PRUSS_MII_RT register bits */
|
||||
#define PRUSS_MII_RT_EVENT_EN BIT(0)
|
||||
|
||||
/* PRUSS_SPP register bits */
|
||||
#define PRUSS_SPP_XFER_SHIFT_EN BIT(1)
|
||||
#define PRUSS_SPP_PRU1_PAD_HP_EN BIT(0)
|
||||
#define PRUSS_SPP_RTU_XFR_SHIFT_EN BIT(3)
|
||||
|
||||
/**
|
||||
* pruss_cfg_read() - read a PRUSS CFG sub-module register
|
||||
* @pruss: the pruss instance handle
|
||||
* @reg: register offset within the CFG sub-module
|
||||
* @val: pointer to return the value in
|
||||
*
|
||||
* Reads a given register within the PRUSS CFG sub-module and
|
||||
* returns it through the passed-in @val pointer
|
||||
*
|
||||
* Return: 0 on success, or an error code otherwise
|
||||
*/
|
||||
static int pruss_cfg_read(struct pruss *pruss, unsigned int reg, unsigned int *val)
|
||||
{
|
||||
if (IS_ERR_OR_NULL(pruss))
|
||||
return -EINVAL;
|
||||
|
||||
return regmap_read(pruss->cfg_regmap, reg, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* pruss_cfg_update() - configure a PRUSS CFG sub-module register
|
||||
* @pruss: the pruss instance handle
|
||||
* @reg: register offset within the CFG sub-module
|
||||
* @mask: bit mask to use for programming the @val
|
||||
* @val: value to write
|
||||
*
|
||||
* Programs a given register within the PRUSS CFG sub-module
|
||||
*
|
||||
* Return: 0 on success, or an error code otherwise
|
||||
*/
|
||||
static int pruss_cfg_update(struct pruss *pruss, unsigned int reg,
|
||||
unsigned int mask, unsigned int val)
|
||||
{
|
||||
if (IS_ERR_OR_NULL(pruss))
|
||||
return -EINVAL;
|
||||
|
||||
return regmap_update_bits(pruss->cfg_regmap, reg, mask, val);
|
||||
}
|
||||
|
||||
#endif /* _SOC_TI_PRUSS_H_ */
|
@ -815,7 +815,6 @@ static int omap_sr_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct omap_sr *sr_info;
|
||||
struct omap_sr_data *pdata = pdev->dev.platform_data;
|
||||
struct resource *mem;
|
||||
struct dentry *nvalue_dir;
|
||||
int i, ret = 0;
|
||||
|
||||
@ -835,8 +834,7 @@ static int omap_sr_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
sr_info->base = devm_ioremap_resource(&pdev->dev, mem);
|
||||
sr_info->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(sr_info->base))
|
||||
return PTR_ERR(sr_info->base);
|
||||
|
||||
|
@ -202,7 +202,7 @@ static int wkup_m3_ipc_dbg_init(struct wkup_m3_ipc *m3_ipc)
|
||||
{
|
||||
m3_ipc->dbg_path = debugfs_create_dir("wkup_m3_ipc", NULL);
|
||||
|
||||
if (!m3_ipc->dbg_path)
|
||||
if (IS_ERR(m3_ipc->dbg_path))
|
||||
return -EINVAL;
|
||||
|
||||
(void)debugfs_create_file("enable_late_halt", 0644,
|
||||
|
@ -9,7 +9,55 @@
|
||||
#ifndef _PRUSS_DRIVER_H_
|
||||
#define _PRUSS_DRIVER_H_
|
||||
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/remoteproc/pruss.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
/*
|
||||
* enum pruss_gp_mux_sel - PRUSS GPI/O Mux modes for the
|
||||
* PRUSS_GPCFG0/1 registers
|
||||
*
|
||||
* NOTE: The below defines are the most common values, but there
|
||||
* are some exceptions like on 66AK2G, where the RESERVED and MII2
|
||||
* values are interchanged. Also, this bit-field does not exist on
|
||||
* AM335x SoCs
|
||||
*/
|
||||
enum pruss_gp_mux_sel {
|
||||
PRUSS_GP_MUX_SEL_GP,
|
||||
PRUSS_GP_MUX_SEL_ENDAT,
|
||||
PRUSS_GP_MUX_SEL_RESERVED,
|
||||
PRUSS_GP_MUX_SEL_SD,
|
||||
PRUSS_GP_MUX_SEL_MII2,
|
||||
PRUSS_GP_MUX_SEL_MAX,
|
||||
};
|
||||
|
||||
/*
|
||||
* enum pruss_gpi_mode - PRUSS GPI configuration modes, used
|
||||
* to program the PRUSS_GPCFG0/1 registers
|
||||
*/
|
||||
enum pruss_gpi_mode {
|
||||
PRUSS_GPI_MODE_DIRECT,
|
||||
PRUSS_GPI_MODE_PARALLEL,
|
||||
PRUSS_GPI_MODE_28BIT_SHIFT,
|
||||
PRUSS_GPI_MODE_MII,
|
||||
PRUSS_GPI_MODE_MAX,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum pru_type - PRU core type identifier
|
||||
*
|
||||
* @PRU_TYPE_PRU: Programmable Real-time Unit
|
||||
* @PRU_TYPE_RTU: Auxiliary Programmable Real-Time Unit
|
||||
* @PRU_TYPE_TX_PRU: Transmit Programmable Real-Time Unit
|
||||
* @PRU_TYPE_MAX: just keep this one at the end
|
||||
*/
|
||||
enum pru_type {
|
||||
PRU_TYPE_PRU,
|
||||
PRU_TYPE_RTU,
|
||||
PRU_TYPE_TX_PRU,
|
||||
PRU_TYPE_MAX,
|
||||
};
|
||||
|
||||
/*
|
||||
* enum pruss_mem - PRUSS memory range identifiers
|
||||
@ -39,6 +87,8 @@ struct pruss_mem_region {
|
||||
* @cfg_base: base iomap for CFG region
|
||||
* @cfg_regmap: regmap for config region
|
||||
* @mem_regions: data for each of the PRUSS memory regions
|
||||
* @mem_in_use: to indicate if memory resource is in use
|
||||
* @lock: mutex to serialize access to resources
|
||||
* @core_clk_mux: clk handle for PRUSS CORE_CLK_MUX
|
||||
* @iep_clk_mux: clk handle for PRUSS IEP_CLK_MUX
|
||||
*/
|
||||
@ -47,8 +97,81 @@ struct pruss {
|
||||
void __iomem *cfg_base;
|
||||
struct regmap *cfg_regmap;
|
||||
struct pruss_mem_region mem_regions[PRUSS_MEM_MAX];
|
||||
struct pruss_mem_region *mem_in_use[PRUSS_MEM_MAX];
|
||||
struct mutex lock; /* PRU resource lock */
|
||||
struct clk *core_clk_mux;
|
||||
struct clk *iep_clk_mux;
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_TI_PRUSS)
|
||||
|
||||
struct pruss *pruss_get(struct rproc *rproc);
|
||||
void pruss_put(struct pruss *pruss);
|
||||
int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id,
|
||||
struct pruss_mem_region *region);
|
||||
int pruss_release_mem_region(struct pruss *pruss,
|
||||
struct pruss_mem_region *region);
|
||||
int pruss_cfg_get_gpmux(struct pruss *pruss, enum pruss_pru_id pru_id, u8 *mux);
|
||||
int pruss_cfg_set_gpmux(struct pruss *pruss, enum pruss_pru_id pru_id, u8 mux);
|
||||
int pruss_cfg_gpimode(struct pruss *pruss, enum pruss_pru_id pru_id,
|
||||
enum pruss_gpi_mode mode);
|
||||
int pruss_cfg_miirt_enable(struct pruss *pruss, bool enable);
|
||||
int pruss_cfg_xfr_enable(struct pruss *pruss, enum pru_type pru_type,
|
||||
bool enable);
|
||||
|
||||
#else
|
||||
|
||||
static inline struct pruss *pruss_get(struct rproc *rproc)
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static inline void pruss_put(struct pruss *pruss) { }
|
||||
|
||||
static inline int pruss_request_mem_region(struct pruss *pruss,
|
||||
enum pruss_mem mem_id,
|
||||
struct pruss_mem_region *region)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int pruss_release_mem_region(struct pruss *pruss,
|
||||
struct pruss_mem_region *region)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int pruss_cfg_get_gpmux(struct pruss *pruss,
|
||||
enum pruss_pru_id pru_id, u8 *mux)
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static inline int pruss_cfg_set_gpmux(struct pruss *pruss,
|
||||
enum pruss_pru_id pru_id, u8 mux)
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static inline int pruss_cfg_gpimode(struct pruss *pruss,
|
||||
enum pruss_pru_id pru_id,
|
||||
enum pruss_gpi_mode mode)
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static inline int pruss_cfg_miirt_enable(struct pruss *pruss, bool enable)
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static inline int pruss_cfg_xfr_enable(struct pruss *pruss,
|
||||
enum pru_type pru_type,
|
||||
bool enable);
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_TI_PRUSS */
|
||||
|
||||
#endif /* _PRUSS_DRIVER_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user