18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2015 NVIDIA Corporation.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci /*
78c2ecf20Sopenharmony_ci  * Function naming determines intended use:
88c2ecf20Sopenharmony_ci  *
98c2ecf20Sopenharmony_ci  *     <x>_r(void) : Returns the offset for register <x>.
108c2ecf20Sopenharmony_ci  *
118c2ecf20Sopenharmony_ci  *     <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
128c2ecf20Sopenharmony_ci  *
138c2ecf20Sopenharmony_ci  *     <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
148c2ecf20Sopenharmony_ci  *
158c2ecf20Sopenharmony_ci  *     <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted
168c2ecf20Sopenharmony_ci  *         and masked to place it at field <y> of register <x>.  This value
178c2ecf20Sopenharmony_ci  *         can be |'d with others to produce a full register value for
188c2ecf20Sopenharmony_ci  *         register <x>.
198c2ecf20Sopenharmony_ci  *
208c2ecf20Sopenharmony_ci  *     <x>_<y>_m(void) : Returns a mask for field <y> of register <x>.  This
218c2ecf20Sopenharmony_ci  *         value can be ~'d and then &'d to clear the value of field <y> for
228c2ecf20Sopenharmony_ci  *         register <x>.
238c2ecf20Sopenharmony_ci  *
248c2ecf20Sopenharmony_ci  *     <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted
258c2ecf20Sopenharmony_ci  *         to place it at field <y> of register <x>.  This value can be |'d
268c2ecf20Sopenharmony_ci  *         with others to produce a full register value for <x>.
278c2ecf20Sopenharmony_ci  *
288c2ecf20Sopenharmony_ci  *     <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register
298c2ecf20Sopenharmony_ci  *         <x> value 'r' after being shifted to place its LSB at bit 0.
308c2ecf20Sopenharmony_ci  *         This value is suitable for direct comparison with other unshifted
318c2ecf20Sopenharmony_ci  *         values appropriate for use in field <y> of register <x>.
328c2ecf20Sopenharmony_ci  *
338c2ecf20Sopenharmony_ci  *     <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for
348c2ecf20Sopenharmony_ci  *         field <y> of register <x>.  This value is suitable for direct
358c2ecf20Sopenharmony_ci  *         comparison with unshifted values appropriate for use in field <y>
368c2ecf20Sopenharmony_ci  *         of register <x>.
378c2ecf20Sopenharmony_ci  */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#ifndef HOST1X_HW_HOST1X05_UCLASS_H
408c2ecf20Sopenharmony_ci#define HOST1X_HW_HOST1X05_UCLASS_H
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_incr_syncpt_r(void)
438c2ecf20Sopenharmony_ci{
448c2ecf20Sopenharmony_ci	return 0x0;
458c2ecf20Sopenharmony_ci}
468c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INCR_SYNCPT \
478c2ecf20Sopenharmony_ci	host1x_uclass_incr_syncpt_r()
488c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_incr_syncpt_cond_f(u32 v)
498c2ecf20Sopenharmony_ci{
508c2ecf20Sopenharmony_ci	return (v & 0xff) << 8;
518c2ecf20Sopenharmony_ci}
528c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INCR_SYNCPT_COND_F(v) \
538c2ecf20Sopenharmony_ci	host1x_uclass_incr_syncpt_cond_f(v)
548c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_incr_syncpt_indx_f(u32 v)
558c2ecf20Sopenharmony_ci{
568c2ecf20Sopenharmony_ci	return (v & 0xff) << 0;
578c2ecf20Sopenharmony_ci}
588c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INCR_SYNCPT_INDX_F(v) \
598c2ecf20Sopenharmony_ci	host1x_uclass_incr_syncpt_indx_f(v)
608c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_wait_syncpt_r(void)
618c2ecf20Sopenharmony_ci{
628c2ecf20Sopenharmony_ci	return 0x8;
638c2ecf20Sopenharmony_ci}
648c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_WAIT_SYNCPT \
658c2ecf20Sopenharmony_ci	host1x_uclass_wait_syncpt_r()
668c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_wait_syncpt_indx_f(u32 v)
678c2ecf20Sopenharmony_ci{
688c2ecf20Sopenharmony_ci	return (v & 0xff) << 24;
698c2ecf20Sopenharmony_ci}
708c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_WAIT_SYNCPT_INDX_F(v) \
718c2ecf20Sopenharmony_ci	host1x_uclass_wait_syncpt_indx_f(v)
728c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_wait_syncpt_thresh_f(u32 v)
738c2ecf20Sopenharmony_ci{
748c2ecf20Sopenharmony_ci	return (v & 0xffffff) << 0;
758c2ecf20Sopenharmony_ci}
768c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_WAIT_SYNCPT_THRESH_F(v) \
778c2ecf20Sopenharmony_ci	host1x_uclass_wait_syncpt_thresh_f(v)
788c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_wait_syncpt_base_r(void)
798c2ecf20Sopenharmony_ci{
808c2ecf20Sopenharmony_ci	return 0x9;
818c2ecf20Sopenharmony_ci}
828c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_WAIT_SYNCPT_BASE \
838c2ecf20Sopenharmony_ci	host1x_uclass_wait_syncpt_base_r()
848c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_wait_syncpt_base_indx_f(u32 v)
858c2ecf20Sopenharmony_ci{
868c2ecf20Sopenharmony_ci	return (v & 0xff) << 24;
878c2ecf20Sopenharmony_ci}
888c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_WAIT_SYNCPT_BASE_INDX_F(v) \
898c2ecf20Sopenharmony_ci	host1x_uclass_wait_syncpt_base_indx_f(v)
908c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_wait_syncpt_base_base_indx_f(u32 v)
918c2ecf20Sopenharmony_ci{
928c2ecf20Sopenharmony_ci	return (v & 0xff) << 16;
938c2ecf20Sopenharmony_ci}
948c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_WAIT_SYNCPT_BASE_BASE_INDX_F(v) \
958c2ecf20Sopenharmony_ci	host1x_uclass_wait_syncpt_base_base_indx_f(v)
968c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_wait_syncpt_base_offset_f(u32 v)
978c2ecf20Sopenharmony_ci{
988c2ecf20Sopenharmony_ci	return (v & 0xffff) << 0;
998c2ecf20Sopenharmony_ci}
1008c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_WAIT_SYNCPT_BASE_OFFSET_F(v) \
1018c2ecf20Sopenharmony_ci	host1x_uclass_wait_syncpt_base_offset_f(v)
1028c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_load_syncpt_base_r(void)
1038c2ecf20Sopenharmony_ci{
1048c2ecf20Sopenharmony_ci	return 0xb;
1058c2ecf20Sopenharmony_ci}
1068c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_LOAD_SYNCPT_BASE \
1078c2ecf20Sopenharmony_ci	host1x_uclass_load_syncpt_base_r()
1088c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_load_syncpt_base_base_indx_f(u32 v)
1098c2ecf20Sopenharmony_ci{
1108c2ecf20Sopenharmony_ci	return (v & 0xff) << 24;
1118c2ecf20Sopenharmony_ci}
1128c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_LOAD_SYNCPT_BASE_BASE_INDX_F(v) \
1138c2ecf20Sopenharmony_ci	host1x_uclass_load_syncpt_base_base_indx_f(v)
1148c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_load_syncpt_base_value_f(u32 v)
1158c2ecf20Sopenharmony_ci{
1168c2ecf20Sopenharmony_ci	return (v & 0xffffff) << 0;
1178c2ecf20Sopenharmony_ci}
1188c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_LOAD_SYNCPT_BASE_VALUE_F(v) \
1198c2ecf20Sopenharmony_ci	host1x_uclass_load_syncpt_base_value_f(v)
1208c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_incr_syncpt_base_base_indx_f(u32 v)
1218c2ecf20Sopenharmony_ci{
1228c2ecf20Sopenharmony_ci	return (v & 0xff) << 24;
1238c2ecf20Sopenharmony_ci}
1248c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INCR_SYNCPT_BASE_BASE_INDX_F(v) \
1258c2ecf20Sopenharmony_ci	host1x_uclass_incr_syncpt_base_base_indx_f(v)
1268c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_incr_syncpt_base_offset_f(u32 v)
1278c2ecf20Sopenharmony_ci{
1288c2ecf20Sopenharmony_ci	return (v & 0xffffff) << 0;
1298c2ecf20Sopenharmony_ci}
1308c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INCR_SYNCPT_BASE_OFFSET_F(v) \
1318c2ecf20Sopenharmony_ci	host1x_uclass_incr_syncpt_base_offset_f(v)
1328c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_indoff_r(void)
1338c2ecf20Sopenharmony_ci{
1348c2ecf20Sopenharmony_ci	return 0x2d;
1358c2ecf20Sopenharmony_ci}
1368c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INDOFF \
1378c2ecf20Sopenharmony_ci	host1x_uclass_indoff_r()
1388c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_indoff_indbe_f(u32 v)
1398c2ecf20Sopenharmony_ci{
1408c2ecf20Sopenharmony_ci	return (v & 0xf) << 28;
1418c2ecf20Sopenharmony_ci}
1428c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INDOFF_INDBE_F(v) \
1438c2ecf20Sopenharmony_ci	host1x_uclass_indoff_indbe_f(v)
1448c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_indoff_autoinc_f(u32 v)
1458c2ecf20Sopenharmony_ci{
1468c2ecf20Sopenharmony_ci	return (v & 0x1) << 27;
1478c2ecf20Sopenharmony_ci}
1488c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INDOFF_AUTOINC_F(v) \
1498c2ecf20Sopenharmony_ci	host1x_uclass_indoff_autoinc_f(v)
1508c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_indoff_indmodid_f(u32 v)
1518c2ecf20Sopenharmony_ci{
1528c2ecf20Sopenharmony_ci	return (v & 0xff) << 18;
1538c2ecf20Sopenharmony_ci}
1548c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INDOFF_INDMODID_F(v) \
1558c2ecf20Sopenharmony_ci	host1x_uclass_indoff_indmodid_f(v)
1568c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_indoff_indroffset_f(u32 v)
1578c2ecf20Sopenharmony_ci{
1588c2ecf20Sopenharmony_ci	return (v & 0xffff) << 2;
1598c2ecf20Sopenharmony_ci}
1608c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INDOFF_INDROFFSET_F(v) \
1618c2ecf20Sopenharmony_ci	host1x_uclass_indoff_indroffset_f(v)
1628c2ecf20Sopenharmony_cistatic inline u32 host1x_uclass_indoff_rwn_read_v(void)
1638c2ecf20Sopenharmony_ci{
1648c2ecf20Sopenharmony_ci	return 1;
1658c2ecf20Sopenharmony_ci}
1668c2ecf20Sopenharmony_ci#define HOST1X_UCLASS_INDOFF_INDROFFSET_F(v) \
1678c2ecf20Sopenharmony_ci	host1x_uclass_indoff_indroffset_f(v)
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci#endif
170