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

Commit 1de583f1 authored by Deepak Kumar's avatar Deepak Kumar Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Add support for loading legacy GMU firmware



Current code doesn't support loading of legacy GMU firmware
format. Add this support to make sure code is backward
compatible with older targets.

Change-Id: Id47acef3ead3808b470e492c35cfccdd385bc63b
Signed-off-by: default avatarDeepak Kumar <dkumar@codeaurora.org>
parent 43e5f3f5
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -452,6 +452,25 @@ static int a6xx_rpmh_power_off_gpu(struct kgsl_device *device)
	return 0;
}

static int _load_legacy_gmu_fw(struct kgsl_device *device,
	struct gmu_device *gmu)
{
	const struct firmware *fw = gmu->fw_image;
	u32 *fwptr = (u32 *)fw->data;
	int i;

	if (fw->size > MAX_GMUFW_SIZE)
		return -EINVAL;

	for (i = 0; i < (fw->size >> 2); i++)
		gmu_core_regwrite(device,
			A6XX_GMU_CM3_ITCM_START + i, fwptr[i]);

	/* Proceed only after the FW is written */
	wmb();
	return 0;
}

static int load_gmu_fw(struct kgsl_device *device)
{
	struct gmu_device *gmu = KGSL_GMU_DEVICE(device);
@@ -461,6 +480,10 @@ static int load_gmu_fw(struct kgsl_device *device)
	struct gmu_block_header *blk;
	struct gmu_memdesc *md;

	if (adreno_is_a630(ADRENO_DEVICE(device)) ||
		adreno_is_a615_family(ADRENO_DEVICE(device)))
		return _load_legacy_gmu_fw(device, gmu);

	while (fw < (uint8_t *)gmu->fw_image->data + gmu->fw_image->size) {
		blk = (struct gmu_block_header *)fw;
		fw += sizeof(*blk);
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
#include <linux/firmware.h>
#include "kgsl_hfi.h"

#define MAX_GMUFW_SIZE	0x2000	/* in bytes */
#define MAX_GMUFW_SIZE	0x8000	/* in bytes */

#define BWMEM_SIZE	(12 + (4 * NUM_BW_LEVELS))	/*in bytes*/