예제 #1
0
void pn544_factory_standby_set(void)
{
    int ret = 0;
    struct pn544_dev *pn544_dev;
    struct pn544_i2c_platform_data *platform_data;
           
    platform_data = pn544_client->dev.platform_data;
    pn544_dev = i2c_get_clientdata(pn544_client);
    // 1. Go To Dnld mode 2
    pr_info("%s Go To Dnld mode 2\n", __func__);
    pr_info("%s platform_data->irq_gpio[%d]\n", __func__, platform_data->irq_gpio);
    pr_info("%s platform_data->ven_gpio[%d]\n", __func__, platform_data->ven_gpio);
    pr_info("%s platform_data->firm_gpio[%d]\n", __func__, platform_data->firm_gpio);

    pr_info("%s pn544_dev->irq_gpio[%d]\n", __func__, pn544_dev->irq_gpio);
    pr_info("%s pn544_dev->ven_gpio[%d]\n", __func__, pn544_dev->ven_gpio);
    pr_info("%s pn544_dev->firm_gpio[%d]\n", __func__, pn544_dev->firm_gpio);
     printk("[seokmin] print test\n");        
   gpio_set_value(platform_data->ven_gpio, 1);
    gpio_set_value(platform_data->firm_gpio, 1);
    msleep(10);
    gpio_set_value(platform_data->ven_gpio, 0);
//    gpio_set_value(platform_data->firm_gpio, 0);
    msleep(10);
    gpio_set_value(platform_data->ven_gpio, 1);
    msleep(10);

    // 2. I2c write
    pr_info("%s Go To I2c write\n", __func__);

    ret = __pn544_kwrite(pn544_dev, pn544_standby_set_val1, 6);

    if(ret)
    {
        printk("[seokmin] standby write fail\n");
    }
    ret = __pn544_kread(pn544_dev, 4);

    ret = __pn544_kwrite(pn544_dev, pn544_standby_set_val2, 6);
    if(ret)
    {
        printk("[seokmin] standby write fail\n");
    }
    ret = __pn544_kread(pn544_dev, 6);

    ret = __pn544_kwrite(pn544_dev, pn544_standby_set_val3, 10);
    if(ret)
    {
        printk("[seokmin] standby write fail\n");
    }
    ret = __pn544_kread(pn544_dev, 7);
          
    // 4. power off
    pr_debug(PN544_DRV_NAME ":%s power off\n", __func__);
    gpio_set_value(pn544_dev->firm_gpio, 0);
    gpio_set_value(pn544_dev->ven_gpio, 0);
    msleep(10);

    return;
}
예제 #2
0
void pn544_factory_standby_set(void)
{
    int ret = 0;
    struct pn544_dev *pn544_dev;
    struct pn544_i2c_platform_data *platform_data;
           
    platform_data = pn544_client->dev.platform_data;
    pn544_dev = i2c_get_clientdata(pn544_client);
    // 1. Go To Dnld mode 2
    dprintk("%s Go To Dnld mode 2\n", __func__);
    gpio_set_value(platform_data->ven_gpio, 0);
    gpio_set_value(platform_data->firm_gpio, 0);
    msleep(10);
    gpio_set_value(platform_data->ven_gpio, 1);
    msleep(10);

    // 2. I2c write
    dprintk("%s Go To I2c write\n", __func__);

    ret = __pn544_kwrite(pn544_dev, pn544_standby_set_val1, 6);
    if (ret == 0) {
    	printk("%s: standby write val1 success\n", __func__);
    	ret = __pn544_kread(pn544_dev, 4);
    } else {
    	printk("%s: standby write val1 fail\n", __func__);
    	return;
    }

    ret = __pn544_kwrite(pn544_dev, pn544_standby_set_val2, 6);
    if (ret == 0) {
    	printk("%s: standby write val2 success\n", __func__);
    	ret = __pn544_kread(pn544_dev, 6);
    } else {
    	printk("%s: standby write val2 fail\n", __func__);
    	return;
    }
	
    ret = __pn544_kwrite(pn544_dev, pn544_standby_set_val3, 10);
    if (ret == 0) {
    	printk("%s: standby write val3 success\n", __func__);
        ret = __pn544_kread(pn544_dev, 7);
    } else {
    	printk("%s: standby write val3 fail\n", __func__);
    	return;
    }
          
    // 4. power off
    dprintk(PN544_DRV_NAME ":%s power off\n", __func__);
    gpio_set_value(pn544_dev->firm_gpio, 0);
    gpio_set_value(pn544_dev->ven_gpio, 0);
    msleep(10);

    return;
}