summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/ata-nand-telechips.c
AgeCommit message (Collapse)AuthorFilesLines
2017-10-26Unify storage threads into oneMichael Sevakis1-0/+6
* Editing a bunch of drivers' thread routines in order to implement a new feature is tedious. * No matter the number of storage drivers, they share one thread. No extra threads needed for CONFIG_STORAGE_MULTI. * Each has an event callback called by the storage thread. * A default callback is provided to fake sleeping in order to trigger idle callbacks. It could also do other default processing. Changes to it will be part of driver code without editing each one. * Drivers may sleep and wake as they please as long as they give a low pulse on their storage bit to ask to go into sleep mode. Idle callback is called on its behalf and driver immediately put into sleep mode. * Drivers may indicate they are to continue receiving events in USB mode, otherwise they receve nothing until disconnect (they do receive SYS_USB_DISCONNECTED no matter what). * Rework a few things to keep the callback implementation sane and maintainable. ata.c was dreadful with all those bools; make it a state machine and easier to follow. Remove last_user_activity; it has no purpose that isn't served by keeping the disk active through last_disk_activity instead. * Even-out stack sizes partly because of a lack of a decent place to define them by driver or SoC or whatever; it doesn't seem too critical to do that anyway. Many are simply too large while at least one isn't really adequate. They may be individually overridden if necessary (figure out where). The thread uses the greatest size demanded. Newer file code is much more frugal with stack space. I barely see use crack 50% after idle callbacks (usually mid-40s). Card insert/eject doesn't demand much. * No forcing of idle callbacks. If it isn't necessary for one or more non-disk storage types, it really isn't any more necessary for disk storage. Besides, it makes the whole thing easier to implement. Change-Id: Id30c284d82a8af66e47f2cfe104c52cbd8aa7215
2017-03-12Do some housekeeping with fat.h and SECTOR_SIZEMichael Sevakis1-2/+1
Many includes of fat.h are pointless. Some includes are just for SECTOR_SIZE. Add a file 'firmware/include/fs_defines.h' for that and to define tuneable values that were scattered amongst various headers. Remove some local definitions of SECTOR_SIZE since they have to be in agreement with the rest of the fs code anyway. (We'll see what's in fact pointless in a moment ;) Change-Id: I9ba183bf58bd87f5c45eba7bd675c7e2c1c18ed5
2014-01-05Add missing kernel.h includes (hopefully all of them).Thomas Martitz1-2/+4
Change-Id: I9c1825296a788587b8d494d8514b3314847b0ff0
2013-08-17Cleanup MV/MD macros a little.Michael Sevakis1-3/+3
When using variadic macros there's no need for IF_MD2/IF_MV2 to deal with function parameters. IF_MD/IF_MV are enough. Throw in IF_MD_DRV/ID_MV_VOL that return the parameter if MD/MV, or 0 if not. Change-Id: I7605e6039f3be19cb47110c84dcb3c5516f2c3eb
2011-08-30GSoC/Buflib: Add buflib memory alocator to the core.Thomas Martitz1-4/+11
The buflib memory allocator is handle based and can free and compact, move or resize memory on demand. This allows to effeciently allocate memory dynamically without an MMU, by avoiding fragmentation through memory compaction. This patch adds the buflib library to the core, along with convinience wrappers to omit the context parameter. Compaction is not yet enabled, but will be in a later patch. Therefore, this acts as a replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug menu. See buflib.h for some API documentation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657
2009-10-09Core changes to allow storage drivers to do cleanup on shutdown, and iPod ↵Michael Sparmann1-0/+6
Nano 2G shutdown code rework (FS#10668) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23057 a1c6a512-1295-4272-9138-f99709370657
2009-09-27Clean up duplicate #includesBertrik Sikken1-1/+0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22845 a1c6a512-1295-4272-9138-f99709370657
2009-09-21ata-nand-telechips: tcc77x have now USEC_TIMERVitja Makarov1-2/+0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22763 a1c6a512-1295-4272-9138-f99709370657
2009-09-18tcc77x: add tcc77x_cscfg_bw() helper for external memory bus width setupVitja Makarov1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22729 a1c6a512-1295-4272-9138-f99709370657
2009-08-12TCC: Implement ECC error correction for sectors read from NAND. Tested on D2 ↵Rob Purchase1-21/+123
(78x, MLC) and M200 (77x, SLC). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22284 a1c6a512-1295-4272-9138-f99709370657
2009-07-17Commit FS#9545, storage cleanup and multi-driver supportFrank Gevaerts1-6/+45
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21933 a1c6a512-1295-4272-9138-f99709370657
2009-07-17Revert r21912 : "Storage API : remove undeeded target-specific functions"Rafaël Carré1-0/+13
After a discussion mixed on mailing list and irc, it was agreed that more abstraction for plugins is better (so developers don't have to add a check to HAVE_DISK_STORAGE when writing disk-specific code) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21923 a1c6a512-1295-4272-9138-f99709370657
2009-07-17Storage API : remove undeeded target-specific functionsRafaël Carré1-13/+0
storage_sleep, storage_spin, storage_spindown are only defined if #defiend (HAVE_DISK_STORAGE), not for MMC/ATA/SD remove already unneeded nand_disk_is_active, nand_soft_reset git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21912 a1c6a512-1295-4272-9138-f99709370657
2009-07-10Make the TCC NAND driver use the (virtual) disk activity LED.Rob Purchase1-5/+15
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21748 a1c6a512-1295-4272-9138-f99709370657
2009-06-24Fix an error in the TCC NAND driver which caused a panic on startup for ↵Rob Purchase1-5/+7
certain users. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21485 a1c6a512-1295-4272-9138-f99709370657
2009-06-22TCC78x: Make the NAND driver yield during reads (thanks to bertrik for ↵Rob Purchase1-0/+11
spotting the obvious error that caused this to crash until now). Fixes the D2 'delay before playback starts' bug. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21465 a1c6a512-1295-4272-9138-f99709370657
2009-06-21Fix more missing mutex_init calls.Bertrik Sikken1-0/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21463 a1c6a512-1295-4272-9138-f99709370657
2009-03-02TCC NAND: The BLOCKS_PER_SEGMENT define was actually the number of planes ↵Rob Purchase1-59/+69
mentioned in the Samsung NAND datasheet. Add this to the nand_id struct, so that it can be runtime detected (required for some D2s to boot). Use the struct directly instead of making a local copy, and format the nand_info table to 80 columns. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20186 a1c6a512-1295-4272-9138-f99709370657
2008-11-16Telechips NAND: much improved read reliability on D2/iAudio7. More work is ↵Rob Purchase1-203/+212
required for M200/DAX, but an improvement is evident nonetheless. LPT buffers are now buffer_alloc'd after determining the required size, so most targets should also see a healthy reduction in RAM usage. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19118 a1c6a512-1295-4272-9138-f99709370657
2008-11-02implement single-driver storage layer with macros instead of inlinesFrank Gevaerts1-0/+13
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18975 a1c6a512-1295-4272-9138-f99709370657
2008-11-01conditionalise *_get_info() to get some binsize backFrank Gevaerts1-0/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18965 a1c6a512-1295-4272-9138-f99709370657
2008-11-01Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do ↵Frank Gevaerts1-79/+14
that, it also introduces sd_*, nand_*, and mmc_*. This should be a good first step to allow multi-driver targets, like the Elio (ATA/SD), or the D2 (NAND/SD). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18960 a1c6a512-1295-4272-9138-f99709370657
2008-10-07Fill some ata_identify fields, e.g model name, firmware, block countVitja Makarov1-5/+42
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18725 a1c6a512-1295-4272-9138-f99709370657
2008-09-07Telechips NAND: split out a couple of small functions to help readability, ↵Rob Purchase1-27/+54
and add a note about LPT blocks. No functional changes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18440 a1c6a512-1295-4272-9138-f99709370657
2008-09-06Initial commit of iaudio 7 port by Vitja Makarov (FS#9245). Port is at ↵Dave Chapman1-1/+1
quite an advanced stage, but is troubled by the lack of a reliable NAND driver (similar to the Cowon D2 port) and is not yet suitable for non-developers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18435 a1c6a512-1295-4272-9138-f99709370657
2008-07-15Fix yellowRob Purchase1-1/+0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18064 a1c6a512-1295-4272-9138-f99709370657
2008-07-15Update the Telechips NAND driver to use the nand_identify() function ↵Rob Purchase1-45/+11
introduced in r18052. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18063 a1c6a512-1295-4272-9138-f99709370657
2008-07-12Make the TCC780x NAND driver also build for 77x targets. This is ↵Rob Purchase1-0/+892
work-in-progress stuff and does not yet work fully on 77x, but it's a step in the right direction. Also replace some magic numbers with #defines. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18019 a1c6a512-1295-4272-9138-f99709370657