Hi this sounds normal to me, it will normally stop by 5 years of age, however you need to take measures to stop him from hurting himself, move the bed away from the wall, put padding over the headboard & provide more pillows.
I say it is normal as I did it from age 3 maybe younger many children do & then grow out of it, however the only problem is I still do it at 23 years old, if it doesn't disappear by age 5 it's probably Rhythmic Movement Disorder, if you do some research you will find there doesn't seem to be much you can do if it is, the main stay of treatment seems to be behavioural treatment like CBT (Cognitive Behavioural Therapy) some of the behavioural treatment include a Water bed, or Memory foam Mattress & Pillows, although your littleun sounds a bit young for any of this yet.
Hope this helps Best of Luck - I hope he grows out of it as it is a nightmare not just for you but for him, as he gets older he'll get more conscious about it, please don't shout at him if it doesn't stop as it will make him feel punished about something he has no control over, my parents screamed & shouted at me as they thought I was doing it for attention & didn't realize I wasn't actually able to control it, it is really frustrating & he is suffering as it affects his sleep as well as yours.
Always remember to keep an open mind xxx :)
Oh and I forgot to mention he has a permanent bump on teh back of his head from the banging!