Controlling mixing and segregation in time periodic granular flows