Пример #1
0
static int __init gpio_test_init(void)
{
	const struct wl12xx_platform_data *wlan_data;
	wlan_data = wl12xx_get_platform_data();

	bt_enable_pin = wlan_data->bt_enable_gpio;

	/* Default to alpha EVM in case the element is not initialized */
	if (! bt_enable_pin)
	{
		pr_info("BT Enable pin is not initialized, defaulting to EVM Rev 1.0A.\n");
		bt_enable_pin = GPIO_TO_PIN(1, 31); 
	}

	/* Select pad conf register based on EVM board rev */
	if ( bt_enable_pin == GPIO_TO_PIN(3, 21) )	
		selected_pad = AM33XX_CONTROL_PADCONF_MCASP0_AHCLKX_OFFSET;
	else
		selected_pad = AM33XX_CONTROL_PADCONF_GPMC_CSN2_OFFSET;
 
	printk("Gpio value is :%d\n", bt_enable_pin);
	gpio_direction_output(bt_enable_pin, 0);
	msleep(1);
	printk("WL1271: BT Enable\n");
	gpio_direction_output(bt_enable_pin, 1);

	/* Enable pullup on the enable pin for keeping BT active during suspend */
	pad_mux_value = readl(AM33XX_CTRL_REGADDR(selected_pad));
	pad_mux_value &= (~AM33XX_PULL_DISA);
	writel(pad_mux_value, AM33XX_CTRL_REGADDR(selected_pad));

	return 0;
}
Пример #2
0
void call_timer_fn(unsigned long arg)
{
	int temp;
	pulse_status = OFF;
	temp = gpio_get_value(GPIO_TO_PIN(3,14));
	gpio_set_value(GPIO_TO_PIN(3,14), !temp);
	del_timer(&call_nurse_timer); 
}
Пример #3
0
//ÉêÇëGPIO¿Ú
void call_init(void)
{
	int result;
	result = gpio_request(GPIO_TO_PIN(3,14), "calldriver");
	if(result != 0)
		printk("gpio_request(3,14) failed \n");
	
	result = gpio_direction_output(GPIO_TO_PIN(3,14), 0);	
	if(result != 0)
		printk("gpio_direction(3,14) failed \n");
}
Пример #4
0
long nurse_call_ioctl( struct file *filp,unsigned int cmd, unsigned long v)
{
	
	switch(cmd)
	{
		case PULSE_ON :
		{
			call_status = PULSE_ON;	
			pulse_status = OFF;
			gpio_set_value(GPIO_TO_PIN(3,14), 0);			
		}	
		break;
		case PULSE_OFF :	
		{ 
			call_status = PULSE_OFF;
			pulse_status = OFF;
			gpio_set_value(GPIO_TO_PIN(3,14), 1);	
		}	
		break;	
		case CONTINUOUS_ON:	
		{	
			call_status = CONTINUOUS_ON;
			continuous_status = 0;
			gpio_set_value(GPIO_TO_PIN(3,14), 0);	
		}
		break;
		case CONTINUOUS_OFF:
		{
			call_status = CONTINUOUS_OFF;
			continuous_status = 1;
			gpio_set_value(GPIO_TO_PIN(3,14), 1);	
		}
		break;		
		case ALARM_ON:	
		{
			handle_alarm_task(ALARM_ON);
		}
		break;
		case ALARM_OFF:	
		{
			handle_alarm_task(ALARM_OFF);	
		}
		break;
				
		default:
			return -ENOTTY;
	}
	
	return 0;
}
Пример #5
0
static void pfla03_eth_init(void)
{
	int status;

	status = gpio_request(GPIO_TO_PIN(1, 22), "gpio1_22");
	if (status < 0)
		pr_warn("Failed to request gpio for rmii2_crs_dv\n");

	gpio_direction_output(GPIO_TO_PIN(1, 22), 1);

	setup_pin_mux(rgmii1_pin_mux);
	setup_pin_mux(rmii2_pin_mux);
	am33xx_cpsw_init(AM33XX_CPSW_MODE_RMII2_RGMII1, "0:02", "0:00");
	return;
}
Пример #6
0
static void _platform_spi_init(void)
{
    struct IOTK_CC3200_FH8610_MODULE_CONFIG spi_cfg;

    spi_cfg.delegate = _platform_spi_delegate;
    spi_cfg.use_dma = 1;
    spi_cfg.peripheral = PRCM_GSPI;
    spi_cfg.bitrate = CONFIG_SPI_BITRATE;
    spi_cfg.spi_transfer_timeout = CONFIG_SPI_TIMEOUT;
    spi_cfg.fh8610_power_gpio = GPIO_ACC_POWER;
    spi_cfg.fh8610_power_gpio_pin = GPIO_TO_PIN(GPIO_ACC_POWER);
    spi_cfg.fh8610_power_gpio_port = GPIOBase(GPIO_ACC_POWER);
    spi_cfg.fh8610_reset_gpio = GPIO_FH_RESET;
    spi_cfg.fh8610_reset_gpio_pin = GPIO_TO_PIN(GPIO_FH_RESET);
    spi_cfg.fh8610_reset_gpio_port = GPIOBase(GPIO_FH_RESET);
    spi_cfg.fh8610_reset_delay = 50;
    spi_cfg.fh8610_boot_delay = 1100;
    spi_cfg.fh8610_spi_cs_gpio_init_level = GPIO_FH_SPI_INIT_LEVEL;
    spi_cfg.fh8610_spi_cs_gpio_pin = GPIO_TO_PIN(GPIO_FH_SPI);
    spi_cfg.fh8610_spi_cs_gpio_port = GPIOBase(GPIO_FH_SPI);
    iotk_cc3200_fh8610_module_init(&spi_cfg);
    iotk_cc3200_fh8610_spi_enable();
}
	case 2:
		da850_max_speed = 408000;
		break;
	case 1:
		da850_max_speed = 372000;
		break;
	}

	return da850_register_cpufreq("pll0_sysclk3");
}
#else
static __init int da850_evm_init_cpufreq(void) { return 0; }
#endif

static struct i2c_gpio_platform_data da850_gpio_i2c_pdata = {
	.sda_pin	= GPIO_TO_PIN(1, 4),
	.scl_pin	= GPIO_TO_PIN(1, 5),
	.udelay		= 2,			/* 250 KHz */
};

static struct platform_device da850_gpio_i2c = {
	.name		= "i2c-gpio",
	.id		= 1,
	.dev		= {
		.platform_data	= &da850_gpio_i2c_pdata,
	},
};

/* Retaining these APIs, since the VPIF drivers do not check NULL handlers */
static int da850_set_vpif_clock(int mux_mode, int hd)
{
Пример #8
0
void handle_alarm_task(int alarm_switch)
{
	int temp;
	switch(call_status)
	{
		case PULSE_ON:
		{
			if(alarm_switch == ALARM_ON && pulse_status != ON)
			{
				pulse_status = ON;
			  temp = gpio_get_value(GPIO_TO_PIN(3,14));
			  gpio_set_value(GPIO_TO_PIN(3,14), !temp);
			  init_timer(&call_nurse_timer);
				call_nurse_timer.expires = jiffies + HZ;
				call_nurse_timer.function = call_timer_fn;
				add_timer(&call_nurse_timer);
			}
		}
		break;
		case PULSE_OFF:
		{
			if(alarm_switch == ALARM_ON && pulse_status != ON)
			{
				pulse_status = ON;
				temp = gpio_get_value(GPIO_TO_PIN(3,14));
			  gpio_set_value(GPIO_TO_PIN(3,14), !temp);
			  init_timer(&call_nurse_timer);
				call_nurse_timer.expires = jiffies + HZ;
				call_nurse_timer.function = call_timer_fn;
				add_timer(&call_nurse_timer);
			}
		}
		break;		
		case CONTINUOUS_ON:
		{
				temp = gpio_get_value(GPIO_TO_PIN(3,14));
				if(alarm_switch == ALARM_ON)
				{
					if(temp == continuous_status)
					{
				 		 gpio_set_value(GPIO_TO_PIN(3,14), !temp);						
					}	
				}
				else
				{
					if(temp != continuous_status)
					{
				 		 gpio_set_value(GPIO_TO_PIN(3,14), !temp);						
					}						
				}
	
		}
		break;	
		case CONTINUOUS_OFF:
		{
				temp = gpio_get_value(GPIO_TO_PIN(3,14));
				if(alarm_switch == ALARM_ON)
				{
					if(temp == continuous_status)
					{
				 		 gpio_set_value(GPIO_TO_PIN(3,14), !temp);						
					}	
				}
				else
				{
					if(temp != continuous_status)
					{
				 		 gpio_set_value(GPIO_TO_PIN(3,14), !temp);						
					}						
				}	
		}
		break;
		default:
		break;	
	}

}
Пример #9
0
	{NULL, 0},
};

/* pinmux for usb1 drvvbus */
static struct pinmux_config usb1_pin_mux[] = {
	{"usb1_drvvbus.usb1_drvvbus",	OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
	{"gpmc_csn2.gpio1_31",	OMAP_MUX_MODE7 | AM33XX_PULL_ENBL |
					AM33XX_PIN_INPUT_PULLUP},
	{NULL, 0},
};

static struct omap2_hsmmc_info am335x_mmc[] __initdata = {
	{
		.mmc		= 1,
		.caps		= MMC_CAP_4_BIT_DATA,
		.gpio_cd	= GPIO_TO_PIN(1, 17),
		.gpio_wp	= GPIO_TO_PIN(3, 18),
		.ocr_mask	= MMC_VDD_32_33 | MMC_VDD_33_34, /* 3V3 */
	},
	{}	/* Terminator */
};

static struct gpmc_timings am335x_nand_timings = {

/* granularity of 10 is sufficient because of calculations */
	.sync_clk = 0,

	.cs_on = 0,
	.cs_rd_off = 30,
	.cs_wr_off = 30,
	.rx_dma_offset	= 0x46000000,
	.op_mode	= DAVINCI_MCASP_IIS_MODE,
	.num_serializer	= ARRAY_SIZE(am335x_iis_serializer_direction1),
	.tdm_slots	= 2,
	.serial_dir	= am335x_iis_serializer_direction1,
	.asp_chan_q	= EVENTQ_2,
	.version	= MCASP_VERSION_3,
	.txnumevt	= 1,
	.rxnumevt	= 1,
};

static struct omap2_hsmmc_info am335x_mmc[] __initdata = {
	{
		.mmc            = 1,
		.caps           = MMC_CAP_4_BIT_DATA,
		.gpio_cd        = GPIO_TO_PIN(0, 6),
		.gpio_wp        = GPIO_TO_PIN(3, 18),
		.ocr_mask       = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3V3 */
	},
	{
		.mmc            = 0,	/* will be set at runtime */
	},
	{
		.mmc            = 0,	/* will be set at runtime */
	},
	{}      /* Terminator */
};


#ifdef CONFIG_OMAP_MUX
static struct omap_board_mux board_mux[] __initdata = {