[Letux-kernel] letux-4.7-rc7: charging & ethernet gadget
H. Nikolaus Schaller
hns at goldelico.com
Thu Jul 21 09:00:09 CEST 2016
> Am 20.07.2016 um 22:53 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
>>
>> Am 20.07.2016 um 20:07 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>
>>
>>> Am 20.07.2016 um 12:08 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>>
>>>
>>>> Am 20.07.2016 um 11:17 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>>>
>>>> Hi Andreas,
>>>>
>>>>>
>>>>>> [ 60.034973] twl4030 REG_BCICTL1 = 12
>>>>>> [ 60.046569] twl4030 REG_BCICTL2 = 00
>>>>>> [ 60.061920] twl4030 current = 10 uA
>>>>>> [ 60.074676] twl4030 res = 0 Ohm
>>>>>> [ 60.089141] twl4030 temp = 59 C
>>>>>> temp: 56°C
>>>>>
>>>>> This means ITHEN is disabled after boot! For whatever reasons.
>>>>
>>>> I can't even set the ITHEN bit!
>>>>
>>>> [ 279.510040] twl4030_madc_set_current_generator read regval = 12
>>>> [ 279.517547] twl4030_madc_set_current_generator write regval = 1a
>>>> [ 279.527343] twl4030_madc_set_current_generator read back regval = 12
>>
>> it is not lost in software but by hardware:
>>
>> [ 67.609069] twl_i2c_read 2 23->97[1] -> 12...
>> [ 67.613647] twl4030_madc_set_current_generator read regval = 12
>> [ 67.620941] twl4030_madc_set_current_generator write regval = 1a
>> [ 67.628112] twl_i2c_write 2 23->97[1] -> 1a...
>> [ 67.637786] twl_i2c_read 2 23->97[1] -> 12...
>> [ 67.637817] twl4030_madc_set_current_generator read back regval = 12
>
> I have now looked through the full boot log and ~13.30 seconds
> the register value is 0x1b. For ca. 30ms. Then it goes back to 0x12.
>
> Here an interesting sequence:
>
> [ 13.296447] musb-hdrc musb-hdrc.0.auto: power state already 0
> [ 13.296478] twl4030_bci 48070000.i2c:twl at 48:bci: OTG notify 1
> [ 13.296478] twl4030_bci 48070000.i2c:twl at 48:bci: OTG notify USB_EVENT_VBUS
>
> ^^^ twl4030_bci_usb_work() prints this message
>
> vvv this must be twl4030_charger_enable_usb()
>
> [ 13.296508] twl_i2c_write 14 0a->0a[2] -> 00...
> [ 13.296661] twl_i2c_write 14 13->13[1] -> 20...
> [ 13.296966] twl_i2c_read 14 13->13[1] -> de...
>
> ^^^ oops. Another unwriteable register?
Yes... That is ok. It is register CTRL_SW2 and only bit 5 is
writeable but returns 0. So writing 0x20 sets this bit bit it is reset
automatically. All other bits are read only.
>
> seems to belong to madc (14 = TWL4030_BASEADD_MADC).
> See: http://lxr.free-electrons.com/source/drivers/mfd/twl-core.c#L174
>
> [ 13.297180] twl_i2c_read 14 4d->4d[2] -> 40...
>
> vvv this is ac_available()
>
> [ 13.297180] twl4030_madc_conversion ret=1
> [ 13.297180] twl4030_madc_read chan=11 val=9
> [ 13.297210] twl4030_bci vac 9
> [ 13.297210] twl4030_bci 48070000.i2c:twl at 48:bci: cgain 0
> [ 13.297454] twl_i2c_read 2 23->97[1] -> 12...
>
> ^^^ still 0x12
>
> [ 13.297851] twl_i2c_read 3 07->3d[1] -> 35...
> [ 13.298004] twl_i2c_read 9 05->05[1] -> 80...
> [ 13.298095] twl_i2c_read 2 1d->91[1] -> 59...
> [ 13.298370] twl_i2c_read 2 1e->92[1] -> 9f...
> [ 13.298370] twl4030_bci 48070000.i2c:twl at 48:bci: cur 500000 reg 812
> [ 13.298583] twl_i2c_read 2 27->9b[1] -> 00...
> [ 13.298828] twl_i2c_read 2 28->9c[1] -> 02...
> [ 13.298828] twl_i2c_write 2 11->85[1] -> e7...
> [ 13.299011] twl_i2c_write 2 28->9c[1] -> 03...
> [ 13.299194] twl_i2c_write 2 11->85[1] -> e7...
> [ 13.299377] twl_i2c_write 2 27->9b[1] -> 2c...
> [ 13.299743] twl_i2c_read 3 07->3d[1] -> 35...
> [ 13.299743] twl_i2c_write 3 07->3d[1] -> 37...
> [ 13.300170] twl_i2c_read 2 10->84[1] -> f0...
> [ 13.300170] twl_i2c_write 2 10->84[1] -> f4...
> [ 13.300567] twl_i2c_read 9 05->05[1] -> 80...
> [ 13.300933] twl_i2c_read 1 01->81[1] -> 04...
>
> vvv here an interrupt occurs and both interrupt status registers are read
>
> [ 13.301116] twl_i2c_read 15 00->b9[1] -> 08...
> [ 13.301300] twl_i2c_read 15 01->ba[1] -> 00...
> [ 13.301330] twl4030_bci 48070000.i2c:twl at 48:bci: BCI irq 00 08
>
> vvv seems to be twl4030_charger_update_current()
>
> [ 13.301391] twl_i2c_write 14 0a->0a[2] -> 00...
> [ 13.301544] twl_i2c_write 14 13->13[1] -> 20...
> [ 13.301879] twl_i2c_read 14 13->13[1] -> de...
>
> ^^^ oops again!
>
> [ 13.302062] twl_i2c_read 14 4d->4d[2] -> 00...
>
> vvv this is ac_available()
>
> [ 13.302062] twl4030_madc_conversion ret=1
> [ 13.302093] twl4030_madc_read chan=11 val=0
> [ 13.302093] twl4030_bci vac 0
> [ 13.302093] twl4030_bci 48070000.i2c:twl at 48:bci: cgain 0
> [ 13.302246] twl4030_bci 48070000.i2c:twl at 48:bci: get_property: 4
> [ 13.302398] twl_i2c_read 2 23->97[1] -> 1b...
>
> ^^^ now 0x1b - some of the previous i2c_write must have enabled
>
> [ 13.302581] twl_i2c_read 3 07->3d[1] -> 37...
> [ 13.302886] twl_i2c_read 2 1d->91[1] -> 59...
> [ 13.303009] twl4030_bci 48070000.i2c:twl at 48:bci: get_property: 4
> [ 13.303100] twl_i2c_read 2 1e->92[1] -> 9f...
> [ 13.303131] twl4030_bci 48070000.i2c:twl at 48:bci: cur 500000 reg 812
>
> ...
>
> shortly after than I get
>
> [ 13.334228] twl4030_bci 48070000.i2c:twl at 48:bci: BCI irq 00 08
> [ 13.334289] twl_i2c_write 14 0a->0a[2] -> 00...
> [ 13.334472] twl_i2c_write 14 13->13[1] -> 20...
> [ 13.334808] twl_i2c_read 14 13->13[1] -> de...
>
> vvv this differs a little - but I don't know if it is relevant
>
> [ 13.334991] twl_i2c_read 14 4d->4d[2] -> 40...
>
> vvv this is ac_available()
>
> [ 13.335021] twl4030_madc_conversion ret=1
> [ 13.335021] twl4030_madc_read chan=11 val=9
> [ 13.335021] twl4030_bci vac 9
> [ 13.335052] twl4030_bci 48070000.i2c:twl at 48:bci: cgain 0
> [ 13.335266] twl_i2c_read 2 23->97[1] -> 12...
>
> ^^^ now 0x12 - something has disabled ITHEN in between
>
> Looks as if I should trace twl4030_charger_enable_usb()
> twl4030_charger_update_current() and friends. Tomorrow...
>
> BR,
> Nikolaus
>
> _______________________________________________
> http://projects.goldelico.com/p/gta04-kernel/
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel
More information about the Letux-kernel
mailing list