xref: /openbmc/linux/drivers/gpu/host1x/hw/hw_host1x01_channel.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*9952f691SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
26579324aSTerje Bergstrom /*
36579324aSTerje Bergstrom  * Copyright (c) 2012-2013, NVIDIA Corporation.
46579324aSTerje Bergstrom  */
56579324aSTerje Bergstrom 
66579324aSTerje Bergstrom  /*
76579324aSTerje Bergstrom   * Function naming determines intended use:
86579324aSTerje Bergstrom   *
96579324aSTerje Bergstrom   *     <x>_r(void) : Returns the offset for register <x>.
106579324aSTerje Bergstrom   *
116579324aSTerje Bergstrom   *     <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
126579324aSTerje Bergstrom   *
136579324aSTerje Bergstrom   *     <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
146579324aSTerje Bergstrom   *
156579324aSTerje Bergstrom   *     <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted
166579324aSTerje Bergstrom   *         and masked to place it at field <y> of register <x>.  This value
176579324aSTerje Bergstrom   *         can be |'d with others to produce a full register value for
186579324aSTerje Bergstrom   *         register <x>.
196579324aSTerje Bergstrom   *
206579324aSTerje Bergstrom   *     <x>_<y>_m(void) : Returns a mask for field <y> of register <x>.  This
216579324aSTerje Bergstrom   *         value can be ~'d and then &'d to clear the value of field <y> for
226579324aSTerje Bergstrom   *         register <x>.
236579324aSTerje Bergstrom   *
246579324aSTerje Bergstrom   *     <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted
256579324aSTerje Bergstrom   *         to place it at field <y> of register <x>.  This value can be |'d
266579324aSTerje Bergstrom   *         with others to produce a full register value for <x>.
276579324aSTerje Bergstrom   *
286579324aSTerje Bergstrom   *     <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register
296579324aSTerje Bergstrom   *         <x> value 'r' after being shifted to place its LSB at bit 0.
306579324aSTerje Bergstrom   *         This value is suitable for direct comparison with other unshifted
316579324aSTerje Bergstrom   *         values appropriate for use in field <y> of register <x>.
326579324aSTerje Bergstrom   *
336579324aSTerje Bergstrom   *     <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for
346579324aSTerje Bergstrom   *         field <y> of register <x>.  This value is suitable for direct
356579324aSTerje Bergstrom   *         comparison with unshifted values appropriate for use in field <y>
366579324aSTerje Bergstrom   *         of register <x>.
376579324aSTerje Bergstrom   */
386579324aSTerje Bergstrom 
396579324aSTerje Bergstrom #ifndef __hw_host1x_channel_host1x_h__
406579324aSTerje Bergstrom #define __hw_host1x_channel_host1x_h__
416579324aSTerje Bergstrom 
host1x_channel_fifostat_r(void)426236451dSTerje Bergstrom static inline u32 host1x_channel_fifostat_r(void)
436236451dSTerje Bergstrom {
446236451dSTerje Bergstrom 	return 0x0;
456236451dSTerje Bergstrom }
466236451dSTerje Bergstrom #define HOST1X_CHANNEL_FIFOSTAT \
476236451dSTerje Bergstrom 	host1x_channel_fifostat_r()
host1x_channel_fifostat_cfempty_v(u32 r)486236451dSTerje Bergstrom static inline u32 host1x_channel_fifostat_cfempty_v(u32 r)
496236451dSTerje Bergstrom {
506236451dSTerje Bergstrom 	return (r >> 10) & 0x1;
516236451dSTerje Bergstrom }
526236451dSTerje Bergstrom #define HOST1X_CHANNEL_FIFOSTAT_CFEMPTY_V(r) \
536236451dSTerje Bergstrom 	host1x_channel_fifostat_cfempty_v(r)
host1x_channel_dmastart_r(void)546579324aSTerje Bergstrom static inline u32 host1x_channel_dmastart_r(void)
556579324aSTerje Bergstrom {
566579324aSTerje Bergstrom 	return 0x14;
576579324aSTerje Bergstrom }
586579324aSTerje Bergstrom #define HOST1X_CHANNEL_DMASTART \
596579324aSTerje Bergstrom 	host1x_channel_dmastart_r()
host1x_channel_dmaput_r(void)606579324aSTerje Bergstrom static inline u32 host1x_channel_dmaput_r(void)
616579324aSTerje Bergstrom {
626579324aSTerje Bergstrom 	return 0x18;
636579324aSTerje Bergstrom }
646579324aSTerje Bergstrom #define HOST1X_CHANNEL_DMAPUT \
656579324aSTerje Bergstrom 	host1x_channel_dmaput_r()
host1x_channel_dmaget_r(void)666579324aSTerje Bergstrom static inline u32 host1x_channel_dmaget_r(void)
676579324aSTerje Bergstrom {
686579324aSTerje Bergstrom 	return 0x1c;
696579324aSTerje Bergstrom }
706579324aSTerje Bergstrom #define HOST1X_CHANNEL_DMAGET \
716579324aSTerje Bergstrom 	host1x_channel_dmaget_r()
host1x_channel_dmaend_r(void)726579324aSTerje Bergstrom static inline u32 host1x_channel_dmaend_r(void)
736579324aSTerje Bergstrom {
746579324aSTerje Bergstrom 	return 0x20;
756579324aSTerje Bergstrom }
766579324aSTerje Bergstrom #define HOST1X_CHANNEL_DMAEND \
776579324aSTerje Bergstrom 	host1x_channel_dmaend_r()
host1x_channel_dmactrl_r(void)786579324aSTerje Bergstrom static inline u32 host1x_channel_dmactrl_r(void)
796579324aSTerje Bergstrom {
806579324aSTerje Bergstrom 	return 0x24;
816579324aSTerje Bergstrom }
826579324aSTerje Bergstrom #define HOST1X_CHANNEL_DMACTRL \
836579324aSTerje Bergstrom 	host1x_channel_dmactrl_r()
host1x_channel_dmactrl_dmastop(void)846579324aSTerje Bergstrom static inline u32 host1x_channel_dmactrl_dmastop(void)
856579324aSTerje Bergstrom {
866579324aSTerje Bergstrom 	return 1 << 0;
876579324aSTerje Bergstrom }
886579324aSTerje Bergstrom #define HOST1X_CHANNEL_DMACTRL_DMASTOP \
896579324aSTerje Bergstrom 	host1x_channel_dmactrl_dmastop()
host1x_channel_dmactrl_dmastop_v(u32 r)906236451dSTerje Bergstrom static inline u32 host1x_channel_dmactrl_dmastop_v(u32 r)
916236451dSTerje Bergstrom {
926236451dSTerje Bergstrom 	return (r >> 0) & 0x1;
936236451dSTerje Bergstrom }
946236451dSTerje Bergstrom #define HOST1X_CHANNEL_DMACTRL_DMASTOP_V(r) \
956236451dSTerje Bergstrom 	host1x_channel_dmactrl_dmastop_v(r)
host1x_channel_dmactrl_dmagetrst(void)966579324aSTerje Bergstrom static inline u32 host1x_channel_dmactrl_dmagetrst(void)
976579324aSTerje Bergstrom {
986579324aSTerje Bergstrom 	return 1 << 1;
996579324aSTerje Bergstrom }
1006579324aSTerje Bergstrom #define HOST1X_CHANNEL_DMACTRL_DMAGETRST \
1016579324aSTerje Bergstrom 	host1x_channel_dmactrl_dmagetrst()
host1x_channel_dmactrl_dmainitget(void)1026579324aSTerje Bergstrom static inline u32 host1x_channel_dmactrl_dmainitget(void)
1036579324aSTerje Bergstrom {
1046579324aSTerje Bergstrom 	return 1 << 2;
1056579324aSTerje Bergstrom }
1066579324aSTerje Bergstrom #define HOST1X_CHANNEL_DMACTRL_DMAINITGET \
1076579324aSTerje Bergstrom 	host1x_channel_dmactrl_dmainitget()
1086579324aSTerje Bergstrom #endif
109