コード例 #1
0
static void bigmac_rx_reset(void __iomem *bregs)
{
	int tries = RX_RESET_TRIES;

	sbus_writel(0, bregs + BMAC_RXCFG);
	while (sbus_readl(bregs + BMAC_RXCFG) && --tries)
		udelay(20);

	if (!tries) {
		printk(KERN_ERR "BIGMAC: Receiver will not reset.\n");
		printk(KERN_ERR "BIGMAC: rx_cfg is %08x\n",
		       sbus_readl(bregs + BMAC_RXCFG));
	}
}
コード例 #2
0
void sun4m_nmi(struct pt_regs *regs)
{
    unsigned long afsr, afar, si;

    printk(KERN_ERR "Aieee: sun4m NMI received!\n");
    /* XXX HyperSparc hack XXX */
    __asm__ __volatile__("mov 0x500, %%g1\n\t"
                         "lda [%%g1] 0x4, %0\n\t"
                         "mov 0x600, %%g1\n\t"
                         "lda [%%g1] 0x4, %1\n\t" :
                         "=r" (afsr), "=r" (afar));
    printk(KERN_ERR "afsr=%08lx afar=%08lx\n", afsr, afar);
    si = sbus_readl(&sun4m_irq_global->pending);
    printk(KERN_ERR "si=%08lx\n", si);
    if (si & SUN4M_INT_MODULE_ERR)
        printk(KERN_ERR "Module async error\n");
    if (si & SUN4M_INT_M2S_WRITE_ERR)
        printk(KERN_ERR "MBus/SBus async error\n");
    if (si & SUN4M_INT_ECC_ERR)
        printk(KERN_ERR "ECC memory error\n");
    if (si & SUN4M_INT_VME_ERR)
        printk(KERN_ERR "VME async error\n");
    printk(KERN_ERR "you lose buddy boy...\n");
    show_regs(regs);
    prom_halt();
}
コード例 #3
0
static void leo_clear(struct vc_data *conp, struct display *p, int sy, int sx,
		      int height, int width)
{
	struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
	register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
	register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0;
	unsigned long flags;
	int x, y, w, h;
	int i;

	spin_lock_irqsave(&fb->lock, flags);
	do {
		i = sbus_readl(&us->csr);
	} while (i & 0x20000000);
	sbus_writel((attr_bgcol_ec(p,conp)<<24), &ss->fg);
	if (fontheightlog(p)) {
		y = sy << fontheightlog(p); h = height << fontheightlog(p);
	} else {
		y = sy * fontheight(p); h = height * fontheight(p);
	}
	if (fontwidthlog(p)) {
		x = sx << fontwidthlog(p); w = width << fontwidthlog(p);
	} else {
		x = sx * fontwidth(p); w = width * fontwidth(p);
	}
	sbus_writel((w - 1) | ((h - 1) << 11), &us->extent);
	sbus_writel((x + fb->x_margin) | ((y + fb->y_margin) << 11) | 0x80000000,
		    &us->fill);
	spin_unlock_irqrestore(&fb->lock, flags);
}
コード例 #4
0
ファイル: leo.c プロジェクト: PennPanda/linux-repo
static void leo_switch_from_graph(struct fb_info *info)
{
	struct leo_par *par = (struct leo_par *) info->par;
	struct leo_ld __iomem *ss = (struct leo_ld __iomem *) par->ld_ss0;
	unsigned long flags;
	u32 val;

	spin_lock_irqsave(&par->lock, flags);

	par->extent = ((info->var.xres - 1) |
		       ((info->var.yres - 1) << 16));

	sbus_writel(0xffffffff, &ss->wid);
	sbus_writel(0xffff, &ss->wmask);
	sbus_writel(0, &ss->vclipmin);
	sbus_writel(par->extent, &ss->vclipmax);
	sbus_writel(0, &ss->fg);
	sbus_writel(0xff000000, &ss->planemask);
	sbus_writel(0x310850, &ss->rop);
	sbus_writel(0, &ss->widclip);
	sbus_writel((info->var.xres-1) | ((info->var.yres-1) << 11),
		    &par->lc_ss0_usr->extent);
	sbus_writel(4, &par->lc_ss0_usr->addrspace);
	sbus_writel(0x80000000, &par->lc_ss0_usr->fill);
	sbus_writel(0, &par->lc_ss0_usr->fontt);
	do {
		val = sbus_readl(&par->lc_ss0_usr->csr);
	} while (val & 0x20000000);

	spin_unlock_irqrestore(&par->lock, flags);
}
コード例 #5
0
static void leo_loadcmap (struct fb_info_sbusfb *fb, struct display *p, int index, int count)
{
        struct leo_lx_krn *lx_krn = fb->s.leo.lx_krn;
	unsigned long flags;
	u32 tmp;
	int i;
	
	spin_lock_irqsave(&fb->lock, flags);
	sbus_writel(LEO_KRN_TYPE_CLUT0, &lx_krn->krn_type);
	i = leo_wait (lx_krn);
	if (i)
		goto out;
	sbus_writel(LEO_KRN_TYPE_CLUTDATA, &lx_krn->krn_type);
	for (i = 0; i < 256; i++) {
		u32 val;

		val = fb->color_map CM(i,0) |
			(fb->color_map CM(i,1) << 8) |
			(fb->color_map CM(i,2) << 16);

		sbus_writel(val, &lx_krn->krn_value); /* Throw colors there :)) */
	}
	sbus_writel(LEO_KRN_TYPE_CLUT0, &lx_krn->krn_type);
	tmp = sbus_readl(&lx_krn->krn_csr);
	tmp |= (LEO_KRN_CSR_UNK|LEO_KRN_CSR_UNK2);
	sbus_writel(tmp, &lx_krn->krn_csr);
out:
	spin_unlock_irqrestore(&fb->lock, flags);
}
コード例 #6
0
ファイル: myri_sbus.c プロジェクト: nos1609/Chrono_Kernel-1
static int myri_do_handshake(struct myri_eth *mp)
{
	struct myri_shmem __iomem *shmem = mp->shmem;
	void __iomem *cregs = mp->cregs;
	struct myri_channel __iomem *chan = &shmem->channel;
	int tick 			= 0;

	DET(("myri_do_handshake: "));
	if (sbus_readl(&chan->state) == STATE_READY) {
		DET(("Already STATE_READY, failed.\n"));
		return -1;	/* We're hosed... */
	}

	myri_disable_irq(mp->lregs, cregs);

	while (tick++ < 25) {
		u32 softstate;

		/* Wake it up. */
		DET(("shakedown, CONTROL_WON, "));
		sbus_writel(1, &shmem->shakedown);
		sbus_writel(CONTROL_WON, cregs + MYRICTRL_CTRL);

		softstate = sbus_readl(&chan->state);
		DET(("chanstate[%08x] ", softstate));
		if (softstate == STATE_READY) {
			DET(("wakeup successful, "));
			break;
		}

		if (softstate != STATE_WFN) {
			DET(("not WFN setting that, "));
			sbus_writel(STATE_WFN, &chan->state);
		}

		udelay(20);
	}

	myri_enable_irq(mp->lregs, cregs);

	if (tick > 25) {
		DET(("25 ticks we lose, failure.\n"));
		return -1;
	}
	DET(("success\n"));
	return 0;
}
コード例 #7
0
static int vfc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
	      unsigned long arg) 
{
	int ret = 0;
	unsigned int tmp;
	struct vfc_dev *dev;

	dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
	if(dev == NULL)
		return -ENODEV;
	
	switch(cmd & 0x0000ffff) {
	case VFCGCTRL:
#if 0
		VFC_IOCTL_DEBUG_PRINTK(("vfc%d: IOCTL(VFCGCTRL)\n", dev->instance));
#endif
		tmp = sbus_readl(&dev->regs->control);
		if(copy_to_user((void *)arg, &tmp, sizeof(unsigned int))) {
			ret = -EFAULT;
			break;
		}
		ret = 0;
		break;
	case VFCSCTRL:
		ret = vfc_set_control_ioctl(inode, file, dev, arg);
		break;
	case VFCGVID:
		ret = vfc_get_video_ioctl(inode, file, dev, arg);
		break;
	case VFCSVID:
		ret = vfc_set_video_ioctl(inode, file, dev, arg);
		break;
	case VFCHUE:
		VFC_IOCTL_DEBUG_PRINTK(("vfc%d: IOCTL(VFCHUE)\n", dev->instance));
		if(copy_from_user(&tmp,(void *)arg,sizeof(unsigned int))) {
			VFC_IOCTL_DEBUG_PRINTK(("vfc%d: User passed bogus pointer "
						"to IOCTL(VFCHUE)", dev->instance));
			ret = -EFAULT;
		} else {
			VFC_SAA9051_SA(dev,VFC_SAA9051_HUE) = tmp;
			vfc_update_saa9051(dev);
			ret = 0;
		}
		break;
	case VFCPORTCHG:
		ret = vfc_port_change_ioctl(inode, file, dev, arg);
		break;
	case VFCRDINFO:
		ret = -EINVAL;
		VFC_IOCTL_DEBUG_PRINTK(("vfc%d: IOCTL(VFCRDINFO)\n", dev->instance));
		break;
	default:
		ret = vfc_debug(vfc_get_dev_ptr(MINOR(inode->i_rdev)),
				cmd, arg);
		break;
	};

	return ret;
}
コード例 #8
0
static void parport_sunbpp_enable_irq(struct parport *p)
{
	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
	u32 tmp;

	tmp = sbus_readl(&regs->p_csr);
	tmp |= DMA_INT_ENAB;
	sbus_writel(tmp, &regs->p_csr);
}
コード例 #9
0
static void parport_sunbpp_disable_irq(struct parport *p)
{
	struct bpp_regs *regs = (struct bpp_regs *)p->base;
	u32 tmp;

	tmp = sbus_readl(&regs->p_csr);
	tmp &= ~DMA_INT_ENAB;
	sbus_writel(tmp, &regs->p_csr);
}
コード例 #10
0
static int leo_wait (struct leo_lx_krn *lx_krn)
{
	int i;
	
	for (i = 0; (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) && i < 300000; i++)
		udelay (1); /* Busy wait at most 0.3 sec */
	if (i == 300000)
		return -EFAULT; /* Timed out - should we print some message? */
	return 0;
}
コード例 #11
0
ファイル: sunbmac.c プロジェクト: 119-org/hi3518-osdrv
static void bigmac_tx_reset(void __iomem *bregs)
{
	int tries = TX_RESET_TRIES;

	sbus_writel(0, bregs + BMAC_TXCFG);

	/* The fifo threshold bit is read-only and does
	 * not clear.  -DaveM
	 */
	while ((sbus_readl(bregs + BMAC_TXCFG) & ~(BIGMAC_TXCFG_FIFO)) != 0 &&
	       --tries != 0)
		udelay(20);

	if (!tries) {
		printk(KERN_ERR "BIGMAC: Transmitter will not reset.\n");
		printk(KERN_ERR "BIGMAC: tx_cfg is %08x\n",
		       sbus_readl(bregs + BMAC_TXCFG));
	}
}
コード例 #12
0
ファイル: dvma.c プロジェクト: archith/camera_project
void __init init_one_dvma(struct sbus_dma *dma, int num_dma)
{
	printk("dma%d: ", num_dma);
	
	dma->next = 0;
	dma->running = 0;      /* No transfers going on as of yet */
	dma->allocated = 0;    /* No one has allocated us yet */
	switch(sbus_readl(dma->regs + DMA_CSR)&DMA_DEVICE_ID) {
	case DMA_VERS0:
		dma->revision = dvmarev0;
		printk("Revision 0 ");
		break;
	case DMA_ESCV1:
		dma->revision = dvmaesc1;
		printk("ESC Revision 1 ");
		break;
	case DMA_VERS1:
		dma->revision = dvmarev1;
		printk("Revision 1 ");
		break;
	case DMA_VERS2:
		dma->revision = dvmarev2;
		printk("Revision 2 ");
		break;
	case DMA_VERHME:
		dma->revision = dvmahme;
		printk("HME DVMA gate array ");
		break;
	case DMA_VERSPLUS:
		dma->revision = dvmarevplus;
		printk("Revision 1 PLUS ");
		break;
	default:
		printk("unknown dma version %08x",
		       sbus_readl(dma->regs + DMA_CSR) & DMA_DEVICE_ID);
		dma->allocated = 1;
		break;
	}
	printk("\n");
#if 0 /* Clutters up the screen */
	dump_dma_regs(dma->regs);
#endif
}
コード例 #13
0
ファイル: leo.c プロジェクト: PennPanda/linux-repo
static void leo_wait(struct leo_lx_krn __iomem *lx_krn)
{
	int i;
	
	for (i = 0;
	     (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) && i < 300000;
	     i++)
		udelay (1); /* Busy wait at most 0.3 sec */
	return;
}
コード例 #14
0
ファイル: sunqe.c プロジェクト: Lyude/linux
/* Interrupts for all QE's get filtered out via the QEC master controller,
 * so we just run through each qe and check to see who is signaling
 * and thus needs to be serviced.
 */
static irqreturn_t qec_interrupt(int irq, void *dev_id)
{
	struct sunqec *qecp = dev_id;
	u32 qec_status;
	int channel = 0;

	/* Latch the status now. */
	qec_status = sbus_readl(qecp->gregs + GLOB_STAT);
	while (channel < 4) {
		if (qec_status & 0xf) {
			struct sunqe *qep = qecp->qes[channel];
			u32 qe_status;

			qe_status = sbus_readl(qep->qcregs + CREG_STAT);
			if (qe_status & CREG_STAT_ERRORS) {
				if (qe_is_bolixed(qep, qe_status))
					goto next;
			}
			if (qe_status & CREG_STAT_RXIRQ)
				qe_rx(qep);
			if (netif_queue_stopped(qep->dev) &&
			    (qe_status & CREG_STAT_TXIRQ)) {
				spin_lock(&qep->lock);
				qe_tx_reclaim(qep);
				if (TX_BUFFS_AVAIL(qep) > 0) {
					/* Wake net queue and return to
					 * lazy tx reclaim.
					 */
					netif_wake_queue(qep->dev);
					sbus_writel(1, qep->qcregs + CREG_TIMASK);
				}
				spin_unlock(&qep->lock);
			}
	next:
			;
		}
		qec_status >>= 4;
		channel++;
	}

	return IRQ_HANDLED;
}
コード例 #15
0
ファイル: leo.c プロジェクト: PennPanda/linux-repo
static void leo_init_hw(struct fb_info *info)
{
	struct leo_par *par = (struct leo_par *) info->par;
	u32 val;

	val = sbus_readl(&par->ld_ss1->ss1_misc);
	val |= LEO_SS1_MISC_ENABLE;
	sbus_writel(val, &par->ld_ss1->ss1_misc);

	leo_switch_from_graph(info);
}
コード例 #16
0
ファイル: vfc_i2c.c プロジェクト: kzlin129/tt-gpl
int vfc_i2c_wait_for_bus(struct vfc_dev *dev) 
{
	int timeout = 1000; 

	while(!(sbus_readl(&dev->regs->i2c_s1) & BB)) {
		if(!(timeout--))
			return -ETIMEDOUT;
		vfc_i2c_delay(dev);
	}
	return 0;
}
コード例 #17
0
static void leo_restore_palette (struct fb_info_sbusfb *fb)
{
	u32 tmp;
	unsigned long flags;

	spin_lock_irqsave(&fb->lock, flags);
	tmp = sbus_readl(&fb->s.leo.ld_ss1->ss1_misc);
	tmp &= ~(LEO_SS1_MISC_ENABLE);
	sbus_writel(tmp, &fb->s.leo.ld_ss1->ss1_misc);
	spin_unlock_irqrestore(&fb->lock, flags);
}
コード例 #18
0
ファイル: leo.c プロジェクト: CSCLOG/beaglebone
static void leo_switch_from_graph(struct fb_info *info)
{
	struct leo_par *par = (struct leo_par *) info->par;
	struct leo_ld_ss0 __iomem *ss = par->ld_ss0;
	struct leo_cursor __iomem *cursor = par->cursor;
	unsigned long flags;
	u32 val;

	spin_lock_irqsave(&par->lock, flags);

	par->extent = ((info->var.xres - 1) |
		       ((info->var.yres - 1) << 16));

	sbus_writel(0xffffffff, &ss->wid);
	sbus_writel(0xffff, &ss->wmask);
	sbus_writel(0, &ss->vclipmin);
	sbus_writel(par->extent, &ss->vclipmax);
	sbus_writel(0, &ss->fg);
	sbus_writel(0xff000000, &ss->planemask);
	sbus_writel(0x310850, &ss->rop);
	sbus_writel(0, &ss->widclip);
	sbus_writel((info->var.xres-1) | ((info->var.yres-1) << 11),
		    &par->lc_ss0_usr->extent);
	sbus_writel(4, &par->lc_ss0_usr->addrspace);
	sbus_writel(0x80000000, &par->lc_ss0_usr->fill);
	sbus_writel(0, &par->lc_ss0_usr->fontt);
	do {
		val = sbus_readl(&par->lc_ss0_usr->csr);
	} while (val & 0x20000000);

	/* setup screen buffer for cfb_* functions */
	sbus_writel(1, &ss->wid);
	sbus_writel(0x00ffffff, &ss->planemask);
	sbus_writel(0x310b90, &ss->rop);
	sbus_writel(0, &par->lc_ss0_usr->addrspace);

	/* hide cursor */
	sbus_writel(sbus_readl(&cursor->cur_misc) & ~LEO_CUR_ENABLE, &cursor->cur_misc);

	spin_unlock_irqrestore(&par->lock, flags);
}
コード例 #19
0
static void leo_blank (struct fb_info_sbusfb *fb)
{
	unsigned long flags;
	u32 tmp;

	spin_lock_irqsave(&fb->lock, flags);
	sbus_writel(LEO_KRN_TYPE_VIDEO, &fb->s.leo.lx_krn->krn_type);

	tmp = sbus_readl(&fb->s.leo.lx_krn->krn_csr);
	tmp &= ~LEO_KRN_CSR_ENABLE;
	sbus_writel(tmp, &fb->s.leo.lx_krn->krn_csr);
	spin_unlock_irqrestore(&fb->lock, flags);
}
コード例 #20
0
ファイル: myri_sbus.c プロジェクト: nos1609/Chrono_Kernel-1
static irqreturn_t myri_interrupt(int irq, void *dev_id)
{
	struct net_device *dev		= (struct net_device *) dev_id;
	struct myri_eth *mp		= netdev_priv(dev);
	void __iomem *lregs		= mp->lregs;
	struct myri_channel __iomem *chan = &mp->shmem->channel;
	unsigned long flags;
	u32 status;
	int handled = 0;

	spin_lock_irqsave(&mp->irq_lock, flags);

	status = sbus_readl(lregs + LANAI_ISTAT);
	DIRQ(("myri_interrupt: status[%08x] ", status));
	if (status & ISTAT_HOST) {
		u32 softstate;

		handled = 1;
		DIRQ(("IRQ_DISAB "));
		myri_disable_irq(lregs, mp->cregs);
		softstate = sbus_readl(&chan->state);
		DIRQ(("state[%08x] ", softstate));
		if (softstate != STATE_READY) {
			DIRQ(("myri_not_so_happy "));
			myri_is_not_so_happy(mp);
		}
		DIRQ(("\nmyri_rx: "));
		myri_rx(mp, dev);
		DIRQ(("\nistat=ISTAT_HOST "));
		sbus_writel(ISTAT_HOST, lregs + LANAI_ISTAT);
		DIRQ(("IRQ_ENAB "));
		myri_enable_irq(lregs, mp->cregs);
	}
	DIRQ(("\n"));

	spin_unlock_irqrestore(&mp->irq_lock, flags);

	return IRQ_RETVAL(handled);
}
コード例 #21
0
ファイル: sunbmac.c プロジェクト: 119-org/hi3518-osdrv
static void write_tcvr_bit(struct bigmac *bp, void __iomem *tregs, int bit)
{
	if (bp->tcvr_type == internal) {
		bit = (bit & 1) << 3;
		sbus_writel(bit | (MGMT_PAL_OENAB | MGMT_PAL_EXT_MDIO),
			    tregs + TCVR_MPAL);
		sbus_readl(tregs + TCVR_MPAL);
		sbus_writel(bit | MGMT_PAL_OENAB | MGMT_PAL_EXT_MDIO | MGMT_PAL_DCLOCK,
			    tregs + TCVR_MPAL);
		sbus_readl(tregs + TCVR_MPAL);
	} else if (bp->tcvr_type == external) {
		bit = (bit & 1) << 2;
		sbus_writel(bit | MGMT_PAL_INT_MDIO | MGMT_PAL_OENAB,
			    tregs + TCVR_MPAL);
		sbus_readl(tregs + TCVR_MPAL);
		sbus_writel(bit | MGMT_PAL_INT_MDIO | MGMT_PAL_OENAB | MGMT_PAL_DCLOCK,
			    tregs + TCVR_MPAL);
		sbus_readl(tregs + TCVR_MPAL);
	} else {
		printk(KERN_ERR "write_tcvr_bit: No transceiver type known!\n");
	}
}
コード例 #22
0
ファイル: myri_sbus.c プロジェクト: nos1609/Chrono_Kernel-1
static void myri_clean_rings(struct myri_eth *mp)
{
	struct sendq __iomem *sq = mp->sq;
	struct recvq __iomem *rq = mp->rq;
	int i;

	sbus_writel(0, &rq->tail);
	sbus_writel(0, &rq->head);
	for (i = 0; i < (RX_RING_SIZE+1); i++) {
		if (mp->rx_skbs[i] != NULL) {
			struct myri_rxd __iomem *rxd = &rq->myri_rxd[i];
			u32 dma_addr;

			dma_addr = sbus_readl(&rxd->myri_scatters[0].addr);
			dma_unmap_single(&mp->myri_op->dev, dma_addr,
					 RX_ALLOC_SIZE, DMA_FROM_DEVICE);
			dev_kfree_skb(mp->rx_skbs[i]);
			mp->rx_skbs[i] = NULL;
		}
	}

	mp->tx_old = 0;
	sbus_writel(0, &sq->tail);
	sbus_writel(0, &sq->head);
	for (i = 0; i < TX_RING_SIZE; i++) {
		if (mp->tx_skbs[i] != NULL) {
			struct sk_buff *skb = mp->tx_skbs[i];
			struct myri_txd __iomem *txd = &sq->myri_txd[i];
			u32 dma_addr;

			dma_addr = sbus_readl(&txd->myri_gathers[0].addr);
			dma_unmap_single(&mp->myri_op->dev, dma_addr,
					 (skb->len + 3) & ~3,
					 DMA_TO_DEVICE);
			dev_kfree_skb(mp->tx_skbs[i]);
			mp->tx_skbs[i] = NULL;
		}
	}
}
コード例 #23
0
ファイル: myri_sbus.c プロジェクト: dmgerman/original
static void myri_tx(struct myri_eth *mp, struct net_device *dev)
{
	struct sendq *sq	= mp->sq;
	int entry		= mp->tx_old;
	int limit		= sbus_readl(&sq->head);

	DTX(("entry[%d] limit[%d] ", entry, limit));
	if (entry == limit)
		return;
	while (entry != limit) {
		struct sk_buff *skb = mp->tx_skbs[entry];
		u32 dma_addr;

		DTX(("SKB[%d] ", entry));
		dma_addr = sbus_readl(&sq->myri_txd[entry].myri_gathers[0].addr);
		sbus_unmap_single(mp->myri_sdev, dma_addr, skb->len, SBUS_DMA_TODEVICE);
		dev_kfree_skb(skb);
		mp->tx_skbs[entry] = NULL;
		mp->enet_stats.tx_packets++;
		entry = NEXT_TX(entry);
	}
	mp->tx_old = entry;
}
コード例 #24
0
ファイル: vfc_i2c.c プロジェクト: kzlin129/tt-gpl
int vfc_i2c_xmit_addr(struct vfc_dev *dev, unsigned char addr, char mode) 
{ 
	int ret, raddr;
#if 1
	WRITE_S1(SEND_I2C_STOP | ACK);
	WRITE_S1(SELECT(S0) | ENABLE_SERIAL);
	vfc_i2c_delay(dev);
#endif

	switch(mode) {
	case VFC_I2C_READ:
		raddr = SHIFT(((unsigned int)addr | 0x1));
		WRITE_REG(raddr);
		VFC_I2C_DEBUG_PRINTK(("vfc%d: receiving from i2c addr 0x%x\n",
				      dev->instance, addr | 0x1));
		break;
	case VFC_I2C_WRITE:
		raddr = SHIFT((unsigned int)addr & ~0x1);
		WRITE_REG(raddr);
		VFC_I2C_DEBUG_PRINTK(("vfc%d: sending to i2c addr 0x%x\n",
				      dev->instance, addr & ~0x1));
		break;
	default:
		return -EINVAL;
	};

	WRITE_S1(SEND_I2C_START);
	vfc_i2c_delay(dev);
	ret = vfc_i2c_wait_for_pin(dev,VFC_I2C_ACK_CHECK); /* We wait
							      for the
							      i2c send
							      to finish
							      here but
							      Sun
							      doesn't,
							      hmm */
	if (ret) {
		printk(KERN_ERR "vfc%d: VFC xmit addr timed out or no ack\n",
		       dev->instance);
		return ret;
	} else if (mode == VFC_I2C_READ) {
		if ((ret = sbus_readl(&dev->regs->i2c_reg) & 0xff000000) != raddr) {
			printk(KERN_WARNING 
			       "vfc%d: returned slave address "
			       "mismatch(%x,%x)\n",
			       dev->instance, raddr, ret);
		}
	}	
	return 0;
}
コード例 #25
0
static void leo_putc(struct vc_data *conp, struct display *p, int c, int yy, int xx)
{
	struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
	register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
	register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0;
	unsigned long flags;
	int i, x, y;
	u8 *fd;
	u32 *u;

	spin_lock_irqsave(&fb->lock, flags);
	if (fontheightlog(p)) {
		y = yy << (fontheightlog(p) + 11);
		i = (c & p->charmask) << fontheightlog(p);
	} else {
		y = (yy * fontheight(p)) << 11;
		i = (c & p->charmask) * fontheight(p);
	}
	if (fontwidth(p) <= 8)
		fd = p->fontdata + i;
	else
		fd = p->fontdata + (i << 1);
	if (fontwidthlog(p))
		x = xx << fontwidthlog(p);
	else
		x = xx * fontwidth(p);
	do {
		i = sbus_readl(&us->csr);
	} while (i & 0x20000000);
	sbus_writel(attr_fgcol(p,c) << 24, &ss->fg);
	sbus_writel(attr_bgcol(p,c) << 24, &ss->bg);
	sbus_writel(0xFFFFFFFF<<(32-fontwidth(p)),
		    &us->fontmsk);
	u = ((u32 *)p->screen_base) + y + x;
	if (fontwidth(p) <= 8) {
		for (i = 0; i < fontheight(p); i++, u += 2048) {
			u32 val = *fd++ << 24;

			sbus_writel(val, u);
		}
	} else {
		for (i = 0; i < fontheight(p); i++, u += 2048) {
			u32 val = *(u16 *)fd << 16;

			sbus_writel(val, u);
			fd += 2;
		}
	}
	spin_unlock_irqrestore(&fb->lock, flags);
}
コード例 #26
0
/* Load cursor information */
static void leo_setcursor (struct fb_info_sbusfb *fb)
{
	struct cg_cursor *c = &fb->cursor;
	struct leo_cursor *l = fb->s.leo.cursor;
	unsigned long flags;
	u32 tmp;

	spin_lock_irqsave(&fb->lock, flags);
	tmp = sbus_readl(&l->cur_misc);
	tmp &= ~LEO_CUR_ENABLE;
	sbus_writel(tmp, &l->cur_misc);

	sbus_writel(((c->cpos.fbx - c->chot.fbx) & 0x7ff) |
		    (((c->cpos.fby - c->chot.fby) & 0x7ff) << 11),
		    &l->cur_cursxy);

	tmp = sbus_readl(&l->cur_misc);
	tmp |= LEO_CUR_UPDATE;
	if (c->enable)
		tmp |= LEO_CUR_ENABLE;
	sbus_writel(tmp, &l->cur_misc);
	spin_unlock_irqrestore(&fb->lock, flags);
}
コード例 #27
0
ファイル: uctrl.c プロジェクト: andi34/Dhollmen_Kernel
static void uctrl_do_txn(struct uctrl_driver *driver, struct uctrl_txn *txn)
{
	int stat, incnt, outcnt, bytecnt, intr;
	u32 byte;

	stat = sbus_readl(&driver->regs->uctrl_stat);
	intr = sbus_readl(&driver->regs->uctrl_intr);
	sbus_writel(stat, &driver->regs->uctrl_stat);

	dprintk(("interrupt stat 0x%x int 0x%x\n", stat, intr));

	incnt = txn->inbits;
	outcnt = txn->outbits;
	byte = (txn->opcode << 8);
	WRITEUCTLDATA(byte);

	bytecnt = 0;
	while (incnt > 0) {
		byte = (txn->inbuf[bytecnt] << 8);
		WRITEUCTLDATA(byte);
		incnt--;
		bytecnt++;
	}

	/* Get the ack */
	READUCTLDATA(byte);
	dprintk(("ack was %x\n", (byte >> 8)));

	bytecnt = 0;
	while (outcnt > 0) {
		READUCTLDATA(byte);
		txn->outbuf[bytecnt] = (byte >> 8);
		dprintk(("set byte to %02x\n", byte));
		outcnt--;
		bytecnt++;
	}
}
コード例 #28
0
ファイル: vfc_dev.c プロジェクト: FatSunHYS/OSCourseDesign
int vfc_capture_poll(struct vfc_dev *dev) 
{
	int timeout = 1000;

	while (!timeout--) {
		if (sbus_readl(&dev->regs->control) & VFC_STATUS_CAPTURE)
			break;
		vfc_i2c_delay_no_busy(dev, 100);
	}
	if(!timeout) {
		printk(KERN_WARNING "vfc%d: capture timed out\n",
		       dev->instance);
		return -ETIMEDOUT;
	}
	return 0;
}
コード例 #29
0
ファイル: vfc_i2c.c プロジェクト: kzlin129/tt-gpl
int vfc_i2c_wait_for_pin(struct vfc_dev *dev, int ack)
{
	int timeout = 1000; 
	int s1;

	while ((s1 = sbus_readl(&dev->regs->i2c_s1)) & PIN) {
		if (!(timeout--))
			return -ETIMEDOUT;
		vfc_i2c_delay(dev);
	}
	if (ack == VFC_I2C_ACK_CHECK) {
		if(s1 & LRB)
			return -EIO; 
	}
	return 0;
}
コード例 #30
0
ファイル: sunbmac.c プロジェクト: 119-org/hi3518-osdrv
static int qec_global_reset(void __iomem *gregs)
{
	int tries = QEC_RESET_TRIES;

	sbus_writel(GLOB_CTRL_RESET, gregs + GLOB_CTRL);
	while (--tries) {
		if (sbus_readl(gregs + GLOB_CTRL) & GLOB_CTRL_RESET) {
			udelay(20);
			continue;
		}
		break;
	}
	if (tries)
		return 0;
	printk(KERN_ERR "BigMAC: Cannot reset the QEC.\n");
	return -1;
}