dslinux/linux-2.6.x/drivers/mmc scsd_c.c scsd_s.S
Malcolm
malcolm.parsons at gmail.com
Sun Aug 27 23:31:37 CEST 2006
On 8/27/06, amadeus <dslinux_amadeus at user.in-berlin.de> wrote:
> Log Message:
> Rewrite of SD driver to allow 32 MByte GBA ROM space used as RAM
Some of the changes may do that, but it's a misleading comment.
> +/* Structure for device-specific functions in assembler.
> +*/
> +struct sd_functions {
> + /* Test if the card is present.
> + Return != 0 if present. */
> + int (*detect_card) (void);
> +
> + /* Say if the data transfer is 1 or 4 bit.
> + Return != 0 if 4 bit. */
> + int (*transfer_nibbles) (void);
> +
> + /* Write at minimum 8 clock cycles to the card.
> + Wait max. 1ms for the CMD line to become HIGH.
> + Send a command to the card. Skip 2 Z bits.
> + data = pointer to start of command. 32bit aligned.
> + len = length of the command (including CRC7).
> + Return != 0 if OK, 0 if timeout. */
> + int (*send_command) (u8 *data, int len);
> +
> + /* Wait max. 1ms for the CMD line to become LOW.
> + Read a response from the device and skip 2 Z bits.
> + data = pointer to start of response buffer. 32bit aligned.
> + len = number of bytes to read(including CRC).
> + Return != 0 if OK, 0 if timeout. */
> + int (*read_response) (u8* data, int len);
> +
> + /* Wait for the DATA line to become HIGH.
> + Return != 0 if OK, 0 if timeout.
> + Maximum length of testing is 1ms. */
> + int (*wait_ready) (void);
> +
> + /* Write a start bit, send a Data block incl. CRC.
> + Write the end bit. Skip 2 Z bits.
> + Wait max. 1ms for the start of the CRC response.
> + Check the CRC response.
> + data = pointer to start of data. 32bit aligned.
> + len = number of bytes to send.
> + Return != 0 if OK, 0 if CRC missing or error. */
> + int (*send_data) (u8 *data, int len);
> +
> + /* Wait max 1ms for the DATA line to become LOW.
> + Receive a Data block and CRC, skip the end bit.
> + data = pointer to start of data. 32bit aligned.
> + len = number of bytes to receive (incl. CRC)
> + Return != 0 if OK, 0 if timeout. */
> + int (*read_data) (u8 *data, int len);
> +
> + /* Read the write protect switch.
> + Return != 0 if readonly, 0 if r/w.
> + When in doubt, return 0. */
> + int (*read_only) (void);
> +
> + /* Write at minimum 8 clock cycles to the card. */
> + void (*send_clocks) (void);
> +};
I specifically told you not to do this.
The MMC layer handles using different drivers for different devices.
Don't stick support for different devices in one driver.
Also "Structure for device-specific functions in assembler."
"in assembler"?!
Don't write an M3SD driver in assembler.
--
Malcolm Parsons
More information about the dslinux-devel
mailing list