Commit graph

75 commits

Author SHA1 Message Date
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
Jack Halpin
8fd3ec9727 sd-as3525v2.c: Set MCI interrupt mask immediately prior to enabling DMA for the transfer.
These INT's shouldn't be unmasked until the transfer is just about to happen.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25836 a1c6a512-1295-4272-9138-f99709370657
2010-05-05 20:04:16 +00:00
Jack Halpin
08641941bb sd-as3525v2.c: Implement 4 bit widebus for SD Transfers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25820 a1c6a512-1295-4272-9138-f99709370657
2010-05-05 04:35:08 +00:00
Jack Halpin
adcbb32966 sd-as3525v2: Check for response timeout error in addition to response crc error. Remove TODO comment.
Change SD_SELECT/DESELECT_CARD commands to MCI_NO_RESP as we don't need a response here.
Renumber some command errors.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25811 a1c6a512-1295-4272-9138-f99709370657
2010-05-04 17:29:26 +00:00
Rafaël Carré
7480afb3c5 as3525v2: Use CD Interrupt vs. CD polling in send_cmd()
Also enable write support, test_disk passes on all targets

Flyspray: FS#11140
Authors: Jack Halpin and myself

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25799 a1c6a512-1295-4272-9138-f99709370657
2010-05-03 22:15:56 +00:00
Rafaël Carré
bc3c5c1657 sd-as3525v2: cosmetics
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25762 a1c6a512-1295-4272-9138-f99709370657
2010-04-30 08:57:56 +00:00
Thomas Martitz
249aae587a FS#11172 - Fuzev2: Read the scrollwheel scrollwheel via IRQ
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25736 a1c6a512-1295-4272-9138-f99709370657
2010-04-27 10:11:52 +00:00
Thomas Martitz
845af676f8 as3525(v2): Add a somewhat inaccurate udelay (-0.5/+1.0µs). It should work good for some huge delays.
Use it in fuzev2 to improve some big delays (correct the biggest one to actually wait for the fifo to empty), and use it in the sd drivers.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25734 a1c6a512-1295-4272-9138-f99709370657
2010-04-27 09:34:29 +00:00
Rafaël Carré
8a2187136f fix yellow
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25602 a1c6a512-1295-4272-9138-f99709370657
2010-04-12 10:25:49 +00:00
Rafaël Carré
5a8b5f1ebf as3525v2: clarify the comment about write support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25594 a1c6a512-1295-4272-9138-f99709370657
2010-04-11 18:18:24 +00:00
Jack Halpin
43304b87b0 sd-as3525v2: Add some comments, no functional changes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25546 a1c6a512-1295-4272-9138-f99709370657
2010-04-09 00:26:06 +00:00
Jack Halpin
286fcfe8b1 sd-as3525v2: Start out with all MCI Interrupts masked.
Before the clock settings were fixed this setting actually caused the problem it now seems to solve.
Random freezups seem to be gone for clip+ at least.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25531 a1c6a512-1295-4272-9138-f99709370657
2010-04-08 06:12:44 +00:00
Jack Halpin
f25f17c5b6 sd-as3525v2: Set SD FIFO TX/RX watermarks once in init_controller() and leave them alone after that.
We only use DMA transfers so we should not need to change/reset the FIFO configuration.

Also add comment showing what we set as the TX/RX watermarks.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25507 a1c6a512-1295-4272-9138-f99709370657
2010-04-07 05:47:12 +00:00
Jack Halpin
48477f06bf AS3525v2: Set XPD to SD-MMC interface in sd_init() for HAVE_MULTIDRIVE.
XPD was being switched between SD-MMC interface and general i/o functions in the sd_enable() function similar to as3525v1.
Since the as3525v2's do not seem to use XPD as general i/o there's no need to switch it back.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25497 a1c6a512-1295-4272-9138-f99709370657
2010-04-06 17:22:51 +00:00
Rafaël Carré
722be53bf9 as3525v2: acknowledge USB connection/deconnection in SD thread
Fuzev2: detect USB connection and reboot to OF

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25446 a1c6a512-1295-4272-9138-f99709370657
2010-04-03 05:42:54 +00:00
Rafaël Carré
148a5fb631 Fuzev2: µSD detect pin is A2 like Clip+, but the meaning is reversed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25353 a1c6a512-1295-4272-9138-f99709370657
2010-03-27 16:53:08 +00:00
Jack Halpin
4b0c43da8f sd-as3525v2.c Organize construction of MCI_COMMAND so it is more apparent which bits are being set and why.
I have also made the CMD_CHECK_CRC_BIT unused for now since we do not check any response crc values yet.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25343 a1c6a512-1295-4272-9138-f99709370657
2010-03-26 17:00:25 +00:00
Jack Halpin
9d9c090cba sd-as3525v2.c Implement HS timings for those cards that are capable.
The internal card does not appear to be HS capable, at least not in 2GB clip+

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25316 a1c6a512-1295-4272-9138-f99709370657
2010-03-24 05:41:33 +00:00
Jack Halpin
0466a11028 sd-as3525v2.c Don't reset controller on every pass through the transfer loop.
The controller only needs to be reset if we had an error to clean up any leftover trash...

Move comment pertaining to retry variable so it's actually nearby.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25315 a1c6a512-1295-4272-9138-f99709370657
2010-03-24 05:41:25 +00:00
Jack Halpin
66f011e8c1 sd-as3525v2.c Adjust comments for MCI_INT bits to show if they are related to CMD, DATA, or a termination signal.
Adjust the initial MCI_MASK value to also mask the MCI_INT_RXDR and MCI_INT_TXDR bits as it seems we don't use them for dma transfers.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25314 a1c6a512-1295-4272-9138-f99709370657
2010-03-24 02:48:38 +00:00
Jack Halpin
19fc7297ba SansaAMSv2: Give register CGU_BASE + 0x3C the name CGU_SDSLOT.
Move CLKDIV macros into clock-target.h.
Only enable the necessary interfaces for the 3 clock registers used for SD.
Add MEMSTICK and SDSLOT registers to bottom of register display in View HW info debug page.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25309 a1c6a512-1295-4272-9138-f99709370657
2010-03-23 17:00:59 +00:00
Rafaël Carré
1657174561 sd-as3525v2: read cid & csd in the correct order, fix disk info
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25292 a1c6a512-1295-4272-9138-f99709370657
2010-03-22 12:12:09 +00:00
Jack Halpin
beaa292199 sd-as3525v2.c We don't need to disable/enable MCI_CLKENA in send_cmd().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25286 a1c6a512-1295-4272-9138-f99709370657
2010-03-22 06:09:19 +00:00
Jack Halpin
2a75da37ae sd-as3525v2.c Enable disk access icon.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25285 a1c6a512-1295-4272-9138-f99709370657
2010-03-22 06:09:14 +00:00
Jack Halpin
d2a264e7da sd-as3525v2.c Use MCI_MASK instead of data_transfer flag to determine if data transfer is happening.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25284 a1c6a512-1295-4272-9138-f99709370657
2010-03-22 06:09:08 +00:00
Jack Halpin
3ee301248d sd-as3525v2.c Add macros to distinguish between a CMD error and a DATA error.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25283 a1c6a512-1295-4272-9138-f99709370657
2010-03-22 02:30:00 +00:00
Jack Halpin
48b8080330 sd-as3525v2 Remove post transfer wait for state call and move pre transfer wait for state call inside the transfer loop.
We don't need the post transfer call this way.  We check on TRAN state before each partial transfer.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25282 a1c6a512-1295-4272-9138-f99709370657
2010-03-22 02:29:53 +00:00
Jack Halpin
6357c5a085 sd-as3525v2.c Use SD_DESELECT_CARD instead of SD_SELECT_CARD to make the code easier to understand. There is no functional difference.
Add comment to explain why we need to do this.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25281 a1c6a512-1295-4272-9138-f99709370657
2010-03-22 02:29:40 +00:00
Jack Halpin
da325b6270 sd-as3525v2.c: Correct SD_APP_OP_COND command to send full voltage range for v1 SD cards.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25266 a1c6a512-1295-4272-9138-f99709370657
2010-03-21 06:49:42 +00:00
Jack Halpin
f1d9491e9c sd-as3525v2.c: Only manipulate MCI_CLKENA for drive being used.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25265 a1c6a512-1295-4272-9138-f99709370657
2010-03-21 06:10:44 +00:00
Rafaël Carré
004317a863 sd-as3525v2: correctly check send_cmd return value (which is boolean)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25246 a1c6a512-1295-4272-9138-f99709370657
2010-03-18 16:40:21 +00:00
Jack Halpin
016153a0b9 SansaAMSv2: Add support for uSD cards to sd-as3525v2.c and activate hotswap and multidrive.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25245 a1c6a512-1295-4272-9138-f99709370657
2010-03-18 13:25:13 +00:00
Rafaël Carré
fb6a5431f2 sd-as3525v2: sd_get_info() is already in common SD code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25243 a1c6a512-1295-4272-9138-f99709370657
2010-03-18 10:29:13 +00:00
Rafaël Carré
ba68f2dedd sd-as3525v2: add card hotswap to sd_thread
Clip+: add (disabled) configuration for µSD slot

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25194 a1c6a512-1295-4272-9138-f99709370657
2010-03-15 02:36:16 +00:00
Rafaël Carré
72e0bf3381 sd-as3525v2: prepare for multidrive builds
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25193 a1c6a512-1295-4272-9138-f99709370657
2010-03-15 01:57:15 +00:00
Rafaël Carré
ade669f0e7 sd-as3525v2: reduce the delay before reading response
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25189 a1c6a512-1295-4272-9138-f99709370657
2010-03-15 00:36:08 +00:00
Rafaël Carré
db7aedf93a sd-as3525v2: do not reverse 2 times long responses, read them directly in the needed order
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25184 a1c6a512-1295-4272-9138-f99709370657
2010-03-14 21:38:36 +00:00
Rafaël Carré
291e2b1ae6 sd-as3525v2: delay a bit before reading the command response
Especially when using caches we might read the response too fast and get
the response for the previous command instead.

Now Clip+ boots fine with both instruction & data caches enabled, the
delay might need to be lowered though: boot time is a bit longer.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25183 a1c6a512-1295-4272-9138-f99709370657
2010-03-14 21:38:30 +00:00
Jack Halpin
a872587a8d sd-as3525v2: Load CID info to cardinfo.cid[] correctly.
SD_ALL_SEND_CID was using cardinfo.cid to store the response instead of the temp array used for long responses.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24944 a1c6a512-1295-4272-9138-f99709370657
2010-02-27 17:07:54 +00:00
Jack Halpin
d95211a23d sd-as3525v2: Controller and card init much more reliably now.
Remove MCI_HCON read from init_controller() as it now appears unneccesary.
Make sd-init_card() use similar init sequence to the one in sd-as3525.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24903 a1c6a512-1295-4272-9138-f99709370657
2010-02-25 06:46:16 +00:00