コード例 #1
0
static int __init hsi_ports_init(struct hsi_dev *hsi_ctrl)
{
	struct platform_device *pd = to_platform_device(hsi_ctrl->dev);
	struct hsi_platform_data *pdata = dev_get_platdata(hsi_ctrl->dev);
	struct hsi_port *hsi_p;
	unsigned int port;
	int err;

	for (port = 0; port < hsi_ctrl->max_p; port++) {
		hsi_p = &hsi_ctrl->hsi_port[port];
		hsi_p->flags = 0;
		hsi_p->port_number = pdata->ctx->pctx[port].port_number;
		hsi_p->hsi_controller = hsi_ctrl;
		hsi_p->max_ch = hsi_driver_device_is_hsi(pd) ?
		    HSI_CHANNELS_MAX : HSI_SSI_CHANNELS_MAX;
		hsi_p->irq = 0;
		hsi_p->wake_rx_3_wires_mode = 0; /* 4 wires */
		hsi_p->wake_3_wires_mode = 0; /* 4 wires */
		hsi_p->hsi_mode = 0x00;    //hsi_mode, bit0~31; 
		hsi_p->cawake_status = -1; /* Unknown */
		hsi_p->cawake_off_event = false;
		hsi_p->cawake_double_int = false;
		hsi_p->acwake_status = 0;
		hsi_p->in_int_tasklet = false;
		hsi_p->in_cawake_tasklet = false;
		hsi_p->counters_on = 1;
		hsi_p->reg_counters = pdata->ctx->pctx[port].hsr.counters;
		spin_lock_init(&hsi_p->lock);
		err = hsi_port_channels_init(hsi_p);
		if (err < 0)
			goto rback;
		err = hsi_request_mpu_irq(hsi_p);
		if (err < 0)
			goto rback;
		err = hsi_request_cawake_irq(hsi_p);
		if (err < 0)
			goto rback;
		dev_info(hsi_ctrl->dev, "HSI port %d initialized\n",
			 hsi_p->port_number);
	}
	return 0;
rback:
	hsi_ports_exit(hsi_ctrl, port + 1);
	return err;
}
コード例 #2
0
ファイル: hsi_driver.c プロジェクト: kapoloclubs/diana
static int __init hsi_ports_init(struct hsi_dev *hsi_ctrl)
{
	struct platform_device *pd = to_platform_device(hsi_ctrl->dev);
	struct hsi_platform_data *pdata = pd->dev.platform_data;
	struct hsi_port *hsi_p;
	unsigned int port;
	int err;

	for (port = 0; port < hsi_ctrl->max_p; port++) {
		hsi_p = &hsi_ctrl->hsi_port[port];
		hsi_p->port_number = port + 1;
		hsi_p->hsi_controller = hsi_ctrl;
		hsi_p->max_ch = hsi_driver_device_is_hsi(pd) ?
		    HSI_CHANNELS_MAX : HSI_SSI_CHANNELS_MAX;
		hsi_p->irq = 0;
		hsi_p->cawake_status = -1; /* Unknown */
		hsi_p->cawake_off_event = false;
		hsi_p->acwake_status = 0;
		hsi_p->in_int_tasklet = false;
		hsi_p->in_cawake_tasklet = false;
		hsi_p->counters_on = 1;
		hsi_p->reg_counters = pdata->ctx->pctx[port].hsr.counters;
		spin_lock_init(&hsi_p->lock);
		err = hsi_port_channels_init(&hsi_ctrl->hsi_port[port]);
		if (err < 0)
			goto rback1;
		err = hsi_request_mpu_irq(hsi_p);
		if (err < 0)
			goto rback2;
		err = hsi_request_cawake_irq(hsi_p);
		if (err < 0)
			goto rback3;
	}
	return 0;
rback3:
	hsi_mpu_exit(hsi_p);
rback2:
	hsi_ports_exit(hsi_ctrl, port + 1);
rback1:
	return err;
}
コード例 #3
0
static int __init hsi_ports_init(struct hsi_dev *hsi_ctrl)
{
	struct platform_device *pd = to_platform_device(hsi_ctrl->dev);
	struct hsi_platform_data *pdata = pd->dev.platform_data;
	struct hsi_port *hsi_p;
	unsigned int port;
	int err;

	for (port = 0; port < hsi_ctrl->max_p; port++) {
		hsi_p = &hsi_ctrl->hsi_port[port];
		hsi_p->port_number = port + 1;
		hsi_p->hsi_controller = hsi_ctrl;
		hsi_p->max_ch = hsi_driver_device_is_hsi(pd) ?
				HSI_CHANNELS_MAX : HSI_SSI_CHANNELS_MAX;
		hsi_p->max_ch = min(hsi_p->max_ch, (u8) HSI_PORT_MAX_CH);
		hsi_p->irq = 0;
		hsi_p->counters_on = 1;
		hsi_p->reg_counters = pdata->ctx.pctx[port].hsr.timeout;
		spin_lock_init(&hsi_p->lock);
		err = hsi_port_channels_init(&hsi_ctrl->hsi_port[port]);
		if (err < 0)
			goto rback1;
		err = hsi_request_mpu_irq(hsi_p);
		if (err < 0)
			goto rback2;
		err = hsi_request_cawake_irq(hsi_p);
		if (err < 0)
			goto rback3;
	}
	return 0;
rback3:
	hsi_mpu_exit(hsi_p);
rback2:
	hsi_ports_exit(hsi_ctrl, port + 1);
rback1:
	return err;
}