of: Move of_fdt_get_ddrtype to soc/qcom/of_common.h

In order to reset include/linux/of.h to upstream, move downstream
of_fdt_get_ddrtype to include/soc/qcom/of_common.h. This new header file
is included in include/linux/of.h to allow out-of-tree drivers to switch
without rudely breaking their build.

Change-Id: I9da71f4112b2874460d09c5767dc4eec398fb1d9
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
This commit is contained in:
Elliot Berman 2021-02-18 14:46:18 -08:00
parent 58851f0315
commit 9c8b9b4536
9 changed files with 46 additions and 28 deletions

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "arm-memlat-mon: " fmt
@ -28,6 +28,7 @@
#include <linux/mutex.h>
#include <linux/cpu.h>
#include <linux/spinlock.h>
#include <soc/qcom/of_common.h>
enum common_ev_idx {
INST_IDX,

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2013-2014, 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2014, 2018-2021, The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "devfreq-icc: " fmt
@ -26,6 +26,7 @@
#include <linux/platform_device.h>
#include <linux/interconnect.h>
#include <soc/qcom/devfreq_icc.h>
#include <soc/qcom/of_common.h>
/* Has to be ULL to prevent overflow where this macro is used. */
#define MBYTE (1ULL << 20)

View File

@ -10,6 +10,7 @@
#include <linux/of_device.h>
#include <linux/regulator/consumer.h>
#include <linux/soc/qcom/llcc-qcom.h>
#include <soc/qcom/of_common.h>
#include "adreno.h"
#include "adreno_a6xx.h"

View File

@ -18,6 +18,7 @@
#include <linux/pm_runtime.h>
#include <linux/security.h>
#include <linux/sort.h>
#include <soc/qcom/of_common.h>
#include "kgsl_compat.h"
#include "kgsl_debugfs.h"

View File

@ -1,10 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/interconnect.h>
#include <linux/of.h>
#include <soc/qcom/of_common.h>
#include "kgsl_bus.h"
#include "kgsl_device.h"

View File

@ -1,11 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
#include <linux/rpmsg.h>
#include <linux/of_platform.h>
#include <linux/of_fdt.h>
#include <soc/qcom/of_common.h>
#include <soc/qcom/secure_buffer.h>
#include "msm_cvp_dsp.h"
#include "msm_cvp_internal.h"

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/debugfs.h>
@ -16,6 +16,7 @@
#include <linux/version.h>
#include <linux/io.h>
#include <linux/of_fdt.h>
#include <soc/qcom/of_common.h>
#include "msm_cvp_internal.h"
#include "msm_cvp_debug.h"

View File

@ -1296,29 +1296,7 @@ static inline int of_get_available_child_count(const struct device_node *np)
return num;
}
/**
* of_fdt_get_ddrtype - Return the type of ddr (4/5) on the current device
*
* On match, returns a non-zero positive value which matches the ddr type.
* Otherwise returns -ENOENT.
*/
static inline int of_fdt_get_ddrtype(void)
{
int ret;
u32 ddr_type;
struct device_node *mem_node;
mem_node = of_find_node_by_path("/memory");
if (!mem_node)
return -ENOENT;
ret = of_property_read_u32(mem_node, "ddr_device_type", &ddr_type);
of_node_put(mem_node);
if (ret < 0)
return -ENOENT;
return ddr_type;
}
#include <soc/qcom/of_common.h>
#if defined(CONFIG_OF) && !defined(MODULE)
#define _OF_DECLARE(table, name, compat, fn, fn_type) \

View File

@ -0,0 +1,33 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
*/
#ifndef __QCOM_OF_H
#define __QCOM_OF_H
/**
* of_fdt_get_ddrtype - Return the type of ddr (4/5) on the current device
*
* On match, returns a non-zero positive value which matches the ddr type.
* Otherwise returns -ENOENT.
*/
static inline int of_fdt_get_ddrtype(void)
{
int ret;
u32 ddr_type;
struct device_node *mem_node;
mem_node = of_find_node_by_path("/memory");
if (!mem_node)
return -ENOENT;
ret = of_property_read_u32(mem_node, "ddr_device_type", &ddr_type);
of_node_put(mem_node);
if (ret < 0)
return -ENOENT;
return ddr_type;
}
#endif