Example #1
0
void vr41xx_supply_clock(vr41xx_clock_t clock)
{
	spin_lock_irq(&cmu_lock);

	switch (clock) {
	case PIU_CLOCK:
		cmuclkmsk |= MSKPIU;
		break;
	case SIU_CLOCK:
		cmuclkmsk |= MSKSIU | MSKSSIU;
		break;
	case AIU_CLOCK:
		cmuclkmsk |= MSKAIU;
		break;
	case KIU_CLOCK:
		cmuclkmsk |= MSKKIU;
		break;
	case FIR_CLOCK:
		cmuclkmsk |= MSKFIR | MSKFFIR;
		break;
	case DSIU_CLOCK:
		if (current_cpu_type() == CPU_VR4111 ||
		    current_cpu_type() == CPU_VR4121)
			cmuclkmsk |= MSKDSIU;
		else
			cmuclkmsk |= MSKSIU | MSKDSIU;
		break;
	case CSI_CLOCK:
		cmuclkmsk |= MSKCSI | MSKSCSI;
		break;
	case PCIU_CLOCK:
		cmuclkmsk |= MSKPCIU;
		break;
	case HSP_CLOCK:
		cmuclkmsk |= MSKSHSP;
		break;
	case PCI_CLOCK:
		cmuclkmsk |= MSKPPCIU;
		break;
	case CEU_CLOCK:
		cmuclkmsk2 |= MSKCEU;
		break;
	case ETHER0_CLOCK:
		cmuclkmsk2 |= MSKMAC0;
		break;
	case ETHER1_CLOCK:
		cmuclkmsk2 |= MSKMAC1;
		break;
	default:
		break;
	}

	if (clock == CEU_CLOCK || clock == ETHER0_CLOCK ||
	    clock == ETHER1_CLOCK)
		cmu_write(CMUCLKMSK2, cmuclkmsk2);
	else
		cmu_write(CMUCLKMSK, cmuclkmsk);

	spin_unlock_irq(&cmu_lock);
}
Example #2
0
asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count)
{
	ssize_t ret;
	struct file * file;
	struct vms_fd * vms_fd;

	ret = -EBADF;
	vms_fd = fget(fd);
	int cmu_write();
	if (vms_fd->vfd$l_is_cmu)
	  return cmu_write(fd, buf, count);
	file = vms_fd->vfd$l_fd_p;
	if (file == 0)
	  return ret;
	int sts = 0;
	int curcount = count;
	int retcount = 0;
	struct _rabdef * rab = file;
	struct _fabdef * fab = rab->rab$l_fab;
	char * kbuf = buf;
	while (curcount>0) {
	  rab->rab$l_rbf = kbuf;
#if 0
	  rab->rab$w_rsz = count;
#else
	  rab->rab$w_rsz = curcount;
#if 0
	  printk("mrs %x %x\n",fab, fab->fab$w_mrs);
#endif

	  if (fab->fab$w_mrs == 0) {
	    rab->rab$v_asy = 1; // workaround to avoid tza hanging
	  }
#if 0
	  if (fab->fab$w_mrs)
	    rab->rab$w_rsz = fab->fab$w_mrs;
#else
	  if (rab->rab$w_rsz > 512) 
	    rab->rab$w_rsz = 512;
#endif
	  sts = exe$put(rab);
	  if ((sts&1)==0)
	    break;
	  int thiscount = rab->rab$w_rsz;
	  if (curcount < rab->rab$w_rsz)
	    thiscount = curcount;
	  kbuf += thiscount;
	  curcount -= thiscount;
	  retcount += thiscount;
#if 0
	  unsigned rsz = rab.rab$w_rsz;
	  return rsz;
#endif
	}
	if (sts & 1)
	  return retcount;
	else
	  return 0;
#endif
	if (file) {
		if (file->f_mode & FMODE_WRITE) {
		  if (fd<3) goto skip;
			struct inode *inode = file->f_dentry->d_inode;
			ret = 0;
			if (!ret) {
			skip: {}
				ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
				ret = -EINVAL;
				if (file->f_op && (write = file->f_op->write) != NULL)
					ret = write(file, buf, count, &file->f_pos);
			}
		}
		  if (fd<3) goto skip2;
		fput(file);
	skip2: {}
	}
	return ret;
}