Millwall have signed Yeovil midfielder Ed Upson on a two-and-a-half-year deal for an undisclosed fee.