xref: /linux/Documentation/networking/devlink/ptp_ocp.rst (revision a4b7c15aa78f1064a4f9a89b8ea43905daf5ab27)
13b815e29SSagi Maimon.. SPDX-License-Identifier: GPL-2.0
23b815e29SSagi Maimon
33b815e29SSagi Maimon========================
43b815e29SSagi Maimonptp_ocp devlink support
53b815e29SSagi Maimon========================
63b815e29SSagi Maimon
73b815e29SSagi MaimonThis document describes the devlink features implemented by the ``ptp_ocp``
8*a4b7c15aSSagi Maimondevice driver: the info versions it reports and its flash update support.
93b815e29SSagi Maimon
103b815e29SSagi MaimonInfo versions
113b815e29SSagi Maimon=============
123b815e29SSagi Maimon
133b815e29SSagi MaimonThe ``ptp_ocp`` driver reports the following versions
143b815e29SSagi Maimon
153b815e29SSagi Maimon.. list-table:: devlink info versions implemented
163b815e29SSagi Maimon   :widths: 5 5 90
173b815e29SSagi Maimon
183b815e29SSagi Maimon   * - Name
193b815e29SSagi Maimon     - Type
203b815e29SSagi Maimon     - Description
213b815e29SSagi Maimon   * - ``fw``
223b815e29SSagi Maimon     - running
233b815e29SSagi Maimon     - Version of the firmware running on the card.  Reported as ``loader``
243b815e29SSagi Maimon       instead when the card is running the firmware loader.
253b815e29SSagi Maimon   * - ``board.id``
263b815e29SSagi Maimon     - fixed
273b815e29SSagi Maimon     - Board identifier, read from the on-card EEPROM.
283b815e29SSagi Maimon   * - ``cpld.id``
293b815e29SSagi Maimon     - fixed
303b815e29SSagi Maimon     - Lattice device ID (IDCODE) of the TAP CPLD, formatted as ``0x%08x``.
313b815e29SSagi Maimon       Only present on ADVA TimeCard X1 boards, which are the only ones
323b815e29SSagi Maimon       carrying that CPLD.  Reading it claims the shared I2C bus and
33*a4b7c15aSSagi Maimon       reprograms the on-card mux, so the driver does that from its own
34*a4b7c15aSSagi Maimon       worker and reports the cached value here; the version is omitted
35*a4b7c15aSSagi Maimon       until that read has succeeded.  The read is made once per binding
36*a4b7c15aSSagi Maimon       and again after a successful CPLD update.
37*a4b7c15aSSagi Maimon   * - ``fw.cpld``
38*a4b7c15aSSagi Maimon     - running
39*a4b7c15aSSagi Maimon     - USERCODE of the image programmed into the TAP CPLD, formatted as
40*a4b7c15aSSagi Maimon       ``0x%08x``.  Read together with ``cpld.id`` and reported the same
41*a4b7c15aSSagi Maimon       way.  This is the component name to pass to ``devlink dev flash``
42*a4b7c15aSSagi Maimon       to update the CPLD.
43*a4b7c15aSSagi Maimon
44*a4b7c15aSSagi MaimonFlash update
45*a4b7c15aSSagi Maimon============
46*a4b7c15aSSagi Maimon
47*a4b7c15aSSagi MaimonThe driver implements ``devlink dev flash`` for two separate targets,
48*a4b7c15aSSagi Maimonselected with the component name.
49*a4b7c15aSSagi Maimon
50*a4b7c15aSSagi Maimon.. list-table:: Flash components
51*a4b7c15aSSagi Maimon   :widths: 20 80
52*a4b7c15aSSagi Maimon
53*a4b7c15aSSagi Maimon   * - Component
54*a4b7c15aSSagi Maimon     - Description
55*a4b7c15aSSagi Maimon   * - (none)
56*a4b7c15aSSagi Maimon     - The card's own flash, written through the SPI controller the driver
57*a4b7c15aSSagi Maimon       exposes.  The card runs the new image after its next reset.
58*a4b7c15aSSagi Maimon   * - ``fw.cpld``
59*a4b7c15aSSagi Maimon     - The configuration flash of the TAP CPLD on ADVA TimeCard X1 boards,
60*a4b7c15aSSagi Maimon       programmed over I2C with the MachXO3 in-system programming commands
61*a4b7c15aSSagi Maimon       and activated with a REFRESH, so the new image runs immediately.
62*a4b7c15aSSagi Maimon       The image is the raw configuration bitstream.  The only check the
63*a4b7c15aSSagi Maimon       driver makes is that its length is a non-zero multiple of the
64*a4b7c15aSSagi Maimon       16-byte page size, so a container such as ``.jed`` has to be
65*a4b7c15aSSagi Maimon       converted first rather than passed through - one whose length
66*a4b7c15aSSagi Maimon       happens to be a multiple of 16 would be programmed as if it were
67*a4b7c15aSSagi Maimon       a bitstream.
68*a4b7c15aSSagi Maimon
69*a4b7c15aSSagi MaimonProgramming the CPLD claims the shared I2C bus for the whole cycle, so
70*a4b7c15aSSagi Maimonreads of the card's EEPROM block until it completes.  Progress is reported
71*a4b7c15aSSagi Maimonwith the standard devlink status notifications.
72*a4b7c15aSSagi Maimon
73*a4b7c15aSSagi MaimonExample::
74*a4b7c15aSSagi Maimon
75*a4b7c15aSSagi Maimon    $ devlink dev flash pci/0000:02:00.0 file adva-cpld.bin component fw.cpld
76