mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
Add the upstream host1x driver with the 'Host1x/Tegra UAPI' series [0] applied. This driver will be built as an external module for use with the NVGPU driver on upstream Linux kernels. The following modifications have been made to the series posted upstream 1. Update the Makefile to always build the driver as a module 2. Remove the tests to see if CONFIG_DRM_TEGRA_STAGING is enabled 3. Rename the include/linux/host1x.h to include/linux/host1x-next.h to avoid conflicts with upstream headers when building as an external module. 4. Rename the include/uapi/linux/host1x.h to include/uapi/linux/host1x-next.h to avoid conflicts with upstream headers when building as an external module. 5. Rename the module that is built to be host1x-next.ko instead of host1x.ko to avoid any depmod conflicts with the upstream driver. [0] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=215770 Bug 3156385 Change-Id: Ic60299546809097dd0e4a9a7157bce1491d9f794 Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2435801 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
132 lines
3.3 KiB
C
132 lines
3.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Tegra host1x Register Offsets for Tegra210
|
|
*
|
|
* Copyright (c) 2015 NVIDIA Corporation.
|
|
*/
|
|
|
|
#ifndef __HOST1X_HOST1X05_HARDWARE_H
|
|
#define __HOST1X_HOST1X05_HARDWARE_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/bitops.h>
|
|
|
|
#include "hw_host1x05_channel.h"
|
|
#include "hw_host1x05_sync.h"
|
|
#include "hw_host1x05_uclass.h"
|
|
|
|
static inline u32 host1x_class_host_wait_syncpt(
|
|
unsigned indx, unsigned threshold)
|
|
{
|
|
return host1x_uclass_wait_syncpt_indx_f(indx)
|
|
| host1x_uclass_wait_syncpt_thresh_f(threshold);
|
|
}
|
|
|
|
static inline u32 host1x_class_host_load_syncpt_base(
|
|
unsigned indx, unsigned threshold)
|
|
{
|
|
return host1x_uclass_load_syncpt_base_base_indx_f(indx)
|
|
| host1x_uclass_load_syncpt_base_value_f(threshold);
|
|
}
|
|
|
|
static inline u32 host1x_class_host_wait_syncpt_base(
|
|
unsigned indx, unsigned base_indx, unsigned offset)
|
|
{
|
|
return host1x_uclass_wait_syncpt_base_indx_f(indx)
|
|
| host1x_uclass_wait_syncpt_base_base_indx_f(base_indx)
|
|
| host1x_uclass_wait_syncpt_base_offset_f(offset);
|
|
}
|
|
|
|
static inline u32 host1x_class_host_incr_syncpt_base(
|
|
unsigned base_indx, unsigned offset)
|
|
{
|
|
return host1x_uclass_incr_syncpt_base_base_indx_f(base_indx)
|
|
| host1x_uclass_incr_syncpt_base_offset_f(offset);
|
|
}
|
|
|
|
static inline u32 host1x_class_host_incr_syncpt(
|
|
unsigned cond, unsigned indx)
|
|
{
|
|
return host1x_uclass_incr_syncpt_cond_f(cond)
|
|
| host1x_uclass_incr_syncpt_indx_f(indx);
|
|
}
|
|
|
|
static inline u32 host1x_class_host_indoff_reg_write(
|
|
unsigned mod_id, unsigned offset, bool auto_inc)
|
|
{
|
|
u32 v = host1x_uclass_indoff_indbe_f(0xf)
|
|
| host1x_uclass_indoff_indmodid_f(mod_id)
|
|
| host1x_uclass_indoff_indroffset_f(offset);
|
|
if (auto_inc)
|
|
v |= host1x_uclass_indoff_autoinc_f(1);
|
|
return v;
|
|
}
|
|
|
|
static inline u32 host1x_class_host_indoff_reg_read(
|
|
unsigned mod_id, unsigned offset, bool auto_inc)
|
|
{
|
|
u32 v = host1x_uclass_indoff_indmodid_f(mod_id)
|
|
| host1x_uclass_indoff_indroffset_f(offset)
|
|
| host1x_uclass_indoff_rwn_read_v();
|
|
if (auto_inc)
|
|
v |= host1x_uclass_indoff_autoinc_f(1);
|
|
return v;
|
|
}
|
|
|
|
/* cdma opcodes */
|
|
static inline u32 host1x_opcode_setclass(
|
|
unsigned class_id, unsigned offset, unsigned mask)
|
|
{
|
|
return (0 << 28) | (offset << 16) | (class_id << 6) | mask;
|
|
}
|
|
|
|
static inline u32 host1x_opcode_incr(unsigned offset, unsigned count)
|
|
{
|
|
return (1 << 28) | (offset << 16) | count;
|
|
}
|
|
|
|
static inline u32 host1x_opcode_nonincr(unsigned offset, unsigned count)
|
|
{
|
|
return (2 << 28) | (offset << 16) | count;
|
|
}
|
|
|
|
static inline u32 host1x_opcode_mask(unsigned offset, unsigned mask)
|
|
{
|
|
return (3 << 28) | (offset << 16) | mask;
|
|
}
|
|
|
|
static inline u32 host1x_opcode_imm(unsigned offset, unsigned value)
|
|
{
|
|
return (4 << 28) | (offset << 16) | value;
|
|
}
|
|
|
|
static inline u32 host1x_opcode_imm_incr_syncpt(unsigned cond, unsigned indx)
|
|
{
|
|
return host1x_opcode_imm(host1x_uclass_incr_syncpt_r(),
|
|
host1x_class_host_incr_syncpt(cond, indx));
|
|
}
|
|
|
|
static inline u32 host1x_opcode_restart(unsigned address)
|
|
{
|
|
return (5 << 28) | (address >> 4);
|
|
}
|
|
|
|
static inline u32 host1x_opcode_gather(unsigned count)
|
|
{
|
|
return (6 << 28) | count;
|
|
}
|
|
|
|
static inline u32 host1x_opcode_gather_nonincr(unsigned offset, unsigned count)
|
|
{
|
|
return (6 << 28) | (offset << 16) | BIT(15) | count;
|
|
}
|
|
|
|
static inline u32 host1x_opcode_gather_incr(unsigned offset, unsigned count)
|
|
{
|
|
return (6 << 28) | (offset << 16) | BIT(15) | BIT(14) | count;
|
|
}
|
|
|
|
#define HOST1X_OPCODE_NOP host1x_opcode_nonincr(0, 0)
|
|
|
|
#endif
|