video: tegra: host: nvdla: add DLA fw version check

- update DLA1 FW version for multichip support
- include DLA2 driver's build path
- For firmware verification with multi-chip support,
  - Need to get way to distinuguish chip.
  - Use tegra_get_chip_id() is not recommended practice
  - Alternately, using nvhost_device_data's "version" param which distinguishes
    chip specific data at compile time
  - So encode fw version into "version" param
  - include firmware version header to encode
  - Inline function can't be used at compile to encode "version" param
    through macro

Jira DLA-3182

Change-Id: Id958133739acba583690b9fdf440fa1729b2b51e
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2359966
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Shridhar Rasal
2020-06-12 12:38:10 +05:30
committed by Laxman Dewangan
parent ebbbba1533
commit 36f80259cc
5 changed files with 43 additions and 37 deletions

View File

@@ -21,5 +21,6 @@ endif
ifdef CONFIG_TEGRA_T23X_GRHOST
ccflags-y += -I$(srctree.nvidia-t23x)/drivers/video/tegra/host
ccflags-y += -I$(srctree.nvidia-t23x)/drivers/video/tegra/host/nvdla
endif

View File

@@ -1,33 +0,0 @@
/*
* NVDLA OS Interface
*
* Copyright (c) 2016-2019, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DLA_FW_VERSION_H
#define DLA_FW_VERSION_H
#define FIRMWARE_VERSION_MAJOR 0x1UL
#define FIRMWARE_VERSION_MINOR 0x1UL
#define FIRMWARE_VERSION_SUBMINOR 0x3UL
static inline uint32_t dla_version(void)
{
return (((FIRMWARE_VERSION_MAJOR & 0xffU) << 16) |
((FIRMWARE_VERSION_MINOR & 0xffU) << 8) |
((FIRMWARE_VERSION_SUBMINOR & 0xffU)));
}
#endif

View File

@@ -0,0 +1,31 @@
/*
* NVDLA OS Interface
*
* Copyright (c) 2016-2020, 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.
*
*/
#ifndef DLA_T19X_FW_VERSION_H
#define DLA_T19X_FW_VERSION_H
#define FIRMWARE_T19X_VERSION_MAJOR 0x1UL
#define FIRMWARE_T19X_VERSION_MINOR 0x2UL
#define FIRMWARE_T19X_VERSION_SUBMINOR 0x0UL
static inline uint32_t dla_t19x_fw_version(void)
{
return (((FIRMWARE_T19X_VERSION_MAJOR & 0xffU) << 16) |
((FIRMWARE_T19X_VERSION_MINOR & 0xffU) << 8) |
((FIRMWARE_T19X_VERSION_SUBMINOR & 0xffU)));
}
#endif /* End of DLA_T19X_FW_VERSION_H */

View File

@@ -48,7 +48,6 @@
#include "nvdla/nvdla_buffer.h"
#include "nvdla/nvdla_debug.h"
#include <uapi/linux/nvhost_nvdla_ioctl.h>
#include "dla_fw_version.h"
#include "dla_os_interface.h"
#include "class_ids_t194.h"
@@ -623,7 +622,8 @@ int nvhost_nvdla_finalize_poweron(struct platform_device *pdev)
}
fw_ver_read_bin = host1x_readl(pdev, NV_DLA_OS_VERSION);
firmware_version = dla_version();
firmware_version = pdata->version;
if ((firmware_version & 0xffff00) != (fw_ver_read_bin & 0xffff00)) {
nvdla_dbg_err(pdev,

View File

@@ -26,10 +26,17 @@
#include <uapi/linux/nvdev_fence.h>
#include <uapi/linux/nvhost_nvdla_ioctl.h>
#include "nvdla_buffer.h"
#include "dla_os_interface.h"
#include "dla_fw_version.h"
#include "dla_t19x_fw_version.h"
/*
* macro to encode firmware version
*/
#define FIRMWARE_ENCODE_VERSION(chip) \
(((FIRMWARE_##chip##_VERSION_MAJOR & 0xffU) << 16) | \
((FIRMWARE_##chip##_VERSION_MINOR & 0xffU) << 8) | \
((FIRMWARE_##chip##_VERSION_SUBMINOR & 0xffU)))
#define ALIGNED_DMA(x) ((x >> 8) & 0xffffffff)