common/i2c: Improve port number validation in i2c_set_freq
common/i2c: Improve port number validation in i2c_set_freq

This adds additional checks to the port number validation in
i2c_set_freq.  get_i2c_port could potentially return a NULL pointer, so
check for that.  Also, when DYNAMIC_SPEED is not enabled on a port,
return ERROR_UNIMPLEMENTED instead of ERROR_INVAL.

BRANCH=none
BUG=b:201039003
TEST=with follow-on patches, switched I2C bus speed between 400 kHz
	and 1 MHz.

Change-Id: Ie58d68ee2b64d94681ea1d5044530195210ff661
Signed-off-by: Caveh Jalali <08e24a66aefda7a55ca7d73f8903e0fb16eec763@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3181503
Reviewed-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Reviewed-by: Boris Mittelberg <46897f4fb5cad4b1d5146ad1fd460d7f4825bbf7@google.com>

coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec