I know part of Qur'an was revealed in Makka and remaining was revealed in Madina. However, some surahs of the Qur'an (moshaf) are declares to be "makki" or "madani", based on revelation.
So I want to know: who defined the terms makki and madani?
First you should know that there are 3 definitions of makki and madani which are used by scholars:
Now when it comes to whom have made this definition or whom first made a difference between surahs of the Qur'an and claimed that some are makki and other madani. Then we could exclude that this was based on statements of the Prophet (), as if he had made such a distinction using these terms, we would know about that via his traditions (hadith, seerah etc.).
So this terms is rather defined by statements of the sahaba () -whom witnessed the revelation- and their students the tabi'in as claimed by qadi abu Bakr al-Baqilani in his Al-Intiṣār lil-Qur’ān نكت الانتصار لنقل القرآن adding that our Prophet () never did, so as he was not ordered to do it and knowing the difference is not a knowledge which the -whole- Uma is asked (ordered) to know! You can read a quote in the book of Imam az-Zarkashi called Al-burhān fī `ulūm al-Qur'an (البرهان في علوم القرآن) in Arabic:
إنما يرجع في معرفة المكي والمدني لحفظ الصحابة والتابعين، ولم يرد عن النبي في ذلك قول لأنه لم يؤمر به، ولم يجعل الله علم ذلك من فرائض الأمة
That's why most tafsir books like tafsir al-Kashaf and tafsir al-Qurtobi quote when commenting verse (2:21) the following narration:
'Alqamah and Mujahid said that every ayat which begins with "Mankind" was revealed in Makka and everyone with "You who believes" was revealed in Madina. ...
(Source: Tafsir al-Qurtobi p. 178, this is also reported on the authority of Abdullah ibn Mas'od by al-Bayhadi and al-Hakim)