HS mode in RPi

Ian Lepore ian at freebsd.org
Sun Jan 18 20:52:35 UTC 2015


On Sun, 2015-01-18 at 17:31 +0900, Daisuke Aoyama wrote:
> I forget mention. r276985 is complete wrong.
> 
> SDHCI_COMMAND_FLAGS is never stored in local variable.
> So accessing it means "return uninitialized value".
> 
> >	if (off == SDHCI_TRANSFER_MODE) {
> >		return (sc->cmd_and_mode >> 16);
> >	} else if (off == SDHCI_COMMAND_FLAGS) {
> >		return (sc->cmd_and_mode & 0x0000ffff);
> >	}
> 

Fixed in r277346, but nothing will actually change because nothing right
now does a 16-bit read of SDHCI_COMMAND_FLAGS.  But if that ever
changes, now the code will work right.

> Also I fixed, the code may return unexpected value.
> 16bit width access should use even address.
> >return ((val >> (off & 3)*8) & 0xffff);

sdhci will never do a bus_space_read_2() on an odd address, so (off & 3)
has the same effect as (off & 2).  In general it is expected that the
bus_space accessor functions will be used with offsets that are aligned
to the size of the operation.  The documentation doesn't absolutely
forbid unaligned access, but it strongly encourages natural alignment
and notes that unaligned operations may fail.

-- Ian




More information about the freebsd-arm mailing list