Пример #1
0
static int __init frodo_init_irq(void)
{
	set_GPIO_IRQ_edge (0x01 << GPIO_11_27_IRQ (FRODO_IDE_IRQ),GPIO_RISING_EDGE);
	set_GPIO_IRQ_edge (0x01 << GPIO_11_27_IRQ (FRODO_ETH_IRQ),GPIO_RISING_EDGE);
	set_GPIO_IRQ_edge (0x01 << GPIO_11_27_IRQ (FRODO_USB_DC_IRQ),GPIO_RISING_EDGE);
	set_GPIO_IRQ_edge (0x01 << GPIO_11_27_IRQ (FRODO_USB_HC_IRQ),GPIO_RISING_EDGE);
}
Пример #2
0
static int cerf_pcmcia_init(struct pcmcia_init *init)
{
	int i, res;

	if( pcmcia_debug)
		printk( KERN_INFO "cerf_pcmcia_init: enter\n");

	cerf_pcmcia_set_gpio_direction();

	set_GPIO_IRQ_edge( PCMCIA_GPIO_CF_IRQ_EDGE, GPIO_FALLING_EDGE );

	for (i = 0; i < ARRAY_SIZE(irqs); i++) {

		set_GPIO_IRQ_edge(irqs[i].gpio, GPIO_BOTH_EDGES);

		res = request_irq(irqs[i].irq, init->handler, SA_INTERRUPT,
				irqs[i].str, NULL);
		if (res)
			goto irq_err;
	}

	printk( KERN_INFO "PCMCIA for Cerf: OK\n");

	return CERF_SOCKET+1; /* last socket used +1 */

irq_err:
	printk(KERN_ERR "%s: Request for IRQ%d failed\n", 
		__FUNCTION__, irqs[i].irq);

	while (i--)
		free_irq(irqs[i].irq, NULL);

	return -1;
}
static int h3600_pcmcia_init(struct pcmcia_init *init)
{
	int i, res;

	/*
	 * Set transition detect
	 */
	set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_IRQ0 | GPIO_H3600_PCMCIA_IRQ1,
			  GPIO_FALLING_EDGE);

	set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_CD0 | GPIO_H3600_PCMCIA_CD1,
			  GPIO_NO_EDGES);

	/*
	 * Register interrupts
	 */
	for (i = res = 0; i < ARRAY_SIZE(irqs); i++) {
		res = request_irq(irqs[i].irq, init->handler, SA_INTERRUPT,
				  irqs[i].str, NULL);
		if (res)
			break;
	}

	if (res) {
		printk(KERN_ERR "h3600_pcmcia: request for IRQ%d failed: %d\n",
		       irqs[i].irq, res);

		while (i--)
			free_irq(irqs[i].irq, NULL);
	}

	return res ? -1 : 2;
}
static int h3600_pcmcia_socket_suspend(int sock)
{
	switch (sock) {
	case 0:
		set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_CD0, GPIO_NO_EDGES);
		break;
	case 1:
		set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_CD1, GPIO_NO_EDGES);
		break;
	}

	/*
	 * FIXME:  This doesn't fit well.  We don't have the mechanism in
	 * the generic PCMCIA layer to deal with the idea of two sockets
	 * on one bus.  We rely on the cs.c behaviour shutting down
	 * socket 0 then socket 1.
	 */
	if (sock == 1) {
		clr_h3600_egpio(IPAQ_EGPIO_OPT_ON);
		clr_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON);
		/* hmm, does this suck power? */
		set_h3600_egpio(IPAQ_EGPIO_OPT_RESET);
	}

	return 0;
}
static int stork_pcmcia_init(struct pcmcia_init *init)
{
        int irq, res;
        printk("in stork_pcmcia_init\n");

        sa1100_stork_pcmcia_init = *init;

	/* Set transition detect */
	set_GPIO_IRQ_edge( GPIO_STORK_PCMCIA_A_CARD_DETECT | GPIO_STORK_PCMCIA_B_CARD_DETECT, GPIO_NO_EDGES );
        set_GPIO_IRQ_edge( GPIO_STORK_PCMCIA_A_RDY| GPIO_STORK_PCMCIA_B_RDY, GPIO_FALLING_EDGE );

	/* Register interrupts */
	irq = IRQ_GPIO_STORK_PCMCIA_A_CARD_DETECT;
	res = request_irq( irq, init->handler, SA_INTERRUPT, "PCMCIA_CD0", NULL );
	if( res < 0 ) goto irq_err;
	irq = IRQ_GPIO_STORK_PCMCIA_B_CARD_DETECT;
	res = request_irq( irq, init->handler, SA_INTERRUPT, "PCMCIA_CD1", NULL );
	if( res < 0 ) goto irq_err;

        return 2;

 irq_err:
        printk( KERN_ERR __FUNCTION__ ": Request for IRQ %u failed\n", irq );
        return -1;
}
static int stork_pcmcia_socket_init(int sock)
{
        storkSetLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON);

        if (sock == 0)
		set_GPIO_IRQ_edge(GPIO_STORK_PCMCIA_A_CARD_DETECT, GPIO_BOTH_EDGES);
        else if (sock == 1)
		set_GPIO_IRQ_edge(GPIO_STORK_PCMCIA_B_CARD_DETECT, GPIO_BOTH_EDGES);

	return 0;
}
static int stork_pcmcia_socket_suspend(int sock)
{
        if (sock == 0)
		set_GPIO_IRQ_edge(GPIO_STORK_PCMCIA_A_CARD_DETECT, GPIO_NO_EDGES);
        else if (sock == 1) {
		set_GPIO_IRQ_edge(GPIO_STORK_PCMCIA_B_CARD_DETECT, GPIO_NO_EDGES);

		/*
		 * Hack!
		 */
	        storkClearLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON);
	}

	return 0;
}
static int h3600_stowaway_startup(struct skbd_state *skbd)
{
	unsigned long flags;
	int retval = 0;

	SFDEBUG(1,"\n");
	save_flags_cli(flags);

	h3600_stowaway_reset_comm();

	/* Direction registers */
	GPDR |= GPIO_H3600_COM_RTS;
	GPDR &= ~GPIO_H3600_COM_DCD;
	set_GPIO_IRQ_edge( GPIO_H3600_COM_DCD, GPIO_RISING_EDGE );

	/* Timer structure */
	init_timer(&skbd->timer);
	skbd->timer.function = h3600_stowaway_timer_callback;
	skbd->timer.data = (unsigned long) skbd;

	retval = request_irq(IRQ_GPIO_H3600_COM_DCD,
			     h3600_stowaway_handshake_interrupt,
			     SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
			     "Stowaway DCD", (void *)skbd);

	if ( !retval )
		retval = request_irq( IRQ_Ser3UART, 
				      h3600_stowaway_data_interrupt,
				      SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
				      "Stowaway data", (void *)skbd);
				      
	restore_flags(flags);
	return retval;
}
Пример #9
0
static void __init system3_init_irq(void)
{
	int irq;

	DPRINTK( "%s\n", "START" );

	/* SA1111 IRQ not routed to a GPIO. */
	sa1111_init_irq(-1);

	/* setup extra IRQs */
	irq = IRQ_SYSTEM3_SMC9196;
	irq_desc[irq].valid	= 1;
	irq_desc[irq].probe_ok	= 1;

#if 0
	/* Highspeed Serial Bus not yet used */
	irq = PT_USAR_IRQ;
	irq_desc[irq].valid	= 1;
	irq_desc[irq].probe_ok	= 1;
#endif

	/* IRQ by CPLD */
	set_GPIO_IRQ_edge( GPIO_GPIO(25), GPIO_RISING_EDGE );
	setup_arm_irq( IRQ_GPIO25, &system3_irq );
}
Пример #10
0
static int __init jornada720_init(void)
{
	GPDR |= GPIO_GPIO20;
	TUCR = JORTUCR_VAL;	/* set the oscillator out to the SA-1101 */

	GPSR = GPIO_GPIO20;
	udelay(1);
	GPCR = GPIO_GPIO20;
	udelay(1);
	GPSR = GPIO_GPIO20;
	udelay(20);
	SKCR = JORSKCR_INIT;	/* Turn on the PLL, enable Ready and enable nOE assertion from DC */
	mdelay(100);

	SBI_SKCR = JORSKCR_RCLK;/* turn on the RCLOCK */
	SBI_SMCR = 0x35;	/* initialize the SMC (debug SA-1111 reset */
	PCCR = 0;		/* initialize the S2MC (debug SA-1111 reset) */

	/* LDD4 is speaker, LDD3 is microphone */
	PPSR &= ~(PPC_LDD3 | PPC_LDD4);
	PPDR |= PPC_LDD3 | PPC_LDD4;

	/* initialize extra IRQs */
	set_GPIO_IRQ_edge(GPIO_GPIO1, GPIO_RISING_EDGE);
	sa1111_init_irq(IRQ_GPIO1);	/* chained on GPIO 1 */

	return 0;
}
Пример #11
0
static int __init assabet_init(void)
{
	if (!machine_is_assabet())
		return -EINVAL;

	/*
	 * Set the IRQ edges
	 */
	set_GPIO_IRQ_edge(GPIO_GPIO23, GPIO_RISING_EDGE);	/* UCB1300 */

	if (machine_has_neponset()) {
		/*
		 * Angel sets this, but other bootloaders may not.
		 *
		 * This must precede any driver calls to BCR_set()
		 * or BCR_clear().
		 */
		ASSABET_BCR = BCR_value = ASSABET_BCR_DB1111;
		NCR_0 = 0;

#ifndef CONFIG_ASSABET_NEPONSET
		printk( "Warning: Neponset detected but full support "
			"hasn't been configured in the kernel\n" );
#endif
	}

	return 0;
}
Пример #12
0
static void __init graphicsmaster_init_irq(void)
{
	int irq;

	/* First the standard SA1100 IRQs */
	sa1100_init_irq();

	/* disable all IRQs */
	ADS_INT_EN1 = 0;
	ADS_INT_EN2 = 0;
	/* clear all IRQs */
	ADS_INT_ST1 = 0xff;
	ADS_INT_ST2 = 0xff;

	for (irq = ADS_EXT_IRQ(0); irq <= ADS_EXT_IRQ(7); irq++) {
		irq_desc[irq].valid	= 1;
		irq_desc[irq].probe_ok	= 1;
		irq_desc[irq].mask_ack	= ADS_mask_and_ack_irq0;
		irq_desc[irq].mask	= ADS_mask_irq0;
		irq_desc[irq].unmask	= ADS_unmask_irq0;
	}
	for (irq = ADS_EXT_IRQ(8); irq <= ADS_EXT_IRQ(15); irq++) {
		irq_desc[irq].valid	= 1;
		irq_desc[irq].probe_ok	= 1;
		irq_desc[irq].mask_ack	= ADS_mask_and_ack_irq1;
		irq_desc[irq].mask	= ADS_mask_irq1;
		irq_desc[irq].unmask	= ADS_unmask_irq1;
	}
	set_GPIO_IRQ_edge(GPIO_GPIO0, GPIO_FALLING_EDGE);
	setup_arm_irq( IRQ_GPIO0, &ADS_ext_irq );
}
static void __init graphicsmaster_init_irq(void)
{
	int irq;

	/* First the standard SA1100 IRQs */
	sa1100_init_irq();

	/* disable all IRQs */
	ADS_INT_EN1 = 0;
	ADS_INT_EN2 = 0;
	/* clear all IRQs */
	ADS_INT_ST1 = 0xff;
	ADS_INT_ST2 = 0xff;

	for (irq = IRQ_GRAPHICSMASTER_START; irq < IRQ_GRAPHICSMASTER_UCB1200; irq++) {
		irq_desc[irq].valid	= 1;
		irq_desc[irq].probe_ok	= 1;
		irq_desc[irq].mask_ack	= ADS_mask_and_ack_irq0;
		irq_desc[irq].mask	= ADS_mask_irq0;
		irq_desc[irq].unmask	= ADS_unmask_irq0;
	}
	for (irq = IRQ_GRAPHICSMASTER_UCB1200; irq < IRQ_GRAPHICSMASTER_END; irq++) {
		irq_desc[irq].valid	= 1;
		irq_desc[irq].probe_ok	= 1;
		irq_desc[irq].mask_ack	= ADS_mask_and_ack_irq1;
		irq_desc[irq].mask	= ADS_mask_irq1;
		irq_desc[irq].unmask	= ADS_unmask_irq1;
	}

	GPDR &= ~GPIO_GPIO0;
	set_GPIO_IRQ_edge(GPIO_GPIO0, GPIO_FALLING_EDGE);
	setup_arm_irq( IRQ_GPIO0, &ADS_ext_irq );
}
Пример #14
0
static int h3600_uart_open(struct uart_port *port, struct uart_info *info)
{
    int ret = 0;

    if (port->mapbase == _Ser2UTCR0) {
        Ser2UTCR4 = UTCR4_HSE;
        Ser2HSCR0 = 0;
        Ser2HSSR0 = HSSR0_EIF | HSSR0_TUR |
                    HSSR0_RAB | HSSR0_FRE;
    } else if (port->mapbase == _Ser3UTCR0) {
        set_GPIO_IRQ_edge(GPIO_H3600_COM_DCD|GPIO_H3600_COM_CTS,
                          GPIO_BOTH_EDGES);

        ret = request_irq(IRQ_GPIO_H3600_COM_DCD, h3600_dcd_intr,
                          0, "RS232 DCD", info);
        if (ret)
            return ret;

        ret = request_irq(IRQ_GPIO_H3600_COM_CTS, h3600_cts_intr,
                          0, "RS232 CTS", info);
        if (ret)
            free_irq(IRQ_GPIO_H3600_COM_DCD, info);
    }
    return ret;
}
Пример #15
0
static void __init yopy_map_io(void)
{
	sa1100_map_io();
	iotable_init(yopy_io_desc);

	sa1100_register_uart(0, 3);

	set_GPIO_IRQ_edge(GPIO_UCB1200_IRQ, GPIO_RISING_EDGE);
}
Пример #16
0
static int h3600_pcmcia_socket_init(int sock)
{
	/* Enable CF bus: */
	set_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON);
	set_h3600_egpio(IPAQ_EGPIO_OPT_ON);
	clr_h3600_egpio(IPAQ_EGPIO_OPT_RESET);

	set_current_state(TASK_UNINTERRUPTIBLE);
	schedule_timeout(10*HZ / 1000);

	switch (sock) {
	case 0:
		set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_CD0, GPIO_BOTH_EDGES);
		break;
	case 1:
		set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_CD1, GPIO_BOTH_EDGES);
		break;
	}

	return 0;
}
Пример #17
0
static int cerf_pcmcia_init(struct pcmcia_init *init){
  int irq, res;

  set_GPIO_IRQ_edge( GPIO_CF_CD|GPIO_CF_BVD2|GPIO_CF_BVD1, GPIO_BOTH_EDGES );
  set_GPIO_IRQ_edge( GPIO_CF_IRQ, GPIO_FALLING_EDGE );

  irq = IRQ_GPIO_CF_CD;
  res = request_irq( irq, init->handler, SA_INTERRUPT, "CF_CD", NULL );
  if( res < 0 ) goto irq_err;
  irq = IRQ_GPIO_CF_BVD2;
  res = request_irq( irq, init->handler, SA_INTERRUPT, "CF_BVD2", NULL );
  if( res < 0 ) goto irq_err;
  irq = IRQ_GPIO_CF_BVD1;
  res = request_irq( irq, init->handler, SA_INTERRUPT, "CF_BVD1", NULL );
  if( res < 0 ) goto irq_err;

  return 2;

irq_err:
  printk(KERN_ERR "%s: Request for IRQ %u failed\n", __FUNCTION__, irq);
  return -1;
}
Пример #18
0
static void __init neponset_init_irq(void)
{
	sa1111_init_irq(-1);	/* SA1111 IRQ not routed to a GPIO */

	/* setup extra Neponset IRQs */
	irq_desc[IRQ_NEPONSET_SMC9196].valid	= 1;
	irq_desc[IRQ_NEPONSET_SMC9196].probe_ok	= 1;
	irq_desc[IRQ_NEPONSET_USAR].valid	= 1;
	irq_desc[IRQ_NEPONSET_USAR].probe_ok	= 1;

	set_GPIO_IRQ_edge(GPIO_GPIO25, GPIO_RISING_EDGE);
	setup_arm_irq(IRQ_GPIO25, &neponset_irq);
}
Пример #19
0
static int cerf_pcmcia_socket_suspend(int sock)
{
  int i;

  if( pcmcia_debug)
      printk( KERN_INFO "cerf_pcmcia_socket_suspend: sock=%d\n",sock);

  if (sock == CERF_SOCKET)
    for (i = 0; i < ARRAY_SIZE(irqs); i++)
      set_GPIO_IRQ_edge(irqs[i].gpio, GPIO_NO_EDGES);

  return 0;
}
Пример #20
0
static int __devinit navman_gps_cf_probe_sleeve(struct sleeve_dev *sleeve_dev,
        const struct sleeve_device_id *ent)
{
    serial_ioaddr = ioremap(0x30000000 + serial_port, PAGE_SIZE);
    if (1) printk(__FUNCTION__ ": %s serial_port=%x serial_ioaddr=%p\n",
                      sleeve_dev->driver->name, serial_port, serial_ioaddr);
    sa1100_h3600_pcmcia_change_sleeves(&h3600_single_sleeve_ops);

    GPDR &= ~GPIO_H3600_OPT_IRQ;    /* GPIO line as input */
    set_GPIO_IRQ_edge( GPIO_H3600_OPT_IRQ, GPIO_RISING_EDGE );  /* Rising edge */

    serial_line = setup_serial((ioaddr_t) serial_ioaddr,  serial_irq);
    return 0;
}
Пример #21
0
static int __init ttlio_init(void)
{
	printk(KERN_INFO "MT6N TTL-I/O driver (release %s)\n",
			TTLIO_VERSION);
	
	misc_register(&ttlio_dev);
	create_proc_read_entry ("driver/ttlio", 0, 0, ttlio_read_proc, NULL);

	set_GPIO_IRQ_edge(GPIO_TTLIO_IRQ, GPIO_FALLING_EDGE);
	if (request_irq(TTLIO_IRQ, ttlio_interrupt, SA_INTERRUPT, "ttlio irq", NULL)) {
		printk(KERN_ERR "ttlio: irq %d already in use\n", TTLIO_IRQ);
		return 1;
	}
	return 0;
}
static int pangolin_pcmcia_init(struct pcmcia_init *init){
  int irq, res;

#ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
  /* Enable PCMCIA bus: */
  GPCR = GPIO_PCMCIA_BUS_ON;
#endif

  /* Set transition detect */
  set_GPIO_IRQ_edge( GPIO_PCMCIA_CD, GPIO_BOTH_EDGES );
  set_GPIO_IRQ_edge( GPIO_PCMCIA_IRQ, GPIO_FALLING_EDGE );

  /* Register interrupts */
  irq = IRQ_PCMCIA_CD;
  res = request_irq( irq, init->handler, SA_INTERRUPT, "PCMCIA_CD", NULL );
  if( res < 0 ) goto irq_err;

  /* There's only one slot, but it's "Slot 1": */
  return 2;

irq_err:
  printk( KERN_ERR "%s: Request for IRQ %lu failed\n", __FUNCTION__, irq );
  return -1;
}
Пример #23
0
static void __init neponset_init_irq(void)
{
	int irq;

	sa1111_init_irq(-1);	/* SA1111 IRQ not routed to a GPIO */

	/* setup extra Neponset IRQs */
	irq = NEPONSET_ETHERNET_IRQ;
	irq_desc[irq].valid	= 1;
	irq_desc[irq].probe_ok	= 1;
	irq = NEPONSET_USAR_IRQ;
	irq_desc[irq].valid	= 1;
	irq_desc[irq].probe_ok	= 1;
	set_GPIO_IRQ_edge(ASSABET_GPIO_NEP_IRQ, GPIO_RISING_EDGE);
	setup_arm_irq(ASSABET_IRQ_GPIO_NEP_IRQ, &neponset_irq);
}
Пример #24
0
static void __init simpad_map_io(void)
{
	sa1100_map_io();
	iotable_init(simpad_io_desc);

	PSPR = 0xc0008000;
	GPDR &= ~GPIO_GPIO0;
	cs3_shadow = (EN1 | EN0 | LED2_ON | DISPLAY_ON | RS232_ON | 
		      ENABLE_5V | RESET_SIMCARD);
	*(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow;

	//It is only possible to register 3 UART in serial_sa1100.c
	sa1100_register_uart(0, 3);
	sa1100_register_uart(1, 1);

	set_GPIO_IRQ_edge(GPIO_UCB1300_IRQ);
}
Пример #25
0
static __init int pfs168_spi_init(void)
{
	printk (KERN_INFO "PFS-168 SA-1110 SPI Driver v1.1\n");
	pfs168_spi_init_dev();
	misc_register(&pfs168_spi_dev);
	rxq = (struct pfs168_spi_queue *) kmalloc(sizeof(*rxq), GFP_KERNEL);
	memset(rxq, 0, sizeof(*rxq));
	rxq->head = rxq->tail = 0;
	rxq->buf = rxq_buf;
	init_waitqueue_head(&rxq->proc_list);
	txq = (struct pfs168_spi_queue *) kmalloc(sizeof(*txq), GFP_KERNEL);
	memset(txq, 0, sizeof(*txq));
	txq->head = txq->tail = 0;
	txq->buf = txq_buf;
	set_GPIO_IRQ_edge(GPIO_GPIO(14), GPIO_RISING_EDGE);
	return 0;
}
Пример #26
0
void apollo_init_irq(void) {
  int rqstatus;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
  set_irq_type(IRQ_GPIO(83), IRQT_FALLING);
#else
  set_GPIO_IRQ_edge(83, GPIO_FALLING_EDGE);
  printk("SET FALLING EDGE 2.4 style done\n");
#endif

  rqstatus = request_irq(IRQ_GPIO(83), eink_irq_hdl, SA_INTERRUPT, "einkfb", NULL);
  do_debug("rqstatus %d irq %d\n", rqstatus, IRQ_GPIO(83));

  disable_irq(IRQ_GPIO(83)); /* initially disable irq.  we will use it 
                                only for longer waits to avoid prolonged 
                                spinning */
  do_debug("DISABLE_IRQ done\n");
}
Пример #27
0
/**
 * monitor_request_irq
 */
int monitor_request_irq(void)
{
#if defined(CONFIG_SA1100_USBCABLE_GPIO)
    int rc;

    printk(KERN_DEBUG"monitor_request_irq: %d %d\n", 
            CONFIG_SA1100_USBCABLE_GPIO, SA1100_GPIO_TO_IRQ(CONFIG_SA1100_USBCABLE_GPIO));

    if ((rc = request_irq(SA1100_GPIO_TO_IRQ(CONFIG_SA1100_USBCABLE_GPIO), 
                    monitor_int_hndlr, SA_SHIRQ, "USBD Monitor", &monitor))) 
    {
        printk(KERN_DEBUG"monitor_request_irq: failed: %d\n", rc);
        return -EINVAL;
    }
    GPDR &= ~GPIO_GPIO(CONFIG_SA1100_USBCABLE_GPIO);
    set_GPIO_IRQ_edge(GPIO_GPIO(CONFIG_SA1100_USBCABLE_GPIO), GPIO_BOTH_EDGES);
#endif
    return 0;
}
Пример #28
0
/*
 * h3600ts_connect() is the routine that is called when someone adds a
 * new serio device that supports H3600 protocol and registers it as
 * an input device.
 */
static int h3600ts_connect(struct serio *serio, struct serio_driver *drv)
{
	struct h3600_dev *ts;
	struct input_dev *input_dev;
	int err;

	ts = kzalloc(sizeof(struct h3600_dev), GFP_KERNEL);
	input_dev = input_allocate_device();
	if (!ts || !input_dev) {
		err = -ENOMEM;
		goto fail1;
	}

	ts->serio = serio;
	ts->dev = input_dev;
	snprintf(ts->phys, sizeof(ts->phys), "%s/input0", serio->phys);

	input_dev->name = "H3600 TouchScreen";
	input_dev->phys = ts->phys;
	input_dev->id.bustype = BUS_RS232;
	input_dev->id.vendor = SERIO_H3600;
	input_dev->id.product = 0x0666;  /* FIXME !!! We can ask the hardware */
	input_dev->id.version = 0x0100;
	input_dev->dev.parent = &serio->dev;

	input_set_drvdata(input_dev, ts);

	input_dev->event = h3600ts_event;

	input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) |
		BIT_MASK(EV_LED) | BIT_MASK(EV_PWR);
	input_dev->ledbit[0] = BIT_MASK(LED_SLEEP);
	input_set_abs_params(input_dev, ABS_X, 60, 985, 0, 0);
	input_set_abs_params(input_dev, ABS_Y, 35, 1024, 0, 0);

	set_bit(KEY_RECORD, input_dev->keybit);
	set_bit(KEY_Q, input_dev->keybit);
	set_bit(KEY_PROG1, input_dev->keybit);
	set_bit(KEY_PROG2, input_dev->keybit);
	set_bit(KEY_PROG3, input_dev->keybit);
	set_bit(KEY_UP, input_dev->keybit);
	set_bit(KEY_RIGHT, input_dev->keybit);
	set_bit(KEY_LEFT, input_dev->keybit);
	set_bit(KEY_DOWN, input_dev->keybit);
	set_bit(KEY_ENTER, input_dev->keybit);
	set_bit(KEY_SUSPEND, input_dev->keybit);
	set_bit(BTN_TOUCH, input_dev->keybit);

	/* Device specific stuff */
	set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES);
	set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE);

	if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler,
			IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) {
		printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n");
		err = -EBUSY;
		goto fail2;
	}

	if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler,
			IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) {
		printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n");
		err = -EBUSY;
		goto fail3;
	}

	serio_set_drvdata(serio, ts);

	err = serio_open(serio, drv);
	if (err)
		return err;

	//h3600_flite_control(1, 25);     /* default brightness */
	input_register_device(ts->dev);

	return 0;

fail3:	free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev);
fail2:	free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev);
fail1:	serio_set_drvdata(serio, NULL);
	input_free_device(input_dev);
	kfree(ts);
	return err;
}
Пример #29
0
static int __init adsbitsy_init(void)
{
	int ret;

	if (!machine_is_adsbitsy())
		return -ENODEV;

	/*
	 * Ensure that the memory bus request/grant signals are setup,
	 * and the grant is held in its inactive state
	 */
	sa1110_mb_disable();

	/* Bitsy uses GPIO pins for SPI interface to AVR
	 * Bitsy Plus uses the standard pins instead.
	 * it also needs to reset the AVR when booting
	 */

	PPAR |= PPAR_SSPGPIO;

	/*
	 * Reset SA1111
	 */
	GPCR |= GPIO_GPIO26;
	udelay(1000);
	GPSR |= GPIO_GPIO26;


#ifndef CONFIG_LEDS_TIMER
	// Set Serial port 1 RTS and DTR Low during sleep
	PGSR |= GPIO_GPIO15 | GPIO_GPIO20;
#else
	// only RTS (because DTR is also the LED
	// which should be off during sleep);
	PGSR |= GPIO_GPIO15;
#endif

	// Set Serial port 3RTS Low during sleep
	PGSR |= GPIO_GPIO19;

	/*
	 * Probe for SA1111.
	 */
	ret = sa1111_probe(ADSBITSY_SA1111_BASE);
	if (ret < 0)
		return ret;

	/*
	 * We found it.  Wake the chip up.
	 */
	sa1111_wake();

	/*
	 * The SDRAM configuration of the SA1110 and the SA1111 must
	 * match.  This is very important to ensure that SA1111 accesses
	 * don't corrupt the SDRAM.  Note that this ungates the SA1111's
	 * MBGNT signal, so we must have called sa1110_mb_disable()
	 * beforehand.
	 */
	sa1111_configure_smc(1,
			     FExtr(MDCNFG, MDCNFG_SA1110_DRAC0),
			     FExtr(MDCNFG, MDCNFG_SA1110_TDL0));

	/*
	 * We only need to turn on DCLK whenever we want to use the
	 * DMA.  It can otherwise be held firmly in the off position.
	 */
	SKPCR |= SKPCR_DCLKEN;

	/*
	 * Enable the SA1110 memory bus request and grant signals.
	 */
	sa1110_mb_enable();

	set_GPIO_IRQ_edge(GPIO_GPIO0, GPIO_RISING_EDGE);
	sa1111_init_irq(IRQ_GPIO0);

	return 0;
}
Пример #30
0
/*****************************************************************
 *
 * Function Name: init_irq
 *
 * This function is board specific.  It sets up the interrupt to 
 * be an edge trigger and trigger on the rising edge  
 *
 * Input: none 
 *
 * Return value  : none 
 *                
 *****************************************************************/
void init_irq (void)
{
	GPDR &= ~(1 << 13);
	set_GPIO_IRQ_edge (1 << 13, GPIO_RISING_EDGE);
}