Lines Matching +full:data +full:- +full:shift

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * DVB CAM support for NetUP Universal Dual DVB-CI
43 /* BIT_CAM_BYPASS bit shift for SLOT 1 */
48 writew(0x101, ndev->bmmio0 + CAM_CTRLSTAT_CLR); in netup_ci_interrupt()
55 struct netup_ci_state *state = en50221->data; in netup_unidvb_ci_slot_ts_ctl()
56 struct netup_unidvb_dev *dev = state->dev; in netup_unidvb_ci_slot_ts_ctl()
57 u16 shift = (state->nr == 1) ? CAM1_SHIFT : 0; in netup_unidvb_ci_slot_ts_ctl() local
59 dev_dbg(&dev->pci_dev->dev, "%s(): CAM_CTRLSTAT=0x%x\n", in netup_unidvb_ci_slot_ts_ctl()
60 __func__, readw(dev->bmmio0 + CAM_CTRLSTAT_READ_SET)); in netup_unidvb_ci_slot_ts_ctl()
62 return -EINVAL; in netup_unidvb_ci_slot_ts_ctl()
63 /* pass data to CAM module */ in netup_unidvb_ci_slot_ts_ctl()
64 writew(BIT_CAM_BYPASS << shift, dev->bmmio0 + CAM_CTRLSTAT_CLR); in netup_unidvb_ci_slot_ts_ctl()
65 dev_dbg(&dev->pci_dev->dev, "%s(): CAM_CTRLSTAT=0x%x done\n", in netup_unidvb_ci_slot_ts_ctl()
66 __func__, readw(dev->bmmio0 + CAM_CTRLSTAT_READ_SET)); in netup_unidvb_ci_slot_ts_ctl()
73 struct netup_ci_state *state = en50221->data; in netup_unidvb_ci_slot_shutdown()
74 struct netup_unidvb_dev *dev = state->dev; in netup_unidvb_ci_slot_shutdown()
76 dev_dbg(&dev->pci_dev->dev, "%s()\n", __func__); in netup_unidvb_ci_slot_shutdown()
83 struct netup_ci_state *state = en50221->data; in netup_unidvb_ci_slot_reset()
84 struct netup_unidvb_dev *dev = state->dev; in netup_unidvb_ci_slot_reset()
86 u16 shift = (state->nr == 1) ? CAM1_SHIFT : 0; in netup_unidvb_ci_slot_reset() local
90 dev_dbg(&dev->pci_dev->dev, "%s(): CAM_CTRLSTAT_READ_SET=0x%x\n", in netup_unidvb_ci_slot_reset()
91 __func__, readw(dev->bmmio0 + CAM_CTRLSTAT_READ_SET)); in netup_unidvb_ci_slot_reset()
95 writew(BIT_CAM_RESET << shift, dev->bmmio0 + CAM_CTRLSTAT_READ_SET); in netup_unidvb_ci_slot_reset()
96 dev_dbg(&dev->pci_dev->dev, "%s(): waiting for reset\n", __func__); in netup_unidvb_ci_slot_reset()
99 ci_stat = readw(dev->bmmio0 + CAM_CTRLSTAT_READ_SET); in netup_unidvb_ci_slot_reset()
100 if (ci_stat & (BIT_CAM_READY << shift)) in netup_unidvb_ci_slot_reset()
104 if (!(ci_stat & (BIT_CAM_READY << shift)) && reset_counter > 0) { in netup_unidvb_ci_slot_reset()
105 dev_dbg(&dev->pci_dev->dev, in netup_unidvb_ci_slot_reset()
108 reset_counter--; in netup_unidvb_ci_slot_reset()
117 struct netup_ci_state *state = en50221->data; in netup_unidvb_poll_ci_slot_status()
118 struct netup_unidvb_dev *dev = state->dev; in netup_unidvb_poll_ci_slot_status()
119 u16 shift = (state->nr == 1) ? CAM1_SHIFT : 0; in netup_unidvb_poll_ci_slot_status() local
122 dev_dbg(&dev->pci_dev->dev, "%s(): CAM_CTRLSTAT_READ_SET=0x%x\n", in netup_unidvb_poll_ci_slot_status()
123 __func__, readw(dev->bmmio0 + CAM_CTRLSTAT_READ_SET)); in netup_unidvb_poll_ci_slot_status()
124 ci_stat = readw(dev->bmmio0 + CAM_CTRLSTAT_READ_SET); in netup_unidvb_poll_ci_slot_status()
125 if (ci_stat & (BIT_CAM_READY << shift)) { in netup_unidvb_poll_ci_slot_status()
126 state->status = DVB_CA_EN50221_POLL_CAM_PRESENT | in netup_unidvb_poll_ci_slot_status()
128 } else if (ci_stat & (BIT_CAM_PRESENT << shift)) { in netup_unidvb_poll_ci_slot_status()
129 state->status = DVB_CA_EN50221_POLL_CAM_PRESENT; in netup_unidvb_poll_ci_slot_status()
131 state->status = 0; in netup_unidvb_poll_ci_slot_status()
133 return state->status; in netup_unidvb_poll_ci_slot_status()
139 struct netup_ci_state *state = en50221->data; in netup_unidvb_ci_read_attribute_mem()
140 struct netup_unidvb_dev *dev = state->dev; in netup_unidvb_ci_read_attribute_mem()
141 u8 val = *((u8 __force *)state->membase8_config + addr); in netup_unidvb_ci_read_attribute_mem()
143 dev_dbg(&dev->pci_dev->dev, in netup_unidvb_ci_read_attribute_mem()
149 int slot, int addr, u8 data) in netup_unidvb_ci_write_attribute_mem() argument
151 struct netup_ci_state *state = en50221->data; in netup_unidvb_ci_write_attribute_mem()
152 struct netup_unidvb_dev *dev = state->dev; in netup_unidvb_ci_write_attribute_mem()
154 dev_dbg(&dev->pci_dev->dev, in netup_unidvb_ci_write_attribute_mem()
155 "%s(): addr=0x%x data=0x%x\n", __func__, addr, data); in netup_unidvb_ci_write_attribute_mem()
156 *((u8 __force *)state->membase8_config + addr) = data; in netup_unidvb_ci_write_attribute_mem()
163 struct netup_ci_state *state = en50221->data; in netup_unidvb_ci_read_cam_ctl()
164 struct netup_unidvb_dev *dev = state->dev; in netup_unidvb_ci_read_cam_ctl()
165 u8 val = *((u8 __force *)state->membase8_io + addr); in netup_unidvb_ci_read_cam_ctl()
167 dev_dbg(&dev->pci_dev->dev, in netup_unidvb_ci_read_cam_ctl()
173 int slot, u8 addr, u8 data) in netup_unidvb_ci_write_cam_ctl() argument
175 struct netup_ci_state *state = en50221->data; in netup_unidvb_ci_write_cam_ctl()
176 struct netup_unidvb_dev *dev = state->dev; in netup_unidvb_ci_write_cam_ctl()
178 dev_dbg(&dev->pci_dev->dev, in netup_unidvb_ci_write_cam_ctl()
179 "%s(): addr=0x%x data=0x%x\n", __func__, addr, data); in netup_unidvb_ci_write_cam_ctl()
180 *((u8 __force *)state->membase8_io + addr) = data; in netup_unidvb_ci_write_cam_ctl()
191 dev_err(&pci_dev->dev, "%s(): invalid CI adapter %d\n", in netup_unidvb_ci_register()
193 return -EINVAL; in netup_unidvb_ci_register()
195 state = &dev->ci[num]; in netup_unidvb_ci_register()
196 state->nr = num; in netup_unidvb_ci_register()
197 state->membase8_config = dev->bmmio1 + in netup_unidvb_ci_register()
199 state->membase8_io = dev->bmmio1 + in netup_unidvb_ci_register()
201 state->dev = dev; in netup_unidvb_ci_register()
202 state->ca.owner = THIS_MODULE; in netup_unidvb_ci_register()
203 state->ca.read_attribute_mem = netup_unidvb_ci_read_attribute_mem; in netup_unidvb_ci_register()
204 state->ca.write_attribute_mem = netup_unidvb_ci_write_attribute_mem; in netup_unidvb_ci_register()
205 state->ca.read_cam_control = netup_unidvb_ci_read_cam_ctl; in netup_unidvb_ci_register()
206 state->ca.write_cam_control = netup_unidvb_ci_write_cam_ctl; in netup_unidvb_ci_register()
207 state->ca.slot_reset = netup_unidvb_ci_slot_reset; in netup_unidvb_ci_register()
208 state->ca.slot_shutdown = netup_unidvb_ci_slot_shutdown; in netup_unidvb_ci_register()
209 state->ca.slot_ts_enable = netup_unidvb_ci_slot_ts_ctl; in netup_unidvb_ci_register()
210 state->ca.poll_slot_status = netup_unidvb_poll_ci_slot_status; in netup_unidvb_ci_register()
211 state->ca.data = state; in netup_unidvb_ci_register()
212 result = dvb_ca_en50221_init(&dev->frontends[num].adapter, in netup_unidvb_ci_register()
213 &state->ca, 0, 1); in netup_unidvb_ci_register()
215 dev_err(&pci_dev->dev, in netup_unidvb_ci_register()
220 writew(NETUP_UNIDVB_IRQ_CI, dev->bmmio0 + REG_IMASK_SET); in netup_unidvb_ci_register()
221 dev_info(&pci_dev->dev, in netup_unidvb_ci_register()
230 dev_dbg(&dev->pci_dev->dev, "%s()\n", __func__); in netup_unidvb_ci_unregister()
232 dev_err(&dev->pci_dev->dev, "%s(): invalid CI adapter %d\n", in netup_unidvb_ci_unregister()
236 state = &dev->ci[num]; in netup_unidvb_ci_unregister()
237 dvb_ca_en50221_release(&state->ca); in netup_unidvb_ci_unregister()