i can name three reasons for the foaming :

1. overfilled with atf.
2. wrong type of atf used.
3. restricted or plugged transmission.