#
# shell script to read and then set pinmux to agree with P8/9 settings.
# only a few items need to be changed to match - so only those changed.
#
# first - mount or check for mounted debugfs
mount -t debugfs none /sys/kernel/debug

# next read the debugfs values of items to change
#
cat /sys/kernel/debug/omap_mux/gpmc_wait0 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_wpn | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_a2 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_a3 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/spi0_d0 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/spi0_sclk | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/uart1_txd | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/uart1_rxd | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/mcasp0_ahclkr | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/mcasp0_fsx | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/mcasp0_axr0 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/mcasp0_aclkx | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad7 | grep :name"" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad2 | grep :name"" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_advn_ale | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_oen_ren | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ben0_cle | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_wen | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad9 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad8 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad5 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad4 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad1 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad0 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_csn0 | grep "name:" | cut -d " " -f 2,4,5 
cat /sys/kernel/debug/omap_mux/lcd_data14 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data15 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data13 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data11 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data12 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data10 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data8 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data9 | grep "name:" | cut -d " " -f 2,4,5

# set the values
echo " "
echo " "
echo "setting the values to P8/9 defined modes"

echo 26 > /sys/kernel/debug/omap_mux/gpmc_wait0
echo 06 > /sys/kernel/debug/omap_mux/gpmc_wpn
echo 06 > /sys/kernel/debug/omap_mux/gpmc_a2
echo 06 > /sys/kernel/debug/omap_mux/gpmc_a3
echo 01 > /sys/kernel/debug/omap_mux/spi0_d0
echo 21 > /sys/kernel/debug/omap_mux/spi0_sclk
echo 00 > /sys/kernel/debug/omap_mux/uart1_txd
echo 30 > /sys/kernel/debug/omap_mux/uart1_rxd
echo 03 > /sys/kernel/debug/omap_mux/mcasp0_ahclkr
echo 03 > /sys/kernel/debug/omap_mux/mcasp0_fsx
echo 33 > /sys/kernel/debug/omap_mux/mcasp0_axr0
echo 03 > /sys/kernel/debug/omap_mux/mcasp0_aclkx
echo 37 > /sys/kernel/debug/omap_mux/gpmc_ad7
echo 37 > /sys/kernel/debug/omap_mux/gpmc_ad2
echo 02 > /sys/kernel/debug/omap_mux/gpmc_advn_ale
echo 02 > /sys/kernel/debug/omap_mux/gpmc_oen_ren
echo 02 > /sys/kernel/debug/omap_mux/gpmc_ben0_cle
echo 02 > /sys/kernel/debug/omap_mux/gpmc_wen
echo 04 > /sys/kernel/debug/omap_mux/gpmc_ad9
echo 04 > /sys/kernel/debug/omap_mux/gpmc_ad8
echo 37 > /sys/kernel/debug/omap_mux/gpmc_ad5
echo 37 > /sys/kernel/debug/omap_mux/gpmc_ad4
echo 37 > /sys/kernel/debug/omap_mux/gpmc_ad1
echo 37 > /sys/kernel/debug/omap_mux/gpmc_ad0
echo 37 > /sys/kernel/debug/omap_mux/gpmc_csn0
echo 26 > /sys/kernel/debug/omap_mux/lcd_data14
echo 06 > /sys/kernel/debug/omap_mux/lcd_data15
echo 06 > /sys/kernel/debug/omap_mux/lcd_data13
echo 06 > /sys/kernel/debug/omap_mux/lcd_data11
echo 26 > /sys/kernel/debug/omap_mux/lcd_data12
echo 26 > /sys/kernel/debug/omap_mux/lcd_data10
echo 04 > /sys/kernel/debug/omap_mux/lcd_data8
echo 24 > /sys/kernel/debug/omap_mux/lcd_data9

echo " "
echo " "
# now see what the new values are
cat /sys/kernel/debug/omap_mux/gpmc_wait0 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_wpn | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_a2 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_a3 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/spi0_d0 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/spi0_sclk | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/uart1_txd | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/uart1_rxd | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/mcasp0_ahclkr | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/mcasp0_fsx | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/mcasp0_axr0 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/mcasp0_aclkx | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad7 | grep :name"" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad2 | grep :name"" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_advn_ale | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_oen_ren | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ben0_cle | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_wen | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad9 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad8 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad5 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad4 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad1 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_ad0 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/gpmc_csn0 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data14 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data15 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data13 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data11 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data12 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data10 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data8 | grep "name:" | cut -d " " -f 2,4,5
cat /sys/kernel/debug/omap_mux/lcd_data9 | grep "name:" | cut -d " " -f 2,4,5


