Violating Bell inequalities maximally for two d-dimensional systems