How to repair mortar that is crumbling?
If the mortar is crumbling and flaking, it MUST be removed.  It is a tedious job, bit to assure a good solid surface, you have to remove all loose mortar, key it, and point all the joints.  Let it cure a few weeks, be absolutely it is dried, then go for the finish. If you don't get to a solid base, you will be wasting your time and paint. Remember, the right way is the only way.