Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding PMON2.0 tg48m-p #32

Open
wants to merge 4 commits into
base: target_master
Choose a base branch
from
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
12 changes: 12 additions & 0 deletions platform/marvell-arm64/platform-tg48m-p.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# TG48M-P Platform

TG48MP_VERSION=1.0

export TG48MP_VERSION

TG48M-P_PLATFORM = sonic-platform-tg48m-p_$(TG48MP_VERSION)_$(CONFIGURED_ARCH).deb
$(TG48M-P_PLATFORM)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-tg48m-p
$(TG48M-P_PLATFORM)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
$(TG48M-P_PLATFORM)_PLATFORM = arm64-delta_tg48m_poe-r0

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

* Add support for delta-tg48m-p.

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-tg48m-p/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Source: sonic-platform-tg48m-p
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-tg48m-p
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-tg48m-p/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:= tg48m-p
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 @@
tg48m-p_plt_setup.sh usr/sbin
tg48m-p/scripts/tg48m-pinit.sh usr/local/bin
tg48m-p/service/tg48m-pinit.service etc/systemd/system
tg48m-p/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/arm64-delta_tg48m_poe-r0
tg48m-p/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-delta_tg48m_poe-r0
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
# postinst script for sonic-platform-tg48m-p
#
# see: dh_installdeb(1)

sh /usr/sbin/tg48m-p_plt_setup.sh
chmod a+x /usr/local/bin/tg48m-pinit.sh
systemctl enable tg48m-pinit.service
systemctl start tg48m-pinit.service

exit 0

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
# Platform init script for Delta TG48M-P

# 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--------------------------------------------#
# 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

# Enable optical SFP Tx
i2cset -y -m 0x0f 2 0x41 0x31 0x00

#choose PCA9546 channel 3 in order to collect fan present status
i2cset -y 0 0x70 0x00 0x08

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

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

[Install]
WantedBy=multi-user.target
15 changes: 15 additions & 0 deletions platform/marvell-arm64/sonic-platform-tg48m-p/tg48m-p/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 TG48M-P platforms',

packages=['sonic_platform','sonic_platform.test'],
package_dir={'sonic_platform': 'tg48m-p/sonic_platform'},
)

Loading