1*9952f691SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2a134789aSThierry Reding /* 3a134789aSThierry Reding * Copyright (c) 2015 NVIDIA Corporation. 4a134789aSThierry Reding */ 5a134789aSThierry Reding 6a134789aSThierry Reding /* 7a134789aSThierry Reding * Function naming determines intended use: 8a134789aSThierry Reding * 9a134789aSThierry Reding * <x>_r(void) : Returns the offset for register <x>. 10a134789aSThierry Reding * 11a134789aSThierry Reding * <x>_w(void) : Returns the word offset for word (4 byte) element <x>. 12a134789aSThierry Reding * 13a134789aSThierry Reding * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits. 14a134789aSThierry Reding * 15a134789aSThierry Reding * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted 16a134789aSThierry Reding * and masked to place it at field <y> of register <x>. This value 17a134789aSThierry Reding * can be |'d with others to produce a full register value for 18a134789aSThierry Reding * register <x>. 19a134789aSThierry Reding * 20a134789aSThierry Reding * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This 21a134789aSThierry Reding * value can be ~'d and then &'d to clear the value of field <y> for 22a134789aSThierry Reding * register <x>. 23a134789aSThierry Reding * 24a134789aSThierry Reding * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted 25a134789aSThierry Reding * to place it at field <y> of register <x>. This value can be |'d 26a134789aSThierry Reding * with others to produce a full register value for <x>. 27a134789aSThierry Reding * 28a134789aSThierry Reding * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register 29a134789aSThierry Reding * <x> value 'r' after being shifted to place its LSB at bit 0. 30a134789aSThierry Reding * This value is suitable for direct comparison with other unshifted 31a134789aSThierry Reding * values appropriate for use in field <y> of register <x>. 32a134789aSThierry Reding * 33a134789aSThierry Reding * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for 34a134789aSThierry Reding * field <y> of register <x>. This value is suitable for direct 35a134789aSThierry Reding * comparison with unshifted values appropriate for use in field <y> 36a134789aSThierry Reding * of register <x>. 37a134789aSThierry Reding */ 38a134789aSThierry Reding 39a134789aSThierry Reding #ifndef HOST1X_HW_HOST1X05_CHANNEL_H 40a134789aSThierry Reding #define HOST1X_HW_HOST1X05_CHANNEL_H 41a134789aSThierry Reding host1x_channel_fifostat_r(void)42a134789aSThierry Redingstatic inline u32 host1x_channel_fifostat_r(void) 43a134789aSThierry Reding { 44a134789aSThierry Reding return 0x0; 45a134789aSThierry Reding } 46a134789aSThierry Reding #define HOST1X_CHANNEL_FIFOSTAT \ 47a134789aSThierry Reding host1x_channel_fifostat_r() host1x_channel_fifostat_cfempty_v(u32 r)48a134789aSThierry Redingstatic inline u32 host1x_channel_fifostat_cfempty_v(u32 r) 49a134789aSThierry Reding { 50a134789aSThierry Reding return (r >> 11) & 0x1; 51a134789aSThierry Reding } 52a134789aSThierry Reding #define HOST1X_CHANNEL_FIFOSTAT_CFEMPTY_V(r) \ 53a134789aSThierry Reding host1x_channel_fifostat_cfempty_v(r) host1x_channel_dmastart_r(void)54a134789aSThierry Redingstatic inline u32 host1x_channel_dmastart_r(void) 55a134789aSThierry Reding { 56a134789aSThierry Reding return 0x14; 57a134789aSThierry Reding } 58a134789aSThierry Reding #define HOST1X_CHANNEL_DMASTART \ 59a134789aSThierry Reding host1x_channel_dmastart_r() host1x_channel_dmaput_r(void)60a134789aSThierry Redingstatic inline u32 host1x_channel_dmaput_r(void) 61a134789aSThierry Reding { 62a134789aSThierry Reding return 0x18; 63a134789aSThierry Reding } 64a134789aSThierry Reding #define HOST1X_CHANNEL_DMAPUT \ 65a134789aSThierry Reding host1x_channel_dmaput_r() host1x_channel_dmaget_r(void)66a134789aSThierry Redingstatic inline u32 host1x_channel_dmaget_r(void) 67a134789aSThierry Reding { 68a134789aSThierry Reding return 0x1c; 69a134789aSThierry Reding } 70a134789aSThierry Reding #define HOST1X_CHANNEL_DMAGET \ 71a134789aSThierry Reding host1x_channel_dmaget_r() host1x_channel_dmaend_r(void)72a134789aSThierry Redingstatic inline u32 host1x_channel_dmaend_r(void) 73a134789aSThierry Reding { 74a134789aSThierry Reding return 0x20; 75a134789aSThierry Reding } 76a134789aSThierry Reding #define HOST1X_CHANNEL_DMAEND \ 77a134789aSThierry Reding host1x_channel_dmaend_r() host1x_channel_dmactrl_r(void)78a134789aSThierry Redingstatic inline u32 host1x_channel_dmactrl_r(void) 79a134789aSThierry Reding { 80a134789aSThierry Reding return 0x24; 81a134789aSThierry Reding } 82a134789aSThierry Reding #define HOST1X_CHANNEL_DMACTRL \ 83a134789aSThierry Reding host1x_channel_dmactrl_r() host1x_channel_dmactrl_dmastop(void)84a134789aSThierry Redingstatic inline u32 host1x_channel_dmactrl_dmastop(void) 85a134789aSThierry Reding { 86a134789aSThierry Reding return 1 << 0; 87a134789aSThierry Reding } 88a134789aSThierry Reding #define HOST1X_CHANNEL_DMACTRL_DMASTOP \ 89a134789aSThierry Reding host1x_channel_dmactrl_dmastop() host1x_channel_dmactrl_dmastop_v(u32 r)90a134789aSThierry Redingstatic inline u32 host1x_channel_dmactrl_dmastop_v(u32 r) 91a134789aSThierry Reding { 92a134789aSThierry Reding return (r >> 0) & 0x1; 93a134789aSThierry Reding } 94a134789aSThierry Reding #define HOST1X_CHANNEL_DMACTRL_DMASTOP_V(r) \ 95a134789aSThierry Reding host1x_channel_dmactrl_dmastop_v(r) host1x_channel_dmactrl_dmagetrst(void)96a134789aSThierry Redingstatic inline u32 host1x_channel_dmactrl_dmagetrst(void) 97a134789aSThierry Reding { 98a134789aSThierry Reding return 1 << 1; 99a134789aSThierry Reding } 100a134789aSThierry Reding #define HOST1X_CHANNEL_DMACTRL_DMAGETRST \ 101a134789aSThierry Reding host1x_channel_dmactrl_dmagetrst() host1x_channel_dmactrl_dmainitget(void)102a134789aSThierry Redingstatic inline u32 host1x_channel_dmactrl_dmainitget(void) 103a134789aSThierry Reding { 104a134789aSThierry Reding return 1 << 2; 105a134789aSThierry Reding } 106a134789aSThierry Reding #define HOST1X_CHANNEL_DMACTRL_DMAINITGET \ 107a134789aSThierry Reding host1x_channel_dmactrl_dmainitget() host1x_channel_channelctrl_r(void)1082316f29fSMikko Perttunenstatic inline u32 host1x_channel_channelctrl_r(void) 1092316f29fSMikko Perttunen { 1102316f29fSMikko Perttunen return 0x98; 1112316f29fSMikko Perttunen } 1122316f29fSMikko Perttunen #define HOST1X_CHANNEL_CHANNELCTRL \ 1132316f29fSMikko Perttunen host1x_channel_channelctrl_r() host1x_channel_channelctrl_kernel_filter_gbuffer_f(u32 v)1142316f29fSMikko Perttunenstatic inline u32 host1x_channel_channelctrl_kernel_filter_gbuffer_f(u32 v) 1152316f29fSMikko Perttunen { 1162316f29fSMikko Perttunen return (v & 0x1) << 2; 1172316f29fSMikko Perttunen } 1182316f29fSMikko Perttunen #define HOST1X_CHANNEL_CHANNELCTRL_KERNEL_FILTER_GBUFFER(v) \ 1192316f29fSMikko Perttunen host1x_channel_channelctrl_kernel_filter_gbuffer_f(v) 120a134789aSThierry Reding 121a134789aSThierry Reding #endif 122