Ejemplo n.º 1
0
static long efuse_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg )
{
	switch (cmd)
	{
#ifndef CONFIG_MESON_TRUSTZONE			
		case EFUSE_ENCRYPT_ENABLE:
			aml_set_reg32_bits( P_EFUSE_CNTL4, CNTL4_ENCRYPT_ENABLE_ON,
			CNTL4_ENCRYPT_ENABLE_BIT, CNTL4_ENCRYPT_ENABLE_SIZE);
			break;

		case EFUSE_ENCRYPT_DISABLE:
			aml_set_reg32_bits( P_EFUSE_CNTL4, CNTL4_ENCRYPT_ENABLE_OFF,
			CNTL4_ENCRYPT_ENABLE_BIT, CNTL4_ENCRYPT_ENABLE_SIZE);
			break;

		case EFUSE_ENCRYPT_RESET:
			aml_set_reg32_bits( P_EFUSE_CNTL4, CNTL4_ENCRYPT_RESET_ON,
			CNTL4_ENCRYPT_RESET_BIT, CNTL4_ENCRYPT_RESET_SIZE);
			break;
#endif
		case EFUSE_INFO_GET:
			{
				efuseinfo_item_t *info = (efuseinfo_item_t*)arg;
				if(efuse_getinfo_byID(info->id, info) < 0)
					return  -EFAULT;
			}
			break;

		default:
			return -ENOTTY;
	}
	return 0;
}
static int efuse_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg )
{
	switch (cmd)
	{
		case EFUSE_ENCRYPT_ENABLE:
			WRITE_CBUS_REG_BITS( EFUSE_CNTL4, CNTL4_ENCRYPT_ENABLE_ON,
			CNTL4_ENCRYPT_ENABLE_BIT, CNTL4_ENCRYPT_ENABLE_SIZE);
			break;

		case EFUSE_ENCRYPT_DISABLE:
			WRITE_CBUS_REG_BITS( EFUSE_CNTL4, CNTL4_ENCRYPT_ENABLE_OFF,
			CNTL4_ENCRYPT_ENABLE_BIT, CNTL4_ENCRYPT_ENABLE_SIZE);
			break;

		case EFUSE_ENCRYPT_RESET:
			WRITE_CBUS_REG_BITS( EFUSE_CNTL4, CNTL4_ENCRYPT_RESET_ON,
			CNTL4_ENCRYPT_RESET_BIT, CNTL4_ENCRYPT_RESET_SIZE);
			break;

		case EFUSE_INFO_GET:
			{
				efuseinfo_item_t *info = (efuseinfo_item_t*)arg;				
				if(efuse_getinfo_byID(info->id, info) < 0)
					return  -EFAULT;				
			}
			break;
			
		default:
			return -ENOTTY;
	}
	return 0;
}