Remove CONFIG_ARCH_BOARD #ifdef dependencies from mtd

Since mtd already checks whether CONFIG_MTD_RAMTRON is set in
defconfig use this define to check whether to call ramtron_attach()
or at24xxx_attach() in the main function, instead of checking
CONFIG_ARCH_BOARD_PX4FMU-V1.

Also instead of using #ifdef CONFIG_ARCH_BOARD_AEROCORE to determine
whether to start mtd on spi 2 or 4, rather use a new board define
PX4_SPI_BUS_RAMTRON in the board_config.h file.
This commit is contained in:
Karl Schwabe
2015-11-13 16:30:57 +01:00
committed by Lorenz Meier
parent 199f6478ee
commit 48c467f602
3 changed files with 10 additions and 9 deletions
@@ -82,6 +82,9 @@ __BEGIN_DECLS
#define GPIO_SPI_CS_GYRO (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN3)
#define GPIO_SPI_CS_BARO (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN4)
/* SPI4--Ramtron */
#define PX4_SPI_BUS_RAMTRON 4
/* Nominal chip selects for devices on SPI bus #3 */
#define PX4_SPIDEV_ACCEL_MAG 0
#define PX4_SPIDEV_GYRO 1
@@ -113,6 +113,7 @@ __BEGIN_DECLS
#define GPIO_SPI_CS_EXT3 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN13)
#define PX4_SPI_BUS_SENSORS 1
#define PX4_SPI_BUS_RAMTRON 2
#define PX4_SPI_BUS_EXT 4
/* Use these in place of the spi_dev_e enumeration to select a specific SPI device on SPI1 */
+6 -9
View File
@@ -176,12 +176,9 @@ struct mtd_dev_s *mtd_partition(FAR struct mtd_dev_s *mtd,
static void
ramtron_attach(void)
{
/* find the right spi */
#ifdef CONFIG_ARCH_BOARD_AEROCORE
struct spi_dev_s *spi = up_spiinitialize(4);
#else
struct spi_dev_s *spi = up_spiinitialize(2);
#endif
/* initialize the right spi */
struct spi_dev_s *spi = up_spiinitialize(PX4_SPI_BUS_RAMTRON);
/* this resets the spi bus, set correct bus speed again */
SPI_SETFREQUENCY(spi, 10 * 1000 * 1000);
SPI_SETBITS(spi, 8);
@@ -269,10 +266,10 @@ mtd_start(char *partition_names[], unsigned n_partitions)
}
if (!attached) {
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
at24xxx_attach();
#else
#ifdef CONFIG_MTD_RAMTRON
ramtron_attach();
#else
at24xxx_attach();
#endif
}