• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/staging/crystalhd/

Lines Matching refs:adp

34 static inline uint32_t crystalhd_dram_rd(struct crystalhd_adp *adp, uint32_t mem_off)
36 crystalhd_reg_wr(adp, DCI_DRAM_BASE_ADDR, (mem_off >> 19));
37 return bc_dec_reg_rd(adp, (0x00380000 | (mem_off & 0x0007FFFF)));
40 static inline void crystalhd_dram_wr(struct crystalhd_adp *adp, uint32_t mem_off, uint32_t val)
42 crystalhd_reg_wr(adp, DCI_DRAM_BASE_ADDR, (mem_off >> 19));
43 bc_dec_reg_wr(adp, (0x00380000 | (mem_off & 0x0007FFFF)), val);
46 static inline enum BC_STATUS bc_chk_dram_range(struct crystalhd_adp *adp, uint32_t start_off, uint32_t cnt)
51 static struct crystalhd_dio_req *crystalhd_alloc_dio(struct crystalhd_adp *adp)
56 if (!adp) {
61 spin_lock_irqsave(&adp->lock, flags);
62 temp = adp->ua_map_free_head;
64 adp->ua_map_free_head = adp->ua_map_free_head->next;
65 spin_unlock_irqrestore(&adp->lock, flags);
70 static void crystalhd_free_dio(struct crystalhd_adp *adp, struct crystalhd_dio_req *dio)
74 if (!adp || !dio)
76 spin_lock_irqsave(&adp->lock, flags);
81 dio->next = adp->ua_map_free_head;
82 adp->ua_map_free_head = dio;
83 spin_unlock_irqrestore(&adp->lock, flags);
86 static struct crystalhd_elem *crystalhd_alloc_elem(struct crystalhd_adp *adp)
91 if (!adp)
93 spin_lock_irqsave(&adp->lock, flags);
94 temp = adp->elem_pool_head;
96 adp->elem_pool_head = adp->elem_pool_head->flink;
99 spin_unlock_irqrestore(&adp->lock, flags);
103 static void crystalhd_free_elem(struct crystalhd_adp *adp, struct crystalhd_elem *elem)
107 if (!adp || !elem)
109 spin_lock_irqsave(&adp->lock, flags);
110 elem->flink = adp->elem_pool_head;
111 adp->elem_pool_head = elem;
112 spin_unlock_irqrestore(&adp->lock, flags);
133 * @adp: Adapter instance
143 uint32_t bc_dec_reg_rd(struct crystalhd_adp *adp, uint32_t reg_off)
145 if (!adp || (reg_off > adp->pci_mem_len)) {
150 return readl(adp->addr + reg_off);
155 * @adp: Adapter instance
166 void bc_dec_reg_wr(struct crystalhd_adp *adp, uint32_t reg_off, uint32_t val)
168 if (!adp || (reg_off > adp->pci_mem_len)) {
172 writel(val, adp->addr + reg_off);
178 * @adp: Adapter instance
189 uint32_t crystalhd_reg_rd(struct crystalhd_adp *adp, uint32_t reg_off)
191 if (!adp || (reg_off > adp->pci_i2o_len)) {
195 return readl(adp->i2o_addr + reg_off);
200 * @adp: Adapter instance
212 void crystalhd_reg_wr(struct crystalhd_adp *adp, uint32_t reg_off, uint32_t val)
214 if (!adp || (reg_off > adp->pci_i2o_len)) {
218 writel(val, adp->i2o_addr + reg_off);
223 * @adp: Adapter instance
233 enum BC_STATUS crystalhd_mem_rd(struct crystalhd_adp *adp, uint32_t start_off,
238 if (!adp || !rd_buff ||
239 (bc_chk_dram_range(adp, start_off, dw_cnt) != BC_STS_SUCCESS)) {
244 rd_buff[ix] = crystalhd_dram_rd(adp, (start_off + (ix * 4)));
251 * @adp: Adapter instance
261 enum BC_STATUS crystalhd_mem_wr(struct crystalhd_adp *adp, uint32_t start_off,
266 if (!adp || !wr_buff ||
267 (bc_chk_dram_range(adp, start_off, dw_cnt) != BC_STS_SUCCESS)) {
273 crystalhd_dram_wr(adp, (start_off + (ix * 4)), wr_buff[ix]);
279 * @adp: Adapter instance
289 enum BC_STATUS crystalhd_pci_cfg_rd(struct crystalhd_adp *adp, uint32_t off,
295 if (!adp || !val) {
302 rc = pci_read_config_byte(adp->pdev, off, (u8 *)val);
305 rc = pci_read_config_word(adp->pdev, off, (u16 *)val);
308 rc = pci_read_config_dword(adp->pdev, off, (u32 *)val);
324 * @adp: Adapter instance
334 enum BC_STATUS crystalhd_pci_cfg_wr(struct crystalhd_adp *adp, uint32_t off,
340 if (!adp || !val) {
347 rc = pci_write_config_byte(adp->pdev, off, (u8)val);
350 rc = pci_write_config_word(adp->pdev, off, (u16)val);
353 rc = pci_write_config_dword(adp->pdev, off, val);
369 * @adp: Adapter instance
380 void *bc_kern_dma_alloc(struct crystalhd_adp *adp, uint32_t sz,
385 if (!adp || !sz || !phy_addr) {
390 temp = pci_alloc_consistent(adp->pdev, sz, phy_addr);
399 * @adp: Adapter instance
408 void bc_kern_dma_free(struct crystalhd_adp *adp, uint32_t sz, void *ka,
411 if (!adp || !ka || !sz || !phy_addr) {
416 pci_free_consistent(adp->pdev, sz, ka, phy_addr);
421 * @adp: Adapter instance
432 enum BC_STATUS crystalhd_create_dioq(struct crystalhd_adp *adp,
438 if (!adp || !dioq_hnd) {
452 dioq->adp = adp;
462 * @adp: Adapter instance
473 void crystalhd_delete_dioq(struct crystalhd_adp *adp, struct crystalhd_dioq *dioq)
512 tmp = crystalhd_alloc_elem(ioq->adp);
566 crystalhd_free_elem(ioq->adp, ret);
609 crystalhd_free_elem(ioq->adp, ret);
662 * @adp: Adapter instance
676 enum BC_STATUS crystalhd_map_dio(struct crystalhd_adp *adp, void *ubuff,
686 if (!adp || !ubuff || !ubuff_sz || !dio_hnd) {
702 dio = crystalhd_alloc_dio(adp);
719 crystalhd_unmap_dio(adp, dio);
738 crystalhd_unmap_dio(adp, dio);
753 crystalhd_unmap_dio(adp, dio);
790 dio->sg_cnt = pci_map_sg(adp->pdev, dio->sg,
794 crystalhd_unmap_dio(adp, dio);
814 * @adp: Adapter instance
822 enum BC_STATUS crystalhd_unmap_dio(struct crystalhd_adp *adp, struct crystalhd_dio_req *dio)
827 if (!adp || !dio) {
844 pci_unmap_sg(adp->pdev, dio->sg, dio->page_cnt, dio->direction);
846 crystalhd_free_dio(adp, dio);
853 * @adp: Adapter instance
862 int crystalhd_create_dio_pool(struct crystalhd_adp *adp, uint32_t max_pages)
868 if (!adp || !max_pages) {
874 adp->fill_byte_pool = pci_pool_create("crystalhd_fbyte",
875 adp->pdev, 8, 8, 0);
876 if (!adp->fill_byte_pool) {
886 BC_LINK_SG_POOL_SZ, max_pages, asz, adp->fill_byte_pool);
901 dio->fb_va = pci_pool_alloc(adp->fill_byte_pool, GFP_KERNEL,
908 crystalhd_free_dio(adp, dio);
916 * @adp: Adapter instance
923 void crystalhd_destroy_dio_pool(struct crystalhd_adp *adp)
928 if (!adp) {
934 dio = crystalhd_alloc_dio(adp);
937 pci_pool_free(adp->fill_byte_pool,
944 if (adp->fill_byte_pool) {
945 pci_pool_destroy(adp->fill_byte_pool);
946 adp->fill_byte_pool = NULL;
954 * @adp: Adapter instance
963 int __devinit crystalhd_create_elem_pool(struct crystalhd_adp *adp,
969 if (!adp || !pool_size)
978 crystalhd_free_elem(adp, temp);
986 * @adp: Adapter instance
993 void crystalhd_delete_elem_pool(struct crystalhd_adp *adp)
998 if (!adp)
1002 temp = crystalhd_alloc_elem(adp);