void __init at91_add_device_nand(struct atmel_nand_data *data)
{
	unsigned long csa;

	if (!data)
		return;

	csa = at91_matrix_read(AT91_MATRIX_EBICSA);
	at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);

	/*            */
	if (gpio_is_valid(data->enable_pin))
		at91_set_gpio_output(data->enable_pin, 1);

	/*                */
	if (gpio_is_valid(data->rdy_pin))
		at91_set_gpio_input(data->rdy_pin, 1);

	/*                 */
	if (gpio_is_valid(data->det_pin))
		at91_set_gpio_input(data->det_pin, 1);

	at91_set_A_periph(AT91_PIN_PB4, 0);		/*        */
	at91_set_A_periph(AT91_PIN_PB5, 0);		/*        */

	nand_data = *data;
	platform_device_register(&atmel_nand_device);
}
Example #2
0
void __init at91_add_device_nand(struct atmel_nand_data *data)
{
	unsigned long csa;

	if (!data)
		return;

	csa = at91_matrix_read(AT91_MATRIX_EBICSA);
	at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);

	/* enable pin */
	if (gpio_is_valid(data->enable_pin))
		at91_set_gpio_output(data->enable_pin, 1);

	/* ready/busy pin */
	if (gpio_is_valid(data->rdy_pin))
		at91_set_gpio_input(data->rdy_pin, 1);

	/* card detect pin */
	if (gpio_is_valid(data->det_pin))
		at91_set_gpio_input(data->det_pin, 1);

	nand_data = *data;
	platform_device_register(&at91sam9260_nand_device);
}
void __init at91_add_device_cf(struct at91_cf_data *data)
{
	unsigned long ebi0_csa;
	struct platform_device *pdev;

	if (!data)
		return;

	/*
	 * assign CS4 or CS5 to SMC with Compact Flash logic support,
	 * we assume SMC timings are configured by board code,
	 * except True IDE where timings are controlled by driver
	 */
	ebi0_csa = at91_matrix_read(AT91_MATRIX_EBI0CSA);
	switch (data->chipselect) {
	case 4:
		at91_set_A_periph(AT91_PIN_PD6, 0);  /* EBI0_NCS4/CFCS0 */
		ebi0_csa |= AT91_MATRIX_EBI0_CS4A_SMC_CF1;
		cf0_data = *data;
		pdev = &cf0_device;
		break;
	case 5:
		at91_set_A_periph(AT91_PIN_PD7, 0);  /* EBI0_NCS5/CFCS1 */
		ebi0_csa |= AT91_MATRIX_EBI0_CS5A_SMC_CF2;
		cf1_data = *data;
		pdev = &cf1_device;
		break;
	default:
		printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
		       data->chipselect);
		return;
	}
	at91_matrix_write(AT91_MATRIX_EBI0CSA, ebi0_csa);

	if (gpio_is_valid(data->det_pin)) {
		at91_set_gpio_input(data->det_pin, 1);
		at91_set_deglitch(data->det_pin, 1);
	}

	if (gpio_is_valid(data->irq_pin)) {
		at91_set_gpio_input(data->irq_pin, 1);
		at91_set_deglitch(data->irq_pin, 1);
	}

	if (gpio_is_valid(data->vcc_pin))
		/* initially off */
		at91_set_gpio_output(data->vcc_pin, 0);

	/* enable EBI controlled pins */
	at91_set_A_periph(AT91_PIN_PD5, 1);  /* NWAIT */
	at91_set_A_periph(AT91_PIN_PD8, 0);  /* CFCE1 */
	at91_set_A_periph(AT91_PIN_PD9, 0);  /* CFCE2 */
	at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */

	pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "pata_at91" : "at91_cf";
	platform_device_register(pdev);
}
Example #4
0
static __init void cpu9krea_add_device_nor(void)
{
	unsigned long csa;

	csa = at91_matrix_read(AT91_MATRIX_EBICSA);
	at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_VDDIOMSEL_3_3V);

	/* configure chip-select 0 (NOR) */
	sam9_smc_configure(0, 0, &cpu9krea_nor_smc_config);

	platform_device_register(&cpu9krea_nor_flash);
}
void __init at91_add_device_cf(struct at91_cf_data *data)
{
	unsigned long ebi0_csa;
	struct platform_device *pdev;

	if (!data)
		return;

	ebi0_csa = at91_matrix_read(AT91_MATRIX_EBI0CSA);
	switch (data->chipselect) {
	case 4:
		at91_set_A_periph(AT91_PIN_PD6, 0);  
		ebi0_csa |= AT91_MATRIX_EBI0_CS4A_SMC_CF1;
		cf0_data = *data;
		pdev = &cf0_device;
		break;
	case 5:
		at91_set_A_periph(AT91_PIN_PD7, 0);  
		ebi0_csa |= AT91_MATRIX_EBI0_CS5A_SMC_CF2;
		cf1_data = *data;
		pdev = &cf1_device;
		break;
	default:
		printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
		       data->chipselect);
		return;
	}
	at91_matrix_write(AT91_MATRIX_EBI0CSA, ebi0_csa);

	if (gpio_is_valid(data->det_pin)) {
		at91_set_gpio_input(data->det_pin, 1);
		at91_set_deglitch(data->det_pin, 1);
	}

	if (gpio_is_valid(data->irq_pin)) {
		at91_set_gpio_input(data->irq_pin, 1);
		at91_set_deglitch(data->irq_pin, 1);
	}

	if (gpio_is_valid(data->vcc_pin))
		
		at91_set_gpio_output(data->vcc_pin, 0);

	
	at91_set_A_periph(AT91_PIN_PD5, 1);  
	at91_set_A_periph(AT91_PIN_PD8, 0);  
	at91_set_A_periph(AT91_PIN_PD9, 0);  
	at91_set_A_periph(AT91_PIN_PD14, 0); 

	pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "pata_at91" : "at91_cf";
	platform_device_register(pdev);
}
Example #6
0
void __init at91_add_device_cf(struct at91_cf_data *data)
{
	struct platform_device *pdev;
	unsigned long csa;

	if (!data)
		return;

	csa = at91_matrix_read(AT91_MATRIX_EBICSA);

	switch (data->chipselect) {
	case 4:
		at91_set_multi_drive(AT91_PIN_PC8, 0);
		at91_set_A_periph(AT91_PIN_PC8, 0);
		csa |= AT91_MATRIX_CS4A_SMC_CF1;
		cf0_data = *data;
		pdev = &cf0_device;
		break;
	case 5:
		at91_set_multi_drive(AT91_PIN_PC9, 0);
		at91_set_A_periph(AT91_PIN_PC9, 0);
		csa |= AT91_MATRIX_CS5A_SMC_CF2;
		cf1_data = *data;
		pdev = &cf1_device;
		break;
	default:
		printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
		       data->chipselect);
		return;
	}

	at91_matrix_write(AT91_MATRIX_EBICSA, csa);

	if (gpio_is_valid(data->rst_pin)) {
		at91_set_multi_drive(data->rst_pin, 0);
		at91_set_gpio_output(data->rst_pin, 1);
	}

	if (gpio_is_valid(data->irq_pin)) {
		at91_set_gpio_input(data->irq_pin, 0);
		at91_set_deglitch(data->irq_pin, 1);
	}

	if (gpio_is_valid(data->det_pin)) {
		at91_set_gpio_input(data->det_pin, 0);
		at91_set_deglitch(data->det_pin, 1);
	}

	at91_set_B_periph(AT91_PIN_PC6, 0);     /* CFCE1 */
	at91_set_B_periph(AT91_PIN_PC7, 0);     /* CFCE2 */
	at91_set_A_periph(AT91_PIN_PC10, 0);    /* CFRNW */
	at91_set_A_periph(AT91_PIN_PC15, 1);    /* NWAIT */

	if (data->flags & AT91_CF_TRUE_IDE)
#if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE)
		pdev->name = "pata_at91";
#else
#warning "board requires AT91_CF_TRUE_IDE: enable pata_at91"
#endif
	else
		pdev->name = "at91_cf";

	platform_device_register(pdev);
}