Commit graph

114 commits

Author SHA1 Message Date
Bertrik Sikken
2543340bf4 AMSv2 SD: sd card communication speed can be changed back to full speed after CMD3 (SEND_RCA)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29647 a1c6a512-1295-4272-9138-f99709370657
2011-03-26 19:52:42 +00:00
Rafaël Carré
688545ea16 fix warning, use unsigned variable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29638 a1c6a512-1295-4272-9138-f99709370657
2011-03-24 10:54:30 +00:00
Rafaël Carré
669313a11d SD AMSv2: fix r29625
The number of blocks could have been checked while the card was not initialized yet.
See FS#11870 for details

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29637 a1c6a512-1295-4272-9138-f99709370657
2011-03-24 10:43:47 +00:00
Bertrik Sikken
d3c796d20e AMSv2 SD: send 80 idle clocks before sending initial CMD0 (go idle state)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29630 a1c6a512-1295-4272-9138-f99709370657
2011-03-21 23:24:59 +00:00
Bertrik Sikken
fc0ad4c01e AMSv2 SD: receive sd card command responses during initialisation instead of ignoring them
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29629 a1c6a512-1295-4272-9138-f99709370657
2011-03-21 22:04:25 +00:00
Bertrik Sikken
3d3c0c51ec AMSv2 SD: wait for previous data transfer completion before sending a command
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29628 a1c6a512-1295-4272-9138-f99709370657
2011-03-21 21:41:50 +00:00
Bertrik Sikken
6bf0f65388 AMSv2 SD: use a sleep instead of a udelay for 100 ms delay
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29627 a1c6a512-1295-4272-9138-f99709370657
2011-03-21 20:41:53 +00:00
Rafaël Carré
82f2bb99ae SD AMSv2: fix r29169
Restore access to the last AMS_OF_SIZE == 0xF000 sectors of internal drive
Mostly visible when using USB (or database?)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29625 a1c6a512-1295-4272-9138-f99709370657
2011-03-20 17:04:31 +00:00
Rafaël Carré
1675e98925 SD amsv2: remove double assignement
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29624 a1c6a512-1295-4272-9138-f99709370657
2011-03-20 17:04:19 +00:00
Bertrik Sikken
faeb4d6aef Add another delay in the AMSv2 sd controller driver as a work-around for SD initialisation problems, see FS#11870
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29619 a1c6a512-1295-4272-9138-f99709370657
2011-03-20 09:57:43 +00:00
Michael Sevakis
12375d1d3a Merge functionality of wakeups and semaphores-- fewer APIs and object types. semaphore_wait takes a timeout now so codecs and plugins have to be made incompatible. Don't make semaphores for targets not using them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29492 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 08:49:38 +00:00
Michael Sevakis
e9749d1b93 AMSv2 SD: Fix card insert lockups in USB mode. First, get rid of infinite loops and retry those a limited number of times-- no explaination for their dubious existence was offered in the source. Second, SD thread was no longer monitoring inserts (and it wouldn't really matter if it were). Thus, .initialized was reported as '1' despite the new card needing reinit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29169 a1c6a512-1295-4272-9138-f99709370657
2011-01-29 16:54:36 +00:00
Michael Sevakis
453550a687 Try to get some control over #ifdef hell in usb.c by refactoring and inline function use. SYS_USB_DISCONNECTED_ACK hasn't been doing anything useful for the USB thread; remove it. USB thread simply ignores that value. Observe only valid usb_state transitions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29084 a1c6a512-1295-4272-9138-f99709370657
2011-01-18 14:10:06 +00:00
Bertrik Sikken
92b849d3bf Apply FS#11798 (Files in MicroSD card aren't being shown in File Browser or Database on Clip+) by Will Sowerbutts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28903 a1c6a512-1295-4272-9138-f99709370657
2010-12-26 12:55:28 +00:00
Bertrik Sikken
2a0a9a5f2a AMSv2: handle sd card ACMDs similar to how it's done for AMSv1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28814 a1c6a512-1295-4272-9138-f99709370657
2010-12-12 15:30:58 +00:00
Bertrik Sikken
9da76f3031 AMSv2: only switch sd cards to high speed mode for for v2 sd cards, just like is done for AMSv1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28808 a1c6a512-1295-4272-9138-f99709370657
2010-12-12 14:04:07 +00:00
Thomas Martitz
f09499f70f Change sd-as3525*.c to the new cache coherency function names.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28046 a1c6a512-1295-4272-9138-f99709370657
2010-09-08 17:16:52 +00:00
Rafaël Carré
63c1769701 AMSv2: remove a bunch of panicf() in SD driver
The driver is stable so we can use error codes for debugging

Fix 2 problems in error code path:
    - release sd mutex
    - release dma module when needed

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27915 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 11:22:58 +00:00
Rafaël Carré
26de96cad8 typo in r27876
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27878 a1c6a512-1295-4272-9138-f99709370657
2010-08-25 11:15:06 +00:00
Rafaël Carré
8de2af7b9c sd-as3525*: use AS3525_PHYSICAL_ADDR
fix DMA buffers when the src/dst is in IRAM
It worked fine because all the buffers are in DRAM, and the virtual
address happens to be the physical address

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27876 a1c6a512-1295-4272-9138-f99709370657
2010-08-25 11:10:40 +00:00
Thomas Martitz
0e2286f226 Introduce NORETURN_ATTR wrapper for __attribute__((noreturn)), using this and a bit further cleanup in main gets rid of a warning when compiling for android.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27788 a1c6a512-1295-4272-9138-f99709370657
2010-08-12 13:38:25 +00:00
Bertrik Sikken
10e79de27c Correction to previous commit: fix condition to include backlight-target.h (not needed for clip+)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27521 a1c6a512-1295-4272-9138-f99709370657
2010-07-22 15:10:32 +00:00
Bertrik Sikken
4d6c816721 Sansa Clip+: detect AMSv2 variant (just like was already done for fuze v2), this makes SD transfers work for newer clip+ players ("COMBO4E" type). Variable fuzev2_variant has been renamed to amsv2_variant.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27520 a1c6a512-1295-4272-9138-f99709370657
2010-07-22 13:47:09 +00:00
Rafaël Carré
c6b838695c Revert r26290
If the card is not actively deselected on newer Fuzev2, frequent
switches between internal storage and µSD will lock up.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27500 a1c6a512-1295-4272-9138-f99709370657
2010-07-20 04:34:21 +00:00
Rafaël Carré
c57ba97246 newer Fuzev2 doesn't seem to use B5 for button light
playing from µSD now works to some degree
database update or copy between the 2 drives lock up

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27496 a1c6a512-1295-4272-9138-f99709370657
2010-07-19 17:12:47 +00:00
Rafaël Carré
b221d6d4d4 as3525*: use atomic bit manipulation for CCU_IO
fuzev2 button_read_device() runs in interrupt context so writes are atomic

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27494 a1c6a512-1295-4272-9138-f99709370657
2010-07-19 15:56:15 +00:00
Rafaël Carré
e44b65c806 Support new Fuzev2 revisions (fuzev2_variant == 1)
- Revert BUTTON_HOME
- Modifications to SD driver (µSD not working yet)

TODO: µSD and FM radio

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27492 a1c6a512-1295-4272-9138-f99709370657
2010-07-19 15:29:28 +00:00
Rafaël Carré
81593e8e61 sd-as3525v2: remove unneeded prototypes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27488 a1c6a512-1295-4272-9138-f99709370657
2010-07-19 04:41:07 +00:00
Michael Sevakis
0f47ffe0e4 AMS SoC's: Some register bit changes need interrupt protection: timer API and CGU_PERI.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27236 a1c6a512-1295-4272-9138-f99709370657
2010-07-02 06:00:00 +00:00
Rafaël Carré
28bcc17dde revert r27044 (which was a revert of r26953 & r26954)
The bug was in playback.c and was fixed in previous commit

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27074 a1c6a512-1295-4272-9138-f99709370657
2010-06-23 04:34:23 +00:00
Rafaël Carré
5a44e43870 revert r26953 + r26954
test_disk says everything is alright but playback is buggy, especially
when playing lossless files

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27044 a1c6a512-1295-4272-9138-f99709370657
2010-06-22 09:02:56 +00:00
Rafaël Carré
4329512017 fix r26953: use physical address for DMA buffer, also for IRAM
AMSv2 and AMSv1 lowmem put the codec buffer in IRAM so we need to adjust
the address : AS3525_PHYSICAL_ADDRESS macro will do just that

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26954 a1c6a512-1295-4272-9138-f99709370657
2010-06-19 05:55:18 +00:00
Rafaël Carré
ffc7323ec3 sd-as3525*: handle aligned transfers without memcpy()
test_disk shows 1MB transfers are up to 3 times faster
not much difference for 1 or 8 sectors at a time
define STORAGE_WANTS_ALIGN to use the fast path when possible

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26953 a1c6a512-1295-4272-9138-f99709370657
2010-06-19 04:55:10 +00:00
Rafaël Carré
46e1231a44 FS#11402 by me : sd_enable for Sansa AMSv2
Gets a bit more battery life
Adjust current usage, it was a bit too low for Clipv2/Clip+

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26866 a1c6a512-1295-4272-9138-f99709370657
2010-06-16 06:08:04 +00:00
Rafaël Carré
5c9e76a1e0 sd-as3525v2: check the (supposedly) card data line for business when writing
Fix panics when deleting large files from µSD
Tested on problematic Transcend 4GB Class 6

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26631 a1c6a512-1295-4272-9138-f99709370657
2010-06-06 13:47:30 +00:00
Frank Gevaerts
9c43b2ce17 Remove card_enable_monitoring() and use a mutex instead. The card_enable_monitoring() method actually didn't eliminate the possible race conditions it was meant to fix.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26627 a1c6a512-1295-4272-9138-f99709370657
2010-06-06 13:20:47 +00:00
Frank Gevaerts
a0557b23f0 remane hotswap.* to sdmmc.*. The contents have nothing at all to do with hotswapping things
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26598 a1c6a512-1295-4272-9138-f99709370657
2010-06-05 21:12:16 +00:00
Rafaël Carré
9ff986cdca sd-as3525v2: Include time spent yielding when figuring timeout in sd_wait_for_tran_state()
(apply r23738 to as3525v2 code)
extend the arbitrary delay to 5 seconds, we never know

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26342 a1c6a512-1295-4272-9138-f99709370657
2010-05-27 23:32:29 +00:00
Rafaël Carré
9112b0b1bb as3525v2: do not deselect all cards after a SD transfer
Selecting the right card before the transfer will deselect the other one

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26290 a1c6a512-1295-4272-9138-f99709370657
2010-05-25 20:38:42 +00:00
Rafaël Carré
13f159df57 as3525*: sd_wait_for_state() is only used for waiting to SD_TRAN state
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26251 a1c6a512-1295-4272-9138-f99709370657
2010-05-24 15:07:15 +00:00
Rafaël Carré
29e70dfcb8 sd-as3525v2: masked interrupts and block size won't change, and DMA won't be disabled, so we can just set these in the controller init once for all
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26179 a1c6a512-1295-4272-9138-f99709370657
2010-05-19 20:41:47 +00:00
Rafaël Carré
6b46cc08ed as3525: hide our UNCACHED_ADDR from usb_storage.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26178 a1c6a512-1295-4272-9138-f99709370657
2010-05-19 18:13:06 +00:00
Rafaël Carré
c785722fec as3525: make sure we don't use a negative number of sectors
Better be safe than sorry, don't try to read/write outside our storage,
because we might overwrite the OF on the internal storage

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26077 a1c6a512-1295-4272-9138-f99709370657
2010-05-16 10:24:31 +00:00
Rafaël Carré
79cfc221a5 fuzev2: fix buttonlight flashing on µSD access (2nd try)
it would still flash when the light was off
it turns out that if B5 is set to input the light can't be turned on
but we can still select between µSD slot and internal storage

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26059 a1c6a512-1295-4272-9138-f99709370657
2010-05-15 16:21:47 +00:00
Rafaël Carré
0f77db7346 as3525: fix capacity sanity check
adjust logical starting sector to physical starting sector after the check
number of blocks is already adjusted from physical to logical
don't panic anymore when accessing the last part of storage

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26050 a1c6a512-1295-4272-9138-f99709370657
2010-05-15 12:01:53 +00:00
Rafaël Carré
7036a10126 fuzev2: prevent button light flickering when accessing µSD
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26031 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 22:01:40 +00:00
Rafaël Carré
e72d2daad8 as3525v2: check if SD transfers fit with the card capacity
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26028 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 19:37:10 +00:00
Jack Halpin
ed704825d2 sd-as3525v2: Set LP bits in MCI_CLKENA for cards after they have been initialized.
The OF does this and while we don't have the documentation to be sure I think it's highly likely this is a low power mode referred to in one of the product "briefs".

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25936 a1c6a512-1295-4272-9138-f99709370657
2010-05-10 17:35:00 +00:00
Jack Halpin
56457934c6 sd-as3525v2: Add delay after SD_SWITCH_FUNC to while switching to high speed timings and wait until after this switch to bring the card clock back up to full speed.
This seems to make switching the uSD card to high speed timing much more reliable.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25935 a1c6a512-1295-4272-9138-f99709370657
2010-05-10 17:34:54 +00:00
Jack Halpin
db8d07589f ad-as3525v2: Ask for a reponse from SD_APP_CMD to help with timing issues when switching to 4 bit widebus.
Some SD cards were having problems switching to 4 Bit widebus and this solution appears to remedy that.
Thanks to Luca_S!

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25846 a1c6a512-1295-4272-9138-f99709370657
2010-05-06 18:53:41 +00:00