honeylab's blog

各種ハードウェアの改造、主にファミコンミニなどをやってます(ました)

mainline u-boot + sunxi 3.4.112 で i2cが動かない件についてまとめながらメモ

u-bootで、ニンテンドークラシックミニがi2cやコントローラの電源としている3.3V系をaxp223が出力するようにmainline u-bootを設定してやったところ正常に動作しました。
以下は勘違いによる見解ですが、一応残しておきます。

 

・mainline u-boot (U-Boot 2016.11-00415-g3c980ba-dirty) with MMC

からboot.cmdでscript.binも読んでKernelを読み込んだ後,EP952とi2cできないので気づいた

ただし、内蔵u-boot改変(sunxi_flash を外してboota 0x43800000だけ残す)のを使って
write 0x43800000 boot.img, write 0x47000000 u-boot_2.bin をすると起動後i2cできる。

※内蔵u-bootを経由した場合

# i2cdetect 0 29 29
[ 115.095085] i2c i2c-0: ioctl, cmd=0x705, arg=0xbe9c8c2c
i2cdetect: WARNING! This program can confuse your I2C bus
Continue? [y/N] y
[ 116.188546] i2c i2c-0: ioctl, cmd=0x703, arg=0x29
[ 116.196477] i2c i2c-0: ioctl, cmd=0x720, arg=0xbe9c8c0c
[ 116.205036] i2c i2c-0: master_xfer[0] W, addr=0x29, len=0

0 1 2 3 4 5 6 7 8 9 a b c d e f
00:
10:
20: 29
30:
40:
50:
60:
70:

# i2cdetect 1 52 52
[ 124.764370] i2c i2c-1: ioctl, cmd=0x705, arg=0xbe99bc2c
i2cdetect: WARNING! This program can confuse your I2C bus
Continue? [y/N] y

[ 125.712091] i2c i2c-1: ioctl, cmd=0x703, arg=0x52
[ 125.719827] i2c i2c-1: ioctl, cmd=0x720, arg=0xbe99bc0c
[ 125.728379] i2c i2c-1: master_xfer[0] W, addr=0x52, len=0

0 1 2 3 4 5 6 7 8 9 a b c d e f
00:
10:
20:
30:
40:
50: 52
60:
70:

 

内蔵u-bootを経由しないと、

[i2c0] START can't sendout!

になる

 

違い

script.binがちょっとだけ違うけど、i2cまわりは触ってない

u-bootが違う

 

なので、内蔵u-bootからFELに入って u-boot-sunxi-with-splを経由してからを読んだらどうなる?を試してみる。