msm: rtb: Add support for device tree

Add support for setting up RTB via matching in the device tree
in addition to the platform_data driven model. Also add
the corresponding device for 8974 in the device tree.

Change-Id: I76615fc75ff4fe428cab16a4aa161b032e548983
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
This commit is contained in:
Laura Abbott 2012-06-22 12:50:32 -07:00 committed by Stephen Boyd
parent c6a9accd04
commit 756382365e
2 changed files with 33 additions and 2 deletions

View file

@ -573,6 +573,12 @@
qcom,slope = <1134 1122 1142 1123 1176 1176 1176 1186 1176
1176 1176>;
};
qcom,msm-rtb {
compatible = "qcom,msm-rtb";
qcom,memory-reservation-type = "EBI1";
qcom,memory-reservation-size = <0x100000>; /* 1M EBI1 buffer */
};
};
/include/ "msm-pm8x41-rpm-regulator.dtsi"

View file

@ -16,11 +16,13 @@
#include <linux/kernel.h>
#include <linux/memory_alloc.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/atomic.h>
#include <linux/of.h>
#include <asm/io.h>
#include <asm-generic/sizes.h>
#include <mach/memory.h>
@ -31,6 +33,8 @@
#define SENTINEL_BYTE_2 0xAA
#define SENTINEL_BYTE_3 0xFF
#define RTB_COMPAT_STR "qcom,msm-rtb"
/* Write
* 1) 3 bytes sentinel
* 2) 1 bytes of log type
@ -227,8 +231,22 @@ int msm_rtb_probe(struct platform_device *pdev)
#if defined(CONFIG_MSM_RTB_SEPARATE_CPUS)
unsigned int cpu;
#endif
int ret;
msm_rtb.size = d->size;
if (!pdev->dev.of_node) {
msm_rtb.size = d->size;
} else {
int size;
ret = of_property_read_u32((&pdev->dev)->of_node,
"qcom,memory-reservation-size",
&size);
if (ret < 0)
return ret;
msm_rtb.size = size;
}
if (msm_rtb.size <= 0 || msm_rtb.size > SZ_1M)
return -EINVAL;
@ -275,10 +293,17 @@ int msm_rtb_probe(struct platform_device *pdev)
return 0;
}
static struct of_device_id msm_match_table[] = {
{.compatible = RTB_COMPAT_STR},
{},
};
EXPORT_COMPAT(RTB_COMPAT_STR);
static struct platform_driver msm_rtb_driver = {
.driver = {
.name = "msm_rtb",
.owner = THIS_MODULE
.owner = THIS_MODULE,
.of_match_table = msm_match_table
},
};