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_CHANNEL_H
408c2ecf20Sopenharmony_ci#define HOST1X_HW_HOST1X05_CHANNEL_H
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_fifostat_r(void)
438c2ecf20Sopenharmony_ci{
448c2ecf20Sopenharmony_ci	return 0x0;
458c2ecf20Sopenharmony_ci}
468c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_FIFOSTAT \
478c2ecf20Sopenharmony_ci	host1x_channel_fifostat_r()
488c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_fifostat_cfempty_v(u32 r)
498c2ecf20Sopenharmony_ci{
508c2ecf20Sopenharmony_ci	return (r >> 11) & 0x1;
518c2ecf20Sopenharmony_ci}
528c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_FIFOSTAT_CFEMPTY_V(r) \
538c2ecf20Sopenharmony_ci	host1x_channel_fifostat_cfempty_v(r)
548c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_dmastart_r(void)
558c2ecf20Sopenharmony_ci{
568c2ecf20Sopenharmony_ci	return 0x14;
578c2ecf20Sopenharmony_ci}
588c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_DMASTART \
598c2ecf20Sopenharmony_ci	host1x_channel_dmastart_r()
608c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_dmaput_r(void)
618c2ecf20Sopenharmony_ci{
628c2ecf20Sopenharmony_ci	return 0x18;
638c2ecf20Sopenharmony_ci}
648c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_DMAPUT \
658c2ecf20Sopenharmony_ci	host1x_channel_dmaput_r()
668c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_dmaget_r(void)
678c2ecf20Sopenharmony_ci{
688c2ecf20Sopenharmony_ci	return 0x1c;
698c2ecf20Sopenharmony_ci}
708c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_DMAGET \
718c2ecf20Sopenharmony_ci	host1x_channel_dmaget_r()
728c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_dmaend_r(void)
738c2ecf20Sopenharmony_ci{
748c2ecf20Sopenharmony_ci	return 0x20;
758c2ecf20Sopenharmony_ci}
768c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_DMAEND \
778c2ecf20Sopenharmony_ci	host1x_channel_dmaend_r()
788c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_dmactrl_r(void)
798c2ecf20Sopenharmony_ci{
808c2ecf20Sopenharmony_ci	return 0x24;
818c2ecf20Sopenharmony_ci}
828c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_DMACTRL \
838c2ecf20Sopenharmony_ci	host1x_channel_dmactrl_r()
848c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_dmactrl_dmastop(void)
858c2ecf20Sopenharmony_ci{
868c2ecf20Sopenharmony_ci	return 1 << 0;
878c2ecf20Sopenharmony_ci}
888c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_DMACTRL_DMASTOP \
898c2ecf20Sopenharmony_ci	host1x_channel_dmactrl_dmastop()
908c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_dmactrl_dmastop_v(u32 r)
918c2ecf20Sopenharmony_ci{
928c2ecf20Sopenharmony_ci	return (r >> 0) & 0x1;
938c2ecf20Sopenharmony_ci}
948c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_DMACTRL_DMASTOP_V(r) \
958c2ecf20Sopenharmony_ci	host1x_channel_dmactrl_dmastop_v(r)
968c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_dmactrl_dmagetrst(void)
978c2ecf20Sopenharmony_ci{
988c2ecf20Sopenharmony_ci	return 1 << 1;
998c2ecf20Sopenharmony_ci}
1008c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_DMACTRL_DMAGETRST \
1018c2ecf20Sopenharmony_ci	host1x_channel_dmactrl_dmagetrst()
1028c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_dmactrl_dmainitget(void)
1038c2ecf20Sopenharmony_ci{
1048c2ecf20Sopenharmony_ci	return 1 << 2;
1058c2ecf20Sopenharmony_ci}
1068c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_DMACTRL_DMAINITGET \
1078c2ecf20Sopenharmony_ci	host1x_channel_dmactrl_dmainitget()
1088c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_channelctrl_r(void)
1098c2ecf20Sopenharmony_ci{
1108c2ecf20Sopenharmony_ci	return 0x98;
1118c2ecf20Sopenharmony_ci}
1128c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_CHANNELCTRL \
1138c2ecf20Sopenharmony_ci	host1x_channel_channelctrl_r()
1148c2ecf20Sopenharmony_cistatic inline u32 host1x_channel_channelctrl_kernel_filter_gbuffer_f(u32 v)
1158c2ecf20Sopenharmony_ci{
1168c2ecf20Sopenharmony_ci	return (v & 0x1) << 2;
1178c2ecf20Sopenharmony_ci}
1188c2ecf20Sopenharmony_ci#define HOST1X_CHANNEL_CHANNELCTRL_KERNEL_FILTER_GBUFFER(v) \
1198c2ecf20Sopenharmony_ci	host1x_channel_channelctrl_kernel_filter_gbuffer_f(v)
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#endif
122