Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions platform/marvell-arm64/platform-tg4810m.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# TG4810M Platform

TG4810M_VERSION = 1.0
export TG4810M_VERSION

TG4810M_PLATFORM = sonic-platform-tg4810m_$(TG4810M_VERSION)_$(CONFIGURED_ARCH).deb
$(TG4810M_PLATFORM)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-tg4810m
$(TG4810M_PLATFORM)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
$(TG4810M_PLATFORM)_PLATFORM = arm64-delta_tg4810m-r0

SONIC_DPKG_DEBS += $(TG4810M_PLATFORM)
1 change: 1 addition & 0 deletions platform/marvell-arm64/rules.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include $(PLATFORM_PATH)/sdk.mk
include $(PLATFORM_PATH)/platform-tg4810m.mk
include $(PLATFORM_PATH)/sai.mk
include $(PLATFORM_PATH)/docker-syncd-mrvl.mk
include $(PLATFORM_PATH)/docker-syncd-mrvl-rpc.mk
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sonic-platform-tg4810m (1.0) unstable; urgency=low

* Add support for delta-tg4810m.
-- Delta <lkunjumon@marvell.com> Wed, 15 Apr 2020 09:35:58 +0800
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
13 changes: 13 additions & 0 deletions platform/marvell-arm64/sonic-platform-tg4810m/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Source: sonic-platform-tg4810m
Section: unknown
Priority: optional
Maintainer: Delta
Build-Depends: debhelper (>=9)
Standards-Version: 3.9.6
Homepage: <insert the upstream URL, if relevant>

Package: sonic-platform-tg4810m
Architecture: arm64
Depends: ${misc:Depends}
Description: <insert up to 60 chars description>
<insert long description, indented with spaces>
66 changes: 66 additions & 0 deletions platform/marvell-arm64/sonic-platform-tg4810m/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

include /usr/share/dpkg/pkg-info.mk
#--------------------------------------------------------

PACKAGE_PRE_NAME := sonic-platform
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= tg4810m
UTILS_DIR := utils
SERVICE_DIR := service
PLATFORM_DIR := sonic_platform

%:
dh $@ --with systemd,python2,python3 --buildsystem=pybuild

clean:
dh_testdir
dh_testroot
dh_clean

build:
(for mod in $(MODULE_DIRS); do \
python2 $${mod}/setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \
python3 $${mod}/setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \
done)

binary: binary-arch binary-indep
# Nothing to do

binary-arch:
# Nothing to do

binary-indep:
dh_testdir
dh_installdirs

# Custom package commands
(for mod in $(MODULE_DIRS); do \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /usr/local/bin; \
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
python2 $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
python3 $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
done)

# Resuming debhelper scripts
dh_testroot
dh_install
dh_installchangelogs
dh_installdocs
dh_systemd_enable
dh_installinit
dh_systemd_start
dh_link
dh_fixperms
dh_compress
dh_strip
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb

.PHONY: build binary binary-arch binary-indep clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tg4810m_plt_setup.sh usr/sbin
tg4810m/scripts/tg4810minit.sh usr/local/bin
tg4810m/service/tg4810minit.service etc/systemd/system
tg4810m/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/arm64-delta_tg4810m-r0
tg4810m/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-delta_tg4810m-r0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# postinst script for sonic-platform-tg4810m
#
# see: dh_installdeb(1)

sh /usr/sbin/tg4810m_plt_setup.sh
chmod a+x /usr/local/bin/tg4810minit.sh
systemctl enable tg4810minit.service
systemctl start tg4810minit.service
exit 0

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Platform init script for Delta TG4810M

# Load required kernel-mode drivers
load_kernel_drivers() {
# Remove modules loaded during Linux init
# FIX-ME: This will be removed in the future when Linux init no longer loads these
rmmod i2c_mux_gpio
rmmod i2c_dev
rmmod i2c_mv64xxx

# Carefully control the load order here to ensure consistent i2c bus numbering
modprobe i2c_mv64xxx
modprobe i2c_dev
modprobe i2c_mux_gpio
modprobe eeprom
}

# - Main entry

# Install kernel drivers required for i2c bus access
#load_kernel_drivers

# LOGIC to enumerate SFP eeprom devices - send 0x50 to kernel i2c driver - initialize devices
# the mux may be enumerated at number 4 or 5 so we check for the mux and skip if needed
# Get list of the mux channels
ismux_bus=$(i2cdetect -l|grep mux|cut -f1)
# Enumerate the SFP eeprom device on each mux channel
for mux in ${ismux_bus}
do
echo optoe2 0x50 > /sys/class/i2c-adapter/${mux}/new_device
done

#choose PCA9546 channel 3 in order to collect present status
i2cset -y 0 0x70 0x00 0x08
#select all the devices on PCA9546 i2c-2
i2cset -y 2 0x77 0x00 0x7
# Enable optical SFP Tx
i2cset -y 2 0x41 0x31 0x00
i2cset -y 2 0x41 0x32 0x00
i2cset -y 2 0x41 0x33 0x00
i2cset -y 2 0x41 0x34 0x00
i2cset -y 2 0x41 0x35 0x00
i2cset -y 2 0x41 0x36 0x00

echo "Delta-tg4810m - completed platform init script"
exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit
Description=Delta-tg4810m Platform Service
Before=pmon.service
After=sysinit.target
DefaultDependencies=no

[Service]
ExecStart=/usr/local/bin/tg4810minit.sh
KillSignal=SIGKILL
SuccessExitStatus=SIGKILL
#StandardOutput=tty

[Install]
WantedBy=multi-user.target
15 changes: 15 additions & 0 deletions platform/marvell-arm64/sonic-platform-tg4810m/tg4810m/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python

import os
from setuptools import setup
os.listdir

setup(
name='sonic_platform',
version='1.0',
description='Module to initialize Delta TG4810M platforms',

packages=['sonic_platform','sonic_platform.test'],
package_dir={'sonic_platform': 'tg4810m/sonic_platform'},
)

Loading