From f30a685f48768b784fb92652d945f43a289e13c4 Mon Sep 17 00:00:00 2001 From: Mahantesh Kumbar Date: Fri, 21 Apr 2017 16:49:12 +0530 Subject: gpu: nvgpu: interface layer for falcon - struct nvgpu_falcon to hold properties of falcon controller - falcon controller interface layer which establish access to required falcon controller HAL based on struct nvgpu_falcon member flcn_id & flcn_base parameter. - each falcon nvgpu_falcon struct initialized during init with id, base-address along with other properties at HAL. - Added defines related to flacon controller. Change-Id: Ia7777c01ecc542150ddd72f8603b7b4475522b58 Signed-off-by: Mahantesh Kumbar Reviewed-on: http://git-master/r/1467523 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/falcon/falcon.c | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 drivers/gpu/nvgpu/common/falcon/falcon.c (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/falcon/falcon.c b/drivers/gpu/nvgpu/common/falcon/falcon.c new file mode 100644 index 00000000..ac1b390f --- /dev/null +++ b/drivers/gpu/nvgpu/common/falcon/falcon.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ +#include +#include +#include + +#include "gk20a/gk20a.h" + +void nvgpu_flcn_sw_init(struct gk20a *g, u32 flcn_id) +{ + struct nvgpu_falcon *flcn = NULL; + struct gpu_ops *gops = &g->ops; + + switch (flcn_id) { + case FALCON_ID_PMU: + flcn = &g->pmu_flcn; + flcn->flcn_id = flcn_id; + break; + case FALCON_ID_SEC2: + flcn = &g->sec2_flcn; + flcn->flcn_id = flcn_id; + break; + case FALCON_ID_FECS: + flcn = &g->fecs_flcn; + flcn->flcn_id = flcn_id; + break; + case FALCON_ID_GPCCS: + flcn = &g->gpccs_flcn; + flcn->flcn_id = flcn_id; + break; + default: + nvgpu_err(g, "Invalid/Unsupported falcon ID %x", flcn->flcn_id); + break; + }; + + /* call to HAL method to assign flcn base & ops to selected falcon */ + if (flcn) { + flcn->g = g; + gops->falcon.falcon_hal_sw_init(flcn); + } +} -- cgit v1.2.2