Merge branch 'master' of github.com:opencomputeproject/OpenNetworkLinux

This commit is contained in:
Jeffrey Townsend
2017-02-02 21:40:41 +00:00
344 changed files with 11365 additions and 608 deletions

View File

@@ -11,4 +11,3 @@
- hw-management
- sx-kernel
- onl-kernel-3.16-lts-x86-64-all-modules
- onl-kernel-3.2-deb7-x86-64-all-modules

View File

@@ -28,9 +28,20 @@ export BUILD_DIR_BASE=BUILD/$(ONL_DEBIAN_SUITE)
# Use the new module database tool to resolve dependencies dynamically.
ifndef BUILDER_MODULE_DATABASE
export BUILDER_MODULE_DATABASE := $(ONL)/make/modules/modules.json
endif
# Regenerate the module manifest if necessary.
export MODULEMANIFEST := $(shell $(BUILDER)/tools/modtool.py --db $(BUILDER_MODULE_DATABASE) --dbroot $(ONL) --make-manifest $(ONL)/make/modules/modules.mk)
ifndef BUILDER_MODULE_DATABASE_ROOT
BUILDER_MODULE_DATABASE_ROOT := $(ONL)
endif
ifndef BUILDER_MODULE_MANIFEST
BUILDER_MODULE_MANIFEST := $(ONL)/make/modules/modules.mk
endif
export MODULEMANIFEST := $(shell $(BUILDER)/tools/modtool.py --db $(BUILDER_MODULE_DATABASE) --dbroot $(BUILDER_MODULE_DATABASE_ROOT) --make-manifest $(BUILDER_MODULE_MANIFEST))
# Generate versions if necessary.
$(shell $(ONL)/tools/make-versions.py --import-file=$(ONL)/tools/onlvi --class-name=OnlVersionImplementation --output-dir $(ONL)/make/versions)
@@ -74,5 +85,3 @@ ONL_MAKE := $(MAKE) $(ONL_MAKE_FLAGS)
#
export SUBMODULE_INFRA := $(ONL)/sm/infra
export SUBMODULE_BIGCODE := $(ONL)/sm/bigcode

View File

@@ -164,7 +164,7 @@ endif
endif
MODSYNCLIST_DEFAULT := .config Module.symvers Makefile include scripts arch/x86/include arch/x86/Makefile arch/powerpc/include arch/powerpc/Makefile arch/powerpc/lib arch/arm/include arch/arm/Makefile arch/arm/lib
MODSYNCLIST_DEFAULT := .config Module.symvers Makefile include scripts arch/x86/include arch/x86/Makefile arch/powerpc/include arch/powerpc/Makefile arch/powerpc/lib arch/arm/include arch/arm/Makefile arch/arm/lib drivers
MODSYNCLIST := $(MODSYNCLIST_DEFAULT) $(MODSYNCLIST_EXTRA)
@@ -172,6 +172,8 @@ mbuild: build
rm -rf $(K_MBUILD_DIR)
mkdir -p $(K_MBUILD_DIR)
$(foreach f,$(MODSYNCLIST),$(ONL)/tools/scripts/tree-copy.sh $(K_SOURCE_DIR) $(f) $(K_MBUILD_DIR);)
find $(K_MBUILD_DIR) -name "*.o*" -delete
find $(K_MBUILD_DIR) -name "*.c" -delete
dtbs: mbuild
ifdef DTS_LIST

View File

@@ -6,14 +6,24 @@ ifndef KMODULES
$(error $$KMODULES must be set)
endif
ifndef PLATFORM
$(error $$PLATFORM must be set)
endif
ifndef ARCH
$(error $$ARCH must be set)
endif
ifndef SUBDIR
ifndef VENDOR
$(error $$VENDOR must be set.)
endif
ifndef BASENAME
$(error $$BASENAME must be set.)
endif
SUBDIR := "onl/$(VENDOR)/$(BASENAME)"
endif
modules:
ARCH=$(ARCH) $(ONL)/tools/scripts/kmodbuild.sh "$(KERNELS)" "$(KMODULES)" $(PLATFORM)
rm -rf lib
ARCH=$(ARCH) $(ONL)/tools/scripts/kmodbuild.sh "$(KERNELS)" "$(KMODULES)" "$(SUBDIR)"

View File

@@ -113,18 +113,30 @@ class OnlBootConfigNet(OnlBootConfig):
self.delete('NETGW')
self.set('NETAUTO', 'dhcp')
def netauto_get(self):
return self.keys.get('NETAUTO', None)
def netip_set(self, addr):
self.delete('NETAUTO')
self.keys['NETIP'] = addr
def netip_get(self):
return self.keys.get('NETIP', None)
def netmask_set(self, mask):
self.delete('NETAUTO')
self.keys['NETMASK'] = mask
def netmask_get(self):
return self.keys.get('NETMASK', None)
def netgw_set(self, gw):
self.delete('NETAUTO')
self.keys['NETGW'] = gw
def netgw_get(self):
return self.keys.get('NETGW', None)
def __validate(self):
if 'NETAUTO' not in self.keys:
@@ -221,4 +233,3 @@ class OnlBootConfigNet(OnlBootConfig):
if __name__ == '__main__':
bc = OnlBootConfigNet()
bc.main("onl-boot-config")

View File

@@ -190,26 +190,49 @@ class OnlPlatformBase(object):
def baseconfig(self):
return True
def insmod(self, module, required=True):
kv = os.uname()[2]
searched = []
def insmod(self, module, required=True, params={}):
#
# Search for modules in this order:
#
# 1. Fully qualified platform name
# /lib/modules/<kernel>/onl/<vendor>/<platform-name>
# 2. Basename
# /lib/modules/<kernel>/onl/<vendor>/<basename>
# 3. Vendor common
# /lib/modules/<kernel>/onl/<vendor>/common
# 4. ONL common
# /lib/modules/<kernel>/onl/onl/common
# 5. ONL Top-Level
# /lib/modules/<kernel>/onl
# 5. Kernel Top-level
# /lib/modules/<kernel>
#
# Search paths in this order:
locations = [ self.PLATFORM,
'-'.join(self.PLATFORM.split('-')[:-1]),
'onl',
".",
]
for l in locations:
kdir = "/lib/modules/%s" % os.uname()[2]
basename = "-".join(self.PLATFORM.split('-')[:-1])
odir = "%s/onl" % kdir
vdir = "%s/%s" % (odir, self.MANUFACTURER.lower())
bdir = "%s/%s" % (vdir, basename)
pdir = "%s/%s" % (vdir, self.PLATFORM)
searchdirs = [ os.path.join(vdir, self.PLATFORM),
os.path.join(vdir, basename),
os.path.join(vdir, "common"),
os.path.join(odir, "onl", "common"),
odir,
kdir,
]
for d in searchdirs:
for e in [ ".ko", "" ]:
path = "/lib/modules/%s/%s/%s%s" % (kv, l, module, e)
searched.append(path)
path = os.path.join(d, "%s%s" % (module, e))
if os.path.exists(path):
subprocess.check_call("insmod %s" % path, shell=True)
cmd = "insmod %s %s" % (path, " ".join([ "%s=%s" % (k,v) for (k,v) in params.iteritems() ]))
subprocess.check_call(cmd, shell=True);
return True
if required:
raise RuntimeError("kernel module %s could not be found. Searched: %s" % (module, searched))
raise RuntimeError("kernel module %s could not be found." % (module))
else:
return False
@@ -220,7 +243,9 @@ class OnlPlatformBase(object):
'-'.join(self.PLATFORM.split('-')[:-1]) ]
for subdir in directories:
d = "/lib/modules/%s/%s" % (kv, subdir)
d = "/lib/modules/%s/onl/%s/%s" % (kv,
self.MANUFACTURER.lower(),
subdir)
if os.path.isdir(d):
for f in os.listdir(d):
if f.endswith(".ko"):

View File

@@ -393,6 +393,7 @@ class BaseOnieUpgrade(BaseUpgrade):
def onie_fwpkg_add(self, pkg):
import onl.grub
onl.grub.onie_fwpkg("-f purge")
onl.grub.onie_fwpkg("add %s" % pkg)
onl.grub.onie_fwpkg("show")

View File

@@ -14,7 +14,8 @@ include $(ONL)/make/config.mk
kernel:
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.16-lts/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) $(ONL_MAKE_PARALLEL)
ARCH=x86_64 $(ONL)/tools/scripts/kmodbuild.sh linux-3.16.39-mbuild "$(wildcard $(ONL)/packages/base/any/kernels/modules/*)" onl
rm -rf lib
ARCH=x86_64 $(ONL)/tools/scripts/kmodbuild.sh linux-3.16.39-mbuild "$(wildcard $(ONL)/packages/base/any/kernels/modules/*)" onl/onl/common
clean:
rm -rf linux-3.16* kernel-3.16*

View File

@@ -0,0 +1 @@
This package is no longer in use. It will be fully removed.

View File

@@ -0,0 +1 @@
This package is no longer in use. It will be fully removed.

View File

@@ -0,0 +1 @@
This package is no longer in use. It will be fully removed.

View File

@@ -1,8 +1,5 @@
prerequisites:
packages:
- onl-kernel-3.9.6-x86-64-all:amd64
- onl-kernel-3.2-deb7-x86-64-all:amd64
- onl-kernel-3.18-x86-64-all:amd64
- onl-kernel-3.16-lts-x86-64-all:amd64
- onl-loader-initrd:amd64

View File

@@ -1,10 +1,7 @@
include $(ONL)/make/config.amd64.mk
# All amd64 kernels
KERNELS := $(shell $(ONLPM) --find-file onl-kernel-3.9.6-x86-64-all:amd64 kernel-3.9.6-x86-64-all) \
$(shell $(ONLPM) --find-file onl-kernel-3.2-deb7-x86-64-all:amd64 kernel-3.2-deb7-x86_64-all) \
$(shell $(ONLPM) --find-file onl-kernel-3.18-x86-64-all:amd64 kernel-3.18-x86_64-all) \
$(shell $(ONLPM) --find-file onl-kernel-3.16-lts-x86-64-all:amd64 kernel-3.16-lts-x86_64-all) \
KERNELS := $(shell $(ONLPM) --find-file onl-kernel-3.16-lts-x86-64-all:amd64 kernel-3.16-lts-x86_64-all)
# Loader initrd

View File

@@ -1187,6 +1187,9 @@ CONFIG_TI_DAC7512=y
# CONFIG_BMP085_I2C is not set
# CONFIG_BMP085_SPI is not set
# CONFIG_USB_SWITCH_FSA9480 is not set
CONFIG_EARLY_DMA_ALLOC=y
CONFIG_EDA_DEF_SIZE=0x04000000
CONFIG_EDA_DEF_ALIGN=0x00100000
# CONFIG_LATTICE_ECP3_CONFIG is not set
# CONFIG_SRAM is not set
# CONFIG_C2PORT is not set
@@ -1506,7 +1509,7 @@ CONFIG_NETDEVICES=y
CONFIG_MII=y
CONFIG_NET_CORE=y
# CONFIG_BONDING is not set
CONFIG_DUMMY=y
# CONFIG_DUMMY is not set
# CONFIG_EQUALIZER is not set
# CONFIG_NET_FC is not set
# CONFIG_NET_TEAM is not set
@@ -1857,6 +1860,7 @@ CONFIG_I2C_MUX=y
CONFIG_I2C_MUX_GPIO=y
CONFIG_I2C_MUX_PCA9541=y
CONFIG_I2C_MUX_PCA954x=y
CONFIG_I2C_MUX_PCA954X_DESELECT_ON_EXIT=y
CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_ALGOBIT=y
CONFIG_I2C_ALGOPCA=y
@@ -1876,7 +1880,7 @@ CONFIG_I2C_ALGOPCA=y
CONFIG_I2C_I801=y
CONFIG_I2C_ISCH=y
CONFIG_I2C_ISMT=y
# CONFIG_I2C_PIIX4 is not set
CONFIG_I2C_PIIX4=y
# CONFIG_I2C_NFORCE2 is not set
# CONFIG_I2C_SIS5595 is not set
# CONFIG_I2C_SIS630 is not set
@@ -1970,6 +1974,7 @@ CONFIG_PTP_1588_CLOCK=y
# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks.
#
CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
CONFIG_ARCH_NR_GPIOS=512
CONFIG_GPIOLIB=y
CONFIG_GPIO_DEVRES=y
CONFIG_GPIO_ACPI=y
@@ -2835,7 +2840,6 @@ CONFIG_X86_PLATFORM_DEVICES=y
# CONFIG_INTEL_RST is not set
# CONFIG_INTEL_SMARTCONNECT is not set
# CONFIG_PVPANIC is not set
CONFIG_DELL_S6000_S1220=y
# CONFIG_CHROME_PLATFORMS is not set
#

View File

@@ -0,0 +1,335 @@
diff -urpN a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
--- a/arch/x86/kernel/setup.c 2016-11-20 01:17:41.000000000 +0000
+++ b/arch/x86/kernel/setup.c 2017-01-04 23:10:26.473086206 +0000
@@ -49,6 +49,7 @@
#include <asm/pci-direct.h>
#include <linux/init_ohci1394_dma.h>
#include <linux/kvm_para.h>
+#include <linux/early_dma_alloc.h>
#include <linux/dma-contiguous.h>
#include <linux/errno.h>
@@ -1243,6 +1244,10 @@ void __init setup_arch(char **cmdline_p)
arch_init_ideal_nops();
+#ifdef CONFIG_EARLY_DMA_ALLOC
+ eda_init();
+#endif
+
register_refined_jiffies(CLOCK_TICK_RATE);
#ifdef CONFIG_EFI
diff -urpN a/drivers/misc/Kconfig b/drivers/misc/Kconfig
--- a/drivers/misc/Kconfig 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/misc/Kconfig 2017-01-04 23:11:14.305087244 +0000
@@ -496,6 +496,34 @@ config USB_SWITCH_FSA9480
stereo and mono audio, video, microphone and UART data to use
a common connector port.
+config EARLY_DMA_ALLOC
+ bool "Early DMA Memory Allocator"
+ depends on HAS_DMA
+
+ ---help---
+ This driver locks down a region of DMA accessible memory
+ early in the boot process. This memory can be used by other
+ drivers that might rmmod/insmod, insuring the memory region
+ does not become fragmented.
+
+config EDA_DEF_SIZE
+ hex "EDA Default Region Size"
+ depends on EARLY_DMA_ALLOC
+ default 0x04000000
+ help
+ Default size of the reserved memory pool, if not altered by the
+ open firmware interface or kernel boot parameter. This memory
+ will not be accessable to the rest of the system. Default is
+ 64MB.
+
+config EDA_DEF_ALIGN
+ hex "EDA Default Alignment"
+ depends on EARLY_DMA_ALLOC
+ default 0x00100000
+ help
+ Default alignment of the memory region. Default is 1MB.
+
+
config LATTICE_ECP3_CONFIG
tristate "Lattice ECP3 FPGA bitstream configuration via SPI"
depends on SPI && SYSFS
diff -urpN a/drivers/misc/Makefile b/drivers/misc/Makefile
--- a/drivers/misc/Makefile 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/misc/Makefile 2017-01-04 23:12:15.781088578 +0000
@@ -56,3 +56,4 @@ obj-y += mic/
obj-$(CONFIG_GENWQE) += genwqe/
obj-$(CONFIG_ECHO) += echo/
obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o
+obj-$(CONFIG_EARLY_DMA_ALLOC) += early_dma_alloc.o
diff -urpN a/drivers/misc/early_dma_alloc.c b/drivers/misc/early_dma_alloc.c
--- a/drivers/misc/early_dma_alloc.c 1970-01-01 00:00:00.000000000 +0000
+++ b/drivers/misc/early_dma_alloc.c 2017-01-04 23:13:09.209089737 +0000
@@ -0,0 +1,223 @@
+/*
+ * Early DMA Memory Allocator
+ *
+ * Copyright © 2013,2014 Cumulus Networks, Inc.
+ *
+ * Author: Curt Brune <curt@cumulusnetworks.com>
+ * Modified: Jonathan Toppins <jtoppins@cumulusnetworks.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/*
+ * This driver allocates a region of DMA accessible memory, making it
+ * available to one other device driver.
+ *
+ * The client device driver may be unloaded and reloaded over time.
+ * This driver keeps the DMA region from becoming fragmented across
+ * module reloads.
+ *
+ * Memory Region Restrictions
+ * --------------------------
+ * The memory region allocated by EDA MUST exist below a 4GB limit. This
+ * is because EDA's primary (only at time of writing) user is the
+ * Broadcom BDE driver wich assumes a 32-bit physical address space and
+ * assumes paddr is no more than 32-bits wide. Furthermore, before porting
+ * the BDE driver to use EDA the BDE driver specifically checked if the
+ * memory region provided by highmem was less than 4GB. We assume Broadcom
+ * knew what they were doing and there is a specific reason why this 4GB
+ * limit is needed, so we enforce this limit by checking the physical address
+ * after allocation.
+ *
+ * Memory Region Size and Alignment
+ * --------------------------------
+ * This driver allows three ways for the user to define the DMA memory
+ * that will be created, listed in order of preference.
+ * 1. The user may specify on the kernel command line in the boot loader
+ * the "eda_mem" option, this option has the format "size@alignment",
+ * example: eda_mem=0x04000000@0x00100000
+ * 2. This driver looks for a device tree node compatible with
+ * "early-dma-alloc". The "region_size" property of the node contains
+ * the size, in bytes, of the desired DMA memory region. The
+ * "alignment" property contains the desired memory alignment of the
+ * region.
+ * 3. Finally if neither of the above are provided the Kbuild changable,
+ * compiled in default size and alignment will be used.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/unistd.h>
+#include <linux/slab.h>
+#include <linux/of_platform.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/dma-mapping.h>
+#include <linux/bootmem.h>
+#include <linux/early_dma_alloc.h>
+
+#if (!defined CONFIG_EDA_DEF_SIZE) || \
+ (!defined CONFIG_EDA_DEF_ALIGN)
+#error incorrect kernel config - fix it
+#endif
+
+// #define DEBUG
+#if (defined DEBUG)
+#define eda_debug(fmt, ... ) \
+ printk(KERN_ERR "eda-debug:%s(): " fmt "\n", __func__ , \
+ ##__VA_ARGS__)
+#else
+#define eda_debug(fmt, ... )
+#endif
+
+#define eda_info(fmt, ... ) \
+ printk(KERN_INFO "eda: " fmt "\n", ##__VA_ARGS__)
+
+static uint32_t dma_size;
+static void *dma_vaddr;
+static u32 dma_align __initdata;
+static bool eda_cmdline __initdata;
+
+static int __init setup_eda_mem(char *str)
+{
+ char *endp;
+
+ dma_size = memparse(str, &endp) & PAGE_MASK;
+ if (*endp == '@')
+ dma_align = memparse(endp + 1, NULL) & PAGE_MASK;
+ eda_cmdline = true;
+ return 0;
+}
+early_param("eda_mem", setup_eda_mem);
+
+static int __init of_eda_init(uint32_t *size, u32 *align)
+#ifdef CONFIG_OF_FLATTREE
+{
+ int rc = -ENODEV;
+ struct device_node *np = NULL;
+ const u32 *region_sz_p = NULL;
+ const u32 *align_p = NULL;
+ u32 prop_sz = 0;
+
+ eda_debug("entry");
+
+ /* is a programming error make it really painful so it gets fixed */
+ BUG_ON(NULL == size || NULL == align);
+
+ np = of_find_compatible_node(NULL, NULL, "early-dma-alloc");
+ if (!np) {
+ printk(KERN_WARNING "WARN: Can not find `early-dma-alloc'"
+ " device tree node.\n");
+ goto cleanup;
+ }
+
+ region_sz_p = of_get_property(np, "region_size", &prop_sz);
+ if (!region_sz_p || (prop_sz != sizeof(*region_sz_p))) {
+ printk(KERN_ERR "ERROR: Can not find `region_size' property"
+ " in early-dma-alloc device tree node.\n");
+ goto cleanup;
+ }
+ *size = *region_sz_p;
+
+ align_p = of_get_property(np, "alignment", &prop_sz);
+ if (!align_p || (prop_sz != sizeof(*align_p))) {
+ printk(KERN_ERR "ERROR: Can not find `alignment' property in"
+ "early-dma-alloc device tree node.\n");
+ goto cleanup;
+ }
+ *align = *align_p;
+ rc = 0;
+
+ eda_debug("cleanup");
+
+cleanup:
+ of_node_put(np);
+ return rc;
+
+}
+#else
+{
+ return -ENODEV;
+}
+#endif
+
+int eda_dma_info_get(void **vaddr, uint32_t *paddr, uint32_t *size)
+{
+ eda_debug("entry");
+
+ if (!dma_vaddr)
+ return -ENOMEM;
+
+ if (!vaddr || !paddr || !size)
+ return -EINVAL;
+
+ *vaddr = dma_vaddr;
+ *paddr = (uint32_t) virt_to_phys(dma_vaddr);
+ *size = dma_size;
+
+ eda_debug("returning -- dma_vaddr: 0x%pK, dma_paddr: 0x%08x,"
+ " size: 0x%08x", *vaddr, *paddr, *size);
+
+ return 0;
+}
+EXPORT_SYMBOL(eda_dma_info_get);
+
+int __init eda_init(void)
+{
+ int rc = 0;
+
+ if (eda_cmdline) {
+ if (!dma_align)
+ dma_align = CONFIG_EDA_DEF_ALIGN;
+ if (!dma_size)
+ dma_size = CONFIG_EDA_DEF_SIZE;
+ eda_debug("size & alignment came from: kernel cmdline");
+ } else if (!of_eda_init(&dma_size, &dma_align)) {
+ eda_debug("size & alignment came from: open firmware entry");
+ } else {
+ dma_align = CONFIG_EDA_DEF_ALIGN;
+ dma_size = CONFIG_EDA_DEF_SIZE;
+ eda_debug("size & alignment came from: compiled in defaults");
+ }
+
+ dma_vaddr = __alloc_bootmem_low(dma_size, dma_align, 0);
+ /*
+ * enforce EDA's requirement to allocate the memory region below a
+ * 32-bit limit.
+ */
+ if (virt_to_phys(dma_vaddr) > 0xFFFFFFFFULL) {
+ rc = -ENOMEM;
+ printk(KERN_ERR "ERROR: DMA memory beyond 32-bit address"
+ " space not supported.\n");
+ goto cleanup;
+ }
+
+ eda_info("dma_vaddr: 0x%pK, dma_paddr: 0x%016llx, size: 0x%08x,"
+ " alignment: 0x%08x",
+ dma_vaddr, (unsigned long long) virt_to_phys(dma_vaddr),
+ dma_size, dma_align);
+cleanup:
+ if (rc && dma_vaddr) {
+ free_bootmem(dma_vaddr, dma_size);
+ }
+ if (rc) {
+ dma_vaddr = NULL;
+ dma_size = 0;
+ }
+ return rc;
+}
+EXPORT_SYMBOL(eda_init);
diff -urpN a/include/linux/early_dma_alloc.h b/include/linux/early_dma_alloc.h
--- a/include/linux/early_dma_alloc.h 1970-01-01 00:00:00.000000000 +0000
+++ b/include/linux/early_dma_alloc.h 2017-01-04 23:13:59.405090826 +0000
@@ -0,0 +1,36 @@
+/*
+ * Early DMA Memory Allocator
+ *
+ * Copyright © 2013 Cumulus Networks, Inc.
+ *
+ * Author: Curt Brune <curt@cumulusnetworks.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef EARLY_DMA_ALLOC_H__
+#define EARLY_DMA_ALLOC_H__
+
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+
+extern int eda_init(void);
+extern int eda_dma_info_get(void** vaddr, uint32_t* paddr, uint32_t* size);
+
+#endif /* __KERNEL__ */
+
+#endif /* EARLY_DMA_ALLOC_H__ */

View File

@@ -0,0 +1,12 @@
diff -urpN a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
--- a/drivers/mmc/host/sdhci-of-esdhc.c 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/mmc/host/sdhci-of-esdhc.c 2017-01-05 17:29:20.798516943 +0000
@@ -343,7 +343,7 @@ static const struct sdhci_pltfm_data sdh
* eSDHC cannot support End Attribute in NOP ADMA descriptor
*/
.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_CARD_DETECTION
- | SDHCI_QUIRK_NO_CARD_NO_RESET
+ | SDHCI_QUIRK_NO_CARD_NO_RESET | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
| SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
.ops = &sdhci_esdhc_ops,
};

View File

@@ -0,0 +1,46 @@
diff -urpN a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
--- a/drivers/hwmon/pmbus/pmbus_core.c 2017-01-07 00:56:44.908974275 +0000
+++ b/drivers/hwmon/pmbus/pmbus_core.c 2017-01-07 01:02:17.176981485 +0000
@@ -1680,6 +1680,21 @@ static int pmbus_identify_common(struct
return 0;
}
+static int pmbus_emer_detect(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ u8 value[4];
+
+ if(i2c_smbus_read_block_data(client, PMBUS_MFR_ID, value) > 0
+ && memcmp(value, "EMER", 4) == 0) {
+ dev_info(dev, "EMER detected\n");
+ return 0;
+ }
+
+ return -ENODEV;
+}
+
+
static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
struct pmbus_driver_info *info)
{
@@ -1697,8 +1712,18 @@ static int pmbus_init_common(struct i2c_
data->status_register = PMBUS_STATUS_WORD;
ret = i2c_smbus_read_word_data(client, PMBUS_STATUS_WORD);
if (ret < 0 || ret == 0xffff) {
- dev_err(dev, "PMBus status register not found\n");
- return -ENODEV;
+ if(pmbus_emer_detect(client) == 0) {
+ data->status_register = PMBUS_STATUS_MFR_SPECIFIC;
+ ret = i2c_smbus_read_byte_data(client, PMBUS_STATUS_MFR_SPECIFIC);
+ if (ret < 0 || ret == 0xff) {
+ dev_err(dev, "PMBus status register not found\n");
+ return -ENODEV;
+ }
+ }
+ else {
+ dev_err(dev, "PMBus status register not found\n");
+ return -ENODEV;
+ }
}
}

View File

@@ -0,0 +1,41 @@
diff -urpN a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
--- a/drivers/gpio/Kconfig 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/gpio/Kconfig 2017-01-06 18:06:11.520439745 +0000
@@ -30,6 +30,23 @@ config ARCH_REQUIRE_GPIOLIB
Selecting this from the architecture code will cause the gpiolib
code to always get built in.
+config ARCH_NR_GPIOS
+ int "Max number gpios"
+ default 256
+ range 256 2048
+ help
+ Platforms may implement their GPIO interface with library code,
+ at a small performance cost for non-inlined operations and some
+ extra memory (for code and for per-GPIO table entries).
+
+ While the GPIO programming interface defines valid GPIO numbers
+ to be in the range 0..MAX_INT, this library restricts them to the
+ smaller range 0..ARCH_NR_GPIOS-1.
+
+ ARCH_NR_GPIOS is somewhat arbitrary; it usually reflects the sum of
+ builtin/SoC GPIOs plus a number of GPIOs on expanders; the latter is
+ actually an estimate of a board-specific value.
+
menuconfig GPIOLIB
bool "GPIO Support"
diff -urpN a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
--- a/include/asm-generic/gpio.h 2016-11-20 01:17:41.000000000 +0000
+++ b/include/asm-generic/gpio.h 2017-01-06 18:02:56.124435505 +0000
@@ -26,6 +26,10 @@
* actually an estimate of a board-specific value.
*/
+#ifdef CONFIG_ARCH_NR_GPIOS
+#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIOS
+#endif
+
#ifndef ARCH_NR_GPIOS
#define ARCH_NR_GPIOS 256
#endif

View File

@@ -0,0 +1,58 @@
diff -urpN a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig
--- a/drivers/i2c/muxes/Kconfig 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/i2c/muxes/Kconfig 2017-01-04 19:39:46.292811921 +0000
@@ -48,6 +48,13 @@ config I2C_MUX_PCA954x
This driver can also be built as a module. If so, the module
will be called i2c-mux-pca954x.
+config I2C_MUX_PCA954X_DESELECT_ON_EXIT
+ bool "Enable deselect-on-exit feature for PCA954X devices."
+ depends on I2C_MUX_PCA954x
+ help
+ If you say yes here you enable the deselect-on-exit feature in
+ the pca954x i2c driver.
+
config I2C_MUX_PINCTRL
tristate "pinctrl-based I2C multiplexer"
depends on PINCTRL
diff -urpN a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c 2017-01-04 19:41:03.832813604 +0000
@@ -189,6 +189,7 @@ static int pca954x_probe(struct i2c_clie
int num, force, class;
struct pca954x *data;
int ret;
+ int deselect_on_exit = 0;
if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE))
return -ENODEV;
@@ -213,6 +214,20 @@ static int pca954x_probe(struct i2c_clie
return -ENODEV;
}
+ /*
+ * Check whether we want to deselect the mux after the
+ * transaction. This can be specified in one of two ways:
+ *
+ * 1. using platform data: pdata->modes[num].deselect_on_exit
+ * 2. using the device tree property deselect_on_exit
+ */
+ if (of_find_property(client->dev.of_node, "deselect-on-exit", NULL)) {
+ deselect_on_exit = 1;
+ }
+
+#ifdef CONFIG_I2C_MUX_PCA954X_DESELECT_ON_EXIT
+ deselect_on_exit = 1;
+#endif
data->type = id->driver_data;
data->last_chan = 0; /* force the first selection */
@@ -233,7 +248,7 @@ static int pca954x_probe(struct i2c_clie
data->virt_adaps[num] =
i2c_add_mux_adapter(adap, &client->dev, client,
force, num, class, pca954x_select_chan,
- (pdata && pdata->modes[num].deselect_on_exit)
+ (pdata && pdata->modes[num].deselect_on_exit) || deselect_on_exit
? pca954x_deselect_mux : NULL);
if (data->virt_adaps[num] == NULL) {

View File

@@ -0,0 +1,44 @@
diff -urpN a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
--- a/drivers/net/ethernet/broadcom/tg3.c 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/net/ethernet/broadcom/tg3.c 2017-01-12 20:49:40.051901568 +0000
@@ -234,6 +234,14 @@ static int tg3_debug = -1; /* -1 == use
module_param(tg3_debug, int, 0);
MODULE_PARM_DESC(tg3_debug, "Tigon3 bitmapped debugging message enable value");
+static int short_preamble = 0;
+module_param(short_preamble, int, 0);
+MODULE_PARM_DESC(short_preamble, "Enable short preamble.");
+
+static int bcm5718s_reset = 0;
+module_param(bcm5718s_reset, int, 0);
+MODULE_PARM_DESC(bcm5718s_reset, "Enable BCM5718S reset support.");
+
#define TG3_DRV_DATA_FLAG_10_100_ONLY 0x0001
#define TG3_DRV_DATA_FLAG_5705_10_100 0x0002
@@ -1485,6 +1493,12 @@ static void tg3_mdio_config_5785(struct
static void tg3_mdio_start(struct tg3 *tp)
{
tp->mi_mode &= ~MAC_MI_MODE_AUTO_POLL;
+
+ if(short_preamble) {
+ netdev_info(tp->dev, "Setting short preamble...");
+ tp->mi_mode |= MAC_MI_MODE_SHORT_PREAMBLE;
+ }
+
tw32_f(MAC_MI_MODE, tp->mi_mode);
udelay(80);
@@ -2689,6 +2703,12 @@ static int tg3_phy_reset(struct tg3 *tp)
}
}
+ if (bcm5718s_reset && tp->phy_id == TG3_PHY_ID_BCM5718S) {
+ netdev_info(tp->dev, "BCM5718S reset...");
+ __tg3_writephy(tp, 0x8, 0x10, 0x1d0); /* set internal phy 0x8 to make linkup */
+ __tg3_writephy(tp, 0x1f, 0x4, 0x5e1); /* enable 10/100 cability of external phy */
+ }
+
if (tg3_flag(tp, 5717_PLUS) &&
(tp->phy_flags & TG3_PHYFLG_MII_SERDES))
return 0;

View File

@@ -15,3 +15,9 @@ driver-igb-version-5.3.54.patch
driver-support-intel-igb-bcm5461X-phy.patch
driver-i2c-bus-intel-ismt-enable-param.patch
drivers-i2c-busses-i2c-isch-probe-param.patch
drivers-i2c-muxes-pca954x-deselect-on-exit.patch
driver-early-dma-allocator.patch
driver-esdhc-p2020-broken-timeout.patch
drivers-gpio-config-arch-nr-gpios.patch
driver-hwmon-emerson-update-pmbus-core.patch
drivers-net-ethernet-broadcom-tg3-preamble-reset.patch

View File

@@ -277,8 +277,8 @@ index 0000000..3934bcd
+ */
+static const u8 fan_reg[] = {
+ 0x2B, /* fan PWM(for all fan) */
+ 0x2C, /* fan 1 speed(rpm) */
+ 0x2D, /* fan 2 speed(rpm) */
+ 0x2D, /* fan 1 speed(rpm) */
+ 0x2C, /* fan 2 speed(rpm) */
+ 0x11, /* fan1-2 operating status */
+};
+
@@ -382,7 +382,7 @@ index 0000000..3934bcd
+
+static u8 is_fan_fault(struct as4610_fan_data *data, enum fan_id id)
+{
+ u8 mask = (id == FAN1_ID) ? 0x10 : 0x20;
+ u8 mask = (id == FAN1_ID) ? 0x20 : 0x10;
+
+ return !(data->reg_val[FAN_FAULT] & mask);
+}
@@ -1862,10 +1862,10 @@ index e4f6bf5..db2dab8 100644
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
diff --git a/drivers/leds/leds-accton_as4610.c b/drivers/leds/leds-accton_as4610.c
new file mode 100644
index 0000000..6f20735
index 0000000..0c4b535
--- /dev/null
+++ b/drivers/leds/leds-accton_as4610.c
@@ -0,0 +1,719 @@
@@ -0,0 +1,678 @@
+/*
+ * A LED driver for the accton_as4610_led
+ *
@@ -1896,6 +1896,7 @@ index 0000000..6f20735
+#include <linux/err.h>
+#include <linux/leds.h>
+#include <linux/slab.h>
+#include <linux/bitops.h>
+#include <linux/accton_i2c_cpld.h>
+
+extern int accton_i2c_cpld_read (unsigned short cpld_addr, u8 reg);
@@ -1903,8 +1904,6 @@ index 0000000..6f20735
+
+extern void led_classdev_unregister(struct led_classdev *led_cdev);
+extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev);
+extern void led_classdev_resume(struct led_classdev *led_cdev);
+extern void led_classdev_suspend(struct led_classdev *led_cdev);
+
+#define DRVNAME "as4610_led"
+
@@ -1913,12 +1912,12 @@ index 0000000..6f20735
+ struct mutex update_lock;
+ char valid; /* != 0 if registers are valid */
+ unsigned long last_updated; /* In jiffies */
+ u8 num_of_led;
+ int led_map;
+ u8 reg_val[5]; /* Register value, 0 = (0x1A) Blinking function
+ 1 = (0x30) 7-seg 2
+ 2 = (0x31) 7-seg 1
+ 3 = (0x32) SYS/PRI/PSU1-2 LED
+ 4 = (0x33) STK1-2/Fan/PoE LED */
+ 4 = (0x33) STK1-2/Fan/PoE/Alarm LED */
+};
+
+static struct as4610_led_data *ledctl = NULL;
@@ -1934,50 +1933,35 @@ index 0000000..6f20735
+#define LED_NORMAL_OFF_VALUE 0x00
+
+#define LED_TYPE_SYS_REG_MASK 0xC0
+#define LED_MODE_SYS_GREEN_MASK 0x80
+#define LED_MODE_SYS_AMBER_MASK 0x40
+#define LED_MODE_SYS_OFF_MASK 0x00
+#define LED_MODE_SYS_BLINK_MASK 0x80
+#define LED_MODE_SYS_BLINK_MASK 0x80
+
+#define LED_TYPE_PRI_REG_MASK 0x30
+#define LED_MODE_PRI_GREEN_MASK 0x20
+#define LED_MODE_PRI_AMBER_MASK 0x10
+#define LED_MODE_PRI_OFF_MASK 0x00
+#define LED_MODE_PRI_BLINK_MASK 0x40
+#define LED_TYPE_PRI_REG_MASK 0x30
+#define LED_MODE_PRI_BLINK_MASK 0x40
+
+#define LED_TYPE_PSU1_REG_MASK 0x0C
+#define LED_TYPE_PSU1_REG_MASK 0x0C
+#define LED_MODE_PSU1_BLINK_MASK 0x20
+
+#define LED_TYPE_PSU2_REG_MASK 0x03
+#define LED_TYPE_PSU2_REG_MASK 0x03
+#define LED_MODE_PSU2_BLINK_MASK 0x10
+
+#define LED_TYPE_STK1_REG_MASK 0xC0
+#define LED_MODE_STK1_GREEN_MASK 0x80
+#define LED_MODE_STK1_AMBER_MASK 0x40
+#define LED_MODE_STK1_OFF_MASK 0x00
+#define LED_TYPE_STK1_REG_MASK 0xC0
+#define LED_MODE_STK1_BLINK_MASK 0x08
+
+#define LED_TYPE_STK2_REG_MASK 0x30
+#define LED_MODE_STK2_GREEN_MASK 0x20
+#define LED_MODE_STK2_AMBER_MASK 0x10
+#define LED_MODE_STK2_OFF_MASK 0x00
+#define LED_TYPE_STK2_REG_MASK 0x30
+#define LED_MODE_STK2_BLINK_MASK 0x04
+
+#define LED_TYPE_FAN_REG_MASK 0x0C
+#define LED_MODE_FAN_BLINK_MASK 0x02
+#define LED_TYPE_FAN_REG_MASK 0x0C
+#define LED_MODE_FAN_BLINK_MASK 0x02
+
+#define LED_TYPE_POE_REG_MASK 0x03
+#define LED_MODE_POE_GREEN_MASK 0x02
+#define LED_MODE_POE_AMBER_MASK 0x01
+#define LED_MODE_POE_OFF_MASK 0x00
+#define LED_MODE_POE_BLINK_MASK 0x01
+#define LED_TYPE_POE_ALARM_REG_MASK 0x03
+#define LED_MODE_POE_ALARM_BLINK_MASK 0x01
+
+static const u8 led_reg[] = {
+ 0x1A, /* Blinking function */
+ 0x30, /* 7-seg 1 */
+ 0x31, /* 7-seg 2 */
+ 0x32, /* SYS/PRI/PSU1-2 LED */
+ 0x33, /* STK1-2/Fan/PoE LED */
+ 0x33, /* STK1-2/Fan/PoE/Alarm LED */
+};
+
+enum led_type {
@@ -1992,7 +1976,26 @@ index 0000000..6f20735
+ LED_TYPE_7SEG_DIGITS,
+ LED_TYPE_7SEG_DIGITS_POINT,
+ LED_TYPE_FAN,
+ LED_TYPE_POE
+ LED_TYPE_POE,
+ LED_TYPE_ALARM,
+ NUM_OF_LED
+};
+
+#define AS4610_COMMON_LED_MAP (BIT(LED_TYPE_SYS) | BIT(LED_TYPE_PRI) | BIT(LED_TYPE_PSU1) | \
+ BIT(LED_TYPE_PSU2)| BIT(LED_TYPE_STK1)| BIT(LED_TYPE_STK2))
+#define AS4610_NPOE_LED_MAP (AS4610_COMMON_LED_MAP | BIT(LED_TYPE_7SEG_TENS) | \
+ BIT(LED_TYPE_7SEG_TENS_POINT) | BIT(LED_TYPE_7SEG_DIGITS) | \
+ BIT(LED_TYPE_7SEG_DIGITS_POINT))
+#define AS4610_POE_LED_MAP (AS4610_NPOE_LED_MAP | BIT(LED_TYPE_FAN) | BIT(LED_TYPE_POE))
+#define AS4610_54T_B_LED_MAP (AS4610_COMMON_LED_MAP | BIT(LED_TYPE_FAN) | BIT(LED_TYPE_ALARM))
+
+static int as4610_ledmaps[] = {
+ [PID_AS4610_30T] = AS4610_NPOE_LED_MAP,
+ [PID_AS4610_30P] = AS4610_POE_LED_MAP,
+ [PID_AS4610_54T] = AS4610_NPOE_LED_MAP,
+ [PID_AS4610_54P] = AS4610_POE_LED_MAP,
+ [PID_AS4610_54T_B] = AS4610_54T_B_LED_MAP,
+ [PID_RESERVED] = 0,
+};
+
+enum led_light_mode {
@@ -2059,12 +2062,6 @@ index 0000000..6f20735
+{
+ as4610_led_update();
+ return (ledctl->reg_val[reg_id] & LED_7SEG_REG_MASK);
+#if 0
+ as4610_led_update();
+
+ return (ledctl->reg_val[2] & LED_7SEG_REG_MASK) * 10 +
+ (ledctl->reg_val[1] & LED_7SEG_REG_MASK);
+#endif
+}
+
+static void seven_segment_set(struct led_classdev *cdev, enum led_brightness mode, u8 reg_id)
@@ -2076,23 +2073,6 @@ index 0000000..6f20735
+ ledctl->reg_val[reg_id] &= 0xF0;
+ ledctl->reg_val[reg_id] |= mode;
+ as4610_led_write_value(led_reg[reg_id], ledctl->reg_val[reg_id]);
+
+#if 0
+ u8 digits, tens;
+
+ if (mode > LED_MODE_SEVEN_SEGMENT_MAX) {
+ return;
+ }
+
+ digits = mode % 10;
+ tens = mode / 10;
+ ledctl->reg_val[1] &= 0xF0;
+ ledctl->reg_val[1] |= digits;
+ ledctl->reg_val[2] &= 0xF0;
+ ledctl->reg_val[2] |= tens;
+ as4610_led_write_value(led_reg[1], ledctl->reg_val[1]);
+ as4610_led_write_value(led_reg[2], ledctl->reg_val[2]);
+#endif
+}
+
+static enum led_brightness seven_segment_digits_get(struct led_classdev *cdev)
@@ -2322,16 +2302,16 @@ index 0000000..6f20735
+ return as4610_led_normal_get(3, LED_MODE_PRI_BLINK_MASK, 4);
+}
+
+static void as4610_led_poe_set(struct led_classdev *cdev,
+static void as4610_led_poe_alarm_set(struct led_classdev *cdev,
+ enum led_brightness mode)
+{
+ as4610_led_normal_set(cdev, mode, LED_MODE_POE_BLINK_MASK,
+ 4, LED_TYPE_POE_REG_MASK, 0);
+ as4610_led_normal_set(cdev, mode, LED_MODE_POE_ALARM_BLINK_MASK,
+ 4, LED_TYPE_POE_ALARM_REG_MASK, 0);
+}
+
+static enum led_brightness as4610_led_poe_get(struct led_classdev *cdev)
+static enum led_brightness as4610_led_poe_alarm_get(struct led_classdev *cdev)
+{
+ return as4610_led_normal_get(4, LED_MODE_POE_BLINK_MASK, 0);
+ return as4610_led_normal_get(4, LED_MODE_POE_ALARM_BLINK_MASK, 0);
+}
+
+static void as4610_led_stk1_set(struct led_classdev *cdev,
@@ -2364,7 +2344,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = as4610_led_sys_set,
+ .brightness_get = as4610_led_sys_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_AMBER_BLINK,
+ },
+ [LED_TYPE_PRI] = {
@@ -2372,7 +2351,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = as4610_led_pri_set,
+ .brightness_get = as4610_led_pri_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_AMBER_BLINK,
+ },
+ [LED_TYPE_PSU1] = {
@@ -2380,7 +2358,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = as4610_led_psu1_set,
+ .brightness_get = as4610_led_psu1_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_AUTO_BLINKING,
+ },
+ [LED_TYPE_PSU2] = {
@@ -2388,7 +2365,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = as4610_led_psu2_set,
+ .brightness_get = as4610_led_psu2_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_AUTO_BLINKING,
+ },
+ [LED_TYPE_STK1] = {
@@ -2396,7 +2372,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = as4610_led_stk1_set,
+ .brightness_get = as4610_led_stk1_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_AMBER_BLINK,
+ },
+ [LED_TYPE_STK2] = {
@@ -2404,7 +2379,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = as4610_led_stk2_set,
+ .brightness_get = as4610_led_stk2_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_AMBER_BLINK,
+ },
+ [LED_TYPE_7SEG_TENS] = {
@@ -2412,7 +2386,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = seven_segment_tens_set,
+ .brightness_get = seven_segment_tens_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_SEVEN_SEGMENT_MAX,
+ },
+ [LED_TYPE_7SEG_TENS_POINT] = {
@@ -2420,7 +2393,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = seven_segment_tens_point_set,
+ .brightness_get = seven_segment_tens_point_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_GREEN,
+ },
+ [LED_TYPE_7SEG_DIGITS] = {
@@ -2428,7 +2400,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = seven_segment_digits_set,
+ .brightness_get = seven_segment_digits_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_SEVEN_SEGMENT_MAX,
+ },
+ [LED_TYPE_7SEG_DIGITS_POINT] = {
@@ -2436,7 +2407,6 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = seven_segment_digits_point_set,
+ .brightness_get = seven_segment_digits_point_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_GREEN,
+ },
+ [LED_TYPE_FAN] = {
@@ -2444,61 +2414,49 @@ index 0000000..6f20735
+ .default_trigger = "unused",
+ .brightness_set = as4610_led_fan_set,
+ .brightness_get = as4610_led_fan_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .max_brightness = LED_MODE_AUTO_BLINKING,
+ },
+ [LED_TYPE_POE] = {
+ .name = "as4610::poe",
+ .default_trigger = "unused",
+ .brightness_set = as4610_led_poe_set,
+ .brightness_get = as4610_led_poe_get,
+ .flags = LED_CORE_SUSPENDRESUME,
+ .brightness_set = as4610_led_poe_alarm_set,
+ .brightness_get = as4610_led_poe_alarm_get,
+ .max_brightness = LED_MODE_AMBER_BLINK,
+ },
+ [LED_TYPE_ALARM] = {
+ .name = "as4610::alarm",
+ .default_trigger = "unused",
+ .brightness_set = as4610_led_poe_alarm_set,
+ .brightness_get = as4610_led_poe_alarm_get,
+ .max_brightness = LED_MODE_AMBER_BLINK,
+ },
+};
+
+static int as4610_led_suspend(struct platform_device *dev,
+ pm_message_t state)
+{
+ int i = 0;
+
+ for (i = 0; i < ledctl->num_of_led; i++) {
+ led_classdev_suspend(&as4610_leds[i]);
+ }
+
+ return 0;
+}
+
+static int as4610_led_resume(struct platform_device *dev)
+{
+ int i = 0;
+
+ for (i = 0; i < ledctl->num_of_led; i++) {
+ led_classdev_resume(&as4610_leds[i]);
+ }
+
+ return 0;
+}
+
+static int as4610_led_probe(struct platform_device *pdev)
+{
+ int ret = 0, i;
+
+ for (i = 0; i < ledctl->num_of_led; i++) {
+ for (i = 0; i < NUM_OF_LED; i++) {
+ if (!(ledctl->led_map & BIT(i))) {
+ continue;
+ }
+
+ ret = led_classdev_register(&pdev->dev, &as4610_leds[i]);
+
+ if (ret < 0)
+ break;
+ if (ret < 0) {
+ goto error;
+ }
+ }
+
+ /* Check if all LEDs were successfully registered */
+ if (i != ledctl->num_of_led){
+ int j;
+ return 0;
+
+error:
+ for (i = i-1; i >= 0; i--) {
+ /* only unregister the LEDs that were successfully registered */
+ for (j = 0; j < i; j++) {
+ led_classdev_unregister(&as4610_leds[i]);
+ if (!(ledctl->led_map & BIT(i))) {
+ continue;
+ }
+
+ led_classdev_unregister(&as4610_leds[i]);
+ }
+
+ return ret;
@@ -2508,7 +2466,11 @@ index 0000000..6f20735
+{
+ int i;
+
+ for (i = 0; i < ledctl->num_of_led; i++) {
+ for (i = 0; i < NUM_OF_LED; i++) {
+ if (!(ledctl->led_map & BIT(i))) {
+ continue;
+ }
+
+ led_classdev_unregister(&as4610_leds[i]);
+ }
+
@@ -2518,8 +2480,6 @@ index 0000000..6f20735
+static struct platform_driver as4610_led_driver = {
+ .probe = as4610_led_probe,
+ .remove = as4610_led_remove,
+ .suspend = as4610_led_suspend,
+ .resume = as4610_led_resume,
+ .driver = {
+ .name = DRVNAME,
+ .owner = THIS_MODULE,
@@ -2528,7 +2488,7 @@ index 0000000..6f20735
+
+static int __init as4610_led_init(void)
+{
+ int ret;
+ int ret, pid;
+
+ if (as4610_product_id() == PID_UNKNOWN) {
+ return -ENODEV;
@@ -2546,13 +2506,12 @@ index 0000000..6f20735
+ goto exit;
+ }
+
+ if (as4610_is_poe_system()) {
+ ledctl->num_of_led = LED_TYPE_POE - LED_TYPE_SYS + 1;
+ }
+ else {
+ ledctl->num_of_led = LED_TYPE_7SEG_DIGITS_POINT - LED_TYPE_SYS + 1;
+ pid = as4610_product_id();
+ if (pid == PID_UNKNOWN) {
+ return -ENODEV;
+ }
+
+ ledctl->led_map = as4610_ledmaps[pid];
+ mutex_init(&ledctl->update_lock);
+
+ ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
@@ -2615,10 +2574,10 @@ index 9edd559..12f7cae 100644
+obj-$(CONFIG_EEPROM_ACCTON_AS4610_SFP) += accton_as4610_sfp.o
diff --git a/drivers/misc/eeprom/accton_as4610_sfp.c b/drivers/misc/eeprom/accton_as4610_sfp.c
new file mode 100644
index 0000000..51488b4
index 0000000..39c17ec
--- /dev/null
+++ b/drivers/misc/eeprom/accton_as4610_sfp.c
@@ -0,0 +1,1265 @@
@@ -0,0 +1,1269 @@
+/*
+ * SFP driver for accton as4610 sfp
+ *
@@ -2941,7 +2900,7 @@ index 0000000..51488b4
+ DEBUG_PRINT("Present status = 0x%lx", data->present);
+exit:
+ mutex_unlock(&data->update_lock);
+ return data;
+ return (status < 0) ? ERR_PTR(status) : data;
+}
+
+static struct sfp_port_data *sfp_update_tx_rx_status(struct device *dev)
@@ -3168,7 +3127,6 @@ index 0000000..51488b4
+ for (i = 0; i < ARRAY_SIZE(reg); i++) {
+ status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf));
+ if (unlikely(status < 0)) {
+ data = ERR_PTR(status);
+ goto exit;
+ }
+ }
@@ -3178,7 +3136,6 @@ index 0000000..51488b4
+ for (i = 0; i < ARRAY_SIZE(reg); i++) {
+ status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf));
+ if (unlikely(status < 0)) {
+ data = ERR_PTR(status);
+ goto exit;
+ }
+
@@ -3191,7 +3148,7 @@ index 0000000..51488b4
+
+exit:
+ mutex_unlock(&data->update_lock);
+ return data;
+ return (status < 0) ? ERR_PTR(status) : data;
+}
+
+static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da,
@@ -3210,7 +3167,7 @@ index 0000000..51488b4
+
+ if (present == 0) {
+ /* port is not present */
+ return -ENODEV;
+ return -ENXIO;
+ }
+
+ data = qsfp_update_tx_rx_status(dev);
@@ -3220,31 +3177,31 @@ index 0000000..51488b4
+
+ switch (attr->index) {
+ case TX_FAULT:
+ val = (data->qsfp->status[2] & 0xF) ? 1 : 0;
+ val = !!(data->qsfp->status[2] & 0xF);
+ break;
+ case TX_FAULT1:
+ case TX_FAULT2:
+ case TX_FAULT3:
+ case TX_FAULT4:
+ val = (data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1)) ? 1 : 0;
+ val = !!(data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1));
+ break;
+ case TX_DISABLE:
+ val = (data->qsfp->status[1] & 0xF) ? 1 : 0;
+ val = data->qsfp->status[1] & 0xF;
+ break;
+ case TX_DISABLE1:
+ case TX_DISABLE2:
+ case TX_DISABLE3:
+ case TX_DISABLE4:
+ val = (data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1)) ? 1 : 0;
+ val = !!(data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1));
+ break;
+ case RX_LOS:
+ val = (data->qsfp->status[0] & 0xF) ? 1 : 0;
+ val = !!(data->qsfp->status[0] & 0xF);
+ break;
+ case RX_LOS1:
+ case RX_LOS2:
+ case RX_LOS3:
+ case RX_LOS4:
+ val = (data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1)) ? 1 : 0;
+ val = !!(data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1));
+ break;
+ default:
+ break;
@@ -3259,7 +3216,18 @@ index 0000000..51488b4
+ long disable;
+ int status;
+ struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
+ struct sfp_port_data *data = NULL;
+ struct i2c_client *client = to_i2c_client(dev);
+ struct sfp_port_data *data = i2c_get_clientdata(client);
+
+ status = sfp_is_port_present(client, data->port);
+ if (IS_ERR_VALUE(status)) {
+ return status;
+ }
+
+ if (!status) {
+ /* port is not present */
+ return -ENXIO;
+ }
+
+ status = kstrtol(buf, 10, &disable);
+ if (status) {
@@ -3274,12 +3242,7 @@ index 0000000..51488b4
+ mutex_lock(&data->update_lock);
+
+ if (attr->index == TX_DISABLE) {
+ if (disable) {
+ data->qsfp->status[1] |= 0xF;
+ }
+ else {
+ data->qsfp->status[1] &= ~0xF;
+ }
+ data->qsfp->status[1] = disable & 0xF;
+ }
+ else {/* TX_DISABLE1 ~ TX_DISABLE4*/
+ if (disable) {
@@ -3323,7 +3286,7 @@ index 0000000..51488b4
+ return status;
+ }
+
+ return sprintf(buf, "%d\n", (ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK) ? 1 : 0);
+ return sprintf(buf, "%d\n", !!(ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK));
+}
+
+/* Platform dependent +++ */
@@ -3855,7 +3818,7 @@ index 0000000..51488b4
+
+/* Addresses scanned
+ */
+static const unsigned short normal_i2c[] = { SFP_EEPROM_A0_I2C_ADDR, SFP_EEPROM_A2_I2C_ADDR, I2C_CLIENT_END };
+static const unsigned short normal_i2c[] = { I2C_CLIENT_END };
+
+static struct i2c_driver sfp_driver = {
+ .driver = {
@@ -3881,15 +3844,15 @@ index 0000000..51488b4
+MODULE_DESCRIPTION("accton as4610_sfp driver");
+MODULE_LICENSE("GPL");
+
+module_init(sfp_init);
+late_initcall(sfp_init);
+module_exit(sfp_exit);
+
diff --git a/include/linux/accton_i2c_cpld.h b/include/linux/accton_i2c_cpld.h
new file mode 100644
index 0000000..3f13209
index 0000000..9b75abd
--- /dev/null
+++ b/include/linux/accton_i2c_cpld.h
@@ -0,0 +1,53 @@
@@ -0,0 +1,76 @@
+/*
+ * A hwmon driver for the accton_i2c_cpld
+ *
@@ -3922,6 +3885,8 @@ index 0000000..3f13209
+ PID_AS4610_30P,
+ PID_AS4610_54T,
+ PID_AS4610_54P,
+ PID_RESERVED,
+ PID_AS4610_54T_B,
+ PID_UNKNOWN
+};
+
@@ -3929,7 +3894,12 @@ index 0000000..3f13209
+{
+ int pid = accton_i2c_cpld_read(AS4610_CPLD_SLAVE_ADDR, AS4610_CPLD_PID_OFFSET);
+ pid &= 0xF;
+ return (pid < PID_AS4610_30T || pid > PID_AS4610_54P) ? PID_UNKNOWN : pid;
+
+ if (pid < PID_AS4610_30T || pid > PID_AS4610_54T_B || pid == PID_RESERVED) {
+ return PID_UNKNOWN;
+ }
+
+ return pid;
+}
+
+static inline int as4610_is_poe_system(void)
@@ -3940,7 +3910,23 @@ index 0000000..3f13209
+
+static inline int as4610_number_of_system_fan(void)
+{
+ return as4610_is_poe_system() ? 1 : 0;
+ int nFan = 0;
+ int pid = as4610_product_id();
+
+ switch (pid) {
+ case PID_AS4610_30P:
+ case PID_AS4610_54P:
+ nFan = 1;
+ break;
+ case PID_AS4610_54T_B:
+ nFan = 2;
+ break;
+ default:
+ nFan = 0;
+ break;
+ }
+
+ return nFan;
+}
+

View File

@@ -0,0 +1,233 @@
/*
* Hardware monitoring driver for PMBus devices
*
* Copyright (c) 2010, 2011 Ericsson AB.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/i2c.h>
#include <linux/../../drivers/hwmon/pmbus/pmbus.h>
/*
* Find sensor groups and status registers on each page.
*/
static void pmbus_find_sensor_groups(struct i2c_client *client,
struct pmbus_driver_info *info)
{
int page;
/* Sensors detected on page 0 only */
if (pmbus_check_word_register(client, 0, PMBUS_READ_VIN))
info->func[0] |= PMBUS_HAVE_VIN;
if (pmbus_check_word_register(client, 0, PMBUS_READ_VCAP))
info->func[0] |= PMBUS_HAVE_VCAP;
if (pmbus_check_word_register(client, 0, PMBUS_READ_IIN))
info->func[0] |= PMBUS_HAVE_IIN;
if (pmbus_check_word_register(client, 0, PMBUS_READ_PIN))
info->func[0] |= PMBUS_HAVE_PIN;
if (info->func[0]
&& pmbus_check_byte_register(client, 0, PMBUS_STATUS_INPUT))
info->func[0] |= PMBUS_HAVE_STATUS_INPUT;
if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_12) &&
pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_1)) {
info->func[0] |= PMBUS_HAVE_FAN12;
if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_12))
info->func[0] |= PMBUS_HAVE_STATUS_FAN12;
}
if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_34) &&
pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_3)) {
info->func[0] |= PMBUS_HAVE_FAN34;
if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34))
info->func[0] |= PMBUS_HAVE_STATUS_FAN34;
}
if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1))
info->func[0] |= PMBUS_HAVE_TEMP;
if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2))
info->func[0] |= PMBUS_HAVE_TEMP2;
if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3))
info->func[0] |= PMBUS_HAVE_TEMP3;
if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2
| PMBUS_HAVE_TEMP3)
&& pmbus_check_byte_register(client, 0,
PMBUS_STATUS_TEMPERATURE))
info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
/* Sensors detected on all pages */
for (page = 0; page < info->pages; page++) {
if (pmbus_check_word_register(client, page, PMBUS_READ_VOUT)) {
info->func[page] |= PMBUS_HAVE_VOUT;
if (pmbus_check_byte_register(client, page,
PMBUS_STATUS_VOUT))
info->func[page] |= PMBUS_HAVE_STATUS_VOUT;
}
if (pmbus_check_word_register(client, page, PMBUS_READ_IOUT)) {
info->func[page] |= PMBUS_HAVE_IOUT;
if (pmbus_check_byte_register(client, 0,
PMBUS_STATUS_IOUT))
info->func[page] |= PMBUS_HAVE_STATUS_IOUT;
}
if (pmbus_check_word_register(client, page, PMBUS_READ_POUT))
info->func[page] |= PMBUS_HAVE_POUT;
}
}
/*
* Identify chip parameters.
*/
static int pmbus_identify(struct i2c_client *client,
struct pmbus_driver_info *info)
{
int ret = 0;
if (!info->pages) {
/*
* Check if the PAGE command is supported. If it is,
* keep setting the page number until it fails or until the
* maximum number of pages has been reached. Assume that
* this is the number of pages supported by the chip.
*/
if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) {
int page;
for (page = 1; page < PMBUS_PAGES; page++) {
if (pmbus_set_page(client, page) < 0)
break;
}
pmbus_set_page(client, 0);
info->pages = page;
} else {
info->pages = 1;
}
}
if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
int vout_mode;
vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
if (vout_mode >= 0 && vout_mode != 0xff) {
switch (vout_mode >> 5) {
case 0:
break;
case 1:
info->format[PSC_VOLTAGE_OUT] = vid;
break;
case 2:
info->format[PSC_VOLTAGE_OUT] = direct;
break;
default:
ret = -ENODEV;
goto abort;
}
}
}
/*
* We should check if the COEFFICIENTS register is supported.
* If it is, and the chip is configured for direct mode, we can read
* the coefficients from the chip, one set per group of sensor
* registers.
*
* To do this, we will need access to a chip which actually supports the
* COEFFICIENTS command, since the command is too complex to implement
* without testing it. Until then, abort if a chip configured for direct
* mode was detected.
*/
if (info->format[PSC_VOLTAGE_OUT] == direct) {
ret = -ENODEV;
goto abort;
}
/* Try to find sensor groups */
pmbus_find_sensor_groups(client, info);
abort:
return ret;
}
static int pmbus_read_byte_data_emerson700(struct i2c_client *client, int page, int reg)
{
int rv, value;
if (page >= 0) {
rv = pmbus_set_page(client, page);
if (rv < 0)
return rv;
}
value = i2c_smbus_read_byte_data(client, reg);
return (value == 0xff) ? (-EIO) : value;
}
static int pmbus_read_word_data_emerson700(struct i2c_client *client, int page, int reg)
{
int rv, value;
rv = pmbus_set_page(client, page);
if (rv < 0)
return rv;
value = i2c_smbus_read_word_data(client, reg);
return (value == 0xffff) ? (-EIO) : value;
}
static int emerson700_pmbus_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct pmbus_driver_info *info;
info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
GFP_KERNEL);
if (!info)
return -ENOMEM;
info->pages = id->driver_data;
info->identify = pmbus_identify;
info->read_byte_data = pmbus_read_byte_data_emerson700;
info->read_word_data = pmbus_read_word_data_emerson700;
return pmbus_do_probe(client, id, info);
}
/*
* Use driver_data to set the number of pages supported by the chip.
*/
static const struct i2c_device_id emerson700_pmbus_id[] = {
{"emerson700", 0},
{}
};
MODULE_DEVICE_TABLE(i2c, emerson700_pmbus_id);
/* This is the driver that will be inserted */
static struct i2c_driver emerson700_pmbus_driver = {
.driver = {
.name = "emerson700",
},
.probe = emerson700_pmbus_probe,
.remove = pmbus_do_remove,
.id_table = emerson700_pmbus_id,
};
module_i2c_driver(emerson700_pmbus_driver);
MODULE_AUTHOR("Audi Hsu ");
MODULE_DESCRIPTION("Emerson 700 PMBus driver");
MODULE_LICENSE("GPL");

View File

@@ -83,7 +83,7 @@ resource_int_register(int index, const char* desc,
netsnmp_create_handler_registration(desc, handler,
tree, OID_LENGTH(tree),
HANDLER_CAN_RONLY);
if (netsnmp_register_scalar(reg) != MIB_REGISTERED_OK) {
if (netsnmp_register_instance(reg) != MIB_REGISTERED_OK) {
AIM_LOG_ERROR("registering handler for %s failed", desc);
}
}

View File

@@ -67,6 +67,10 @@ sff_module_types: &sff_module_types
desc: "40GBASE-CR"
- 40G_BASE_SR2:
desc: "40GBASE-SR2"
- 40G_BASE_SM4:
desc: "40GBASE-SM4"
- 25G_BASE_CR:
desc: "25GBASE-CR"
- 10G_BASE_SR:
desc: "10GBASE-SR"
- 10G_BASE_LR:
@@ -102,8 +106,9 @@ sff_module_caps: &sff_module_caps
- F_100 : 0x1
- F_1G : 0x2
- F_10G : 0x4
- F_40G : 0x8
- F_100G : 0x10
- F_25G : 0x8
- F_40G : 0x10
- F_100G : 0x20
sff_sfp_types: &sff_sfp_types
- SFP:

View File

@@ -270,6 +270,23 @@ _sff8436_qsfp_40g_lm4(const uint8_t* idprom)
return SFF8436_MEDIA_NONE(idprom);
}
static inline int
_sff8436_qsfp_40g_sm4(const uint8_t* idprom)
{
if(!SFF8436_MODULE_QSFP_PLUS_V2(idprom)) {
return 0;
}
if (!SFF8436_MEDIA_NONE(idprom)) return 0;
/* 850nm tx technology */
if (idprom[147] & 0xF0) return 0;
/* length is 200m(OM3) or 250m(OM4) */
if ((idprom[143] != 100) && (idprom[146] != 125)) {
return 0;
}
return 1;
}
static inline int
_sff8436_bitrate(const uint8_t *idprom)
{

View File

@@ -72,6 +72,7 @@
#define SFF8472_CONN_HSSDC_II 0x20
#define SFF8472_CONN_CU_PIGTAIL 0x21
#define SFF8472_CONN_RJ45 0x22
#define SFF8472_CONN_NOSEP 0x23
/* module compliance codes (SFP type) */
@@ -943,7 +944,7 @@ _sff8472_sfp_10g_aoc(const uint8_t *idprom)
static inline int
_sff8472_sfp_10g_aoc_length(const uint8_t *idprom)
{
/* module should be qsfp */
/* module should be sfp */
if (!SFF8472_MODULE_SFP(idprom)) return -1;
/* does not report a fiber length, but does report a cable length */
@@ -957,4 +958,19 @@ _sff8472_sfp_10g_aoc_length(const uint8_t *idprom)
return -1;
}
/*
* SFP28
*/
static inline int
_sff8472_media_sfp28_cr(const uint8_t* idprom)
{
/* module should be sfp */
if (!SFF8472_MODULE_SFP(idprom)) return 0;
if (idprom[2] != SFF8472_CONN_NOSEP) return 0;
if ((idprom[3] & SFF8472_CC3_INF_1X_CU_PASSIVE) == 0) return 0;
if (idprom[12] == 0xFF) return 1;
return 0;
}
#endif

View File

@@ -68,8 +68,9 @@ typedef enum sff_module_caps_e {
SFF_MODULE_CAPS_F_100 = 1,
SFF_MODULE_CAPS_F_1G = 2,
SFF_MODULE_CAPS_F_10G = 4,
SFF_MODULE_CAPS_F_40G = 8,
SFF_MODULE_CAPS_F_100G = 16,
SFF_MODULE_CAPS_F_25G = 8,
SFF_MODULE_CAPS_F_40G = 16,
SFF_MODULE_CAPS_F_100G = 32,
} sff_module_caps_t;
/** Enum names. */
@@ -107,6 +108,8 @@ typedef enum sff_module_type_e {
SFF_MODULE_TYPE_40G_BASE_ACTIVE,
SFF_MODULE_TYPE_40G_BASE_CR,
SFF_MODULE_TYPE_40G_BASE_SR2,
SFF_MODULE_TYPE_40G_BASE_SM4,
SFF_MODULE_TYPE_25G_BASE_CR,
SFF_MODULE_TYPE_10G_BASE_SR,
SFF_MODULE_TYPE_10G_BASE_LR,
SFF_MODULE_TYPE_10G_BASE_LRM,
@@ -142,6 +145,8 @@ typedef enum sff_module_type_e {
"40G_BASE_ACTIVE", \
"40G_BASE_CR", \
"40G_BASE_SR2", \
"40G_BASE_SM4", \
"25G_BASE_CR", \
"10G_BASE_SR", \
"10G_BASE_LR", \
"10G_BASE_LRM", \

View File

@@ -125,6 +125,11 @@ sff_module_type_get(const uint8_t* eeprom)
return SFF_MODULE_TYPE_40G_BASE_LM4;
}
if (SFF8436_MODULE_QSFP_PLUS_V2(eeprom)
&& _sff8436_qsfp_40g_sm4(eeprom)) {
return SFF_MODULE_TYPE_40G_BASE_SM4;
}
if (SFF8472_MODULE_SFP(eeprom)
&& SFF8472_MEDIA_XGE_SR(eeprom)
&& !_sff8472_media_gbe_sx_fc_hack(eeprom))
@@ -165,6 +170,11 @@ sff_module_type_get(const uint8_t* eeprom)
return SFF_MODULE_TYPE_10G_BASE_CR;
}
if (SFF8472_MODULE_SFP(eeprom)
&& _sff8472_media_sfp28_cr(eeprom)) {
return SFF_MODULE_TYPE_25G_BASE_CR;
}
if (SFF8472_MODULE_SFP(eeprom)
&& SFF8472_MEDIA_GBE_SX(eeprom))
return SFF_MODULE_TYPE_1G_BASE_SX;
@@ -214,6 +224,7 @@ sff_media_type_get(sff_module_type_t mt)
case SFF_MODULE_TYPE_100G_BASE_CR4:
case SFF_MODULE_TYPE_40G_BASE_CR4:
case SFF_MODULE_TYPE_40G_BASE_CR:
case SFF_MODULE_TYPE_25G_BASE_CR:
case SFF_MODULE_TYPE_10G_BASE_CR:
case SFF_MODULE_TYPE_1G_BASE_CX:
case SFF_MODULE_TYPE_1G_BASE_T:
@@ -228,6 +239,7 @@ sff_media_type_get(sff_module_type_t mt)
case SFF_MODULE_TYPE_40G_BASE_LM4:
case SFF_MODULE_TYPE_40G_BASE_ACTIVE:
case SFF_MODULE_TYPE_40G_BASE_SR2:
case SFF_MODULE_TYPE_40G_BASE_SM4:
case SFF_MODULE_TYPE_10G_BASE_SR:
case SFF_MODULE_TYPE_10G_BASE_LR:
case SFF_MODULE_TYPE_10G_BASE_LRM:
@@ -275,9 +287,14 @@ sff_module_caps_get(sff_module_type_t mt, uint32_t *caps)
case SFF_MODULE_TYPE_40G_BASE_ACTIVE:
case SFF_MODULE_TYPE_40G_BASE_CR:
case SFF_MODULE_TYPE_40G_BASE_SR2:
case SFF_MODULE_TYPE_40G_BASE_SM4:
*caps |= SFF_MODULE_CAPS_F_40G;
return 0;
case SFF_MODULE_TYPE_25G_BASE_CR:
*caps |= SFF_MODULE_CAPS_F_25G;
return 0;
case SFF_MODULE_TYPE_10G_BASE_SR:
case SFF_MODULE_TYPE_10G_BASE_LR:
case SFF_MODULE_TYPE_10G_BASE_LRM:

View File

@@ -66,6 +66,7 @@ aim_map_si_t sff_module_caps_map[] =
{ "F_100", SFF_MODULE_CAPS_F_100 },
{ "F_1G", SFF_MODULE_CAPS_F_1G },
{ "F_10G", SFF_MODULE_CAPS_F_10G },
{ "F_25G", SFF_MODULE_CAPS_F_25G },
{ "F_40G", SFF_MODULE_CAPS_F_40G },
{ "F_100G", SFF_MODULE_CAPS_F_100G },
{ NULL, 0 }
@@ -76,6 +77,7 @@ aim_map_si_t sff_module_caps_desc_map[] =
{ "None", SFF_MODULE_CAPS_F_100 },
{ "None", SFF_MODULE_CAPS_F_1G },
{ "None", SFF_MODULE_CAPS_F_10G },
{ "None", SFF_MODULE_CAPS_F_25G },
{ "None", SFF_MODULE_CAPS_F_40G },
{ "None", SFF_MODULE_CAPS_F_100G },
{ NULL, 0 }
@@ -141,6 +143,8 @@ aim_map_si_t sff_module_type_map[] =
{ "40G_BASE_ACTIVE", SFF_MODULE_TYPE_40G_BASE_ACTIVE },
{ "40G_BASE_CR", SFF_MODULE_TYPE_40G_BASE_CR },
{ "40G_BASE_SR2", SFF_MODULE_TYPE_40G_BASE_SR2 },
{ "40G_BASE_SM4", SFF_MODULE_TYPE_40G_BASE_SM4 },
{ "25G_BASE_CR", SFF_MODULE_TYPE_25G_BASE_CR },
{ "10G_BASE_SR", SFF_MODULE_TYPE_10G_BASE_SR },
{ "10G_BASE_LR", SFF_MODULE_TYPE_10G_BASE_LR },
{ "10G_BASE_LRM", SFF_MODULE_TYPE_10G_BASE_LRM },
@@ -173,6 +177,8 @@ aim_map_si_t sff_module_type_desc_map[] =
{ "40GBASE-ACTIVE", SFF_MODULE_TYPE_40G_BASE_ACTIVE },
{ "40GBASE-CR", SFF_MODULE_TYPE_40G_BASE_CR },
{ "40GBASE-SR2", SFF_MODULE_TYPE_40G_BASE_SR2 },
{ "40GBASE-SM4", SFF_MODULE_TYPE_40G_BASE_SM4 },
{ "25GBASE-CR", SFF_MODULE_TYPE_25G_BASE_CR },
{ "10GBASE-SR", SFF_MODULE_TYPE_10G_BASE_SR },
{ "10GBASE-LR", SFF_MODULE_TYPE_10G_BASE_LR },
{ "10GBASE-LRM", SFF_MODULE_TYPE_10G_BASE_LRM },

View File

@@ -3,12 +3,12 @@
#
# Inclusive Makefile for the sff module.
#
# Autogenerated 2016-05-17 17:43:05.843123
# Autogenerated 2017-01-31 00:32:39.650740
#
###############################################################################
sff_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include $(sff_BASEDIR)module/make.mk
include $(sff_BASEDIR)module/auto/make.mk
include $(sff_BASEDIR)module/src/make.mk
include $(sff_BASEDIR)module/auto/make.mk
include $(sff_BASEDIR)utest/_make.mk

View File

@@ -1,23 +1,21 @@
############################################################
#
# PKG template for all platform-config packages.
# PKG template for a vendor's common modules
#
############################################################
prerequisites:
packages: [ "onl-vendor-config-${VENDOR}:all", "$MODULES" ]
packages: [ $KERNELS ]
packages:
- name: onl-platform-config-${PLATFORM}
depends: onl-vendor-config-${VENDOR},$MODULES
- name: onl-vendor-${VENDOR}-modules
version: 1.0.0
arch: $ARCH
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
summary: ONL Platform Configuration Package for the ${PLATFORM}
summary: ONL Vendor Modules Package for ${vendor}
files:
src/lib: /lib/platform-config/${PLATFORM}/onl
src/python : ${PY_INSTALL}/onl/platform/
builds/lib: /lib
changelog: Changes

View File

@@ -0,0 +1,15 @@
############################################################
#
# PKG template for a vendor's common modules
#
############################################################
packages:
- name: onl-vendor-${VENDOR}-modules
version: 1.0.0
arch: $ARCH
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
summary: ONL Vendor Modules Package for ${vendor}
changelog: Changes

View File

@@ -0,0 +1,20 @@
############################################################
#
# PKG template for all platform module packages
#
############################################################
prerequisites:
packages:
- onl-vendor-${VENDOR}-modules:$ARCH
packages:
- name: onl-platform-modules-$BASENAME
version: 1.0.0
arch: $ARCH
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
summary: ONL Platform Modules Package for the $BASENAME
depends: onl-vendor-${VENDOR}-modules
changelog: Changes

View File

@@ -3,21 +3,26 @@
# PKG template for all platform-config packages.
#
############################################################
variables:
PLATFORM : $BASENAME-$REVISION
prerequisites:
packages: [ "onl-vendor-config-${VENDOR}:all" ]
packages:
- "onl-vendor-config-$VENDOR:all"
- "onl-platform-modules-$BASENAME:$ARCH"
packages:
- name: onl-platform-config-${PLATFORM}
depends: onl-vendor-config-${VENDOR}
- name: onl-platform-config-$PLATFORM
depends: onl-vendor-config-$VENDOR,onl-platform-modules-$BASENAME
version: 1.0.0
arch: $ARCH
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
summary: ONL Platform Configuration Package for the ${PLATFORM}
summary: ONL Platform Configuration Package for the $PLATFORM
files:
src/lib: /lib/platform-config/${PLATFORM}/onl
src/lib: /lib/platform-config/$PLATFORM/onl
src/python : ${PY_INSTALL}/onl/platform/
changelog: Changes

View File

@@ -4,16 +4,19 @@
#
############################################################
prerequisites:
packages: [ $KERNELS ]
packages:
- $KERNELS
- onl-vendor-${VENDOR}-modules:$ARCH
packages:
- name: onl-platform-modules-${PLATFORM}
- name: onl-platform-modules-${BASENAME}
version: 1.0.0
arch: $ARCH
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
summary: ONL Platform Modules Package for the ${PLATFORM}
summary: ONL Platform Modules Package for the ${BASENAME}
depends: onl-vendor-${VENDOR}-modules
files:
builds/lib: /lib

View File

@@ -0,0 +1 @@
This package is no longer in use. It will be fully removed.

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=armel VENDOR=accton BASENAME=arm-accton-as4610-30

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=armel VENDOR=accton PLATFORM=arm-accton-as4610-30-r0
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=armel VENDOR=accton BASENAME=arm-accton-as4610-30 REVISION=r0

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=armel VENDOR=accton BASENAME=arm-accton-as4610-54

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=armel VENDOR=accton PLATFORM=arm-accton-as4610-54-r0
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=armel VENDOR=accton BASENAME=arm-accton-as4610-54 REVISION=r0

View File

@@ -41,6 +41,7 @@ enum onlp_fan_id
{
FAN_RESERVED = 0,
FAN_1_ON_MAIN_BOARD,
FAN_2_ON_MAIN_BOARD,
FAN_1_ON_PSU1,
FAN_1_ON_PSU2
};
@@ -64,6 +65,7 @@ typedef struct fan_path_S
static fan_path_T fan_path[] = /* must map with onlp_fan_id */
{
{ }, /* Not used */
MAKE_FAN_PATH_ON_MAIN_BOARD(1),
MAKE_FAN_PATH_ON_MAIN_BOARD(2),
MAKE_FAN_PATH_ON_PSU(8-0058),
MAKE_FAN_PATH_ON_PSU(8-0059)
@@ -93,6 +95,7 @@ static fan_path_T fan_path[] = /* must map with onlp_fan_id */
onlp_fan_info_t linfo[] = {
{ }, /* Not used */
MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(1),
MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(2),
MAKE_FAN_INFO_NODE_ON_PSU(1,1),
MAKE_FAN_INFO_NODE_ON_PSU(2,1),
};
@@ -222,6 +225,7 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
rc = _onlp_fani_info_get_fan_on_psu(local_id, info);
break;
case FAN_1_ON_MAIN_BOARD:
case FAN_2_ON_MAIN_BOARD:
rc =_onlp_fani_info_get_fan(local_id, info);
break;
default:
@@ -282,6 +286,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].ctrl_speed);
break;
case FAN_1_ON_MAIN_BOARD:
case FAN_2_ON_MAIN_BOARD:
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].ctrl_speed);
break;
default:

View File

@@ -76,10 +76,11 @@ typedef enum onlp_led_id
LED_STK1,
LED_STK2,
LED_FAN,
LED_POE
LED_POE,
LED_ALARM
} onlp_led_id_t;
static char onlp_led_node_subname[][20] = /* must map with onlp_led_id */
static char* onlp_led_node_subname[] = /* must map with onlp_led_id */
{
"reserved",
"7seg_tens",
@@ -93,7 +94,8 @@ static char onlp_led_node_subname[][20] = /* must map with onlp_led_id */
"stk1",
"stk2",
"fan",
"poe"
"poe",
"alarm"
};
/*
@@ -162,6 +164,12 @@ static onlp_led_info_t linfo[] =
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN_BLINKING |
ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING,
},
{
{ ONLP_LED_ID_CREATE(LED_ALARM), "alarm", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN_BLINKING |
ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING,
},
};
static int conver_led_light_mode_to_onl(uint32_t id, int led_ligth_mode)
@@ -172,6 +180,7 @@ static int conver_led_light_mode_to_onl(uint32_t id, int led_ligth_mode)
case LED_STK1:
case LED_STK2:
case LED_POE:
case LED_ALARM:
case LED_7SEG_DP1:
case LED_7SEG_DP2:
switch (led_ligth_mode) {
@@ -203,6 +212,7 @@ static int conver_onlp_led_light_mode_to_driver(uint32_t id, int led_ligth_mode)
case LED_STK1:
case LED_STK2:
case LED_POE:
case LED_ALARM:
case LED_7SEG_DP1:
case LED_7SEG_DP2:
switch (led_ligth_mode) {
@@ -304,24 +314,48 @@ int onlp_ledi_char_get(onlp_oid_t id, char* c)
return ONLP_STATUS_OK;
}
static int
onlp_ledi_oid_to_internal_id(onlp_oid_t id)
{
enum as4610_product_id pid = get_product_id();
int lid = ONLP_OID_ID_GET(id);
if (pid != PID_AS4610T_B) {
return lid;
}
switch (lid) {
case 1: return LED_SYS;
case 2: return LED_PRI;
case 3: return LED_PSU1;
case 4: return LED_PSU2;
case 5: return LED_STK1;
case 6: return LED_STK2;
case 7: return LED_FAN;
case 8: return LED_ALARM;
}
return lid;
}
int
onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
{
int fd, len, nbytes=1;
char data[2] = {0};
char fullpath[50] = {0};
int lid = ONLP_OID_ID_GET(id);
int lid = onlp_ledi_oid_to_internal_id(id);
VALIDATE(id);
/* Set the onlp_oid_hdr_t and capabilities */
*info = linfo[ONLP_OID_ID_GET(id)];
*info = linfo[lid];
if (linfo[lid].caps & ONLP_LED_CAPS_CHAR) {
return onlp_ledi_char_get(id, &info->character);
}
else {
sprintf(fullpath, "%s%s/%s", led_prefix_path, onlp_led_node_subname[ONLP_OID_ID_GET(id)], led_filename);
sprintf(fullpath, "%s%s/%s", led_prefix_path, onlp_led_node_subname[lid], led_filename);
/* Set current mode */
if ((fd = open(fullpath, O_RDONLY)) == -1) {
@@ -338,7 +372,7 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
return ONLP_STATUS_E_INTERNAL;
}
info->mode = conver_led_light_mode_to_onl(ONLP_OID_ID_GET(id),atoi(data));
info->mode = conver_led_light_mode_to_onl(lid, atoi(data));
/* Set the on/off status */
if (info->mode != ONLP_LED_MODE_OFF) {
@@ -382,7 +416,7 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
int fd, len, driver_mode, nbytes=1;
char data[2] = {0};
char fullpath[50] = {0};
int lid = ONLP_OID_ID_GET(id);
int lid = onlp_ledi_oid_to_internal_id(id);
VALIDATE(id);
@@ -390,9 +424,9 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
return ONLP_STATUS_E_UNSUPPORTED;
}
sprintf(fullpath, "%s%s/%s", led_prefix_path, onlp_led_node_subname[ONLP_OID_ID_GET(id)], led_filename);
sprintf(fullpath, "%s%s/%s", led_prefix_path, onlp_led_node_subname[lid], led_filename);
driver_mode = conver_onlp_led_light_mode_to_driver(ONLP_OID_ID_GET(id),mode);
driver_mode = conver_onlp_led_light_mode_to_driver(lid, mode);
sprintf(data, "%d", driver_mode);
/* Create output file descriptor */

View File

@@ -150,7 +150,7 @@ enum as4610_product_id get_product_id(void)
}
pid = atoi(buf);
if (pid >= PID_UNKNOWN || pid < PID_AS4610_30T) {
if (pid >= PID_UNKNOWN || pid < PID_AS4610_30T || pid == PID_RESERVED) {
return PID_UNKNOWN;
}
@@ -160,11 +160,21 @@ enum as4610_product_id get_product_id(void)
int chassis_fan_count(void)
{
enum as4610_product_id pid = get_product_id();
if (pid == PID_AS4610T_B) {
return 2;
}
return (pid == PID_AS4610_30P || pid == PID_AS4610P) ? 1 : 0;
}
int chassis_led_count(void)
{
enum as4610_product_id pid = get_product_id();
if (pid == PID_AS4610T_B) {
return 8;
}
return (pid == PID_AS4610_30P || pid == PID_AS4610P) ? 12 : 10;
}

View File

@@ -79,6 +79,8 @@ enum as4610_product_id {
PID_AS4610_30P,
PID_AS4610T,
PID_AS4610P,
PID_RESERVED,
PID_AS4610T_B,
PID_UNKNOWN
};

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/no-arch-vendor-modules.yml ARCH=armel VENDOR=accton

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/no-arch-vendor-modules.yml ARCH=powerpc VENDOR=accton

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as4600-54t

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as4600-54t-r0
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as4600-54t REVISION=r0

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as5610-52x

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as5610-52x-r0
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as5610-52x REVISION=r0

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as5710-54x

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as5710-54x-r0
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as5710-54x REVISION=r0

View File

@@ -1 +1 @@
!include $ONL/packages/base/any/templates/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as5710-54x-r0b
!include $ONL/packages/base/any/templates/platform-config-platform.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as5710-54x REVISION=r0b

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as6700-32x

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as6700-32x-r0
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as6700-32x REVISION=r0

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as6700-32x-r1
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton BASENAME=powerpc-accton-as6700-32x REVISION=r1

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/arch-vendor-modules.yml ARCH=amd64 VENDOR=accton KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"

View File

@@ -0,0 +1 @@
lib

View File

@@ -0,0 +1,6 @@
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
VENDOR := accton
BASENAME := common
ARCH := x86_64
include $(ONL)/make/kmodule.mk

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-modules.yml PLATFORM=x86-64-accton-as5512-54x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as5512-54x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"

View File

@@ -1,5 +1,6 @@
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64 onl-kernel-3.2-deb7-x86-64-all:amd64
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
PLATFORM := x86-64-accton-as5512-54x
VENDOR := accton
BASENAME := x86-64-accton-as5512-54x
ARCH := x86_64
include $(ONL)/make/kmodule.mk

View File

@@ -29,10 +29,6 @@
#include <onlp/platformi/thermali.h>
#include <fcntl.h>
#define prefix_path "/sys/bus/i2c/devices/"
#define filename "temp1_input"
#define LOCAL_DEBUG 0
#define VALIDATE(_id) \
do { \
if(!ONLP_OID_IS_THERMAL(_id)) { \
@@ -41,20 +37,6 @@
} while(0)
#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \
if (LOCAL_DEBUG) \
printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \
if ((fd = open(fullpath, O_RDONLY)) == -1) \
return ONLP_STATUS_E_INTERNAL; \
if ((len = read(fd, r_data, nbytes)) <= 0){ \
close(fd); \
return ONLP_STATUS_E_INTERNAL;} \
if (LOCAL_DEBUG) \
printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \
if (close(fd) == -1) \
return ONLP_STATUS_E_INTERNAL
enum onlp_thermal_id
{
THERMAL_RESERVED = 0,
@@ -66,23 +48,23 @@ enum onlp_thermal_id
THERMAL_1_ON_PSU2,
};
static char* last_path[] = /* must map with onlp_thermal_id */
static char* devfiles__[] = /* must map with onlp_thermal_id */
{
"reserved",
NULL, /* CPU_CORE files */
"63-0048/",
"64-0049/",
"65-004a/",
"59-003c/psu_",
"60-003f/psu_",
"/sys/bus/i2c/devices/63-0048*temp1_input",
"/sys/bus/i2c/devices/64-0049*temp1_input",
"/sys/bus/i2c/devices/65-004a*temp1_input",
"/sys/bus/i2c/devices/59-003c*psu_temp1_input",
"/sys/bus/i2c/devices/60-003f*psu_temp1_input",
};
static char* cpu_coretemp_files[] =
{
"/sys/devices/platform/coretemp.0/temp2_input",
"/sys/devices/platform/coretemp.0/temp3_input",
"/sys/devices/platform/coretemp.0/temp4_input",
"/sys/devices/platform/coretemp.0/temp5_input",
"/sys/devices/platform/coretemp.0*temp2_input",
"/sys/devices/platform/coretemp.0*temp3_input",
"/sys/devices/platform/coretemp.0*temp4_input",
"/sys/devices/platform/coretemp.0*temp5_input",
NULL,
};
@@ -141,16 +123,11 @@ onlp_thermali_init(void)
int
onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
{
int fd, len, nbytes = 10, temp_base=1, local_id;
char r_data[10] = {0};
char fullpath[50] = {0};
int local_id;
VALIDATE(id);
local_id = ONLP_OID_ID_GET(id);
if (LOCAL_DEBUG)
printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id);
/* Set the onlp_oid_hdr_t and capabilities */
*info = linfo[local_id];
@@ -158,18 +135,5 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
int rv = onlp_file_read_int_max(&info->mcelsius, cpu_coretemp_files);
return rv;
}
/* get fullpath */
sprintf(fullpath, "%s%s%s", prefix_path, last_path[local_id], filename);
OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
info->mcelsius = atoi(r_data)/temp_base;
if (LOCAL_DEBUG)
printf("\n[Debug][%s][%d][save data: %d]\n", __FUNCTION__, __LINE__, info->mcelsius);
return ONLP_STATUS_OK;
return onlp_file_read_int(&info->mcelsius, devfiles__[local_id]);
}

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-with-modules.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as5512-54x-r0 MODULES=onl-platform-modules-x86-64-accton-as5512-54x:amd64
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton BASENAME=x86-64-accton-as5512-54x REVISION=r0

View File

@@ -18,7 +18,7 @@ x86-64-accton-as5512-54x-r0:
--stop=1
kernel:
<<: *kernel-3-2
<<: *kernel-3-16
args: >-
nopat

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-modules.yml PLATFORM=x86-64-accton-as5712-54x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as5712-54x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"

View File

@@ -1,5 +1,6 @@
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64 onl-kernel-3.2-deb7-x86-64-all:amd64
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
PLATFORM := x86-64-accton-as5712-54x
VENDOR := accton
BASENAME := x86-64-accton-as5712-54x
ARCH := x86_64
include $(ONL)/make/kmodule.mk

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-with-modules.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as5712-54x-r0 MODULES=onl-platform-modules-x86-64-accton-as5712-54x:amd64
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton BASENAME=x86-64-accton-as5712-54x REVISION=r0

View File

@@ -18,7 +18,7 @@ x86-64-accton-as5712-54x-r0:
--stop=1
kernel:
<<: *kernel-3-2
<<: *kernel-3-16
args: >-
nopat

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-modules.yml PLATFORM=x86-64-accton-as5812-54t ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as5812-54t ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"

View File

@@ -1,5 +1,6 @@
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64 onl-kernel-3.2-deb7-x86-64-all:amd64
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
PLATFORM := x86-64-accton-as5812-54t
VENDOR := accton
BASENAME := x86-64-accton-as5812-54t
ARCH := x86_64
include $(ONL)/make/kmodule.mk

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-with-modules.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as5812-54t-r0 MODULES=onl-platform-modules-x86-64-accton-as5812-54t:amd64
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton BASENAME=x86-64-accton-as5812-54t REVISION=r0

View File

@@ -18,7 +18,7 @@ x86-64-accton-as5812-54t-r0:
--stop=1
kernel:
<<: *kernel-3-2
<<: *kernel-3-16
args: >-
nopat

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-modules.yml PLATFORM=x86-64-accton-as5812-54x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as5812-54x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"

View File

@@ -1,5 +1,6 @@
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64 onl-kernel-3.2-deb7-x86-64-all:amd64
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
PLATFORM := x86-64-accton-as5812-54x
VENDOR := accton
BASENAME := x86-64-accton-as5812-54x
ARCH := x86_64
include $(ONL)/make/kmodule.mk

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-with-modules.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as5812-54x-r0 MODULES=onl-platform-modules-x86-64-accton-as5812-54x:amd64
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton BASENAME=x86-64-accton-as5812-54x REVISION=r0

View File

@@ -18,7 +18,7 @@ x86-64-accton-as5812-54x-r0:
--stop=1
kernel:
<<: *kernel-3-2
<<: *kernel-3-16
args: >-
nopat

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-modules.yml PLATFORM=x86-64-accton-as6712-32x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as6712-32x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"

View File

@@ -1,5 +1,6 @@
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64 onl-kernel-3.2-deb7-x86-64-all:amd64
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
PLATFORM := x86-64-accton-as6712-32x
VENDOR := accton
BASENAME := x86-64-accton-as6712-32x
ARCH := x86_64
include $(ONL)/make/kmodule.mk

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-with-modules.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as6712-32x-r0 MODULES=onl-platform-modules-x86-64-accton-as6712-32x:amd64
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton BASENAME=x86-64-accton-as6712-32x REVISION=r0

View File

@@ -18,7 +18,7 @@ x86-64-accton-as6712-32x-r0:
--stop=1
kernel:
<<: *kernel-3-2
<<: *kernel-3-16
args: >-
nopat

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-modules.yml PLATFORM=x86-64-accton-as6812-32x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as6812-32x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"

View File

@@ -1,5 +1,6 @@
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64 onl-kernel-3.2-deb7-x86-64-all:amd64
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
PLATFORM := x86-64-accton-as6812-32x
VENDOR := accton
BASENAME := x86-64-accton-as6812-32x
ARCH := x86_64
include $(ONL)/make/kmodule.mk

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-with-modules.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as6812-32x-r0 MODULES=onl-platform-modules-x86-64-accton-as6812-32x:amd64
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton BASENAME=x86-64-accton-as6812-32x REVISION=r0

View File

@@ -18,7 +18,7 @@ x86-64-accton-as6812-32x-r0:
--stop=1
kernel:
<<: *kernel-3-2
<<: *kernel-3-16
args: >-
nopat

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-modules.yml PLATFORM=x86-64-accton-as7512-32x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as7512-32x ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"

View File

@@ -1,5 +1,6 @@
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64 onl-kernel-3.2-deb7-x86-64-all:amd64
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
PLATFORM := x86-64-accton-as7512-32x
VENDOR := accton
BASENAME := x86-64-accton-as7512-32x
ARCH := x86_64
include $(ONL)/make/kmodule.mk

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-config-with-modules.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as7512-32x-r0 MODULES=onl-platform-modules-x86-64-accton-as7512-32x:amd64
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton BASENAME=x86-64-accton-as7512-32x REVISION=r0

Some files were not shown because too many files have changed in this diff Show More