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

Lines Matching refs:ppc

104 static int ppc6_select(Interface *ppc);
105 static void ppc6_deselect(Interface *ppc);
106 static void ppc6_send_cmd(Interface *ppc, u8 cmd);
107 static void ppc6_wr_data_byte(Interface *ppc, u8 data);
108 static u8 ppc6_rd_data_byte(Interface *ppc);
109 static u8 ppc6_rd_port(Interface *ppc, u8 port);
110 static void ppc6_wr_port(Interface *ppc, u8 port, u8 data);
111 static void ppc6_rd_data_blk(Interface *ppc, u8 *data, long count);
112 static void ppc6_wait_for_fifo(Interface *ppc);
113 static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count);
114 static void ppc6_rd_port16_blk(Interface *ppc, u8 port, u8 *data, long length);
115 static void ppc6_wr_port16_blk(Interface *ppc, u8 port, u8 *data, long length);
116 static void ppc6_wr_extout(Interface *ppc, u8 regdata);
117 static int ppc6_open(Interface *ppc);
118 static void ppc6_close(Interface *ppc);
122 static int ppc6_select(Interface *ppc)
126 i = inb(ppc->lpt_addr + 1);
129 outb(i, ppc->lpt_addr + 1);
131 ppc->org_data = inb(ppc->lpt_addr);
133 ppc->org_ctrl = inb(ppc->lpt_addr + 2) & 0x5F; // readback ctrl
135 ppc->cur_ctrl = ppc->org_ctrl;
137 ppc->cur_ctrl |= port_sel;
139 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
141 if (ppc->org_data == 'b')
142 outb('x', ppc->lpt_addr);
144 outb('b', ppc->lpt_addr);
145 outb('p', ppc->lpt_addr);
146 outb(ppc->ppc_id, ppc->lpt_addr);
147 outb(~ppc->ppc_id,ppc->lpt_addr);
149 ppc->cur_ctrl &= ~port_sel;
151 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
153 ppc->cur_ctrl = (ppc->cur_ctrl & port_int) | port_init;
155 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
157 i = ppc->mode & 0x0C;
160 i = (ppc->mode & 2) | 1;
162 outb(i, ppc->lpt_addr);
164 ppc->cur_ctrl |= port_sel;
166 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
170 ppc->cur_ctrl |= port_afd;
172 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
176 k = inb(ppc->lpt_addr + 1) & 0xB8;
180 ppc->cur_ctrl &= ~port_afd;
182 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
184 k = (inb(ppc->lpt_addr + 1) & 0xB8) ^ 0xB8;
189 ppc->cur_ctrl &= ~(port_sel | port_init);
191 ppc->cur_ctrl &= ~port_sel;
193 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
199 outb(ppc->org_ctrl, ppc->lpt_addr + 2);
201 outb(ppc->org_data, ppc->lpt_addr);
208 static void ppc6_deselect(Interface *ppc)
210 if (ppc->mode & 4) // EPP
211 ppc->cur_ctrl |= port_init;
213 ppc->cur_ctrl |= port_sel;
215 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
217 outb(ppc->org_data, ppc->lpt_addr);
219 outb((ppc->org_ctrl | port_sel), ppc->lpt_addr + 2);
221 outb(ppc->org_ctrl, ppc->lpt_addr + 2);
226 static void ppc6_send_cmd(Interface *ppc, u8 cmd)
228 switch(ppc->mode)
235 outb(cmd, ppc->lpt_addr);
237 ppc->cur_ctrl ^= cmd_stb;
239 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
248 outb(cmd, ppc->lpt_addr + 3);
257 static void ppc6_wr_data_byte(Interface *ppc, u8 data)
259 switch(ppc->mode)
266 outb(data, ppc->lpt_addr);
268 ppc->cur_ctrl ^= data_stb;
270 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
279 outb(data, ppc->lpt_addr + 4);
288 static u8 ppc6_rd_data_byte(Interface *ppc)
292 switch(ppc->mode)
297 ppc->cur_ctrl = (ppc->cur_ctrl & ~port_stb) ^ data_stb;
299 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
303 data = inb(ppc->lpt_addr + 1);
307 ppc->cur_ctrl |= port_stb;
309 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
313 data |= inb(ppc->lpt_addr + 1) & 0xB8;
321 ppc->cur_ctrl |= port_dir;
323 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
325 ppc->cur_ctrl = (ppc->cur_ctrl | port_stb) ^ data_stb;
327 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
329 data = inb(ppc->lpt_addr);
331 ppc->cur_ctrl &= ~port_stb;
333 outb(ppc->cur_ctrl,ppc->lpt_addr + 2);
335 ppc->cur_ctrl &= ~port_dir;
337 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
346 outb((ppc->cur_ctrl | port_dir),ppc->lpt_addr + 2);
348 data = inb(ppc->lpt_addr + 4);
350 outb(ppc->cur_ctrl,ppc->lpt_addr + 2);
361 static u8 ppc6_rd_port(Interface *ppc, u8 port)
363 ppc6_send_cmd(ppc,(u8)(port | ACCESS_PORT | ACCESS_READ));
365 return(ppc6_rd_data_byte(ppc));
370 static void ppc6_wr_port(Interface *ppc, u8 port, u8 data)
372 ppc6_send_cmd(ppc,(u8)(port | ACCESS_PORT | ACCESS_WRITE));
374 ppc6_wr_data_byte(ppc, data);
379 static void ppc6_rd_data_blk(Interface *ppc, u8 *data, long count)
381 switch(ppc->mode)
390 ppc->cur_ctrl = (ppc->cur_ctrl & ~port_stb) ^ data_stb;
392 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
396 d = inb(ppc->lpt_addr + 1);
400 ppc->cur_ctrl |= port_stb;
402 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
406 d |= inb(ppc->lpt_addr + 1) & 0xB8;
418 ppc->cur_ctrl |= port_dir;
420 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
422 ppc->cur_ctrl |= port_stb;
426 ppc->cur_ctrl ^= data_stb;
428 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
430 *data++ = inb(ppc->lpt_addr);
434 ppc->cur_ctrl &= ~port_stb;
436 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
438 ppc->cur_ctrl &= ~port_dir;
440 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
447 outb((ppc->cur_ctrl | port_dir), ppc->lpt_addr + 2);
453 *data++ = inb(ppc->lpt_addr + 4);
457 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
464 outb((ppc->cur_ctrl | port_dir), ppc->lpt_addr + 2);
470 *((u16 *)data) = inw(ppc->lpt_addr + 4);
477 *data++ = inb(ppc->lpt_addr + 4);
481 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
488 outb((ppc->cur_ctrl | port_dir),ppc->lpt_addr + 2);
494 *((u32 *)data) = inl(ppc->lpt_addr + 4);
501 *data++ = inb(ppc->lpt_addr + 4);
505 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
515 static void ppc6_wait_for_fifo(Interface *ppc)
519 if (ppc->ppc_flags & fifo_wait)
522 inb(ppc->lpt_addr + 1);
528 static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count)
530 switch(ppc->mode)
537 outb(*data++, ppc->lpt_addr);
539 ppc->cur_ctrl ^= data_stb;
541 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
552 ppc6_send_cmd(ppc,(CMD_PREFIX_SET | PREFIX_FASTWR));
554 ppc->cur_ctrl |= port_stb;
556 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
560 outb(last, ppc->lpt_addr);
569 ppc->cur_ctrl ^= data_stb;
571 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
575 outb(this, ppc->lpt_addr);
581 ppc->cur_ctrl &= ~port_stb;
583 outb(ppc->cur_ctrl, ppc->lpt_addr + 2);
585 ppc6_send_cmd(ppc,(CMD_PREFIX_RESET | PREFIX_FASTWR));
594 outb(*data++,ppc->lpt_addr + 4);
598 ppc6_wait_for_fifo(ppc);
607 outw(*((u16 *)data),ppc->lpt_addr + 4);
614 outb(*data++,ppc->lpt_addr + 4);
618 ppc6_wait_for_fifo(ppc);
627 outl(*((u32 *)data),ppc->lpt_addr + 4);
634 outb(*data++,ppc->lpt_addr + 4);
638 ppc6_wait_for_fifo(ppc);
647 static void ppc6_rd_port16_blk(Interface *ppc, u8 port, u8 *data, long length)
651 ppc6_send_cmd(ppc, (REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE));
652 ppc6_wr_data_byte(ppc,(u8)length);
653 ppc6_wr_data_byte(ppc,(u8)(length >> 8));
654 ppc6_wr_data_byte(ppc,0);
656 ppc6_send_cmd(ppc, (CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK));
658 ppc6_send_cmd(ppc, (u8)(port | ACCESS_PORT | ACCESS_READ));
660 ppc6_rd_data_blk(ppc, data, length);
662 ppc6_send_cmd(ppc, (CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK));
667 static void ppc6_wr_port16_blk(Interface *ppc, u8 port, u8 *data, long length)
671 ppc6_send_cmd(ppc, (REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE));
672 ppc6_wr_data_byte(ppc,(u8)length);
673 ppc6_wr_data_byte(ppc,(u8)(length >> 8));
674 ppc6_wr_data_byte(ppc,0);
676 ppc6_send_cmd(ppc, (CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK));
678 ppc6_send_cmd(ppc, (u8)(port | ACCESS_PORT | ACCESS_WRITE));
680 ppc6_wr_data_blk(ppc, data, length);
682 ppc6_send_cmd(ppc, (CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK));
687 static void ppc6_wr_extout(Interface *ppc, u8 regdata)
689 ppc6_send_cmd(ppc,(REG_VERSION | ACCESS_REG | ACCESS_WRITE));
691 ppc6_wr_data_byte(ppc, (u8)((regdata & 0x03) << 6));
696 static int ppc6_open(Interface *ppc)
700 ret = ppc6_select(ppc);
705 ppc->ppc_flags &= ~fifo_wait;
707 ppc6_send_cmd(ppc, (ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE));
708 ppc6_wr_data_byte(ppc, RAMSIZE_128K);
710 ppc6_send_cmd(ppc, (ACCESS_REG | ACCESS_READ | REG_VERSION));
712 if ((ppc6_rd_data_byte(ppc) & 0x3F) == 0x0C)
713 ppc->ppc_flags |= fifo_wait;
720 static void ppc6_close(Interface *ppc)
722 ppc6_deselect(ppc);