Commit 1db7afa4 authored by Rob Clark's avatar Rob Clark

drm/msm: drop qcom,chipid

The original way we determined the gpu version was based on downstream
bindings from android kernel.  A cleaner way is to get the version from
the compatible string.

Note that no upstream dtb uses these bindings.  But the code still
supports falling back to the legacy bindings (with a warning), so that
we are still compatible with the gpu dt node from android device
kernels.
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Acked-by: default avatarRob Herring <robh@kernel.org>
parent 1a4a66dd
Qualcomm adreno/snapdragon GPU Qualcomm adreno/snapdragon GPU
Required properties: Required properties:
- compatible: "qcom,adreno-3xx" - compatible: "qcom,adreno-XYZ.W", "qcom,adreno"
for example: "qcom,adreno-306.0", "qcom,adreno"
Note that you need to list the less specific "qcom,adreno" (since this
is what the device is matched on), in addition to the more specific
with the chip-id.
- reg: Physical base address and length of the controller's registers. - reg: Physical base address and length of the controller's registers.
- interrupts: The interrupt signal from the gpu. - interrupts: The interrupt signal from the gpu.
- clocks: device clocks - clocks: device clocks
...@@ -10,8 +14,6 @@ Required properties: ...@@ -10,8 +14,6 @@ Required properties:
* "core_clk" * "core_clk"
* "iface_clk" * "iface_clk"
* "mem_iface_clk" * "mem_iface_clk"
- qcom,chipid: gpu chip-id. Note this may become optional for future
devices if we can reliably read the chipid from hw
Example: Example:
...@@ -19,7 +21,7 @@ Example: ...@@ -19,7 +21,7 @@ Example:
... ...
gpu: qcom,kgsl-3d0@4300000 { gpu: qcom,kgsl-3d0@4300000 {
compatible = "qcom,adreno-3xx"; compatible = "qcom,adreno-320.2", "qcom,adreno";
reg = <0x04300000 0x20000>; reg = <0x04300000 0x20000>;
reg-names = "kgsl_3d0_reg_memory"; reg-names = "kgsl_3d0_reg_memory";
interrupts = <GIC_SPI 80 0>; interrupts = <GIC_SPI 80 0>;
...@@ -32,6 +34,5 @@ Example: ...@@ -32,6 +34,5 @@ Example:
<&mmcc GFX3D_CLK>, <&mmcc GFX3D_CLK>,
<&mmcc GFX3D_AHB_CLK>, <&mmcc GFX3D_AHB_CLK>,
<&mmcc MMSS_IMEM_AHB_CLK>; <&mmcc MMSS_IMEM_AHB_CLK>;
qcom,chipid = <0x03020100>;
}; };
}; };
...@@ -189,6 +189,43 @@ static const struct { ...@@ -189,6 +189,43 @@ static const struct {
{ "qcom,gpu-quirk-fault-detect-mask", ADRENO_QUIRK_FAULT_DETECT_MASK }, { "qcom,gpu-quirk-fault-detect-mask", ADRENO_QUIRK_FAULT_DETECT_MASK },
}; };
static int find_chipid(struct device *dev, u32 *chipid)
{
struct device_node *node = dev->of_node;
const char *compat;
int ret;
/* first search the compat strings for qcom,adreno-XYZ.W: */
ret = of_property_read_string_index(node, "compatible", 0, &compat);
if (ret == 0) {
unsigned rev, patch;
if (sscanf(compat, "qcom,adreno-%u.%u", &rev, &patch) == 2) {
*chipid = 0;
*chipid |= (rev / 100) << 24; /* core */
rev %= 100;
*chipid |= (rev / 10) << 16; /* major */
rev %= 10;
*chipid |= rev << 8; /* minor */
*chipid |= patch;
return 0;
}
}
/* and if that fails, fall back to legacy "qcom,chipid" property: */
ret = of_property_read_u32(node, "qcom,chipid", chipid);
if (ret)
return ret;
dev_warn(dev, "Using legacy qcom,chipid binding!\n");
dev_warn(dev, "Use compatible qcom,adreno-%u%u%u.%u instead.\n",
(*chipid >> 24) & 0xff, (*chipid >> 16) & 0xff,
(*chipid >> 8) & 0xff, *chipid & 0xff);
return 0;
}
static int adreno_bind(struct device *dev, struct device *master, void *data) static int adreno_bind(struct device *dev, struct device *master, void *data)
{ {
static struct adreno_platform_config config = {}; static struct adreno_platform_config config = {};
...@@ -196,7 +233,7 @@ static int adreno_bind(struct device *dev, struct device *master, void *data) ...@@ -196,7 +233,7 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
u32 val; u32 val;
int ret, i; int ret, i;
ret = of_property_read_u32(node, "qcom,chipid", &val); ret = find_chipid(dev, &val);
if (ret) { if (ret) {
dev_err(dev, "could not find chipid: %d\n", ret); dev_err(dev, "could not find chipid: %d\n", ret);
return ret; return ret;
...@@ -262,6 +299,7 @@ static int adreno_remove(struct platform_device *pdev) ...@@ -262,6 +299,7 @@ static int adreno_remove(struct platform_device *pdev)
} }
static const struct of_device_id dt_match[] = { static const struct of_device_id dt_match[] = {
{ .compatible = "qcom,adreno" },
{ .compatible = "qcom,adreno-3xx" }, { .compatible = "qcom,adreno-3xx" },
/* for backwards compat w/ downstream kgsl DT files: */ /* for backwards compat w/ downstream kgsl DT files: */
{ .compatible = "qcom,kgsl-3d0" }, { .compatible = "qcom,kgsl-3d0" },
......
...@@ -985,6 +985,7 @@ static int add_display_components(struct device *dev, ...@@ -985,6 +985,7 @@ static int add_display_components(struct device *dev,
* as components. * as components.
*/ */
static const struct of_device_id msm_gpu_match[] = { static const struct of_device_id msm_gpu_match[] = {
{ .compatible = "qcom,adreno" },
{ .compatible = "qcom,adreno-3xx" }, { .compatible = "qcom,adreno-3xx" },
{ .compatible = "qcom,kgsl-3d0" }, { .compatible = "qcom,kgsl-3d0" },
{ }, { },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment