Skip to content
Snippets Groups Projects
Commit 1951b9df authored by Max Neklyudov's avatar Max Neklyudov Committed by Gregory Nutt
Browse files

Improve m25px driver

parent 0369facb
No related branches found
No related tags found
No related merge requests found
Documentation @ 35343cbe
Subproject commit d1d8974e7a8c743ed2ee102a93ad73478755a080
Subproject commit 35343cbe6660bb07d9fee4c2e5af0dd450313c14
......@@ -408,6 +408,10 @@ config M25P_SPIMODE
int "M25P SPI mode"
default 0
config M25P_SPIFREQUENCY
int "M25P SPI Frequency"
default 20000000
config M25P_MANUFACTURER
hex "M25P manufacturers ID"
default 0x20
......
......@@ -69,6 +69,10 @@
# define CONFIG_M25P_SPIMODE SPIDEV_MODE0
#endif
#ifndef CONFIG_M25P_SPIFREQUENCY
# define CONFIG_M25P_SPIFREQUENCY 20000000
#endif
/* Various manufacturers may have produced the parts. 0x20 is the manufacturer ID
* for the STMicro MP25x serial FLASH. If, for example, you are using the a Macronix
* International MX25 serial FLASH, the correct manufacturer ID would be 0xc2.
......@@ -137,6 +141,7 @@
#define M25P_M25P32_NSECTORS 64
#define M25P_M25P32_PAGE_SHIFT 8 /* Page size 1 << 8 = 256 */
#define M25P_M25P32_NPAGES 16384
#define M25P_M25PX32_SUBSECT_SHIFT 12 /* Sub-Sector size 1 << 12 = 4,096 */
/* M25P64 capacity is 8,338,608 bytes:
* (128 sectors) * (65,536 bytes per sector)
......@@ -285,7 +290,7 @@ static void m25p_lock(FAR struct spi_dev_s *dev)
SPI_SETMODE(dev, CONFIG_M25P_SPIMODE);
SPI_SETBITS(dev, 8);
(void)SPI_HWFEATURES(dev, 0);
(void)SPI_SETFREQUENCY(dev, 20000000);
(void)SPI_SETFREQUENCY(dev, CONFIG_M25P_SPIFREQUENCY);
}
/************************************************************************************
......@@ -383,6 +388,9 @@ static inline int m25p_readid(struct m25p_dev_s *priv)
priv->nsectors = M25P_M25P32_NSECTORS;
priv->pageshift = M25P_M25P32_PAGE_SHIFT;
priv->npages = M25P_M25P32_NPAGES;
#ifdef CONFIG_M25P_SUBSECTOR_ERASE
priv->subsectorshift = M25P_M25PX32_SUBSECT_SHIFT;
#endif
return OK;
}
else if (capacity == M25P_M25P64_CAPACITY)
......
......@@ -852,7 +852,7 @@ void sched_suspend_scheduler(FAR struct tcb_s *tcb);
* to application code.
*
* Input Parameters:
* tcb - The TCB of the thread to be restarted.
* tcb - The TCB of the thread.
*
* Returned Value:
* None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment