I think you have some issues here...
First off, you are exporting (enabling for control) GP22, then in the next line you're controlling GP21. You've got your signals mixed up there.
Then you seem to have some confusion over the signals:
- GP19 is the AR3391 signal that is routed as the handshake signal to the '32U4 processor's shield pin 7.
- GP21 is the output enable for a level shifter that buffers the SPI signals between the two processors. (U5 on schematic sheet 4)
- GP22 is the output enable for a level shifter that buffers the handshake line between the processors. (U7 on schematic sheet 4)
I wrote a fairly lengthy description of controlling that line HERE which includes code both on the Linux side to control the handshake line, and on the sketch side to wait for the signal to be active.
The Linux side code is:
# Added section to set the handshake line.
# GP19 is connected to D7 of the 32U4 processor.
# This requires setting GP22 high to enable the U7 level shifter.
# This GPIO is already exported.
# Then GP19 needs to be exported, set to output, and finally brought low.
echo 1 > /sys/class/gpio/gpio22/value
echo 19 > /sys/class/gpio/export
echo "high" > /sys/class/gpio/gpio19/direction
echo 0 > /sys/class/gpio/gpio19/value
The first thing it does is turn on the level shifter using GP22.
Then it exports GP19 so that it can be controlled. (GP22 is already exported by default, it does not need to be re-exported unless you unexport it at some point.)
Next, it sets GP19 as an output.
Finally, it sets the output low.
Up until this point, with the level shifter disabled, the output has been floating. By programming the sketch such that pin 7 is an input with pullup resistors, that floating signal is read as a high. Once the code above runs, the output is driven low, and the sketch reads it as a low.
The level shifter should be bi-directional, so it should also be valid to set GP19 as an input, and pin 7 as an output, and have the Linux side read the data that the sketch outputs.
Note that the code above is designed to run only once (I put it in /etc/rc.local so it runs once after booting is done.) I used it as a signal that Linux is fully booted, and the sketch can use the serial port without fear of interrupting the boot process. If you want to use the signal for more than that, of the four lines of actual code, the first three should only be done once. Then you can echo 0 or 1 to /sys/class/gpio/gpio19/value as needed.