Change code to support multiple chips.

Signed-off-by: Haifeng Yan <yanhaifeng@gmail.com>