···11+/*22+ * Host1x init for Tegra210 SoCs33+ *44+ * Copyright (c) 2015 NVIDIA Corporation.55+ *66+ * This program is free software; you can redistribute it and/or modify it77+ * under the terms and conditions of the GNU General Public License,88+ * version 2, as published by the Free Software Foundation.99+ *1010+ * This program is distributed in the hope it will be useful, but WITHOUT1111+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1212+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1313+ * more details.1414+ *1515+ * You should have received a copy of the GNU General Public License1616+ * along with this program. If not, see <http://www.gnu.org/licenses/>.1717+ */1818+1919+/* include hw specification */2020+#include "host1x05.h"2121+#include "host1x05_hardware.h"2222+2323+/* include code */2424+#include "cdma_hw.c"2525+#include "channel_hw.c"2626+#include "debug_hw.c"2727+#include "intr_hw.c"2828+#include "syncpt_hw.c"2929+3030+#include "../dev.h"3131+3232+int host1x05_init(struct host1x *host)3333+{3434+ host->channel_op = &host1x_channel_ops;3535+ host->cdma_op = &host1x_cdma_ops;3636+ host->cdma_pb_op = &host1x_pushbuffer_ops;3737+ host->syncpt_op = &host1x_syncpt_ops;3838+ host->intr_op = &host1x_intr_ops;3939+ host->debug_op = &host1x_debug_ops;4040+4141+ return 0;4242+}
+26
drivers/gpu/host1x/hw/host1x05.h
···11+/*22+ * Host1x init for Tegra210 SoCs33+ *44+ * Copyright (c) 2015 NVIDIA Corporation.55+ *66+ * This program is free software; you can redistribute it and/or modify it77+ * under the terms and conditions of the GNU General Public License,88+ * version 2, as published by the Free Software Foundation.99+ *1010+ * This program is distributed in the hope it will be useful, but WITHOUT1111+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1212+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1313+ * more details.1414+ *1515+ * You should have received a copy of the GNU General Public License1616+ * along with this program. If not, see <http://www.gnu.org/licenses/>.1717+ */1818+1919+#ifndef HOST1X_HOST1X05_H2020+#define HOST1X_HOST1X05_H2121+2222+struct host1x;2323+2424+int host1x05_init(struct host1x *host);2525+2626+#endif
+142
drivers/gpu/host1x/hw/host1x05_hardware.h
···11+/*22+ * Tegra host1x Register Offsets for Tegra21033+ *44+ * Copyright (c) 2015 NVIDIA Corporation.55+ *66+ * This program is free software; you can redistribute it and/or modify it77+ * under the terms and conditions of the GNU General Public License,88+ * version 2, as published by the Free Software Foundation.99+ *1010+ * This program is distributed in the hope it will be useful, but WITHOUT1111+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1212+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1313+ * more details.1414+ *1515+ * You should have received a copy of the GNU General Public License1616+ * along with this program. If not, see <http://www.gnu.org/licenses/>.1717+ */1818+1919+#ifndef __HOST1X_HOST1X05_HARDWARE_H2020+#define __HOST1X_HOST1X05_HARDWARE_H2121+2222+#include <linux/types.h>2323+#include <linux/bitops.h>2424+2525+#include "hw_host1x05_channel.h"2626+#include "hw_host1x05_sync.h"2727+#include "hw_host1x05_uclass.h"2828+2929+static inline u32 host1x_class_host_wait_syncpt(3030+ unsigned indx, unsigned threshold)3131+{3232+ return host1x_uclass_wait_syncpt_indx_f(indx)3333+ | host1x_uclass_wait_syncpt_thresh_f(threshold);3434+}3535+3636+static inline u32 host1x_class_host_load_syncpt_base(3737+ unsigned indx, unsigned threshold)3838+{3939+ return host1x_uclass_load_syncpt_base_base_indx_f(indx)4040+ | host1x_uclass_load_syncpt_base_value_f(threshold);4141+}4242+4343+static inline u32 host1x_class_host_wait_syncpt_base(4444+ unsigned indx, unsigned base_indx, unsigned offset)4545+{4646+ return host1x_uclass_wait_syncpt_base_indx_f(indx)4747+ | host1x_uclass_wait_syncpt_base_base_indx_f(base_indx)4848+ | host1x_uclass_wait_syncpt_base_offset_f(offset);4949+}5050+5151+static inline u32 host1x_class_host_incr_syncpt_base(5252+ unsigned base_indx, unsigned offset)5353+{5454+ return host1x_uclass_incr_syncpt_base_base_indx_f(base_indx)5555+ | host1x_uclass_incr_syncpt_base_offset_f(offset);5656+}5757+5858+static inline u32 host1x_class_host_incr_syncpt(5959+ unsigned cond, unsigned indx)6060+{6161+ return host1x_uclass_incr_syncpt_cond_f(cond)6262+ | host1x_uclass_incr_syncpt_indx_f(indx);6363+}6464+6565+static inline u32 host1x_class_host_indoff_reg_write(6666+ unsigned mod_id, unsigned offset, bool auto_inc)6767+{6868+ u32 v = host1x_uclass_indoff_indbe_f(0xf)6969+ | host1x_uclass_indoff_indmodid_f(mod_id)7070+ | host1x_uclass_indoff_indroffset_f(offset);7171+ if (auto_inc)7272+ v |= host1x_uclass_indoff_autoinc_f(1);7373+ return v;7474+}7575+7676+static inline u32 host1x_class_host_indoff_reg_read(7777+ unsigned mod_id, unsigned offset, bool auto_inc)7878+{7979+ u32 v = host1x_uclass_indoff_indmodid_f(mod_id)8080+ | host1x_uclass_indoff_indroffset_f(offset)8181+ | host1x_uclass_indoff_rwn_read_v();8282+ if (auto_inc)8383+ v |= host1x_uclass_indoff_autoinc_f(1);8484+ return v;8585+}8686+8787+/* cdma opcodes */8888+static inline u32 host1x_opcode_setclass(8989+ unsigned class_id, unsigned offset, unsigned mask)9090+{9191+ return (0 << 28) | (offset << 16) | (class_id << 6) | mask;9292+}9393+9494+static inline u32 host1x_opcode_incr(unsigned offset, unsigned count)9595+{9696+ return (1 << 28) | (offset << 16) | count;9797+}9898+9999+static inline u32 host1x_opcode_nonincr(unsigned offset, unsigned count)100100+{101101+ return (2 << 28) | (offset << 16) | count;102102+}103103+104104+static inline u32 host1x_opcode_mask(unsigned offset, unsigned mask)105105+{106106+ return (3 << 28) | (offset << 16) | mask;107107+}108108+109109+static inline u32 host1x_opcode_imm(unsigned offset, unsigned value)110110+{111111+ return (4 << 28) | (offset << 16) | value;112112+}113113+114114+static inline u32 host1x_opcode_imm_incr_syncpt(unsigned cond, unsigned indx)115115+{116116+ return host1x_opcode_imm(host1x_uclass_incr_syncpt_r(),117117+ host1x_class_host_incr_syncpt(cond, indx));118118+}119119+120120+static inline u32 host1x_opcode_restart(unsigned address)121121+{122122+ return (5 << 28) | (address >> 4);123123+}124124+125125+static inline u32 host1x_opcode_gather(unsigned count)126126+{127127+ return (6 << 28) | count;128128+}129129+130130+static inline u32 host1x_opcode_gather_nonincr(unsigned offset, unsigned count)131131+{132132+ return (6 << 28) | (offset << 16) | BIT(15) | count;133133+}134134+135135+static inline u32 host1x_opcode_gather_incr(unsigned offset, unsigned count)136136+{137137+ return (6 << 28) | (offset << 16) | BIT(15) | BIT(14) | count;138138+}139139+140140+#define HOST1X_OPCODE_NOP host1x_opcode_nonincr(0, 0)141141+142142+#endif
+121
drivers/gpu/host1x/hw/hw_host1x05_channel.h
···11+/*22+ * Copyright (c) 2015 NVIDIA Corporation.33+ *44+ * This program is free software; you can redistribute it and/or modify it55+ * under the terms and conditions of the GNU General Public License,66+ * version 2, as published by the Free Software Foundation.77+ *88+ * This program is distributed in the hope it will be useful, but WITHOUT99+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1010+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1111+ * more details.1212+ *1313+ * You should have received a copy of the GNU General Public License1414+ * along with this program. If not, see <http://www.gnu.org/licenses/>.1515+ *1616+ */1717+1818+ /*1919+ * Function naming determines intended use:2020+ *2121+ * <x>_r(void) : Returns the offset for register <x>.2222+ *2323+ * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.2424+ *2525+ * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.2626+ *2727+ * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted2828+ * and masked to place it at field <y> of register <x>. This value2929+ * can be |'d with others to produce a full register value for3030+ * register <x>.3131+ *3232+ * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This3333+ * value can be ~'d and then &'d to clear the value of field <y> for3434+ * register <x>.3535+ *3636+ * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted3737+ * to place it at field <y> of register <x>. This value can be |'d3838+ * with others to produce a full register value for <x>.3939+ *4040+ * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register4141+ * <x> value 'r' after being shifted to place its LSB at bit 0.4242+ * This value is suitable for direct comparison with other unshifted4343+ * values appropriate for use in field <y> of register <x>.4444+ *4545+ * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for4646+ * field <y> of register <x>. This value is suitable for direct4747+ * comparison with unshifted values appropriate for use in field <y>4848+ * of register <x>.4949+ */5050+5151+#ifndef HOST1X_HW_HOST1X05_CHANNEL_H5252+#define HOST1X_HW_HOST1X05_CHANNEL_H5353+5454+static inline u32 host1x_channel_fifostat_r(void)5555+{5656+ return 0x0;5757+}5858+#define HOST1X_CHANNEL_FIFOSTAT \5959+ host1x_channel_fifostat_r()6060+static inline u32 host1x_channel_fifostat_cfempty_v(u32 r)6161+{6262+ return (r >> 11) & 0x1;6363+}6464+#define HOST1X_CHANNEL_FIFOSTAT_CFEMPTY_V(r) \6565+ host1x_channel_fifostat_cfempty_v(r)6666+static inline u32 host1x_channel_dmastart_r(void)6767+{6868+ return 0x14;6969+}7070+#define HOST1X_CHANNEL_DMASTART \7171+ host1x_channel_dmastart_r()7272+static inline u32 host1x_channel_dmaput_r(void)7373+{7474+ return 0x18;7575+}7676+#define HOST1X_CHANNEL_DMAPUT \7777+ host1x_channel_dmaput_r()7878+static inline u32 host1x_channel_dmaget_r(void)7979+{8080+ return 0x1c;8181+}8282+#define HOST1X_CHANNEL_DMAGET \8383+ host1x_channel_dmaget_r()8484+static inline u32 host1x_channel_dmaend_r(void)8585+{8686+ return 0x20;8787+}8888+#define HOST1X_CHANNEL_DMAEND \8989+ host1x_channel_dmaend_r()9090+static inline u32 host1x_channel_dmactrl_r(void)9191+{9292+ return 0x24;9393+}9494+#define HOST1X_CHANNEL_DMACTRL \9595+ host1x_channel_dmactrl_r()9696+static inline u32 host1x_channel_dmactrl_dmastop(void)9797+{9898+ return 1 << 0;9999+}100100+#define HOST1X_CHANNEL_DMACTRL_DMASTOP \101101+ host1x_channel_dmactrl_dmastop()102102+static inline u32 host1x_channel_dmactrl_dmastop_v(u32 r)103103+{104104+ return (r >> 0) & 0x1;105105+}106106+#define HOST1X_CHANNEL_DMACTRL_DMASTOP_V(r) \107107+ host1x_channel_dmactrl_dmastop_v(r)108108+static inline u32 host1x_channel_dmactrl_dmagetrst(void)109109+{110110+ return 1 << 1;111111+}112112+#define HOST1X_CHANNEL_DMACTRL_DMAGETRST \113113+ host1x_channel_dmactrl_dmagetrst()114114+static inline u32 host1x_channel_dmactrl_dmainitget(void)115115+{116116+ return 1 << 2;117117+}118118+#define HOST1X_CHANNEL_DMACTRL_DMAINITGET \119119+ host1x_channel_dmactrl_dmainitget()120120+121121+#endif
+243
drivers/gpu/host1x/hw/hw_host1x05_sync.h
···11+/*22+ * Copyright (c) 2015 NVIDIA Corporation.33+ *44+ * This program is free software; you can redistribute it and/or modify it55+ * under the terms and conditions of the GNU General Public License,66+ * version 2, as published by the Free Software Foundation.77+ *88+ * This program is distributed in the hope it will be useful, but WITHOUT99+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1010+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1111+ * more details.1212+ *1313+ * You should have received a copy of the GNU General Public License1414+ * along with this program. If not, see <http://www.gnu.org/licenses/>.1515+ *1616+ */1717+1818+ /*1919+ * Function naming determines intended use:2020+ *2121+ * <x>_r(void) : Returns the offset for register <x>.2222+ *2323+ * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.2424+ *2525+ * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.2626+ *2727+ * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted2828+ * and masked to place it at field <y> of register <x>. This value2929+ * can be |'d with others to produce a full register value for3030+ * register <x>.3131+ *3232+ * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This3333+ * value can be ~'d and then &'d to clear the value of field <y> for3434+ * register <x>.3535+ *3636+ * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted3737+ * to place it at field <y> of register <x>. This value can be |'d3838+ * with others to produce a full register value for <x>.3939+ *4040+ * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register4141+ * <x> value 'r' after being shifted to place its LSB at bit 0.4242+ * This value is suitable for direct comparison with other unshifted4343+ * values appropriate for use in field <y> of register <x>.4444+ *4545+ * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for4646+ * field <y> of register <x>. This value is suitable for direct4747+ * comparison with unshifted values appropriate for use in field <y>4848+ * of register <x>.4949+ */5050+5151+#ifndef HOST1X_HW_HOST1X05_SYNC_H5252+#define HOST1X_HW_HOST1X05_SYNC_H5353+5454+#define REGISTER_STRIDE 45555+5656+static inline u32 host1x_sync_syncpt_r(unsigned int id)5757+{5858+ return 0xf80 + id * REGISTER_STRIDE;5959+}6060+#define HOST1X_SYNC_SYNCPT(id) \6161+ host1x_sync_syncpt_r(id)6262+static inline u32 host1x_sync_syncpt_thresh_cpu0_int_status_r(unsigned int id)6363+{6464+ return 0xe80 + id * REGISTER_STRIDE;6565+}6666+#define HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(id) \6767+ host1x_sync_syncpt_thresh_cpu0_int_status_r(id)6868+static inline u32 host1x_sync_syncpt_thresh_int_disable_r(unsigned int id)6969+{7070+ return 0xf00 + id * REGISTER_STRIDE;7171+}7272+#define HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(id) \7373+ host1x_sync_syncpt_thresh_int_disable_r(id)7474+static inline u32 host1x_sync_syncpt_thresh_int_enable_cpu0_r(unsigned int id)7575+{7676+ return 0xf20 + id * REGISTER_STRIDE;7777+}7878+#define HOST1X_SYNC_SYNCPT_THRESH_INT_ENABLE_CPU0(id) \7979+ host1x_sync_syncpt_thresh_int_enable_cpu0_r(id)8080+static inline u32 host1x_sync_cf_setup_r(unsigned int channel)8181+{8282+ return 0xc00 + channel * REGISTER_STRIDE;8383+}8484+#define HOST1X_SYNC_CF_SETUP(channel) \8585+ host1x_sync_cf_setup_r(channel)8686+static inline u32 host1x_sync_cf_setup_base_v(u32 r)8787+{8888+ return (r >> 0) & 0x3ff;8989+}9090+#define HOST1X_SYNC_CF_SETUP_BASE_V(r) \9191+ host1x_sync_cf_setup_base_v(r)9292+static inline u32 host1x_sync_cf_setup_limit_v(u32 r)9393+{9494+ return (r >> 16) & 0x3ff;9595+}9696+#define HOST1X_SYNC_CF_SETUP_LIMIT_V(r) \9797+ host1x_sync_cf_setup_limit_v(r)9898+static inline u32 host1x_sync_cmdproc_stop_r(void)9999+{100100+ return 0xac;101101+}102102+#define HOST1X_SYNC_CMDPROC_STOP \103103+ host1x_sync_cmdproc_stop_r()104104+static inline u32 host1x_sync_ch_teardown_r(void)105105+{106106+ return 0xb0;107107+}108108+#define HOST1X_SYNC_CH_TEARDOWN \109109+ host1x_sync_ch_teardown_r()110110+static inline u32 host1x_sync_usec_clk_r(void)111111+{112112+ return 0x1a4;113113+}114114+#define HOST1X_SYNC_USEC_CLK \115115+ host1x_sync_usec_clk_r()116116+static inline u32 host1x_sync_ctxsw_timeout_cfg_r(void)117117+{118118+ return 0x1a8;119119+}120120+#define HOST1X_SYNC_CTXSW_TIMEOUT_CFG \121121+ host1x_sync_ctxsw_timeout_cfg_r()122122+static inline u32 host1x_sync_ip_busy_timeout_r(void)123123+{124124+ return 0x1bc;125125+}126126+#define HOST1X_SYNC_IP_BUSY_TIMEOUT \127127+ host1x_sync_ip_busy_timeout_r()128128+static inline u32 host1x_sync_mlock_owner_r(unsigned int id)129129+{130130+ return 0x340 + id * REGISTER_STRIDE;131131+}132132+#define HOST1X_SYNC_MLOCK_OWNER(id) \133133+ host1x_sync_mlock_owner_r(id)134134+static inline u32 host1x_sync_mlock_owner_chid_v(u32 r)135135+{136136+ return (r >> 8) & 0xf;137137+}138138+#define HOST1X_SYNC_MLOCK_OWNER_CHID_V(v) \139139+ host1x_sync_mlock_owner_chid_v(v)140140+static inline u32 host1x_sync_mlock_owner_cpu_owns_v(u32 r)141141+{142142+ return (r >> 1) & 0x1;143143+}144144+#define HOST1X_SYNC_MLOCK_OWNER_CPU_OWNS_V(r) \145145+ host1x_sync_mlock_owner_cpu_owns_v(r)146146+static inline u32 host1x_sync_mlock_owner_ch_owns_v(u32 r)147147+{148148+ return (r >> 0) & 0x1;149149+}150150+#define HOST1X_SYNC_MLOCK_OWNER_CH_OWNS_V(r) \151151+ host1x_sync_mlock_owner_ch_owns_v(r)152152+static inline u32 host1x_sync_syncpt_int_thresh_r(unsigned int id)153153+{154154+ return 0x1380 + id * REGISTER_STRIDE;155155+}156156+#define HOST1X_SYNC_SYNCPT_INT_THRESH(id) \157157+ host1x_sync_syncpt_int_thresh_r(id)158158+static inline u32 host1x_sync_syncpt_base_r(unsigned int id)159159+{160160+ return 0x600 + id * REGISTER_STRIDE;161161+}162162+#define HOST1X_SYNC_SYNCPT_BASE(id) \163163+ host1x_sync_syncpt_base_r(id)164164+static inline u32 host1x_sync_syncpt_cpu_incr_r(unsigned int id)165165+{166166+ return 0xf60 + id * REGISTER_STRIDE;167167+}168168+#define HOST1X_SYNC_SYNCPT_CPU_INCR(id) \169169+ host1x_sync_syncpt_cpu_incr_r(id)170170+static inline u32 host1x_sync_cbread_r(unsigned int channel)171171+{172172+ return 0xc80 + channel * REGISTER_STRIDE;173173+}174174+#define HOST1X_SYNC_CBREAD(channel) \175175+ host1x_sync_cbread_r(channel)176176+static inline u32 host1x_sync_cfpeek_ctrl_r(void)177177+{178178+ return 0x74c;179179+}180180+#define HOST1X_SYNC_CFPEEK_CTRL \181181+ host1x_sync_cfpeek_ctrl_r()182182+static inline u32 host1x_sync_cfpeek_ctrl_addr_f(u32 v)183183+{184184+ return (v & 0x3ff) << 0;185185+}186186+#define HOST1X_SYNC_CFPEEK_CTRL_ADDR_F(v) \187187+ host1x_sync_cfpeek_ctrl_addr_f(v)188188+static inline u32 host1x_sync_cfpeek_ctrl_channr_f(u32 v)189189+{190190+ return (v & 0xf) << 16;191191+}192192+#define HOST1X_SYNC_CFPEEK_CTRL_CHANNR_F(v) \193193+ host1x_sync_cfpeek_ctrl_channr_f(v)194194+static inline u32 host1x_sync_cfpeek_ctrl_ena_f(u32 v)195195+{196196+ return (v & 0x1) << 31;197197+}198198+#define HOST1X_SYNC_CFPEEK_CTRL_ENA_F(v) \199199+ host1x_sync_cfpeek_ctrl_ena_f(v)200200+static inline u32 host1x_sync_cfpeek_read_r(void)201201+{202202+ return 0x750;203203+}204204+#define HOST1X_SYNC_CFPEEK_READ \205205+ host1x_sync_cfpeek_read_r()206206+static inline u32 host1x_sync_cfpeek_ptrs_r(void)207207+{208208+ return 0x754;209209+}210210+#define HOST1X_SYNC_CFPEEK_PTRS \211211+ host1x_sync_cfpeek_ptrs_r()212212+static inline u32 host1x_sync_cfpeek_ptrs_cf_rd_ptr_v(u32 r)213213+{214214+ return (r >> 0) & 0x3ff;215215+}216216+#define HOST1X_SYNC_CFPEEK_PTRS_CF_RD_PTR_V(r) \217217+ host1x_sync_cfpeek_ptrs_cf_rd_ptr_v(r)218218+static inline u32 host1x_sync_cfpeek_ptrs_cf_wr_ptr_v(u32 r)219219+{220220+ return (r >> 16) & 0x3ff;221221+}222222+#define HOST1X_SYNC_CFPEEK_PTRS_CF_WR_PTR_V(r) \223223+ host1x_sync_cfpeek_ptrs_cf_wr_ptr_v(r)224224+static inline u32 host1x_sync_cbstat_r(unsigned int channel)225225+{226226+ return 0xcc0 + channel * REGISTER_STRIDE;227227+}228228+#define HOST1X_SYNC_CBSTAT(channel) \229229+ host1x_sync_cbstat_r(channel)230230+static inline u32 host1x_sync_cbstat_cboffset_v(u32 r)231231+{232232+ return (r >> 0) & 0xffff;233233+}234234+#define HOST1X_SYNC_CBSTAT_CBOFFSET_V(r) \235235+ host1x_sync_cbstat_cboffset_v(r)236236+static inline u32 host1x_sync_cbstat_cbclass_v(u32 r)237237+{238238+ return (r >> 16) & 0x3ff;239239+}240240+#define HOST1X_SYNC_CBSTAT_CBCLASS_V(r) \241241+ host1x_sync_cbstat_cbclass_v(r)242242+243243+#endif
+181
drivers/gpu/host1x/hw/hw_host1x05_uclass.h
···11+/*22+ * Copyright (c) 2015 NVIDIA Corporation.33+ *44+ * This program is free software; you can redistribute it and/or modify it55+ * under the terms and conditions of the GNU General Public License,66+ * version 2, as published by the Free Software Foundation.77+ *88+ * This program is distributed in the hope it will be useful, but WITHOUT99+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1010+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1111+ * more details.1212+ *1313+ * You should have received a copy of the GNU General Public License1414+ * along with this program. If not, see <http://www.gnu.org/licenses/>.1515+ *1616+ */1717+1818+ /*1919+ * Function naming determines intended use:2020+ *2121+ * <x>_r(void) : Returns the offset for register <x>.2222+ *2323+ * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.2424+ *2525+ * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.2626+ *2727+ * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted2828+ * and masked to place it at field <y> of register <x>. This value2929+ * can be |'d with others to produce a full register value for3030+ * register <x>.3131+ *3232+ * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This3333+ * value can be ~'d and then &'d to clear the value of field <y> for3434+ * register <x>.3535+ *3636+ * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted3737+ * to place it at field <y> of register <x>. This value can be |'d3838+ * with others to produce a full register value for <x>.3939+ *4040+ * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register4141+ * <x> value 'r' after being shifted to place its LSB at bit 0.4242+ * This value is suitable for direct comparison with other unshifted4343+ * values appropriate for use in field <y> of register <x>.4444+ *4545+ * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for4646+ * field <y> of register <x>. This value is suitable for direct4747+ * comparison with unshifted values appropriate for use in field <y>4848+ * of register <x>.4949+ */5050+5151+#ifndef HOST1X_HW_HOST1X05_UCLASS_H5252+#define HOST1X_HW_HOST1X05_UCLASS_H5353+5454+static inline u32 host1x_uclass_incr_syncpt_r(void)5555+{5656+ return 0x0;5757+}5858+#define HOST1X_UCLASS_INCR_SYNCPT \5959+ host1x_uclass_incr_syncpt_r()6060+static inline u32 host1x_uclass_incr_syncpt_cond_f(u32 v)6161+{6262+ return (v & 0xff) << 8;6363+}6464+#define HOST1X_UCLASS_INCR_SYNCPT_COND_F(v) \6565+ host1x_uclass_incr_syncpt_cond_f(v)6666+static inline u32 host1x_uclass_incr_syncpt_indx_f(u32 v)6767+{6868+ return (v & 0xff) << 0;6969+}7070+#define HOST1X_UCLASS_INCR_SYNCPT_INDX_F(v) \7171+ host1x_uclass_incr_syncpt_indx_f(v)7272+static inline u32 host1x_uclass_wait_syncpt_r(void)7373+{7474+ return 0x8;7575+}7676+#define HOST1X_UCLASS_WAIT_SYNCPT \7777+ host1x_uclass_wait_syncpt_r()7878+static inline u32 host1x_uclass_wait_syncpt_indx_f(u32 v)7979+{8080+ return (v & 0xff) << 24;8181+}8282+#define HOST1X_UCLASS_WAIT_SYNCPT_INDX_F(v) \8383+ host1x_uclass_wait_syncpt_indx_f(v)8484+static inline u32 host1x_uclass_wait_syncpt_thresh_f(u32 v)8585+{8686+ return (v & 0xffffff) << 0;8787+}8888+#define HOST1X_UCLASS_WAIT_SYNCPT_THRESH_F(v) \8989+ host1x_uclass_wait_syncpt_thresh_f(v)9090+static inline u32 host1x_uclass_wait_syncpt_base_r(void)9191+{9292+ return 0x9;9393+}9494+#define HOST1X_UCLASS_WAIT_SYNCPT_BASE \9595+ host1x_uclass_wait_syncpt_base_r()9696+static inline u32 host1x_uclass_wait_syncpt_base_indx_f(u32 v)9797+{9898+ return (v & 0xff) << 24;9999+}100100+#define HOST1X_UCLASS_WAIT_SYNCPT_BASE_INDX_F(v) \101101+ host1x_uclass_wait_syncpt_base_indx_f(v)102102+static inline u32 host1x_uclass_wait_syncpt_base_base_indx_f(u32 v)103103+{104104+ return (v & 0xff) << 16;105105+}106106+#define HOST1X_UCLASS_WAIT_SYNCPT_BASE_BASE_INDX_F(v) \107107+ host1x_uclass_wait_syncpt_base_base_indx_f(v)108108+static inline u32 host1x_uclass_wait_syncpt_base_offset_f(u32 v)109109+{110110+ return (v & 0xffff) << 0;111111+}112112+#define HOST1X_UCLASS_WAIT_SYNCPT_BASE_OFFSET_F(v) \113113+ host1x_uclass_wait_syncpt_base_offset_f(v)114114+static inline u32 host1x_uclass_load_syncpt_base_r(void)115115+{116116+ return 0xb;117117+}118118+#define HOST1X_UCLASS_LOAD_SYNCPT_BASE \119119+ host1x_uclass_load_syncpt_base_r()120120+static inline u32 host1x_uclass_load_syncpt_base_base_indx_f(u32 v)121121+{122122+ return (v & 0xff) << 24;123123+}124124+#define HOST1X_UCLASS_LOAD_SYNCPT_BASE_BASE_INDX_F(v) \125125+ host1x_uclass_load_syncpt_base_base_indx_f(v)126126+static inline u32 host1x_uclass_load_syncpt_base_value_f(u32 v)127127+{128128+ return (v & 0xffffff) << 0;129129+}130130+#define HOST1X_UCLASS_LOAD_SYNCPT_BASE_VALUE_F(v) \131131+ host1x_uclass_load_syncpt_base_value_f(v)132132+static inline u32 host1x_uclass_incr_syncpt_base_base_indx_f(u32 v)133133+{134134+ return (v & 0xff) << 24;135135+}136136+#define HOST1X_UCLASS_INCR_SYNCPT_BASE_BASE_INDX_F(v) \137137+ host1x_uclass_incr_syncpt_base_base_indx_f(v)138138+static inline u32 host1x_uclass_incr_syncpt_base_offset_f(u32 v)139139+{140140+ return (v & 0xffffff) << 0;141141+}142142+#define HOST1X_UCLASS_INCR_SYNCPT_BASE_OFFSET_F(v) \143143+ host1x_uclass_incr_syncpt_base_offset_f(v)144144+static inline u32 host1x_uclass_indoff_r(void)145145+{146146+ return 0x2d;147147+}148148+#define HOST1X_UCLASS_INDOFF \149149+ host1x_uclass_indoff_r()150150+static inline u32 host1x_uclass_indoff_indbe_f(u32 v)151151+{152152+ return (v & 0xf) << 28;153153+}154154+#define HOST1X_UCLASS_INDOFF_INDBE_F(v) \155155+ host1x_uclass_indoff_indbe_f(v)156156+static inline u32 host1x_uclass_indoff_autoinc_f(u32 v)157157+{158158+ return (v & 0x1) << 27;159159+}160160+#define HOST1X_UCLASS_INDOFF_AUTOINC_F(v) \161161+ host1x_uclass_indoff_autoinc_f(v)162162+static inline u32 host1x_uclass_indoff_indmodid_f(u32 v)163163+{164164+ return (v & 0xff) << 18;165165+}166166+#define HOST1X_UCLASS_INDOFF_INDMODID_F(v) \167167+ host1x_uclass_indoff_indmodid_f(v)168168+static inline u32 host1x_uclass_indoff_indroffset_f(u32 v)169169+{170170+ return (v & 0xffff) << 2;171171+}172172+#define HOST1X_UCLASS_INDOFF_INDROFFSET_F(v) \173173+ host1x_uclass_indoff_indroffset_f(v)174174+static inline u32 host1x_uclass_indoff_rwn_read_v(void)175175+{176176+ return 1;177177+}178178+#define HOST1X_UCLASS_INDOFF_INDROFFSET_F(v) \179179+ host1x_uclass_indoff_indroffset_f(v)180180+181181+#endif