File Index
Files and directories
Sign in
FILE

dcr.c

File preview with syntax highlighting.

linux-6.19.14/arch/powerpc/sysdev/dcr.c C
 1// SPDX-License-Identifier: GPL-2.0-or-later
 2/*
 3 * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
 4 *                    <benh@kernel.crashing.org>
 5 */
 6
 7#undef DEBUG
 8
 9#include <linux/kernel.h>
10#include <linux/export.h>
11#include <linux/of_address.h>
12#include <asm/dcr.h>
13
14unsigned int dcr_resource_start(const struct device_node *np,
15				unsigned int index)
16{
17	unsigned int ds;
18	const u32 *dr = of_get_property(np, "dcr-reg", &ds);
19
20	if (dr == NULL || ds & 1 || index >= (ds / 8))
21		return 0;
22
23	return dr[index * 2];
24}
25EXPORT_SYMBOL_GPL(dcr_resource_start);
26
27unsigned int dcr_resource_len(const struct device_node *np, unsigned int index)
28{
29	unsigned int ds;
30	const u32 *dr = of_get_property(np, "dcr-reg", &ds);
31
32	if (dr == NULL || ds & 1 || index >= (ds / 8))
33		return 0;
34
35	return dr[index * 2 + 1];
36}
37EXPORT_SYMBOL_GPL(dcr_resource_len);
38
39DEFINE_SPINLOCK(dcr_ind_lock);
40EXPORT_SYMBOL_GPL(dcr_ind_lock);
~/ Read-only file preview.