Veteran shortstop Jimmy Rollins has agreed to a minor league deal with the San Francisco Giants, his third team in three years after spending the first 15 seasons of his career with the Philadelphia Phillies.

The deal will pay Rollins $1 million if he makes the Giants' major league roster, a source told ESPN's Jerry Crasnick. Making the roster would mean a return home for Rollins, who was born in Oakland and grew up in nearby Alameda.

Rollins, 38, signed a minor league deal with the Chicago White Sox last year and made the big league roster. But he was designated for assignment in June after hitting .221 in 41 games. Despite saying he still wanted to play, he did not hook up with another team.

Rollins played for the Los Angeles Dodgers in 2015, but his best days were with the Phillies. A three-time All-Star, Rollins was the National League MVP in 2007 when he hit .296 with 30 homers, 94 RBIs, a league-leading 20 triples and 41 steals.

Jimmy Rollins played in 41 games for the White Sox last season. Kim Klement/USA TODAY Sports

He also won four Gold Gloves, the latest coming in 2012.

The Phillies traded Rollins to the Dodgers in December 2014 for a pair of minor leaguers.

The Giants won the wild-card game over the New York Mets last season and then lost to the Chicago Cubs in the division series. Brandon Crawford is a fixture at shortstop with an All-Star appearance in 2015 and Gold Gloves in 2015 and '16.

Rollins' deal was first reported by Fox Sports.