Merge pull request #1 from opencomputeproject/master

rebase
This commit is contained in:
Jerry Chen
2017-02-16 19:53:31 -08:00
committed by GitHub
168 changed files with 16443 additions and 819 deletions

26
make/dtbs.mk Normal file
View File

@@ -0,0 +1,26 @@
############################################################
#
# Common DTB build rules.
#
############################################################
include $(ONL)/make/config.mk
ifndef DTS_LIST
DTS_LIST := $(wildcard *.dts)
endif
ifndef DTB_LIST
DTB_LIST := $(patsubst %.dts,%.dtb,$(DTS_LIST))
endif
%.dtb: %.dts
$(ONL)/tools/dtc -I dts -O dtb -o $@ $<
.DEFAULT_GOAL := $(DTB_LIST)
$(DTB_LIST): setup
clean::
rm -rf *.dtb
setup::

View File

@@ -164,16 +164,23 @@ 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 drivers
MODSYNCLIST_DEFAULT := .config Module.symvers Makefile include scripts drivers \
arch/x86/include arch/x86/Makefile \
arch/powerpc/include arch/powerpc/Makefile arch/powerpc/lib arch/powerpc/boot/dts \
arch/arm/include arch/arm/Makefile arch/arm/lib arch/arm/boot/dts
MODSYNCLIST := $(MODSYNCLIST_DEFAULT) $(MODSYNCLIST_EXTRA)
# This file must be preserved for PPC module builds.
MODSYNCKEEP := arch/powerpc/lib/crtsavres.o
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
$(foreach f,$(MODSYNCKEEP), cp $(K_SOURCE_DIR)/$(f) $(K_MBUILD_DIR)/$(f) || true;)
dtbs: mbuild
ifdef DTS_LIST

View File

@@ -483,6 +483,10 @@ class OnlPlatformPortConfig_48x10_6x40(object):
PORT_COUNT=54
PORT_CONFIG="48x10 + 6x40"
class OnlPlatformPortConfig_48x25_6x100(object):
PORT_COUNT=54
PORT_CONFIG="48x25 + 6x100"
class OnlPlatformPortConfig_32x40(object):
PORT_COUNT=32
PORT_CONFIG="32x40"

View File

@@ -1,22 +0,0 @@
common:
arch: amd64
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
packages:
- name: onl-kernel-3.18-x86-64-all
version: 1.0.0
summary: Open Network Linux Kernel 3.18 for X86_64 Platforms.
files:
builds/kernel-3.18-x86_64-all : $$PKG_INSTALL/
builds/linux-3.18.25-mbuild : $$PKG_INSTALL/mbuilds
changelog: Change changes changes.,

View File

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

View File

@@ -1,2 +0,0 @@
linux-3.18*
kernel-3.18-x86_64-all

View File

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

View File

@@ -1,3 +0,0 @@
linux-3.2.65-1+deb7u2*
kernel-3.2-deb7-x86_64-all
lib

View File

@@ -1,19 +0,0 @@
# -*- Makefile -*-
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################
THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(ONL)/make/config.mk
kernel:
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) $(ONL_MAKE_PARALLEL)
ARCH=x86_64 $(ONL)/tools/scripts/kmodbuild.sh linux-3.2.65-1+deb7u2-mbuild "$(wildcard $(ONL)/packages/base/any/kernels/modules/*)" onl
clean:
rm -rf linux-3.2.65-1+deb7u2 linux-3.2.65-1+deb7u2-mbuild

View File

@@ -1,25 +0,0 @@
prerequisites:
submodules:
- { root : $ONL, path : packages/base/any/kernels/legacy/linux-3.9.6 }
common:
arch: amd64
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
packages:
- name: onl-kernel-3.9.6-x86-64-all
version: 1.0.0
summary: Open Network Linux Legacy 3.9.6 Kernel for X86_64 platforms.
files:
builds/kernel-x86_64 : $$PKG_INSTALL/kernel-3.9.6-x86-64-all
builds/linux-x86_64-headers : $$PKG_INSTALL/mbuilds
changelog: Change changes changes.,

View File

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

View File

@@ -1,3 +0,0 @@
kernel-x86_64
linux-x86_64-headers
linux-build-x86_64

View File

@@ -1,35 +0,0 @@
# -*- Makefile -*-
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################
THISDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(ONL)/make/config.amd64.mk
all: kernel-x86_64 linux-x86_64-headers
LINUX := $(ONL)/packages/base/any/kernels/legacy/linux-3.9.6
ARCH := x86_64
kernel-x86_64: $(LINUX)/arch/x86/configs/onl_x86_64_defconfig
mkdir -p $(THISDIR)/linux-build-x86_64
$(MAKE) -C $(LINUX) onl_x86_64_defconfig O=$(THISDIR)/linux-build-x86_64
$(MAKE) -C $(LINUX) bzImage O=$(THISDIR)/linux-build-x86_64
cp $(THISDIR)/linux-build-x86_64/arch/x86/boot/bzImage $(THISDIR)/kernel-x86_64
.PHONY: linux-x86_64-headers deb
linux-x86_64-headers: $(LINUX)/arch/x86/configs/onl_x86_64_defconfig
mkdir -p $(THISDIR)/linux-x86_64-headers
cp -a $(LINUX)/include $(LINUX)/arch/x86/include $(THISDIR)/linux-x86_64-headers
$(MAKE) -C $(LINUX) ARCH=x86 O=$(THISDIR)/linux-x86_64-headers onl_x86_64_defconfig
$(MAKE) -C $(LINUX) ARCH=x86 O=$(THISDIR)/linux-x86_64-headers headers_install modules_prepare
deb:
$(MAKE) -C deb

View File

@@ -0,0 +1,3 @@
kernel-3.16*
linux-*

View File

@@ -0,0 +1,39 @@
############################################################
# <bsn.cl fy=2015 v=onl>
#
# Copyright 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(ONL)/make/config.mk
ifndef K_TARGET_DIR
K_TARGET_DIR := $(THIS_DIR)
endif
include ../../kconfig.mk
K_CONFIG := powerpc-e500v-all.config
K_BUILD_TARGET := uImage
K_COPY_SRC := vmlinux.bin.gz
ifndef K_COPY_DST
K_COPY_DST := kernel-3.16-lts-powerpc-e500v-all.bin.gz
endif
export ARCH=powerpc
include $(ONL)/make/kbuild.mk

View File

@@ -0,0 +1,41 @@
Changes to arch/powerpc/platforms/85xx/Makefile and Kconfig.
Keep these separate from the individual platform patches because all
platforms need to touch these two files. By keeping these changes in
a separate patch allows the platform specific patchsets to sink/float
without conflicts in these two files.
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index b9a2559..2c1aa86 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -278,6 +278,19 @@ config CORENET_GENERIC
The following boards are supported for both 32bit and 64bit kernel:
P5020 DS, P5040 DS and T104xQDS
+config QUANTA_LB
+ bool "Quanta LBx"
+ select DEFAULT_UIMAGE
+ select HAS_RAPIDIO
+ help
+ This option enables support for the Quanta LBx board
+
+config DELTA_7448
+ bool "Delta ET-7448BF"
+ select DEFAULT_UIMAGE
+ help
+ This option enables support for the Delta ET-7448BF board
+
endif # FSL_SOC_BOOKE
config TQM85xx
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index bc5acb9..d04e66c 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -30,3 +30,5 @@ obj-$(CONFIG_XES_MPC85xx) += xes_mpc85xx.o
obj-$(CONFIG_GE_IMP3A) += ge_imp3a.o
obj-$(CONFIG_PPC_QEMU_E500) += qemu_e500.o
obj-$(CONFIG_SGY_CTS1000) += sgy_cts1000.o
+obj-$(CONFIG_DELTA_7448) += delta_7448.o
+obj-$(CONFIG_QUANTA_LB) += quanta_lb.o

View File

@@ -0,0 +1,83 @@
diff --git a/arch/powerpc/platforms/85xx/delta_7448.c b/arch/powerpc/platforms/85xx/delta_7448.c
new file mode 100644
index 0000000..4618bef
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/delta_7448.c
@@ -0,0 +1,77 @@
+/*
+ * Delta ET-7448BF platform setup
+ *
+ * Copyright 2013 Big Switch Networks, Inc.
+ *
+ * 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.
+ */
+
+#include <linux/pci.h>
+#include <asm/udbg.h>
+#include <asm/mpic.h>
+#include <sysdev/fsl_soc.h>
+#include <sysdev/fsl_pci.h>
+
+#include "mpc85xx.h"
+#include "smp.h"
+
+static void delta_7448_restart(char *cmd)
+{
+ struct device_node *cpld;
+
+ cpld = of_find_compatible_node(NULL, NULL, "delta-7448-cpld");
+ if (cpld) {
+ uint8_t __iomem *cpld_regs = of_iomap(cpld, 0);
+ of_node_put(cpld);
+ if (cpld_regs) {
+ writeb(0, cpld_regs + 0x20);
+ }
+ }
+
+ fsl_rstcr_restart(NULL);
+}
+
+static void __init delta_7448_pic_init(void)
+{
+ struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN, 0, 256,
+ " OpenPIC ");
+ BUG_ON(!mpic);
+ mpic_init(mpic);
+}
+
+static void __init delta_7448_setup_arch(void)
+{
+ if (ppc_md.progress)
+ ppc_md.progress("delta_7448_setup_arch()", 0);
+ fsl_pci_assign_primary();
+ mpc85xx_smp_init();
+}
+
+static void delta_7448_show_cpuinfo(struct seq_file *m)
+{
+ seq_printf(m, "PVR\t\t: 0x%lx\n", mfspr(SPRN_PVR));
+ seq_printf(m, "SVR\t\t: 0x%lx\n", mfspr(SPRN_SVR));
+ seq_printf(m, "PLL\t\t: 0x%lx\n", (mfspr(SPRN_HID1) >> 24) & 0x3f);
+}
+
+static int __init delta_7448_probe(void)
+{
+ return of_flat_dt_is_compatible(of_get_flat_dt_root(), "delta-7448");
+}
+
+machine_arch_initcall(delta_7448, mpc85xx_common_publish_devices);
+
+define_machine(delta_7448) {
+ .name = "Delta ET-7448BF",
+ .probe = delta_7448_probe,
+ .setup_arch = delta_7448_setup_arch,
+ .init_IRQ = delta_7448_pic_init,
+ .show_cpuinfo = delta_7448_show_cpuinfo,
+ .get_irq = mpic_get_irq,
+ .restart = delta_7448_restart,
+ .calibrate_decr = generic_calibrate_decr,
+ .progress = udbg_progress,
+};

View File

@@ -0,0 +1,287 @@
diff --git a/arch/powerpc/platforms/85xx/quanta_lb.c b/arch/powerpc/platforms/85xx/quanta_lb.c
new file mode 100644
index 0000000..9660990
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/quanta_lb.c
@@ -0,0 +1,70 @@
+/*
+ * Quanta LBx platform setup
+ *
+ * Copyright 2013 Big Switch Networks, Inc.
+ *
+ * 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.
+ */
+
+#include <linux/pci.h>
+#include <asm/udbg.h>
+#include <asm/mpic.h>
+#include <sysdev/fsl_soc.h>
+#include <sysdev/fsl_pci.h>
+
+#include "mpc85xx.h"
+
+static void quanta_lb_restart(char *cmd)
+{
+ void __iomem *immap = ioremap(get_immrbase(), 0x1000000);
+ if (immap) {
+ unsigned long pdata = in_be32(immap + 0x90d10);
+ pdata &= ~(1 << 7);
+ out_be32(immap + 0x90d10, pdata);
+ }
+ fsl_rstcr_restart(NULL);
+}
+
+static void __init quanta_lb_pic_init(void)
+{
+ struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN, 0, 256,
+ " OpenPIC ");
+ BUG_ON(!mpic);
+ mpic_init(mpic);
+}
+
+static void __init quanta_lb_setup_arch(void)
+{
+ if (ppc_md.progress)
+ ppc_md.progress("quanta_lb_setup_arch()", 0);
+ fsl_pci_assign_primary();
+}
+
+static void quanta_lb_show_cpuinfo(struct seq_file *m)
+{
+ seq_printf(m, "PVR\t\t: 0x%lx\n", mfspr(SPRN_PVR));
+ seq_printf(m, "SVR\t\t: 0x%lx\n", mfspr(SPRN_SVR));
+ seq_printf(m, "PLL\t\t: 0x%lx\n", (mfspr(SPRN_HID1) >> 24) & 0x3f);
+}
+
+static int __init quanta_lb_probe(void)
+{
+ return of_flat_dt_is_compatible(of_get_flat_dt_root(), "quanta-lb");
+}
+
+machine_arch_initcall(quanta_lb, mpc85xx_common_publish_devices);
+
+define_machine(quanta_lb) {
+ .name = "Quanta LBx",
+ .probe = quanta_lb_probe,
+ .setup_arch = quanta_lb_setup_arch,
+ .init_IRQ = quanta_lb_pic_init,
+ .show_cpuinfo = quanta_lb_show_cpuinfo,
+ .get_irq = mpic_get_irq,
+ .restart = quanta_lb_restart,
+ .calibrate_decr = generic_calibrate_decr,
+ .progress = udbg_progress,
+};
diff -rupN a/drivers/ata/Kconfig b/drivers/ata/Kconfig
--- a/drivers/ata/Kconfig 2014-12-14 08:24:02.000000000 -0800
+++ b/drivers/ata/Kconfig 2015-05-20 17:39:45.202136101 -0700
@@ -964,6 +964,13 @@ config PATA_WINBOND_VLB
Support for the Winbond W83759A controller on Vesa Local Bus
systems.
+config PATA_QUANTA_LB
+ bool "Quanta LB platform ATA support"
+ depends on PATA_PLATFORM && OF
+ help
+ This driver adds support for IDE/ATA drives on the Quanta LB
+ platform.
+
comment "Generic fallback / legacy drivers"
config PATA_ACPI
diff -rupN a/drivers/ata/Makefile b/drivers/ata/Makefile
--- a/drivers/ata/Makefile 2014-12-14 08:24:02.000000000 -0800
+++ b/drivers/ata/Makefile 2015-05-20 17:39:13.602132473 -0700
@@ -100,6 +100,7 @@ obj-$(CONFIG_PATA_OF_PLATFORM) += pata_o
obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o
obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o
obj-$(CONFIG_PATA_SAMSUNG_CF) += pata_samsung_cf.o
+obj-$(CONFIG_PATA_QUANTA_LB) += pata_quanta_lb.o
obj-$(CONFIG_PATA_PXA) += pata_pxa.o
diff -rupN a/drivers/ata/pata_quanta_lb.c b/drivers/ata/pata_quanta_lb.c
--- a/drivers/ata/pata_quanta_lb.c 1969-12-31 16:00:00.000000000 -0800
+++ b/drivers/ata/pata_quanta_lb.c 2015-05-20 17:40:21.562121047 -0700
@@ -0,0 +1,178 @@
+/*
+ * <bsn.cl fy=2013 v=gpl>
+ *
+ * Copyright 2013, 2014 BigSwitch Networks, Inc.
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms ofthe GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ *
+ * </bsn.cl>
+ *
+ *
+ * Quanta LBx platform PATA driver
+ */
+#include <linux/module.h>
+#include <linux/libata.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+
+#define DRV_NAME "quanta-lb-ata"
+
+static unsigned int
+quanta_lb_ata_data_xfer(struct ata_device *dev, unsigned char *buf,
+ unsigned int buflen, int rw)
+{
+ unsigned long irq_flags;
+ void __iomem *data_addr = dev->link->ap->ioaddr.data_addr;
+ unsigned short *ptr = (unsigned short *) buf;
+ unsigned int count = (buflen + 1) / 2;
+
+ local_irq_save(irq_flags);
+
+ if (rw == READ) {
+ while (count--) {
+ *ptr++ = cpu_to_le16(__raw_readw(data_addr));
+ }
+ }
+ else {
+ while (count--) {
+ __raw_writew(le16_to_cpu(*ptr), data_addr);
+ ptr++;
+ }
+ }
+
+ local_irq_restore(irq_flags);
+
+ return buflen;
+}
+
+static int
+quanta_lb_ata_set_mode(struct ata_link *link, struct ata_device **unused)
+{
+ struct ata_device *dev;
+
+ ata_for_each_dev(dev, link, ENABLED) {
+ /* We don't really care */
+ dev->pio_mode = dev->xfer_mode = XFER_PIO_0;
+ dev->xfer_shift = ATA_SHIFT_PIO;
+ dev->flags |= ATA_DFLAG_PIO;
+ ata_dev_info(dev, "configured for PIO\n");
+ }
+ return 0;
+}
+
+static struct scsi_host_template quanta_lb_ata_sht = {
+ ATA_PIO_SHT(DRV_NAME),
+};
+
+static struct ata_port_operations quanta_lb_ata_port_ops = {
+ .inherits = &ata_sff_port_ops,
+ .sff_data_xfer = quanta_lb_ata_data_xfer,
+ .cable_detect = ata_cable_unknown,
+ .set_mode = quanta_lb_ata_set_mode,
+};
+
+static int
+quanta_lb_ata_probe(struct platform_device *op)
+{
+ int rv;
+ struct resource io_res, ctl_res, *irq_res;
+ int irq = 0;
+ void __iomem *io_mem, *ctl_mem;
+ struct ata_host *host;
+ struct ata_port *ap;
+
+ rv = of_address_to_resource(op->dev.of_node, 0, &io_res);
+ if (rv) {
+ dev_err(&op->dev, "could not determine io base\n");
+ return rv;
+ }
+ io_mem = devm_ioremap(&op->dev, io_res.start, resource_size(&io_res));
+ if (!io_mem) {
+ dev_err(&op->dev, "could not map io base\n");
+ return -ENOMEM;
+ }
+
+ rv = of_address_to_resource(op->dev.of_node, 1, &ctl_res);
+ if (rv) {
+ dev_err(&op->dev, "could not determine ctl base\n");
+ return rv;
+ }
+ ctl_mem = devm_ioremap(&op->dev, ctl_res.start, resource_size(&ctl_res));
+ if (!ctl_mem) {
+ dev_err(&op->dev, "could not map ctl base\n");
+ return -ENOMEM;
+ }
+
+ irq_res = platform_get_resource(op, IORESOURCE_IRQ, 0);
+ if (irq_res)
+ irq = irq_res->start;
+
+ host = ata_host_alloc(&op->dev, 1);
+ if (!host)
+ return -ENOMEM;
+ ap = host->ports[0];
+
+ ap->ops = &quanta_lb_ata_port_ops;
+ ap->pio_mask = ATA_PIO6;
+ ap->flags |= ATA_FLAG_SLAVE_POSS;
+
+ if (!irq) {
+ ap->flags |= ATA_FLAG_PIO_POLLING;
+ ata_port_desc(ap, "no IRQ, using PIO polling");
+ }
+
+ ap->ioaddr.cmd_addr = io_mem;
+ ap->ioaddr.data_addr = io_mem + 0x02;
+ ap->ioaddr.error_addr = io_mem + 0x07;
+ ap->ioaddr.feature_addr = io_mem + 0x07;
+ ap->ioaddr.nsect_addr = io_mem + 0x0b;
+ ap->ioaddr.lbal_addr = io_mem + 0x0f;
+ ap->ioaddr.lbam_addr = io_mem + 0x13;
+ ap->ioaddr.lbah_addr = io_mem + 0x17;
+ ap->ioaddr.device_addr = io_mem + 0x1b;
+ ap->ioaddr.status_addr = io_mem + 0x1f;
+ ap->ioaddr.command_addr = io_mem + 0x1f;
+ ap->ioaddr.altstatus_addr = ctl_mem + 0x1b;
+ ap->ioaddr.ctl_addr = ctl_mem + 0x1b;
+
+ ata_port_desc(ap, "mmio cmd 0x%llx ctl 0x%llx",
+ (unsigned long long) io_res.start,
+ (unsigned long long) ctl_res.start);
+
+ return ata_host_activate(host, irq, irq ? ata_sff_interrupt : NULL,
+ 0, &quanta_lb_ata_sht);
+}
+
+static int __exit
+quanta_lb_ata_remove(struct platform_device *op)
+{
+ struct ata_host *host = dev_get_drvdata(&op->dev);
+ ata_host_detach(host);
+ return 0;
+}
+
+static struct of_device_id quanta_lb_ata_of_match[] = {
+ { .compatible = "quanta-lb-ata", },
+ {},
+};
+
+static struct platform_driver quanta_lb_ata_of_platform_driver = {
+ .probe = quanta_lb_ata_probe,
+ .remove = __exit_p(quanta_lb_ata_remove),
+ .driver = {
+ .name = DRV_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = quanta_lb_ata_of_match,
+ },
+};
+
+module_platform_driver(quanta_lb_ata_of_platform_driver);
+
+MODULE_AUTHOR("Big Switch Networks <support@bigswitch.com>");
+MODULE_DESCRIPTION("Quanta LBx platform PATA driver");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(of, quanta_lb_ata_of_match);

View File

@@ -21,3 +21,6 @@ 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
platform-powerpc-85xx-Makefile.patch
platform-powerpc-dni-7448-r0.patch
platform-powerpc-quanta-lb9-r0.patch

View File

@@ -36,7 +36,12 @@
/* Addresses scanned
*/
static const unsigned short normal_i2c[] = { 0x58, 0x5b, I2C_CLIENT_END };
static const unsigned short normal_i2c[] = { I2C_CLIENT_END };
enum chips {
YM2651,
YM2401,
};
/* Each client has this additional data
*/
@@ -45,6 +50,7 @@ struct ym2651y_data {
struct mutex update_lock;
char valid; /* !=0 if registers are valid */
unsigned long last_updated; /* In jiffies */
u8 chip; /* chip id */
u8 capability; /* Register value */
u16 status_word; /* Register value */
u8 fan_fault; /* Register value */
@@ -52,13 +58,14 @@ struct ym2651y_data {
u16 v_out; /* Register value */
u16 i_out; /* Register value */
u16 p_out; /* Register value */
u8 vout_mode; /* Register value */
u16 temp; /* Register value */
u16 fan_speed; /* Register value */
u16 fan_duty_cycle[2]; /* Register value */
u8 fan_dir[5]; /* Register value */
u8 pmbus_revision; /* Register value */
u8 mfr_id[10]; /* Register value */
u8 mfr_model[10]; /* Register value */
u8 mfr_model[16]; /* Register value */
u8 mfr_revsion[3]; /* Register value */
u16 mfr_vin_min; /* Register value */
u16 mfr_vin_max; /* Register value */
@@ -76,6 +83,7 @@ static ssize_t show_word(struct device *dev, struct device_attribute *da,
char *buf);
static ssize_t show_linear(struct device *dev, struct device_attribute *da,
char *buf);
static ssize_t show_vout(struct device *dev, struct device_attribute *da, char *buf);
static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da,
char *buf);
static ssize_t show_over_temp(struct device *dev, struct device_attribute *da,
@@ -121,7 +129,7 @@ static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, show_word, NULL, PSU_TEMP
static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_word, NULL, PSU_POWER_GOOD);
static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT);
static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, show_over_temp, NULL, PSU_OVER_TEMP);
static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_linear, NULL, PSU_V_OUT);
static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OUT);
static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT);
static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT);
static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT);
@@ -369,6 +377,37 @@ static ssize_t show_ascii(struct device *dev, struct device_attribute *da,
return sprintf(buf, "%s\n", ptr);
}
static ssize_t show_vout_by_mode(struct device *dev, struct device_attribute *da,
char *buf)
{
struct ym2651y_data *data = ym2651y_update_device(dev);
int exponent, mantissa;
int multiplier = 1000;
if (!data->valid) {
return 0;
}
exponent = two_complement_to_int(data->vout_mode, 5, 0x1f);
mantissa = data->v_out;
return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) :
sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent));
}
static ssize_t show_vout(struct device *dev, struct device_attribute *da,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct ym2651y_data *data = i2c_get_clientdata(client);
if (data->chip == YM2401) {
return show_vout_by_mode(dev, da, buf);
}
return show_linear(dev, da, buf);
}
static const struct attribute_group ym2651y_group = {
.attrs = ym2651y_attributes,
};
@@ -395,7 +434,7 @@ static int ym2651y_probe(struct i2c_client *client,
i2c_set_clientdata(client, data);
mutex_init(&data->update_lock);
data->chip = dev_id->driver_data;
dev_info(&client->dev, "chip found\n");
/* Register sysfs hooks */
@@ -436,7 +475,8 @@ static int ym2651y_remove(struct i2c_client *client)
}
static const struct i2c_device_id ym2651y_id[] = {
{ "ym2651", 0 },
{ "ym2651", YM2651 },
{ "ym2401", YM2401 },
{}
};
MODULE_DEVICE_TABLE(i2c, ym2651y_id);
@@ -504,9 +544,10 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev)
if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
|| !data->valid) {
int i, status;
u8 command;
int i, status, length;
u8 command, buf;
struct reg_data_byte regs_byte[] = { {0x19, &data->capability},
{0x20, &data->vout_mode},
{0x7d, &data->over_temp},
{0x81, &data->fan_fault},
{0x98, &data->pmbus_revision}};
@@ -582,9 +623,17 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev)
/* Read mfr_model */
command = 0x9a;
status = ym2651y_read_block(client, command, data->mfr_model,
ARRAY_SIZE(data->mfr_model)-1);
data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0';
length = 1;
/* Read first byte to determine the length of data */
status = ym2651y_read_block(client, command, &buf, length);
if (status < 0) {
dev_dbg(&client->dev, "reg %d, err %d\n", command, status);
goto exit;
}
status = ym2651y_read_block(client, command, data->mfr_model, buf+1);
data->mfr_model[buf+1] = '\0';
if (status < 0) {
dev_dbg(&client->dev, "reg %d, err %d\n", command, status);

View File

@@ -11,18 +11,24 @@ prerequisites:
- "onl-vendor-config-$VENDOR:all"
- "onl-platform-modules-$BASENAME:$ARCH"
common:
version: 1.0.0
arch: $ARCH
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
changelog: None
packages:
- 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
files:
src/lib: /lib/platform-config/$PLATFORM/onl
src/python : ${PY_INSTALL}/onl/platform/
changelog: Changes
- name: onl-platform-build-$PLATFORM
summary: ONL Platform Build Package for the $PLATFORM
optional-files:
builds: $$PKG_INSTALL

View File

@@ -1,8 +1,8 @@
variables:
basename: onl-kernel-3.2-deb7-x86-64-all
basename: onl-kernel-3.16-lts-powerpc-e500v-all
common:
arch: amd64
arch: powerpc
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
@@ -11,19 +11,20 @@ common:
packages:
- name: $basename
version: 1.0.0
summary: Open Network Linux Kernel 3.2-deb7 for X86_64 Platforms.
summary: Open Network Linux Kernel 3.16-lts for PowerPC e500v platforms.
files:
builds/kernel-3.2-deb7-x86_64-all : $$PKG_INSTALL/
builds/linux-3.2.65-1+deb7u2-mbuild : $$PKG_INSTALL/mbuilds
builds/kernel-3.16* : $$PKG_INSTALL/
builds/linux-*mbuild : $$PKG_INSTALL/mbuilds
changelog: Change changes changes.,
- name: $basename-modules
version: 1.0.0
summary: Open Network Linux 3.2 Kernel Modules for X86_64 Platforms
summary: Open Network Linux 3.16 LTS Kernel Modules for PowerPC e500v Platforms
files:
builds/lib: /lib
changelog: Change changes changes.,

View File

@@ -0,0 +1,3 @@
linux-*
kernel-*
lib

View File

@@ -13,7 +13,7 @@ THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(ONL)/make/config.mk
kernel:
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.18.25/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) $(ONL_MAKE_PARALLEL)
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.16-lts/configs/powerpc-e500v-all K_TARGET_DIR=$(THIS_DIR) K_COPY_DST=kernel-3.16-lts-powerpc-e500v-all.bin.gz $(ONL_MAKE_PARALLEL)
clean:
rm -rf linux-3.18.25 linux-3.18.25-mbuild
rm -rf linux-3.16.39 linux-3.16.39-mbuild

View File

@@ -1,22 +0,0 @@
common:
arch: powerpc
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
packages:
- name: onl-kernel-3.2-deb7-powerpc-e500v-all
version: 1.0.0
summary: Open Network Linux Kernel 3.2-deb7 for PowerPC e500v platforms.
files:
builds/kernel-3.2-deb7-powerpc-e500v-all.bin.gz : $$PKG_INSTALL/
builds/linux-3.2.65-1+deb7u2-dtbs : $$PKG_INSTALL/dtbs
builds/linux-3.2.65-1+deb7u2-mbuild : $$PKG_INSTALL/mbuilds
changelog: Change changes changes.,

View File

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

View File

@@ -1,2 +0,0 @@
linux-3.2.65-1+deb7u2*
*.bin.gz

View File

@@ -1,19 +0,0 @@
# -*- Makefile -*-
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################
THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(ONL)/make/config.mk
kernel:
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/powerpc-e500v-all K_TARGET_DIR=$(THIS_DIR) K_COPY_DST=kernel-3.2-deb7-powerpc-e500v-all.bin.gz $(ONL_MAKE_PARALLEL)
clean:
rm -rf linux-3.2.65-1+deb7u2 linux-3.2.65-1+deb7u2-mbuild linux-3.2.65-1+deb7u2-dtbs

View File

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

View File

@@ -0,0 +1,10 @@
include $(ONL)/make/dtbs.mk
#
# The 4610 DTS relies on the common arm devices tree includes. These are linked here from the kernel package.
#
setup::
onlpm --link-dir onl-kernel-3.2-deb7-arm-iproc-all:armel /usr/share/onl/packages/armel/onl-kernel-3.2-deb7-arm-iproc-all/mbuilds/arch/arm/boot/dts dts
clean::
rm -rf fsl

View File

@@ -0,0 +1,254 @@
/*
* Accton AS4610 54 Device Tree Source
*
* Copyright 2015, Cumulus Networks, Inc.
*
* 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.
*
*/
/dts-v1/;
/include/ "dts/helix4.dtsi"
/ {
model = "accton,as4610_54";
compatible = "accton,as4610_54";
aliases {
serial0 = &uart0;
i2c-controller0 = &i2c0;
i2c-controller1 = &i2c1;
};
memory {
reg = <0x61000000 0x7f000000>;
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-a9";
next-level-cache = <&L2>;
reg = <0x00>;
};
cpu@1 {
device_type = "cpu";
compatible = "arm,cortex-a9";
next-level-cache = <&L2>;
reg = <0x01>;
};
};
localbus@1c000000 {
#address-cells = <0x2>;
#size-cells = <0x1>;
/* NAND Flash */
ranges = <
0x0 0x0 0x0 0x1c000000 0x00120000
0x1 0x0 0x0 0x1c120000 0x00040000
>;
flash@0,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x02000000>;
byteswap;
partition@0 {
/* uboot */
reg = <0x00000000 0x00100000>;
label = "uboot";
};
partition@1 {
/* uboot-env */
reg = <0x00100000 0x00100000>;
label = "uboot-env";
env_size = <0x2000>;
};
partition@2 {
/* board_eeprom */
reg = <0x00200000 0x00100000>;
label = "board_eeprom";
};
partition@3 {
/* shmoo */
reg = <0x00300000 0x00100000>;
label = "shmoo";
};
partition@4 {
/* onie */
reg = <0x00400000 0x00800000>;
label = "onie";
};
partition@5 {
/* open */
reg = <0x00c00000 0x03c00000>;
label = "open";
};
partition@6 {
/* open2 */
reg = <0x04800000 0x7d000000>;
label = "open2";
};
partition@7 {
/* diag */
reg = <0xfec00000 0x01000000>;
label = "diag";
};
};
};
i2c0: i2c@18038000 {
compatible = "iproc-smb";
reg = <0x18038000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupts = < 127 >;
clock-frequency = <400000>;
cpld@1,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "accton,as4610_54_cpld";
label = "cpld";
reg = <0x30>;
};
};
i2c1: i2c@1803b000 {
compatible = "iproc-smb";
reg = <0x1803b000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupts = < 128 >;
clock-frequency = <100000>;
mux@70 {
compatible = "ti,pca9548";
reg = <0x70>;
#address-cells = <1>;
#size-cells = <0>;
deselect-on-exit;
// SFP+ 1
i2c@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
sfp_eeprom@50 {
compatible = "at,as4610_sfp1";
reg = <0x50>;
label = "port49";
};
};
// SFP+ 2
i2c@1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp2";
reg = <0x50>;
label = "port50";
};
};
// SFP+ 3
i2c@2 {
#address-cells = <1>;
#size-cells = <0>;
reg = <2>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp3";
reg = <0x50>;
label = "port51";
};
};
// SFP+ 4
i2c@3 {
#address-cells = <1>;
#size-cells = <0>;
reg = <3>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp4";
reg = <0x50>;
label = "port52";
};
};
// QSFP+ STK1
i2c@4 {
#address-cells = <1>;
#size-cells = <0>;
reg = <4>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp5";
reg = <0x50>;
};
};
// QSFP+ STK2
i2c@5 {
#address-cells = <1>;
#size-cells = <0>;
reg = <5>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp6";
reg = <0x50>;
};
};
// PSU EEPROM
i2c@6 {
#address-cells = <1>;
#size-cells = <0>;
reg = <6>;
psu1_eeprom@50 {
compatible = "accton,as4610_psu1";
reg = <0x50>;
};
psu1_pmbus@58 {
compatible = "3y-power,ym1921";
reg = <0x58>;
};
psu2_eeprom@51 {
compatible = "accton,as4610_psu2";
reg = <0x51>;
};
psu2_pmbus@59 {
compatible = "3y-power,ym1921";
reg = <0x59>;
};
};
i2c@7 {
#address-cells = <1>;
#size-cells = <0>;
reg = <7>;
temp@48 {
compatible = "nxp,lm77";
reg = <0x48>;
};
rtc@68 {
/* Actually M41T11 */
compatible = "dallas,ds1307";
reg = <0x68>;
};
board_eeprom@50 {
compatible = "at,24c04";
reg = <0x50>;
label = "board_eeprom";
};
};
};
};
};

View File

@@ -11,8 +11,9 @@ arm-accton-as4610-30-r0:
kernel:
<<: *arm-iproc-kernel
dtb:
=: accton_as4610_54.dtb
<<: *arm-iproc-kernel-package
=: arm-accton-as4610-54-r0.dtb
package: onl-platform-build-arm-accton-as4610-30-r0:armel
itb:
<<: *arm-itb

View File

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

View File

@@ -0,0 +1,10 @@
include $(ONL)/make/dtbs.mk
#
# The 4610 DTS relies on the common arm devices tree includes. These are linked here from the kernel package.
#
setup::
onlpm --link-dir onl-kernel-3.2-deb7-arm-iproc-all:armel /usr/share/onl/packages/armel/onl-kernel-3.2-deb7-arm-iproc-all/mbuilds/arch/arm/boot/dts dts
clean::
rm -rf fsl

View File

@@ -0,0 +1,254 @@
/*
* Accton AS4610 54 Device Tree Source
*
* Copyright 2015, Cumulus Networks, Inc.
*
* 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.
*
*/
/dts-v1/;
/include/ "dts/helix4.dtsi"
/ {
model = "accton,as4610_54";
compatible = "accton,as4610_54";
aliases {
serial0 = &uart0;
i2c-controller0 = &i2c0;
i2c-controller1 = &i2c1;
};
memory {
reg = <0x61000000 0x7f000000>;
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-a9";
next-level-cache = <&L2>;
reg = <0x00>;
};
cpu@1 {
device_type = "cpu";
compatible = "arm,cortex-a9";
next-level-cache = <&L2>;
reg = <0x01>;
};
};
localbus@1c000000 {
#address-cells = <0x2>;
#size-cells = <0x1>;
/* NAND Flash */
ranges = <
0x0 0x0 0x0 0x1c000000 0x00120000
0x1 0x0 0x0 0x1c120000 0x00040000
>;
flash@0,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x02000000>;
byteswap;
partition@0 {
/* uboot */
reg = <0x00000000 0x00100000>;
label = "uboot";
};
partition@1 {
/* uboot-env */
reg = <0x00100000 0x00100000>;
label = "uboot-env";
env_size = <0x2000>;
};
partition@2 {
/* board_eeprom */
reg = <0x00200000 0x00100000>;
label = "board_eeprom";
};
partition@3 {
/* shmoo */
reg = <0x00300000 0x00100000>;
label = "shmoo";
};
partition@4 {
/* onie */
reg = <0x00400000 0x00800000>;
label = "onie";
};
partition@5 {
/* open */
reg = <0x00c00000 0x03c00000>;
label = "open";
};
partition@6 {
/* open2 */
reg = <0x04800000 0x7d000000>;
label = "open2";
};
partition@7 {
/* diag */
reg = <0xfec00000 0x01000000>;
label = "diag";
};
};
};
i2c0: i2c@18038000 {
compatible = "iproc-smb";
reg = <0x18038000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupts = < 127 >;
clock-frequency = <400000>;
cpld@1,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "accton,as4610_54_cpld";
label = "cpld";
reg = <0x30>;
};
};
i2c1: i2c@1803b000 {
compatible = "iproc-smb";
reg = <0x1803b000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupts = < 128 >;
clock-frequency = <100000>;
mux@70 {
compatible = "ti,pca9548";
reg = <0x70>;
#address-cells = <1>;
#size-cells = <0>;
deselect-on-exit;
// SFP+ 1
i2c@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
sfp_eeprom@50 {
compatible = "at,as4610_sfp1";
reg = <0x50>;
label = "port49";
};
};
// SFP+ 2
i2c@1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp2";
reg = <0x50>;
label = "port50";
};
};
// SFP+ 3
i2c@2 {
#address-cells = <1>;
#size-cells = <0>;
reg = <2>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp3";
reg = <0x50>;
label = "port51";
};
};
// SFP+ 4
i2c@3 {
#address-cells = <1>;
#size-cells = <0>;
reg = <3>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp4";
reg = <0x50>;
label = "port52";
};
};
// QSFP+ STK1
i2c@4 {
#address-cells = <1>;
#size-cells = <0>;
reg = <4>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp5";
reg = <0x50>;
};
};
// QSFP+ STK2
i2c@5 {
#address-cells = <1>;
#size-cells = <0>;
reg = <5>;
sfp_eeprom@50 {
compatible = "accton,as4610_sfp6";
reg = <0x50>;
};
};
// PSU EEPROM
i2c@6 {
#address-cells = <1>;
#size-cells = <0>;
reg = <6>;
psu1_eeprom@50 {
compatible = "accton,as4610_psu1";
reg = <0x50>;
};
psu1_pmbus@58 {
compatible = "3y-power,ym1921";
reg = <0x58>;
};
psu2_eeprom@51 {
compatible = "accton,as4610_psu2";
reg = <0x51>;
};
psu2_pmbus@59 {
compatible = "3y-power,ym1921";
reg = <0x59>;
};
};
i2c@7 {
#address-cells = <1>;
#size-cells = <0>;
reg = <7>;
temp@48 {
compatible = "nxp,lm77";
reg = <0x48>;
};
rtc@68 {
/* Actually M41T11 */
compatible = "dallas,ds1307";
reg = <0x68>;
};
board_eeprom@50 {
compatible = "at,24c04";
reg = <0x50>;
label = "board_eeprom";
};
};
};
};
};

View File

@@ -11,8 +11,9 @@ arm-accton-as4610-54-r0:
kernel:
<<: *arm-iproc-kernel
dtb:
=: accton_as4610_54.dtb
<<: *arm-iproc-kernel-package
=: arm-accton-as4610-54-r0.dtb
package: onl-platform-build-arm-accton-as4610-54-r0:armel
itb:
<<: *arm-itb
@@ -27,4 +28,3 @@ arm-accton-as4610-54-r0:
env_offset: 0x00000000
env_size: 0x00002000
sector_size: 0x00010000

View File

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

View File

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

View File

@@ -0,0 +1,479 @@
/*
* P2020 RDB Device Tree Source
*
* Copyright 2009-2010 Freescale Semiconductor Inc.
*
* 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.
*/
/dts-v1/;
/ {
model = "powerpc-as4600-54t";
compatible = "fsl,P2020RDB";
#address-cells = <2>;
#size-cells = <2>;
aliases {
ethernet0 = &enet1;
serial0 = &serial0;
pci1 = &pci1;
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
PowerPC,P2020@0 {
device_type = "cpu";
reg = <0x0>;
next-level-cache = <&L2>;
};
PowerPC,P2020@1 {
device_type = "cpu";
reg = <0x1>;
next-level-cache = <&L2>;
};
};
memory {
device_type = "memory";
};
localbus@ff705000 {
ranges = <0x0 0x0 0x0 0xef800000 0x800000 0x1 0x0 0x0 0xea000000 0x100>;
interrupts = <0x13 0x2>;
reg = <0x0 0xff705000 0x0 0x1000>;
compatible = "fsl,p2020-elbc", "fsl,elbc", "simple-bus";
#size-cells = <0x1>;
#address-cells = <0x2>;
bus-frequency = <0x1dcd650>;
cpld@1,0 {
reg = <0x1 0x0 0x100>;
compatible = "accton,4654-cpld";
};
flash@0,0 {
device-width = <0x1>;
bank-width = <0x1>;
reg = <0x0 0x0 0x800000>;
compatible = "cfi-flash";
#size-cells = <0x1>;
#address-cells = <0x1>;
partition@0 {
label = "open";
reg = <0x0 0x360000>;
};
partition@1 {
label = "onie";
reg = <0x360000 0x400000>;
};
partition@2 {
env_size = <0x10000>;
label = "uboot-env";
reg = <0x760000 0x10000>;
};
partition@3 {
label = "board_eeprom";
reg = <0x770000 0x10000>;
};
partition@4 {
label = "uboot";
reg = <0x780000 0x80000>;
};
};
};
soc@ff700000 {
#address-cells = <1>;
#size-cells = <1>;
device_type = "soc";
compatible = "fsl,p2020-immr", "simple-bus";
ranges = <0x0 0x0 0xff700000 0x100000>;
bus-frequency = <0>; // Filled out by uboot.
ecm-law@0 {
compatible = "fsl,ecm-law";
reg = <0x0 0x1000>;
fsl,num-laws = <12>;
};
ecm@1000 {
compatible = "fsl,p2020-ecm", "fsl,ecm";
reg = <0x1000 0x1000>;
interrupts = <17 2>;
interrupt-parent = <&mpic>;
};
memory-controller@2000 {
compatible = "fsl,p2020-memory-controller";
reg = <0x2000 0x1000>;
interrupt-parent = <&mpic>;
interrupts = <18 2>;
};
i2c@3000 {
#address-cells = <1>;
#size-cells = <0>;
cell-index = <0>;
compatible = "fsl-i2c";
reg = <0x3000 0x100>;
interrupts = <43 2>;
interrupt-parent = <&mpic>;
dfsrr;
};
i2c@3100 {
#address-cells = <1>;
#size-cells = <0>;
cell-index = <1>;
compatible = "fsl-i2c";
reg = <0x3100 0x100>;
interrupts = <43 2>;
interrupt-parent = <&mpic>;
dfsrr;
rtc@68 {
compatible = "dallas,ds1672";
reg = <0x68>;
};
};
serial0: serial@4500 {
cell-index = <0>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4500 0x100>;
clock-frequency = <0>;
interrupts = <42 2>;
interrupt-parent = <&mpic>;
};
spi@7000 {
cell-index = <0>;
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,espi";
reg = <0x7000 0x1000>;
interrupts = <59 0x2>;
interrupt-parent = <&mpic>;
mode = "cpu";
fsl_m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,espi-flash";
reg = <0>;
linux,modalias = "fsl_m25p80";
modal = "s25sl128b";
spi-max-frequency = <32000000>;
mode = <0>;
partition@0 {
/* 512KB for u-boot Bootloader Image */
reg = <0x0 0x00080000>;
label = "SPI (RO) U-Boot Image";
read-only;
};
partition@80000 {
/* 512KB for DTB Image */
reg = <0x00080000 0x00080000>;
label = "SPI (RO) DTB Image";
read-only;
};
partition@100000 {
/* 4MB for Linux Kernel Image */
reg = <0x00100000 0x00400000>;
label = "SPI (RO) Linux Kernel Image";
read-only;
};
partition@500000 {
/* 4MB for Compressed RFS Image */
reg = <0x00500000 0x00400000>;
label = "SPI (RO) Compressed RFS Image";
read-only;
};
partition@900000 {
/* 7MB for JFFS2 based RFS */
reg = <0x00900000 0x00700000>;
label = "SPI (RW) JFFS2 RFS";
};
};
};
dma@c300 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,eloplus-dma";
reg = <0xc300 0x4>;
ranges = <0x0 0xc100 0x200>;
cell-index = <1>;
dma-channel@0 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x0 0x80>;
cell-index = <0>;
interrupt-parent = <&mpic>;
interrupts = <76 2>;
};
dma-channel@80 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x80 0x80>;
cell-index = <1>;
interrupt-parent = <&mpic>;
interrupts = <77 2>;
};
dma-channel@100 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x100 0x80>;
cell-index = <2>;
interrupt-parent = <&mpic>;
interrupts = <78 2>;
};
dma-channel@180 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x180 0x80>;
cell-index = <3>;
interrupt-parent = <&mpic>;
interrupts = <79 2>;
};
};
gpio: gpio-controller@f000 {
#gpio-cells = <2>;
compatible = "fsl,mpc8572-gpio";
reg = <0xf000 0x100>;
interrupts = <47 0x2>;
interrupt-parent = <&mpic>;
gpio-controller;
};
L2: l2-cache-controller@20000 {
compatible = "fsl,p2020-l2-cache-controller";
reg = <0x20000 0x1000>;
cache-line-size = <32>; // 32 bytes
cache-size = <0x80000>; // L2,512K
interrupt-parent = <&mpic>;
interrupts = <16 2>;
};
dma@21300 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,eloplus-dma";
reg = <0x21300 0x4>;
ranges = <0x0 0x21100 0x200>;
cell-index = <0>;
dma-channel@0 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x0 0x80>;
cell-index = <0>;
interrupt-parent = <&mpic>;
interrupts = <20 2>;
};
dma-channel@80 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x80 0x80>;
cell-index = <1>;
interrupt-parent = <&mpic>;
interrupts = <21 2>;
};
dma-channel@100 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x100 0x80>;
cell-index = <2>;
interrupt-parent = <&mpic>;
interrupts = <22 2>;
};
dma-channel@180 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x180 0x80>;
cell-index = <3>;
interrupt-parent = <&mpic>;
interrupts = <23 2>;
};
};
usb@22000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl-usb2-dr";
reg = <0x22000 0x1000>;
interrupt-parent = <&mpic>;
interrupts = <28 0x2>;
phy_type = "ulpi";
};
mdio0: mdio@24520 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,gianfar-mdio";
reg = <0x24520 0x20>;
phy1: ethernet-phy@1 {
interrupt-parent = <&mpic>;
interrupts = <3 1>;
reg = <0x1>;
device_type = "ethernet-phy";
};
};
enet1: ethernet@25000 {
#address-cells = <0x1>;
#size-cells = <0x1>;
cell-index = <0x1>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x25000 0x1000>;
ranges = <0x0 0x25000 0x1000>;
interrupts = <
0x23 0x2
0x24 0x2
0x28 0x2>;
interrupt-parent = <&mpic>;
tbi-handle = <&tbi1>;
phy-handle = <&phy1>;
phy-connection-type = "sgmii";
};
mdio1: mdio@25520 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "fsl,gianfar-tbi";
reg = <0x520 0x20>;
tbi1: tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
};
};
sdhci@2e000 {
compatible = "fsl,p2020-esdhc", "fsl,esdhc";
reg = <0x2e000 0x1000>;
interrupts = <72 0x2>;
interrupt-parent = <&mpic>;
fsl,sdhci-adjust-timeout;
/* Filled in by U-Boot */
clock-frequency = <0>;
};
crypto@30000 {
compatible = "fsl,sec3.1", "fsl,sec3.0", "fsl,sec2.4",
"fsl,sec2.2", "fsl,sec2.1", "fsl,sec2.0";
reg = <0x30000 0x10000>;
interrupts = <45 2 58 2>;
interrupt-parent = <&mpic>;
fsl,num-channels = <4>;
fsl,channel-fifo-len = <24>;
fsl,exec-units-mask = <0xbfe>;
fsl,descriptor-types-mask = <0x3ab0ebf>;
fsl,multi-host-mode = "dual";
fsl,channel-remap = <0x3>;
};
mpic: pic@40000 {
interrupt-controller;
#address-cells = <0>;
#interrupt-cells = <2>;
reg = <0x40000 0x40000>;
compatible = "chrp,open-pic";
device_type = "open-pic";
};
message@41400 {
compatible = "fsl,p2020-msg", "fsl,mpic-msg";
reg = <0x41400 0x200>;
interrupts = <
0xb0 2
0xb1 2
0xb2 2
0xb3 2>;
interrupt-parent = <&mpic>;
};
message@42400 {
compatible = "fsl,p2020-msg", "fsl,mpic-msg";
reg = <0x42400 0x200>;
interrupts = <
0xb4 2
0xb5 2
0xb6 2
0xb7 2>;
interrupt-parent = <&mpic>;
};
msi@41600 {
compatible = "fsl,p2020-msi", "fsl,mpic-msi";
reg = <0x41600 0x80>;
msi-available-ranges = <0 0x100>;
interrupts = <
0xe0 0
0xe1 0
0xe2 0
0xe3 0
0xe4 0
0xe5 0
0xe6 0
0xe7 0>;
interrupt-parent = <&mpic>;
};
global-utilities@e0000 { //global utilities block
compatible = "fsl,p2020-guts";
reg = <0xe0000 0x1000>;
fsl,has-rstcr;
};
};
pci1: pcie@ff70a000 {
cell-index = <2>;
compatible = "fsl,mpc8548-pcie";
device_type = "pci";
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
reg = <0 0xff70a000 0 0x1000>;
bus-range = <0 255>;
ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>;
clock-frequency = <33333333>;
interrupt-parent = <&mpic>;
interrupts = <26 2>;
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <
/* IDSEL 0x0 */
0000 0x0 0x0 0x1 &mpic 0x0 0x1
0000 0x0 0x0 0x2 &mpic 0x1 0x1
0000 0x0 0x0 0x3 &mpic 0x2 0x1
0000 0x0 0x0 0x4 &mpic 0x3 0x1
>;
pcie@0 {
reg = <0x0 0x0 0x0 0x0 0x0>;
#size-cells = <2>;
#address-cells = <3>;
device_type = "pci";
ranges = <0x2000000 0x0 0xc0000000
0x2000000 0x0 0xc0000000
0x0 0x20000000
0x1000000 0x0 0x0
0x1000000 0x0 0x0
0x0 0x100000>;
};
};
};

View File

@@ -11,8 +11,8 @@ powerpc-accton-as4600-54t-r0:
kernel:
<<: *e500v-kernel
dtb:
=: powerpc-as4600-54t.dtb
<<: *e500v-kernel-package
=: powerpc-accton-as4600-54t-r0.dtb
package: onl-platform-build-powerpc-accton-as4600-54t-r0:powerpc
loader:
device: /dev/sda

View File

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

View File

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

View File

@@ -0,0 +1,584 @@
/*
* P2020 RDB Device Tree Source
*
* Copyright 2009-2010 Freescale Semiconductor Inc.
*
* 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.
*/
/dts-v1/;
/ {
model = "powerpc-as5610-52x";
compatible = "fsl,P2020RDB";
#address-cells = <2>;
#size-cells = <2>;
aliases {
ethernet0 = &enet0;
/* ethernet1 = &enet1;
ethernet2 = &enet2; */
serial0 = &serial0;
serial1 = &serial1;
pci0 = &pci0;
pci1 = &pci1;
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
PowerPC,P2020@0 {
device_type = "cpu";
reg = <0x0>;
next-level-cache = <&L2>;
};
PowerPC,P2020@1 {
device_type = "cpu";
reg = <0x1>;
next-level-cache = <&L2>;
};
};
memory {
device_type = "memory";
};
localbus@ff705000 {
#address-cells = <2>;
#size-cells = <1>;
compatible = "fsl,p2020-elbc", "fsl,elbc", "simple-bus";
reg = <0 0xff705000 0 0x1000>;
interrupts = <19 2>;
interrupt-parent = <&mpic>;
/* NOR and CPLD, nvram, FPGA */
ranges = <0x0 0x0 0x0 0xefc00000 0x00400000>;
nor@0,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x400000>;
bank-width = <1>; /* 1 = 64KB on each erase block */
device-width = <1>;
partition@0 {
/* 3.3 MB for Linux Kernel Image */
reg = <0x0 0x00360000>;
label = "onie";
};
partition@360000 {
/* 64 KB for u-boot environment */
reg = <0x360000 0x00010000>;
label = "u-boot environment";
};
partition@370000 {
/* 64 KB for VPD */
reg = <0x00370000 0x00010000>;
label = "board_eeprom";
read-only;
};
partition@380000 {
/* 512 KB for bootloader */
reg = <0x00380000 0x00080000>;
label = "uboot";
read-only;
};
};
};
soc@ff700000 {
#address-cells = <1>;
#size-cells = <1>;
device_type = "soc";
compatible = "fsl,p2020-immr", "simple-bus";
ranges = <0x0 0x0 0xff700000 0x100000>;
bus-frequency = <0>; // Filled out by uboot.
ecm-law@0 {
compatible = "fsl,ecm-law";
reg = <0x0 0x1000>;
fsl,num-laws = <12>;
};
ecm@1000 {
compatible = "fsl,p2020-ecm", "fsl,ecm";
reg = <0x1000 0x1000>;
interrupts = <17 2>;
interrupt-parent = <&mpic>;
};
memory-controller@2000 {
compatible = "fsl,p2020-memory-controller";
reg = <0x2000 0x1000>;
interrupt-parent = <&mpic>;
interrupts = <18 2>;
};
i2c@3000 {
#address-cells = <1>;
#size-cells = <0>;
cell-index = <0>;
compatible = "fsl-i2c";
reg = <0x3000 0x100>;
interrupts = <43 2>;
interrupt-parent = <&mpic>;
dfsrr;
mux@70 {
compatible = "nxp,pca9548";
reg = <0x70>;
#address-cells = <1>;
#size-cells = <0>;
i2c@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
rtc@51 {
compatible = "nxp,pcf8563";
reg = <0x51>;
};
};
};
};
i2c@3100 {
#address-cells = <1>;
#size-cells = <0>;
cell-index = <1>;
compatible = "fsl-i2c";
reg = <0x3100 0x100>;
interrupts = <43 2>;
interrupt-parent = <&mpic>;
dfsrr;
};
serial0: serial@4500 {
cell-index = <0>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4500 0x100>;
clock-frequency = <0>;
interrupts = <42 2>;
interrupt-parent = <&mpic>;
};
serial1: serial@4600 {
cell-index = <1>;
device_type = "serial";
compatible = "ns16550";
reg = <0x4600 0x100>;
clock-frequency = <0>;
interrupts = <42 2>;
interrupt-parent = <&mpic>;
};
spi@7000 {
cell-index = <0>;
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,espi";
reg = <0x7000 0x1000>;
interrupts = <59 0x2>;
interrupt-parent = <&mpic>;
mode = "cpu";
fsl_m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,espi-flash";
reg = <0>;
linux,modalias = "fsl_m25p80";
modal = "s25sl128b";
spi-max-frequency = <32000000>;
mode = <0>;
partition@0 {
/* 512KB for u-boot Bootloader Image */
reg = <0x0 0x00080000>;
label = "SPI (RO) U-Boot Image";
read-only;
};
partition@80000 {
/* 512KB for DTB Image */
reg = <0x00080000 0x00080000>;
label = "SPI (RO) DTB Image";
read-only;
};
partition@100000 {
/* 4MB for Linux Kernel Image */
reg = <0x00100000 0x00400000>;
label = "SPI (RO) Linux Kernel Image";
read-only;
};
partition@500000 {
/* 4MB for Compressed RFS Image */
reg = <0x00500000 0x00400000>;
label = "SPI (RO) Compressed RFS Image";
read-only;
};
partition@900000 {
/* 7MB for JFFS2 based RFS */
reg = <0x00900000 0x00700000>;
label = "SPI (RW) JFFS2 RFS";
};
};
};
dma@c300 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,eloplus-dma";
reg = <0xc300 0x4>;
ranges = <0x0 0xc100 0x200>;
cell-index = <1>;
dma-channel@0 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x0 0x80>;
cell-index = <0>;
interrupt-parent = <&mpic>;
interrupts = <76 2>;
};
dma-channel@80 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x80 0x80>;
cell-index = <1>;
interrupt-parent = <&mpic>;
interrupts = <77 2>;
};
dma-channel@100 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x100 0x80>;
cell-index = <2>;
interrupt-parent = <&mpic>;
interrupts = <78 2>;
};
dma-channel@180 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x180 0x80>;
cell-index = <3>;
interrupt-parent = <&mpic>;
interrupts = <79 2>;
};
};
gpio: gpio-controller@f000 {
#gpio-cells = <2>;
compatible = "fsl,mpc8572-gpio";
reg = <0xf000 0x100>;
interrupts = <47 0x2>;
interrupt-parent = <&mpic>;
gpio-controller;
};
L2: l2-cache-controller@20000 {
compatible = "fsl,p2020-l2-cache-controller";
reg = <0x20000 0x1000>;
cache-line-size = <32>; // 32 bytes
cache-size = <0x80000>; // L2,512K
interrupt-parent = <&mpic>;
interrupts = <16 2>;
};
dma@21300 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,eloplus-dma";
reg = <0x21300 0x4>;
ranges = <0x0 0x21100 0x200>;
cell-index = <0>;
dma-channel@0 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x0 0x80>;
cell-index = <0>;
interrupt-parent = <&mpic>;
interrupts = <20 2>;
};
dma-channel@80 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x80 0x80>;
cell-index = <1>;
interrupt-parent = <&mpic>;
interrupts = <21 2>;
};
dma-channel@100 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x100 0x80>;
cell-index = <2>;
interrupt-parent = <&mpic>;
interrupts = <22 2>;
};
dma-channel@180 {
compatible = "fsl,eloplus-dma-channel";
reg = <0x180 0x80>;
cell-index = <3>;
interrupt-parent = <&mpic>;
interrupts = <23 2>;
};
};
usb@22000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl-usb2-dr";
reg = <0x22000 0x1000>;
interrupt-parent = <&mpic>;
interrupts = <28 0x2>;
phy_type = "ulpi";
};
/* No ptp_timer
ptp_timer: ptimer@24e00 {
compatible = "fsl,gianfar-ptp-timer";
reg = <0x24e00 0xb0>;
};
*/
enet0: ethernet@24000 {
#address-cells = <1>;
#size-cells = <1>;
cell-index = <0>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x24000 0x1000>;
ranges = <0x0 0x24000 0x1000>;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <29 2 30 2 34 2>;
interrupt-parent = <&mpic>;
fixed-link = <1 1 1000 0 0>;
phy-handle = <&phy1>;
phy-connection-type = "rgmii-id";
/* ptimer-handle = <&ptp_timer>; */
mdio@520 {
#address-cells = <1>;
#size-cells = <0>;
device_type = "mdio";
compatible = "fsl,gianfar-mdio";
reg = <0x520 0x20>;
/*
phy0: ethernet-phy@0 {
interrupt-parent = <&mpic>;
interrupts = <3 1>;
reg = <0x0>;
};
*/
phy1: ethernet-phy@1 {
reg = <0x1>;
device_type = "ethernet-phy";
linux,phandle = <0x4>;
};
};
};
/* not used !
enet1: ethernet@25000 {
#address-cells = <1>;
#size-cells = <1>;
cell-index = <1>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x25000 0x1000>;
ranges = <0x0 0x25000 0x1000>;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <35 2 36 2 40 2>;
interrupt-parent = <&mpic>;
tbi-handle = <&tbi0>;
phy-handle = <&phy0>;
phy-connection-type = "sgmii";
ptimer-handle = <&ptp_timer>;
mdio@520 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,gianfar-tbi";
reg = <0x520 0x20>;
tbi0: tbi-phy@11 {
reg = <0x11>;
device_type = "tbi-phy";
};
};
};
enet2: ethernet@26000 {
#address-cells = <1>;
#size-cells = <1>;
cell-index = <2>;
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <0x26000 0x1000>;
ranges = <0x0 0x26000 0x1000>;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <31 2 32 2 33 2>;
interrupt-parent = <&mpic>;
phy-handle = <&phy1>;
phy-connection-type = "rgmii-id";
ptimer-handle = <&ptp_timer>;
};
*/
sdhci@2e000 {
compatible = "fsl,p2020-esdhc", "fsl,esdhc";
reg = <0x2e000 0x1000>;
interrupts = <72 0x2>;
interrupt-parent = <&mpic>;
fsl,sdhci-adjust-timeout;
/* Filled in by U-Boot */
clock-frequency = <0>;
};
crypto@30000 {
compatible = "fsl,sec3.1", "fsl,sec3.0", "fsl,sec2.4",
"fsl,sec2.2", "fsl,sec2.1", "fsl,sec2.0";
reg = <0x30000 0x10000>;
interrupts = <45 2 58 2>;
interrupt-parent = <&mpic>;
fsl,num-channels = <4>;
fsl,channel-fifo-len = <24>;
fsl,exec-units-mask = <0xbfe>;
fsl,descriptor-types-mask = <0x3ab0ebf>;
fsl,multi-host-mode = "dual";
fsl,channel-remap = <0x3>;
};
mpic: pic@40000 {
interrupt-controller;
#address-cells = <0>;
#interrupt-cells = <2>;
reg = <0x40000 0x40000>;
compatible = "chrp,open-pic";
device_type = "open-pic";
};
message@41400 {
compatible = "fsl,p2020-msg", "fsl,mpic-msg";
reg = <0x41400 0x200>;
interrupts = <
0xb0 2
0xb1 2
0xb2 2
0xb3 2>;
interrupt-parent = <&mpic>;
};
message@42400 {
compatible = "fsl,p2020-msg", "fsl,mpic-msg";
reg = <0x42400 0x200>;
interrupts = <
0xb4 2
0xb5 2
0xb6 2
0xb7 2>;
interrupt-parent = <&mpic>;
};
msi@41600 {
compatible = "fsl,p2020-msi", "fsl,mpic-msi";
reg = <0x41600 0x80>;
msi-available-ranges = <0 0x100>;
interrupts = <
0xe0 0
0xe1 0
0xe2 0
0xe3 0
0xe4 0
0xe5 0
0xe6 0
0xe7 0>;
interrupt-parent = <&mpic>;
};
global-utilities@e0000 { //global utilities block
compatible = "fsl,p2020-guts";
reg = <0xe0000 0x1000>;
fsl,has-rstcr;
};
};
pci0: pcie@ff709000 {
cell-index = <1>;
compatible = "fsl,mpc8548-pcie";
device_type = "pci";
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
reg = <0 0xff709000 0 0x1000>;
bus-range = <0 255>;
ranges = <0x2000000 0x0 0xc0000000 0 0xc0000000 0x0 0x20000000
0x1000000 0x0 0x00000000 0 0xffc30000 0x0 0x10000>;
clock-frequency = <33333333>;
interrupt-parent = <&mpic>;
interrupts = <25 2>;
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <
/* IDSEL 0x0 */
0000 0x0 0x0 0x1 &mpic 0x4 0x1
0000 0x0 0x0 0x2 &mpic 0x5 0x1
0000 0x0 0x0 0x3 &mpic 0x6 0x1
0000 0x0 0x0 0x4 &mpic 0x7 0x1
>;
pcie@0 {
reg = <0x0 0x0 0x0 0x0 0x0>;
#size-cells = <2>;
#address-cells = <3>;
device_type = "pci";
ranges = <0x2000000 0x0 0xc0000000
0x2000000 0x0 0xc0000000
0x0 0x20000000
0x1000000 0x0 0x0
0x1000000 0x0 0x0
0x0 0x100000>;
};
};
pci1: pcie@ff70a000 {
cell-index = <2>;
compatible = "fsl,mpc8548-pcie";
device_type = "pci";
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
reg = <0 0xff70a000 0 0x1000>;
bus-range = <0 255>;
ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>;
clock-frequency = <33333333>;
interrupt-parent = <&mpic>;
interrupts = <26 2>;
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <
/* IDSEL 0x0 */
0000 0x0 0x0 0x1 &mpic 0x0 0x1
0000 0x0 0x0 0x2 &mpic 0x1 0x1
0000 0x0 0x0 0x3 &mpic 0x2 0x1
0000 0x0 0x0 0x4 &mpic 0x3 0x1
>;
pcie@0 {
reg = <0x0 0x0 0x0 0x0 0x0>;
#size-cells = <2>;
#address-cells = <3>;
device_type = "pci";
ranges = <0x2000000 0x0 0xc0000000
0x2000000 0x0 0xc0000000
0x0 0x20000000
0x1000000 0x0 0x0
0x1000000 0x0 0x0
0x0 0x100000>;
};
};
};

View File

@@ -12,8 +12,8 @@ powerpc-accton-as5610-52x-r0:
kernel:
<<: *e500v-kernel
dtb:
=: powerpc-as5610-52x.dtb
<<: *e500v-kernel-package
=: powerpc-accton-as5610-52x-r0.dtb
package: onl-platform-build-powerpc-accton-as5610-52x-r0:powerpc
loader:
device: /dev/sda

View File

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

View File

@@ -0,0 +1,10 @@
include $(ONL)/make/dtbs.mk
#
# The 5710 DTS relies on the common FSL devices trees. These are linked here from the kernel package.
#
setup::
onlpm --link-dir onl-kernel-3.8.13-powerpc-e500mc:powerpc /usr/share/onl/packages/powerpc/onl-kernel-3.8.13-powerpc-e500mc/mbuilds/source/arch/powerpc/boot/dts/fsl fsl
clean::
rm -rf fsl

View File

@@ -0,0 +1,486 @@
/*
* P2041RDB Device Tree Source
*
* Copyright 2011-2012 Freescale Semiconductor Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Freescale Semiconductor nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* ALTERNATIVELY, this software may be distributed under the terms of the
* GNU General Public License ("GPL") as published by the Free Software
* Foundation, either version 2 of that License or (at your option) any
* later version.
*
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/include/ "fsl/as5710_54x-pre.dtsi"
/ {
model = "powerpc-accton-as5710-54x-r0";
compatible = "accton,as5710_54x";
#address-cells = <2>;
#size-cells = <2>;
interrupt-parent = <&mpic>;
aliases {
ethernet0 = &enet3;
ethernet1 = &enet0;
phy_sgmii_2 = &phy_sgmii_2;
phy_sgmii_1f = &phy_sgmii_1f;
};
memory {
device_type = "memory";
};
dcsr: dcsr@f00000000 {
ranges = <0x00000000 0xf 0x00000000 0x01008000>;
};
bportals: bman-portals@ff4000000 {
ranges = <0x0 0xf 0xf4000000 0x200000>;
};
qportals: qman-portals@ff4200000 {
ranges = <0x0 0xf 0xf4200000 0x200000>;
};
soc: soc@ffe000000 {
ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
reg = <0xf 0xfe000000 0 0x00001000>;
i2c@118000 {
ne1617ads@18 {
compatible = "max1617a";
reg = <0x18>;
};
eeprom@50 {
compatible = "at24,24c256";
reg = <0x50>;
};
rtc: ds1672@68 {
compatible = "ds1672";
reg = <0x68>;
};
};
i2c@118100 {
pca9548@70 {
compatible = "nxp,pca9548";
reg = <0x70>;
#address-cells = <1>;
#size-cells = <0>;
i2c@1 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x1>;
as5710_54x_ac_psu1@38 {
compatible = "acc_as5710_54x_psu";
reg = <0x38>;
};
as5710_54x_dc_psu1@50 {
compatible = "acc_as5710_54x_psu";
reg = <0x50>;
};
cpr_4011_4mxx@3c {
compatible = "cpr_4011_4mxx";
reg = <0x3c>;
};
};
i2c@2 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x2>;
as5710_54x_ac_psu2@3b {
compatible = "acc_as5710_54x_psu";
reg = <0x3b>;
};
as5710_54x_dc_psu2@53 {
compatible = "acc_as5710_54x_psu";
reg = <0x53>;
};
cpr_4011_4mxx@3f {
compatible = "cpr_4011_4mxx";
reg = <0x3f>;
};
};
i2c@5 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x5>;
lm75@48 {
compatible = "lm75";
reg = <0x48>;
};
};
i2c@6 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x6>;
lm75@49 {
compatible = "lm75";
reg = <0x49>;
};
};
i2c@7 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x7>;
lm75@4a{
compatible = "lm75";
reg = <0x4a>;
};
};
};
};
i2c@119000 {
};
i2c@119100 {
accton_i2c_cpld@60 {
compatible = "accton_i2c_cpld";
reg = <0x60>;
};
accton_i2c_cpld@61 {
compatible = "accton_i2c_cpld";
reg = <0x61>;
};
accton_i2c_cpld@62 {
compatible = "accton_i2c_cpld";
reg = <0x62>;
};
acc_as5710_54x_sfp@50 {
compatible = "acc_as5710_54x_sfp";
reg = <0x50>;
};
sfp_dom@51 {
compatible = "at,24c02";
reg = <0x51>;
};
};
usb1: usb@211000 {
dr_mode = "host";
};
fman0: fman@400000 {
enet0: ethernet@e0000 {
tbi-handle = <&tbi0>;
phy-handle = <&phy_sgmii_2>;
phy-connection-type = "sgmii";
};
mdio0: mdio@e1120 {
tbi0: tbi-phy@8 {
reg = <0x8>;
device_type = "tbi-phy";
};
phy_sgmii_2: ethernet-phy@2 {
reg = <0x2>;
};
phy_sgmii_1f: ethernet-phy@1f {
reg = <0x1f>;
};
};
enet3: ethernet@e6000 {
tbi-handle = <&tbi3>;
phy-handle = <&phy_sgmii_1f>;
phy-connection-type = "sgmii";
};
mdio@e7120 {
tbi3: tbi-phy@8 {
reg = <8>;
device_type = "tbi-phy";
};
};
};
};
rio: rapidio@ffe0c0000 {
reg = <0xf 0xfe0c0000 0 0x11000>;
port1 {
ranges = <0 0 0xc 0x20000000 0 0x10000000>;
};
port2 {
ranges = <0 0 0xc 0x30000000 0 0x10000000>;
};
};
lbc: localbus@ffe124000 {
/*orig
reg = <0xf 0xfe124000 0 0x1000>;
ranges = <0 0 0xf 0xe8000000 0x08000000
1 0 0xf 0xffa00000 0x00040000>;
*/
/*miles*/
reg = <0xf 0xfe124000 0 0x1000>;
ranges = <0 0 0xf 0xe8000000 0x08000000>;
nor@0,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x8000000>;
bank-width = <0x2>;
device-width = <0x2>;
byteswap;
partition@0 {
/*RCW 128KB*/
reg = <0x00000000 0x00020000>;
label = "RCW";
read-only;
};
partition@1 {
/*HW info 128KB*/
reg = <0x00020000 0x00020000>;
label = "hw-info";
read-only;
};
partition@2 {
/*ONIE 13MB*/
reg = <0x00040000 0x00d00000>;
label = "onie";
read-only;
};
partition@3 {
/*Diag 20MB*/
reg = <0x00d40000 0x01400000>;
label = "diag";
};
partition@4 {
/*Reserved*/
reg = <0x02140000 0x05E00000>;
label = "open";
};
partition@5 {
/*Firmware (Fman) 128KB*/
reg = <0x07f40000 0x00020000>;
label = "Fman-FW";
read-only;
};
partition@6 {
/*uboot env 128KB*/
reg = <0x07f60000 0x00020000>;
label = "uboot-env";
env_size = <0x2000>;
};
partition@7 {
/*uboot*/
reg = <0x07f80000 0x00080000>;
label = "uboot";
read-only;
};
};
/* orig
flash@0,0 {
compatible = "cfi-flash";
reg = <0 0 0x08000000>;
bank-width = <2>;
device-width = <2>;
};
nand@1,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,elbc-fcm-nand";
reg = <0x1 0x0 0x40000>;
partition@0 {
label = "NAND U-Boot Image";
reg = <0x0 0x02000000>;
read-only;
};
partition@2000000 {
label = "NAND Root File System";
reg = <0x02000000 0x10000000>;
};
partition@12000000 {
label = "NAND Compressed RFS Image";
reg = <0x12000000 0x08000000>;
};
partition@1a000000 {
label = "NAND Linux Kernel Image";
reg = <0x1a000000 0x04000000>;
};
partition@1e000000 {
label = "NAND DTB Image";
reg = <0x1e000000 0x01000000>;
};
partition@1f000000 {
label = "NAND Writable User area";
reg = <0x1f000000 0x01000000>;
};
};
*/
};
/* orig *//*
pci0: pcie@ffe200000 {
reg = <0xf 0xfe200000 0 0x1000>;
ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x20000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci1: pcie@ffe201000 {
reg = <0xf 0xfe201000 0 0x1000>;
ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x20000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci2: pcie@ffe202000 {
reg = <0xf 0xfe202000 0 0x1000>;
ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000
0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x20000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
*/
pci0: pcie@ffe200000 {
reg = <0xf 0xfe200000 0 0x1000>;
ranges = <0x02000000 0x0 0xd0000000
0x0 0xd0000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8000000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci1: pcie@ffe201000 {
reg = <0xf 0xfe201000 0 0x1000>;
ranges = <0x02000000 0x0 0xd8000000
0x0 0xd8000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8010000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci2: pcie@ffe202000 {
reg = <0xf 0xfe202000 0 0x1000>;
ranges = <0x02000000 0x0 0xe0000000
0x0 0xe0000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8020000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
fsl,dpaa {
compatible = "fsl,p2041-dpaa", "fsl,dpaa";
ethernet@0 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet3>;
};
ethernet@1 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet0>;
};
};
};
/include/ "fsl/as5710_54x-post.dtsi"
/include/ "fsl/qoriq-dpaa-res1.dtsi"

View File

@@ -9,11 +9,11 @@
powerpc-accton-as5710-54x-r0:
flat_image_tree:
kernel:
kernel:
<<: *e500mc-kernel
dtb:
=: powerpc-accton-as5710-54x-r0.dtb
<<: *e500mc-kernel-package
package: onl-platform-build-powerpc-accton-as5710-54x-r0:powerpc
loader:
device: /dev/sda

View File

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

View File

@@ -0,0 +1,10 @@
include $(ONL)/make/dtbs.mk
#
# The 5710 DTS relies on the common FSL devices trees. These are linked here from the kernel package.
#
setup::
onlpm --link-dir onl-kernel-3.8.13-powerpc-e500mc:powerpc /usr/share/onl/packages/powerpc/onl-kernel-3.8.13-powerpc-e500mc/mbuilds/source/arch/powerpc/boot/dts/fsl fsl
clean::
rm -rf fsl

View File

@@ -0,0 +1,486 @@
/*
* P2041RDB Device Tree Source
*
* Copyright 2011-2012 Freescale Semiconductor Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Freescale Semiconductor nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* ALTERNATIVELY, this software may be distributed under the terms of the
* GNU General Public License ("GPL") as published by the Free Software
* Foundation, either version 2 of that License or (at your option) any
* later version.
*
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/include/ "fsl/as5710_54x-pre.dtsi"
/ {
model = "powerpc-accton-as5710-54x-r0b";
compatible = "accton,as5710_54x";
#address-cells = <2>;
#size-cells = <2>;
interrupt-parent = <&mpic>;
aliases {
ethernet0 = &enet3;
ethernet1 = &enet0;
phy_sgmii_2 = &phy_sgmii_2;
phy_sgmii_1f = &phy_sgmii_1f;
};
memory {
device_type = "memory";
};
dcsr: dcsr@f00000000 {
ranges = <0x00000000 0xf 0x00000000 0x01008000>;
};
bportals: bman-portals@ff4000000 {
ranges = <0x0 0xf 0xf4000000 0x200000>;
};
qportals: qman-portals@ff4200000 {
ranges = <0x0 0xf 0xf4200000 0x200000>;
};
soc: soc@ffe000000 {
ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
reg = <0xf 0xfe000000 0 0x00001000>;
i2c@118000 {
ne1617ads@18 {
compatible = "max1617a";
reg = <0x18>;
};
eeprom@50 {
compatible = "at24,24c256";
reg = <0x50>;
};
rtc: ds1672@68 {
compatible = "ds1672";
reg = <0x68>;
};
};
i2c@118100 {
pca9548@70 {
compatible = "nxp,pca9548";
reg = <0x70>;
#address-cells = <1>;
#size-cells = <0>;
i2c@1 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x1>;
as5710_54x_ac_psu1@38 {
compatible = "acc_as5710_54x_psu";
reg = <0x38>;
};
as5710_54x_dc_psu1@50 {
compatible = "acc_as5710_54x_psu";
reg = <0x50>;
};
cpr_4011_4mxx@3c {
compatible = "cpr_4011_4mxx";
reg = <0x3c>;
};
};
i2c@2 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x2>;
as5710_54x_ac_psu2@3b {
compatible = "acc_as5710_54x_psu";
reg = <0x3b>;
};
as5710_54x_dc_psu2@53 {
compatible = "acc_as5710_54x_psu";
reg = <0x53>;
};
cpr_4011_4mxx@3f {
compatible = "cpr_4011_4mxx";
reg = <0x3f>;
};
};
i2c@5 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x5>;
lm75@48 {
compatible = "lm75";
reg = <0x48>;
};
};
i2c@6 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x6>;
lm75@49 {
compatible = "lm75";
reg = <0x49>;
};
};
i2c@7 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x7>;
lm75@4a{
compatible = "lm75";
reg = <0x4a>;
};
};
};
};
i2c@119000 {
};
i2c@119100 {
accton_i2c_cpld@60 {
compatible = "accton_i2c_cpld";
reg = <0x60>;
};
accton_i2c_cpld@61 {
compatible = "accton_i2c_cpld";
reg = <0x61>;
};
accton_i2c_cpld@62 {
compatible = "accton_i2c_cpld";
reg = <0x62>;
};
acc_as5710_54x_sfp@50 {
compatible = "acc_as5710_54x_sfp";
reg = <0x50>;
};
sfp_dom@51 {
compatible = "at,24c02";
reg = <0x51>;
};
};
usb1: usb@211000 {
dr_mode = "host";
};
fman0: fman@400000 {
enet0: ethernet@e0000 {
tbi-handle = <&tbi0>;
phy-handle = <&phy_sgmii_2>;
phy-connection-type = "sgmii";
};
mdio0: mdio@e1120 {
tbi0: tbi-phy@8 {
reg = <0x8>;
device_type = "tbi-phy";
};
phy_sgmii_2: ethernet-phy@2 {
reg = <0x2>;
};
phy_sgmii_1f: ethernet-phy@1f {
reg = <0x1f>;
};
};
enet3: ethernet@e6000 {
tbi-handle = <&tbi3>;
phy-handle = <&phy_sgmii_1f>;
phy-connection-type = "sgmii";
};
mdio@e7120 {
tbi3: tbi-phy@8 {
reg = <8>;
device_type = "tbi-phy";
};
};
};
};
rio: rapidio@ffe0c0000 {
reg = <0xf 0xfe0c0000 0 0x11000>;
port1 {
ranges = <0 0 0xc 0x20000000 0 0x10000000>;
};
port2 {
ranges = <0 0 0xc 0x30000000 0 0x10000000>;
};
};
lbc: localbus@ffe124000 {
/*orig
reg = <0xf 0xfe124000 0 0x1000>;
ranges = <0 0 0xf 0xe8000000 0x08000000
1 0 0xf 0xffa00000 0x00040000>;
*/
/*miles*/
reg = <0xf 0xfe124000 0 0x1000>;
ranges = <0 0 0xf 0xe8000000 0x08000000>;
nor@0,0 {
#address-cells = <0x1>;
#size-cells = <0x1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x8000000>;
bank-width = <0x2>;
device-width = <0x2>;
byteswap;
partition@0 {
/*RCW 128KB*/
reg = <0x00000000 0x00020000>;
label = "RCW";
read-only;
};
partition@1 {
/*HW info 128KB*/
reg = <0x00020000 0x00020000>;
label = "hw-info";
read-only;
};
partition@2 {
/*ONIE 13MB*/
reg = <0x00040000 0x00d00000>;
label = "onie";
read-only;
};
partition@3 {
/*Diag 20MB*/
reg = <0x00d40000 0x01400000>;
label = "diag";
};
partition@4 {
/*Reserved*/
reg = <0x02140000 0x05E00000>;
label = "open";
};
partition@5 {
/*Firmware (Fman) 128KB*/
reg = <0x07f40000 0x00020000>;
label = "Fman-FW";
read-only;
};
partition@6 {
/*uboot env 128KB*/
reg = <0x07f60000 0x00020000>;
label = "uboot-env";
env_size = <0x2000>;
};
partition@7 {
/*uboot*/
reg = <0x07f80000 0x00080000>;
label = "uboot";
read-only;
};
};
/* orig
flash@0,0 {
compatible = "cfi-flash";
reg = <0 0 0x08000000>;
bank-width = <2>;
device-width = <2>;
};
nand@1,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,elbc-fcm-nand";
reg = <0x1 0x0 0x40000>;
partition@0 {
label = "NAND U-Boot Image";
reg = <0x0 0x02000000>;
read-only;
};
partition@2000000 {
label = "NAND Root File System";
reg = <0x02000000 0x10000000>;
};
partition@12000000 {
label = "NAND Compressed RFS Image";
reg = <0x12000000 0x08000000>;
};
partition@1a000000 {
label = "NAND Linux Kernel Image";
reg = <0x1a000000 0x04000000>;
};
partition@1e000000 {
label = "NAND DTB Image";
reg = <0x1e000000 0x01000000>;
};
partition@1f000000 {
label = "NAND Writable User area";
reg = <0x1f000000 0x01000000>;
};
};
*/
};
/* orig *//*
pci0: pcie@ffe200000 {
reg = <0xf 0xfe200000 0 0x1000>;
ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x20000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci1: pcie@ffe201000 {
reg = <0xf 0xfe201000 0 0x1000>;
ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x20000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci2: pcie@ffe202000 {
reg = <0xf 0xfe202000 0 0x1000>;
ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000
0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x20000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
*/
pci0: pcie@ffe200000 {
reg = <0xf 0xfe200000 0 0x1000>;
ranges = <0x02000000 0x0 0xd0000000
0x0 0xd0000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8000000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci1: pcie@ffe201000 {
reg = <0xf 0xfe201000 0 0x1000>;
ranges = <0x02000000 0x0 0xd8000000
0x0 0xd8000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8010000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci2: pcie@ffe202000 {
reg = <0xf 0xfe202000 0 0x1000>;
ranges = <0x02000000 0x0 0xe0000000
0x0 0xe0000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8020000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
fsl,dpaa {
compatible = "fsl,p2041-dpaa", "fsl,dpaa";
ethernet@0 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet3>;
};
ethernet@1 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet0>;
};
};
};
/include/ "fsl/as5710_54x-post.dtsi"
/include/ "fsl/qoriq-dpaa-res1.dtsi"

View File

@@ -13,7 +13,7 @@ powerpc-accton-as5710-54x-r0b:
<<: *e500mc-kernel
dtb:
=: powerpc-accton-as5710-54x-r0b.dtb
<<: *e500mc-kernel-package
package: onl-platform-build-powerpc-accton-as5710-54x-r0b:powerpc
loader:
device: /dev/sda

View File

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

View File

@@ -0,0 +1,10 @@
include $(ONL)/make/dtbs.mk
#
# The 6700 DTS relies on the common FSL devices trees. These are linked here from the kernel package.
#
setup::
onlpm --link-dir onl-kernel-3.8.13-powerpc-e500mc:powerpc /usr/share/onl/packages/powerpc/onl-kernel-3.8.13-powerpc-e500mc/mbuilds/source/arch/powerpc/boot/dts/fsl fsl
clean::
rm -rf fsl

View File

@@ -0,0 +1,378 @@
/*
* P2041RDB Device Tree Source
*
* Copyright 2011-2012 Freescale Semiconductor Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Freescale Semiconductor nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* ALTERNATIVELY, this software may be distributed under the terms of the
* GNU General Public License ("GPL") as published by the Free Software
* Foundation, either version 2 of that License or (at your option) any
* later version.
*
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/include/ "fsl/as6700_32x-pre.dtsi"
/ {
model = "powerpc-accton-as6700-32x-r0";
compatible = "accton,as6700_32x";
#address-cells = <2>;
#size-cells = <2>;
interrupt-parent = <&mpic>;
aliases {
ethernet0 = &enet3;
ethernet2 = &enet2;
phy_sgmii_2 = &phy_sgmii_2;
phy_sgmii_1e = &phy_sgmii_1e;
phy_sgmii_1 = &phy_sgmii_1;
};
memory {
device_type = "memory";
};
dcsr: dcsr@f00000000 {
ranges = <0x00000000 0xf 0x00000000 0x01008000>;
};
bportals: bman-portals@ff4000000 {
ranges = <0x0 0xf 0xf4000000 0x200000>;
};
qportals: qman-portals@ff4200000 {
ranges = <0x0 0xf 0xf4200000 0x200000>;
};
soc: soc@ffe000000 {
ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
reg = <0xf 0xfe000000 0 0x00001000>;
spi@110000 {
flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "numonyx,n25q512a13";
reg = <0>;
spi-max-frequency = <12000000>; /* input clock */
partition@uboot {
label = "uboot";
reg = <0x00000000 0x00100000>;
};
partition@uboot-env {
label = "uboot-env";
reg = <0x00100000 0x00010000>;
env_size = <0x2000>;
};
partition@Fman-FW {
label = "Fman-FW";
reg = <0x00110000 0x00010000>;
read-only;
};
partition@hw-info {
label = "hw-info";
reg = <0x00120000 0x00010000>;
read-only;
};
partition@onie {
label = "onie";
reg = <0x00130000 0x00800000>;
};
partition@diag {
label = "diag";
reg = <0x00930000 0x01600000>;
};
partition@reserved {
label = "reserved";
reg = <0x01f30000 0x020d0000>;
};
};
};
i2c@118000 {
clock-frequency = <0x18000>;
rtc@68 {
compatible = "dallas,ds1672";
reg = <0x68>;
};
};
i2c@118100 {
clock-frequency = <0x18000>;
accton_i2c_cpld@18 {
compatible = "accton_i2c_cpld";
reg = <0x18>;
};
accton_i2c_cpld@19 {
compatible = "accton_i2c_cpld";
reg = <0x19>;
};
accton_i2c_cpld@1a {
compatible = "accton_i2c_cpld";
reg = <0x1a>;
};
accton_i2c_cpld@20 {
compatible = "accton_i2c_cpld";
reg = <0x20>;
};
accton_i2c_cpld@70 {
compatible = "accton_i2c_cpld";
reg = <0x70>;
};
accton_as6700_32x_sfp@50 {
compatible = "acc_as6700_32x_sfp";
reg = <0x50>;
};
accton_i2c_cpld@31 {
compatible = "accton_i2c_cpld";
reg = <0x31>;
};
accton_i2c_cpld@35 {
compatible = "accton_i2c_cpld";
reg = <0x35>;
};
};
i2c@119000 {
clock-frequency = <0x18000>;
};
i2c@119100 {
clock-frequency = <0x18000>;
pca9546@70 {
compatible = "nxp,pca9546";
reg = <0x70>;
#address-cells = <1>;
#size-cells = <0>;
i2c@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
max6581@4d {
compatible = "max6581";
reg = <0x4d>;
};
};
i2c@2 {
#address-cells = <1>;
#size-cells = <0>;
reg = <2>;
as6700_32x_ac_psu1@3a {
compatible = "acc_as6700_32x_psu";
reg = <0x3a>;
};
cpr_4011_4mxx_psu1@3e {
compatible = "cpr_4011_4mxx";
reg = <0x3e>;
};
as6700_32x_dc_psu1@52 {
compatible = "acc_as6700_32x_psu";
reg = <0x52>;
};
as6700_32x_ac_psu2@39 {
compatible = "acc_as6700_32x_psu";
reg = <0x39>;
};
cpr_4011_4mxx_psu2@3d {
compatible = "cpr_4011_4mxx";
reg = <0x3d>;
};
as6700_32x_dc_psu2@51 {
compatible = "acc_as6700_32x_psu";
reg = <0x51>;
};
};
};
};
usb1: usb@211000 {
dr_mode = "host";
};
fman0: fman@400000 {
enet0: ethernet@e0000 {
tbi-handle = <&tbi0>;
phy-handle = <&phy_sgmii_2>;
phy-connection-type = "sgmii";
};
mdio0: mdio@e1120 {
tbi0: tbi-phy@8 {
reg = <0x8>;
device_type = "tbi-phy";
};
phy_sgmii_2: ethernet-phy@2 {
reg = <0x2>;
};
phy_sgmii_1e: ethernet-phy@1e {
reg = <0x1e>;
};
phy_sgmii_1: ethernet-phy@1 {
reg = <0x1>;
};
};
enet2: ethernet@e4000 {
tbi-handle = <&tbi2>;
phy-handle = <&phy_sgmii_1e>;
phy-connection-type = "sgmii";
};
mdio@e5120 {
tbi2: tbi-phy@8 {
reg = <8>;
device_type = "tbi-phy";
};
};
enet3: ethernet@e6000 {
tbi-handle = <&tbi3>;
phy-handle = <&phy_sgmii_1>;
phy-connection-type = "sgmii";
};
mdio@e7120 {
tbi3: tbi-phy@8 {
reg = <8>;
device_type = "tbi-phy";
};
};
};
};
rio: rapidio@ffe0c0000 {
reg = <0xf 0xfe0c0000 0 0x11000>;
port1 {
ranges = <0 0 0xc 0x20000000 0 0x10000000>;
};
port2 {
ranges = <0 0 0xc 0x30000000 0 0x10000000>;
};
};
lbc: localbus@ffe124000 {
reg = <0xf 0xfe124000 0 0x1000>;
ranges = <0 0 0xf 0xec000000 0x04000000>;
flash@0,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0 0 0x04000000>;
bank-width = <2>;
device-width = <2>;
};
};
pci0: pcie@ffe200000 {
reg = <0xf 0xfe200000 0 0x1000>;
ranges = <0x02000000 0x0 0xd0000000
0x0 0xd0000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8000000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci1: pcie@ffe201000 {
reg = <0xf 0xfe201000 0 0x1000>;
ranges = <0x02000000 0x0 0xd8000000
0x0 0xd8000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8010000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci2: pcie@ffe202000 {
reg = <0xf 0xfe202000 0 0x1000>;
ranges = <0x02000000 0x0 0xe0000000
0x0 0xe0000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8020000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
fsl,dpaa {
compatible = "fsl,p2041-dpaa", "fsl,dpaa";
ethernet@0 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet0>;
};
ethernet@2 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet2>;
};
ethernet@3 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet3>;
};
};
};
/include/ "fsl/as6700_32x-post.dtsi"
/include/ "fsl/qoriq-dpaa-res1.dtsi"

View File

@@ -13,7 +13,7 @@ powerpc-accton-as6700-32x-r0:
<<: *e500mc-kernel
dtb:
=: powerpc-accton-as6700-32x-r0.dtb
<<: *e500mc-kernel-package
package: onl-platform-build-powerpc-accton-as6700-32x-r0:powerpc
loader:
device: /dev/sda

View File

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

View File

@@ -0,0 +1,10 @@
include $(ONL)/make/dtbs.mk
#
# The 5710 DTS relies on the common FSL devices trees. These are linked here from the kernel package.
#
setup::
onlpm --link-dir onl-kernel-3.8.13-powerpc-e500mc:powerpc /usr/share/onl/packages/powerpc/onl-kernel-3.8.13-powerpc-e500mc/mbuilds/source/arch/powerpc/boot/dts/fsl fsl
clean::
rm -rf fsl

View File

@@ -0,0 +1,378 @@
/*
* P2041RDB Device Tree Source
*
* Copyright 2011-2012 Freescale Semiconductor Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Freescale Semiconductor nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* ALTERNATIVELY, this software may be distributed under the terms of the
* GNU General Public License ("GPL") as published by the Free Software
* Foundation, either version 2 of that License or (at your option) any
* later version.
*
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/include/ "fsl/as6700_32x-pre.dtsi"
/ {
model = "powerpc-accton-as6700-32x-r1";
compatible = "accton,as6700_32x";
#address-cells = <2>;
#size-cells = <2>;
interrupt-parent = <&mpic>;
aliases {
ethernet0 = &enet3;
ethernet2 = &enet2;
phy_sgmii_2 = &phy_sgmii_2;
phy_sgmii_1e = &phy_sgmii_1e;
phy_sgmii_1 = &phy_sgmii_1;
};
memory {
device_type = "memory";
};
dcsr: dcsr@f00000000 {
ranges = <0x00000000 0xf 0x00000000 0x01008000>;
};
bportals: bman-portals@ff4000000 {
ranges = <0x0 0xf 0xf4000000 0x200000>;
};
qportals: qman-portals@ff4200000 {
ranges = <0x0 0xf 0xf4200000 0x200000>;
};
soc: soc@ffe000000 {
ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
reg = <0xf 0xfe000000 0 0x00001000>;
spi@110000 {
flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "numonyx,n25q512a13", "s25fl512s";
reg = <0>;
spi-max-frequency = <12000000>; /* input clock */
partition@uboot {
label = "uboot";
reg = <0x00000000 0x00100000>;
};
partition@uboot-env {
label = "uboot-env";
reg = <0x00100000 0x00040000>;
env_size = <0x2000>;
};
partition@Fman-FW {
label = "Fman-FW";
reg = <0x00140000 0x00040000>;
read-only;
};
partition@hw-info {
label = "hw-info";
reg = <0x00180000 0x00040000>;
read-only;
};
partition@onie {
label = "onie";
reg = <0x001c0000 0x00800000>;
};
partition@diag {
label = "diag";
reg = <0x009c0000 0x02000000>;
};
partition@reserved {
label = "reserved";
reg = <0x029c0000 0x01640000>;
};
};
};
i2c@118000 {
clock-frequency = <0x18000>;
rtc@68 {
compatible = "dallas,ds1672";
reg = <0x68>;
};
};
i2c@118100 {
clock-frequency = <0x18000>;
accton_i2c_cpld@18 {
compatible = "accton_i2c_cpld";
reg = <0x18>;
};
accton_i2c_cpld@19 {
compatible = "accton_i2c_cpld";
reg = <0x19>;
};
accton_i2c_cpld@1a {
compatible = "accton_i2c_cpld";
reg = <0x1a>;
};
accton_i2c_cpld@20 {
compatible = "accton_i2c_cpld";
reg = <0x20>;
};
accton_i2c_cpld@70 {
compatible = "accton_i2c_cpld";
reg = <0x70>;
};
accton_as6700_32x_sfp@50 {
compatible = "acc_as6700_32x_sfp";
reg = <0x50>;
};
accton_i2c_cpld@31 {
compatible = "accton_i2c_cpld";
reg = <0x31>;
};
accton_i2c_cpld@35 {
compatible = "accton_i2c_cpld";
reg = <0x35>;
};
};
i2c@119000 {
clock-frequency = <0x18000>;
};
i2c@119100 {
clock-frequency = <0x18000>;
pca9546@70 {
compatible = "nxp,pca9546";
reg = <0x70>;
#address-cells = <1>;
#size-cells = <0>;
i2c@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
max6581@4d {
compatible = "max6581";
reg = <0x4d>;
};
};
i2c@2 {
#address-cells = <1>;
#size-cells = <0>;
reg = <2>;
as6700_32x_ac_psu1@3a {
compatible = "acc_as6700_32x_psu";
reg = <0x3a>;
};
cpr_4011_4mxx_psu1@3e {
compatible = "cpr_4011_4mxx";
reg = <0x3e>;
};
as6700_32x_dc_psu1@52 {
compatible = "acc_as6700_32x_psu";
reg = <0x52>;
};
as6700_32x_ac_psu2@39 {
compatible = "acc_as6700_32x_psu";
reg = <0x39>;
};
cpr_4011_4mxx_psu2@3d {
compatible = "cpr_4011_4mxx";
reg = <0x3d>;
};
as6700_32x_dc_psu2@51 {
compatible = "acc_as6700_32x_psu";
reg = <0x51>;
};
};
};
};
usb1: usb@211000 {
dr_mode = "host";
};
fman0: fman@400000 {
enet0: ethernet@e0000 {
tbi-handle = <&tbi0>;
phy-handle = <&phy_sgmii_2>;
phy-connection-type = "sgmii";
};
mdio0: mdio@e1120 {
tbi0: tbi-phy@8 {
reg = <0x8>;
device_type = "tbi-phy";
};
phy_sgmii_2: ethernet-phy@2 {
reg = <0x2>;
};
phy_sgmii_1e: ethernet-phy@1e {
reg = <0x1e>;
};
phy_sgmii_1: ethernet-phy@1 {
reg = <0x1>;
};
};
enet2: ethernet@e4000 {
tbi-handle = <&tbi2>;
phy-handle = <&phy_sgmii_1e>;
phy-connection-type = "sgmii";
};
mdio@e5120 {
tbi2: tbi-phy@8 {
reg = <8>;
device_type = "tbi-phy";
};
};
enet3: ethernet@e6000 {
tbi-handle = <&tbi3>;
phy-handle = <&phy_sgmii_1>;
phy-connection-type = "sgmii";
};
mdio@e7120 {
tbi3: tbi-phy@8 {
reg = <8>;
device_type = "tbi-phy";
};
};
};
};
rio: rapidio@ffe0c0000 {
reg = <0xf 0xfe0c0000 0 0x11000>;
port1 {
ranges = <0 0 0xc 0x20000000 0 0x10000000>;
};
port2 {
ranges = <0 0 0xc 0x30000000 0 0x10000000>;
};
};
lbc: localbus@ffe124000 {
reg = <0xf 0xfe124000 0 0x1000>;
ranges = <0 0 0xf 0xec000000 0x04000000>;
flash@0,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0 0 0x04000000>;
bank-width = <2>;
device-width = <2>;
};
};
pci0: pcie@ffe200000 {
reg = <0xf 0xfe200000 0 0x1000>;
ranges = <0x02000000 0x0 0xd0000000
0x0 0xd0000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8000000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci1: pcie@ffe201000 {
reg = <0xf 0xfe201000 0 0x1000>;
ranges = <0x02000000 0x0 0xd8000000
0x0 0xd8000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8010000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
pci2: pcie@ffe202000 {
reg = <0xf 0xfe202000 0 0x1000>;
ranges = <0x02000000 0x0 0xe0000000
0x0 0xe0000000
0x0 0x08000000
0x01000000 0x0 0x00000000
0x0 0xf8020000
0x0 0x00010000>;
pcie@0 {
ranges = <0x02000000 0 0xe0000000
0x02000000 0 0xe0000000
0 0x08000000
0x01000000 0 0x00000000
0x01000000 0 0x00000000
0 0x00010000>;
};
};
fsl,dpaa {
compatible = "fsl,p2041-dpaa", "fsl,dpaa";
ethernet@0 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet0>;
};
ethernet@2 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet2>;
};
ethernet@3 {
compatible = "fsl,p2041-dpa-ethernet", "fsl,dpa-ethernet";
fsl,fman-mac = <&enet3>;
};
};
};
/include/ "fsl/as6700_32x-post.dtsi"
/include/ "fsl/qoriq-dpaa-res1.dtsi"

View File

@@ -13,7 +13,7 @@ powerpc-accton-as6700-32x-r1:
<<: *e500mc-kernel
dtb:
=: powerpc-accton-as6700-32x-r1.dtb
<<: *e500mc-kernel-package
package: onl-platform-build-powerpc-accton-as6700-32x-r1:powerpc
loader:
device: /dev/sda

View File

@@ -32,15 +32,23 @@
#include <linux/sysfs.h>
#include <linux/slab.h>
#define PSU_STATUS_I2C_ADDR 0x60
#define PSU_STATUS_I2C_REG_OFFSET 0x2
#define IS_POWER_GOOD(id, value) (!!(value & BIT(id*4 + 1)))
#define IS_PRESENT(id, value) (!(value & BIT(id*4)))
static ssize_t show_index(struct device *dev, struct device_attribute *da, char *buf);
static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf);
static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf);
static int as5812_54t_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len);
extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg);
static int as5812_54t_psu_model_name_get(struct device *dev);
/* Addresses scanned
*/
static const unsigned short normal_i2c[] = { 0x38, 0x3b, 0x50, 0x53, I2C_CLIENT_END };
static const unsigned short normal_i2c[] = { I2C_CLIENT_END };
/* Each client has this additional data
*/
@@ -94,11 +102,15 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da,
struct as5812_54t_psu_data *data = as5812_54t_psu_update_device(dev);
u8 status = 0;
if (!data->valid) {
return sprintf(buf, "0\n");
}
if (attr->index == PSU_PRESENT) {
status = !(data->status >> ((data->index - 1) * 4) & 0x1);
status = IS_PRESENT(data->index, data->status);
}
else { /* PSU_POWER_GOOD */
status = data->status >> ((data->index - 1) * 4 + 1) & 0x1;
status = IS_POWER_GOOD(data->index, data->status);
}
return sprintf(buf, "%d\n", status);
@@ -108,8 +120,20 @@ static ssize_t show_model_name(struct device *dev, struct device_attribute *da,
char *buf)
{
struct as5812_54t_psu_data *data = as5812_54t_psu_update_device(dev);
return sprintf(buf, "%s", data->model_name);
if (!data->valid) {
return 0;
}
if (!IS_PRESENT(data->index, data->status)) {
return 0;
}
if (as5812_54t_psu_model_name_get(dev) < 0) {
return -ENXIO;
}
return sprintf(buf, "%s\n", data->model_name);
}
static const struct attribute_group as5812_54t_psu_group = {
@@ -135,6 +159,7 @@ static int as5812_54t_psu_probe(struct i2c_client *client,
i2c_set_clientdata(client, data);
data->valid = 0;
data->index = dev_id->driver_data;
mutex_init(&data->update_lock);
dev_info(&client->dev, "chip found\n");
@@ -151,14 +176,6 @@ static int as5812_54t_psu_probe(struct i2c_client *client,
goto exit_remove;
}
/* Update PSU index */
if (client->addr == 0x38 || client->addr == 0x50) {
data->index = 1;
}
else if (client->addr == 0x3b || client->addr == 0x53) {
data->index = 2;
}
dev_info(&client->dev, "%s: psu '%s'\n",
dev_name(data->hwmon_dev), client->name);
@@ -184,8 +201,15 @@ static int as5812_54t_psu_remove(struct i2c_client *client)
return 0;
}
enum psu_index
{
as5812_54t_psu1,
as5812_54t_psu2
};
static const struct i2c_device_id as5812_54t_psu_id[] = {
{ "as5812_54t_psu", 0 },
{ "as5812_54t_psu1", as5812_54t_psu1 },
{ "as5812_54t_psu2", as5812_54t_psu2 },
{}
};
MODULE_DEVICE_TABLE(i2c, as5812_54t_psu_id);
@@ -219,6 +243,76 @@ abort:
return result;
}
enum psu_type {
PSU_YM_2401_JCR, /* AC110V - F2B */
PSU_YM_2401_JDR, /* AC110V - B2F */
PSU_CPR_4011_4M11, /* AC110V - F2B */
PSU_CPR_4011_4M21, /* AC110V - B2F */
PSU_CPR_6011_2M11, /* AC110V - F2B */
PSU_CPR_6011_2M21, /* AC110V - B2F */
PSU_UM400D_01G, /* DC48V - F2B */
PSU_UM400D01_01G /* DC48V - B2F */
};
struct model_name_info {
enum psu_type type;
u8 offset;
u8 length;
char* model_name;
};
struct model_name_info models[] = {
{PSU_YM_2401_JCR, 0x20, 11, "YM-2401JCR"},
{PSU_YM_2401_JDR, 0x20, 11, "YM-2401JDR"},
{PSU_CPR_4011_4M11, 0x26, 13, "CPR-4011-4M11"},
{PSU_CPR_4011_4M21, 0x26, 13, "CPR-4011-4M21"},
{PSU_CPR_6011_2M11, 0x26, 13, "CPR-6011-2M11"},
{PSU_CPR_6011_2M21, 0x26, 13, "CPR-6011-2M21"},
{PSU_UM400D_01G, 0x50, 9, "um400d01G"},
{PSU_UM400D01_01G, 0x50, 12, "um400d01-01G"},
};
static int as5812_54t_psu_model_name_get(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct as5812_54t_psu_data *data = i2c_get_clientdata(client);
int i, status;
for (i = 0; i < ARRAY_SIZE(models); i++) {
memset(data->model_name, 0, sizeof(data->model_name));
status = as5812_54t_psu_read_block(client, models[i].offset,
data->model_name, models[i].length);
if (status < 0) {
data->model_name[0] = '\0';
dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n",
client->addr, models[i].offset);
return status;
}
else {
data->model_name[models[i].length] = '\0';
}
if (i == PSU_YM_2401_JCR || i == PSU_YM_2401_JDR) {
/* Skip the meaningless data byte 8*/
data->model_name[8] = data->model_name[9];
data->model_name[9] = data->model_name[10];
data->model_name[10] = '\0';
}
/* Determine if the model name is known, if not, read next index
*/
if (strncmp(data->model_name, models[i].model_name, models[i].length) == 0) {
return 0;
}
else {
data->model_name[0] = '\0';
}
}
return -ENODATA;
}
static struct as5812_54t_psu_data *as5812_54t_psu_update_device(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@@ -231,41 +325,24 @@ static struct as5812_54t_psu_data *as5812_54t_psu_update_device(struct device *d
int status = -1;
dev_dbg(&client->dev, "Starting as5812_54t update\n");
/* Read model name */
if (client->addr == 0x38 || client->addr == 0x3b) {
/* AC power */
status = as5812_54t_psu_read_block(client, 0x26, data->model_name,
ARRAY_SIZE(data->model_name)-1);
}
else {
/* DC power */
status = as5812_54t_psu_read_block(client, 0x50, data->model_name,
ARRAY_SIZE(data->model_name)-1);
}
if (status < 0) {
data->model_name[0] = '\0';
dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr);
}
else {
data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0';
}
data->valid = 0;
/* Read psu status */
status = accton_i2c_cpld_read(0x60, 0x2);
status = accton_i2c_cpld_read(PSU_STATUS_I2C_ADDR, PSU_STATUS_I2C_REG_OFFSET);
if (status < 0) {
dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status);
dev_dbg(&client->dev, "cpld reg (0x%x) err %d\n", PSU_STATUS_I2C_ADDR, status);
goto exit;
}
else {
data->status = status;
}
data->last_updated = jiffies;
data->valid = 1;
}
exit:
mutex_unlock(&data->update_lock);
return data;
@@ -273,10 +350,10 @@ static struct as5812_54t_psu_data *as5812_54t_psu_update_device(struct device *d
static int __init as5812_54t_psu_init(void)
{
extern int platform_accton_as5812_54t(void);
if (!platform_accton_as5812_54t()) {
return -ENODEV;
}
extern int platform_accton_as5812_54t(void);
if (!platform_accton_as5812_54t()) {
return -ENODEV;
}
return i2c_add_driver(&as5812_54t_psu_driver);
}

View File

@@ -24,7 +24,8 @@
*
***********************************************************/
#include <onlp/platformi/fani.h>
#include <onlplib/mmap.h>
#include <unistd.h>
#include <onlplib/file.h>
#include <fcntl.h>
#include "platform_lib.h"
@@ -51,7 +52,7 @@ typedef struct last_path_S
char status[LEN_FILE_NAME];
char speed[LEN_FILE_NAME];
char direction[LEN_FILE_NAME];
char ctrl_speed[LEN_FILE_NAME];
char ctrl_speed[LEN_FILE_NAME];
char r_status[LEN_FILE_NAME];
char r_speed[LEN_FILE_NAME];
}last_path_T;
@@ -74,10 +75,10 @@ static last_path_T last_path[] = /* must map with onlp_fan_id */
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_2_ON_MAIN_BOARD),
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_3_ON_MAIN_BOARD),
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_4_ON_MAIN_BOARD),
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD),
MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD),
MAKE_FAN_LAST_PATH_ON_PSU(11-003c),
MAKE_FAN_LAST_PATH_ON_PSU(12-003f),
MAKE_FAN_LAST_PATH_ON_PSU(11-003c),
MAKE_FAN_LAST_PATH_ON_PSU(12-003f),
};
#define MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(id) \
@@ -135,11 +136,11 @@ onlp_fan_info_t linfo[] = {
/* PSU relative marco */
#define SET_PSU_TYPE_CPR_4011_F2B_FAN(info) \
#define SET_PSU_TYPE_AC_F2B_FAN(info) \
info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B); \
info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE
#define SET_PSU_TYPE_CPR_4011_B2F_FAN(info) \
#define SET_PSU_TYPE_AC_B2F_FAN(info) \
info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \
info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE
@@ -156,7 +157,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
int fd, len, nbytes = 10;
char r_data[10] = {0};
char fullpath[65] = {0};
/* get fan/fanr fault status (turn on when any one fails)
*/
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status);
@@ -199,10 +200,26 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
return ONLP_STATUS_OK;
}
static int
_onlp_fani_info_get_fan_on_psu_ym2401(int pid, onlp_fan_info_t* info)
{
int val = 0;
/* get fan status
*/
if (psu_ym2401_pmbus_info_get(pid, "psu_fan1_speed_rpm", &val) == ONLP_STATUS_OK) {
info->status |= (val > 0) ? 0 : ONLP_FAN_STATUS_FAILED;
info->rpm = val;
info->percentage = (info->rpm * 100) / 21600;
}
return ONLP_STATUS_OK;
}
static int
_onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
{
int psu_id, is_ac=0;
int psu_id;
int fd, len, nbytes = 10;
char r_data[10] = {0};
char fullpath[50] = {0};
@@ -211,24 +228,19 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
/* get fan other cap status according to psu type
*/
psu_id = (local_id-FAN_1_ON_PSU1) + 1;
if (LOCAL_DEBUG)
printf("[Debug][%s][%d][psu_id: %d]\n", __FUNCTION__, __LINE__, psu_id);
DEBUG_PRINT("[psu_id: %d]", psu_id);
psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */
if (LOCAL_DEBUG)
printf("[Debug][%s][%d][psu_type: %d]\n", __FUNCTION__, __LINE__, psu_type);
DEBUG_PRINT("[psu_type: %d]", psu_type);
switch (psu_type) {
case PSU_TYPE_AC_F2B:
SET_PSU_TYPE_CPR_4011_F2B_FAN(info);
is_ac = 1;
case PSU_TYPE_AC_COMPUWARE_F2B:
case PSU_TYPE_AC_3YPOWER_F2B:
SET_PSU_TYPE_AC_F2B_FAN(info);
break;
case PSU_TYPE_AC_B2F:
SET_PSU_TYPE_CPR_4011_B2F_FAN(info);
is_ac = 1;
case PSU_TYPE_AC_COMPUWARE_B2F:
case PSU_TYPE_AC_3YPOWER_B2F:
SET_PSU_TYPE_AC_B2F_FAN(info);
break;
case PSU_TYPE_DC_48V_F2B:
SET_PSU_TYPE_UM400D_F2B_FAN(info);
@@ -243,7 +255,8 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
break;
}
if (1 == is_ac)
if (psu_type == PSU_TYPE_AC_COMPUWARE_F2B ||
psu_type == PSU_TYPE_AC_COMPUWARE_B2F )
{
/* get fan fault status
*/
@@ -259,10 +272,14 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
info->rpm = atoi(r_data);
/* get speed percentage from rpm */
info->percentage = (info->rpm * 100)/19328;
info->percentage = (info->rpm * 100)/19328;
}
else if (psu_type == PSU_TYPE_AC_3YPOWER_F2B ||
psu_type == PSU_TYPE_AC_3YPOWER_B2F )
{
return _onlp_fani_info_get_fan_on_psu_ym2401(psu_id, info);
}
return ONLP_STATUS_OK;
}
@@ -284,17 +301,17 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
int local_id;
VALIDATE(id);
local_id = ONLP_OID_ID_GET(id);
*info = linfo[local_id];
if (LOCAL_DEBUG)
printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id);
switch (local_id)
{
case FAN_1_ON_PSU1:
case FAN_1_ON_PSU1:
case FAN_1_ON_PSU2:
rc = _onlp_fani_info_get_fan_on_psu(local_id, info);
break;
@@ -302,8 +319,8 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
default:
rc =_onlp_fani_info_get_fan(local_id, info);
break;
}
}
return rc;
}
@@ -321,7 +338,6 @@ onlp_fani_rpm_set(onlp_oid_t id, int rpm)
return ONLP_STATUS_E_UNSUPPORTED;
}
/*
* This function sets the fan speed of the given OID as a percentage.
*
@@ -335,20 +351,31 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
{
int fd, len, nbytes=10, local_id;
char data[10] = {0};
char fullpath[70] = {0};
char fullpath[70] = {0};
int psu_id;
psu_type_t psu_type;
VALIDATE(id);
local_id = ONLP_OID_ID_GET(id);
/* reject p=0 (p=0, stop fan) */
if (p == 0){
return ONLP_STATUS_E_INVALID;
}
psu_id = local_id - FAN_1_ON_PSU1 + 1;
psu_type = get_psu_type(psu_id, NULL, 0);
if (psu_type == PSU_TYPE_AC_3YPOWER_F2B ||
psu_type == PSU_TYPE_AC_3YPOWER_B2F )
{
return psu_ym2401_pmbus_info_set(psu_id, "psu_fan1_duty_cycle_percentage", p);
}
/* get fullpath */
switch (local_id)
{
{
case FAN_1_ON_PSU1:
case FAN_1_ON_PSU2:
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed);
@@ -357,12 +384,12 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].ctrl_speed);
break;
}
sprintf(data, "%d", p);
if (LOCAL_DEBUG)
printf("[Debug][%s][%d][openfile: %s][data=%s]\n", __FUNCTION__, __LINE__, fullpath, data);
/* Create output file descriptor */
fd = open(fullpath, O_WRONLY, 0644);
if(fd == -1){
@@ -373,7 +400,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
if(len != nbytes){
close(fd);
return ONLP_STATUS_E_INTERNAL;
}
}
close(fd);
return ONLP_STATUS_OK;

View File

@@ -23,12 +23,13 @@
*
*
***********************************************************/
#include <sys/mman.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <onlp/onlp.h>
#include <onlplib/file.h>
#include <AIM/aim.h>
#include "platform_lib.h"
@@ -121,6 +122,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le
}
#define I2C_PSU_MODEL_NAME_LEN 13
#define STRLEN(x) (sizeof(x) - 1)
psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
{
@@ -128,50 +130,73 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
char model_name[I2C_PSU_MODEL_NAME_LEN + 1] = {0};
/* Check AC model name */
node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_model_name) : PSU2_AC_HWMON_NODE(psu_model_name);
node = (id == PSU1_ID) ? PSU1_AC_EEPROM_NODE(psu_model_name) : PSU2_AC_EEPROM_NODE(psu_model_name);
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) {
if (modelname) {
strncpy(modelname, model_name, modelname_len-1);
}
return PSU_TYPE_AC_F2B;
}
else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) {
if (modelname) {
strncpy(modelname, model_name, modelname_len-1);
}
return PSU_TYPE_AC_B2F;
}
else if (strncmp(model_name, "CPR-6011-2M11", strlen("CPR-6011-2M11")) == 0) {
if (strncmp(model_name, "CPR-4011-4M11", STRLEN("CPR-4011-4M11")) == 0) {
if (modelname) {
strncpy(modelname, model_name, modelname_len-1);
strncpy(modelname, model_name, sizeof(model_name));
}
return PSU_TYPE_AC_F2B;
return PSU_TYPE_AC_COMPUWARE_F2B;
}
else if (strncmp(model_name, "CPR-6011-2M21", strlen("CPR-6011-2M21")) == 0) {
else if (strncmp(model_name, "CPR-4011-4M21", STRLEN("CPR-4011-4M21")) == 0) {
if (modelname) {
strncpy(modelname, model_name, modelname_len-1);
strncpy(modelname, model_name, sizeof(model_name));
}
return PSU_TYPE_AC_B2F;
return PSU_TYPE_AC_COMPUWARE_B2F;
}
else if (strncmp(model_name, "CPR-6011-2M11", STRLEN("CPR-6011-2M11")) == 0) {
if (modelname) {
strncpy(modelname, model_name, sizeof(model_name));
}
return PSU_TYPE_AC_COMPUWARE_F2B;
}
else if (strncmp(model_name, "CPR-6011-2M21", STRLEN("CPR-6011-2M21")) == 0) {
if (modelname) {
strncpy(modelname, model_name, sizeof(model_name));
}
return PSU_TYPE_AC_COMPUWARE_B2F;
}
}
/* Check 3Y-Power AC model name */
memset(model_name, 0, sizeof(model_name));
node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name);
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
if (strncmp(model_name, "YM-2401JCR", STRLEN("YM-2401JCR")) == 0) {
if (modelname) {
model_name[STRLEN("YM-2401JCR")] = 0;
strncpy(modelname, model_name, 11);
}
return PSU_TYPE_AC_3YPOWER_F2B;
}
else if (strncmp(model_name, "YM-2401JDR", STRLEN("YM-2401JDR")) == 0) {
if (modelname) {
model_name[STRLEN("YM-2401JDR")] = 0;
strncpy(modelname, model_name, 11);
}
return PSU_TYPE_AC_3YPOWER_B2F;
}
}
/* Check DC model name */
memset(model_name, 0, sizeof(model_name));
node = (id == PSU1_ID) ? PSU1_DC_HWMON_NODE(psu_model_name) : PSU2_DC_HWMON_NODE(psu_model_name);
node = (id == PSU1_ID) ? PSU1_DC_EEPROM_NODE(psu_model_name) : PSU2_DC_EEPROM_NODE(psu_model_name);
if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) {
if (modelname) {
strncpy(modelname, model_name, modelname_len-1);
}
if (strncmp(model_name, "um400d01G", STRLEN("um400d01G")) == 0) {
if (modelname) {
model_name[STRLEN("um400d01G")] = 0;
strncpy(modelname, model_name, 10);
}
return PSU_TYPE_DC_48V_B2F;
}
else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) {
if (modelname) {
strncpy(modelname, model_name, modelname_len-1);
}
else if (strncmp(model_name, "um400d01-01G", STRLEN("um400d01-01G")) == 0) {
if (modelname) {
model_name[STRLEN("um400d01-01G")] = 0;
strncpy(modelname, model_name, 13);
}
return PSU_TYPE_DC_48V_F2B;
}
}
@@ -179,3 +204,48 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
return PSU_TYPE_UNKNOWN;
}
int psu_ym2401_pmbus_info_get(int id, char *node, int *value)
{
int ret = 0;
char path[64] = {0};
*value = 0;
if (PSU1_ID == id) {
sprintf(path, "%s%s", PSU1_AC_3YPOWER_PMBUS_PREFIX, node);
}
else {
sprintf(path, "%s%s", PSU2_AC_3YPOWER_PMBUS_PREFIX, node);
}
if (onlp_file_read_int(value, path) < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", path);
return ONLP_STATUS_E_INTERNAL;
}
return ret;
}
int psu_ym2401_pmbus_info_set(int id, char *node, int value)
{
char path[64] = {0};
switch (id) {
case PSU1_ID:
sprintf(path, "%s%s", PSU1_AC_3YPOWER_PMBUS_PREFIX, node);
break;
case PSU2_ID:
sprintf(path, "%s%s", PSU2_AC_3YPOWER_PMBUS_PREFIX, node);
break;
default:
return ONLP_STATUS_E_UNSUPPORTED;
};
if (deviceNodeWriteInt(path, value, 0) < 0) {
AIM_LOG_ERROR("Unable to write data to file (%s)\r\n", path);
return ONLP_STATUS_E_INTERNAL;
}
return ONLP_STATUS_OK;
}

View File

@@ -34,18 +34,24 @@
#define CHASSIS_FAN_COUNT 5
#define CHASSIS_THERMAL_COUNT 4
#define PSU1_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/11-003c/"
#define PSU2_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/12-003f/"
#define PSU1_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/11-003c/" /* Compuware psu */
#define PSU2_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/12-003f/" /* Compuware psu */
#define PSU1_AC_3YPOWER_PMBUS_PREFIX "/sys/bus/i2c/devices/11-0058/" /* 3YPower psu */
#define PSU2_AC_3YPOWER_PMBUS_PREFIX "/sys/bus/i2c/devices/12-005b/" /* 3YPower psu */
#define PSU1_AC_HWMON_PREFIX "/sys/bus/i2c/devices/11-0038/"
#define PSU1_DC_HWMON_PREFIX "/sys/bus/i2c/devices/11-0050/"
#define PSU2_AC_HWMON_PREFIX "/sys/bus/i2c/devices/12-003b/"
#define PSU2_DC_HWMON_PREFIX "/sys/bus/i2c/devices/12-0053/"
#define PSU1_AC_EEPROM_PREFIX "/sys/bus/i2c/devices/11-0038/"
#define PSU1_DC_EEPROM_PREFIX "/sys/bus/i2c/devices/11-0050/"
#define PSU2_AC_EEPROM_PREFIX "/sys/bus/i2c/devices/12-003b/"
#define PSU2_DC_EEPROM_PREFIX "/sys/bus/i2c/devices/12-0053/"
#define PSU1_AC_3YPOWER_EEPROM_PREFIX "/sys/bus/i2c/devices/11-0050/"
#define PSU2_AC_3YPOWER_EEPROM_PREFIX "/sys/bus/i2c/devices/12-0053/"
#define PSU1_AC_HWMON_NODE(node) PSU1_AC_HWMON_PREFIX#node
#define PSU1_DC_HWMON_NODE(node) PSU1_DC_HWMON_PREFIX#node
#define PSU2_AC_HWMON_NODE(node) PSU2_AC_HWMON_PREFIX#node
#define PSU2_DC_HWMON_NODE(node) PSU2_DC_HWMON_PREFIX#node
#define PSU1_AC_EEPROM_NODE(node) PSU1_AC_EEPROM_PREFIX#node
#define PSU1_DC_EEPROM_NODE(node) PSU1_DC_EEPROM_PREFIX#node
#define PSU2_AC_EEPROM_NODE(node) PSU2_AC_EEPROM_PREFIX#node
#define PSU2_DC_EEPROM_NODE(node) PSU2_DC_EEPROM_PREFIX#node
#define PSU1_AC_3YPOWER_EEPROM_NODE(node) PSU1_AC_3YPOWER_EEPROM_PREFIX#node
#define PSU2_AC_3YPOWER_EEPROM_NODE(node) PSU2_AC_3YPOWER_EEPROM_PREFIX#node
#define IDPROM_PATH "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/1-0057/eeprom"
@@ -55,12 +61,25 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le
typedef enum psu_type {
PSU_TYPE_UNKNOWN,
PSU_TYPE_AC_F2B,
PSU_TYPE_AC_B2F,
PSU_TYPE_AC_COMPUWARE_F2B,
PSU_TYPE_AC_COMPUWARE_B2F,
PSU_TYPE_AC_3YPOWER_F2B,
PSU_TYPE_AC_3YPOWER_B2F,
PSU_TYPE_DC_48V_F2B,
PSU_TYPE_DC_48V_B2F
} psu_type_t;
psu_type_t get_psu_type(int id, char* modelname, int modelname_len);
int psu_ym2401_pmbus_info_get(int id, char *node, int *value);
int psu_ym2401_pmbus_info_set(int id, char *node, int value);
#define DEBUG_MODE 0
#if (DEBUG_MODE == 1)
#define DEBUG_PRINT(fmt, args...) \
printf("%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args)
#else
#define DEBUG_PRINT(fmt, args...)
#endif
#endif /* __PLATFORM_LIB_H__ */

View File

@@ -24,7 +24,6 @@
*
***********************************************************/
#include <onlp/platformi/psui.h>
#include <onlplib/mmap.h>
#include <stdio.h>
#include <string.h>
#include "platform_lib.h"
@@ -52,10 +51,10 @@ psu_status_info_get(int id, int is_ac, char *node, int *value)
*value = 0;
if (PSU1_ID == id) {
sprintf(node_path, "%s%s", is_ac ? PSU1_AC_HWMON_PREFIX : PSU1_DC_HWMON_PREFIX, node);
sprintf(node_path, "%s%s", is_ac ? PSU1_AC_EEPROM_PREFIX : PSU1_DC_EEPROM_PREFIX, node);
}
else if (PSU2_ID == id) {
sprintf(node_path, "%s%s", is_ac ? PSU2_AC_HWMON_PREFIX : PSU2_DC_HWMON_PREFIX, node);
sprintf(node_path, "%s%s", is_ac ? PSU2_AC_EEPROM_PREFIX : PSU2_DC_EEPROM_PREFIX, node);
}
ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0);
@@ -108,9 +107,9 @@ psu_cpr_4011_info_get(onlp_psu_info_t* info)
*/
info->caps = ONLP_PSU_CAPS_AC;
if (info->status & ONLP_PSU_STATUS_FAILED) {
return ONLP_STATUS_OK;
}
if (info->status & ONLP_PSU_STATUS_FAILED) {
return ONLP_STATUS_OK;
}
/* Set the associated oid_table */
info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT);
@@ -169,6 +168,43 @@ psu_um400d_info_get(onlp_psu_info_t* info)
return ONLP_STATUS_OK;
}
static int
psu_ym2401_info_get(onlp_psu_info_t* info)
{
int val = 0;
int index = ONLP_OID_ID_GET(info->hdr.id);
/* Set capability
*/
info->caps = ONLP_PSU_CAPS_AC;
if (info->status & ONLP_PSU_STATUS_FAILED) {
return ONLP_STATUS_OK;
}
/* Set the associated oid_table */
info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT);
info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(index + CHASSIS_THERMAL_COUNT);
/* Read voltage, current and power */
if (psu_ym2401_pmbus_info_get(index, "psu_v_out", &val) == 0) {
info->mvout = val;
info->caps |= ONLP_PSU_CAPS_VOUT;
}
if (psu_ym2401_pmbus_info_get(index, "psu_i_out", &val) == 0) {
info->miout = val;
info->caps |= ONLP_PSU_CAPS_IOUT;
}
if (psu_ym2401_pmbus_info_get(index, "psu_p_out", &val) == 0) {
info->mpout = val;
info->caps |= ONLP_PSU_CAPS_POUT;
}
return ONLP_STATUS_OK;
}
/*
* Get all information about the given PSU oid.
*/
@@ -224,10 +260,14 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
psu_type = get_psu_type(index, info->model, sizeof(info->model));
switch (psu_type) {
case PSU_TYPE_AC_F2B:
case PSU_TYPE_AC_B2F:
case PSU_TYPE_AC_COMPUWARE_F2B:
case PSU_TYPE_AC_COMPUWARE_B2F:
ret = psu_cpr_4011_info_get(info);
break;
case PSU_TYPE_AC_3YPOWER_F2B:
case PSU_TYPE_AC_3YPOWER_B2F:
ret = psu_ym2401_info_get(info);
break;
case PSU_TYPE_DC_48V_F2B:
case PSU_TYPE_DC_48V_B2F:
ret = psu_um400d_info_get(info);

View File

@@ -24,10 +24,9 @@
*
***********************************************************/
#include <unistd.h>
#include <onlplib/mmap.h>
#include <onlplib/file.h>
#include <onlp/platformi/thermali.h>
#include <fcntl.h>
#include "platform_lib.h"
#define VALIDATE(_id) \
do { \
@@ -67,7 +66,6 @@ static char* cpu_coretemp_files[] =
NULL,
};
/* Static values */
static onlp_thermal_info_t linfo[] = {
{ }, /* Not used */
@@ -97,9 +95,6 @@ static onlp_thermal_info_t linfo[] = {
},
};
/*
* This will be called to intiialize the thermali subsystem.
*/
@@ -109,7 +104,6 @@ onlp_thermali_init(void)
return ONLP_STATUS_OK;
}
/*
* Retrieve the information structure for the given thermal OID.
*
@@ -124,6 +118,9 @@ int
onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
{
int local_id;
int psu_id;
psu_type_t psu_type;
VALIDATE(id);
local_id = ONLP_OID_ID_GET(id);
@@ -136,5 +133,14 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
return rv;
}
psu_id = local_id - THERMAL_1_ON_PSU1 + 1;
psu_type = get_psu_type(psu_id, NULL, 0);
if (psu_type == PSU_TYPE_AC_3YPOWER_F2B || psu_type == PSU_TYPE_AC_3YPOWER_B2F ) {
int rv = psu_ym2401_pmbus_info_get(psu_id, "psu_temp1_input", &info->mcelsius);
return rv;
}
return onlp_file_read_int(&info->mcelsius, devfiles__[local_id]);
}

View File

@@ -12,6 +12,7 @@ class OnlPlatform_x86_64_accton_as5812_54t_r0(OnlPlatformAccton,
########### initialize I2C bus 0 ###########
self.insmod("accton_i2c_cpld")
self.insmod("cpr_4011_4mxx")
self.insmod("ym2651y")
for m in [ "sfp", "psu", "fan", "leds" ]:
self.insmod("x86-64-accton-as5812-54t-%s" % m)
@@ -36,12 +37,16 @@ class OnlPlatform_x86_64_accton_as5812_54t_r0(OnlPlatformAccton,
('pca9548', 0x70, 1),
# initiate PSU-1 AC Power
('as5812_54t_psu', 0x38, 11),
('as5812_54t_psu1', 0x38, 11),
('cpr_4011_4mxx', 0x3c, 11),
('as5812_54t_psu1', 0x50, 11),
('ym2401', 0x58, 11),
# initiate PSU-2 AC Power
('as5812_54t_psu', 0x3b, 12),
('as5812_54t_psu2', 0x3b, 12),
('cpr_4011_4mxx', 0x3f, 12),
('as5812_54t_psu2', 0x53, 12),
('ym2401', 0x5b, 12),
# initiate lm75
('lm75', 0x48, 15),

View File

@@ -0,0 +1,3 @@
*x86*64*accton*as7312*54x*.mk
onlpdump.mk

View File

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

View File

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

View File

@@ -0,0 +1,211 @@
/*
* A hwmon driver for the accton_i2c_cpld
*
* Copyright (C) 2014 Accton Technology Corporation.
* Brandon Chuang <brandon_chuang@accton.com.tw>
*
* Based on ad7414.c
* Copyright 2006 Stefan Roese <sr at denx.de>, DENX Software Engineering
*
* 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/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/dmi.h>
static struct dmi_system_id as7312_dmi_table[] = {
{
.ident = "Accton AS7312",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Accton"),
DMI_MATCH(DMI_PRODUCT_NAME, "AS7312"),
},
}
};
int platform_accton_as7312_54x(void)
{
return dmi_check_system(as7312_dmi_table);
}
EXPORT_SYMBOL(platform_accton_as7312_54x);
static LIST_HEAD(cpld_client_list);
static struct mutex list_lock;
struct cpld_client_node {
struct i2c_client *client;
struct list_head list;
};
/* Addresses scanned for accton_i2c_cpld
*/
static const unsigned short normal_i2c[] = { 0x31, 0x35, 0x60, 0x62, 0x64, I2C_CLIENT_END };
static void accton_i2c_cpld_add_client(struct i2c_client *client)
{
struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL);
if (!node) {
dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr);
return;
}
node->client = client;
mutex_lock(&list_lock);
list_add(&node->list, &cpld_client_list);
mutex_unlock(&list_lock);
}
static void accton_i2c_cpld_remove_client(struct i2c_client *client)
{
struct list_head *list_node = NULL;
struct cpld_client_node *cpld_node = NULL;
int found = 0;
mutex_lock(&list_lock);
list_for_each(list_node, &cpld_client_list)
{
cpld_node = list_entry(list_node, struct cpld_client_node, list);
if (cpld_node->client == client) {
found = 1;
break;
}
}
if (found) {
list_del(list_node);
kfree(cpld_node);
}
mutex_unlock(&list_lock);
}
static int accton_i2c_cpld_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
int status;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr);
status = -EIO;
goto exit;
}
dev_info(&client->dev, "chip found\n");
accton_i2c_cpld_add_client(client);
return 0;
exit:
return status;
}
static int accton_i2c_cpld_remove(struct i2c_client *client)
{
accton_i2c_cpld_remove_client(client);
return 0;
}
static const struct i2c_device_id accton_i2c_cpld_id[] = {
{ "accton_i2c_cpld", 0 },
{}
};
MODULE_DEVICE_TABLE(i2c, accton_i2c_cpld_id);
static struct i2c_driver accton_i2c_cpld_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "accton_i2c_cpld",
},
.probe = accton_i2c_cpld_probe,
.remove = accton_i2c_cpld_remove,
.id_table = accton_i2c_cpld_id,
.address_list = normal_i2c,
};
int as7312_54x_i2c_cpld_read(unsigned short cpld_addr, u8 reg)
{
struct list_head *list_node = NULL;
struct cpld_client_node *cpld_node = NULL;
int ret = -EPERM;
mutex_lock(&list_lock);
list_for_each(list_node, &cpld_client_list)
{
cpld_node = list_entry(list_node, struct cpld_client_node, list);
if (cpld_node->client->addr == cpld_addr) {
ret = i2c_smbus_read_byte_data(cpld_node->client, reg);
break;
}
}
mutex_unlock(&list_lock);
return ret;
}
EXPORT_SYMBOL(as7312_54x_i2c_cpld_read);
int as7312_54x_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value)
{
struct list_head *list_node = NULL;
struct cpld_client_node *cpld_node = NULL;
int ret = -EIO;
mutex_lock(&list_lock);
list_for_each(list_node, &cpld_client_list)
{
cpld_node = list_entry(list_node, struct cpld_client_node, list);
if (cpld_node->client->addr == cpld_addr) {
ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value);
break;
}
}
mutex_unlock(&list_lock);
return ret;
}
EXPORT_SYMBOL(as7312_54x_i2c_cpld_write);
static int __init accton_i2c_cpld_init(void)
{
mutex_init(&list_lock);
return i2c_add_driver(&accton_i2c_cpld_driver);
}
static void __exit accton_i2c_cpld_exit(void)
{
i2c_del_driver(&accton_i2c_cpld_driver);
}
MODULE_AUTHOR("Brandon Chuang <brandon_chuang@accton.com.tw>");
MODULE_DESCRIPTION("accton_i2c_cpld driver");
MODULE_LICENSE("GPL");
module_init(accton_i2c_cpld_init);
module_exit(accton_i2c_cpld_exit);

View File

@@ -0,0 +1,491 @@
/*
* A hwmon driver for the Accton as7312 54x fan
*
* Copyright (C) 2014 Accton Technology Corporation.
* Brandon Chuang <brandon_chuang@accton.com.tw>
*
* 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/module.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/slab.h>
#include <linux/dmi.h>
#define DRVNAME "as7312_54x_fan"
static struct as7312_54x_fan_data *as7312_54x_fan_update_device(struct device *dev);
static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf);
static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da,
const char *buf, size_t count);
extern int as7312_54x_i2c_cpld_read(unsigned short cpld_addr, u8 reg);
extern int as7312_54x_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value);
/* fan related data, the index should match sysfs_fan_attributes
*/
static const u8 fan_reg[] = {
0x0F, /* fan 1-6 present status */
0x10, /* fan 1-6 direction(0:F2B 1:B2F) */
0x11, /* fan PWM(for all fan) */
0x12, /* front fan 1 speed(rpm) */
0x13, /* front fan 2 speed(rpm) */
0x14, /* front fan 3 speed(rpm) */
0x15, /* front fan 4 speed(rpm) */
0x16, /* front fan 5 speed(rpm) */
0x17, /* front fan 6 speed(rpm) */
0x22, /* rear fan 1 speed(rpm) */
0x23, /* rear fan 2 speed(rpm) */
0x24, /* rear fan 3 speed(rpm) */
0x25, /* rear fan 4 speed(rpm) */
0x26, /* rear fan 5 speed(rpm) */
0x27, /* rear fan 6 speed(rpm) */
};
/* Each client has this additional data */
struct as7312_54x_fan_data {
struct device *hwmon_dev;
struct mutex update_lock;
char valid; /* != 0 if registers are valid */
unsigned long last_updated; /* In jiffies */
u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */
};
enum fan_id {
FAN1_ID,
FAN2_ID,
FAN3_ID,
FAN4_ID,
FAN5_ID,
FAN6_ID
};
enum sysfs_fan_attributes {
FAN_PRESENT_REG,
FAN_DIRECTION_REG,
FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */
FAN1_FRONT_SPEED_RPM,
FAN2_FRONT_SPEED_RPM,
FAN3_FRONT_SPEED_RPM,
FAN4_FRONT_SPEED_RPM,
FAN5_FRONT_SPEED_RPM,
FAN6_FRONT_SPEED_RPM,
FAN1_REAR_SPEED_RPM,
FAN2_REAR_SPEED_RPM,
FAN3_REAR_SPEED_RPM,
FAN4_REAR_SPEED_RPM,
FAN5_REAR_SPEED_RPM,
FAN6_REAR_SPEED_RPM,
FAN1_DIRECTION,
FAN2_DIRECTION,
FAN3_DIRECTION,
FAN4_DIRECTION,
FAN5_DIRECTION,
FAN6_DIRECTION,
FAN1_PRESENT,
FAN2_PRESENT,
FAN3_PRESENT,
FAN4_PRESENT,
FAN5_PRESENT,
FAN6_PRESENT,
FAN1_FAULT,
FAN2_FAULT,
FAN3_FAULT,
FAN4_FAULT,
FAN5_FAULT,
FAN6_FAULT
};
/* Define attributes
*/
#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index) \
static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT)
#define DECLARE_FAN_FAULT_ATTR(index) &sensor_dev_attr_fan##index##_fault.dev_attr.attr
#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \
static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION)
#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr
#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \
static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN##index##_DUTY_CYCLE_PERCENTAGE)
#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr
#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \
static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT)
#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr
#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index) \
static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\
static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM)
#define DECLARE_FAN_SPEED_RPM_ATTR(index) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \
&sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr
/* 6 fan fault attributes in this platform */
DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1);
DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2);
DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3);
DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4);
DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5);
DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(6);
/* 6 fan speed(rpm) attributes in this platform */
DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1);
DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2);
DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3);
DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4);
DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5);
DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6);
/* 6 fan present attributes in this platform */
DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1);
DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2);
DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3);
DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4);
DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5);
DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(6);
/* 6 fan direction attribute in this platform */
DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(1);
DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(2);
DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(3);
DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(4);
DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5);
DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6);
/* 1 fan duty cycle attribute in this platform */
DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR();
static struct attribute *as7312_54x_fan_attributes[] = {
/* fan related attributes */
DECLARE_FAN_FAULT_ATTR(1),
DECLARE_FAN_FAULT_ATTR(2),
DECLARE_FAN_FAULT_ATTR(3),
DECLARE_FAN_FAULT_ATTR(4),
DECLARE_FAN_FAULT_ATTR(5),
DECLARE_FAN_FAULT_ATTR(6),
DECLARE_FAN_SPEED_RPM_ATTR(1),
DECLARE_FAN_SPEED_RPM_ATTR(2),
DECLARE_FAN_SPEED_RPM_ATTR(3),
DECLARE_FAN_SPEED_RPM_ATTR(4),
DECLARE_FAN_SPEED_RPM_ATTR(5),
DECLARE_FAN_SPEED_RPM_ATTR(6),
DECLARE_FAN_PRESENT_ATTR(1),
DECLARE_FAN_PRESENT_ATTR(2),
DECLARE_FAN_PRESENT_ATTR(3),
DECLARE_FAN_PRESENT_ATTR(4),
DECLARE_FAN_PRESENT_ATTR(5),
DECLARE_FAN_PRESENT_ATTR(6),
DECLARE_FAN_DIRECTION_ATTR(1),
DECLARE_FAN_DIRECTION_ATTR(2),
DECLARE_FAN_DIRECTION_ATTR(3),
DECLARE_FAN_DIRECTION_ATTR(4),
DECLARE_FAN_DIRECTION_ATTR(5),
DECLARE_FAN_DIRECTION_ATTR(6),
DECLARE_FAN_DUTY_CYCLE_ATTR(),
NULL
};
#define FAN_DUTY_CYCLE_REG_MASK 0xF
#define FAN_MAX_DUTY_CYCLE 100
#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100
static int as7312_54x_fan_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg);
}
static int as7312_54x_fan_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}
/* fan utility functions
*/
static u32 reg_val_to_duty_cycle(u8 reg_val)
{
reg_val &= FAN_DUTY_CYCLE_REG_MASK;
return ((u32)(reg_val+1) * 625 + 75)/ 100;
}
static u8 duty_cycle_to_reg_val(u8 duty_cycle)
{
return ((u32)duty_cycle * 100 / 625) - 1;
}
static u32 reg_val_to_speed_rpm(u8 reg_val)
{
return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP;
}
static u8 reg_val_to_direction(u8 reg_val, enum fan_id id)
{
u8 mask = (1 << id);
reg_val &= mask;
return reg_val ? 1 : 0;
}
static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id)
{
u8 mask = (1 << id);
reg_val &= mask;
return reg_val ? 0 : 1;
}
static u8 is_fan_fault(struct as7312_54x_fan_data *data, enum fan_id id)
{
u8 ret = 1;
int front_fan_index = FAN1_FRONT_SPEED_RPM + id;
int rear_fan_index = FAN1_REAR_SPEED_RPM + id;
/* Check if the speed of front or rear fan is ZERO,
*/
if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) &&
reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) {
ret = 0;
}
return ret;
}
static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da,
const char *buf, size_t count)
{
int error, value;
struct i2c_client *client = to_i2c_client(dev);
error = kstrtoint(buf, 10, &value);
if (error)
return error;
if (value < 0 || value > FAN_MAX_DUTY_CYCLE)
return -EINVAL;
as7312_54x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */
as7312_54x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value));
return count;
}
static ssize_t fan_show_value(struct device *dev, struct device_attribute *da,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct as7312_54x_fan_data *data = as7312_54x_fan_update_device(dev);
ssize_t ret = 0;
if (data->valid) {
switch (attr->index) {
case FAN_DUTY_CYCLE_PERCENTAGE:
{
u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]);
ret = sprintf(buf, "%u\n", duty_cycle);
break;
}
case FAN1_FRONT_SPEED_RPM:
case FAN2_FRONT_SPEED_RPM:
case FAN3_FRONT_SPEED_RPM:
case FAN4_FRONT_SPEED_RPM:
case FAN5_FRONT_SPEED_RPM:
case FAN6_FRONT_SPEED_RPM:
case FAN1_REAR_SPEED_RPM:
case FAN2_REAR_SPEED_RPM:
case FAN3_REAR_SPEED_RPM:
case FAN4_REAR_SPEED_RPM:
case FAN5_REAR_SPEED_RPM:
case FAN6_REAR_SPEED_RPM:
ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index]));
break;
case FAN1_PRESENT:
case FAN2_PRESENT:
case FAN3_PRESENT:
case FAN4_PRESENT:
case FAN5_PRESENT:
case FAN6_PRESENT:
ret = sprintf(buf, "%d\n",
reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG],
attr->index - FAN1_PRESENT));
break;
case FAN1_FAULT:
case FAN2_FAULT:
case FAN3_FAULT:
case FAN4_FAULT:
case FAN5_FAULT:
case FAN6_FAULT:
ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT));
break;
case FAN1_DIRECTION:
case FAN2_DIRECTION:
case FAN3_DIRECTION:
case FAN4_DIRECTION:
case FAN5_DIRECTION:
case FAN6_DIRECTION:
ret = sprintf(buf, "%d\n",
reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG],
attr->index - FAN1_DIRECTION));
break;
default:
break;
}
}
return ret;
}
static const struct attribute_group as7312_54x_fan_group = {
.attrs = as7312_54x_fan_attributes,
};
static struct as7312_54x_fan_data *as7312_54x_fan_update_device(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct as7312_54x_fan_data *data = i2c_get_clientdata(client);
mutex_lock(&data->update_lock);
if (time_after(jiffies, data->last_updated + HZ + HZ / 2) ||
!data->valid) {
int i;
dev_dbg(&client->dev, "Starting as7312_54x_fan update\n");
data->valid = 0;
/* Update fan data
*/
for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) {
int status = as7312_54x_fan_read_value(client, fan_reg[i]);
if (status < 0) {
data->valid = 0;
mutex_unlock(&data->update_lock);
dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status);
return data;
}
else {
data->reg_val[i] = status;
}
}
data->last_updated = jiffies;
data->valid = 1;
}
mutex_unlock(&data->update_lock);
return data;
}
static int as7312_54x_fan_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
struct as7312_54x_fan_data *data;
int status;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
status = -EIO;
goto exit;
}
data = kzalloc(sizeof(struct as7312_54x_fan_data), GFP_KERNEL);
if (!data) {
status = -ENOMEM;
goto exit;
}
i2c_set_clientdata(client, data);
data->valid = 0;
mutex_init(&data->update_lock);
dev_info(&client->dev, "chip found\n");
/* Register sysfs hooks */
status = sysfs_create_group(&client->dev.kobj, &as7312_54x_fan_group);
if (status) {
goto exit_free;
}
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
status = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}
dev_info(&client->dev, "%s: fan '%s'\n",
dev_name(data->hwmon_dev), client->name);
return 0;
exit_remove:
sysfs_remove_group(&client->dev.kobj, &as7312_54x_fan_group);
exit_free:
kfree(data);
exit:
return status;
}
static int as7312_54x_fan_remove(struct i2c_client *client)
{
struct as7312_54x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7312_54x_fan_group);
return 0;
}
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END };
static const struct i2c_device_id as7312_54x_fan_id[] = {
{ "as7312_54x_fan", 0 },
{}
};
MODULE_DEVICE_TABLE(i2c, as7312_54x_fan_id);
static struct i2c_driver as7312_54x_fan_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = DRVNAME,
},
.probe = as7312_54x_fan_probe,
.remove = as7312_54x_fan_remove,
.id_table = as7312_54x_fan_id,
.address_list = normal_i2c,
};
static int __init as7312_54x_fan_init(void)
{
extern int platform_accton_as7312_54x(void);
if (!platform_accton_as7312_54x()) {
return -ENODEV;
}
return i2c_add_driver(&as7312_54x_fan_driver);
}
static void __exit as7312_54x_fan_exit(void)
{
i2c_del_driver(&as7312_54x_fan_driver);
}
module_init(as7312_54x_fan_init);
module_exit(as7312_54x_fan_exit);
MODULE_AUTHOR("Brandon Chuang <brandon_chuang@accton.com.tw>");
MODULE_DESCRIPTION("as7312_54x_fan driver");
MODULE_LICENSE("GPL");

View File

@@ -0,0 +1,443 @@
/*
* A LED driver for the accton_as7312_54x_led
*
* Copyright (C) 2014 Accton Technology Corporation.
* Brandon Chuang <brandon_chuang@accton.com.tw>
*
* 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.
*/
/*#define DEBUG*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <linux/leds.h>
#include <linux/slab.h>
#include <linux/dmi.h>
extern int as7312_54x_i2c_cpld_read (unsigned short cpld_addr, u8 reg);
extern int as7312_54x_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value);
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 "accton_as7312_54x_led"
struct accton_as7312_54x_led_data {
struct platform_device *pdev;
struct mutex update_lock;
char valid; /* != 0 if registers are valid */
unsigned long last_updated; /* In jiffies */
u8 reg_val[1]; /* only 1 register*/
};
static struct accton_as7312_54x_led_data *ledctl = NULL;
/* LED related data
*/
#define LED_CNTRLER_I2C_ADDRESS (0x60)
#define LED_TYPE_DIAG_REG_MASK (0x3)
#define LED_MODE_DIAG_GREEN_VALUE (0x02)
#define LED_MODE_DIAG_RED_VALUE (0x01)
#define LED_MODE_DIAG_AMBER_VALUE (0x00) /*It's yellow actually. Green+Red=Yellow*/
#define LED_MODE_DIAG_OFF_VALUE (0x03)
#define LED_TYPE_LOC_REG_MASK (0x80)
#define LED_MODE_LOC_ON_VALUE (0)
#define LED_MODE_LOC_OFF_VALUE (0x80)
enum led_type {
LED_TYPE_DIAG,
LED_TYPE_LOC,
LED_TYPE_FAN,
LED_TYPE_PSU1,
LED_TYPE_PSU2
};
struct led_reg {
u32 types;
u8 reg_addr;
};
static const struct led_reg led_reg_map[] = {
{(1<<LED_TYPE_LOC) | (1<<LED_TYPE_DIAG), 0x41},
};
enum led_light_mode {
LED_MODE_OFF = 0,
LED_MODE_GREEN,
LED_MODE_AMBER,
LED_MODE_RED,
LED_MODE_BLUE,
LED_MODE_GREEN_BLINK,
LED_MODE_AMBER_BLINK,
LED_MODE_RED_BLINK,
LED_MODE_BLUE_BLINK,
LED_MODE_AUTO,
LED_MODE_UNKNOWN
};
struct led_type_mode {
enum led_type type;
enum led_light_mode mode;
int reg_bit_mask;
int mode_value;
};
static struct led_type_mode led_type_mode_data[] = {
{LED_TYPE_LOC, LED_MODE_OFF, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_OFF_VALUE},
{LED_TYPE_LOC, LED_MODE_AMBER, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_ON_VALUE},
{LED_TYPE_DIAG, LED_MODE_OFF, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_OFF_VALUE},
{LED_TYPE_DIAG, LED_MODE_GREEN, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_GREEN_VALUE},
{LED_TYPE_DIAG, LED_MODE_RED, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_RED_VALUE},
{LED_TYPE_DIAG, LED_MODE_AMBER, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_AMBER_VALUE},
};
static void accton_as7312_54x_led_set(struct led_classdev *led_cdev,
enum led_brightness led_light_mode, enum led_type type);
static int accton_getLedReg(enum led_type type, u8 *reg)
{
int i;
for (i = 0; i < ARRAY_SIZE(led_reg_map); i++) {
if(led_reg_map[i].types & (type<<1)) {
*reg = led_reg_map[i].reg_addr;
return 0;
}
}
return 1;
}
static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) {
int i;
for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) {
if (type != led_type_mode_data[i].type)
continue;
if ((led_type_mode_data[i].reg_bit_mask & reg_val) ==
led_type_mode_data[i].mode_value)
{
return led_type_mode_data[i].mode;
}
}
return 0;
}
static u8 led_light_mode_to_reg_val(enum led_type type,
enum led_light_mode mode, u8 reg_val) {
int i;
for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) {
if (type != led_type_mode_data[i].type)
continue;
if (mode != led_type_mode_data[i].mode)
continue;
reg_val = led_type_mode_data[i].mode_value |
(reg_val & (~led_type_mode_data[i].reg_bit_mask));
break;
}
return reg_val;
}
static int accton_as7312_54x_led_read_value(u8 reg)
{
return as7312_54x_i2c_cpld_read(LED_CNTRLER_I2C_ADDRESS, reg);
}
static int accton_as7312_54x_led_write_value(u8 reg, u8 value)
{
return as7312_54x_i2c_cpld_write(LED_CNTRLER_I2C_ADDRESS, reg, value);
}
static void accton_as7312_54x_led_update(void)
{
mutex_lock(&ledctl->update_lock);
if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2)
|| !ledctl->valid) {
int i;
dev_dbg(&ledctl->pdev->dev, "Starting accton_as7312_54x_led update\n");
/* Update LED data
*/
for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) {
int status = accton_as7312_54x_led_read_value(led_reg_map[i].reg_addr);
if (status < 0) {
ledctl->valid = 0;
dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status);
goto exit;
}
else
{
ledctl->reg_val[i] = status;
}
}
ledctl->last_updated = jiffies;
ledctl->valid = 1;
}
exit:
mutex_unlock(&ledctl->update_lock);
}
static void accton_as7312_54x_led_set(struct led_classdev *led_cdev,
enum led_brightness led_light_mode,
enum led_type type)
{
int reg_val;
u8 reg ;
mutex_lock(&ledctl->update_lock);
if( !accton_getLedReg(type, &reg))
{
dev_dbg(&ledctl->pdev->dev, "Not match item for %d.\n", type);
}
reg_val = accton_as7312_54x_led_read_value(reg);
if (reg_val < 0) {
dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val);
goto exit;
}
reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val);
accton_as7312_54x_led_write_value(reg, reg_val);
/* to prevent the slow-update issue */
ledctl->valid = 0;
exit:
mutex_unlock(&ledctl->update_lock);
}
static void accton_as7312_54x_led_diag_set(struct led_classdev *led_cdev,
enum led_brightness led_light_mode)
{
accton_as7312_54x_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG);
}
static enum led_brightness accton_as7312_54x_led_diag_get(struct led_classdev *cdev)
{
accton_as7312_54x_led_update();
return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]);
}
static void accton_as7312_54x_led_loc_set(struct led_classdev *led_cdev,
enum led_brightness led_light_mode)
{
accton_as7312_54x_led_set(led_cdev, led_light_mode, LED_TYPE_LOC);
}
static enum led_brightness accton_as7312_54x_led_loc_get(struct led_classdev *cdev)
{
accton_as7312_54x_led_update();
return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]);
}
static void accton_as7312_54x_led_auto_set(struct led_classdev *led_cdev,
enum led_brightness led_light_mode)
{
}
static enum led_brightness accton_as7312_54x_led_auto_get(struct led_classdev *cdev)
{
return LED_MODE_AUTO;
}
static struct led_classdev accton_as7312_54x_leds[] = {
[LED_TYPE_DIAG] = {
.name = "accton_as7312_54x_led::diag",
.default_trigger = "unused",
.brightness_set = accton_as7312_54x_led_diag_set,
.brightness_get = accton_as7312_54x_led_diag_get,
.flags = LED_CORE_SUSPENDRESUME,
.max_brightness = LED_MODE_RED,
},
[LED_TYPE_LOC] = {
.name = "accton_as7312_54x_led::loc",
.default_trigger = "unused",
.brightness_set = accton_as7312_54x_led_loc_set,
.brightness_get = accton_as7312_54x_led_loc_get,
.flags = LED_CORE_SUSPENDRESUME,
.max_brightness = LED_MODE_BLUE,
},
[LED_TYPE_FAN] = {
.name = "accton_as7312_54x_led::fan",
.default_trigger = "unused",
.brightness_set = accton_as7312_54x_led_auto_set,
.brightness_get = accton_as7312_54x_led_auto_get,
.flags = LED_CORE_SUSPENDRESUME,
.max_brightness = LED_MODE_AUTO,
},
[LED_TYPE_PSU1] = {
.name = "accton_as7312_54x_led::psu1",
.default_trigger = "unused",
.brightness_set = accton_as7312_54x_led_auto_set,
.brightness_get = accton_as7312_54x_led_auto_get,
.flags = LED_CORE_SUSPENDRESUME,
.max_brightness = LED_MODE_AUTO,
},
[LED_TYPE_PSU2] = {
.name = "accton_as7312_54x_led::psu2",
.default_trigger = "unused",
.brightness_set = accton_as7312_54x_led_auto_set,
.brightness_get = accton_as7312_54x_led_auto_get,
.flags = LED_CORE_SUSPENDRESUME,
.max_brightness = LED_MODE_AUTO,
},
};
static int accton_as7312_54x_led_suspend(struct platform_device *dev,
pm_message_t state)
{
int i = 0;
for (i = 0; i < ARRAY_SIZE(accton_as7312_54x_leds); i++) {
led_classdev_suspend(&accton_as7312_54x_leds[i]);
}
return 0;
}
static int accton_as7312_54x_led_resume(struct platform_device *dev)
{
int i = 0;
for (i = 0; i < ARRAY_SIZE(accton_as7312_54x_leds); i++) {
led_classdev_resume(&accton_as7312_54x_leds[i]);
}
return 0;
}
static int accton_as7312_54x_led_probe(struct platform_device *pdev)
{
int ret, i;
for (i = 0; i < ARRAY_SIZE(accton_as7312_54x_leds); i++) {
ret = led_classdev_register(&pdev->dev, &accton_as7312_54x_leds[i]);
if (ret < 0)
break;
}
/* Check if all LEDs were successfully registered */
if (i != ARRAY_SIZE(accton_as7312_54x_leds)) {
int j;
/* only unregister the LEDs that were successfully registered */
for (j = 0; j < i; j++) {
led_classdev_unregister(&accton_as7312_54x_leds[i]);
}
}
return ret;
}
static int accton_as7312_54x_led_remove(struct platform_device *pdev)
{
int i;
for (i = 0; i < ARRAY_SIZE(accton_as7312_54x_leds); i++) {
led_classdev_unregister(&accton_as7312_54x_leds[i]);
}
return 0;
}
static struct platform_driver accton_as7312_54x_led_driver = {
.probe = accton_as7312_54x_led_probe,
.remove = accton_as7312_54x_led_remove,
.suspend = accton_as7312_54x_led_suspend,
.resume = accton_as7312_54x_led_resume,
.driver = {
.name = DRVNAME,
.owner = THIS_MODULE,
},
};
static int __init accton_as7312_54x_led_init(void)
{
int ret;
extern int platform_accton_as7312_54x(void);
if (!platform_accton_as7312_54x()) {
return -ENODEV;
}
ret = platform_driver_register(&accton_as7312_54x_led_driver);
if (ret < 0) {
goto exit;
}
ledctl = kzalloc(sizeof(struct accton_as7312_54x_led_data), GFP_KERNEL);
if (!ledctl) {
ret = -ENOMEM;
platform_driver_unregister(&accton_as7312_54x_led_driver);
goto exit;
}
mutex_init(&ledctl->update_lock);
ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
if (IS_ERR(ledctl->pdev)) {
ret = PTR_ERR(ledctl->pdev);
platform_driver_unregister(&accton_as7312_54x_led_driver);
kfree(ledctl);
goto exit;
}
exit:
return ret;
}
static void __exit accton_as7312_54x_led_exit(void)
{
platform_device_unregister(ledctl->pdev);
platform_driver_unregister(&accton_as7312_54x_led_driver);
kfree(ledctl);
}
module_init(accton_as7312_54x_led_init);
module_exit(accton_as7312_54x_led_exit);
MODULE_AUTHOR("Brandon Chuang <brandon_chuang@accton.com.tw>");
MODULE_DESCRIPTION("accton_as7312_54x_led driver");
MODULE_LICENSE("GPL");

View File

@@ -0,0 +1,293 @@
/*
* An hwmon driver for accton as7312_54x Power Module
*
* Copyright (C) 2014 Accton Technology Corporation.
* Brandon Chuang <brandon_chuang@accton.com.tw>
*
* Based on ad7414.c
* Copyright 2006 Stefan Roese <sr at denx.de>, DENX Software Engineering
*
* 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/module.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/dmi.h>
static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf);
static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf);
static int as7312_54x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len);
extern int as7312_54x_i2c_cpld_read(unsigned short cpld_addr, u8 reg);
/* Addresses scanned
*/
static const unsigned short normal_i2c[] = { 0x50, 0x53, I2C_CLIENT_END };
/* Each client has this additional data
*/
struct as7312_54x_psu_data {
struct device *hwmon_dev;
struct mutex update_lock;
char valid; /* !=0 if registers are valid */
unsigned long last_updated; /* In jiffies */
u8 index; /* PSU index */
u8 status; /* Status(present/power_good) register read from CPLD */
char model_name[9]; /* Model name, read from eeprom */
};
static struct as7312_54x_psu_data *as7312_54x_psu_update_device(struct device *dev);
enum as7312_54x_psu_sysfs_attributes {
PSU_PRESENT,
PSU_MODEL_NAME,
PSU_POWER_GOOD
};
/* sysfs attributes for hwmon
*/
static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT);
static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME);
static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD);
static struct attribute *as7312_54x_psu_attributes[] = {
&sensor_dev_attr_psu_present.dev_attr.attr,
&sensor_dev_attr_psu_model_name.dev_attr.attr,
&sensor_dev_attr_psu_power_good.dev_attr.attr,
NULL
};
static ssize_t show_status(struct device *dev, struct device_attribute *da,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct as7312_54x_psu_data *data = as7312_54x_psu_update_device(dev);
u8 status = 0;
if (attr->index == PSU_PRESENT) {
status = !(data->status >> (1-data->index) & 0x1);
}
else { /* PSU_POWER_GOOD */
status = (data->status >> (3-data->index) & 0x1);
}
return sprintf(buf, "%d\n", status);
}
static ssize_t show_model_name(struct device *dev, struct device_attribute *da,
char *buf)
{
struct as7312_54x_psu_data *data = as7312_54x_psu_update_device(dev);
return sprintf(buf, "%s\n", data->model_name);
}
static const struct attribute_group as7312_54x_psu_group = {
.attrs = as7312_54x_psu_attributes,
};
static int as7312_54x_psu_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
struct as7312_54x_psu_data *data;
int status;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) {
status = -EIO;
goto exit;
}
data = kzalloc(sizeof(struct as7312_54x_psu_data), GFP_KERNEL);
if (!data) {
status = -ENOMEM;
goto exit;
}
i2c_set_clientdata(client, data);
data->valid = 0;
data->index = dev_id->driver_data;
mutex_init(&data->update_lock);
dev_info(&client->dev, "chip found\n");
/* Register sysfs hooks */
status = sysfs_create_group(&client->dev.kobj, &as7312_54x_psu_group);
if (status) {
goto exit_free;
}
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
status = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}
dev_info(&client->dev, "%s: psu '%s'\n",
dev_name(data->hwmon_dev), client->name);
return 0;
exit_remove:
sysfs_remove_group(&client->dev.kobj, &as7312_54x_psu_group);
exit_free:
kfree(data);
exit:
return status;
}
static int as7312_54x_psu_remove(struct i2c_client *client)
{
struct as7312_54x_psu_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as7312_54x_psu_group);
kfree(data);
return 0;
}
enum psu_index
{
as7312_54x_psu1,
as7312_54x_psu2
};
static const struct i2c_device_id as7312_54x_psu_id[] = {
{ "as7312_54x_psu1", as7312_54x_psu1 },
{ "as7312_54x_psu2", as7312_54x_psu2 },
{}
};
MODULE_DEVICE_TABLE(i2c, as7312_54x_psu_id);
static struct i2c_driver as7312_54x_psu_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "as7312_54x_psu",
},
.probe = as7312_54x_psu_probe,
.remove = as7312_54x_psu_remove,
.id_table = as7312_54x_psu_id,
.address_list = normal_i2c,
};
static int as7312_54x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,
int data_len)
{
int result = 0;
int retry_count = 5;
while (retry_count) {
retry_count--;
result = i2c_smbus_read_i2c_block_data(client, command, data_len, data);
if (unlikely(result < 0)) {
msleep(10);
continue;
}
if (unlikely(result != data_len)) {
result = -EIO;
msleep(10);
continue;
}
result = 0;
break;
}
return result;
}
static struct as7312_54x_psu_data *as7312_54x_psu_update_device(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct as7312_54x_psu_data *data = i2c_get_clientdata(client);
mutex_lock(&data->update_lock);
if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
|| !data->valid) {
int status;
int power_good = 0;
dev_dbg(&client->dev, "Starting as7312_54x update\n");
/* Read psu status */
status = as7312_54x_i2c_cpld_read(0x60, 0x2);
if (status < 0) {
dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status);
}
else {
data->status = status;
}
/* Read model name */
memset(data->model_name, 0, sizeof(data->model_name));
power_good = (data->status >> (3-data->index) & 0x1);
if (power_good) {
status = as7312_54x_psu_read_block(client, 0x20, data->model_name,
ARRAY_SIZE(data->model_name)-1);
if (status < 0) {
data->model_name[0] = '\0';
dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr);
}
else {
data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0';
}
}
data->last_updated = jiffies;
data->valid = 1;
}
mutex_unlock(&data->update_lock);
return data;
}
static int __init as7312_54x_psu_init(void)
{
extern int platform_accton_as7312_54x(void);
if (!platform_accton_as7312_54x()) {
return -ENODEV;
}
return i2c_add_driver(&as7312_54x_psu_driver);
}
static void __exit as7312_54x_psu_exit(void)
{
i2c_del_driver(&as7312_54x_psu_driver);
}
module_init(as7312_54x_psu_init);
module_exit(as7312_54x_psu_exit);
MODULE_AUTHOR("Brandon Chuang <brandon_chuang@accton.com.tw>");
MODULE_DESCRIPTION("as7312_54x_psu driver");
MODULE_LICENSE("GPL");

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-accton-as7312-54x ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu

View File

@@ -0,0 +1,2 @@
FILTER=src
include $(ONL)/make/subdirs.mk

View File

@@ -0,0 +1,45 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
############################################################
include $(ONL)/make/config.amd64.mk
MODULE := libonlp-x86-64-accton-as7312-54x
include $(BUILDER)/standardinit.mk
DEPENDMODULES := AIM IOF x86_64_accton_as7312_54x onlplib
DEPENDMODULE_HEADERS := sff
include $(BUILDER)/dependmodules.mk
SHAREDLIB := libonlp-x86-64-accton-as7312-54x.so
$(SHAREDLIB)_TARGETS := $(ALL_TARGETS)
include $(BUILDER)/so.mk
.DEFAULT_GOAL := $(SHAREDLIB)
GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -fPIC
GLOBAL_LINK_LIBS += -lpthread
include $(BUILDER)/targets.mk

View File

@@ -0,0 +1,46 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
#
############################################################
include $(ONL)/make/config.amd64.mk
.DEFAULT_GOAL := onlpdump
MODULE := onlpdump
include $(BUILDER)/standardinit.mk
DEPENDMODULES := AIM IOF onlp x86_64_accton_as7312_54x onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS
include $(BUILDER)/dependmodules.mk
BINARY := onlpdump
$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS)
include $(BUILDER)/bin.mk
GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
GLOBAL_LINK_LIBS += -lpthread -lm
include $(BUILDER)/targets.mk

View File

@@ -0,0 +1 @@
name: x86_64_accton_as7312_54x

View File

@@ -0,0 +1,9 @@
###############################################################################
#
#
#
###############################################################################
include ../../init.mk
MODULE := x86_64_accton_as7312_54x
AUTOMODULE := x86_64_accton_as7312_54x
include $(BUILDER)/definemodule.mk

View File

@@ -0,0 +1,6 @@
###############################################################################
#
# x86_64_accton_as7312_54x README
#
###############################################################################

View File

@@ -0,0 +1,9 @@
###############################################################################
#
# x86_64_accton_as7312_54x Autogeneration
#
###############################################################################
x86_64_accton_as7312_54x_AUTO_DEFS := module/auto/x86_64_accton_as7312_54x.yml
x86_64_accton_as7312_54x_AUTO_DIRS := module/inc/x86_64_accton_as7312_54x module/src
include $(BUILDER)/auto.mk

View File

@@ -0,0 +1,50 @@
###############################################################################
#
# x86_64_accton_as7312_54x Autogeneration Definitions.
#
###############################################################################
cdefs: &cdefs
- x86_64_accton_as7312_54x_CONFIG_INCLUDE_LOGGING:
doc: "Include or exclude logging."
default: 1
- x86_64_accton_as7312_54x_CONFIG_LOG_OPTIONS_DEFAULT:
doc: "Default enabled log options."
default: AIM_LOG_OPTIONS_DEFAULT
- x86_64_accton_as7312_54x_CONFIG_LOG_BITS_DEFAULT:
doc: "Default enabled log bits."
default: AIM_LOG_BITS_DEFAULT
- x86_64_accton_as7312_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
doc: "Default enabled custom log bits."
default: 0
- x86_64_accton_as7312_54x_CONFIG_PORTING_STDLIB:
doc: "Default all porting macros to use the C standard libraries."
default: 1
- x86_64_accton_as7312_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
doc: "Include standard library headers for stdlib porting macros."
default: x86_64_accton_as7312_54x_CONFIG_PORTING_STDLIB
- x86_64_accton_as7312_54x_CONFIG_INCLUDE_UCLI:
doc: "Include generic uCli support."
default: 0
- x86_64_accton_as7312_54x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION:
doc: "Assume chassis fan direction is the same as the PSU fan direction."
default: 0
definitions:
cdefs:
x86_64_accton_as7312_54x_CONFIG_HEADER:
defs: *cdefs
basename: x86_64_accton_as7312_54x_config
portingmacro:
x86_64_accton_as7312_54x:
macros:
- malloc
- free
- memset
- memcpy
- strncpy
- vsnprintf
- snprintf
- strlen

View File

@@ -0,0 +1,14 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_accton_as7312_54x/x86_64_accton_as7312_54x_config.h>
/* <--auto.start.xmacro(ALL).define> */
/* <auto.end.xmacro(ALL).define> */
/* <--auto.start.xenum(ALL).define> */
/* <auto.end.xenum(ALL).define> */

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