if gpio input 102; then setenv board_name revA ; else setenv board_name revB;fi
The if statement checks the return status of the command "gpio input 102", not the GPIO value. A return status of 0 indicates success (true). A return status of 1 indicates failure (false).