Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/josejx/josejx.net/collie/index.php:1) in /hsphere/local/home/josejx/josejx.net/collie/index.php on line 341

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/josejx/josejx.net/collie/index.php:1) in /hsphere/local/home/josejx/josejx.net/collie/index.php on line 342
Clock

Clock

Front Page Edit Recent Changes All Pages Find Page

The clock is set through the LoCoMo SPI Mode Setting register as shown below:

SPI Mode Setting

Mask Usage
0x0018 Clock Bit, valid values are [0,4]
0x0007 Multiplier Select, valid values are [0,2] (maybe 3)

Defaults

Clock Bit: 4
Multiplier Select: 2

When is the clock enabled / disabled (as below) ?

The clock is disabled on insert, removal and suspend. The clock is enabled only during reading and writing.

Setting the Clock

Cache the clock settings so that if the clock is already set, you don't need to update it.

The Clock settings depend on the TransmissionSpeed of the card as below:

Clock Disabled

This is always set to:
Clock Bit Multiplier Select
4 0

Clock Enabled

If this is an MMC card, the Multiplier Select defaults to 0, otherwise (SD) the Multiplier Select defaults to 2, but may be set elsewhere (looking...)

Multiplier Select is 2

Transfer Speed Clock Bit
>240 0
>120 1
>60 2
Otherwise 3

Multiplier Select is 1

Transfer Speed Clock Bit
>220 0
>110 1
>50 2
Otherwise 3

Multiplier Select is 0

Transfer Speed Clock Bit
>180 0
>90 1
>45 2
Otherwise 3

Otherwise

The Clock Bit is always 3

Once you have the clock bits determined

1. If the clock bits need to be updated
  a. Write the value of the LoCoMo SPI Mode Register AND'd with ~0x7 and OR'd with the clock bits back to the LoCoMo SPI Mode Register
2. If the Multiplier bits need to be updated and bit 0x2000 is not set in LoCoMo GPIO Level register
  a. Unset bit 0x40 in the LoCoMo SPI Mode Register
  b. Write the value of the LoCoMo SPI Mode Register AND'd with ~0x18 and OR'd with the clock bits left shifted by 3 back to the LoCoMo SPI Mode Register
  c. Set bit 0x40 in the LoCoMo SPI Mode Register
3. After setting the clock, there is a delay of 200uSec