xref: /openbmc/linux/drivers/gpu/host1x/hw/hw_host1x02_channel.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*9952f691SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
25407f31bSThierry Reding /*
35407f31bSThierry Reding  * Copyright (c) 2013 NVIDIA Corporation.
45407f31bSThierry Reding  */
55407f31bSThierry Reding 
65407f31bSThierry Reding  /*
75407f31bSThierry Reding   * Function naming determines intended use:
85407f31bSThierry Reding   *
95407f31bSThierry Reding   *     <x>_r(void) : Returns the offset for register <x>.
105407f31bSThierry Reding   *
115407f31bSThierry Reding   *     <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
125407f31bSThierry Reding   *
135407f31bSThierry Reding   *     <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
145407f31bSThierry Reding   *
155407f31bSThierry Reding   *     <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted
165407f31bSThierry Reding   *         and masked to place it at field <y> of register <x>.  This value
175407f31bSThierry Reding   *         can be |'d with others to produce a full register value for
185407f31bSThierry Reding   *         register <x>.
195407f31bSThierry Reding   *
205407f31bSThierry Reding   *     <x>_<y>_m(void) : Returns a mask for field <y> of register <x>.  This
215407f31bSThierry Reding   *         value can be ~'d and then &'d to clear the value of field <y> for
225407f31bSThierry Reding   *         register <x>.
235407f31bSThierry Reding   *
245407f31bSThierry Reding   *     <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted
255407f31bSThierry Reding   *         to place it at field <y> of register <x>.  This value can be |'d
265407f31bSThierry Reding   *         with others to produce a full register value for <x>.
275407f31bSThierry Reding   *
285407f31bSThierry Reding   *     <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register
295407f31bSThierry Reding   *         <x> value 'r' after being shifted to place its LSB at bit 0.
305407f31bSThierry Reding   *         This value is suitable for direct comparison with other unshifted
315407f31bSThierry Reding   *         values appropriate for use in field <y> of register <x>.
325407f31bSThierry Reding   *
335407f31bSThierry Reding   *     <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for
345407f31bSThierry Reding   *         field <y> of register <x>.  This value is suitable for direct
355407f31bSThierry Reding   *         comparison with unshifted values appropriate for use in field <y>
365407f31bSThierry Reding   *         of register <x>.
375407f31bSThierry Reding   */
385407f31bSThierry Reding 
395407f31bSThierry Reding #ifndef HOST1X_HW_HOST1X02_CHANNEL_H
405407f31bSThierry Reding #define HOST1X_HW_HOST1X02_CHANNEL_H
415407f31bSThierry Reding 
host1x_channel_fifostat_r(void)425407f31bSThierry Reding static inline u32 host1x_channel_fifostat_r(void)
435407f31bSThierry Reding {
445407f31bSThierry Reding 	return 0x0;
455407f31bSThierry Reding }
465407f31bSThierry Reding #define HOST1X_CHANNEL_FIFOSTAT \
475407f31bSThierry Reding 	host1x_channel_fifostat_r()
host1x_channel_fifostat_cfempty_v(u32 r)485407f31bSThierry Reding static inline u32 host1x_channel_fifostat_cfempty_v(u32 r)
495407f31bSThierry Reding {
505407f31bSThierry Reding 	return (r >> 11) & 0x1;
515407f31bSThierry Reding }
525407f31bSThierry Reding #define HOST1X_CHANNEL_FIFOSTAT_CFEMPTY_V(r) \
535407f31bSThierry Reding 	host1x_channel_fifostat_cfempty_v(r)
host1x_channel_dmastart_r(void)545407f31bSThierry Reding static inline u32 host1x_channel_dmastart_r(void)
555407f31bSThierry Reding {
565407f31bSThierry Reding 	return 0x14;
575407f31bSThierry Reding }
585407f31bSThierry Reding #define HOST1X_CHANNEL_DMASTART \
595407f31bSThierry Reding 	host1x_channel_dmastart_r()
host1x_channel_dmaput_r(void)605407f31bSThierry Reding static inline u32 host1x_channel_dmaput_r(void)
615407f31bSThierry Reding {
625407f31bSThierry Reding 	return 0x18;
635407f31bSThierry Reding }
645407f31bSThierry Reding #define HOST1X_CHANNEL_DMAPUT \
655407f31bSThierry Reding 	host1x_channel_dmaput_r()
host1x_channel_dmaget_r(void)665407f31bSThierry Reding static inline u32 host1x_channel_dmaget_r(void)
675407f31bSThierry Reding {
685407f31bSThierry Reding 	return 0x1c;
695407f31bSThierry Reding }
705407f31bSThierry Reding #define HOST1X_CHANNEL_DMAGET \
715407f31bSThierry Reding 	host1x_channel_dmaget_r()
host1x_channel_dmaend_r(void)725407f31bSThierry Reding static inline u32 host1x_channel_dmaend_r(void)
735407f31bSThierry Reding {
745407f31bSThierry Reding 	return 0x20;
755407f31bSThierry Reding }
765407f31bSThierry Reding #define HOST1X_CHANNEL_DMAEND \
775407f31bSThierry Reding 	host1x_channel_dmaend_r()
host1x_channel_dmactrl_r(void)785407f31bSThierry Reding static inline u32 host1x_channel_dmactrl_r(void)
795407f31bSThierry Reding {
805407f31bSThierry Reding 	return 0x24;
815407f31bSThierry Reding }
825407f31bSThierry Reding #define HOST1X_CHANNEL_DMACTRL \
835407f31bSThierry Reding 	host1x_channel_dmactrl_r()
host1x_channel_dmactrl_dmastop(void)845407f31bSThierry Reding static inline u32 host1x_channel_dmactrl_dmastop(void)
855407f31bSThierry Reding {
865407f31bSThierry Reding 	return 1 << 0;
875407f31bSThierry Reding }
885407f31bSThierry Reding #define HOST1X_CHANNEL_DMACTRL_DMASTOP \
895407f31bSThierry Reding 	host1x_channel_dmactrl_dmastop()
host1x_channel_dmactrl_dmastop_v(u32 r)905407f31bSThierry Reding static inline u32 host1x_channel_dmactrl_dmastop_v(u32 r)
915407f31bSThierry Reding {
925407f31bSThierry Reding 	return (r >> 0) & 0x1;
935407f31bSThierry Reding }
945407f31bSThierry Reding #define HOST1X_CHANNEL_DMACTRL_DMASTOP_V(r) \
955407f31bSThierry Reding 	host1x_channel_dmactrl_dmastop_v(r)
host1x_channel_dmactrl_dmagetrst(void)965407f31bSThierry Reding static inline u32 host1x_channel_dmactrl_dmagetrst(void)
975407f31bSThierry Reding {
985407f31bSThierry Reding 	return 1 << 1;
995407f31bSThierry Reding }
1005407f31bSThierry Reding #define HOST1X_CHANNEL_DMACTRL_DMAGETRST \
1015407f31bSThierry Reding 	host1x_channel_dmactrl_dmagetrst()
host1x_channel_dmactrl_dmainitget(void)1025407f31bSThierry Reding static inline u32 host1x_channel_dmactrl_dmainitget(void)
1035407f31bSThierry Reding {
1045407f31bSThierry Reding 	return 1 << 2;
1055407f31bSThierry Reding }
1065407f31bSThierry Reding #define HOST1X_CHANNEL_DMACTRL_DMAINITGET \
1075407f31bSThierry Reding 	host1x_channel_dmactrl_dmainitget()
1085407f31bSThierry Reding 
1095407f31bSThierry Reding #endif
110