Sounds like The Unsuccessful yet Academically Unparalleled Sage - A Cheating S-Rank Sorcerer's Post-Rebirth Adventurer Log.
From Baka-Updates:
After reincarnating in a different world, the great sage Ephthal spent all of his life researching magic. However, he who had aimed to reach the summit of magic, knew of the limits of his talents and fell into despair, thus closing the curtain to his lifetime. However, 400 years later, he reincarnated for the second time and enrolled in a magic academy using the sorcery and knowledge he acquired from his previous life. As if to sneer at the state of magic that had been in decline for the past 400 years, he easily invokes legendary class magic! With overwhelming power, the entire world will kneel before him.
Ephthal was one of four sages who helped the hero to defeat the Demon King. As a reward, all four sages were given the title of emperor, with Ephthal being "the Emperor of Thunder." In the aftermath of the battle with the Demon King, he also discovered the Demon King's orphaned baby daughter, Merlin, and adopted her as his disciple.
He eventually dies of old age and is reincarnated 400 years later as boy who's one of his own descendants. He goes on to attend a magic school where Merlin is a teacher. She senses a familiar aura about him, but he initially tries to hide his true identity from her.
