#!/bin/sh -x
echo jz4740-mmc.0 >/sys/bus/platform/drivers/jz4740-mmc/unbind
PDFUNC=0x10010348
PDDATS=0x10010314
PDDATC=0x10010318
PDDIRS=0x10010364
PDDIRC=0x10010368
# PD08 through PD13
MMC_IO=0x3f00
./poke $PDFUNC $MMC_IO  # make all MMC I/Os GPIOs
./poke $PDDATS 4        # disable MMC power
./poke $PDDATC $MMC_IO  # set all MMC I/Os to 0
./poke $PDDIRS $MMC_IO  # make all MMC I/Os outputs
sleep 1                 # wait for the capacitors to drain
# 10 uF at 3.3 V discharges into 2 kOhm to > 30 mV within 100 ms
#./poke $PDDIRC $MMC_IO  # make all MMC I/Os inputs
./poke $PDDATC 4        # enable MMC power
