int nsh_archinitialize(void) { #ifdef CONFIG_NSH_HAVEMMCSD FAR struct spi_dev_s *ssp; int ret; /* Get the SSP port */ ssp = lpc17_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!ssp) { message("nsh_archinitialize: Failed to initialize SSP port %d\n", CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } message("Successfully initialized SSP port %d\n", CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SSP port to the slot */ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, ssp); if (ret < 0) { message("nsh_archinitialize: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } message("Successfuly bound SSP port %d to MMC/SD slot %d\n", CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); #endif return OK; }
int usbmsc_archinitialize(void) { FAR struct spi_dev_s *spi; int ret; /* Get the SPI port */ syslog(LOG_INFO, "Initializing SPI port %d\n", LPC17XX_MMCSDSPIPORTNO); zkit_spiinitialize(); spi = lpc17_spiinitialize(LPC17XX_MMCSDSPIPORTNO); if (!spi) { syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", LPC17XX_MMCSDSPIPORTNO); return -ENODEV; } syslog(LOG_INFO, "Successfully initialized SPI port %d\n", LPC17XX_MMCSDSPIPORTNO); /* Bind the SPI port to the slot */ syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO); ret = mmcsd_spislotinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1, LPC17XX_MMCSDSLOTNO, spi); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO, ret); return ret; } syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO); return OK; }