void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) { int i; if (!data) return; /* Enable VBus control for UHP ports */ for (i = 0; i < data->ports; i++) { if (gpio_is_valid(data->vbus_pin[i])) at91_set_gpio_output(data->vbus_pin[i], data->vbus_pin_active_low[i]); } usbh_ehci_data = *data; platform_device_register(&at91_usbh_ehci_device); }
void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) { int i; unsigned long cs_pin; short enable_spi0 = 0; short enable_spi1 = 0; /* Choose SPI chip-selects */ for (i = 0; i < nr_devices; i++) { if (devices[i].controller_data) cs_pin = (unsigned long) devices[i].controller_data; else if (devices[i].bus_num == 0) cs_pin = spi0_standard_cs[devices[i].chip_select]; else cs_pin = spi1_standard_cs[devices[i].chip_select]; if (devices[i].bus_num == 0) enable_spi0 = 1; else enable_spi1 = 1; /* enable chip-select pin */ at91_set_gpio_output(cs_pin, 1); /* pass chip-select pin to driver */ devices[i].controller_data = (void *) cs_pin; } spi_register_board_info(devices, nr_devices); /* Configure SPI bus(es) */ if (enable_spi0) { at91_set_A_periph(AT91_PIN_PB0, 0); /* SPI0_MISO */ at91_set_A_periph(AT91_PIN_PB1, 0); /* SPI0_MOSI */ at91_set_A_periph(AT91_PIN_PB2, 0); /* SPI0_SPCK */ platform_device_register(&at91sam9g45_spi0_device); } if (enable_spi1) { at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_MISO */ at91_set_A_periph(AT91_PIN_PB15, 0); /* SPI1_MOSI */ at91_set_A_periph(AT91_PIN_PB16, 0); /* SPI1_SPCK */ platform_device_register(&at91sam9g45_spi1_device); } }
void __init at91_add_device_ac97(struct atmel_ac97_data *data) { if (!data) return; at91_set_A_periph(AT91_PIN_PB0, 0); /* AC97FS */ at91_set_A_periph(AT91_PIN_PB1, 0); /* AC97CK */ at91_set_A_periph(AT91_PIN_PB2, 0); /* AC97TX */ at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */ /* reset */ if (data->reset_pin) at91_set_gpio_output(data->reset_pin, 0); ac97_data = *data; platform_device_register(&at91sam9263_ac97_device); }
void __init at91_add_device_ac97(struct ac97c_platform_data *data) { if (!data) return; at91_set_A_periph(AT91_PIN_PD8, 0); /* AC97FS */ at91_set_A_periph(AT91_PIN_PD9, 0); /* AC97CK */ at91_set_A_periph(AT91_PIN_PD7, 0); /* AC97TX */ at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */ /* reset */ if (gpio_is_valid(data->reset_pin)) at91_set_gpio_output(data->reset_pin, 0); ac97_data = *data; platform_device_register(&at91sam9g45_ac97_device); }
void __init at91_add_device_ac97(struct ac97c_platform_data *data) { if (!data) return; at91_set_A_periph(AT91_PIN_PA6, 0); /* AC97FS */ at91_set_A_periph(AT91_PIN_PA7, 0); /* AC97CK */ at91_set_A_periph(AT91_PIN_PA8, 0); /* AC97TX */ at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */ /* reset */ if (data->reset_pin) at91_set_gpio_output(data->reset_pin, 0); ac97_data = *data; platform_device_register(&at91cap9_ac97_device); }
void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) { int i; if (!data) return; /* Enable VBus control for UHP ports */ for (i = 0; i < data->ports; i++) { if (data->vbus_pin[i]) at91_set_gpio_output(data->vbus_pin[i], 0); } usbh_ehci_data = *data; at91_clock_associate("uhphs_clk", &at91_usbh_ehci_device.dev, "ehci_clk"); platform_device_register(&at91_usbh_ehci_device); }
void __init at91_add_device_ac97(struct ac97c_platform_data *data) { if (!data) return; at91_set_A_periph(AT91_PIN_PD1, 0); at91_set_A_periph(AT91_PIN_PD2, 0); at91_set_A_periph(AT91_PIN_PD3, 0); at91_set_A_periph(AT91_PIN_PD4, 0); if (gpio_is_valid(data->reset_pin)) at91_set_gpio_output(data->reset_pin, 0); ac97_data = *data; platform_device_register(&at91sam9rl_ac97_device); }
void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) { int i; if (!data) return; /* Enable VBus control for UHP ports */ for (i = 0; i < data->ports; i++) { if (gpio_is_valid(data->vbus_pin[i])) at91_set_gpio_output(data->vbus_pin[i], data->vbus_pin_active_low[i]); } add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9261_UHP_BASE, 1024 * 1024, IORESOURCE_MEM, data); }
void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) { if (!data) return; /* */ 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->wp_pin)) at91_set_gpio_input(data->wp_pin, 1); if (gpio_is_valid(data->vcc_pin)) at91_set_gpio_output(data->vcc_pin, 0); /* */ at91_set_A_periph(AT91_PIN_PA8, 0); if (data->slot_b) { /* */ at91_set_B_periph(AT91_PIN_PA1, 1); /* */ at91_set_B_periph(AT91_PIN_PA0, 1); if (data->wire4) { at91_set_B_periph(AT91_PIN_PA5, 1); at91_set_B_periph(AT91_PIN_PA4, 1); at91_set_B_periph(AT91_PIN_PA3, 1); } } else { /* */ at91_set_A_periph(AT91_PIN_PA7, 1); /* */ at91_set_A_periph(AT91_PIN_PA6, 1); if (data->wire4) { at91_set_A_periph(AT91_PIN_PA9, 1); at91_set_A_periph(AT91_PIN_PA10, 1); at91_set_A_periph(AT91_PIN_PA11, 1); } } mmc_data = *data; platform_device_register(&at91sam9260_mmc_device); }
void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) { if (!data) return; /* input/irq */ 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->wp_pin)) at91_set_gpio_input(data->wp_pin, 1); if (gpio_is_valid(data->vcc_pin)) at91_set_gpio_output(data->vcc_pin, 0); /* CLK */ at91_set_A_periph(AT91_PIN_PA27, 0); if (data->slot_b) { /* CMD */ at91_set_B_periph(AT91_PIN_PA8, 1); /* DAT0, maybe DAT1..DAT3 */ at91_set_B_periph(AT91_PIN_PA9, 1); if (data->wire4) { at91_set_B_periph(AT91_PIN_PA10, 1); at91_set_B_periph(AT91_PIN_PA11, 1); at91_set_B_periph(AT91_PIN_PA12, 1); } } else { /* CMD */ at91_set_A_periph(AT91_PIN_PA28, 1); /* DAT0, maybe DAT1..DAT3 */ at91_set_A_periph(AT91_PIN_PA29, 1); if (data->wire4) { at91_set_B_periph(AT91_PIN_PB3, 1); at91_set_B_periph(AT91_PIN_PB4, 1); at91_set_B_periph(AT91_PIN_PB5, 1); } } mmc_data = *data; platform_device_register(&at91rm9200_mmc_device); }
resource_size_t __init at91_configure_usart0(unsigned pins) { at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */ at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */ if (pins & ATMEL_UART_CTS) at91_set_A_periph(AT91_PIN_PA20, 0); /* CTS0 */ if (pins & ATMEL_UART_RTS) { /* * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21. * We need to drive the pin manually. Default is off (RTS is active low). */ at91_set_gpio_output(AT91_PIN_PA21, 1); } return AT91RM9200_BASE_US0; }
void coloured_LED_init(void) { /* Enable clock */ at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_PIOABCD); at91_set_gpio_output(CONFIG_RED_LED, 1); at91_set_gpio_output(CONFIG_GREEN_LED, 1); at91_set_gpio_output(CONFIG_YELLOW_LED, 1); at91_set_gpio_output(CONFIG_RED_LED, 0); at91_set_gpio_output(CONFIG_GREEN_LED, 1); at91_set_gpio_output(CONFIG_YELLOW_LED, 1); }
void __init at91_add_device_usbh(struct at91_usbh_data *data) { int i; if (!data) return; if (cpu_is_at91cap9_revB()) irq_set_irq_type(AT91CAP9_ID_UHP, IRQ_TYPE_LEVEL_HIGH); /* Enable VBus control for UHP ports */ for (i = 0; i < data->ports; i++) { if (data->vbus_pin[i]) at91_set_gpio_output(data->vbus_pin[i], 0); } usbh_data = *data; platform_device_register(&at91_usbh_device); }
void __init at91_add_device_nand(struct at91_nand_data *data) { unsigned long csa, mode; if (!data) return; csa = at91_sys_read(AT91_MATRIX_EBICSA); at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC); /* set the bus interface characteristics */ at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5) | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5)); at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7)); if (data->bus_width_16) mode = AT91_SMC_DBW_16; else mode = AT91_SMC_DBW_8; at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1)); /* enable pin */ if (data->enable_pin) at91_set_gpio_output(data->enable_pin, 1); /* ready/busy pin */ if (data->rdy_pin) at91_set_gpio_input(data->rdy_pin, 1); /* card detect pin */ if (data->det_pin) at91_set_gpio_input(data->det_pin, 1); at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */ at91_set_A_periph(AT91_PIN_PC1, 0); /* NANDWE */ nand_data = *data; platform_device_register(&at91_nand_device); }
static void __init bf_board_init(void) { /* Serial */ at91_add_device_serial(); /* Ethernet */ at91_add_device_eth(&bf_eth_data); /* USB Host */ at91_add_device_usbh(&bf_usbh_data); /* USB Device */ at91_add_device_udc(&bf_udc_data); at91_set_multi_drive(bf_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */ /* I2C */ at91_add_device_i2c(bf_i2c_devices,ARRAY_SIZE(bf_i2c_devices)); /* SPI */ at91_add_device_spi(bf_spi_devices, ARRAY_SIZE(bf_spi_devices)); /* MMC */ at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ at91_add_device_mmc(0, &bf_mmc_data); }
static void __init ek_add_device_dm9000(void) { /* * Configure Chip-Select 2 on SMC for the DM9000. * Note: These timings were calculated for MASTER_CLOCK = 100000000 * according to the DM9000 timings. */ at91_sys_write(AT91_SMC_SETUP(2), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0) | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0)); at91_sys_write(AT91_SMC_PULSE(2), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(8) | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(8)); at91_sys_write(AT91_SMC_CYCLE(2), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16)); at91_sys_write(AT91_SMC_MODE(2), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1)); /* Configure Reset signal as output */ at91_set_gpio_output(AT91_PIN_PC10, 0); /* Configure Interrupt pin as input, no pull-up */ at91_set_gpio_input(AT91_PIN_PC11, 0); platform_device_register(&at91sam9261_dm9000_device); }
static void __init yl_9200_add_device_buttons(void) { //SW2 at91_set_gpio_input(AT91_PIN_PA24, 0); at91_set_deglitch(AT91_PIN_PA24, 1); //SW3 at91_set_gpio_input(AT91_PIN_PB1, 0); at91_set_deglitch(AT91_PIN_PB1, 1); //SW4 at91_set_gpio_input(AT91_PIN_PB2, 0); at91_set_deglitch(AT91_PIN_PB2, 1); //SW5 at91_set_gpio_input(AT91_PIN_PB6, 0); at91_set_deglitch(AT91_PIN_PB6, 1); at91_set_gpio_output(AT91_PIN_PB7, 1); /* #TURN BUTTONS ON, SHEET 5 of schematics */ platform_device_register(&yl_9200_button_device); }
static int mmccpu_devices_init(void) { /* * PB27 enables the 50MHz oscillator for Ethernet PHY * 1 - enable * 0 - disable */ at91_set_gpio_output(AT91_PIN_PB27, 1); at91_set_gpio_value(AT91_PIN_PB27, 1); /* 1- enable, 0 - disable */ at91_add_device_eth(&macb_pdata); add_cfi_flash_device(0, AT91_CHIPSELECT_0, 0, 0); devfs_add_partition("nor0", 0x00000, 256 * 1024, PARTITION_FIXED, "self0"); devfs_add_partition("nor0", 0x40000, 128 * 1024, PARTITION_FIXED, "env0"); armlinux_set_bootparams((void *)(AT91_CHIPSELECT_1 + 0x100)); armlinux_set_architecture(MACH_TYPE_MMCCPU); return 0; }
static void __init rsi_ews_board_init(void) { /* */ at91_add_device_serial(); at91_set_gpio_output(AT91_PIN_PA21, 0); /* */ at91_add_device_eth(&rsi_ews_eth_data); /* */ at91_add_device_usbh(&rsi_ews_usbh_data); /* */ at91_add_device_i2c(rsi_ews_i2c_devices, ARRAY_SIZE(rsi_ews_i2c_devices)); /* */ at91_add_device_spi(rsi_ews_spi_devices, ARRAY_SIZE(rsi_ews_spi_devices)); /* */ at91_add_device_mmc(0, &rsi_ews_mmc_data); /* */ platform_device_register(&rsiews_nor_flash); /* */ at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds)); }
/* * Init Func */ static void __init rsi_ews_board_init(void) { /* Serial */ at91_add_device_serial(); at91_set_gpio_output(AT91_PIN_PA21, 0); /* Ethernet */ at91_add_device_eth(&rsi_ews_eth_data); /* USB Host */ at91_add_device_usbh(&rsi_ews_usbh_data); /* I2C */ at91_add_device_i2c(rsi_ews_i2c_devices, ARRAY_SIZE(rsi_ews_i2c_devices)); /* SPI */ at91_add_device_spi(rsi_ews_spi_devices, ARRAY_SIZE(rsi_ews_spi_devices)); /* MMC */ at91_add_device_mmc(0, &rsi_ews_mmc_data); /* NOR Flash */ platform_device_register(&rsiews_nor_flash); /* LEDs */ at91_gpio_leds(rsi_ews_leds, ARRAY_SIZE(rsi_ews_leds)); }
static void at91sam9261ek_nand_hw_init(void) { unsigned long csa; /* Enable CS3 */ csa = at91_sys_read(AT91_MATRIX_EBICSA); at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); /* Configure SMC CS3 for NAND/SmartMedia */ at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0)); at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3)); at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5)); at91_sys_write(AT91_SMC_MODE(3), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | #ifdef CFG_NAND_DBW_16 AT91_SMC_DBW_16 | #else /* CFG_NAND_DBW_8 */ AT91_SMC_DBW_8 | #endif AT91_SMC_TDF_(2)); at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_PIOC); /* Configure RDY/BSY */ at91_set_gpio_input(AT91_PIN_PC15, 1); /* Enable NandFlash */ at91_set_gpio_output(AT91_PIN_PC14, 1); at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */ at91_set_A_periph(AT91_PIN_PC1, 0); /* NANDWE */ }
static void sbc35_a9g20_nand_hw_init(void) { struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC; struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX; unsigned long csa; /* Enable CS3 */ csa = readl(&matrix->ebicsa); csa |= AT91_MATRIX_CS3A_SMC_SMARTMEDIA; writel(csa, &matrix->ebicsa); /* Configure SMC CS3 for NAND/SmartMedia */ writel(AT91_SMC_SETUP_NWE(1) | AT91_SMC_SETUP_NCS_WR(0) | AT91_SMC_SETUP_NRD(1) | AT91_SMC_SETUP_NCS_RD(0), &smc->cs[3].setup); writel(AT91_SMC_PULSE_NWE(3) | AT91_SMC_PULSE_NCS_WR(3) | AT91_SMC_PULSE_NRD(3) | AT91_SMC_PULSE_NCS_RD(3), &smc->cs[3].pulse); writel(AT91_SMC_CYCLE_NWE(5) | AT91_SMC_CYCLE_NRD(5), &smc->cs[3].cycle); writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE | AT91_SMC_MODE_EXNW_DISABLE | #ifdef CONFIG_SYS_NAND_DBW_16 AT91_SMC_MODE_DBW_16 | #else /* CONFIG_SYS_NAND_DBW_8 */ AT91_SMC_MODE_DBW_8 | #endif AT91_SMC_MODE_TDF_CYCLE(2), &smc->cs[3].mode); writel(1 << ATMEL_ID_PIOC, &pmc->pcer); /* Configure RDY/BSY */ at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1); /* Enable NandFlash */ at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); }
void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) { int i; if (!data) return; /* Enable VBus control for UHP ports */ for (i = 0; i < data->ports; i++) { if (gpio_is_valid(data->vbus_pin[i])) at91_set_gpio_output(data->vbus_pin[i], 0); } /* Enable overcurrent notification */ for (i = 0; i < data->ports; i++) { if (data->overcurrent_pin[i]) at91_set_gpio_input(data->overcurrent_pin[i], 1); } usbh_ohci_data = *data; platform_device_register(&at91_usbh_ohci_device); }
static void __init neocore926_board_init(void) { /* Serial */ at91_add_device_serial(); /* USB Host */ at91_add_device_usbh(&neocore926_usbh_data); /* USB Device */ at91_add_device_udc(&neocore926_udc_data); /* SPI */ at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */ at91_add_device_spi(neocore926_spi_devices, ARRAY_SIZE(neocore926_spi_devices)); /* Touchscreen */ neocore926_add_device_ts(); /* MMC */ at91_add_device_mmc(1, &neocore926_mmc_data); /* Ethernet */ at91_add_device_eth(&neocore926_macb_data); /* NAND */ neocore926_add_device_nand(); /* I2C */ at91_add_device_i2c(NULL, 0); /* LCD Controller */ at91_add_device_lcdc(&neocore926_lcdc_data); /* Push Buttons */ neocore926_add_device_buttons(); /* AC97 */ at91_add_device_ac97(&neocore926_ac97_data); }
void at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata) { int i; int cs_pin; resource_size_t start = ~0; BUG_ON(spi_id > 1); if (!pdata) pdata = &spi_pdata[spi_id]; for (i = 0; i < pdata->num_chipselect; i++) { cs_pin = pdata->chipselect[i]; /* enable chip-select pin */ if (cs_pin > 0) at91_set_gpio_output(cs_pin, 1); } /* Configure SPI bus(es) */ switch (spi_id) { case 0: start = AT91SAM9G45_BASE_SPI0; at91_set_A_periph(AT91_PIN_PB0, 0); /* SPI0_MISO */ at91_set_A_periph(AT91_PIN_PB1, 0); /* SPI0_MOSI */ at91_set_A_periph(AT91_PIN_PB2, 0); /* SPI0_SPCK */ break; case 1: start = AT91SAM9G45_BASE_SPI1; at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_MISO */ at91_set_A_periph(AT91_PIN_PB15, 0); /* SPI1_MOSI */ at91_set_A_periph(AT91_PIN_PB16, 0); /* SPI1_SPCK */ break; } add_generic_device("atmel_spi", spi_id, NULL, start, SZ_16K, IORESOURCE_MEM, pdata); }
static void __init ek_board_init(void) { /* Serial */ /* DBGU on ttyS0. (Rx & Tx only) */ at91_register_uart(0, 0, 0); /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */ at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS); at91_add_device_serial(); /* USB Host */ at91_add_device_usbh(&ek_usbh_data); /* USB Device */ at91_add_device_udc(&ek_udc_data); /* SPI */ at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */ at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); /* Touchscreen */ ek_add_device_ts(); /* MMC */ at91_add_device_mmc(1, &ek_mmc_data); /* Ethernet */ at91_add_device_eth(&ek_macb_data); /* NAND */ ek_add_device_nand(); /* I2C */ at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); /* LCD Controller */ at91_add_device_lcdc(&ek_lcdc_data); /* Push Buttons */ ek_add_device_buttons(); /* AC97 */ at91_add_device_ac97(&ek_ac97_data); /* LEDs */ at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); /* CAN */ at91_add_device_can(&ek_can_data); }
/* * Initialize the SPI controller */ static int __init at91_spi_init(void) { init_MUTEX(&spi_lock); AT91_CfgPIO_SPI(); controller->SPI_CR = AT91C_SPI_SWRST; /* software reset of SPI controller */ /* Set Chip Select registers to good defaults */ // controller->SPI_CSR0 = AT91C_SPI_CPOL |AT91C_SPI_NCPHA | AT91C_SPI_BITS_8 | (1 << 16) | (15 << 8); controller->SPI_CSR0 = AT91C_SPI_BITS_8 | (16 << 16) | (15 << 8); controller->SPI_CSR1 = AT91C_SPI_CPOL | AT91C_SPI_BITS_8 | (16 << 16) | (DEFAULT_SPI_BAUD << 8); controller->SPI_CSR2 = AT91C_SPI_CPOL | AT91C_SPI_BITS_8 | (16 << 16) | (DEFAULT_SPI_BAUD << 8); controller->SPI_CSR3 = AT91C_SPI_CPOL | AT91C_SPI_BITS_8 | (16 << 16) | (DEFAULT_SPI_BAUD << 8); controller->SPI_PTCR = AT91C_PDC_RXTDIS | AT91C_PDC_TXTDIS; memset(&spi_dev, 0, sizeof(spi_dev)); spi_dev[0].pcs = 0xE; spi_dev[1].pcs = 0xD; spi_dev[2].pcs = 0xB; spi_dev[3].pcs = 0x7; if (request_irq(AT91C_ID_SPI, spi_interrupt, 0, "dudu_spi", NULL)) { printk(KERN_INFO "I am Busy.\n"); return -EBUSY; } controller->SPI_CR = AT91C_SPI_SPIEN; /* Enable SPI */ /******************************************************************************/ at91_set_gpio_output(AT91_PIN_PA24, 1); at91_set_gpio_value(AT91_PIN_PA24, 1); /******************************************************************************/ return 0; }
static void __init picotux200_board_init(void) { /* Serial */ /* DBGU on ttyS0. (Rx & Tx only) */ at91_register_uart(0, 0, 0); /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD | ATMEL_UART_RI); at91_add_device_serial(); /* Ethernet */ at91_add_device_eth(&picotux200_eth_data); /* USB Host */ at91_add_device_usbh(&picotux200_usbh_data); /* I2C */ at91_add_device_i2c(NULL, 0); /* MMC */ at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ at91_add_device_mmc(0, &picotux200_mmc_data); /* NOR Flash */ platform_device_register(&picotux200_flash); }
void __init at91_add_device_usbh(struct at91_usbh_data *data) { int i; if (!data) return; for (i = 0; i < data->ports; i++) { if (gpio_is_valid(data->vbus_pin[i])) at91_set_gpio_output(data->vbus_pin[i], data->vbus_pin_active_low[i]); } for (i = 0; i < data->ports; i++) { if (data->overcurrent_pin[i]) at91_set_gpio_input(data->overcurrent_pin[i], 1); } usbh_data = *data; platform_device_register(&at91_usbh_device); }
static void at91sam9261ek_dm9000_hw_init(void) { /* Configure SMC CS2 for DM9000 */ at91_sys_write(AT91_SMC_SETUP(2), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0) | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0)); at91_sys_write(AT91_SMC_PULSE(2), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(8) | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(8)); at91_sys_write(AT91_SMC_CYCLE(2), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16)); at91_sys_write(AT91_SMC_MODE(2), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1)); /* Configure Reset signal as output */ at91_set_gpio_output(AT91_PIN_PC10, 0); /* Configure Interrupt pin as input, no pull-up */ at91_set_gpio_input(AT91_PIN_PC11, 0); }