Bug 155894 - [at91] [patch] Enable at91 booting from SDHC (high capacity) cards
Summary: [at91] [patch] Enable at91 booting from SDHC (high capacity) cards
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-24 00:40 UTC by Ian Lepore
Modified: 2014-07-26 04:18 UTC (History)
1 user (show)

See Also:


Attachments
patch-boot-arm-libat91-sdhc (21.68 KB, text/plain)
2011-03-24 00:40 UTC, Ian Lepore
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Lepore 2011-03-24 00:40:01 UTC
This change enables at91 systems to boot from high capacity SD cards.
It also fixes a few minor violations of the SD protocol, such as running the 
bus at high speed during the card identification sequence.

The sdcard_init() routine now probes for SDHC cards so that later read requests
can make needed adjustments between block and byte offsets based on card type.

There is a new MCI_readblocks() function that takes block number and block
count parameters instead of byte-offset values.  Using this routine, boot 
loader code can load a kernel from any location on an SDHC or standard SD card.

The old MCI_read() interface remains unchanged so that existing customized 
boot loader code will still keep working without changes.  Using this routine,
boot loaders can load a kernel from anywhere in the first 4GB of an SDHC card
(or of course any location on a standard SD card).

A new sdcard_use4wire() routine allows boot loaders to request 4-bit transfers;
it should be called after sdcard_init().  The sdcard_init() routine no longer 
assumes the hardware is 4-wire capable and by default sets things up for 1-bit 
transfers.

Fix: This patch should apply cleanly to any FreeBSD from 6.2 through -current.
How-To-Repeat: n/a
Comment 1 commit-hook freebsd_committer freebsd_triage 2014-07-26 04:16:48 UTC
A commit references this bug:

Author: ian
Date: Sat Jul 26 04:16:05 UTC 2014
New revision: 269113
URL: http://svnweb.freebsd.org/changeset/base/269113

Log:
  Enable at91 systems to boot from high capacity SD cards.

  This also fixes a few minor violations of the SD protocol, such as running
  the bus at high speed during the card identification sequence.

  The sdcard_init() routine now probes for SDHC cards so that later read
  requests can make needed adjustments between block and byte offsets based
  on card type.

  There is a new MCI_readblocks() function that takes block number and block
  count parameters instead of byte-offset values.  Using this routine, boot
  loader code can load a kernel from any location on an SDHC or standard SD.

  The old MCI_read() interface remains unchanged so that existing customized
  boot loader code will still keep working without changes.  Using this
  routine, boot loaders can load a kernel from anywhere in the first 4GB of
  an SDHC card (or of course any location on a standard SD card).

  A new sdcard_use4wire() routine allows boot loaders to request 4-bit
  transfers; it should be called after sdcard_init().  The sdcard_init()
  routine no longer assumes the hardware is 4-wire capable and by default
  sets things up for 1-bit transfers.  (4-wire mode is unreliable on
  at91rm9200, works on later SoCs.)

  PR:		155894
  Submitted by:	me.  years ago.

Changes:
  head/sys/boot/arm/at91/libat91/mci_device.h
  head/sys/boot/arm/at91/libat91/sd-card.c
  head/sys/boot/arm/at91/libat91/sd-card.h