0% found this document useful (0 votes)
0 views7 pages

Micrel_AVB_Setup_Guide

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 7

Micrel AVB/PTP Setup Guide

Micrel AVB/PTP Setup Guide

Rev 1.0

June 18, 2013

© 2013 Micrel, Inc. Confidential Rev 1.0


2180 Fortune Dr., San Jose, CA 95131, USA • (408) 944-0480 • http://www.micrel.com
Page 1
Micrel AVB/PTP Setup Guide

Table of Contents
1 Revision History..........................................................................................................................3
2 Introduction..................................................................................................................................4
3 Driver Setup.................................................................................................................................4
3.1 Device Creation....................................................................................................................5
4 PTP Stacks...................................................................................................................................5
4.1 OnTime PTP Stacks.............................................................................................................5
4.2 Linux PTP Stack...................................................................................................................6

© 2013 Micrel, Inc. Confidential Rev 1.0


2180 Fortune Dr., San Jose, CA 95131, USA • (408) 944-0480 • http://www.micrel.com
Page 2
Micrel AVB/PTP Setup Guide

1 Revision History

Revision Date Summary of Changes


1.0 06/18/2013 Initial revision.

© 2013 Micrel, Inc. Confidential Rev 1.0


2180 Fortune Dr., San Jose, CA 95131, USA • (408) 944-0480 • http://www.micrel.com
Page 3
Micrel AVB/PTP Setup Guide

2 Introduction

This document describes the setup of a Micrel switch running in an Audio/Video Bridge (AVB)
or Precision Time Protocol (PTP) environment. For now only the KSZ8463 switch has PTP
capability, and AVB support is limited to its PTP function.

3 Driver Setup

The Micrel switch needs to be configured properly in the switch driver to support certain
features. The multiple devices mode allows the switch to expose its external ports as network
devices so that they can be controlled individually. There are many modes to choose depending
on how the switch is used.
The first mode is simply creating a network device for each port. The device names will be
eth0, eth1, and so on. Spanning Tree Protocol (STP) can be easily run on the switch by adding
a bridge device br0 and linking all the eth devices under it. However, PTP event messages
cannot be simply forwarded to the other ports by the host. That requires special handling.
In multiple devices mode 2 virtual VLAN devices are created to allow the host to have control
over the ports. The device names will be eth0, eth0.201, eth0.202, and so on. Like mode 1
the Micrel switch tag tailing feature is used to handle receiving and transmitting of packets.
Multiple devices mode 3 is an extension of mode 1 in which a parent network device is used to
control the whole switch. The device names will be eth0, eth0.100, eth0.101, and so on.
The devices eth0.100 and eth0.101 are supposed to be used under the bridge device br0.
Multiple devices mode 4 is a variation of mode 2 in which tail tagging is not used when only
PTP messages needs to be supported. PTP messages themselves have a way to indicate receiving
port and destination port.
Finally multiple devices mode 5 is the combination of modes 2 and 3. The device names will be
eth0, eth0.100, eth0.101, eth0.201, eth0.202, and so on. The devices eth0.100 and
eth0.101 are still used for STP under the bridge device br0. The devices eth0, eth0.201,
and eth0.202 are used for PTP message processing. Some proprietary PTP stacks can use a
single eth0 directly, but most other generic PTP stacks need to have individual network devices
and so eth0.201 and eth0.202 are used.
To run STP on the switch the feature has to be specified directly. For regular switch multiple
devices mode 1 will be used. For PTP switch mode 5 will be used. If STP is not required on a
PTP switch, then mode 4 is recommended.
To specify the multiple devices mode it is required to put a specific parameter in the Linux
command line. This command line can be configured inside the kernel, but most often it can be
set in a U-Boot environmental variable so that it can be changed easily.

© 2013 Micrel, Inc. Confidential Rev 1.0


2180 Fortune Dr., San Jose, CA 95131, USA • (408) 944-0480 • http://www.micrel.com
Page 4
Micrel AVB/PTP Setup Guide

The first part of the command parameter is the driver module name, which is variable depending
on the switch chip used. In this example Micrel KSZ8463MLI is used. The switch driver of
KSZ8463MLI is implemented as an SPI driver, so its module name is spi-ksz8463.
The second part of the command parameter is the driver module variable name. The variable
name for multiple devices mode is multi_dev, and the variable name for STP support is stp.
So to enable STP support the command parameter is “spi-ksz8463.stp=1.” To set a multiple
devices mode the command parameter can be “spi-ksz8463.multi_dev=4.”
These variables can be set in the host network driver if it has the switch functionality. An
example is the Micrel KSZ8692 SoC connected to a KSZ8463 switch. The parameter can be
“ksz8692.stp=1.” Another example is the Micrel KSZ8462HLI chip, which has an embedded
KSZ8463 switch. The parameter can be “ksz8462_h.stp=1.”
The U-Boot environmental variable used to specify the Linux command line is bootargs.
Typical command line can be “console=ttyS0,115200 init=/etc/preinit
spi-ksz8463.stp=1.” Use the U-Boot “set bootargs” command to set the line or clear it.
Use the “saveenv” command to save the environmental variables.

3.1 Device Creation

The virtual VLAN devices eth0.201 and such need to be created using the vconfig command
after the kernel boots. A script vlan.sh is provided to create those devices.
The bridge device br0 can be created using the brctl utility.
These devices are created automatically in the start-up script for the Micrel AVB/PTP demo
boards.

4 PTP Stacks

There are two AVB/PTP stacks provided for use in the Micrel AVB/PTP demo boards. The
OnTime stack from OnTime Networks is proprietary, while the Linux PTP stack is open source.

4.1 OnTime PTP Stacks

The OnTime stacks are used as default. There are two, one for AVB and the other for PTP. In
the system configuration file sysconfig located at directory syscfg it can be set to run the
stack automatically when the system boots up. On a new system that file may not exist. Just
copy the one at /etc to /syscfg. At the end of the file there is a PTP setting. Changing it from
off to on will run the OnTime PTP stack in the background. Setting the AVB setting from off

© 2013 Micrel, Inc. Confidential Rev 1.0


2180 Fortune Dr., San Jose, CA 95131, USA • (408) 944-0480 • http://www.micrel.com
Page 5
Micrel AVB/PTP Setup Guide

to on will run the OnTime AVB stack instead.


To run the stack manually it can be done in several directories under the directory ptp. The
OnTime PTP stack uses the configuration file ptpProfile.txt. In the subdirectory e2e that
configuration file is set to run PTP in E2E mode. In the subdirectory p2p the PTP stack is
configured to run in P2P mode. The OnTime PTP stack executable is ontime.
The subdirectory avb is used to run PTP stack in AVB mode. The OnTime AVB stack
executable is 802.1as.
cd /ptp/p2p; ontime break -d
cd /ptp/avb; 802.1as -d

4.2 Linux PTP Stack

The same Linux PTP stack executable can run in both PTP and AVB modes. Its executable is
ptp4l. As it requires a lot of parameters to specify its behavior a script is provided for easy
invocation. In the directories e2e and p2p the script linuxptp.sh can be used to start the
Linux PTP stack. The configuration file it used is default.cfg. The Linux PTP stack was
modified to work using one network device, but it is designed to use multiple network devices.
In that case another subdirectory tc is provided under the directories e2e and p2p to run the
PTP stack in multiple devices mode.
The Linux PTP stack can be run in AVB mode under the subdirectory avb. The configuration
file it used is gPTP.cfg. The modified default behavior for the stack is to act as a transparent
clock. To run as a boundary clock as required for AVB it requires putting the switch in 802.1AS
mode first. This is done using the ptp_cli utility. Start that utility and use the command “has
1” to enable that mode first before running the Linux PTP stack.
ptp_cli

> has 1
> q

If one of the devices is wanted to be a grandmaster, modify the configuration file to lower its
priority so that it wins the BMC algorithm.
vi /ptp/avb/gPTP.cfg

/priority1
$
a<backspace><backspace><backspace>
148<esc>
:wq

© 2013 Micrel, Inc. Confidential Rev 1.0


2180 Fortune Dr., San Jose, CA 95131, USA • (408) 944-0480 • http://www.micrel.com
Page 6
Micrel AVB/PTP Setup Guide

Alphabetical Index
Linux PTP Stack....................................................6 Precision Time Protocol (PTP)..............................4
OnTime PTP Stacks...............................................5 Spanning Tree Protocol (STP)...............................4

© 2013 Micrel, Inc. Confidential Rev 1.0


2180 Fortune Dr., San Jose, CA 95131, USA • (408) 944-0480 • http://www.micrel.com
Page 7

You might also like