Esempio n. 1
0
/*
 * This needs re-working
 */
static int mcp_sa1100_init(void)
{
	struct mcp *mcp = &mcp_sa1100;
	int ret = -ENODEV;

	if (machine_is_adsbitsy()       || machine_is_assabet()        ||
	    machine_is_cerf()           || machine_is_flexanet()       ||
	    machine_is_freebird()       || machine_is_graphicsclient() ||
	    machine_is_graphicsmaster() || machine_is_lart()           ||
	    machine_is_omnimeter()      || machine_is_pfs168()         ||
	    machine_is_shannon()        || machine_is_simpad()         ||
	    machine_is_yopy()) {
		/*
		 * Setup the PPC unit correctly.
		 */
		PPDR &= ~PPC_RXD4;
		PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM;
		PSDR |= PPC_RXD4;
		PSDR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
		PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);

		Ser4MCSR = -1;
		Ser4MCCR1 = 0;
		Ser4MCCR0 = 0x00007f7f | MCCR0_ADM;

		/*
		 * Calculate the read/write timeout (us) from the bit clock
		 * rate.  This is the period for 3 64-bit frames.  Always
		 * round this time up.
		 */
		mcp->rw_timeout = (64 * 3 * 1000000 + mcp->sclk_rate - 1) /
				  mcp->sclk_rate;

		ret = mcp_register(mcp);
	}

	return ret;
}
/*
 * This configures the UCB1x00 layer depending on the machine type
 * we're running on.  The UCB1x00 drivers should not contain any
 * machine dependencies.
 *
 * We can get rid of some of these dependencies by using existing
 * facilities provided by the kernel - namely IRQ probing.  The
 * machine specific files are expected to setup the IRQ levels on
 * initialisation.  With any luck, we'll get rid of all the
 * machine dependencies here.
 */
static int __init ucb1x00_configure(struct ucb1x00 *ucb)
{
	unsigned int irq_gpio_pin = 0;
	int irq, default_irq = NO_IRQ;

	if (machine_is_adsbitsy())
		default_irq = IRQ_GPCIN4;

//	if (machine_is_assabet())
//		default_irq = IRQ_GPIO23;

#ifdef CONFIG_SA1100_CERF
	if (machine_is_cerf())
		default_irq = IRQ_GPIO_UCB1200_IRQ;
#endif
#ifdef CONFIG_SA1100_FREEBIRD
	if (machine_is_freebird())
		default_irq = IRQ_GPIO_FREEBIRD_UCB1300_IRQ;
#endif
#if defined(CONFIG_SA1100_GRAPHICSCLIENT) || defined(CONFIG_SA1100_GRAPICSMASTER)
	if (machine_is_graphicsclient() || machine_is_graphicsmaster())
		default_irq = ADS_EXT_IRQ(8);
#endif
#ifdef CONFIG_SA1100_LART
	if (machine_is_lart()) {
		default_irq = LART_IRQ_UCB1200;
		irq_gpio_pin = LART_GPIO_UCB1200;
	}
#endif
	if (machine_is_omnimeter())
		default_irq = IRQ_GPIO23;

#ifdef CONFIG_SA1100_PFS168
	if (machine_is_pfs168())
		default_irq = IRQ_GPIO_UCB1300_IRQ;
#endif
#ifdef CONFIG_SA1100_SIMPAD
	if (machine_is_simpad())
		default_irq = IRQ_GPIO_UCB1300_IRQ;
#endif
#ifdef CONFIG_SA1100_SIMPUTER
	if (machine_is_simputer()) {
		default_irq = IRQ_GPIO_UCB1300_IRQ;
		irq_gpio_pin = GPIO_UCB1300_IRQ;
    }
#endif
	if (machine_is_shannon())
		default_irq = SHANNON_IRQ_GPIO_IRQ_CODEC;
#ifdef CONFIG_SA1100_YOPY
	if (machine_is_yopy())
		default_irq = IRQ_GPIO_UCB1200_IRQ;
#endif
#ifdef CONFIG_SA1100_ACCELENT
	if (machine_is_accelent_sa()) {
		ucb->irq = IRQ_GPIO_UCB1200_IRQ;
		irq_gpio_pin = GPIO_UCB1200_IRQ;
	}
#endif

	/*
	 * Eventually, this will disappear.
	 */
	if (irq_gpio_pin)
		set_GPIO_IRQ_edge(irq_gpio_pin, GPIO_RISING_EDGE);

	irq = ucb1x00_detect_irq(ucb);
	if (irq != NO_IRQ) {
		if (default_irq != NO_IRQ && irq != default_irq)
			printk(KERN_ERR "UCB1x00: probed IRQ%d != default IRQ%d\n",
				irq, default_irq);
		if (irq == default_irq)
			printk(KERN_ERR "UCB1x00: probed IRQ%d correctly. "
				"Please remove machine dependencies from "
				"ucb1x00-core.c\n", irq);
		ucb->irq = irq;
	} else {
		printk(KERN_ERR "UCB1x00: IRQ probe failed, using IRQ%d\n",
			default_irq);
		ucb->irq = default_irq;
	}

	return ucb->irq == NO_IRQ ? -ENODEV : 0;
}