aboutsummaryrefslogtreecommitdiff
path: root/src/systemcmds
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2014-01-16 17:00:25 +1100
committerLorenz Meier <lm@inf.ethz.ch>2014-01-16 07:57:32 +0100
commitff59aa9a0f856826682eb5099b1ec2525c5f7ba6 (patch)
tree90d5581b2c9afdb94493918ab8898e3a4711a0e9 /src/systemcmds
parent352dea675435794d90f75d4a3c013d2afc439933 (diff)
downloadpx4-firmware-ff59aa9a0f856826682eb5099b1ec2525c5f7ba6.tar.gz
px4-firmware-ff59aa9a0f856826682eb5099b1ec2525c5f7ba6.tar.bz2
px4-firmware-ff59aa9a0f856826682eb5099b1ec2525c5f7ba6.zip
mtd: use new MTDIOC_SETSPEED ioctl
set SPI speed to 10MHz
Diffstat (limited to 'src/systemcmds')
-rw-r--r--src/systemcmds/mtd/mtd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/systemcmds/mtd/mtd.c b/src/systemcmds/mtd/mtd.c
index 5525a8f33..8bc18b3c2 100644
--- a/src/systemcmds/mtd/mtd.c
+++ b/src/systemcmds/mtd/mtd.c
@@ -144,7 +144,7 @@ ramtron_attach(void)
/* find the right spi */
struct spi_dev_s *spi = up_spiinitialize(2);
/* this resets the spi bus, set correct bus speed again */
- SPI_SETFREQUENCY(spi, 40 * 1000 * 1000);
+ SPI_SETFREQUENCY(spi, 10 * 1000 * 1000);
SPI_SETBITS(spi, 8);
SPI_SETMODE(spi, SPIDEV_MODE3);
SPI_SELECT(spi, SPIDEV_FLASH, false);
@@ -170,6 +170,10 @@ ramtron_attach(void)
if (mtd_dev == NULL)
errx(1, "failed to initialize mtd driver");
+ int ret = mtd_dev->ioctl(mtd_dev, MTDIOC_SETSPEED, (unsigned long)10*1000*1000);
+ if (ret != OK)
+ warnx(1, "failed to set bus speed");
+
attached = true;
}
#else