#!/bin/bash
#
# Get the PCI address of the SD Controller
ADDR=$(lspci | grep "Generic system peripheral \[0805\]: Texas
Instruments PCI6411, PCI6421, PCI6611, PCI6621, PCI7411, PCI7421,
PCI7611, PCI7621 Secure Digital (SD) Controller")
BASE=${ADDR:0:5} #on my system this works out to 0b:00

#Turn on the SD interface using info found at
#http://gentoo-wiki.com/HARDWARE_Gentoo_Acer_Ferrari_4005WLMi_Manual

setpci -s ${BASE}.0 86.b=90:d0 # SDHCI enable
#echo 0 > /sys/bus/pci/slots/0000:06:09.3/power
#echo 0 > /sys/bus/pci/slots/0000:06:09.2/power
#echo 0 > /sys/bus/pci/slots/0000:06:09.0/power
#echo 1 > /sys/bus/pci/slots/0000:06:09.0/power

setpci -s ${BASE}.3 4c.b=02 # FlashMedia SD disable
setpci -s ${BASE}.4 04.b=06 # SDHCI Mem+ BusMaster+
setpci -s ${BASE}.4 88.b=01 # SDHCI DMA enable

