2012-07-13 21:55:52 +07:00
|
|
|
/*
|
|
|
|
* CCI cache coherent interconnect support
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 ARM Ltd.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LINUX_ARM_CCI_H
|
|
|
|
#define __LINUX_ARM_CCI_H
|
|
|
|
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
arm-cci: Get rid of secure transactions for PMU driver
Avoid secure transactions while probing the CCI PMU. The
existing code makes use of the Peripheral ID2 (PID2) register
to determine the revision of the CCI400, which requires a
secure transaction. This puts a limitation on the usage of the
driver on systems running non-secure Linux(e.g, ARM64).
Updated the device-tree binding for cci pmu node to add the explicit
revision number for the compatible field.
The supported strings are :
arm,cci-400-pmu,r0
arm,cci-400-pmu,r1
arm,cci-400-pmu - DEPRECATED. See NOTE below
NOTE: If the revision is not mentioned, we need to probe the cci revision,
which could be fatal on a platform running non-secure. We need a reliable way
to know if we can poke the CCI registers at runtime on ARM32. We depend on
'mcpm_is_available()' when it is available. mcpm_is_available() returns true
only when there is a registered driver for mcpm. Otherwise, we assume that we
don't have secure access, and skips probing the revision number(ARM64 case).
The MCPM should figure out if it is safe to access the CCI. Unfortunately
there isn't a reliable way to indicate the same via dtb. This patch doesn't
address/change the current situation. It only deals with the CCI-PMU, leaving
the assumptions about the secure access as it has been, prior to this patch.
Cc: devicetree@vger.kernel.org
Cc: Punit Agrawal <punit.agrawal@arm.com>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2015-03-18 19:24:40 +07:00
|
|
|
#include <asm/arm-cci.h>
|
|
|
|
|
2012-07-13 21:55:52 +07:00
|
|
|
struct device_node;
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARM_CCI
|
|
|
|
extern bool cci_probed(void);
|
2015-03-18 19:24:41 +07:00
|
|
|
#else
|
|
|
|
static inline bool cci_probed(void) { return false; }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARM_CCI400_PORT_CTRL
|
2012-07-13 21:55:52 +07:00
|
|
|
extern int cci_ace_get_port(struct device_node *dn);
|
|
|
|
extern int cci_disable_port_by_cpu(u64 mpidr);
|
|
|
|
extern int __cci_control_port_by_device(struct device_node *dn, bool enable);
|
|
|
|
extern int __cci_control_port_by_index(u32 port, bool enable);
|
|
|
|
#else
|
|
|
|
static inline int cci_ace_get_port(struct device_node *dn)
|
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
static inline int cci_disable_port_by_cpu(u64 mpidr) { return -ENODEV; }
|
|
|
|
static inline int __cci_control_port_by_device(struct device_node *dn,
|
|
|
|
bool enable)
|
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
static inline int __cci_control_port_by_index(u32 port, bool enable)
|
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
#endif
|
2015-03-18 19:24:41 +07:00
|
|
|
|
2012-07-13 21:55:52 +07:00
|
|
|
#define cci_disable_port_by_device(dev) \
|
|
|
|
__cci_control_port_by_device(dev, false)
|
|
|
|
#define cci_enable_port_by_device(dev) \
|
|
|
|
__cci_control_port_by_device(dev, true)
|
|
|
|
#define cci_disable_port_by_index(dev) \
|
|
|
|
__cci_control_port_by_index(dev, false)
|
|
|
|
#define cci_enable_port_by_index(dev) \
|
|
|
|
__cci_control_port_by_index(dev, true)
|
|
|
|
|
|
|
|
#endif
|