Generalized convolution quadrature for the fractional integral and fractional diffusion equations