Mick Schumacher has joined Mercedes as reserve driver after Ferrari ended its four-year affiliation with him.