Path: blob/master/drivers/gpu/host1x/hw/hw_host1x05_sync.h
26493 views
/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Copyright (c) 2015 NVIDIA Corporation.3*/45/*6* Function naming determines intended use:7*8* <x>_r(void) : Returns the offset for register <x>.9*10* <x>_w(void) : Returns the word offset for word (4 byte) element <x>.11*12* <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.13*14* <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted15* and masked to place it at field <y> of register <x>. This value16* can be |'d with others to produce a full register value for17* register <x>.18*19* <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This20* value can be ~'d and then &'d to clear the value of field <y> for21* register <x>.22*23* <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted24* to place it at field <y> of register <x>. This value can be |'d25* with others to produce a full register value for <x>.26*27* <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register28* <x> value 'r' after being shifted to place its LSB at bit 0.29* This value is suitable for direct comparison with other unshifted30* values appropriate for use in field <y> of register <x>.31*32* <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for33* field <y> of register <x>. This value is suitable for direct34* comparison with unshifted values appropriate for use in field <y>35* of register <x>.36*/3738#ifndef HOST1X_HW_HOST1X05_SYNC_H39#define HOST1X_HW_HOST1X05_SYNC_H4041#define REGISTER_STRIDE 44243static inline u32 host1x_sync_syncpt_r(unsigned int id)44{45return 0xf80 + id * REGISTER_STRIDE;46}47#define HOST1X_SYNC_SYNCPT(id) \48host1x_sync_syncpt_r(id)49static inline u32 host1x_sync_syncpt_thresh_cpu0_int_status_r(unsigned int id)50{51return 0xe80 + id * REGISTER_STRIDE;52}53#define HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(id) \54host1x_sync_syncpt_thresh_cpu0_int_status_r(id)55static inline u32 host1x_sync_syncpt_thresh_int_disable_r(unsigned int id)56{57return 0xf00 + id * REGISTER_STRIDE;58}59#define HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(id) \60host1x_sync_syncpt_thresh_int_disable_r(id)61static inline u32 host1x_sync_syncpt_thresh_int_enable_cpu0_r(unsigned int id)62{63return 0xf20 + id * REGISTER_STRIDE;64}65#define HOST1X_SYNC_SYNCPT_THRESH_INT_ENABLE_CPU0(id) \66host1x_sync_syncpt_thresh_int_enable_cpu0_r(id)67static inline u32 host1x_sync_cf_setup_r(unsigned int channel)68{69return 0xc00 + channel * REGISTER_STRIDE;70}71#define HOST1X_SYNC_CF_SETUP(channel) \72host1x_sync_cf_setup_r(channel)73static inline u32 host1x_sync_cf_setup_base_v(u32 r)74{75return (r >> 0) & 0x3ff;76}77#define HOST1X_SYNC_CF_SETUP_BASE_V(r) \78host1x_sync_cf_setup_base_v(r)79static inline u32 host1x_sync_cf_setup_limit_v(u32 r)80{81return (r >> 16) & 0x3ff;82}83#define HOST1X_SYNC_CF_SETUP_LIMIT_V(r) \84host1x_sync_cf_setup_limit_v(r)85static inline u32 host1x_sync_cmdproc_stop_r(void)86{87return 0xac;88}89#define HOST1X_SYNC_CMDPROC_STOP \90host1x_sync_cmdproc_stop_r()91static inline u32 host1x_sync_ch_teardown_r(void)92{93return 0xb0;94}95#define HOST1X_SYNC_CH_TEARDOWN \96host1x_sync_ch_teardown_r()97static inline u32 host1x_sync_usec_clk_r(void)98{99return 0x1a4;100}101#define HOST1X_SYNC_USEC_CLK \102host1x_sync_usec_clk_r()103static inline u32 host1x_sync_ctxsw_timeout_cfg_r(void)104{105return 0x1a8;106}107#define HOST1X_SYNC_CTXSW_TIMEOUT_CFG \108host1x_sync_ctxsw_timeout_cfg_r()109static inline u32 host1x_sync_ip_busy_timeout_r(void)110{111return 0x1bc;112}113#define HOST1X_SYNC_IP_BUSY_TIMEOUT \114host1x_sync_ip_busy_timeout_r()115static inline u32 host1x_sync_mlock_owner_r(unsigned int id)116{117return 0x340 + id * REGISTER_STRIDE;118}119#define HOST1X_SYNC_MLOCK_OWNER(id) \120host1x_sync_mlock_owner_r(id)121static inline u32 host1x_sync_mlock_owner_chid_v(u32 r)122{123return (r >> 8) & 0xf;124}125#define HOST1X_SYNC_MLOCK_OWNER_CHID_V(v) \126host1x_sync_mlock_owner_chid_v(v)127static inline u32 host1x_sync_mlock_owner_cpu_owns_v(u32 r)128{129return (r >> 1) & 0x1;130}131#define HOST1X_SYNC_MLOCK_OWNER_CPU_OWNS_V(r) \132host1x_sync_mlock_owner_cpu_owns_v(r)133static inline u32 host1x_sync_mlock_owner_ch_owns_v(u32 r)134{135return (r >> 0) & 0x1;136}137#define HOST1X_SYNC_MLOCK_OWNER_CH_OWNS_V(r) \138host1x_sync_mlock_owner_ch_owns_v(r)139static inline u32 host1x_sync_syncpt_int_thresh_r(unsigned int id)140{141return 0x1380 + id * REGISTER_STRIDE;142}143#define HOST1X_SYNC_SYNCPT_INT_THRESH(id) \144host1x_sync_syncpt_int_thresh_r(id)145static inline u32 host1x_sync_syncpt_base_r(unsigned int id)146{147return 0x600 + id * REGISTER_STRIDE;148}149#define HOST1X_SYNC_SYNCPT_BASE(id) \150host1x_sync_syncpt_base_r(id)151static inline u32 host1x_sync_syncpt_cpu_incr_r(unsigned int id)152{153return 0xf60 + id * REGISTER_STRIDE;154}155#define HOST1X_SYNC_SYNCPT_CPU_INCR(id) \156host1x_sync_syncpt_cpu_incr_r(id)157static inline u32 host1x_sync_cbread_r(unsigned int channel)158{159return 0xc80 + channel * REGISTER_STRIDE;160}161#define HOST1X_SYNC_CBREAD(channel) \162host1x_sync_cbread_r(channel)163static inline u32 host1x_sync_cfpeek_ctrl_r(void)164{165return 0x74c;166}167#define HOST1X_SYNC_CFPEEK_CTRL \168host1x_sync_cfpeek_ctrl_r()169static inline u32 host1x_sync_cfpeek_ctrl_addr_f(u32 v)170{171return (v & 0x3ff) << 0;172}173#define HOST1X_SYNC_CFPEEK_CTRL_ADDR_F(v) \174host1x_sync_cfpeek_ctrl_addr_f(v)175static inline u32 host1x_sync_cfpeek_ctrl_channr_f(u32 v)176{177return (v & 0xf) << 16;178}179#define HOST1X_SYNC_CFPEEK_CTRL_CHANNR_F(v) \180host1x_sync_cfpeek_ctrl_channr_f(v)181static inline u32 host1x_sync_cfpeek_ctrl_ena_f(u32 v)182{183return (v & 0x1) << 31;184}185#define HOST1X_SYNC_CFPEEK_CTRL_ENA_F(v) \186host1x_sync_cfpeek_ctrl_ena_f(v)187static inline u32 host1x_sync_cfpeek_read_r(void)188{189return 0x750;190}191#define HOST1X_SYNC_CFPEEK_READ \192host1x_sync_cfpeek_read_r()193static inline u32 host1x_sync_cfpeek_ptrs_r(void)194{195return 0x754;196}197#define HOST1X_SYNC_CFPEEK_PTRS \198host1x_sync_cfpeek_ptrs_r()199static inline u32 host1x_sync_cfpeek_ptrs_cf_rd_ptr_v(u32 r)200{201return (r >> 0) & 0x3ff;202}203#define HOST1X_SYNC_CFPEEK_PTRS_CF_RD_PTR_V(r) \204host1x_sync_cfpeek_ptrs_cf_rd_ptr_v(r)205static inline u32 host1x_sync_cfpeek_ptrs_cf_wr_ptr_v(u32 r)206{207return (r >> 16) & 0x3ff;208}209#define HOST1X_SYNC_CFPEEK_PTRS_CF_WR_PTR_V(r) \210host1x_sync_cfpeek_ptrs_cf_wr_ptr_v(r)211static inline u32 host1x_sync_cbstat_r(unsigned int channel)212{213return 0xcc0 + channel * REGISTER_STRIDE;214}215#define HOST1X_SYNC_CBSTAT(channel) \216host1x_sync_cbstat_r(channel)217static inline u32 host1x_sync_cbstat_cboffset_v(u32 r)218{219return (r >> 0) & 0xffff;220}221#define HOST1X_SYNC_CBSTAT_CBOFFSET_V(r) \222host1x_sync_cbstat_cboffset_v(r)223static inline u32 host1x_sync_cbstat_cbclass_v(u32 r)224{225return (r >> 16) & 0x3ff;226}227#define HOST1X_SYNC_CBSTAT_CBCLASS_V(r) \228host1x_sync_cbstat_cbclass_v(r)229230#endif231232233