Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 505c34f3 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Legacy efuse doesn't need adreno_device



For some reason the legacy efuse code was taking struct adreno_device
but wasn't using it. Remove it so we can query the efuse before the
adreno_device even comes into being.

Change-Id: Ic0dedbad3d69757dcdf59501a6b97e2a98e0827e
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 3aa04160
Loading
Loading
Loading
Loading
+17 −20
Original line number Diff line number Diff line
@@ -223,15 +223,14 @@ unsigned int adreno_get_rptr(struct adreno_ringbuffer *rb)
static void __iomem *efuse_base;
static size_t efuse_len;

int adreno_efuse_map(struct adreno_device *adreno_dev)
int adreno_efuse_map(struct platform_device *pdev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	struct resource *res;

	if (efuse_base != NULL)
		return 0;

	res = platform_get_resource_byname(device->pdev, IORESOURCE_MEM,
	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
		"qfprom_memory");

	if (res == NULL)
@@ -245,7 +244,7 @@ int adreno_efuse_map(struct adreno_device *adreno_dev)
	return 0;
}

void adreno_efuse_unmap(struct adreno_device *adreno_dev)
void adreno_efuse_unmap(void)
{
	if (efuse_base != NULL) {
		iounmap(efuse_base);
@@ -254,8 +253,7 @@ void adreno_efuse_unmap(struct adreno_device *adreno_dev)
	}
}

int adreno_efuse_read_u32(struct adreno_device *adreno_dev, unsigned int offset,
		unsigned int *val)
int adreno_efuse_read_u32(unsigned int offset, unsigned int *val)
{
	if (efuse_base == NULL)
		return -ENODEV;
@@ -263,11 +261,9 @@ int adreno_efuse_read_u32(struct adreno_device *adreno_dev, unsigned int offset,
	if (offset >= efuse_len)
		return -ERANGE;

	if (val != NULL) {
	*val = readl_relaxed(efuse_base + offset);
	/* Make sure memory is updated before returning */
	rmb();
	}

	return 0;
}
@@ -1256,27 +1252,28 @@ static void adreno_isense_probe(struct kgsl_device *device)

static void adreno_efuse_read_soc_hw_rev(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	unsigned int val;
	unsigned int soc_hw_rev[3];
	int ret;

	if (of_property_read_u32_array(
		KGSL_DEVICE(adreno_dev)->pdev->dev.of_node,
		device->pdev->dev.of_node,
		"qcom,soc-hw-rev-efuse", soc_hw_rev, 3))
		return;

	ret = adreno_efuse_map(adreno_dev);
	ret = adreno_efuse_map(device->pdev);
	if (ret) {
		dev_err(KGSL_DEVICE(adreno_dev)->dev,
		dev_err(device->dev,
			"Unable to map hardware revision fuse: ret=%d\n", ret);
		return;
	}

	ret = adreno_efuse_read_u32(adreno_dev, soc_hw_rev[0], &val);
	adreno_efuse_unmap(adreno_dev);
	ret = adreno_efuse_read_u32(soc_hw_rev[0], &val);
	adreno_efuse_unmap();

	if (ret) {
		dev_err(KGSL_DEVICE(adreno_dev)->dev,
		dev_err(device->dev,
			"Unable to read hardware revision fuse: ret=%d\n", ret);
		return;
	}
@@ -1298,11 +1295,11 @@ static bool adreno_is_gpu_disabled(struct adreno_device *adreno_dev)
	 * Read the fuse value to disable GPU driver if fuse
	 * is blown. By default(fuse value is 0) GPU is enabled.
	 */
	if (adreno_efuse_map(adreno_dev))
	if (adreno_efuse_map(device->pdev))
		return false;

	ret = adreno_efuse_read_u32(adreno_dev, pte_row0_msb[0], &row0);
	adreno_efuse_unmap(adreno_dev);
	ret = adreno_efuse_read_u32(pte_row0_msb[0], &row0);
	adreno_efuse_unmap();

	if (ret)
		return false;
+3 −4
Original line number Diff line number Diff line
@@ -960,10 +960,9 @@ long adreno_ioctl_perfcounter_get(struct kgsl_device_private *dev_priv,
long adreno_ioctl_perfcounter_put(struct kgsl_device_private *dev_priv,
	unsigned int cmd, void *data);

int adreno_efuse_map(struct adreno_device *adreno_dev);
int adreno_efuse_read_u32(struct adreno_device *adreno_dev, unsigned int offset,
		unsigned int *val);
void adreno_efuse_unmap(struct adreno_device *adreno_dev);
int adreno_efuse_map(struct platform_device *pdev);
int adreno_efuse_read_u32(unsigned int offset, unsigned int *val);
void adreno_efuse_unmap(void);

bool adreno_is_cx_dbgc_register(struct kgsl_device *device,
		unsigned int offset);
+3 −3
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ static void a3xx_efuse_speed_bin(struct adreno_device *adreno_dev)
		"qcom,gpu-speed-bin", speed_bin, 3))
		return;

	adreno_efuse_read_u32(adreno_dev, speed_bin[0], &val);
	adreno_efuse_read_u32(speed_bin[0], &val);

	adreno_dev->speed_bin = (val & speed_bin[1]) >> speed_bin[2];
}
@@ -151,7 +151,7 @@ static void a3xx_check_features(struct adreno_device *adreno_dev)
{
	unsigned int i;

	if (adreno_efuse_map(adreno_dev))
	if (adreno_efuse_map(KGSL_DEVICE(adreno_dev)->pdev))
		return;

	for (i = 0; i < ARRAY_SIZE(a3xx_efuse_funcs); i++) {
@@ -159,7 +159,7 @@ static void a3xx_check_features(struct adreno_device *adreno_dev)
			a3xx_efuse_funcs[i].func(adreno_dev);
	}

	adreno_efuse_unmap(adreno_dev);
	adreno_efuse_unmap();
}

/**
+5 −7
Original line number Diff line number Diff line
@@ -49,11 +49,9 @@ static void a530_efuse_leakage(struct adreno_device *adreno_dev)
	unsigned int row0, row2;
	unsigned int multiplier, gfx_active, leakage_pwr_on, coeff;

	adreno_efuse_read_u32(adreno_dev,
		A530_QFPROM_RAW_PTE_ROW0_MSB, &row0);
	adreno_efuse_read_u32(A530_QFPROM_RAW_PTE_ROW0_MSB, &row0);

	adreno_efuse_read_u32(adreno_dev,
		A530_QFPROM_RAW_PTE_ROW2_MSB, &row2);
	adreno_efuse_read_u32(A530_QFPROM_RAW_PTE_ROW2_MSB, &row2);

	multiplier = (row0 >> 1) & 0x3;
	gfx_active = (row2 >> 2) & 0xFF;
@@ -78,7 +76,7 @@ static void a530_efuse_speed_bin(struct adreno_device *adreno_dev)
		"qcom,gpu-speed-bin", speed_bin, 3))
		return;

	adreno_efuse_read_u32(adreno_dev, speed_bin[0], &val);
	adreno_efuse_read_u32(speed_bin[0], &val);

	adreno_dev->speed_bin = (val & speed_bin[1]) >> speed_bin[2];
}
@@ -98,7 +96,7 @@ static void a5xx_check_features(struct adreno_device *adreno_dev)
{
	unsigned int i;

	if (adreno_efuse_map(adreno_dev))
	if (adreno_efuse_map(KGSL_DEVICE(adreno_dev)->pdev))
		return;

	for (i = 0; i < ARRAY_SIZE(a5xx_efuse_funcs); i++) {
@@ -106,7 +104,7 @@ static void a5xx_check_features(struct adreno_device *adreno_dev)
			a5xx_efuse_funcs[i].func(adreno_dev);
	}

	adreno_efuse_unmap(adreno_dev);
	adreno_efuse_unmap();
}

static void a5xx_platform_setup(struct adreno_device *adreno_dev)
+3 −3
Original line number Diff line number Diff line
@@ -2175,7 +2175,7 @@ static void a6xx_efuse_speed_bin(struct adreno_device *adreno_dev)
		"qcom,gpu-speed-bin", speed_bin, 3))
		return;

	adreno_efuse_read_u32(adreno_dev, speed_bin[0], &val);
	adreno_efuse_read_u32(speed_bin[0], &val);

	adreno_dev->speed_bin = (val & speed_bin[1]) >> speed_bin[2];
}
@@ -2192,14 +2192,14 @@ static void a6xx_check_features(struct adreno_device *adreno_dev)
{
	unsigned int i;

	if (adreno_efuse_map(adreno_dev))
	if (adreno_efuse_map(KGSL_DEVICE(adreno_dev)->pdev))
		return;
	for (i = 0; i < ARRAY_SIZE(a6xx_efuse_funcs); i++) {
		if (a6xx_efuse_funcs[i].check(adreno_dev))
			a6xx_efuse_funcs[i].func(adreno_dev);
	}

	adreno_efuse_unmap(adreno_dev);
	adreno_efuse_unmap();
}
static void a6xx_platform_setup(struct adreno_device *adreno_dev)
{