Skip to content
Closed
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
2 changes: 1 addition & 1 deletion platform/broadcom/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(PLATFORM_PATH)/platform-modules-inventec.mk
include $(PLATFORM_PATH)/platform-modules-cel.mk
include $(PLATFORM_PATH)/platform-modules-delta.mk
include $(PLATFORM_PATH)/platform-modules-quanta.mk
#include $(PLATFORM_PATH)/platform-modules-mitac.mk
include $(PLATFORM_PATH)/platform-modules-mitac.mk
include $(PLATFORM_PATH)/docker-orchagent-brcm.mk
include $(PLATFORM_PATH)/docker-syncd-brcm.mk
include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk
Expand Down
3 changes: 2 additions & 1 deletion platform/broadcom/sonic-platform-modules-mitac/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
platform drivers of MiTAC products for the SONiC project
# sonic-platform-modules-mitac_stretch
platform drivers of MiTAC products for the SONiC project of Debian 9
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Standards-Version: 3.9.3

Package: sonic-platform-mitac-ly1200-32x
Architecture: amd64
Depends: linux-image-3.16.0-5-amd64
Depends: linux-image-4.9.0-5-amd64
Description: kernel modules for platform devices such as fan, led, sfp

65 changes: 53 additions & 12 deletions platform/broadcom/sonic-platform-modules-mitac/debian/rules
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export INSTALL_MOD_DIR:=extra

Expand All @@ -7,16 +18,36 @@ KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= ly1200-32x
SERVICE_DIR := service

%:
dh $@
dh $@ --with systemd

clean:
dh_testdir
dh_testroot
dh_clean

override_dh_auto_build:
build:
(for mod in $(MODULE_DIRS); do \
make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \
done)

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

binary-arch:
# Nothing to do

#install: build
#dh_testdir
#dh_testroot
#dh_clean -k
#dh_installdirs

binary-indep:
dh_testdir
dh_installdirs
(for mod in $(MODULE_DIRS); do \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}\
$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
Expand All @@ -29,13 +60,23 @@ override_dh_auto_install:
mkdir -p debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/init.d; \
cp -rfL $(MOD_SRC_DIR)/$${mod}/etc/* \
debian/$(PACKAGE_PRE_NAME)-$${mod}/etc; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
done)

override_dh_usrlocal:

override_dh_clean:
dh_clean
(for mod in $(MODULE_DIRS); do \
make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \
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
Expand Up @@ -13,6 +13,11 @@

case "$1" in
start)
eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ")
if [ -f /host/image-$sonic_version/platform/firsttime ]; then
update-rc.d xcvr_servd defaults >/dev/null
fi

echo -n "Setting up board... "

echo 0 > /proc/sys/kernel/perf_cpu_time_max_percent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

### BEGIN INIT INFO
# Provides: setup-board
# Provides: setup-board-i2c
# Required-Start:
# Required-Stop:
# Should-Start:
Expand All @@ -11,6 +11,7 @@
# Short-Description: Setup ly1200-32x board.
### END INIT INFO

I2C_BUS_RM_ALL=0
I2C_I801_RM_PRINT=0
I2C_ISMT_RM_PRINT=0
I2C_I801_INS_PRINT=0
Expand Down Expand Up @@ -47,6 +48,21 @@ function log_msg() {

# Load kernel modules
load_modules () {
while [ 1 ]
do
if [ `lsmod | grep -c "i2c_i801 "` -eq 1 ] && [ `lsmod | grep -c "i2c_ismt "` -eq 1 ]; then
log_msg "The kernel module i801 and ismt was insert."
break;
fi
if [ $I2C_BUS_RM_ALL -eq 0 ]; then
I2C_BUS_RM_ALL=1
log_msg "Wait for i2c_i801 and i2c_ismt module insert."
fi
sleep 1
done
if [ $I2C_BUS_RM_ALL -eq 1 ]; then
log_msg "i2c_i801 and i2c_ismt auto insert success."
fi
#----------remove i801 start---------------------
if [ `lsmod | grep -c "i2c_i801 "` -eq 1 ]; then
rmmod i2c_i801
Expand Down Expand Up @@ -188,6 +204,7 @@ load_i2c_dev_modules () {
case "$1" in
start)
echo -n "Setting up board... "
depmod -a
load_i2c_dev_modules
load_modules
echo "done."
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ struct device_attribute field \

#define SYSFS_RAW_RW_ATTR_DEF(field) \
struct device_attribute field \
= __ATTR(field, S_IRUGO | S_IWUGO, master_cpld_##field##_raw_read, master_cpld_##field##_raw_write);
= __ATTR(field, S_IRUGO | S_IWUSR | S_IWGRP, master_cpld_##field##_raw_read, master_cpld_##field##_raw_write);

#define SYSFS_MISC_RO_ATTR_DEF(field, _read) \
struct device_attribute field \
= __ATTR(field, S_IRUGO, _read, NULL);

#define SYSFS_MISC_RW_ATTR_DEF(field, _read, _write) \
struct device_attribute field \
= __ATTR(field, S_IRUGO | S_IWUGO, _read, _write);
= __ATTR(field, S_IRUGO | S_IWUSR | S_IWGRP, _read, _write);

#define SYSFS_ATTR_PTR(field) \
&field.attr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

#include "system_cpld_reg.h"
#include "system_cpld_sysfs.h"
#ifdef CONFIG_DRV_SYSCPLD_WDT

#define MIC_DEBUG_TAG " [mitac] "
#define MITAC_WDT_MINOR 135
#define MITAC_WDT_NAME "watchdog5"

#if CONFIG_DRV_SYSCPLD_WDT
#include <linux/fs.h>
#include <linux/ioctl.h>
#include <linux/miscdevice.h>
Expand Down Expand Up @@ -33,7 +38,6 @@ MODULE_DEVICE_TABLE(i2c, system_cpld_ids);
static int system_cpld_raw_read(struct device *dev, struct device_attribute *attr, char *buf,
int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name){
unsigned int reg_val = 0, fld_val;
static int debug_flag;
struct system_cpld_data *data = dev_get_drvdata(dev);
struct i2c_client *client = data->client;
int err;
Expand Down Expand Up @@ -64,7 +68,6 @@ static int system_cpld_raw_write(struct device *dev, struct device_attribute *at
int ret_code;
unsigned int reg_val, fld_val;
unsigned long val;
static int debug_flag;
struct system_cpld_data *data = dev_get_drvdata(dev);
struct i2c_client *client = data->client;
if (reg_width != 8){
Expand Down Expand Up @@ -192,7 +195,7 @@ static const struct attribute_group system_cpld_group_misc = {
.attrs = misc_attributes,
};

#ifdef CONFIG_DRV_SYSCPLD_WDT
#if CONFIG_DRV_SYSCPLD_WDT
/*
*****************************************************************************
*
Expand Down Expand Up @@ -276,9 +279,9 @@ static void wdt_set_timeout(int index)
{
struct device *dev = &system_cpld->client->dev;
struct device_attribute *fake_attr=NULL;
char buf[1];
char buf[16];
if ( WD_TIMO_MAX_NUM == 16 ) {
sprintf(buf,"%x",index);
snprintf(buf, 16, "%x",index);
system_cpld_wd_timer_raw_write(dev, fake_attr, buf, (size_t)0);
}
else
Expand Down Expand Up @@ -390,7 +393,7 @@ static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd,
*/
static int wdt_open(struct inode *inode, struct file *file)
{
if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) {
if (MINOR(inode->i_rdev) == MITAC_WDT_MINOR) {
if (test_and_set_bit(0, &wdt_is_open)) {
return -EBUSY;
}
Expand All @@ -412,7 +415,7 @@ static int wdt_open(struct inode *inode, struct file *file)
*/
static int wdt_release(struct inode *inode, struct file *file)
{
if (MINOR(inode->i_rdev) == WATCHDOG_MINOR)
if (MINOR(inode->i_rdev) == MITAC_WDT_MINOR)
clear_bit(0, &wdt_is_open);
return 0;
}
Expand Down Expand Up @@ -447,8 +450,8 @@ static const struct file_operations wdt_fops = {
};

static struct miscdevice wdt_dev = {
.minor = WATCHDOG_MINOR,
.name = "watchdog",
.minor = MITAC_WDT_MINOR,
.name = MITAC_WDT_NAME,
.fops = &wdt_fops,
};

Expand All @@ -459,6 +462,8 @@ static struct miscdevice wdt_dev = {
static struct notifier_block wdt_notifier = {
.notifier_call = wdt_notify_sys,
};
static struct notifier_block *p_wdt_notifier = NULL;

#endif /* CONFIG_DRV_SYSCPLD_WDT */

static int system_cpld_probe(struct i2c_client *client, const struct i2c_device_id *id)
Expand All @@ -483,14 +488,22 @@ static int system_cpld_probe(struct i2c_client *client, const struct i2c_device_

printk(KERN_INFO "%s: System CPLD LCMXO3LF created.\n", __FUNCTION__);

#ifdef CONFIG_DRV_SYSCPLD_WDT
#if CONFIG_DRV_SYSCPLD_WDT
wdt_dev.minor = MITAC_WDT_MINOR;
err = misc_register(&wdt_dev);
if (err)
return err;
err = register_reboot_notifier(&wdt_notifier);
if (err) {
misc_deregister(&wdt_dev);
return err;
printk(MIC_DEBUG_TAG"%s-%d misc_register register watchdog (%s : %d) fail err=%d \n", __FUNCTION__, __LINE__, wdt_dev.name, wdt_dev.minor, err);
wdt_dev.minor = 0;
}
else {
p_wdt_notifier = &wdt_notifier;
err = register_reboot_notifier(p_wdt_notifier);
if (err) {
printk(MIC_DEBUG_TAG"%s-%d register_reboot_notifier fail err:%d \n", __FUNCTION__, __LINE__, err);
misc_deregister(&wdt_dev);
p_wdt_notifier = NULL;
wdt_dev.minor = 0;
}
}
printk(KERN_INFO "%s: System CPLD watchdog created.\n", __FUNCTION__);
#endif
Expand All @@ -501,9 +514,9 @@ static int system_cpld_probe(struct i2c_client *client, const struct i2c_device_

static int system_cpld_remove(struct i2c_client *client)
{
#ifdef CONFIG_DRV_SYSCPLD_WDT
misc_deregister(&wdt_dev);
unregister_reboot_notifier(&wdt_notifier);
#if CONFIG_DRV_SYSCPLD_WDT
if(p_wdt_notifier) unregister_reboot_notifier(p_wdt_notifier);
if(wdt_dev.minor) misc_deregister(&wdt_dev);
#endif
sysfs_remove_group(&client->dev.kobj, &system_cpld_group_misc);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ struct device_attribute field \

#define SYSFS_RAW_RW_ATTR_DEF(field) \
struct device_attribute field \
= __ATTR(field, S_IRUGO | S_IWUGO, slave_cpld_##field##_raw_read, slave_cpld_##field##_raw_write);
= __ATTR(field, S_IRUGO | S_IWUSR | S_IWGRP, slave_cpld_##field##_raw_read, slave_cpld_##field##_raw_write);

#define SYSFS_MISC_RO_ATTR_DEF(field, _read) \
struct device_attribute field \
= __ATTR(field, S_IRUGO, _read, NULL);

#define SYSFS_MISC_RW_ATTR_DEF(field, _read, _write) \
struct device_attribute field \
= __ATTR(field, S_IRUGO | S_IWUGO, _read, _write);
= __ATTR(field, S_IRUGO | S_IWUSR | S_IWGRP, _read, _write);

#define SYSFS_ATTR_PTR(field) \
&field.attr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ struct device_attribute field \

#define SYSFS_RAW_RW_ATTR_DEF(field) \
struct device_attribute field \
= __ATTR(field, S_IRUGO | S_IWUGO, system_cpld_##field##_raw_read, system_cpld_##field##_raw_write);
= __ATTR(field, S_IRUGO | S_IWUSR | S_IWGRP, system_cpld_##field##_raw_read, system_cpld_##field##_raw_write);

#define SYSFS_MISC_RO_ATTR_DEF(field, _read) \
struct device_attribute field \
= __ATTR(field, S_IRUGO, _read, NULL);

#define SYSFS_MISC_RW_ATTR_DEF(field, _read, _write) \
struct device_attribute field \
= __ATTR(field, S_IRUGO | S_IWUGO, _read, _write);
= __ATTR(field, S_IRUGO | S_IWUSR | S_IWGRP, _read, _write);

#define SYSFS_ATTR_PTR(field) \
&field.attr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
##### Temperature vs Fan table #####
## FORMAT: "PWM" fan speed(range from 0 to 255)
# Duty Cycle 25% 30% 35% 40% 45% 50% 55% 60% 65% 70% 75% 80% 85% 90% 95% 100%
PWM 64 77 89 102 115 128 140 153 166 179 191 204 217 230 242 255
# Duty Cycle 30% 32.5% 35% 37.5% 40% 45% 50% 55% 60% 65% 70% 75% 80% 90% 100%
PWM 77 83 89 95 102 114 128 141 153 166 179 192 204 230 255
## FORMAT: sensor name(TEMP_XXX) with asserted temperature by each levels
TEMP_CPU 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97
TEMP_SWITCH 75 78 81 84 87 90 93 96 99 102 105 108 111 114 117 120
TEMP_CPU 46 48 50 52 54 57 60 63 66 69 72 75 78 81 84
TEMP_SWITCH 72 74 76 78 80 83 86 89 92 95 98 101 104 107 110
#TEMP_HDD 25
#TEMP_TMP75_CPU 25
#TEMP_TMP75_CENTER 25
#TEMP_TMP75_RIGHT 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93
TEMP_TMP75_FAN 26.5 31.5 36.5 41.5 46.5 51.5 56.5 61.5 66.5 71.5 76.5 81.5 86.5 91.5 96.5 101.5
#TEMP_TMP75_RIGHT 33 37 45 53 61 69 77 85 93
TEMP_TMP75_FAN 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55
TEMP_XCVR 36 38 40 42 44 46 48 50 52 54 56 58 60 63 66
Loading