[RFC,v2,00/12] Freescale DPAA FMan
From: Igal Liberman The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which contains a series of hardware blocks: ports, Ethernet MACs, a multi user RAM (MURAM) and Storage Profile (SP). This patch set introduced the FMan driver code that configures and initializes the FMan hardware blocks, offering support for three different types of MACs. The first 6 patches present the FMan Foundation Libraries (FLIBs), the FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. The following patches present the FMan driver itself, split into patches for each required hardware module. v2: - This set of patches combines the following submissions: - v2 of FMan (RFC) - v3 of FMan FLib - Reduced FMan code size: - Reduced FMan FLib's size: Removed code for future support. - Removed Priority Flow Control (PFC) support. - Removed rate-limiter. - Removed some MAC features. - Removed Real Time Clock (RTC) support. Igal Liberman (12): soc/fman: Add the FMan FLIB headers soc/fman: Add the FMan FLIB soc/fman: Add the FMan port FLIB headers soc/fman: Add the FMan port FLIB soc/fman: Add the FMan MAC FLIB headers soc/fman: Add the FMan MAC FLIB soc/fman: Add FMan MURAM support soc/fman: Add Frame Manager support soc/fman: Add FMan MAC support soc/fman: Add FMan SP support soc/fman: Add FMan Port Support soc/fman: Add FMan MAC driver drivers/soc/fsl/Kconfig|2 + drivers/soc/fsl/Makefile |2 + drivers/soc/fsl/fman/Kconfig | 46 + drivers/soc/fsl/fman/Makefile | 12 + drivers/soc/fsl/fman/flib/common/general.h | 41 + drivers/soc/fsl/fman/flib/fman_common.h| 73 + drivers/soc/fsl/fman/flib/fsl_enet.h | 275 +++ drivers/soc/fsl/fman/flib/fsl_fman.h | 743 +++ drivers/soc/fsl/fman/flib/fsl_fman_dtsec.h | 791 drivers/soc/fsl/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 + drivers/soc/fsl/fman/flib/fsl_fman_memac.h | 453 + drivers/soc/fsl/fman/flib/fsl_fman_memac_mii_acc.h | 76 + drivers/soc/fsl/fman/flib/fsl_fman_port.h | 462 + drivers/soc/fsl/fman/flib/fsl_fman_sp.h| 66 + drivers/soc/fsl/fman/flib/fsl_fman_tgec.h | 409 drivers/soc/fsl/fman/fm.c | 2088 drivers/soc/fsl/fman/fm.h | 486 + drivers/soc/fsl/fman/fm_common.h | 538 + drivers/soc/fsl/fman/fm_drv.c | 967 + drivers/soc/fsl/fman/fm_drv.h | 123 ++ drivers/soc/fsl/fman/fm_muram.c| 174 ++ drivers/soc/fsl/fman/fm_port_drv.c | 536 + drivers/soc/fsl/fman/fm_sp_common.h| 104 + drivers/soc/fsl/fman/fman.c| 978 + drivers/soc/fsl/fman/inc/crc_mac_addr_ext.h| 343 drivers/soc/fsl/fman/inc/dpaa_ext.h| 253 +++ drivers/soc/fsl/fman/inc/dpaa_integration_ext.h| 120 ++ drivers/soc/fsl/fman/inc/enet_ext.h| 199 ++ drivers/soc/fsl/fman/inc/fm_ext.h | 715 +++ drivers/soc/fsl/fman/inc/fm_mac_ext.h | 452 + drivers/soc/fsl/fman/inc/fm_muram_ext.h| 98 + drivers/soc/fsl/fman/inc/fm_port_ext.h | 397 drivers/soc/fsl/fman/inc/fsl_fman_drv.h| 192 ++ drivers/soc/fsl/fman/inc/mac.h | 125 ++ drivers/soc/fsl/fman/inc/net_ext.h | 534 + drivers/soc/fsl/fman/inc/service.h | 90 + drivers/soc/fsl/fman/mac/Makefile |9 + drivers/soc/fsl/fman/mac/dtsec.c | 1226 drivers/soc/fsl/fman/mac/dtsec.h | 185 ++ drivers/soc/fsl/fman/mac/dtsec_mii_acc.c | 82 + drivers/soc/fsl/fman/mac/dtsec_mii_acc.h | 43 + drivers/soc/fsl/fman/mac/fm_mac.c | 510 + drivers/soc/fsl/fman/mac/fm_mac.h | 183 ++ drivers/soc/fsl/fman/mac/fman_crc32.c | 116 ++ drivers/soc/fsl/fman/mac/fman_crc32.h | 39 + drivers/soc/fsl/fman/mac/fman_dtsec.c | 571 ++ drivers/soc/fsl/fman/mac/fman_dtsec_mii_acc.c | 168 ++ drivers/soc/fsl/fman/mac/fman_memac.c | 365 drivers/soc/fsl/fman/mac/fman_memac_mii_acc.c | 217 ++ drivers/soc/fsl/fma
[RFC,v2,01/12] soc/fman: Add the FMan FLIB headers
From: Igal Liberman This patch presents the FMan Foundation Libraries (FLIB) headers. The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/flib/common/general.h | 41 ++ drivers/soc/fsl/fman/flib/fsl_fman.h | 743 2 files changed, 784 insertions(+) create mode 100644 drivers/soc/fsl/fman/flib/common/general.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman.h diff --git a/drivers/soc/fsl/fman/flib/common/general.h b/drivers/soc/fsl/fman/flib/common/general.h new file mode 100644 index 000..0501f01 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/common/general.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __GENERAL_H +#define __GENERAL_H + +#include +#include + +#define iowrite32be(val, addr) out_be32(&(*addr), val) +#define ioread32be(addr) in_be32(&(*addr)) + +#endif /* __GENERAL_H */ diff --git a/drivers/soc/fsl/fman/flib/fsl_fman.h b/drivers/soc/fsl/fman/flib/fsl_fman.h new file mode 100644 index 000..8534550 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fsl_fman.h @@ -0,0 +1,743 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FSL_FMAN_H +#define __FSL_FMAN_H + +#include "common/general.h" +#in
[RFC,v2,02/12] soc/fman: Add the FMan FLIB
From: Igal Liberman The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman --- drivers/soc/fsl/Kconfig |2 + drivers/soc/fsl/Makefile |2 + drivers/soc/fsl/fman/Kconfig |7 + drivers/soc/fsl/fman/Makefile |5 + drivers/soc/fsl/fman/fman.c | 978 + 5 files changed, 994 insertions(+) create mode 100644 drivers/soc/fsl/fman/Kconfig create mode 100644 drivers/soc/fsl/fman/Makefile create mode 100644 drivers/soc/fsl/fman/fman.c diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig index 291123a..2981306 100644 --- a/drivers/soc/fsl/Kconfig +++ b/drivers/soc/fsl/Kconfig @@ -189,4 +189,6 @@ config FSL_QMAN_INIT_TIMEOUT endif # FSL_QMAN +source "drivers/soc/fsl/fman/Kconfig" + endif # FSL_DPA diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile index cce1f70..b2f76e9 100644 --- a/drivers/soc/fsl/Makefile +++ b/drivers/soc/fsl/Makefile @@ -18,3 +18,5 @@ qman-test-y= qman_test.o qman-test-$(CONFIG_FSL_QMAN_TEST_API) += qman_test_api.o qman-test-$(CONFIG_FSL_QMAN_TEST_STASH)+= qman_test_stash.o obj-$(CONFIG_FSL_QMAN_DEBUGFS) += qman-debugfs.o + +obj-$(CONFIG_FSL_FMAN) += fman/ diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig new file mode 100644 index 000..8aeae29 --- /dev/null +++ b/drivers/soc/fsl/fman/Kconfig @@ -0,0 +1,7 @@ +config FSL_FMAN + bool "FMan support" + depends on FSL_SOC || COMPILE_TEST + default n + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile new file mode 100644 index 000..9f34fbc --- /dev/null +++ b/drivers/soc/fsl/fman/Makefile @@ -0,0 +1,5 @@ +subdir-ccflags-y += -I$(srctree)/drivers/soc/fsl/fman/flib + +obj-y += fsl_fman.o + +fsl_fman-objs := fman.o diff --git a/drivers/soc/fsl/fman/fman.c b/drivers/soc/fsl/fman/fman.c new file mode 100644 index 000..d9ea1e8 --- /dev/null +++ b/drivers/soc/fsl/fman/fman.c @@ -0,0 +1,978 @@ +/* + * Copyright 2008 - 2015 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_fman.h" + +uint32_t fman_get_bmi_err_event(struct fman_bmi_regs __iomem *bmi_rg) +{ + uint32_t event, mask, force; + + event = ioread32be(&bmi_rg->fmbm_ievr); + mask = ioread32be(&bmi_rg->fmbm_ier); + event &= mask; + /* clear the forced events */ + force = ioread32be(&bmi_rg->fmbm_ifr); + if (force & event) + iowrite32be(force & ~event, &bmi_rg->fmbm_ifr); + /* clear the acknowledged events */ + iowrite32be(event, &bmi_rg->fmbm_ievr); + return event; +} + +uint32_t fman_get_qmi_err_event(struct fman_qmi_regs __iomem *qmi_rg) +{ + uint32_t event, mask, force; + + event = ioread32be(&qmi_rg->fmqm_eie); + mask = ioread32be(&qmi_rg->fmqm_eien); + e
[RFC,v2,03/12] soc/fman: Add the FMan port FLIB headers
From: Igal Liberman The FMan Port Flib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/flib/fman_common.h | 73 + drivers/soc/fsl/fman/flib/fsl_fman_port.h | 462 + drivers/soc/fsl/fman/flib/fsl_fman_sp.h | 66 + 3 files changed, 601 insertions(+) create mode 100644 drivers/soc/fsl/fman/flib/fman_common.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_port.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_sp.h diff --git a/drivers/soc/fsl/fman/flib/fman_common.h b/drivers/soc/fsl/fman/flib/fman_common.h new file mode 100644 index 000..e186ed9 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fman_common.h @@ -0,0 +1,73 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FMAN_COMMON_H +#define __FMAN_COMMON_H + +/* NIA Description */ +#define NIA_ORDER_RESTOR 0x0080 +#define NIA_ENG_FM_CTL 0x +#define NIA_ENG_PRS0x0044 +#define NIA_ENG_KG 0x0048 +#define NIA_ENG_PLCR 0x004C +#define NIA_ENG_BMI0x0050 +#define NIA_ENG_QMI_ENQ0x0054 +#define NIA_ENG_QMI_DEQ0x0058 +#define NIA_ENG_MASK 0x007C + +#define NIA_FM_CTL_AC_CC 0x0006 +#define NIA_FM_CTL_AC_HC 0x000C +#define NIA_FM_CTL_AC_IND_MODE_TX 0x0008 +#define NIA_FM_CTL_AC_IND_MODE_RX 0x000A +#define NIA_FM_CTL_AC_FRAG 0x000e +#define NIA_FM_CTL_AC_PRE_FETCH0x0010 +#define NIA_FM_CTL_AC_POST_FETCH_PCD 0x0012 +#define NIA_FM_CTL_AC_POST_FETCH_PCD_UDP_LEN 0x0018 +#define NIA_FM_CTL_AC_POST_FETCH_NO_PCD0x0012 +#define NIA_FM_CTL_AC_FRAG_CHECK 0x0014 +#define NIA_FM_CTL_AC_PRE_CC 0x0020 + +#define NIA_BMI_AC_ENQ_FRAME 0x0002 +#define NIA_BMI_AC_TX_RELEASE 0x02C0 +#define NIA_BMI_AC_RELEASE 0x00C0 +#define NIA_BMI_AC_DISCARD 0x00C1 +#define NIA_BMI_AC_TX 0x0274 +#define NIA_BMI_AC_FETCH 0x0208 +#define NIA_BMI_AC_MASK0x03FF + +#define NIA_KG_DIRECT 0x0100 +#define NIA_KG_CC_EN 0x0200 +#define NIA_PLCR_ABSOLUTE 0x8000 + +#define NIA_BMI_AC_ENQ_FRAME_WITHOUT_DMA 0x0202 +#define NIA_BMI_AC_FETCH_ALL_FRAME 0x020c + +#endif /* __FMAN_COMMON_H */ diff --git a/drivers/soc/fsl/fman/flib/fsl_fman_port.h b/drivers/soc/fsl/fman/flib/fsl_fman_port.h new file mode 100644 index 000..8903c99 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fsl_fman_port.h @@ -0,0 +1,462 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution a
[RFC,v2,04/12] soc/fman: Add the FMan port FLIB
From: Igal Liberman The FMan Port FLib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Kconfig |1 + drivers/soc/fsl/fman/Makefile |2 + drivers/soc/fsl/fman/port/Makefile|3 + drivers/soc/fsl/fman/port/fman_port.c | 728 + 4 files changed, 734 insertions(+) create mode 100644 drivers/soc/fsl/fman/port/Makefile create mode 100644 drivers/soc/fsl/fman/port/fman_port.c diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig index 8aeae29..af42c3a 100644 --- a/drivers/soc/fsl/fman/Kconfig +++ b/drivers/soc/fsl/fman/Kconfig @@ -5,3 +5,4 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index 9f34fbc..a0cfd3e 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -3,3 +3,5 @@ subdir-ccflags-y += -I$(srctree)/drivers/soc/fsl/fman/flib obj-y += fsl_fman.o fsl_fman-objs := fman.o + +obj-y += port/ diff --git a/drivers/soc/fsl/fman/port/Makefile b/drivers/soc/fsl/fman/port/Makefile new file mode 100644 index 000..54b1fa4 --- /dev/null +++ b/drivers/soc/fsl/fman/port/Makefile @@ -0,0 +1,3 @@ +obj-y += fsl_fman_port.o + +fsl_fman_port-objs := fman_port.o diff --git a/drivers/soc/fsl/fman/port/fman_port.c b/drivers/soc/fsl/fman/port/fman_port.c new file mode 100644 index 000..7d04084 --- /dev/null +++ b/drivers/soc/fsl/fman/port/fman_port.c @@ -0,0 +1,728 @@ +/* + * Copyright 2008 - 2015 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 "common/general.h" + +#include "fman_common.h" +#include "fsl_fman_port.h" + +/* problem Eyal: the following should not be here*/ +#define NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME 0x0028 + +static uint32_t get_no_pcd_nia_bmi_ac_enc_frame(struct fman_port_cfg *cfg) +{ + if (cfg->errata_A006675) + return NIA_ENG_FM_CTL | + NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME; + else + return NIA_ENG_BMI | NIA_BMI_AC_ENQ_FRAME; +} + +static int init_bmi_rx(struct fman_port *port, + struct fman_port_cfg *cfg, + struct fman_port_params *params) +{ + struct fman_port_rx_bmi_regs __iomem *regs = &port->bmi_regs->rx; + uint32_t tmp; + + /* Rx Configuration register */ + tmp = 0; + if (cfg->discard_override) + tmp |= BMI_PORT_CFG_FDOVR; + iowrite32be(tmp, ®s->fmbm_rcfg); + + /* DMA attributes */ + tmp = (uint32_t)cfg->dma_swap_data << BMI_DMA_ATTR_SWP_SHIFT; + if (cfg->dma_ic_stash_on) + tmp |= BMI_DMA_ATTR_IC_STASH_ON; + if (cfg->dma_header_stash_on) + tmp |= BMI_DMA_ATTR_HDR_STASH_ON; + if (cfg->dma_sg_stash_on) + tmp |= BMI_DMA_ATTR_SG_STASH_ON; + if (cfg->dma_write_optimize) + tmp |= BMI_DMA_ATTR_WRITE_OPTIMI
[RFC,v2,05/12] soc/fman: Add the FMan MAC FLIB headers
From: Igal Liberman The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/flib/fsl_enet.h | 275 +++ drivers/soc/fsl/fman/flib/fsl_fman_dtsec.h | 791 drivers/soc/fsl/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 +++ drivers/soc/fsl/fman/flib/fsl_fman_memac.h | 453 +++ drivers/soc/fsl/fman/flib/fsl_fman_memac_mii_acc.h | 76 ++ drivers/soc/fsl/fman/flib/fsl_fman_tgec.h | 409 ++ 6 files changed, 2107 insertions(+) create mode 100644 drivers/soc/fsl/fman/flib/fsl_enet.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_dtsec.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_dtsec_mii_acc.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_memac.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_memac_mii_acc.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_tgec.h diff --git a/drivers/soc/fsl/fman/flib/fsl_enet.h b/drivers/soc/fsl/fman/flib/fsl_enet.h new file mode 100644 index 000..78e7d04 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fsl_enet.h @@ -0,0 +1,275 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FSL_ENET_H +#define __FSL_ENET_H + +/*Ethernet MAC-PHY Interface */ + +enum enet_interface { + E_ENET_IF_MII = 0x0001, /* MII interface */ + E_ENET_IF_RMII = 0x0002, /* RMII interface */ + E_ENET_IF_SMII = 0x0003, /* SMII interface */ + E_ENET_IF_GMII = 0x0004, /* GMII interface */ + E_ENET_IF_RGMII = 0x0005, /* RGMII interface */ + E_ENET_IF_TBI = 0x0006, /* TBI interface */ + E_ENET_IF_RTBI = 0x0007, /* RTBI interface */ + E_ENET_IF_SGMII = 0x0008, /* SGMII interface */ + E_ENET_IF_XGMII = 0x0009, /* XGMII interface */ + E_ENET_IF_QSGMII = 0x000a,/* QSGMII interface */ + E_ENET_IF_XFI = 0x000b/* XFI interface */ +}; + +/* Ethernet Speed (nominal data rate) */ +enum enet_speed { + E_ENET_SPEED_10 = 10, /* 10 Mbps */ + E_ENET_SPEED_100 = 100, /* 100 Mbps */ + E_ENET_SPEED_1000 = 1000, /* 1000 Mbps = 1 Gbps */ + E_ENET_SPEED_1 = 1 /* 1 Mbps = 10 Gbps */ +}; + +enum mac_type { + E_MAC_DTSEC, + E_MAC_TGEC, + E_MAC_MEMAC +}; + +/* Enum for inter-module interrupts registration */ +enum fman_event_modules { + E_FMAN_MOD_PRS, /* Parser event */ + E_FMAN_MOD_KG,/* Keygen event */ + E_FMAN_MOD_PLCR, /* Policer event */ + E_FMAN_MOD_10G_MAC, /* 10G MAC event */ + E_FMAN_MOD_1G_MAC,/* 1G MAC event */ + E_FMAN_MOD_TMR, /* Timer event */ + E_FMAN_MOD_FMAN_CTRL, /* FMAN Controller Timer event */ + E_FMAN_MOD_MACSEC, + E_FMAN_MOD_DUMMY_LAST +}; + +/* Enum for interrupts types */ +enum fman_intr_type { + E_FMAN_INTR_TYPE_ERR, + E_F
[RFC,v2,07/12] soc/fman: Add FMan MURAM support
From: Igal Liberman Add Frame Manager Multi-User RAM support. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Kconfig|1 + drivers/soc/fsl/fman/Makefile |5 +- drivers/soc/fsl/fman/fm_muram.c | 174 +++ drivers/soc/fsl/fman/inc/fm_muram_ext.h | 98 + 4 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 drivers/soc/fsl/fman/fm_muram.c create mode 100644 drivers/soc/fsl/fman/inc/fm_muram_ext.h diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig index af42c3a..58104e4 100644 --- a/drivers/soc/fsl/fman/Kconfig +++ b/drivers/soc/fsl/fman/Kconfig @@ -1,6 +1,7 @@ config FSL_FMAN bool "FMan support" depends on FSL_SOC || COMPILE_TEST + select PPC_LIB_RHEAP default n help Freescale Data-Path Acceleration Architecture Frame Manager diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index 5abd6c4..408c0cf 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -1,8 +1,9 @@ -subdir-ccflags-y += -I$(srctree)/drivers/soc/fsl/fman/flib +subdir-ccflags-y += -I$(srctree)/drivers/soc/fsl/fman/flib \ +-I$(srctree)/drivers/soc/fsl/fman/inc obj-y += fsl_fman.o -fsl_fman-objs := fman.o +fsl_fman-objs := fman.o fm_muram.o obj-y += port/ obj-y += mac/ diff --git a/drivers/soc/fsl/fman/fm_muram.c b/drivers/soc/fsl/fman/fm_muram.c new file mode 100644 index 000..2a67a2e --- /dev/null +++ b/drivers/soc/fsl/fman/fm_muram.c @@ -0,0 +1,174 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM MURAM ... */ +#include "fm_muram_ext.h" + +#include +#include +#include + +struct muram_info { + rh_block_t fm_boot_muram_rh_block[16]; + rh_info_t *fm_muram_info; + void __iomem *fm_muram_vbase; + /* Spinlock for MURAM accesses */ + spinlock_t fm_muram_lock; + uint64_tsize; +}; + +static void __iomem *fm_muram_addr(struct muram_info *p_muram, + unsigned long offset) +{ + return p_muram->fm_muram_vbase + offset; +} + +static unsigned long fm_muram_offset(struct muram_info *p_muram, +void __iomem *addr) +{ + return addr - p_muram->fm_muram_vbase; +} + +void fm_muram_clear(struct muram_info *p_muram) +{ + memset_io(p_muram->fm_muram_vbase, 0, p_muram->size); +} + +struct muram_info *fm_muram_init(phys_addr_t base_address, uint64_t size) +{ + int ret; + struct muram_info *p_muram; + + p_muram = kzalloc(sizeof(*p_muram), GFP_KERNEL); + if (!p_muram) + return NULL; + /* Create remote heap */ + p_muram->fm_muram_info = rh_create(sizeof(unsigned int)); + + /* Spinlock for MURAM accesses */ + spin_lock_init(&p_muram->fm_muram_lock); + + /* Initialize the info header */ + rh_init(p_muram->fm_muram_info, 1, + sizeof(p_muram->fm_boot_muram_rh_block) / +
[RFC,v2,10/12] soc/fman: Add FMan SP support
From: Igal Liberman Add Storage Profiles support. The Storage Profiles contain parameters that are used by the FMan in order to store frames being received on the Rx ports, or to determine the parameters that affect writing the Internal Context in the frame margin on Tx. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Makefile |2 + drivers/soc/fsl/fman/fm_sp_common.h | 104 + drivers/soc/fsl/fman/sp/Makefile|3 + drivers/soc/fsl/fman/sp/fm_sp.c | 398 +++ 4 files changed, 507 insertions(+) create mode 100644 drivers/soc/fsl/fman/fm_sp_common.h create mode 100644 drivers/soc/fsl/fman/sp/Makefile create mode 100644 drivers/soc/fsl/fman/sp/fm_sp.c diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index 270527a..4157313 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -8,3 +8,5 @@ fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o obj-y += port/ obj-y += mac/ +obj-y += sp/ + diff --git a/drivers/soc/fsl/fman/fm_sp_common.h b/drivers/soc/fsl/fman/fm_sp_common.h new file mode 100644 index 000..a99d795 --- /dev/null +++ b/drivers/soc/fsl/fman/fm_sp_common.h @@ -0,0 +1,104 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM SP ... */ +#ifndef __FM_SP_COMMON_H +#define __FM_SP_COMMON_H + +#include "service.h" +#include "fm_ext.h" +#include "fsl_fman.h" + +/* defaults */ +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_DATA_SIZE 0 +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_PASS_PRS_RESULT false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_PASS_TIME_STAMP false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64 + +/* structure for defining internal context copying */ +struct fm_sp_int_context_data_copy_t { + /* < Offset in External buffer to which internal +* context is copied to (Rx) or taken from (Tx, Op). +*/ + uint16_t ext_buf_offset; + /* Offset within internal context to copy from +* (Rx) or to copy to (Tx, Op). +*/ + uint8_t int_context_offset; + /* Internal offset size to be copied */ + uint16_t size; +}; + +/* struct for defining external buffer margins */ +struct fm_sp_buf_margins_t { + /* Number of bytes to be left at the beginning +* of the external buffer (must be divisible by 16) +*/ + uint16_t start_margins; + /* number of bytes to be left at the end +* of the external buffer(must be divisible by 16) +*/ + uint16_t end_margins; +}; + +struct fm_sp_buffer_offsets_t { + uint32_t data_offset; + uint32_t prs_result_offset; + uint32_t time_stamp_offset; + uint32_t hash_result_offset; +}; + +int fm_sp_build_buffer_structure(struct fm_sp_int_context_data_copy_t +*p_fm_port_int_context_data_copy, +struct fm_buffer_prefix_content_t +*p_buffer_prefix_content, +struct fm_sp_buf_margins_t +*p_fm_port
[RFC,v2,12/12] soc/fman: Add FMan MAC driver
From: Igal Liberman This patch adds the Ethernet MAC driver code. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/inc/mac.h | 125 drivers/soc/fsl/fman/mac/Makefile |3 +- drivers/soc/fsl/fman/mac/mac-api.c | 605 drivers/soc/fsl/fman/mac/mac.c | 521 +++ 4 files changed, 1253 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/fsl/fman/inc/mac.h create mode 100644 drivers/soc/fsl/fman/mac/mac-api.c create mode 100644 drivers/soc/fsl/fman/mac/mac.c diff --git a/drivers/soc/fsl/fman/inc/mac.h b/drivers/soc/fsl/fman/inc/mac.h new file mode 100644 index 000..2d27331 --- /dev/null +++ b/drivers/soc/fsl/fman/inc/mac.h @@ -0,0 +1,125 @@ +/* Copyright 2008-2015 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. + */ + +#ifndef __MAC_H +#define __MAC_H + +#include /* struct device, BUS_ID_SIZE */ +#include /* ETH_ALEN */ +#include /* phy_interface_t, struct phy_device */ +#include + +#include "fsl_fman_drv.h" /* struct port_device */ +#include "fm_mac_ext.h"/* FM MAC API */ +#include "fm_port_ext.h" + +enum {DTSEC, XGMAC, MEMAC}; + +struct mac_device { + struct device *dev; + void*priv; + u8 cell_index; + struct resource *res; + void __iomem*vaddr; + u8 addr[ETH_ALEN]; + bool promisc; + + struct fm *fm_dev; + struct fm_port *port_dev[2]; + + phy_interface_t phy_if; + u32 if_support; + bool link; + u16 speed; + u16 max_speed; + struct device_node *phy_node; + char fixed_bus_id[MII_BUS_ID_SIZE + 3]; + struct device_node *tbi_node; + struct phy_device *phy_dev; + void*fm; + /* List of multicast addresses */ + struct list_head mc_addr_list; + struct platform_device *eth_dev; + + bool autoneg_pause; + bool rx_pause_req; + bool tx_pause_req; + bool rx_pause_active; + bool tx_pause_active; + + struct fm_mac_dev * (*get_mac_handle)(struct mac_device *mac_dev); + int (*init_phy)(struct net_device *net_dev, struct mac_device *mac_dev); + int (*init)(struct mac_device *mac_dev); + int (*start)(struct mac_device *mac_dev); + int (*stop)(struct mac_device *mac_dev); + int (*set_promisc)(struct fm_mac_dev *fm_mac_dev, bool enable); + int (*change_addr)(struct fm_mac_dev *fm_mac_dev, + enet_addr_t *p_enet_addr); + int (*set_multi)(struct net_device *net_dev, +struct mac_device *mac_dev); + int (*uninit)(struct fm_mac_dev *fm_mac_dev); + int (*set_rx_pause)(struct fm_mac_dev *fm_mac_dev, bool en); + int (*set_tx_pause)(struct fm_mac_dev *fm_mac_dev, u8 priority, + u16 pause_time, u16 thresh_time); +}; + +struct mac_address { +
[RFC,v2,06/12] soc/fman: Add the FMan MAC FLIB
From: Igal Liberman The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Makefile |1 + drivers/soc/fsl/fman/mac/Makefile |5 + drivers/soc/fsl/fman/mac/fman_crc32.c | 116 + drivers/soc/fsl/fman/mac/fman_crc32.h | 39 ++ drivers/soc/fsl/fman/mac/fman_dtsec.c | 571 + drivers/soc/fsl/fman/mac/fman_dtsec_mii_acc.c | 168 drivers/soc/fsl/fman/mac/fman_memac.c | 365 drivers/soc/fsl/fman/mac/fman_memac_mii_acc.c | 217 ++ drivers/soc/fsl/fman/mac/fman_tgec.c | 217 ++ 9 files changed, 1699 insertions(+) create mode 100644 drivers/soc/fsl/fman/mac/Makefile create mode 100644 drivers/soc/fsl/fman/mac/fman_crc32.c create mode 100644 drivers/soc/fsl/fman/mac/fman_crc32.h create mode 100644 drivers/soc/fsl/fman/mac/fman_dtsec.c create mode 100644 drivers/soc/fsl/fman/mac/fman_dtsec_mii_acc.c create mode 100644 drivers/soc/fsl/fman/mac/fman_memac.c create mode 100644 drivers/soc/fsl/fman/mac/fman_memac_mii_acc.c create mode 100644 drivers/soc/fsl/fman/mac/fman_tgec.c diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index a0cfd3e..5abd6c4 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -5,3 +5,4 @@ obj-y += fsl_fman.o fsl_fman-objs := fman.o obj-y += port/ +obj-y += mac/ diff --git a/drivers/soc/fsl/fman/mac/Makefile b/drivers/soc/fsl/fman/mac/Makefile new file mode 100644 index 000..80b7048 --- /dev/null +++ b/drivers/soc/fsl/fman/mac/Makefile @@ -0,0 +1,5 @@ +obj-$(CONFIG_FSL_FMAN_MAC) += fsl_fman_mac.o + +fsl_fman_mac-objs := fman_dtsec.o fman_dtsec_mii_acc.o\ + fman_memac.o fman_tgec.o \ + fman_crc32.o fman_memac_mii_acc.o diff --git a/drivers/soc/fsl/fman/mac/fman_crc32.c b/drivers/soc/fsl/fman/mac/fman_crc32.c new file mode 100644 index 000..1536d12 --- /dev/null +++ b/drivers/soc/fsl/fman/mac/fman_crc32.c @@ -0,0 +1,116 @@ +/* + * Copyright 2008 - 2015 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 "fman_crc32.h" +#include "common/general.h" + +/* precomputed CRC values for address hashing */ +static const uint32_t crc_tbl[256] = { + 0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bd
[PATCH] dt/bindings: qoriq-clock: Add binding for FMan clock mux
From: Igal Liberman Signed-off-by: Igal Liberman --- .../devicetree/bindings/clock/qoriq-clock.txt | 59 1 file changed, 59 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/qoriq-clock.txt b/Documentation/devicetree/bindings/clock/qoriq-clock.txt index df4a259..a7e84ce 100644 --- a/Documentation/devicetree/bindings/clock/qoriq-clock.txt +++ b/Documentation/devicetree/bindings/clock/qoriq-clock.txt @@ -65,6 +65,7 @@ Required properties: It takes parent's clock-frequency as its clock. * "fsl,qoriq-platform-pll-1.0" for the platform PLL clock (v1.0) * "fsl,qoriq-platform-pll-2.0" for the platform PLL clock (v2.0) + * "fsl,fman-clk-mux" for the Frame Manager clock. - #clock-cells: From common clock binding. The number of cells in a clock-specifier. Should be <0> for "fsl,qoriq-sysclk-[1,2].0" clocks, or <1> for "fsl,qoriq-core-pll-[1,2].0" clocks. @@ -73,6 +74,52 @@ Required properties: * 0 - equal to the PLL frequency * 1 - equal to the PLL frequency divided by 2 * 2 - equal to the PLL frequency divided by 4 + For "fsl,fman-clk-mux" clocks, the single clock-specifier cell may + take values according the Reset Configuration Word of the specific + device: + * P2041, P3041: + * 0 - equal to platform PLL divided by 2 + * 1 - equal to PLL2 divided by 2 + * P4080 (Both FMans): + * 0 - equal to platform PLL divided by 2 + * 1 - equal to PLL3 divided by 2 + * P5020: + * 0 - equal to platform PLL divided by 2 + * 1 - equal to PLL2 divided by 2 + * 2 - equal to PLL2 divided by 4 + * P5040 (Both FMans): + * 0 - equal to platform PLL divided by 2 + * 1 - equal to PLL3 divided by 2 + * 2 - equal to PLL3 divided by 4 + * T1024: + * 0 - equal to PLL1 divided by 2 + * T1040: + * 0 - equal to platform PLL + * T2080, B4860, B4420: + * 0 - equal to PLL1 + * 1 - equal to PLL1 divided by 2 + * 2 - equal to PLL1 divided by 3 + * 3 - equal to PLL1 divided by 4 + * 4 - equal to platform PLL + * 5 - equal to PLL2 divided by 2 + * 6 - equal to PLL2 divided by 3 + * T4240: + * FM1: + * 0 equal to PLL1 divided by 2 + * 1 equal to PLL1 divided by 3 + * 2 equal to PLL1 divided by 4 + * 3 equal to platform PLL + * 4 equal to PLL2 divided by 2 + * FM2: + * 0 equal to PLL2 divided by 2 + * 1 equal to PLL2 divided by 3 + * 2 equal to PLL2 divided by 4 + * 3 equal to platform PLL + * 4 equal to PLL1 divided by 2 + * 5 equal to PLL1 divided by 3 + In Part of FMan V3 devices (B4, T2, T4) the single + clock-specifier cell may be determined by the CLKCGxHWACSR + register in addtion to RCW. Recommended properties: - clocks: Should be the phandle of input parent clock @@ -139,6 +186,18 @@ Example for clock block and clock provider: clocks = <&sysclk>; clock-output-names = "platform-pll", "platform-pll-div2"; }; + + fm0clk: fm0-clk-mux { + #clock-cells = <0>; + reg = <0x10 4> + compatible = "fsl,fman-clk-mux"; + clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, <&pll0 3>, +<&platform_pll 0>, <&pll1 1>, <&pll1 2>; + clock-names = "pll0", "pll0-div2", "pll0-div3", + "pll0-div4", "platform-pll", "pll1-div2", + "pll1-div3"; + clock-output-names = "fm0-clk"; + }; }; }; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v2] dt/bindings: qoriq-clock: Add binding for FMan clock mux
From: Igal Liberman v2: Addressed feedback from Scott: - Moved the "fman-clk-mux" clock provider details under "clocks" property. Signed-off-by: Igal Liberman --- .../devicetree/bindings/clock/qoriq-clock.txt | 63 +++- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/clock/qoriq-clock.txt b/Documentation/devicetree/bindings/clock/qoriq-clock.txt index df4a259..4d63ac6 100644 --- a/Documentation/devicetree/bindings/clock/qoriq-clock.txt +++ b/Documentation/devicetree/bindings/clock/qoriq-clock.txt @@ -65,9 +65,10 @@ Required properties: It takes parent's clock-frequency as its clock. * "fsl,qoriq-platform-pll-1.0" for the platform PLL clock (v1.0) * "fsl,qoriq-platform-pll-2.0" for the platform PLL clock (v2.0) + * "fsl,fman-clk-mux" for the Frame Manager clock. - #clock-cells: From common clock binding. The number of cells in a - clock-specifier. Should be <0> for "fsl,qoriq-sysclk-[1,2].0" - clocks, or <1> for "fsl,qoriq-core-pll-[1,2].0" clocks. + clock-specifier. Should be <0> for "fsl,qoriq-sysclk-[1,2].0" and + "fsl,fman-clk-mux" clocks or <1> for "fsl,qoriq-core-pll-[1,2].0". For "fsl,qoriq-core-pll-[1,2].0" clocks, the single clock-specifier cell may take the following values: * 0 - equal to the PLL frequency @@ -76,6 +77,52 @@ Required properties: Recommended properties: - clocks: Should be the phandle of input parent clock + For "fsl,fman-clk-mux" clock there are several options for parent + clock (clock provider), the parent is determined according to the + Reset Configuration Word of the specific device: + * P2041, P3041: + * 0 - equal to platform PLL divided by 2 + * 1 - equal to PLL2 divided by 2 + * P4080 (Both FMans): + * 0 - equal to platform PLL divided by 2 + * 1 - equal to PLL3 divided by 2 + * P5020: + * 0 - equal to platform PLL divided by 2 + * 1 - equal to PLL2 divided by 2 + * 2 - equal to PLL2 divided by 4 + * P5040 (Both FMans): + * 0 - equal to platform PLL divided by 2 + * 1 - equal to PLL3 divided by 2 + * 2 - equal to PLL3 divided by 4 + * T1024: + * 0 - equal to PLL1 divided by 2 + * T1040: + * 0 - equal to platform PLL + * T2080, B4860, B4420: + * 0 - equal to PLL1 + * 1 - equal to PLL1 divided by 2 + * 2 - equal to PLL1 divided by 3 + * 3 - equal to PLL1 divided by 4 + * 4 - equal to platform PLL + * 5 - equal to PLL2 divided by 2 + * 6 - equal to PLL2 divided by 3 + * T4240: + * FM1: + * 0 equal to PLL1 divided by 2 + * 1 equal to PLL1 divided by 3 + * 2 equal to PLL1 divided by 4 + * 3 equal to platform PLL + * 4 equal to PLL2 divided by 2 + * FM2: + * 0 equal to PLL2 divided by 2 + * 1 equal to PLL2 divided by 3 + * 2 equal to PLL2 divided by 4 + * 3 equal to platform PLL + * 4 equal to PLL1 divided by 2 + * 5 equal to PLL1 divided by 3 + In Part of FMan V3 devices (B4, T2, T4) the single + clock-specifier cell may be determined by the CLKCGxHWACSR + register in addtion to RCW. - clock-names: From common clock binding, indicates the clock name - clock-output-names: From common clock binding, indicates the names of output clocks @@ -139,6 +186,18 @@ Example for clock block and clock provider: clocks = <&sysclk>; clock-output-names = "platform-pll", "platform-pll-div2"; }; + + fm0clk: fm0-clk-mux { + #clock-cells = <0>; + reg = <0x10 4> + compatible = "fsl,fman-clk-mux"; + clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, <&pll0 3>, +<&platform_pll 0>, <&pll1 1>, <&pll1 2>; + clock-names = "pll0", "pll0-div2", "pll0-div3", +
[PATCH] dt/bindings: fsl/guts: Added global-utilities compatibles
From: Igal Liberman Signed-off-by: Igal Liberman --- .../devicetree/bindings/powerpc/fsl/guts.txt | 14 ++ 1 file changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt index 7f150b5..e4f0ac2 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt +++ b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt @@ -9,6 +9,20 @@ Required properties: - compatible : Should define the compatible device type for global-utilities. + Possible compatibles: + "fsl,qoriq-device-config-1.0" + "fsl,p2041-device-config" + "fsl,p3041-device-config" + "fsl,p4080-device-config" + "fsl,p5020-device-config" + "fsl,p5040-device-config" + "fsl,qoriq-device-config-2.0" + "fsl,b4860-device-config" + "fsl,b4420-device-config" + "fsl,b4-device-config" + "fsl,t1040-device-config" + "fsl,t2080-device-config" + "fsl,t4240-device-config" - reg : Offset and length of the register set for the device. Recommended properties: -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/dts: Add some SoC specific "fsl, *-device-config" compatibles
From: Igal Liberman This patch is required for: https://patchwork.ozlabs.org/patch/459584/ Signed-off-by: Igal Liberman --- arch/powerpc/boot/dts/fsl/b4420si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/b4860si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi|3 ++- arch/powerpc/boot/dts/fsl/p2041si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/p3041si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/p4080si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/p5020si-post.dtsi |3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi index 1ea8602..9b14f24 100644 --- a/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi @@ -77,7 +77,8 @@ }; guts: global-utilities@e { - compatible = "fsl,b4420-device-config", "fsl,qoriq-device-config-2.0"; + compatible = "fsl,b4420-device-config", "fsl,b4-device-config", + "fsl,qoriq-device-config-2.0"; }; global-utilities@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi index 02ccde6..74a9f5f 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi @@ -248,7 +248,8 @@ }; guts: global-utilities@e { - compatible = "fsl,b4860-device-config", "fsl,qoriq-device-config-2.0"; + compatible = "fsl,b4860-device-config", "fsl,b4-device-config", +"fsl,qoriq-device-config-2.0"; }; global-utilities@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi index f8c325e..babb076 100644 --- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi @@ -391,7 +391,8 @@ /include/ "qoriq-mpic4.3.dtsi" guts: global-utilities@e { - compatible = "fsl,b4-device-config"; + compatible = "fsl,b4-device-config", + "fsl,qoriq-device-config-2.0"; reg = <0xe 0xe00>; fsl,has-rstcr; fsl,liodn-bits = <12>; diff --git a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi index 1f18b8b..a7ae5ae 100644 --- a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi @@ -311,7 +311,8 @@ /include/ "qoriq-mpic.dtsi" guts: global-utilities@e { - compatible = "fsl,qoriq-device-config-1.0"; + compatible = "fsl,p2041-device-config", + "fsl,qoriq-device-config-1.0"; reg = <0xe 0xe00>; fsl,has-rstcr; #sleep-cells = <1>; diff --git a/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi index a555d24..89d08d6 100644 --- a/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi @@ -338,7 +338,8 @@ /include/ "qoriq-mpic.dtsi" guts: global-utilities@e { - compatible = "fsl,qoriq-device-config-1.0"; + compatible = "fsl,p3041-device-config", + "fsl,qoriq-device-config-1.0"; reg = <0xe 0xe00>; fsl,has-rstcr; #sleep-cells = <1>; diff --git a/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi b/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi index 0fe7281..1863d6a 100644 --- a/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi @@ -358,7 +358,8 @@ /include/ "qoriq-mpic.dtsi" guts: global-utilities@e { - compatible = "fsl,qoriq-device-config-1.0"; + compatible = "fsl,p4080-device-config", + "fsl,qoriq-device-config-1.0"; reg = <0xe 0xe00>; fsl,has-rstcr; #sleep-cells = <1>; diff --git a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi index a34ca20..d979d01 100644 --- a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi @@ -343,7 +343,8 @@ /include/ "qoriq-mpic.dtsi" guts: global-utilities@e { - compatible = "fsl,qoriq-device-config-1.0"; + compatible = "fsl,p5020-device-config", + "fsl,qoriq-device-config-1.0"; reg = <0xe 0xe00>; fsl,has-rstcr; #sleep-cells = <1>; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v2] clk: qoriq: Add support for the FMan clock
From: Igal Liberman v2: - Added clock maintainers - Cached FMan clock parent during initialization - Register the clock after checking if the hardware exists - updated error messages Signed-off-by: Igal Liberman --- drivers/clk/clk-qoriq.c | 208 +++ 1 file changed, 208 insertions(+) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index cda90a9..d588e90 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -19,6 +19,8 @@ #include #include +#include + struct cmux_clk { struct clk_hw hw; void __iomem *reg; @@ -155,6 +157,211 @@ err_name: kfree(parent_names); } +/* Table for matching compatible strings, for device tree + * guts node, for QorIQ SOCs. + * "fsl,qoriq-device-config-2.0" corresponds to T4 & B4 + * SOCs. For the older SOCs "fsl,qoriq-device-config-1.0" + * string would be used. + */ + +static const struct of_device_id guts_device_ids[] = { + { .compatible = "fsl,qoriq-device-config-1.0", }, + { .compatible = "fsl,qoriq-device-config-2.0", }, + {} +}; + +/* P2, P3, P4, P5 */ +#define FM1_CLK_SEL_SHIFT 30 +#define FM1_CLK_SELBIT(FM1_CLK_SEL_SHIFT) +#define FM2_CLK_SEL_SHIFT 29 +#define FM2_CLK_SELBIT(FM2_CLK_SEL_SHIFT) +#define HWA_ASYNC_DIV_SHIFT26 +#define HWA_ASYNC_DIV BIT(HWA_ASYNC_DIV_SHIFT) + +/* B4, T2 */ +#define HWA_CGA_M1_CLK_SEL_SHIFT 29 +#define HWA_CGA_M1_CLK_SEL (BIT(HWA_CGA_M1_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGA_M1_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGA_M1_CLK_SEL_SHIFT)) + +/* T4240 */ +#define HWA_CGB_M1_CLK_SEL_SHIFT 26 +#define HWA_CGB_M1_CLK_SEL (BIT(HWA_CGB_M1_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGB_M1_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGB_M1_CLK_SEL_SHIFT)) +#define HWA_CGB_M2_CLK_SEL_SHIFT 3 +#define HWA_CGB_M2_CLK_SEL (BIT(HWA_CGB_M2_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGB_M2_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGB_M2_CLK_SEL_SHIFT)) + +static u8 get_fm_clk_parent(struct clk_hw *hw) +{ + return hw->init->flags; +} + +static const struct clk_ops fm_clk_ops = { + .get_parent = get_fm_clk_parent, +}; + +static int get_fm_clk_idx(int fm_id, int *fm_clk_idx) +{ + struct ccsr_guts __iomem *guts_regs = NULL; + struct device_node *guts; + uint32_t reg = 0; + int clk_src = 0; + + guts = of_find_matching_node(NULL, guts_device_ids); + if (!guts) { + pr_err("could not find GUTS node\n"); + return -ENODEV; + } + + guts_regs = of_iomap(guts, 0); + of_node_put(guts); + if (!guts_regs) { + pr_err("ioremap of GUTS node failed\n"); + return -ENODEV; + } + + if (of_device_is_compatible(guts, "fsl,p1023-guts") || + of_device_is_compatible(guts, "fsl,t1040-device-config")) { + /* P1023 and T1040 have only one optional clock source */ + *fm_clk_idx = 0; + } else if (of_device_is_compatible(guts, "fsl,p2041-device-config") || + of_device_is_compatible(guts, "fsl,p3041-device-config") || + of_device_is_compatible(guts, "fsl,p4080-device-config")) { + /* Read RCW*/ + reg = ioread32be(&guts_regs->rcwsr[7]); + + if (fm_id == 0) + *fm_clk_idx = (reg & FM1_CLK_SEL) >> + FM1_CLK_SEL_SHIFT; + else + *fm_clk_idx = (reg & FM2_CLK_SEL) >> + FM2_CLK_SEL_SHIFT; + } else if (of_device_is_compatible(guts, "fsl,p5020-device-config") || + of_device_is_compatible(guts, "fsl,p5040-device-config")) { + /* Read RCW */ + reg = ioread32be(&guts_regs->rcwsr[7]); + + if (fm_id == 0) + clk_src = (reg & FM1_CLK_SEL) >> FM1_CLK_SEL_SHIFT; + else + clk_src = (reg & FM2_CLK_SEL) >> FM2_CLK_SEL_SHIFT; + + if (clk_src == 0) { + *fm_clk_idx = 0; + } else { + clk_src = (reg & HWA_ASYNC_DIV) >> HWA_ASYNC_DIV_SHIFT; + *fm_clk_idx = clk_src + 1; + } + } else if (of_device_is_compatible(guts, "fsl,b4-device-config") || +
[PATCH] dt/bindings: qoriq-clock: Update core PLL binding
From: Igal Liberman Added optional divider to "fsl,qoriq-core-pll-2.0". This option might be used by Freescale hardware accelerators. Signed-off-by: Igal Liberman --- .../devicetree/bindings/clock/qoriq-clock.txt |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/clock/qoriq-clock.txt b/Documentation/devicetree/bindings/clock/qoriq-clock.txt index df4a259..b0d7b73 100644 --- a/Documentation/devicetree/bindings/clock/qoriq-clock.txt +++ b/Documentation/devicetree/bindings/clock/qoriq-clock.txt @@ -68,11 +68,17 @@ Required properties: - #clock-cells: From common clock binding. The number of cells in a clock-specifier. Should be <0> for "fsl,qoriq-sysclk-[1,2].0" clocks, or <1> for "fsl,qoriq-core-pll-[1,2].0" clocks. - For "fsl,qoriq-core-pll-[1,2].0" clocks, the single + For "fsl,qoriq-core-pll-1.0" clocks, the single clock-specifier cell may take the following values: * 0 - equal to the PLL frequency * 1 - equal to the PLL frequency divided by 2 * 2 - equal to the PLL frequency divided by 4 + For "fsl,qoriq-core-pll-2.0" clocks, the single + clock-specifier cell may take the following values: + * 0 - equal to the PLL frequency + * 1 - equal to the PLL frequency divided by 2 + * 2 - equal to the PLL frequency divided by 3 + * 3 - equal to the PLL frequency divided by 4 Recommended properties: - clocks: Should be the phandle of input parent clock -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/dts: Update the core cluster PLL node(s)
From: Igal Liberman This patch replaces the following: https://patchwork.ozlabs.org/patch/427664/ This patch is described by the following binding document update: https://patchwork.ozlabs.org/patch/461150/ Signed-off-by: Igal Liberman --- arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi index 48e0b6e..7e1f074 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi @@ -49,14 +49,16 @@ global-utilities@e1000 { reg = <0x800 0x4>; compatible = "fsl,qoriq-core-pll-2.0"; clocks = <&sysclk>; - clock-output-names = "pll0", "pll0-div2", "pll0-div4"; + clock-output-names = "pll0", "pll0-div2", "pll0-div3", + "pll0-div4"; }; pll1: pll1@820 { #clock-cells = <1>; reg = <0x820 0x4>; compatible = "fsl,qoriq-core-pll-2.0"; clocks = <&sysclk>; - clock-output-names = "pll1", "pll1-div2", "pll1-div4"; + clock-output-names = "pll1", "pll1-div2", "pll1-div3", + "pll1-div4"; }; platform_pll: platform-pll@c00 { #clock-cells = <1>; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v2] dt/bindings: fsl/guts: Added global-utilities compatibles
From: Igal Liberman v2 - Addressed Scott's feedback Signed-off-by: Igal Liberman --- .../devicetree/bindings/powerpc/fsl/guts.txt |4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt index 7f150b5..69644e6 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt +++ b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt @@ -9,6 +9,10 @@ Required properties: - compatible : Should define the compatible device type for global-utilities. + Possible compatibles: + "fsl,qoriq-device-config-1.0" + "fsl,qoriq-device-config-2.0" + "fsl,-device-config" - reg : Offset and length of the register set for the device. Recommended properties: -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v2] powerpc/dts: Add some SoC specific "fsl, *-device-config" compatibles
From: Igal Liberman This patch adds "fsl,-device-config" compatibles to guts node. The added compatibles used in Freescale FMan clock initialization. This patches is described by the following binding document update: https://patchwork.ozlabs.org/patch/461153/ v2: Updated commit message Signed-off-by: Igal Liberman --- arch/powerpc/boot/dts/fsl/b4420si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/b4860si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi|3 ++- arch/powerpc/boot/dts/fsl/p2041si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/p3041si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/p4080si-post.dtsi |3 ++- arch/powerpc/boot/dts/fsl/p5020si-post.dtsi |3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi index 1ea8602..9b14f24 100644 --- a/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi @@ -77,7 +77,8 @@ }; guts: global-utilities@e { - compatible = "fsl,b4420-device-config", "fsl,qoriq-device-config-2.0"; + compatible = "fsl,b4420-device-config", "fsl,b4-device-config", + "fsl,qoriq-device-config-2.0"; }; global-utilities@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi index 02ccde6..74a9f5f 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi @@ -248,7 +248,8 @@ }; guts: global-utilities@e { - compatible = "fsl,b4860-device-config", "fsl,qoriq-device-config-2.0"; + compatible = "fsl,b4860-device-config", "fsl,b4-device-config", +"fsl,qoriq-device-config-2.0"; }; global-utilities@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi index f8c325e..babb076 100644 --- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi @@ -391,7 +391,8 @@ /include/ "qoriq-mpic4.3.dtsi" guts: global-utilities@e { - compatible = "fsl,b4-device-config"; + compatible = "fsl,b4-device-config", + "fsl,qoriq-device-config-2.0"; reg = <0xe 0xe00>; fsl,has-rstcr; fsl,liodn-bits = <12>; diff --git a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi index 1f18b8b..a7ae5ae 100644 --- a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi @@ -311,7 +311,8 @@ /include/ "qoriq-mpic.dtsi" guts: global-utilities@e { - compatible = "fsl,qoriq-device-config-1.0"; + compatible = "fsl,p2041-device-config", + "fsl,qoriq-device-config-1.0"; reg = <0xe 0xe00>; fsl,has-rstcr; #sleep-cells = <1>; diff --git a/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi index a555d24..89d08d6 100644 --- a/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi @@ -338,7 +338,8 @@ /include/ "qoriq-mpic.dtsi" guts: global-utilities@e { - compatible = "fsl,qoriq-device-config-1.0"; + compatible = "fsl,p3041-device-config", + "fsl,qoriq-device-config-1.0"; reg = <0xe 0xe00>; fsl,has-rstcr; #sleep-cells = <1>; diff --git a/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi b/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi index 0fe7281..1863d6a 100644 --- a/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi @@ -358,7 +358,8 @@ /include/ "qoriq-mpic.dtsi" guts: global-utilities@e { - compatible = "fsl,qoriq-device-config-1.0"; + compatible = "fsl,p4080-device-config", + "fsl,qoriq-device-config-1.0"; reg = <0xe 0xe00>; fsl,has-rstcr; #sleep-cells = <1>; diff --git a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi index a34ca20..d979d01 100644 --- a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi @@ -343,7 +343,8 @@ /include/ "qoriq-mpic.dtsi"
[v3] dt/bindings: qoriq-clock: Add binding for FMan clock mux
From: Igal Liberman v3: Addressed feedback from Scott: - Removed clock specifier description. v2: Addressed feedback from Scott: - Moved the "fman-clk-mux" clock provider details under "clocks" property. Signed-off-by: Igal Liberman --- .../devicetree/bindings/clock/qoriq-clock.txt | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/clock/qoriq-clock.txt b/Documentation/devicetree/bindings/clock/qoriq-clock.txt index b0d7b73..2bb3b38 100644 --- a/Documentation/devicetree/bindings/clock/qoriq-clock.txt +++ b/Documentation/devicetree/bindings/clock/qoriq-clock.txt @@ -65,9 +65,10 @@ Required properties: It takes parent's clock-frequency as its clock. * "fsl,qoriq-platform-pll-1.0" for the platform PLL clock (v1.0) * "fsl,qoriq-platform-pll-2.0" for the platform PLL clock (v2.0) + * "fsl,fman-clk-mux" for the Frame Manager clock. - #clock-cells: From common clock binding. The number of cells in a - clock-specifier. Should be <0> for "fsl,qoriq-sysclk-[1,2].0" - clocks, or <1> for "fsl,qoriq-core-pll-[1,2].0" clocks. + clock-specifier. Should be <0> for "fsl,qoriq-sysclk-[1,2].0" and + "fsl,fman-clk-mux" clocks or <1> for "fsl,qoriq-core-pll-[1,2].0". For "fsl,qoriq-core-pll-1.0" clocks, the single clock-specifier cell may take the following values: * 0 - equal to the PLL frequency @@ -145,6 +146,18 @@ Example for clock block and clock provider: clocks = <&sysclk>; clock-output-names = "platform-pll", "platform-pll-div2"; }; + + fm0clk: fm0-clk-mux { + #clock-cells = <0>; + reg = <0x10 4> + compatible = "fsl,fman-clk-mux"; + clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, <&pll0 3>, +<&platform_pll 0>, <&pll1 1>, <&pll1 2>; + clock-names = "pll0", "pll0-div2", "pll0-div3", + "pll0-div4", "platform-pll", "pll1-div2", + "pll1-div3"; + clock-output-names = "fm0-clk"; + }; }; }; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v3] clk: qoriq: Add support for the FMan clock
From: Igal Liberman This patch depends on the following patches: https://patchwork.ozlabs.org/patch/461151/ https://patchwork.ozlabs.org/patch/461155/ This patche is described by the following binding document update: https://patchwork.ozlabs.org/patch/461166/ v3: Updated commit message v2: - Added clock maintainers - Cached FMan clock parent during initialization - Register the clock after checking if the hardware exists - updated error messages Signed-off-by: Igal Liberman --- drivers/clk/clk-qoriq.c | 208 +++ 1 file changed, 208 insertions(+) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index cda90a9..d588e90 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -19,6 +19,8 @@ #include #include +#include + struct cmux_clk { struct clk_hw hw; void __iomem *reg; @@ -155,6 +157,211 @@ err_name: kfree(parent_names); } +/* Table for matching compatible strings, for device tree + * guts node, for QorIQ SOCs. + * "fsl,qoriq-device-config-2.0" corresponds to T4 & B4 + * SOCs. For the older SOCs "fsl,qoriq-device-config-1.0" + * string would be used. + */ + +static const struct of_device_id guts_device_ids[] = { + { .compatible = "fsl,qoriq-device-config-1.0", }, + { .compatible = "fsl,qoriq-device-config-2.0", }, + {} +}; + +/* P2, P3, P4, P5 */ +#define FM1_CLK_SEL_SHIFT 30 +#define FM1_CLK_SELBIT(FM1_CLK_SEL_SHIFT) +#define FM2_CLK_SEL_SHIFT 29 +#define FM2_CLK_SELBIT(FM2_CLK_SEL_SHIFT) +#define HWA_ASYNC_DIV_SHIFT26 +#define HWA_ASYNC_DIV BIT(HWA_ASYNC_DIV_SHIFT) + +/* B4, T2 */ +#define HWA_CGA_M1_CLK_SEL_SHIFT 29 +#define HWA_CGA_M1_CLK_SEL (BIT(HWA_CGA_M1_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGA_M1_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGA_M1_CLK_SEL_SHIFT)) + +/* T4240 */ +#define HWA_CGB_M1_CLK_SEL_SHIFT 26 +#define HWA_CGB_M1_CLK_SEL (BIT(HWA_CGB_M1_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGB_M1_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGB_M1_CLK_SEL_SHIFT)) +#define HWA_CGB_M2_CLK_SEL_SHIFT 3 +#define HWA_CGB_M2_CLK_SEL (BIT(HWA_CGB_M2_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGB_M2_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGB_M2_CLK_SEL_SHIFT)) + +static u8 get_fm_clk_parent(struct clk_hw *hw) +{ + return hw->init->flags; +} + +static const struct clk_ops fm_clk_ops = { + .get_parent = get_fm_clk_parent, +}; + +static int get_fm_clk_idx(int fm_id, int *fm_clk_idx) +{ + struct ccsr_guts __iomem *guts_regs = NULL; + struct device_node *guts; + uint32_t reg = 0; + int clk_src = 0; + + guts = of_find_matching_node(NULL, guts_device_ids); + if (!guts) { + pr_err("could not find GUTS node\n"); + return -ENODEV; + } + + guts_regs = of_iomap(guts, 0); + of_node_put(guts); + if (!guts_regs) { + pr_err("ioremap of GUTS node failed\n"); + return -ENODEV; + } + + if (of_device_is_compatible(guts, "fsl,p1023-guts") || + of_device_is_compatible(guts, "fsl,t1040-device-config")) { + /* P1023 and T1040 have only one optional clock source */ + *fm_clk_idx = 0; + } else if (of_device_is_compatible(guts, "fsl,p2041-device-config") || + of_device_is_compatible(guts, "fsl,p3041-device-config") || + of_device_is_compatible(guts, "fsl,p4080-device-config")) { + /* Read RCW*/ + reg = ioread32be(&guts_regs->rcwsr[7]); + + if (fm_id == 0) + *fm_clk_idx = (reg & FM1_CLK_SEL) >> + FM1_CLK_SEL_SHIFT; + else + *fm_clk_idx = (reg & FM2_CLK_SEL) >> + FM2_CLK_SEL_SHIFT; + } else if (of_device_is_compatible(guts, "fsl,p5020-device-config") || + of_device_is_compatible(guts, "fsl,p5040-device-config")) { + /* Read RCW */ + reg = ioread32be(&guts_regs->rcwsr[7]); + + if (fm_id == 0) + clk_src = (reg & FM1_CLK_SEL) >> FM1_CLK_SEL_SHIFT; + else + clk_src = (reg & FM2_CLK_SEL) >> FM2_CLK_SEL_SHIFT; + + if (clk_src == 0) { + *fm_clk_idx =
[v3] dt/bindings: fsl/guts: Added global-utilities compatibles
From: Igal Liberman v3 - Addressed Scott's feedback: Added "fsl,-guts" v2 - Addressed Scott's feedback Signed-off-by: Igal Liberman --- .../devicetree/bindings/powerpc/fsl/guts.txt |5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt index 7f150b5..b71b203 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt +++ b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt @@ -9,6 +9,11 @@ Required properties: - compatible : Should define the compatible device type for global-utilities. + Possible compatibles: + "fsl,qoriq-device-config-1.0" + "fsl,qoriq-device-config-2.0" + "fsl,-device-config" + "fsl,-guts" - reg : Offset and length of the register set for the device. Recommended properties: -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/dts: Fix incorrect clock-names property
From: Igal Liberman Signed-off-by: Igal Liberman --- arch/powerpc/boot/dts/fsl/t2081si-post.dtsi |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi index 3dee307..1462431 100644 --- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi @@ -589,7 +589,7 @@ compatible = "fsl,qoriq-core-mux-2.0"; clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, <&pll1 0>, <&pll1 1>, <&pll1 2>; - clock-names = "pll0", "pll0-div2", "pll1-div4", + clock-names = "pll0", "pll0-div2", "pll0-div4", "pll1", "pll1-div2", "pll1-div4"; clock-output-names = "cmux0"; }; @@ -600,7 +600,7 @@ compatible = "fsl,qoriq-core-mux-2.0"; clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, <&pll1 0>, <&pll1 1>, <&pll1 2>; - clock-names = "pll0", "pll0-div2", "pll1-div4", + clock-names = "pll0", "pll0-div2", "pll0-div4", "pll1", "pll1-div2", "pll1-div4"; clock-output-names = "cmux1"; }; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v4] clk: qoriq: Add support for the FMan clock
From: Igal Liberman This patch depends on the following patches: https://patchwork.ozlabs.org/patch/461151/ https://patchwork.ozlabs.org/patch/461155/ This patche is described by the following binding document update: https://patchwork.ozlabs.org/patch/461166/ v4: - Replaced "fsl,b4-device-config" with "fsl,b4860/b4420-device-config" - Updated error messages v3: Updated commit message v2: - Added clock maintainers - Cached FMan clock parent during initialization - Register the clock after checking if the hardware exists - updated error messages Signed-off-by: Igal Liberman --- drivers/clk/clk-qoriq.c | 213 +++ 1 file changed, 213 insertions(+) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index cda90a9..871c6df 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -19,6 +19,8 @@ #include #include +#include + struct cmux_clk { struct clk_hw hw; void __iomem *reg; @@ -155,6 +157,216 @@ err_name: kfree(parent_names); } +/* Table for matching compatible strings, for device tree + * guts node, for QorIQ SOCs. + * "fsl,qoriq-device-config-2.0" corresponds to T4 & B4 + * SOCs. For the older SOCs "fsl,qoriq-device-config-1.0" + * string would be used. + */ + +static const struct of_device_id guts_device_ids[] = { + { .compatible = "fsl,qoriq-device-config-1.0", }, + { .compatible = "fsl,qoriq-device-config-2.0", }, + {} +}; + +/* P2, P3, P4, P5 */ +#define FM1_CLK_SEL_SHIFT 30 +#define FM1_CLK_SELBIT(FM1_CLK_SEL_SHIFT) +#define FM2_CLK_SEL_SHIFT 29 +#define FM2_CLK_SELBIT(FM2_CLK_SEL_SHIFT) +#define HWA_ASYNC_DIV_SHIFT26 +#define HWA_ASYNC_DIV BIT(HWA_ASYNC_DIV_SHIFT) + +/* B4, T2 */ +#define HWA_CGA_M1_CLK_SEL_SHIFT 29 +#define HWA_CGA_M1_CLK_SEL (BIT(HWA_CGA_M1_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGA_M1_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGA_M1_CLK_SEL_SHIFT)) + +/* T4240 */ +#define HWA_CGB_M1_CLK_SEL_SHIFT 26 +#define HWA_CGB_M1_CLK_SEL (BIT(HWA_CGB_M1_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGB_M1_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGB_M1_CLK_SEL_SHIFT)) +#define HWA_CGB_M2_CLK_SEL_SHIFT 3 +#define HWA_CGB_M2_CLK_SEL (BIT(HWA_CGB_M2_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGB_M2_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGB_M2_CLK_SEL_SHIFT)) + +static u8 get_fm_clk_parent(struct clk_hw *hw) +{ + return hw->init->flags; +} + +static const struct clk_ops fm_clk_ops = { + .get_parent = get_fm_clk_parent, +}; + +static int get_fm_clk_idx(int fm_id, int *fm_clk_idx) +{ + struct ccsr_guts __iomem *guts_regs = NULL; + struct device_node *guts; + uint32_t reg = 0; + int clk_src = 0; + + guts = of_find_matching_node(NULL, guts_device_ids); + if (!guts) { + pr_err("%s(): could not find GUTS node\n", __func__); + return -ENODEV; + } + + guts_regs = of_iomap(guts, 0); + of_node_put(guts); + if (!guts_regs) { + pr_err("%s(): ioremap of GUTS node failed\n", __func__); + return -ENODEV; + } + + if (of_device_is_compatible(guts, "fsl,p1023-guts") || + of_device_is_compatible(guts, "fsl,t1040-device-config")) { + /* P1023 and T1040 have only one optional clock source */ + *fm_clk_idx = 0; + } else if (of_device_is_compatible(guts, "fsl,p2041-device-config") || + of_device_is_compatible(guts, "fsl,p3041-device-config") || + of_device_is_compatible(guts, "fsl,p4080-device-config")) { + /* Read RCW*/ + reg = ioread32be(&guts_regs->rcwsr[7]); + + if (fm_id == 0) + *fm_clk_idx = (reg & FM1_CLK_SEL) >> + FM1_CLK_SEL_SHIFT; + else + *fm_clk_idx = (reg & FM2_CLK_SEL) >> + FM2_CLK_SEL_SHIFT; + } else if (of_device_is_compatible(guts, "fsl,p5020-device-config") || + of_device_is_compatible(guts, "fsl,p5040-device-config")) { + /* Read RCW */ + reg = ioread32be(&guts_regs->rcwsr[7]); + + if (fm_id == 0) + clk_src = (reg & FM1_CLK_SEL) >> FM1_CLK_SEL_S
[PATCH] powerpc/dts: Move pll0/1-div4 index
From: Igal Liberman This patch updates pll0/1-div4 index to '3'. Originally it was '2'. The following patch adds pll0/1-div3 option: https://patchwork.ozlabs.org/patch/461151/ After this patch, index '2' becomes pll0/1-div3. This patch based on top of the following: https://patchwork.ozlabs.org/patch/461811/ Signed-off-by: Igal Liberman --- arch/powerpc/boot/dts/fsl/b4si-post.dtsi|4 ++-- arch/powerpc/boot/dts/fsl/t2081si-post.dtsi |8 arch/powerpc/boot/dts/fsl/t4240si-post.dtsi |8 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi index 8d061a4..d6c410d 100644 --- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi @@ -446,8 +446,8 @@ #clock-cells = <0>; reg = <0x0 0x4>; compatible = "fsl,qoriq-core-mux-2.0"; - clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, - <&pll1 0>, <&pll1 1>, <&pll1 2>; + clocks = <&pll0 0>, <&pll0 1>, <&pll0 3>, + <&pll1 0>, <&pll1 1>, <&pll1 3>; clock-names = "pll0", "pll0-div2", "pll0-div4", "pll1", "pll1-div2", "pll1-div4"; clock-output-names = "cmux0"; diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi index 1462431..e347f2d 100644 --- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi @@ -587,8 +587,8 @@ #clock-cells = <0>; reg = <0x0 4>; compatible = "fsl,qoriq-core-mux-2.0"; - clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, -<&pll1 0>, <&pll1 1>, <&pll1 2>; + clocks = <&pll0 0>, <&pll0 1>, <&pll0 3>, +<&pll1 0>, <&pll1 1>, <&pll1 3>; clock-names = "pll0", "pll0-div2", "pll0-div4", "pll1", "pll1-div2", "pll1-div4"; clock-output-names = "cmux0"; @@ -598,8 +598,8 @@ #clock-cells = <0>; reg = <0x20 4>; compatible = "fsl,qoriq-core-mux-2.0"; - clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, -<&pll1 0>, <&pll1 1>, <&pll1 2>; + clocks = <&pll0 0>, <&pll0 1>, <&pll0 3>, +<&pll1 0>, <&pll1 1>, <&pll1 3>; clock-names = "pll0", "pll0-div2", "pll0-div4", "pll1", "pll1-div2", "pll1-div4"; clock-output-names = "cmux1"; diff --git a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi index 1c91d00..1fdce44 100644 --- a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi @@ -1099,8 +1099,8 @@ #clock-cells = <0>; reg = <0x0 0x4>; compatible = "fsl,qoriq-core-mux-2.0"; - clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, - <&pll1 0>, <&pll1 1>, <&pll1 2>, + clocks = <&pll0 0>, <&pll0 1>, <&pll0 3>, + <&pll1 0>, <&pll1 1>, <&pll1 3>, <&pll2 0>, <&pll2 1>, <&pll2 2>; clock-names = "pll0", "pll0-div2", "pll0-div4", "pll1", "pll1-div2", "pll1-div4", @@ -1112,8 +1112,8 @@ #clock-cells = <0>; reg = <0x20 0x4>; compatible = "fsl,qoriq-core-mux-2.0"; - clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, - <&pll1 0>, <&pll1 1>, <&pll1 2>, + clocks = <&pll0 0>, <&pll0 1>, <&pll0 3>, + <&pll1 0>, <&pll1 1>, <&pll1 3>, <&pll2 0>, <&pll2 1>, <&pll2 2>; clock-names = "pll0", "pll0-div2", "pll0-div4", "pll1", "pll1-div2", "pll1-div4", -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC,v3,00/12] Freescale DPAA FMan
From: Igal Liberman The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which contains a series of hardware blocks: ports, Ethernet MACs, a multi user RAM (MURAM) and Storage Profile (SP). This patch set introduced the FMan driver code that configures and initializes the FMan hardware blocks, offering support for three different types of MACs. The first 6 patches present the FMan Foundation Libraries (FLIBs), the FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. The following patches present the FMan driver itself, split into patches for each required hardware module. v3: - Moved FMan to ./drivers/net/ethernet/freescale/ - Use genalloc for MURAM management. - Some updates for T1024 support. v2: - This set of patches combines the following submissions: - v2 of FMan (RFC) - v3 of FMan FLib - Reduced FMan code size: - Reduced FMan FLib's size: Removed code for future support. - Removed Priority Flow Control (PFC) support. - Removed rate-limiter. - Removed some MAC features. - Removed Real Time Clock (RTC) support. Igal Liberman (12): fsl/fman: Add the FMan FLIB headers fsl/fman: Add the FMan FLIB fsl/fman: Add the FMan port FLIB headers fsl/fman: Add the FMan port FLIB fsl/fman: Add the FMan MAC FLIB headers fsl/fman: Add the FMan MAC FLIB fsl/fman: Add FMan MURAM support fsl/fman: Add Frame Manager support fsl/fman: Add FMan MAC support fsl/fman: Add FMan SP support fsl/fman: Add FMan Port Support fsl/fman: Add FMan MAC driver drivers/net/ethernet/freescale/Kconfig |1 + drivers/net/ethernet/freescale/Makefile|2 + drivers/net/ethernet/freescale/fman/Kconfig| 46 + drivers/net/ethernet/freescale/fman/Makefile | 12 + .../ethernet/freescale/fman/flib/common/general.h | 41 + .../net/ethernet/freescale/fman/flib/fman_common.h | 73 + .../net/ethernet/freescale/fman/flib/fsl_enet.h| 275 +++ .../net/ethernet/freescale/fman/flib/fsl_fman.h| 743 +++ .../ethernet/freescale/fman/flib/fsl_fman_dtsec.h | 791 .../freescale/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 + .../ethernet/freescale/fman/flib/fsl_fman_memac.h | 453 + .../freescale/fman/flib/fsl_fman_memac_mii_acc.h | 76 + .../ethernet/freescale/fman/flib/fsl_fman_port.h | 462 + .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 66 + .../ethernet/freescale/fman/flib/fsl_fman_tgec.h | 409 drivers/net/ethernet/freescale/fman/fm.c | 2082 drivers/net/ethernet/freescale/fman/fm.h | 488 + drivers/net/ethernet/freescale/fman/fm_common.h| 538 + drivers/net/ethernet/freescale/fman/fm_drv.c | 973 + drivers/net/ethernet/freescale/fman/fm_drv.h | 123 ++ drivers/net/ethernet/freescale/fman/fm_muram.c | 114 ++ drivers/net/ethernet/freescale/fman/fm_port_drv.c | 536 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 104 + drivers/net/ethernet/freescale/fman/fman.c | 978 + .../ethernet/freescale/fman/inc/crc_mac_addr_ext.h | 343 drivers/net/ethernet/freescale/fman/inc/dpaa_ext.h | 253 +++ .../freescale/fman/inc/dpaa_integration_ext.h | 120 ++ drivers/net/ethernet/freescale/fman/inc/enet_ext.h | 199 ++ drivers/net/ethernet/freescale/fman/inc/fm_ext.h | 715 +++ .../net/ethernet/freescale/fman/inc/fm_mac_ext.h | 452 + .../net/ethernet/freescale/fman/inc/fm_muram_ext.h | 89 + .../net/ethernet/freescale/fman/inc/fm_port_ext.h | 397 .../net/ethernet/freescale/fman/inc/fsl_fman_drv.h | 192 ++ drivers/net/ethernet/freescale/fman/inc/mac.h | 125 ++ drivers/net/ethernet/freescale/fman/inc/net_ext.h | 534 + drivers/net/ethernet/freescale/fman/inc/service.h | 90 + drivers/net/ethernet/freescale/fman/mac/Makefile |9 + drivers/net/ethernet/freescale/fman/mac/dtsec.c| 1226 drivers/net/ethernet/freescale/fman/mac/dtsec.h| 185 ++ .../ethernet/freescale/fman/mac/dtsec_mii_acc.c| 82 + .../ethernet/freescale/fman/mac/dtsec_mii_acc.h| 43 + drivers/net/ethernet/freescale/fman/mac/fm_mac.c | 510 + drivers/net/ethernet/freescale/fman/mac/fm_mac.h | 183 ++ .../net/ethernet/freescale/fman/mac/fman_crc32.c | 116 ++ .../net/ethernet/freescale/fman/mac/fman_crc32.h | 39 + .../net/ethernet/freescale/fman/mac/fman_dtsec.c | 571 ++ .../freescale/fman/mac/fman_dtsec_mii_acc.c| 168 ++ ..
[RFC,v3,01/12] fsl/fman: Add the FMan FLIB headers
From: Igal Liberman This patch presents the FMan Foundation Libraries (FLIB) headers. The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman --- .../ethernet/freescale/fman/flib/common/general.h | 41 ++ .../net/ethernet/freescale/fman/flib/fsl_fman.h| 743 2 files changed, 784 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/common/general.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman.h diff --git a/drivers/net/ethernet/freescale/fman/flib/common/general.h b/drivers/net/ethernet/freescale/fman/flib/common/general.h new file mode 100644 index 000..0501f01 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/common/general.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __GENERAL_H +#define __GENERAL_H + +#include +#include + +#define iowrite32be(val, addr) out_be32(&(*addr), val) +#define ioread32be(addr) in_be32(&(*addr)) + +#endif /* __GENERAL_H */ diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h new file mode 100644 index 000..8534550 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h @@ -0,0 +1,743 @@ +/* + * Copyright 2008 - 2015 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 POSSIBIL
[RFC,v3,02/12] fsl/fman: Add the FMan FLIB
From: Igal Liberman The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/Kconfig |1 + drivers/net/ethernet/freescale/Makefile |2 + drivers/net/ethernet/freescale/fman/Kconfig |7 + drivers/net/ethernet/freescale/fman/Makefile |5 + drivers/net/ethernet/freescale/fman/fman.c | 978 ++ 5 files changed, 993 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/Kconfig create mode 100644 drivers/net/ethernet/freescale/fman/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/fman.c diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig index 25e3425..24e938d 100644 --- a/drivers/net/ethernet/freescale/Kconfig +++ b/drivers/net/ethernet/freescale/Kconfig @@ -55,6 +55,7 @@ config FEC_MPC52xx_MDIO If compiled as module, it will be called fec_mpc52xx_phy. source "drivers/net/ethernet/freescale/fs_enet/Kconfig" +source "drivers/net/ethernet/freescale/fman/Kconfig" config FSL_PQ_MDIO tristate "Freescale PQ MDIO" diff --git a/drivers/net/ethernet/freescale/Makefile b/drivers/net/ethernet/freescale/Makefile index 71debd1..4097c58 100644 --- a/drivers/net/ethernet/freescale/Makefile +++ b/drivers/net/ethernet/freescale/Makefile @@ -17,3 +17,5 @@ gianfar_driver-objs := gianfar.o \ gianfar_ethtool.o obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o ucc_geth_driver-objs := ucc_geth.o ucc_geth_ethtool.o + +obj-$(CONFIG_FSL_FMAN) += fman/ diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig new file mode 100644 index 000..8aeae29 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -0,0 +1,7 @@ +config FSL_FMAN + bool "FMan support" + depends on FSL_SOC || COMPILE_TEST + default n + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile new file mode 100644 index 000..a718f7c --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -0,0 +1,5 @@ +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib + +obj-y += fsl_fman.o + +fsl_fman-objs := fman.o diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c new file mode 100644 index 000..d9ea1e8 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fman.c @@ -0,0 +1,978 @@ +/* + * Copyright 2008 - 2015 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_fman.h" + +uint32_t fman_get_bmi_err_event(struct fman_bmi_regs __iomem *bmi_rg) +{ + uint32_t event, mask, force; + + event = ioread32be(&bmi_rg->fmbm_ievr); + mask = ioread32be(&bmi_rg->fmbm_ier); + event &= mask; + /* clear the forced events */ + force = ioread32be(&bmi_rg->fmbm_ifr); + if (force & event) +
[RFC,v3,03/12] fsl/fman: Add the FMan port FLIB headers
From: Igal Liberman The FMan Port Flib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman --- .../net/ethernet/freescale/fman/flib/fman_common.h | 73 .../ethernet/freescale/fman/flib/fsl_fman_port.h | 462 .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 66 +++ 3 files changed, 601 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fman_common.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_sp.h diff --git a/drivers/net/ethernet/freescale/fman/flib/fman_common.h b/drivers/net/ethernet/freescale/fman/flib/fman_common.h new file mode 100644 index 000..e186ed9 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fman_common.h @@ -0,0 +1,73 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FMAN_COMMON_H +#define __FMAN_COMMON_H + +/* NIA Description */ +#define NIA_ORDER_RESTOR 0x0080 +#define NIA_ENG_FM_CTL 0x +#define NIA_ENG_PRS0x0044 +#define NIA_ENG_KG 0x0048 +#define NIA_ENG_PLCR 0x004C +#define NIA_ENG_BMI0x0050 +#define NIA_ENG_QMI_ENQ0x0054 +#define NIA_ENG_QMI_DEQ0x0058 +#define NIA_ENG_MASK 0x007C + +#define NIA_FM_CTL_AC_CC 0x0006 +#define NIA_FM_CTL_AC_HC 0x000C +#define NIA_FM_CTL_AC_IND_MODE_TX 0x0008 +#define NIA_FM_CTL_AC_IND_MODE_RX 0x000A +#define NIA_FM_CTL_AC_FRAG 0x000e +#define NIA_FM_CTL_AC_PRE_FETCH0x0010 +#define NIA_FM_CTL_AC_POST_FETCH_PCD 0x0012 +#define NIA_FM_CTL_AC_POST_FETCH_PCD_UDP_LEN 0x0018 +#define NIA_FM_CTL_AC_POST_FETCH_NO_PCD0x0012 +#define NIA_FM_CTL_AC_FRAG_CHECK 0x0014 +#define NIA_FM_CTL_AC_PRE_CC 0x0020 + +#define NIA_BMI_AC_ENQ_FRAME 0x0002 +#define NIA_BMI_AC_TX_RELEASE 0x02C0 +#define NIA_BMI_AC_RELEASE 0x00C0 +#define NIA_BMI_AC_DISCARD 0x00C1 +#define NIA_BMI_AC_TX 0x0274 +#define NIA_BMI_AC_FETCH 0x0208 +#define NIA_BMI_AC_MASK0x03FF + +#define NIA_KG_DIRECT 0x0100 +#define NIA_KG_CC_EN 0x0200 +#define NIA_PLCR_ABSOLUTE 0x8000 + +#define NIA_BMI_AC_ENQ_FRAME_WITHOUT_DMA 0x0202 +#define NIA_BMI_AC_FETCH_ALL_FRAME 0x020c + +#endif /* __FMAN_COMMON_H */ diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h new file mode 100644 index 000..8903c99 --- /dev/null +++ b/drivers/ne
[RFC,v3,04/12] fsl/fman: Add the FMan port FLIB
From: Igal Liberman The FMan Port FLib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |2 + drivers/net/ethernet/freescale/fman/port/Makefile |3 + .../net/ethernet/freescale/fman/port/fman_port.c | 728 4 files changed, 734 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/port/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/port/fman_port.c diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 8aeae29..af42c3a 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -5,3 +5,4 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index a718f7c..a9ae0aa 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -3,3 +3,5 @@ subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib obj-y += fsl_fman.o fsl_fman-objs := fman.o + +obj-y += port/ diff --git a/drivers/net/ethernet/freescale/fman/port/Makefile b/drivers/net/ethernet/freescale/fman/port/Makefile new file mode 100644 index 000..54b1fa4 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/port/Makefile @@ -0,0 +1,3 @@ +obj-y += fsl_fman_port.o + +fsl_fman_port-objs := fman_port.o diff --git a/drivers/net/ethernet/freescale/fman/port/fman_port.c b/drivers/net/ethernet/freescale/fman/port/fman_port.c new file mode 100644 index 000..7d04084 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/port/fman_port.c @@ -0,0 +1,728 @@ +/* + * Copyright 2008 - 2015 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 "common/general.h" + +#include "fman_common.h" +#include "fsl_fman_port.h" + +/* problem Eyal: the following should not be here*/ +#define NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME 0x0028 + +static uint32_t get_no_pcd_nia_bmi_ac_enc_frame(struct fman_port_cfg *cfg) +{ + if (cfg->errata_A006675) + return NIA_ENG_FM_CTL | + NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME; + else + return NIA_ENG_BMI | NIA_BMI_AC_ENQ_FRAME; +} + +static int init_bmi_rx(struct fman_port *port, + struct fman_port_cfg *cfg, + struct fman_port_params *params) +{ + struct fman_port_rx_bmi_regs __iomem *regs = &port->bmi_regs->rx; + uint32_t tmp; + + /* Rx Configuration register */ + tmp = 0; + if (cfg->discard_override) + tmp |= BMI_PORT_CFG_FDOVR; + iowrite32be(tmp, ®s->fmbm_rcfg); + + /* DMA attributes */ + tmp = (uint32_t)cfg->dma_swap_data << BMI_DMA_ATTR_SWP_SHIFT; + if (cfg->dma_ic_stash_on) +
[RFC,v3,05/12] fsl/fman: Add the FMan MAC FLIB headers
From: Igal Liberman The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman --- .../net/ethernet/freescale/fman/flib/fsl_enet.h| 275 +++ .../ethernet/freescale/fman/flib/fsl_fman_dtsec.h | 791 .../freescale/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 +++ .../ethernet/freescale/fman/flib/fsl_fman_memac.h | 453 +++ .../freescale/fman/flib/fsl_fman_memac_mii_acc.h | 76 ++ .../ethernet/freescale/fman/flib/fsl_fman_tgec.h | 409 ++ 6 files changed, 2107 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_enet.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_dtsec.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_dtsec_mii_acc.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_memac.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_memac_mii_acc.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_tgec.h diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h b/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h new file mode 100644 index 000..78e7d04 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h @@ -0,0 +1,275 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FSL_ENET_H +#define __FSL_ENET_H + +/*Ethernet MAC-PHY Interface */ + +enum enet_interface { + E_ENET_IF_MII = 0x0001, /* MII interface */ + E_ENET_IF_RMII = 0x0002, /* RMII interface */ + E_ENET_IF_SMII = 0x0003, /* SMII interface */ + E_ENET_IF_GMII = 0x0004, /* GMII interface */ + E_ENET_IF_RGMII = 0x0005, /* RGMII interface */ + E_ENET_IF_TBI = 0x0006, /* TBI interface */ + E_ENET_IF_RTBI = 0x0007, /* RTBI interface */ + E_ENET_IF_SGMII = 0x0008, /* SGMII interface */ + E_ENET_IF_XGMII = 0x0009, /* XGMII interface */ + E_ENET_IF_QSGMII = 0x000a,/* QSGMII interface */ + E_ENET_IF_XFI = 0x000b/* XFI interface */ +}; + +/* Ethernet Speed (nominal data rate) */ +enum enet_speed { + E_ENET_SPEED_10 = 10, /* 10 Mbps */ + E_ENET_SPEED_100 = 100, /* 100 Mbps */ + E_ENET_SPEED_1000 = 1000, /* 1000 Mbps = 1 Gbps */ + E_ENET_SPEED_1 = 1 /* 1 Mbps = 10 Gbps */ +}; + +enum mac_type { + E_MAC_DTSEC, + E_MAC_TGEC, + E_MAC_MEMAC +}; + +/* Enum for inter-module interrupts registration */ +enum fman_event_modules { + E_FMAN_MOD_PRS, /* Parser event */ + E_FMAN_MOD_KG,/* Keygen event */ + E_FMAN_MOD_PLCR, /* Policer event */ + E_FMAN_MOD_10G_MAC, /* 10G MAC event */ + E_FMAN_MOD_1G_MAC,/* 1G MAC event */ + E_FMAN_MOD_TMR, /* Timer event */ + E_FMAN_MOD_FMAN_CTRL, /* FMAN Controller Timer event */ +
[RFC,v3,06/12] fsl/fman: Add the FMan MAC FLIB
From: Igal Liberman The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Makefile |1 + drivers/net/ethernet/freescale/fman/mac/Makefile |5 + .../net/ethernet/freescale/fman/mac/fman_crc32.c | 116 .../net/ethernet/freescale/fman/mac/fman_crc32.h | 39 ++ .../net/ethernet/freescale/fman/mac/fman_dtsec.c | 571 .../freescale/fman/mac/fman_dtsec_mii_acc.c| 168 ++ .../net/ethernet/freescale/fman/mac/fman_memac.c | 365 + .../freescale/fman/mac/fman_memac_mii_acc.c| 217 .../net/ethernet/freescale/fman/mac/fman_tgec.c| 217 9 files changed, 1699 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/mac/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_crc32.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_crc32.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_dtsec_mii_acc.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_memac.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_memac_mii_acc.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_tgec.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index a9ae0aa..534d1ed 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -5,3 +5,4 @@ obj-y += fsl_fman.o fsl_fman-objs := fman.o obj-y += port/ +obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/mac/Makefile b/drivers/net/ethernet/freescale/fman/mac/Makefile new file mode 100644 index 000..80b7048 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/mac/Makefile @@ -0,0 +1,5 @@ +obj-$(CONFIG_FSL_FMAN_MAC) += fsl_fman_mac.o + +fsl_fman_mac-objs := fman_dtsec.o fman_dtsec_mii_acc.o\ + fman_memac.o fman_tgec.o \ + fman_crc32.o fman_memac_mii_acc.o diff --git a/drivers/net/ethernet/freescale/fman/mac/fman_crc32.c b/drivers/net/ethernet/freescale/fman/mac/fman_crc32.c new file mode 100644 index 000..1536d12 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/mac/fman_crc32.c @@ -0,0 +1,116 @@ +/* + * Copyright 2008 - 2015 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 "fman_crc32.h" +#include "common/general.h" + +/* precomputed CRC values for address hashing */ +static const uint32_t crc_tbl[256] = { + 0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e
[RFC,v3,07/12] fsl/fman: Add FMan MURAM support
From: Igal Liberman Add Frame Manager Multi-User RAM support. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |6 +- drivers/net/ethernet/freescale/fman/fm_muram.c | 114 .../net/ethernet/freescale/fman/inc/fm_muram_ext.h | 89 +++ 4 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/freescale/fman/fm_muram.c create mode 100644 drivers/net/ethernet/freescale/fman/inc/fm_muram_ext.h diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index af42c3a..825a0d5 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -1,6 +1,7 @@ config FSL_FMAN bool "FMan support" depends on FSL_SOC || COMPILE_TEST + select GENERIC_ALLOCATOR default n help Freescale Data-Path Acceleration Architecture Frame Manager diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 534d1ed..55c91bd 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -1,8 +1,10 @@ -subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib \ + -I$(srctree)/drivers/net/ethernet/freescale/fman/inc \ + -I$(srctree)/drivers/net/ethernet/freescale/fman obj-y += fsl_fman.o -fsl_fman-objs := fman.o +fsl_fman-objs := fman.o fm_muram.o obj-y += port/ obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/fm_muram.c b/drivers/net/ethernet/freescale/fman/fm_muram.c new file mode 100644 index 000..2bca725 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_muram.c @@ -0,0 +1,114 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM MURAM ... */ +#include "fm_muram_ext.h" + +#include +#include +#include +#include + +struct muram_info { + struct gen_pool *pool; + void __iomem *vbase; + uint64_t size; + phys_addr_t pbase; +}; + +struct muram_info *fm_muram_init(phys_addr_t base, uint64_t size) +{ + struct muram_info *p_muram; + void __iomem *vaddr; + int ret; + + p_muram = kzalloc(sizeof(*p_muram), GFP_KERNEL); + if (!p_muram) + return NULL; + + p_muram->pool = gen_pool_create(ilog2(64), -1); + if (!p_muram->pool) { + pr_err("%s(): MURAM pool create failed\n", __func__); + return NULL; + } + + vaddr = ioremap(base, size); + if (!vaddr) { + pr_err("%s(): MURAM ioremap failed\n", __func__); + return NULL; + } + + ret = gen_pool_add_virt(p_muram->pool, (unsigned long)vaddr, + base, size, -1); + if (ret < 0) { + pr_err("%s(): MURAM pool add fail
[RFC,v3,10/12] fsl/fman: Add FMan SP support
From: Igal Liberman Add Storage Profiles support. The Storage Profiles contain parameters that are used by the FMan in order to store frames being received on the Rx ports, or to determine the parameters that affect writing the Internal Context in the frame margin on Tx. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Makefile |2 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 104 + drivers/net/ethernet/freescale/fman/sp/Makefile|3 + drivers/net/ethernet/freescale/fman/sp/fm_sp.c | 398 4 files changed, 507 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/fm_sp_common.h create mode 100644 drivers/net/ethernet/freescale/fman/sp/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/sp/fm_sp.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index f61d3a6..c6c3e24 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -8,3 +8,5 @@ fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o obj-y += port/ obj-y += mac/ +obj-y += sp/ + diff --git a/drivers/net/ethernet/freescale/fman/fm_sp_common.h b/drivers/net/ethernet/freescale/fman/fm_sp_common.h new file mode 100644 index 000..a99d795 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_sp_common.h @@ -0,0 +1,104 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM SP ... */ +#ifndef __FM_SP_COMMON_H +#define __FM_SP_COMMON_H + +#include "service.h" +#include "fm_ext.h" +#include "fsl_fman.h" + +/* defaults */ +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_DATA_SIZE 0 +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_PASS_PRS_RESULT false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_PASS_TIME_STAMP false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64 + +/* structure for defining internal context copying */ +struct fm_sp_int_context_data_copy_t { + /* < Offset in External buffer to which internal +* context is copied to (Rx) or taken from (Tx, Op). +*/ + uint16_t ext_buf_offset; + /* Offset within internal context to copy from +* (Rx) or to copy to (Tx, Op). +*/ + uint8_t int_context_offset; + /* Internal offset size to be copied */ + uint16_t size; +}; + +/* struct for defining external buffer margins */ +struct fm_sp_buf_margins_t { + /* Number of bytes to be left at the beginning +* of the external buffer (must be divisible by 16) +*/ + uint16_t start_margins; + /* number of bytes to be left at the end +* of the external buffer(must be divisible by 16) +*/ + uint16_t end_margins; +}; + +struct fm_sp_buffer_offsets_t { + uint32_t data_offset; + uint32_t prs_result_offset; + uint32_t time_stamp_offset; + uint32_t hash_result_offset; +}; + +int fm_sp_build_buffer_structure(struct fm_sp_int_context_data_copy_t +*p_fm_port_int_context_data_copy, +
[RFC,v3,12/12] fsl/fman: Add FMan MAC driver
From: Igal Liberman This patch adds the Ethernet MAC driver support. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/inc/mac.h | 125 + drivers/net/ethernet/freescale/fman/mac/Makefile |3 +- drivers/net/ethernet/freescale/fman/mac/mac-api.c | 605 + drivers/net/ethernet/freescale/fman/mac/mac.c | 527 ++ 4 files changed, 1259 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h b/drivers/net/ethernet/freescale/fman/inc/mac.h new file mode 100644 index 000..2d27331 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h @@ -0,0 +1,125 @@ +/* Copyright 2008-2015 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. + */ + +#ifndef __MAC_H +#define __MAC_H + +#include /* struct device, BUS_ID_SIZE */ +#include /* ETH_ALEN */ +#include /* phy_interface_t, struct phy_device */ +#include + +#include "fsl_fman_drv.h" /* struct port_device */ +#include "fm_mac_ext.h"/* FM MAC API */ +#include "fm_port_ext.h" + +enum {DTSEC, XGMAC, MEMAC}; + +struct mac_device { + struct device *dev; + void*priv; + u8 cell_index; + struct resource *res; + void __iomem*vaddr; + u8 addr[ETH_ALEN]; + bool promisc; + + struct fm *fm_dev; + struct fm_port *port_dev[2]; + + phy_interface_t phy_if; + u32 if_support; + bool link; + u16 speed; + u16 max_speed; + struct device_node *phy_node; + char fixed_bus_id[MII_BUS_ID_SIZE + 3]; + struct device_node *tbi_node; + struct phy_device *phy_dev; + void*fm; + /* List of multicast addresses */ + struct list_head mc_addr_list; + struct platform_device *eth_dev; + + bool autoneg_pause; + bool rx_pause_req; + bool tx_pause_req; + bool rx_pause_active; + bool tx_pause_active; + + struct fm_mac_dev * (*get_mac_handle)(struct mac_device *mac_dev); + int (*init_phy)(struct net_device *net_dev, struct mac_device *mac_dev); + int (*init)(struct mac_device *mac_dev); + int (*start)(struct mac_device *mac_dev); + int (*stop)(struct mac_device *mac_dev); + int (*set_promisc)(struct fm_mac_dev *fm_mac_dev, bool enable); + int (*change_addr)(struct fm_mac_dev *fm_mac_dev, + enet_addr_t *p_enet_addr); + int (*set_multi)(struct net_device *net_dev, +struct mac_device *mac_dev); + int (*uninit)(struct fm_mac_dev *fm_mac_dev); + int (*set_rx_pause)(struct fm_mac_dev *fm_mac_dev, bool en); + int (*set_tx
[v3] powerpc/mpc85xx: Add MDIO bus muxing support to the board device tree(s)
From: Igal Liberman Describe the PHY topology for all configurations supported by each board Based on prior work by Andy Fleming Signed-off-by: Igal Liberman Signed-off-by: Shruti Kanetkar Signed-off-by: Emil Medve --- v3: Fixed incorrect E-Mail address (signed-off-by) v2: Remove 'Change-Id' arch/powerpc/boot/dts/b4860qds.dts| 60 - arch/powerpc/boot/dts/b4qds.dtsi | 51 - arch/powerpc/boot/dts/p1023rdb.dts| 24 +- arch/powerpc/boot/dts/p2041rdb.dts| 92 +++- arch/powerpc/boot/dts/p3041ds.dts | 112 - arch/powerpc/boot/dts/p4080ds.dts | 184 ++- arch/powerpc/boot/dts/p5020ds.dts | 112 - arch/powerpc/boot/dts/p5040ds.dts | 234 ++- arch/powerpc/boot/dts/t1040rdb.dts| 32 ++- arch/powerpc/boot/dts/t1042rdb.dts| 30 ++- arch/powerpc/boot/dts/t1042rdb_pi.dts | 18 +- arch/powerpc/boot/dts/t104xqds.dtsi | 178 ++- arch/powerpc/boot/dts/t104xrdb.dtsi | 33 ++- arch/powerpc/boot/dts/t2080qds.dts| 158 - arch/powerpc/boot/dts/t2080rdb.dts| 67 +- arch/powerpc/boot/dts/t2081qds.dts| 221 +- arch/powerpc/boot/dts/t4240qds.dts| 400 - arch/powerpc/boot/dts/t4240rdb.dts| 149 +++- 18 files changed, 2135 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/boot/dts/b4860qds.dts b/arch/powerpc/boot/dts/b4860qds.dts index 6bb3707..98b1ef4 100644 --- a/arch/powerpc/boot/dts/b4860qds.dts +++ b/arch/powerpc/boot/dts/b4860qds.dts @@ -1,7 +1,7 @@ /* * B4860DS Device Tree Source * - * Copyright 2012 Freescale Semiconductor Inc. + * Copyright 2012 - 2015 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -39,12 +39,69 @@ model = "fsl,B4860QDS"; compatible = "fsl,B4860QDS"; + aliases { + phy_sgmii_1e = &phy_sgmii_1e; + phy_sgmii_1f = &phy_sgmii_1f; + phy_xaui_slot1 = &phy_xaui_slot1; + phy_xaui_slot2 = &phy_xaui_slot2; + }; + ifc: localbus@ffe124000 { board-control@3,0 { compatible = "fsl,b4860qds-fpga", "fsl,fpga-qixis"; }; }; + soc@ffe00 { + fman@40 { + ethernet@e8000 { + phy-handle = <&phy_sgmii_1e>; + phy-connection-type = "sgmii"; + }; + + ethernet@ea000 { + phy-handle = <&phy_sgmii_1f>; + phy-connection-type = "sgmii"; + }; + + ethernet@f { + phy-handle = <&phy_xaui_slot1>; + phy-connection-type = "xgmii"; + }; + + ethernet@f2000 { + phy-handle = <&phy_xaui_slot2>; + phy-connection-type = "xgmii"; + }; + + mdio@fc000 { + phy_sgmii_1e: ethernet-phy@1e { + reg = <0x1e>; + status = "disabled"; + }; + + phy_sgmii_1f: ethernet-phy@1f { + reg = <0x1f>; + status = "disabled"; + }; + }; + + mdio@fd000 { + phy_xaui_slot1: xaui-phy@slot1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x7>; + status = "disabled"; + }; + + phy_xaui_slot2: xaui-phy@slot2 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x6>; + status = "disabled"; + }; + }; + }; + }; + rio: rapidio@ffe0c { reg = <0xf 0xfe0c 0 0x11000>; @@ -55,7 +112,6 @@ ranges = <0 0 0xc 0x3000 0 0x1000>; }; }; - }; /include/ "fsl/b4860si-post.dtsi" diff --git a/arch/powerpc/boot/dts/b4qds.dtsi b/arch/powerpc/boot/dts/b4q
[PATCH] powerpc/fsl: Add FMan best effort port compatible
From: Igal Liberman This patch adds a compatible which represents FMan V3 best effort ports. FMan best effort port is configured as 10G ports, however, it uses 1G hardware. Signed-off-by: Igal Liberman --- .../devicetree/bindings/powerpc/fsl/fman.txt |5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt index edda55f..c2e3ec3 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt +++ b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt @@ -166,6 +166,11 @@ PROPERTIES - "fsl,fman-v3-port-oh" for FManV3 OH ports - "fsl,fman-v3-port-rx" for FManV3 RX ports - "fsl,fman-v3-port-tx" for FManV3 TX ports + Optional compatible which can be used in addition to the + compatibles above is: + - "fsl,fman-v3-best-effort-port" + This compatible represents 10G best effort ports: + Port configured as 10G, using 1G hardware. - cell-index Usage: required -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/fsl: Add FMan Port 10G compatibles
From: Igal Liberman This patch adds two boolean properties to FMan Port. FMan has 3 types of ports: - 1G ports By default, all ports support 1G rate - 10G Ports Port which use 10G hardware, and configured as 10G - 10G Best effort ports Ports which use 1G hardware, configured as 10G, in this case, the rate is not guaranteed. The new properties help to distinguish the different type of ports. Signed-off-by: Igal Liberman --- .../devicetree/bindings/powerpc/fsl/fman.txt | 13 + 1 file changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt index edda55f..76a7cba 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt +++ b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt @@ -189,6 +189,19 @@ PROPERTIES Definition: There is one reg region describing the port configuration registers. +- 10G-support + Usage: optional + Value type: boolean + Definition: The default port rate is 1G. + If this property exists, the port is configured as 10G port. + +- best-effort-port + Usage: optional + Value type: boolean + Definition: Can be defined only if 10G-support is set. + This property marks a best-effort 10G port (1G hardware + configured as 10G, 10G rate is not guaranteed). + EXAMPLE port@a8000 { -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v2] powerpc/fsl: Add FMan Port 10G compatibles
From: Igal Liberman This patch adds two boolean properties to FMan Port. FMan has 3 types of ports: - 1G ports By default, all ports support 1G rate - 10G Ports Port which use 10G hardware, and configured as 10G - 10G Best effort ports Ports which use 1G hardware, configured as 10G, in this case, the rate is not guaranteed. The new properties help to distinguish the different type of ports. v2 - Addressed feedback from Scott: Replaced "10G-support" with "fsl,fman-10g-port" Replaced "best-effort-port" with "fsl,fman-best-effort-port" Signed-off-by: Igal Liberman Change-Id: If1ac160fbedc0cfd058f46ae8d8e3a50d3ecebb2 --- .../devicetree/bindings/powerpc/fsl/fman.txt | 13 + 1 file changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt index edda55f..1fc5328 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt +++ b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt @@ -189,6 +189,19 @@ PROPERTIES Definition: There is one reg region describing the port configuration registers. +- fsl,fman-10g-port + Usage: optional + Value type: boolean + Definition: The default port rate is 1G. + If this property exists, the port is s 10G port. + +- fsl,fman-best-effort-port + Usage: optional + Value type: boolean + Definition: Can be defined only if 10G-support is set. + This property marks a best-effort 10G port (10G port that + may not be capable of line rate). + EXAMPLE port@a8000 { -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] Freescale Frame Manager Device Tree binding document
From: Igal Liberman The Frame Manager (FMan) combines the Ethernet network interfaces with packet distribution logic to provide intelligent distribution and queuing decisions for incoming traffic at line rate. This binding document describes Freescale's Frame Manager hardware attributes that are used by the Frame Manager driver for its basic initialization and configuration. Signed-off-by: Igal Liberman --- .../devicetree/bindings/powerpc/fsl/fman.txt | 462 1 file changed, 462 insertions(+) create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/fman.txt diff --git a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt new file mode 100644 index 000..ce0793f --- /dev/null +++ b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt @@ -0,0 +1,462 @@ += +Freescale Frame Manager Device Bindings + +CONTENTS + - FMan Node + - FMan Port Node + - FMan MURAM Node + - FMan dTSEC/XGEC/mEMAC Node + - FMan IEEE 1588 Node + - Example + += +FMan Node + +DESCRIPTION + +Due to the fact that the FMan is an aggregation of sub-engines (ports, MACs, +etc.) the FMan node will have child nodes for each of them. + +PROPERTIES + +- compatible + Usage: required + Value type: + Definition: Must include "fsl,fman" + FMan version can be determined via FM_IP_REV_1 register in the + FMan block. The offset is 0xc4 from the beginning of the + Frame Processing Manager memory map (0xc3000 from the + beginning of the FMan node). + +- cell-index + Usage: required + Value type: + Definition: Specifies the index of the FMan unit. + + The cell-index value may be used, for example, to disable or + enable the FMan via "Device disable register 2" + (DCFG_DEVDISR2, located at the SoC reference manual under + "Device Configuration and Pin Control Memory Map"). + +- reg + Usage: required + Value type: + Definition: A standard property. Specifies the offset of the + following configuration registers: + - BMI configuration registers. + - QMI configuration registers. + - DMA configuration registers. + - FPM configuration registers. + - FMan controller configuration registers. + +- ranges + Usage: required + Value type: + Definition: A standard property. + +- clocks + Usage: required + Value type: + Definition: phandle for fman clock. + +- clock-names + usage: optional + Value type: + Definition: A standard property + +- interrupts + Usage: required + Value type: + Definition: A pair of IRQs are specified in this property. + The first element is associated with the event interrupts and + the second element is associated with the error interrupts. + +- fsl,qman-channel-range + Usage: required + Value type: + Definition: Specifies the ranges of the available dedicated + channels in the FMan. The first cell specifies the beginning + of the range and the second cell specifies the number of + channels. + Further information available at: + "Work Queue (WQ) Channel Assignments in the QMan" section + in DPAA Reference Manual. + += +FMan MURAM Node + +DESCRIPTION + +FMan Internal memory - shared between all the FMan modules. +It contains data structures that are common and written to or read by +the modules. +FMan internal memory is split into the following parts: + Packet buffering (Tx/Rx FIFOs) + Frames internal context + +PROPERTIES + +- compatible + Usage: required + Value type: + Definition: Must include "fsl,fman-muram" + +- ranges + Usage: required + Value type: + Definition: A standard property. Specifies the physical + address and length of the FMan memory space + +EXAMPLE + +muram@0 { + compatible = "fsl,fman-muram"; + ranges = <0 0x00 0x28000>; +}; + += +FMan Port Node + +DESCRIPTION + +The Frame Manager (FMan) supports several types of hardware ports: + Ethernet receiver (RX) + Eth
[PATCH][V2] Freescale Frame Manager Device Tree binding document
From: Igal Liberman The Frame Manager (FMan) combines the Ethernet network interfaces with packet distribution logic to provide intelligent distribution and queuing decisions for incoming traffic at line rate. This binding document describes Freescale's Frame Manager hardware attributes that are used by the Frame Manager driver for its basic initialization and configuration. Difference between [V1] and [V2]: Addressed all comments recieved from Scott in [V1] Signed-off-by: Igal Liberman --- .../devicetree/bindings/powerpc/fsl/fman.txt | 529 1 file changed, 529 insertions(+) create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/fman.txt diff --git a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt new file mode 100644 index 000..da8e5f2 --- /dev/null +++ b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt @@ -0,0 +1,529 @@ += +Freescale Frame Manager Device Bindings + +CONTENTS + - FMan Node + - FMan Port Node + - FMan MURAM Node + - FMan dTSEC/XGEC/mEMAC Node + - FMan IEEE 1588 Node + - Example + += +FMan Node + +DESCRIPTION + +Due to the fact that the FMan is an aggregation of sub-engines (ports, MACs, +etc.) the FMan node will have child nodes for each of them. + +PROPERTIES + +- compatible + Usage: required + Value type: + Definition: Must include "fsl,fman" + FMan version can be determined via FM_IP_REV_1 register in the + FMan block. The offset is 0xc4 from the beginning of the + Frame Processing Manager memory map (0xc3000 from the + beginning of the FMan node). + +- cell-index + Usage: required + Value type: + Definition: Specifies the index of the FMan unit. + + The cell-index value may be used by the SoC, to identify the + FMan unit in the SoC memory map. In the table bellow, + there's a description of the cell-index use in each SoC: + + - P1023: + register[bit] FMan unit cell-index + + DEVDISR[1] 1 0 + + - P2041, P3041, P4080 P5020, P5040: + register[bit] FMan unit cell-index + + DCFG_DEVDISR2[6]1 0 + DCFG_DEVDISR2[14] 2 1 + (Second FM available only in P4080 and P5040) + + - B4860, T1040, T2080, T4240: + register[bit] FMan unit cell-index + + DCFG_CCSR_DEVDISR2[24] 1 0 + DCFG_CCSR_DEVDISR2[25] 2 1 + (Second FM available only in T4240) + + DEVDISR, DCFG_DEVDISR2 and DCFG_CCSR_DEVDISR2 are located in + the specific SoC "Device Configuration/Pin Control" Memory + Map. + +- reg + Usage: required + Value type: + Definition: A standard property. Specifies the offset of the + following configuration registers: + - BMI configuration registers. + - QMI configuration registers. + - DMA configuration registers. + - FPM configuration registers. + - FMan controller configuration registers. + +- ranges + Usage: required + Value type: + Definition: A standard property. + +- clocks + Usage: required + Value type: + Definition: phandle for fman clock. + +- clock-names + usage: optional + Value type: + Definition: A standard property + +- interrupts + Usage: required + Value type: + Definition: A pair of IRQs are specified in this property. + The first element is associated with the event interrupts and + the second element is associated with the error interrupts. + +- fsl,qman-channel-range + Usage: required + Value type: + Definition: Specifies the range of the available dedicated + channels in the FMan. The first cell specifies the beginning + of the range and the second cell specifies the number of + channels. + Further information available a
[PATCH] powerpc: Added rcw registers to global utility registers
From: Igal Liberman The RCW registers are required for the future clock binding implementation. Signed-off-by: Igal Liberman Change-Id: Ic36dd8bc2959aa7f97fb6fd7bbb8420822fef0a9 --- arch/powerpc/include/asm/fsl_guts.h |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/fsl_guts.h b/arch/powerpc/include/asm/fsl_guts.h index 193d1f1..38d0b57 100644 --- a/arch/powerpc/include/asm/fsl_guts.h +++ b/arch/powerpc/include/asm/fsl_guts.h @@ -68,7 +68,10 @@ struct ccsr_guts { u8 res0b4[0xc0 - 0xb4]; __be32 iovselsr; /* 0x.00c0 - I/O voltage select status register Called 'elbcvselcr' on 86xx SOCs */ - u8 res0c4[0x224 - 0xc4]; + u8 res0c4[0x100 - 0xc4]; + __be32 rcwsr[16]; /* 0x.0100 - Reset Control Word Status registers +There are 16 registers */ + u8 res140[0x224 - 0x140]; __be32 iodelay1; /* 0x.0224 - IO delay control register 1 */ __be32 iodelay2; /* 0x.0228 - IO delay control register 2 */ u8 res22c[0x604 - 0x22c]; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/dts: Unify B4 mux nodes
From: Igal Liberman Signed-off-by: Igal Liberman Change-Id: Ic5f28f7b492b708f00a5ff74dda723ce5e1da0ba --- arch/powerpc/boot/dts/fsl/b4420si-post.dtsi | 15 ++- arch/powerpc/boot/dts/fsl/b4860si-post.dtsi | 15 ++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi| 12 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi index 86161ae..1ea8602 100644 --- a/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi @@ -80,20 +80,9 @@ compatible = "fsl,b4420-device-config", "fsl,qoriq-device-config-2.0"; }; -/include/ "qoriq-clockgen2.dtsi" global-utilities@e1000 { - compatible = "fsl,b4420-clockgen", "fsl,qoriq-clockgen-2.0"; - - mux0: mux0@0 { - #clock-cells = <0>; - reg = <0x0 0x4>; - compatible = "fsl,qoriq-core-mux-2.0"; - clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, - <&pll1 0>, <&pll1 1>, <&pll1 2>; - clock-names = "pll0", "pll0-div2", "pll0-div4", - "pll1", "pll1-div2", "pll1-div4"; - clock-output-names = "cmux0"; - }; + compatible = "fsl,b4420-clockgen", "fsl,b4-clockgen", + "fsl,qoriq-clockgen-2.0"; }; rcpm: global-utilities@e2000 { diff --git a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi index 65100b9..d0a5cde 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi @@ -124,20 +124,9 @@ compatible = "fsl,b4860-device-config", "fsl,qoriq-device-config-2.0"; }; -/include/ "qoriq-clockgen2.dtsi" global-utilities@e1000 { - compatible = "fsl,b4860-clockgen", "fsl,qoriq-clockgen-2.0"; - - mux0: mux0@0 { - #clock-cells = <0>; - reg = <0x0 0x4>; - compatible = "fsl,qoriq-core-mux-2.0"; - clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, - <&pll1 0>, <&pll1 1>, <&pll1 2>; - clock-names = "pll0", "pll0-div2", "pll0-div4", - "pll1", "pll1-div2", "pll1-div4"; - clock-output-names = "cmux0"; - }; + compatible = "fsl,b4860-clockgen", "fsl,b4-clockgen", + "fsl,qoriq-clockgen-2.0"; }; rcpm: global-utilities@e2000 { diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi index 1a54ba7..e4e69b0 100644 --- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi @@ -214,9 +214,21 @@ fsl,liodn-bits = <12>; }; +/include/ "qoriq-clockgen2.dtsi" clockgen: global-utilities@e1000 { compatible = "fsl,b4-clockgen", "fsl,qoriq-clockgen-2.0"; reg = <0xe1000 0x1000>; + + mux0: mux0@0 { + #clock-cells = <0>; + reg = <0x0 0x4>; + compatible = "fsl,qoriq-core-mux-2.0"; + clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>, + <&pll1 0>, <&pll1 1>, <&pll1 2>; + clock-names = "pll0", "pll0-div2", "pll0-div4", + "pll1", "pll1-div2", "pll1-div4"; + clock-output-names = "cmux0"; + }; }; rcpm: global-utilities@e2000 { -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/dts: Update platform PLL node
From: Igal Liberman Signed-off-by: Igal Liberman Change-Id: I92d020651237041d3767aa35e9345439714f9831 --- arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi index 48e0b6e..7e1f074 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-clockgen2.dtsi @@ -49,14 +49,16 @@ global-utilities@e1000 { reg = <0x800 0x4>; compatible = "fsl,qoriq-core-pll-2.0"; clocks = <&sysclk>; - clock-output-names = "pll0", "pll0-div2", "pll0-div4"; + clock-output-names = "pll0", "pll0-div2", "pll0-div3", + "pll0-div4"; }; pll1: pll1@820 { #clock-cells = <1>; reg = <0x820 0x4>; compatible = "fsl,qoriq-core-pll-2.0"; clocks = <&sysclk>; - clock-output-names = "pll1", "pll1-div2", "pll1-div4"; + clock-output-names = "pll1", "pll1-div2", "pll1-div3", + "pll1-div4"; }; platform_pll: platform-pll@c00 { #clock-cells = <1>; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[00/12] Freescale DPAA FMan
From: Igal Liberman The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which contains a series of hardware blocks: ports, Ethernet MACs, a multi user RAM (MURAM) and Storage Profile (SP). This patch set introduced the FMan driver code that configures and initializes the FMan hardware blocks, offering support for three different types of MACs. The first 6 patches present the FMan Foundation Libraries (FLIBs), the FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. The following patches present the FMan driver itself, split into patches for each required hardware module. This submission is based on prior Freescale DPAA FMan V3,RFC submission. Several issues addresses in this submission: - Reduced MAC layering and complexity - Reduced code base - T1024/T2080 10G best effort support Igal Liberman (12): fsl/fman: Add the FMan FLIB headers fsl/fman: Add the FMan FLIB fsl/fman: Add the FMan port FLIB headers fsl/fman: Add the FMan port FLIB fsl/fman: Add the FMan MAC FLIB headers fsl/fman: Add the FMan MAC FLIB fsl/fman: Add FMan MURAM support fsl/fman: Add Frame Manager support fsl/fman: Add FMan MAC support fsl/fman: Add FMan SP support fsl/fman: Add FMan Port Support fsl/fman: Add FMan MAC driver drivers/net/ethernet/freescale/Kconfig |1 + drivers/net/ethernet/freescale/Makefile|2 + drivers/net/ethernet/freescale/fman/Kconfig| 46 + drivers/net/ethernet/freescale/fman/Makefile | 12 + .../ethernet/freescale/fman/flib/common/general.h | 41 + .../net/ethernet/freescale/fman/flib/fman_common.h | 73 + .../net/ethernet/freescale/fman/flib/fsl_enet.h| 275 +++ .../net/ethernet/freescale/fman/flib/fsl_fman.h| 609 ++ .../ethernet/freescale/fman/flib/fsl_fman_dtsec.h | 791 .../freescale/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 + .../ethernet/freescale/fman/flib/fsl_fman_memac.h | 453 + .../freescale/fman/flib/fsl_fman_memac_mii_acc.h | 76 + .../ethernet/freescale/fman/flib/fsl_fman_port.h | 427 .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 54 + .../ethernet/freescale/fman/flib/fsl_fman_tgec.h | 409 drivers/net/ethernet/freescale/fman/fm.c | 2036 drivers/net/ethernet/freescale/fman/fm.h | 407 drivers/net/ethernet/freescale/fman/fm_common.h| 576 ++ drivers/net/ethernet/freescale/fman/fm_drv.c | 933 + drivers/net/ethernet/freescale/fman/fm_drv.h | 125 ++ drivers/net/ethernet/freescale/fman/fm_muram.c | 127 ++ drivers/net/ethernet/freescale/fman/fm_port_drv.c | 496 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 104 + drivers/net/ethernet/freescale/fman/fman.c | 973 ++ .../ethernet/freescale/fman/inc/crc_mac_addr_ext.h | 343 drivers/net/ethernet/freescale/fman/inc/enet_ext.h | 199 ++ drivers/net/ethernet/freescale/fman/inc/fm_ext.h | 453 + .../net/ethernet/freescale/fman/inc/fm_muram_ext.h | 103 + .../net/ethernet/freescale/fman/inc/fm_port_ext.h | 376 .../net/ethernet/freescale/fman/inc/fsl_fman_drv.h | 195 ++ drivers/net/ethernet/freescale/fman/inc/mac.h | 136 ++ drivers/net/ethernet/freescale/fman/inc/net_ext.h | 534 + drivers/net/ethernet/freescale/fman/inc/service.h | 90 + drivers/net/ethernet/freescale/fman/mac/Makefile |8 + drivers/net/ethernet/freescale/fman/mac/fm_dtsec.c | 1089 +++ drivers/net/ethernet/freescale/fman/mac/fm_dtsec.h | 227 +++ .../ethernet/freescale/fman/mac/fm_dtsec_mii_acc.c | 82 + .../ethernet/freescale/fman/mac/fm_dtsec_mii_acc.h | 43 + drivers/net/ethernet/freescale/fman/mac/fm_mac.h | 250 +++ drivers/net/ethernet/freescale/fman/mac/fm_memac.c | 741 +++ drivers/net/ethernet/freescale/fman/mac/fm_memac.h | 124 ++ .../ethernet/freescale/fman/mac/fm_memac_mii_acc.c | 66 + .../ethernet/freescale/fman/mac/fm_memac_mii_acc.h | 50 + drivers/net/ethernet/freescale/fman/mac/fm_tgec.c | 652 +++ drivers/net/ethernet/freescale/fman/mac/fm_tgec.h | 126 ++ .../net/ethernet/freescale/fman/mac/fman_dtsec.c | 571 ++ .../freescale/fman/mac/fman_dtsec_mii_acc.c| 168 ++ .../net/ethernet/freescale/fman/mac/fman_memac.c | 365 .../freescale/fman/mac/fman_memac_mii_acc.c| 217 +++ .../net/ethernet/freescale/fman/mac/fman_tgec.c| 217 +++ drivers/net/ethernet/freescale/fman/mac/mac-api.c | 765 drivers/net/ethernet/freescale/fman/mac/mac.c | 526 + drivers/net/ethernet/freescale/fman/port/Makefile |3
[PATCH 01/12] fsl/fman: Add the FMan FLIB headers
From: Igal Liberman This patch presents the FMan Foundation Libraries (FLIB) headers. The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman --- .../ethernet/freescale/fman/flib/common/general.h | 41 ++ .../net/ethernet/freescale/fman/flib/fsl_fman.h| 609 2 files changed, 650 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/common/general.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman.h diff --git a/drivers/net/ethernet/freescale/fman/flib/common/general.h b/drivers/net/ethernet/freescale/fman/flib/common/general.h new file mode 100644 index 000..0501f01 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/common/general.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __GENERAL_H +#define __GENERAL_H + +#include +#include + +#define iowrite32be(val, addr) out_be32(&(*addr), val) +#define ioread32be(addr) in_be32(&(*addr)) + +#endif /* __GENERAL_H */ diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h new file mode 100644 index 000..95eef30 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h @@ -0,0 +1,609 @@ +/* + * Copyright 2008 - 2015 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 POSSIBIL
[PATCH 02/12] fsl/fman: Add the FMan FLIB
From: Igal Liberman The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/Kconfig |1 + drivers/net/ethernet/freescale/Makefile |2 + drivers/net/ethernet/freescale/fman/Kconfig |7 + drivers/net/ethernet/freescale/fman/Makefile |5 + drivers/net/ethernet/freescale/fman/fman.c | 973 ++ 5 files changed, 988 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/Kconfig create mode 100644 drivers/net/ethernet/freescale/fman/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/fman.c diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig index 25e3425..24e938d 100644 --- a/drivers/net/ethernet/freescale/Kconfig +++ b/drivers/net/ethernet/freescale/Kconfig @@ -55,6 +55,7 @@ config FEC_MPC52xx_MDIO If compiled as module, it will be called fec_mpc52xx_phy. source "drivers/net/ethernet/freescale/fs_enet/Kconfig" +source "drivers/net/ethernet/freescale/fman/Kconfig" config FSL_PQ_MDIO tristate "Freescale PQ MDIO" diff --git a/drivers/net/ethernet/freescale/Makefile b/drivers/net/ethernet/freescale/Makefile index 71debd1..4097c58 100644 --- a/drivers/net/ethernet/freescale/Makefile +++ b/drivers/net/ethernet/freescale/Makefile @@ -17,3 +17,5 @@ gianfar_driver-objs := gianfar.o \ gianfar_ethtool.o obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o ucc_geth_driver-objs := ucc_geth.o ucc_geth_ethtool.o + +obj-$(CONFIG_FSL_FMAN) += fman/ diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig new file mode 100644 index 000..8aeae29 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -0,0 +1,7 @@ +config FSL_FMAN + bool "FMan support" + depends on FSL_SOC || COMPILE_TEST + default n + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile new file mode 100644 index 000..2799c6f --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -0,0 +1,5 @@ +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib + +obj-y += fsl_fman.o + +fsl_fman-objs := fman.o diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c new file mode 100644 index 000..410c498 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fman.c @@ -0,0 +1,973 @@ +/* + * Copyright 2008 - 2015 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_fman.h" + +uint32_t fman_get_bmi_err_event(struct fman_bmi_regs __iomem *bmi_rg) +{ + uint32_t event, mask, force; + + event = ioread32be(&bmi_rg->fmbm_ievr); + mask = ioread32be(&bmi_rg->fmbm_ier); + event &= mask; + /* clear the forced events */ + force = ioread32be(&bmi_rg->fmbm_ifr); + if (force & event) +
[PATCH 03/12] fsl/fman: Add the FMan port FLIB headers
From: Igal Liberman The FMan Port Flib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman --- .../net/ethernet/freescale/fman/flib/fman_common.h | 73 .../ethernet/freescale/fman/flib/fsl_fman_port.h | 427 .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 54 +++ 3 files changed, 554 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fman_common.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_sp.h diff --git a/drivers/net/ethernet/freescale/fman/flib/fman_common.h b/drivers/net/ethernet/freescale/fman/flib/fman_common.h new file mode 100644 index 000..e186ed9 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fman_common.h @@ -0,0 +1,73 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FMAN_COMMON_H +#define __FMAN_COMMON_H + +/* NIA Description */ +#define NIA_ORDER_RESTOR 0x0080 +#define NIA_ENG_FM_CTL 0x +#define NIA_ENG_PRS0x0044 +#define NIA_ENG_KG 0x0048 +#define NIA_ENG_PLCR 0x004C +#define NIA_ENG_BMI0x0050 +#define NIA_ENG_QMI_ENQ0x0054 +#define NIA_ENG_QMI_DEQ0x0058 +#define NIA_ENG_MASK 0x007C + +#define NIA_FM_CTL_AC_CC 0x0006 +#define NIA_FM_CTL_AC_HC 0x000C +#define NIA_FM_CTL_AC_IND_MODE_TX 0x0008 +#define NIA_FM_CTL_AC_IND_MODE_RX 0x000A +#define NIA_FM_CTL_AC_FRAG 0x000e +#define NIA_FM_CTL_AC_PRE_FETCH0x0010 +#define NIA_FM_CTL_AC_POST_FETCH_PCD 0x0012 +#define NIA_FM_CTL_AC_POST_FETCH_PCD_UDP_LEN 0x0018 +#define NIA_FM_CTL_AC_POST_FETCH_NO_PCD0x0012 +#define NIA_FM_CTL_AC_FRAG_CHECK 0x0014 +#define NIA_FM_CTL_AC_PRE_CC 0x0020 + +#define NIA_BMI_AC_ENQ_FRAME 0x0002 +#define NIA_BMI_AC_TX_RELEASE 0x02C0 +#define NIA_BMI_AC_RELEASE 0x00C0 +#define NIA_BMI_AC_DISCARD 0x00C1 +#define NIA_BMI_AC_TX 0x0274 +#define NIA_BMI_AC_FETCH 0x0208 +#define NIA_BMI_AC_MASK0x03FF + +#define NIA_KG_DIRECT 0x0100 +#define NIA_KG_CC_EN 0x0200 +#define NIA_PLCR_ABSOLUTE 0x8000 + +#define NIA_BMI_AC_ENQ_FRAME_WITHOUT_DMA 0x0202 +#define NIA_BMI_AC_FETCH_ALL_FRAME 0x020c + +#endif /* __FMAN_COMMON_H */ diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h new file mode 100644 index 000..719d15e --- /dev/null +++ b/drivers/ne
[PATCH 04/12] fsl/fman: Add the FMan port FLIB
From: Igal Liberman The FMan Port FLib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |2 + drivers/net/ethernet/freescale/fman/port/Makefile |3 + .../net/ethernet/freescale/fman/port/fman_port.c | 619 4 files changed, 625 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/port/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/port/fman_port.c diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 8aeae29..af42c3a 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -5,3 +5,4 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 2799c6f..50a4de2 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -3,3 +3,5 @@ subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib obj-y += fsl_fman.o fsl_fman-objs := fman.o + +obj-y += port/ diff --git a/drivers/net/ethernet/freescale/fman/port/Makefile b/drivers/net/ethernet/freescale/fman/port/Makefile new file mode 100644 index 000..54b1fa4 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/port/Makefile @@ -0,0 +1,3 @@ +obj-y += fsl_fman_port.o + +fsl_fman_port-objs := fman_port.o diff --git a/drivers/net/ethernet/freescale/fman/port/fman_port.c b/drivers/net/ethernet/freescale/fman/port/fman_port.c new file mode 100644 index 000..6754c35 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/port/fman_port.c @@ -0,0 +1,619 @@ +/* + * Copyright 2008 - 2015 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 "common/general.h" + +#include "fman_common.h" +#include "fsl_fman_port.h" + +/* problem Eyal: the following should not be here*/ +#define NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME 0x0028 + +static uint32_t get_no_pcd_nia_bmi_ac_enc_frame(struct fman_port_cfg *cfg) +{ + if (cfg->errata_A006675) + return NIA_ENG_FM_CTL | + NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME; + else + return NIA_ENG_BMI | NIA_BMI_AC_ENQ_FRAME; +} + +static int init_bmi_rx(struct fman_port *port, + struct fman_port_cfg *cfg, + struct fman_port_params *params) +{ + struct fman_port_rx_bmi_regs __iomem *regs = &port->bmi_regs->rx; + uint32_t tmp; + + /* Rx Configuration register */ + tmp = 0; + if (cfg->discard_override) + tmp |= BMI_PORT_CFG_FDOVR; + iowrite32be(tmp, ®s->fmbm_rcfg); + + /* DMA attributes */ + tmp = (uint32_t)cfg->dma_swap_data << BMI_DMA_ATTR_SWP_SHIFT; + if (cfg->dma_ic_stash_on) + tmp |= BM
[PATCH 05/12] fsl/fman: Add the FMan MAC FLIB headers
From: Igal Liberman The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman --- .../net/ethernet/freescale/fman/flib/fsl_enet.h| 275 +++ .../ethernet/freescale/fman/flib/fsl_fman_dtsec.h | 791 .../freescale/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 +++ .../ethernet/freescale/fman/flib/fsl_fman_memac.h | 453 +++ .../freescale/fman/flib/fsl_fman_memac_mii_acc.h | 76 ++ .../ethernet/freescale/fman/flib/fsl_fman_tgec.h | 409 ++ 6 files changed, 2107 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_enet.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_dtsec.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_dtsec_mii_acc.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_memac.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_memac_mii_acc.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_tgec.h diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h b/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h new file mode 100644 index 000..78e7d04 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h @@ -0,0 +1,275 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FSL_ENET_H +#define __FSL_ENET_H + +/*Ethernet MAC-PHY Interface */ + +enum enet_interface { + E_ENET_IF_MII = 0x0001, /* MII interface */ + E_ENET_IF_RMII = 0x0002, /* RMII interface */ + E_ENET_IF_SMII = 0x0003, /* SMII interface */ + E_ENET_IF_GMII = 0x0004, /* GMII interface */ + E_ENET_IF_RGMII = 0x0005, /* RGMII interface */ + E_ENET_IF_TBI = 0x0006, /* TBI interface */ + E_ENET_IF_RTBI = 0x0007, /* RTBI interface */ + E_ENET_IF_SGMII = 0x0008, /* SGMII interface */ + E_ENET_IF_XGMII = 0x0009, /* XGMII interface */ + E_ENET_IF_QSGMII = 0x000a,/* QSGMII interface */ + E_ENET_IF_XFI = 0x000b/* XFI interface */ +}; + +/* Ethernet Speed (nominal data rate) */ +enum enet_speed { + E_ENET_SPEED_10 = 10, /* 10 Mbps */ + E_ENET_SPEED_100 = 100, /* 100 Mbps */ + E_ENET_SPEED_1000 = 1000, /* 1000 Mbps = 1 Gbps */ + E_ENET_SPEED_1 = 1 /* 1 Mbps = 10 Gbps */ +}; + +enum mac_type { + E_MAC_DTSEC, + E_MAC_TGEC, + E_MAC_MEMAC +}; + +/* Enum for inter-module interrupts registration */ +enum fman_event_modules { + E_FMAN_MOD_PRS, /* Parser event */ + E_FMAN_MOD_KG,/* Keygen event */ + E_FMAN_MOD_PLCR, /* Policer event */ + E_FMAN_MOD_10G_MAC, /* 10G MAC event */ + E_FMAN_MOD_1G_MAC,/* 1G MAC event */ + E_FMAN_MOD_TMR, /* Timer event */ + E_FMAN_MOD_FMAN_CTRL, /* FMAN Controller Timer event */ +
[PATCH 06/12] fsl/fman: Add the FMan MAC FLIB
From: Igal Liberman The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Makefile |1 + drivers/net/ethernet/freescale/fman/mac/Makefile |5 + .../net/ethernet/freescale/fman/mac/fman_dtsec.c | 571 .../freescale/fman/mac/fman_dtsec_mii_acc.c| 168 ++ .../net/ethernet/freescale/fman/mac/fman_memac.c | 365 + .../freescale/fman/mac/fman_memac_mii_acc.c| 217 .../net/ethernet/freescale/fman/mac/fman_tgec.c| 217 7 files changed, 1544 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/mac/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_dtsec_mii_acc.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_memac.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_memac_mii_acc.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_tgec.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 50a4de2..1841b03 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -5,3 +5,4 @@ obj-y += fsl_fman.o fsl_fman-objs := fman.o obj-y += port/ +obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/mac/Makefile b/drivers/net/ethernet/freescale/fman/mac/Makefile new file mode 100644 index 000..ce03e25 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/mac/Makefile @@ -0,0 +1,5 @@ +obj-y += fsl_fman_mac.o + +fsl_fman_mac-objs := fman_dtsec.o fman_dtsec_mii_acc.o\ + fman_memac.o fman_memac_mii_acc.o\ + fman_tgec.o diff --git a/drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c new file mode 100644 index 000..290a037 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c @@ -0,0 +1,571 @@ +/* + * Copyright 2008 - 2015 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_fman_dtsec.h" + +void fman_dtsec_stop_rx(struct dtsec_regs __iomem *regs) +{ + /* Assert the graceful stop bit */ + iowrite32be(ioread32be(®s->rctrl) | RCTRL_GRS, ®s->rctrl); +} + +void fman_dtsec_stop_tx(struct dtsec_regs __iomem *regs) +{ + /* Assert the graceful stop bit */ + iowrite32be(ioread32be(®s->tctrl) | DTSEC_TCTRL_GTS, ®s->tctrl); +} + +void fman_dtsec_start_tx(struct dtsec_regs __iomem *regs) +{ + /* clear the graceful stop bit */ + iowrite32be(ioread32be(®s->tctrl) & ~DTSEC_TCTRL_GTS, ®s->tctrl); +} + +void fman_dtsec_start_rx(struct dtsec_regs __iomem *regs) +{ + /* clear the graceful stop bit */ + iowrite32be(ioread32be(®s->rctrl) & ~RCTRL_GRS, ®s->rctrl); +} + +void fman_dtsec_defconfig(struct dtsec_cfg *cfg) +{ + cfg->halfdup_on = DEFAULT_HALFDUP_ON; + cfg->halfdup_retra
[PATCH 07/12] fsl/fman: Add FMan MURAM support
From: Igal Liberman Add Frame Manager Multi-User RAM support. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |6 +- drivers/net/ethernet/freescale/fman/fm_muram.c | 127 .../net/ethernet/freescale/fman/inc/fm_muram_ext.h | 103 4 files changed, 235 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/freescale/fman/fm_muram.c create mode 100644 drivers/net/ethernet/freescale/fman/inc/fm_muram_ext.h diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index af42c3a..825a0d5 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -1,6 +1,7 @@ config FSL_FMAN bool "FMan support" depends on FSL_SOC || COMPILE_TEST + select GENERIC_ALLOCATOR default n help Freescale Data-Path Acceleration Architecture Frame Manager diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 1841b03..55c91bd 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -1,8 +1,10 @@ -subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib \ + -I$(srctree)/drivers/net/ethernet/freescale/fman/inc \ + -I$(srctree)/drivers/net/ethernet/freescale/fman obj-y += fsl_fman.o -fsl_fman-objs := fman.o +fsl_fman-objs := fman.o fm_muram.o obj-y += port/ obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/fm_muram.c b/drivers/net/ethernet/freescale/fman/fm_muram.c new file mode 100644 index 000..f62042a --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_muram.c @@ -0,0 +1,127 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM MURAM ... */ +#include "fm_muram_ext.h" + +#include +#include +#include +#include + +struct muram_info { + struct gen_pool *pool; + void __iomem *vbase; + uint64_t size; + phys_addr_t pbase; +}; + +struct muram_info *fm_muram_init(phys_addr_t base, uint64_t size) +{ + struct muram_info *p_muram; + void __iomem *vaddr; + int ret; + + p_muram = kzalloc(sizeof(*p_muram), GFP_KERNEL); + if (!p_muram) + return NULL; + + p_muram->pool = gen_pool_create(ilog2(64), -1); + if (!p_muram->pool) { + pr_err("%s(): MURAM pool create failed\n", __func__); + return NULL; + } + + vaddr = ioremap(base, size); + if (!vaddr) { + pr_err("%s(): MURAM ioremap failed\n", __func__); + return NULL; + } + + ret = gen_pool_add_virt(p_muram->pool, (unsigned long)vaddr, + base, size, -1); + if (ret < 0) { + pr_err("%s(): MURAM pool add fail
[PATCH 10/12] fsl/fman: Add FMan SP support
From: Igal Liberman Add Storage Profiles support. The Storage Profiles contain parameters that are used by the FMan in order to store frames being received on the Rx ports, or to determine the parameters that affect writing the Internal Context in the frame margin on Tx. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Makefile |2 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 104 + drivers/net/ethernet/freescale/fman/sp/Makefile|3 + drivers/net/ethernet/freescale/fman/sp/fm_sp.c | 398 4 files changed, 507 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/fm_sp_common.h create mode 100644 drivers/net/ethernet/freescale/fman/sp/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/sp/fm_sp.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index f61d3a6..c6c3e24 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -8,3 +8,5 @@ fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o obj-y += port/ obj-y += mac/ +obj-y += sp/ + diff --git a/drivers/net/ethernet/freescale/fman/fm_sp_common.h b/drivers/net/ethernet/freescale/fman/fm_sp_common.h new file mode 100644 index 000..a99d795 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_sp_common.h @@ -0,0 +1,104 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM SP ... */ +#ifndef __FM_SP_COMMON_H +#define __FM_SP_COMMON_H + +#include "service.h" +#include "fm_ext.h" +#include "fsl_fman.h" + +/* defaults */ +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_DATA_SIZE 0 +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_PASS_PRS_RESULT false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_PASS_TIME_STAMP false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64 + +/* structure for defining internal context copying */ +struct fm_sp_int_context_data_copy_t { + /* < Offset in External buffer to which internal +* context is copied to (Rx) or taken from (Tx, Op). +*/ + uint16_t ext_buf_offset; + /* Offset within internal context to copy from +* (Rx) or to copy to (Tx, Op). +*/ + uint8_t int_context_offset; + /* Internal offset size to be copied */ + uint16_t size; +}; + +/* struct for defining external buffer margins */ +struct fm_sp_buf_margins_t { + /* Number of bytes to be left at the beginning +* of the external buffer (must be divisible by 16) +*/ + uint16_t start_margins; + /* number of bytes to be left at the end +* of the external buffer(must be divisible by 16) +*/ + uint16_t end_margins; +}; + +struct fm_sp_buffer_offsets_t { + uint32_t data_offset; + uint32_t prs_result_offset; + uint32_t time_stamp_offset; + uint32_t hash_result_offset; +}; + +int fm_sp_build_buffer_structure(struct fm_sp_int_context_data_copy_t +*p_fm_port_int_context_data_copy, +
[PATCH 12/12] fsl/fman: Add FMan MAC driver
From: Igal Liberman This patch adds the Ethernet MAC driver support. Signed-off-by: Igal Liberman Signed-off-by: Madalin Bucur --- drivers/net/ethernet/freescale/fman/inc/mac.h | 136 drivers/net/ethernet/freescale/fman/mac/Makefile |3 +- drivers/net/ethernet/freescale/fman/mac/mac-api.c | 765 + drivers/net/ethernet/freescale/fman/mac/mac.c | 526 ++ 4 files changed, 1429 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h b/drivers/net/ethernet/freescale/fman/inc/mac.h new file mode 100644 index 000..0111f4c --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h @@ -0,0 +1,136 @@ +/* Copyright 2008-2015 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. + */ + +#ifndef __MAC_H +#define __MAC_H + +#include /* struct device, BUS_ID_SIZE */ +#include /* ETH_ALEN */ +#include /* phy_interface_t, struct phy_device */ +#include + +#include "enet_ext.h" + +#include "fsl_fman_drv.h" /* struct port_device */ +#include "fm_port_ext.h" + +struct fm_mac_dev; +enum fm_mac_exceptions; + +enum {DTSEC, XGMAC, MEMAC}; + +struct mac_device { + struct device *dev; + void*priv; + u8 cell_index; + struct resource *res; + void __iomem*vaddr; + u8 addr[ETH_ALEN]; + bool promisc; + + struct fm *fm_dev; + struct fm_port_drv_t*port_dev[2]; + + phy_interface_t phy_if; + u32 if_support; + bool link; + u16 speed; + u16 max_speed; + struct device_node *phy_node; + char fixed_bus_id[MII_BUS_ID_SIZE + 3]; + struct device_node *tbi_node; + struct phy_device *phy_dev; + void*fm; + /* List of multicast addresses */ + struct list_head mc_addr_list; + struct platform_device *eth_dev; + + bool autoneg_pause; + bool rx_pause_req; + bool tx_pause_req; + bool rx_pause_active; + bool tx_pause_active; + + int (*init_phy)(struct net_device *net_dev, struct mac_device *mac_dev); + int (*init)(struct mac_device *mac_dev); + int (*start)(struct mac_device *mac_dev); + int (*stop)(struct mac_device *mac_dev); + int (*set_promisc)(struct fm_mac_dev *fm_mac_dev, bool enable); + int (*change_addr)(struct fm_mac_dev *fm_mac_dev, + enet_addr_t *p_enet_addr); + int (*set_multi)(struct net_device *net_dev, +struct mac_device *mac_dev); + int (*uninit)(struct fm_mac_dev *fm_mac_dev); + int (*set_rx_pause)(struct fm_mac_dev *fm_mac_dev, bool en); + int (*set_tx_pause)(struct fm_mac_dev *fm_mac_dev, u8 priority, +
[v2,7/9] fsl/fman: Add FMan SP support
From: Igal Liberman Add Storage Profiles support. The Storage Profiles contain parameters that are used by the FMan in order to store frames being received on the Rx ports, or to determine the parameters that affect writing the Internal Context in the frame margin on Tx. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Makefile |2 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 104 ++ drivers/net/ethernet/freescale/fman/sp/Makefile|3 + drivers/net/ethernet/freescale/fman/sp/fm_sp.c | 390 4 files changed, 499 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/fm_sp_common.h create mode 100644 drivers/net/ethernet/freescale/fman/sp/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/sp/fm_sp.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index f61d3a6..c6c3e24 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -8,3 +8,5 @@ fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o obj-y += port/ obj-y += mac/ +obj-y += sp/ + diff --git a/drivers/net/ethernet/freescale/fman/fm_sp_common.h b/drivers/net/ethernet/freescale/fman/fm_sp_common.h new file mode 100644 index 000..a99d795 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_sp_common.h @@ -0,0 +1,104 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM SP ... */ +#ifndef __FM_SP_COMMON_H +#define __FM_SP_COMMON_H + +#include "service.h" +#include "fm_ext.h" +#include "fsl_fman.h" + +/* defaults */ +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_DATA_SIZE 0 +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_PASS_PRS_RESULT false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_PASS_TIME_STAMP false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64 + +/* structure for defining internal context copying */ +struct fm_sp_int_context_data_copy_t { + /* < Offset in External buffer to which internal +* context is copied to (Rx) or taken from (Tx, Op). +*/ + uint16_t ext_buf_offset; + /* Offset within internal context to copy from +* (Rx) or to copy to (Tx, Op). +*/ + uint8_t int_context_offset; + /* Internal offset size to be copied */ + uint16_t size; +}; + +/* struct for defining external buffer margins */ +struct fm_sp_buf_margins_t { + /* Number of bytes to be left at the beginning +* of the external buffer (must be divisible by 16) +*/ + uint16_t start_margins; + /* number of bytes to be left at the end +* of the external buffer(must be divisible by 16) +*/ + uint16_t end_margins; +}; + +struct fm_sp_buffer_offsets_t { + uint32_t data_offset; + uint32_t prs_result_offset; + uint32_t time_stamp_offset; + uint32_t hash_result_offset; +}; + +int fm_sp_build_buffer_structure(struct fm_sp_int_context_data_copy_t +*p_fm_port_int_context_data_copy, +
[v2,9/9] fsl/fman: Add FMan MAC driver
From: Igal Liberman This patch adds the Ethernet MAC driver support. Signed-off-by: Igal Liberman Signed-off-by: Madalin Bucur --- drivers/net/ethernet/freescale/fman/inc/mac.h | 136 drivers/net/ethernet/freescale/fman/mac/Makefile |3 +- drivers/net/ethernet/freescale/fman/mac/mac-api.c | 765 + drivers/net/ethernet/freescale/fman/mac/mac.c | 526 ++ 4 files changed, 1429 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h b/drivers/net/ethernet/freescale/fman/inc/mac.h new file mode 100644 index 000..0111f4c --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h @@ -0,0 +1,136 @@ +/* Copyright 2008-2015 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. + */ + +#ifndef __MAC_H +#define __MAC_H + +#include /* struct device, BUS_ID_SIZE */ +#include /* ETH_ALEN */ +#include /* phy_interface_t, struct phy_device */ +#include + +#include "enet_ext.h" + +#include "fsl_fman_drv.h" /* struct port_device */ +#include "fm_port_ext.h" + +struct fm_mac_dev; +enum fm_mac_exceptions; + +enum {DTSEC, XGMAC, MEMAC}; + +struct mac_device { + struct device *dev; + void*priv; + u8 cell_index; + struct resource *res; + void __iomem*vaddr; + u8 addr[ETH_ALEN]; + bool promisc; + + struct fm *fm_dev; + struct fm_port_drv_t*port_dev[2]; + + phy_interface_t phy_if; + u32 if_support; + bool link; + u16 speed; + u16 max_speed; + struct device_node *phy_node; + char fixed_bus_id[MII_BUS_ID_SIZE + 3]; + struct device_node *tbi_node; + struct phy_device *phy_dev; + void*fm; + /* List of multicast addresses */ + struct list_head mc_addr_list; + struct platform_device *eth_dev; + + bool autoneg_pause; + bool rx_pause_req; + bool tx_pause_req; + bool rx_pause_active; + bool tx_pause_active; + + int (*init_phy)(struct net_device *net_dev, struct mac_device *mac_dev); + int (*init)(struct mac_device *mac_dev); + int (*start)(struct mac_device *mac_dev); + int (*stop)(struct mac_device *mac_dev); + int (*set_promisc)(struct fm_mac_dev *fm_mac_dev, bool enable); + int (*change_addr)(struct fm_mac_dev *fm_mac_dev, + enet_addr_t *p_enet_addr); + int (*set_multi)(struct net_device *net_dev, +struct mac_device *mac_dev); + int (*uninit)(struct fm_mac_dev *fm_mac_dev); + int (*set_rx_pause)(struct fm_mac_dev *fm_mac_dev, bool en); + int (*set_tx_pause)(struct fm_mac_dev *fm_mac_dev, u8 priority, +
[v2,0/9] Freescale DPAA FMan
From: Igal Liberman The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which contains a series of hardware blocks: ports, Ethernet MACs, a multi user RAM (MURAM) and Storage Profile (SP). This patch set introduced the FMan driver code that configures and initializes the FMan hardware blocks, offering support for three different types of MACs (dTSEC, TGEC, MEMAC). The first 3 patches present the FMan Foundation Libraries (FLIBs). The FMan drivers make use of the basic API the FMan FLib provides to configure and control the FMan hardware. The remaining patches present the required FMan hardware module drivers. The driver structure and a hint on file naming: -- | FMan driver/MAC driver | fm_drv*, mac* files -- | FMan | Port | MAC | MURAM | SP | fm_* files -- | FLib | fman_* files -- v1 --> v2: - Addressed feedback from Paul Bolle: - General feedback of FMan Driver layer - Remove Errata defines - Aligned comments to Kernel Doc - Remove Loadable Module support (not yet supported) - Removed not needed KConfig dependencies - Addressed feedback from Scott Wood - Use Kernel ioread/iowrite services - Squash FLIB source and header patches together This submission is based on the prior Freescale DPAA FMan V3,RFC submission. Several issues addresses in this submission: - Reduced MAC layering and complexity - Reduced code base - T1024/T2080 10G best effort support Igal Liberman (8): fsl/fman: Add the FMan FLIB fsl/fman: Add the FMan port FLIB fsl/fman: Add the FMan MAC FLIB fsl/fman: Add FMan MURAM support fsl/fman: Add Frame Manager support fsl/fman: Add FMan MAC support fsl/fman: Add FMan SP support fsl/fman: Add FMan MAC driver Madalin Bucur (1): fsl/fman: Add FMan Port Support drivers/net/ethernet/freescale/Kconfig |1 + drivers/net/ethernet/freescale/Makefile|2 + drivers/net/ethernet/freescale/fman/Kconfig| 44 + drivers/net/ethernet/freescale/fman/Makefile | 12 + .../net/ethernet/freescale/fman/flib/fsl_enet.h| 135 ++ .../net/ethernet/freescale/fman/flib/fsl_fman.h| 608 ++ .../ethernet/freescale/fman/flib/fsl_fman_dtsec.h | 830 + .../freescale/fman/flib/fsl_fman_dtsec_mii_acc.h | 93 + .../ethernet/freescale/fman/flib/fsl_fman_memac.h | 443 + .../freescale/fman/flib/fsl_fman_memac_mii_acc.h | 75 + .../ethernet/freescale/fman/flib/fsl_fman_port.h | 443 + .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 53 + .../ethernet/freescale/fman/flib/fsl_fman_tgec.h | 402 drivers/net/ethernet/freescale/fman/fm.c | 1941 drivers/net/ethernet/freescale/fman/fm.h | 397 drivers/net/ethernet/freescale/fman/fm_common.h| 265 +++ drivers/net/ethernet/freescale/fman/fm_drv.c | 784 drivers/net/ethernet/freescale/fman/fm_drv.h | 118 ++ drivers/net/ethernet/freescale/fman/fm_muram.c | 127 ++ drivers/net/ethernet/freescale/fman/fm_port_drv.c | 457 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 104 ++ drivers/net/ethernet/freescale/fman/fman.c | 975 ++ .../ethernet/freescale/fman/inc/crc_mac_addr_ext.h | 314 drivers/net/ethernet/freescale/fman/inc/enet_ext.h | 199 ++ drivers/net/ethernet/freescale/fman/inc/fm_ext.h | 488 + .../net/ethernet/freescale/fman/inc/fm_muram_ext.h | 112 ++ .../net/ethernet/freescale/fman/inc/fm_port_ext.h | 367 .../net/ethernet/freescale/fman/inc/fsl_fman_drv.h | 212 +++ drivers/net/ethernet/freescale/fman/inc/mac.h | 136 ++ drivers/net/ethernet/freescale/fman/inc/service.h | 55 + drivers/net/ethernet/freescale/fman/mac/Makefile |8 + drivers/net/ethernet/freescale/fman/mac/fm_dtsec.c | 1053 +++ drivers/net/ethernet/freescale/fman/mac/fm_dtsec.h | 209 +++ .../ethernet/freescale/fman/mac/fm_dtsec_mii_acc.c | 80 + .../ethernet/freescale/fman/mac/fm_dtsec_mii_acc.h | 43 + drivers/net/ethernet/freescale/fman/mac/fm_mac.h | 261 +++ drivers/net/ethernet/freescale/fman/mac/fm_memac.c | 723 drivers/net/ethernet/freescale/fman/mac/fm_memac.h | 123 ++ .../ethernet/freescale/fman/mac/fm_memac_mii_acc.c | 63 + drivers/net/ethernet/freescale/fman/mac/fm_tgec.c | 630 +++ drivers/net/ethernet/freescale/fman/mac/fm_tge
[v2,2/9] fsl/fman: Add the FMan port FLIB
From: Igal Liberman The FMan Port FLib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |2 + .../ethernet/freescale/fman/flib/fsl_fman_port.h | 443 ++ .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 53 ++ drivers/net/ethernet/freescale/fman/port/Makefile |3 + .../net/ethernet/freescale/fman/port/fman_port.c | 613 6 files changed, 1115 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_sp.h create mode 100644 drivers/net/ethernet/freescale/fman/port/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/port/fman_port.c diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 8aeae29..af42c3a 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -5,3 +5,4 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 2799c6f..50a4de2 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -3,3 +3,5 @@ subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib obj-y += fsl_fman.o fsl_fman-objs := fman.o + +obj-y += port/ diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h new file mode 100644 index 000..ee1a853 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h @@ -0,0 +1,443 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FSL_FMAN_PORT_H +#define __FSL_FMAN_PORT_H + +#include + +#include "fsl_fman_sp.h" + +/* Registers bit fields */ + +/* BMI defines */ +#define BMI_EBD_EN 0x8000 + +#define BMI_PORT_CFG_EN0x8000 +#define BMI_PORT_CFG_FDOVR 0x0200 + +#define BMI_PORT_STATUS_BSY0x8000 + +#define BMI_DMA_ATTR_SWP_SHIFT FMAN_SP_DMA_ATTR_SWP_SHIFT +#define BMI_DMA_ATTR_IC_STASH_ON 0x1000 +#define BMI_DMA_ATTR_HDR_STASH_ON 0x0400 +#define BMI_DMA_ATTR_SG_STASH_ON 0x0100 +#define BMI_DMA_ATTR_WRITE_OPTIMIZEFMAN_SP_DMA_ATTR_WRITE_OPTIMIZE + +#define BMI_RX_FIFO_PRI_ELEVATION_SHIFT16 +#define BMI_RX_FIFO_THRESHOLD_ETHE 0x8000 + +#define BMI_RX_FRAME_END_CS_IGNORE_SHIFT 24 +#define BMI_RX_FRAME_END_CUT_SHIFT 16 + +#define BMI_IC_TO_EXT_SHIFTFMAN_SP_IC_TO_EXT_SHIFT +#define BMI_IC_FROM_INT_SHIFT FMAN_SP_IC_FROM_INT_SHIFT + +#define BMI_INT_BUF_MARG_SHIFT 28 +#defin
[v2,4/9] fsl/fman: Add FMan MURAM support
From: Igal Liberman Add Frame Manager Multi-User RAM support. Signed-off-by: Igal Liberman --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |6 +- drivers/net/ethernet/freescale/fman/fm_muram.c | 127 .../net/ethernet/freescale/fman/inc/fm_muram_ext.h | 112 + 4 files changed, 244 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/freescale/fman/fm_muram.c create mode 100644 drivers/net/ethernet/freescale/fman/inc/fm_muram_ext.h diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index af42c3a..825a0d5 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -1,6 +1,7 @@ config FSL_FMAN bool "FMan support" depends on FSL_SOC || COMPILE_TEST + select GENERIC_ALLOCATOR default n help Freescale Data-Path Acceleration Architecture Frame Manager diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 1841b03..55c91bd 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -1,8 +1,10 @@ -subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib \ + -I$(srctree)/drivers/net/ethernet/freescale/fman/inc \ + -I$(srctree)/drivers/net/ethernet/freescale/fman obj-y += fsl_fman.o -fsl_fman-objs := fman.o +fsl_fman-objs := fman.o fm_muram.o obj-y += port/ obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/fm_muram.c b/drivers/net/ethernet/freescale/fman/fm_muram.c new file mode 100644 index 000..f62042a --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_muram.c @@ -0,0 +1,127 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM MURAM ... */ +#include "fm_muram_ext.h" + +#include +#include +#include +#include + +struct muram_info { + struct gen_pool *pool; + void __iomem *vbase; + uint64_t size; + phys_addr_t pbase; +}; + +struct muram_info *fm_muram_init(phys_addr_t base, uint64_t size) +{ + struct muram_info *p_muram; + void __iomem *vaddr; + int ret; + + p_muram = kzalloc(sizeof(*p_muram), GFP_KERNEL); + if (!p_muram) + return NULL; + + p_muram->pool = gen_pool_create(ilog2(64), -1); + if (!p_muram->pool) { + pr_err("%s(): MURAM pool create failed\n", __func__); + return NULL; + } + + vaddr = ioremap(base, size); + if (!vaddr) { + pr_err("%s(): MURAM ioremap failed\n", __func__); + return NULL; + } + + ret = gen_pool_add_virt(p_muram->pool, (unsigned long)vaddr, + base, size, -1); + if (ret < 0) { + pr_err("%s(): MURAM pool add fail
[PATCH v2 2/2] powerpc/mpc85xx: Add FSL QorIQ DPAA FMan support to the SoC device tree(s)
From: Igal Liberman Based on prior work by Andy Fleming Signed-off-by: Igal Liberman Signed-off-by: Shruti Kanetkar Signed-off-by: Emil Medve --- v1 ---> v2: - Added T1024 support arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi |9 ++- arch/powerpc/boot/dts/fsl/b4860si-post.dtsi | 20 - arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi | 12 ++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi| 31 +++- arch/powerpc/boot/dts/fsl/p1023si-post.dtsi | 115 ++- arch/powerpc/boot/dts/fsl/p1023si-pre.dtsi |5 +- arch/powerpc/boot/dts/fsl/p2041si-post.dtsi | 29 ++- arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi | 10 ++- arch/powerpc/boot/dts/fsl/p3041si-post.dtsi | 29 ++- arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi | 10 ++- arch/powerpc/boot/dts/fsl/p4080si-post.dtsi | 48 ++- arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi | 15 +++- arch/powerpc/boot/dts/fsl/p5020si-post.dtsi | 29 ++- arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi | 10 ++- arch/powerpc/boot/dts/fsl/p5040si-post.dtsi | 56 - arch/powerpc/boot/dts/fsl/p5040si-pre.dtsi | 17 +++- arch/powerpc/boot/dts/fsl/t1023si-post.dtsi | 19 + arch/powerpc/boot/dts/fsl/t102xsi-pre.dtsi |6 ++ arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 31 arch/powerpc/boot/dts/fsl/t104xsi-pre.dtsi |9 ++- arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 43 ++ arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi | 11 +++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 88 +++- arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi | 22 - 24 files changed, 654 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi index 9cfeaef..5d54ec7 100644 --- a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi @@ -1,7 +1,7 @@ /* * B4420 Silicon/SoC Device Tree Source (pre include) * - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012 - 2015 Freescale Semiconductor, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -54,8 +54,13 @@ dma0 = &dma0; dma1 = &dma1; sdhc = &sdhc; - }; + fman0 = &fman0; + ethernet0 = &enet0; + ethernet1 = &enet1; + ethernet2 = &enet2; + ethernet3 = &enet3; + }; cpus { #address-cells = <1>; diff --git a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi index 26585d6..3065833 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi @@ -1,7 +1,7 @@ /* * B4860 Silicon/SoC Device Tree Source (post include) * - * Copyright 2012 - 2014 Freescale Semiconductor Inc. + * Copyright 2012 - 2015 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -271,6 +271,24 @@ compatible = "fsl,b4860-rcpm", "fsl,qoriq-rcpm-2.0"; }; +/include/ "qoriq-fman3-0-1g-4.dtsi" +/include/ "qoriq-fman3-0-1g-5.dtsi" +/include/ "qoriq-fman3-0-10g-0.dtsi" +/include/ "qoriq-fman3-0-10g-1.dtsi" + fman@40 { + enet4: ethernet@e8000 { + }; + + enet5: ethernet@ea000 { + }; + + enet6: ethernet@f { + }; + + enet7: ethernet@f2000 { + }; + }; + L2: l2-cache-controller@c2 { compatible = "fsl,b4860-l2-cache-controller"; }; diff --git a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi index bc914f2..a738f7c 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi @@ -1,7 +1,7 @@ /* * B4860 Silicon/SoC Device Tree Source (pre include) * - * Copyright 2012 Freescale Semiconductor Inc. + * Copyright 2012 - 2015 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -54,6 +54,16 @@ dma0 = &dma0; dma1 = &dma1; sdhc = &sdhc; + + fman0 = &fman0; + ethernet0 = &enet0; + ethernet1 = &enet1; + ethernet2 = &enet2; + ethernet3 = &enet3; + ethernet4 = &enet4; + ethernet5 = &enet5; + ethernet6 = &enet6; + ethernet7 = &e
[PATCH v4] powerpc/mpc85xx: Add MDIO bus muxing support to the board device tree(s)
From: Igal Liberman Describe the PHY topology for all configurations supported by each board Based on prior work by Andy Fleming Signed-off-by: Igal Liberman Signed-off-by: Shruti Kanetkar Signed-off-by: Emil Medve --- Depends on the following patch set: https://patchwork.ozlabs.org/patch/502018/ https://patchwork.ozlabs.org/patch/502019/ v3 ---> v4: - Added T1024 support v2 ---> v3: - Fixed incorrect E-Mail address (signed-off-by) v1 ---> v2 - Remove 'Change-Id' arch/powerpc/boot/dts/b4860qds.dts| 60 - arch/powerpc/boot/dts/b4qds.dtsi | 51 - arch/powerpc/boot/dts/p1023rdb.dts| 24 +- arch/powerpc/boot/dts/p2041rdb.dts| 92 +++- arch/powerpc/boot/dts/p3041ds.dts | 112 - arch/powerpc/boot/dts/p4080ds.dts | 184 ++- arch/powerpc/boot/dts/p5020ds.dts | 112 - arch/powerpc/boot/dts/p5040ds.dts | 234 ++- arch/powerpc/boot/dts/t1023rdb.dts| 41 arch/powerpc/boot/dts/t1024rdb.dts| 45 arch/powerpc/boot/dts/t1040rdb.dts| 32 ++- arch/powerpc/boot/dts/t1042rdb.dts| 30 ++- arch/powerpc/boot/dts/t1042rdb_pi.dts | 18 +- arch/powerpc/boot/dts/t104xqds.dtsi | 178 ++- arch/powerpc/boot/dts/t104xrdb.dtsi | 33 ++- arch/powerpc/boot/dts/t2080qds.dts| 158 - arch/powerpc/boot/dts/t2080rdb.dts| 67 +- arch/powerpc/boot/dts/t2081qds.dts| 221 +- arch/powerpc/boot/dts/t4240qds.dts| 400 - arch/powerpc/boot/dts/t4240rdb.dts| 149 +++- 20 files changed, 2221 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/boot/dts/b4860qds.dts b/arch/powerpc/boot/dts/b4860qds.dts index 6bb3707..98b1ef4 100644 --- a/arch/powerpc/boot/dts/b4860qds.dts +++ b/arch/powerpc/boot/dts/b4860qds.dts @@ -1,7 +1,7 @@ /* * B4860DS Device Tree Source * - * Copyright 2012 Freescale Semiconductor Inc. + * Copyright 2012 - 2015 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -39,12 +39,69 @@ model = "fsl,B4860QDS"; compatible = "fsl,B4860QDS"; + aliases { + phy_sgmii_1e = &phy_sgmii_1e; + phy_sgmii_1f = &phy_sgmii_1f; + phy_xaui_slot1 = &phy_xaui_slot1; + phy_xaui_slot2 = &phy_xaui_slot2; + }; + ifc: localbus@ffe124000 { board-control@3,0 { compatible = "fsl,b4860qds-fpga", "fsl,fpga-qixis"; }; }; + soc@ffe00 { + fman@40 { + ethernet@e8000 { + phy-handle = <&phy_sgmii_1e>; + phy-connection-type = "sgmii"; + }; + + ethernet@ea000 { + phy-handle = <&phy_sgmii_1f>; + phy-connection-type = "sgmii"; + }; + + ethernet@f { + phy-handle = <&phy_xaui_slot1>; + phy-connection-type = "xgmii"; + }; + + ethernet@f2000 { + phy-handle = <&phy_xaui_slot2>; + phy-connection-type = "xgmii"; + }; + + mdio@fc000 { + phy_sgmii_1e: ethernet-phy@1e { + reg = <0x1e>; + status = "disabled"; + }; + + phy_sgmii_1f: ethernet-phy@1f { + reg = <0x1f>; + status = "disabled"; + }; + }; + + mdio@fd000 { + phy_xaui_slot1: xaui-phy@slot1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x7>; + status = "disabled"; + }; + + phy_xaui_slot2: xaui-phy@slot2 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x6>; + status = "disabled"; + }; + }; + }; + }; + rio: rapidio@ff
[v3, 2/2] powerpc/mpc85xx: Add FSL QorIQ DPAA FMan support to the SoC device tree(s)
From: Igal Liberman Based on prior work by Andy Fleming Signed-off-by: Shruti Kanetkar Signed-off-by: Emil Medve Signed-off-by: Igal Liberman --- v2 ---> v3: - Removed P1023 support v1 ---> v2: - Added T1024 support arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi |9 ++- arch/powerpc/boot/dts/fsl/b4860si-post.dtsi | 20 +- arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi | 12 +++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi| 31 +- arch/powerpc/boot/dts/fsl/p2041si-post.dtsi | 29 - arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi | 10 ++- arch/powerpc/boot/dts/fsl/p3041si-post.dtsi | 29 - arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi | 10 ++- arch/powerpc/boot/dts/fsl/p4080si-post.dtsi | 48 ++- arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi | 15 - arch/powerpc/boot/dts/fsl/p5020si-post.dtsi | 29 - arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi | 10 ++- arch/powerpc/boot/dts/fsl/p5040si-post.dtsi | 56 - arch/powerpc/boot/dts/fsl/p5040si-pre.dtsi | 17 +- arch/powerpc/boot/dts/fsl/t1023si-post.dtsi | 19 ++ arch/powerpc/boot/dts/fsl/t102xsi-pre.dtsi |6 ++ arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 31 ++ arch/powerpc/boot/dts/fsl/t104xsi-pre.dtsi |9 ++- arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 43 + arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi | 11 arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 88 ++- arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi | 22 ++- 22 files changed, 536 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi index 9cfeaef..5d54ec7 100644 --- a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi @@ -1,7 +1,7 @@ /* * B4420 Silicon/SoC Device Tree Source (pre include) * - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012 - 2015 Freescale Semiconductor, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -54,8 +54,13 @@ dma0 = &dma0; dma1 = &dma1; sdhc = &sdhc; - }; + fman0 = &fman0; + ethernet0 = &enet0; + ethernet1 = &enet1; + ethernet2 = &enet2; + ethernet3 = &enet3; + }; cpus { #address-cells = <1>; diff --git a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi index 26585d6..3065833 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi @@ -1,7 +1,7 @@ /* * B4860 Silicon/SoC Device Tree Source (post include) * - * Copyright 2012 - 2014 Freescale Semiconductor Inc. + * Copyright 2012 - 2015 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -271,6 +271,24 @@ compatible = "fsl,b4860-rcpm", "fsl,qoriq-rcpm-2.0"; }; +/include/ "qoriq-fman3-0-1g-4.dtsi" +/include/ "qoriq-fman3-0-1g-5.dtsi" +/include/ "qoriq-fman3-0-10g-0.dtsi" +/include/ "qoriq-fman3-0-10g-1.dtsi" + fman@40 { + enet4: ethernet@e8000 { + }; + + enet5: ethernet@ea000 { + }; + + enet6: ethernet@f { + }; + + enet7: ethernet@f2000 { + }; + }; + L2: l2-cache-controller@c2 { compatible = "fsl,b4860-l2-cache-controller"; }; diff --git a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi index bc914f2..a738f7c 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi @@ -1,7 +1,7 @@ /* * B4860 Silicon/SoC Device Tree Source (pre include) * - * Copyright 2012 Freescale Semiconductor Inc. + * Copyright 2012 - 2015 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -54,6 +54,16 @@ dma0 = &dma0; dma1 = &dma1; sdhc = &sdhc; + + fman0 = &fman0; + ethernet0 = &enet0; + ethernet1 = &enet1; + ethernet2 = &enet2; + ethernet3 = &enet3; + ethernet4 = &enet4; + ethernet5 = &enet5; + ethernet6 = &enet6; + ethernet7 = &enet7; }; diff --git a/arch/power
[PATCH v5] powerpc/mpc85xx: Add MDIO bus muxing support to the board device tree(s)
From: Igal Liberman Describe the PHY topology for all configurations supported by each board Based on prior work by Andy Fleming Signed-off-by: Shruti Kanetkar Signed-off-by: Emil Medve Signed-off-by: Igal Liberman --- Depends on the following patch set: https://patchwork.ozlabs.org/patch/503107/ https://patchwork.ozlabs.org/patch/503108/ v4 ---> v5: - Correct "Signed-off-by" order v3 ---> v4: - Added T1024 support v2 ---> v3: - Fixed incorrect E-Mail address (signed-off-by) v1 ---> v2 - Remove 'Change-Id' arch/powerpc/boot/dts/b4860qds.dts| 60 - arch/powerpc/boot/dts/b4qds.dtsi | 51 - arch/powerpc/boot/dts/p1023rdb.dts| 24 +- arch/powerpc/boot/dts/p2041rdb.dts| 92 +++- arch/powerpc/boot/dts/p3041ds.dts | 112 - arch/powerpc/boot/dts/p4080ds.dts | 184 ++- arch/powerpc/boot/dts/p5020ds.dts | 112 - arch/powerpc/boot/dts/p5040ds.dts | 234 ++- arch/powerpc/boot/dts/t1023rdb.dts| 41 arch/powerpc/boot/dts/t1024rdb.dts| 45 arch/powerpc/boot/dts/t1040rdb.dts| 32 ++- arch/powerpc/boot/dts/t1042rdb.dts| 30 ++- arch/powerpc/boot/dts/t1042rdb_pi.dts | 18 +- arch/powerpc/boot/dts/t104xqds.dtsi | 178 ++- arch/powerpc/boot/dts/t104xrdb.dtsi | 33 ++- arch/powerpc/boot/dts/t2080qds.dts| 158 - arch/powerpc/boot/dts/t2080rdb.dts| 67 +- arch/powerpc/boot/dts/t2081qds.dts| 221 +- arch/powerpc/boot/dts/t4240qds.dts| 400 - arch/powerpc/boot/dts/t4240rdb.dts| 149 +++- 20 files changed, 2221 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/boot/dts/b4860qds.dts b/arch/powerpc/boot/dts/b4860qds.dts index 6bb3707..98b1ef4 100644 --- a/arch/powerpc/boot/dts/b4860qds.dts +++ b/arch/powerpc/boot/dts/b4860qds.dts @@ -1,7 +1,7 @@ /* * B4860DS Device Tree Source * - * Copyright 2012 Freescale Semiconductor Inc. + * Copyright 2012 - 2015 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -39,12 +39,69 @@ model = "fsl,B4860QDS"; compatible = "fsl,B4860QDS"; + aliases { + phy_sgmii_1e = &phy_sgmii_1e; + phy_sgmii_1f = &phy_sgmii_1f; + phy_xaui_slot1 = &phy_xaui_slot1; + phy_xaui_slot2 = &phy_xaui_slot2; + }; + ifc: localbus@ffe124000 { board-control@3,0 { compatible = "fsl,b4860qds-fpga", "fsl,fpga-qixis"; }; }; + soc@ffe00 { + fman@40 { + ethernet@e8000 { + phy-handle = <&phy_sgmii_1e>; + phy-connection-type = "sgmii"; + }; + + ethernet@ea000 { + phy-handle = <&phy_sgmii_1f>; + phy-connection-type = "sgmii"; + }; + + ethernet@f { + phy-handle = <&phy_xaui_slot1>; + phy-connection-type = "xgmii"; + }; + + ethernet@f2000 { + phy-handle = <&phy_xaui_slot2>; + phy-connection-type = "xgmii"; + }; + + mdio@fc000 { + phy_sgmii_1e: ethernet-phy@1e { + reg = <0x1e>; + status = "disabled"; + }; + + phy_sgmii_1f: ethernet-phy@1f { + reg = <0x1f>; + status = "disabled"; + }; + }; + + mdio@fd000 { + phy_xaui_slot1: xaui-phy@slot1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x7>; + status = "disabled"; + }; + + phy_xaui_slot2: xaui-phy@slot2 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x6>; + status = "disabled"; +
[v4, 2/2] powerpc/mpc85xx: Add FSL QorIQ DPAA FMan support to the SoC device tree(s)
From: Igal Liberman Based on prior work by Andy Fleming Signed-off-by: Shruti Kanetkar Signed-off-by: Emil Medve Signed-off-by: Igal Liberman --- v3 ---> v4: - No changes in this patch v2 ---> v3: - Removed P1023 support v1 ---> v2: - Added T1024 support arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi |9 ++- arch/powerpc/boot/dts/fsl/b4860si-post.dtsi | 20 +- arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi | 12 +++- arch/powerpc/boot/dts/fsl/b4si-post.dtsi| 31 +- arch/powerpc/boot/dts/fsl/p2041si-post.dtsi | 29 - arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi | 10 ++- arch/powerpc/boot/dts/fsl/p3041si-post.dtsi | 29 - arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi | 10 ++- arch/powerpc/boot/dts/fsl/p4080si-post.dtsi | 48 ++- arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi | 15 - arch/powerpc/boot/dts/fsl/p5020si-post.dtsi | 29 - arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi | 10 ++- arch/powerpc/boot/dts/fsl/p5040si-post.dtsi | 56 - arch/powerpc/boot/dts/fsl/p5040si-pre.dtsi | 17 +- arch/powerpc/boot/dts/fsl/t1023si-post.dtsi | 19 ++ arch/powerpc/boot/dts/fsl/t102xsi-pre.dtsi |6 ++ arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 31 ++ arch/powerpc/boot/dts/fsl/t104xsi-pre.dtsi |9 ++- arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 43 + arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi | 11 arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 88 ++- arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi | 22 ++- 22 files changed, 536 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi index 9cfeaef..5d54ec7 100644 --- a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi @@ -1,7 +1,7 @@ /* * B4420 Silicon/SoC Device Tree Source (pre include) * - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012 - 2015 Freescale Semiconductor, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -54,8 +54,13 @@ dma0 = &dma0; dma1 = &dma1; sdhc = &sdhc; - }; + fman0 = &fman0; + ethernet0 = &enet0; + ethernet1 = &enet1; + ethernet2 = &enet2; + ethernet3 = &enet3; + }; cpus { #address-cells = <1>; diff --git a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi index 26585d6..3065833 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi @@ -1,7 +1,7 @@ /* * B4860 Silicon/SoC Device Tree Source (post include) * - * Copyright 2012 - 2014 Freescale Semiconductor Inc. + * Copyright 2012 - 2015 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -271,6 +271,24 @@ compatible = "fsl,b4860-rcpm", "fsl,qoriq-rcpm-2.0"; }; +/include/ "qoriq-fman3-0-1g-4.dtsi" +/include/ "qoriq-fman3-0-1g-5.dtsi" +/include/ "qoriq-fman3-0-10g-0.dtsi" +/include/ "qoriq-fman3-0-10g-1.dtsi" + fman@40 { + enet4: ethernet@e8000 { + }; + + enet5: ethernet@ea000 { + }; + + enet6: ethernet@f { + }; + + enet7: ethernet@f2000 { + }; + }; + L2: l2-cache-controller@c2 { compatible = "fsl,b4860-l2-cache-controller"; }; diff --git a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi index bc914f2..a738f7c 100644 --- a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi +++ b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi @@ -1,7 +1,7 @@ /* * B4860 Silicon/SoC Device Tree Source (pre include) * - * Copyright 2012 Freescale Semiconductor Inc. + * Copyright 2012 - 2015 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -54,6 +54,16 @@ dma0 = &dma0; dma1 = &dma1; sdhc = &sdhc; + + fman0 = &fman0; + ethernet0 = &enet0; + ethernet1 = &enet1; + ethernet2 = &enet2; + ethernet3 = &enet3; + ethernet4 = &enet4; + ethernet5 = &enet5; + ethernet6 = &enet6; + etherne
[PATCH] clk: ppc-corenet: Add support for the FMD clock
From: Igal Liberman Signed-off-by: Igal Liberman This patch is based on https://patchwork.ozlabs.org/patch/430966/ --- drivers/clk/clk-ppc-corenet.c | 250 + 1 file changed, 250 insertions(+) diff --git a/drivers/clk/clk-ppc-corenet.c b/drivers/clk/clk-ppc-corenet.c index ff425e1..dcde0e6 100644 --- a/drivers/clk/clk-ppc-corenet.c +++ b/drivers/clk/clk-ppc-corenet.c @@ -18,6 +18,7 @@ #include #include #include +#include struct cmux_clk { struct clk_hw hw; @@ -144,6 +145,254 @@ err_name: kfree(parent_names); } +/* Table for matching compatible strings, for device tree + * guts node, for QorIQ SOCs. + * "fsl,qoriq-device-config-2.0" corresponds to T4 & B4 + * SOCs. For the older SOCs "fsl,qoriq-device-config-1.0" + * string would be used. + */ + +static const struct of_device_id guts_device_ids[] = { + { .compatible = "fsl,qoriq-device-config-1.0", }, + { .compatible = "fsl,qoriq-device-config-2.0", }, +}; + +/* P2, P3, P4, P5 */ +#define FM1_CLK_SEL_SHIFT 30 +#define FM1_CLK_SELBIT(FM1_CLK_SEL_SHIFT) +#define FM2_CLK_SEL_SHIFT 29 +#define FM2_CLK_SELBIT(FM2_CLK_SEL_SHIFT) +#define HWA_ASYNC_DIV_SHIFT26 +#define HWA_ASYNC_DIV BIT(HWA_ASYNC_DIV_SHIFT) + +/* B4, T2 */ +#define HWA_CGA_M1_CLK_SEL_SHIFT 29 +#define HWA_CGA_M1_CLK_SEL (BIT(HWA_CGA_M1_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGA_M1_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGA_M1_CLK_SEL_SHIFT)) + +/* T4240 */ +#define HWA_CGB_M1_CLK_SEL_SHIFT 26 +#define HWA_CGB_M1_CLK_SEL (BIT(HWA_CGB_M1_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGB_M1_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGB_M1_CLK_SEL_SHIFT)) +#define HWA_CGB_M2_CLK_SEL_SHIFT 3 +#define HWA_CGB_M2_CLK_SEL (BIT(HWA_CGB_M2_CLK_SEL_SHIFT + 2) |\ +BIT(HWA_CGB_M2_CLK_SEL_SHIFT + 1) |\ +BIT(HWA_CGB_M2_CLK_SEL_SHIFT)) + +static u8 get_fm_clk_parent(struct clk_hw *hw) +{ + struct ccsr_guts __iomem *guts_regs = NULL; + struct device_node *guts; + uint32_t reg = 0; + int clk_src = 0; + int fm_clk_select = -EINVAL; + int fm_id = 0; + + guts = of_find_matching_node(NULL, guts_device_ids); + if (!guts) { + pr_err("could not find GUTS node\n"); + return -EINVAL; + } + + guts_regs = of_iomap(guts, 0); + of_node_put(guts); + if (!guts_regs) { + pr_err("ioremap of GUTS node failed\n"); + return -EINVAL; + } + + if (!strcmp(__clk_get_name(hw->clk), "fm1-clk")) + fm_id = 1; + + /* The FM clock provider is SoC dependent and it's determened by the +* reset configuration word (RCW). We need to map the RCW options to +* the order of the providers in the device tree. +* This code makes assumptions about the clock provider order: +* In the P family: +* 0 - platform clock/2 +* 1 - PLLx /2 +* 2 - PLLx /4 (if possible). +* In B/T family: +* The same order in which the clock providers are described in +* the Reference Manual, starting from 0. +* +* In a case of only one possible provider, the index is 0. +*/ + + if (of_device_is_compatible(guts, "fsl,p1023-guts") || + of_device_is_compatible(guts, "fsl,t1040-device-config")) + /* P1023 and T1040 have only one optional clock source */ + fm_clk_select = 0; + else if (of_device_is_compatible(guts, "fsl,p2041-device-config") || +of_device_is_compatible(guts, "fsl,p3041-device-config") || +of_device_is_compatible(guts, "fsl,p4080-device-config")) { + /* Read RCW*/ + reg = in_be32(&guts_regs->rcwsr[7]); + + /* Check bit 225 or bit 226 (FM2, P4080) +* 0 - The clock source is Platform PLL /2 +* 1 - The clock source is PLL2 /2 (P2, P3) or PLL3 /2 (P4) +* +* Bit 225 represents FM1, Bit 226 represents FM2 +*/ + if (fm_id == 0) + fm_clk_select = (reg & FM1_CLK_SEL) >> + FM1_CLK_SEL_SHIFT; + else + fm_clk_select = (reg & FM2_CLK_SEL) >> + FM2_CLK_SEL_SHIFT; + } else if (of_device_is_compatible(guts, "fsl,p5020-devic
[PATCH] powerpc/mpc85xx: Add FMan platform support
From: Igal Liberman Get the FMan devices/sub-nodes (MAC, MDIO, etc.) auto-probed Signed-off-by: Igal Liberman Reviewed-on: http://git.am.freescale.net:8181/30408 Tested-by: Review Code-CDREVIEW Reviewed-by: Emilian Medve --- arch/powerpc/platforms/85xx/common.c |1 + arch/powerpc/platforms/85xx/corenet_generic.c |3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c index a1cd3cc..958b3c6 100644 --- a/arch/powerpc/platforms/85xx/common.c +++ b/arch/powerpc/platforms/85xx/common.c @@ -42,6 +42,7 @@ static const struct of_device_id mpc85xx_common_ids[] __initconst = { { .compatible = "fsl,qoriq-pcie-v2.2", }, /* For the FMan driver */ { .compatible = "fsl,dpaa", }, + { .compatible = "fsl,fman", }, {}, }; diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c index 9992e29..26b246d 100644 --- a/arch/powerpc/platforms/85xx/corenet_generic.c +++ b/arch/powerpc/platforms/85xx/corenet_generic.c @@ -124,6 +124,9 @@ static const struct of_device_id of_device_ids[] = { { .compatible = "fsl,qe", }, + { + .compatible= "fsl,fman", + }, /* The following two are for the Freescale hypervisor */ { .name = "hypervisor", -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH][v2] powerpc/mpc85xx: Add FMan platform support
From: Igal Liberman Get the FMan devices/sub-nodes (MAC, MDIO, etc.) auto-probed Signed-off-by: Igal Liberman --- arch/powerpc/platforms/85xx/common.c |1 + arch/powerpc/platforms/85xx/corenet_generic.c |3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c index a1cd3cc..958b3c6 100644 --- a/arch/powerpc/platforms/85xx/common.c +++ b/arch/powerpc/platforms/85xx/common.c @@ -42,6 +42,7 @@ static const struct of_device_id mpc85xx_common_ids[] __initconst = { { .compatible = "fsl,qoriq-pcie-v2.2", }, /* For the FMan driver */ { .compatible = "fsl,dpaa", }, + { .compatible = "fsl,fman", }, {}, }; diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c index 9992e29..26b246d 100644 --- a/arch/powerpc/platforms/85xx/corenet_generic.c +++ b/arch/powerpc/platforms/85xx/corenet_generic.c @@ -124,6 +124,9 @@ static const struct of_device_id of_device_ids[] = { { .compatible = "fsl,qe", }, + { + .compatible= "fsl,fman", + }, /* The following two are for the Freescale hypervisor */ { .name = "hypervisor", -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH][v3] powerpc/mpc85xx: Add FMan platform support
From: Igal Liberman Get the FMan devices/sub-nodes (MAC, MDIO, etc.) auto-probed Signed-off-by: Igal Liberman --- arch/powerpc/platforms/85xx/common.c |1 + arch/powerpc/platforms/85xx/corenet_generic.c |3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c index 4a9ad87..7bfb9b1 100644 --- a/arch/powerpc/platforms/85xx/common.c +++ b/arch/powerpc/platforms/85xx/common.c @@ -40,6 +40,7 @@ static const struct of_device_id mpc85xx_common_ids[] __initconst = { { .compatible = "fsl,qoriq-pcie-v2.4", }, { .compatible = "fsl,qoriq-pcie-v2.3", }, { .compatible = "fsl,qoriq-pcie-v2.2", }, + { .compatible = "fsl,fman", }, {}, }; diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c index 63bef30..9824d2c 100644 --- a/arch/powerpc/platforms/85xx/corenet_generic.c +++ b/arch/powerpc/platforms/85xx/corenet_generic.c @@ -117,6 +117,9 @@ static const struct of_device_id of_device_ids[] = { { .compatible = "fsl,qe", }, + { + .compatible= "fsl,fman", + }, /* The following two are for the Freescale hypervisor */ { .name = "hypervisor", -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/fsl-booke: Add T4080 SVR value
From: Madalin Bucur Signed-off-by: Madalin Bucur --- arch/powerpc/include/asm/mpc85xx.h |1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/mpc85xx.h b/arch/powerpc/include/asm/mpc85xx.h index 3bef74a..213f3a8 100644 --- a/arch/powerpc/include/asm/mpc85xx.h +++ b/arch/powerpc/include/asm/mpc85xx.h @@ -61,6 +61,7 @@ #define SVR_T4240 0x824000 #define SVR_T4120 0x824001 #define SVR_T4160 0x824100 +#define SVR_T4080 0x824102 #define SVR_C291 0x85 #define SVR_C292 0x850020 #define SVR_C293 0x850030 -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[v2,00/11] Freescale DPAA FMan FLIB(s)
From: Igal Liberman The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which enables the Ethernet network interfaces. This patch presents the FMan Foundation Libraries (FLIB) headers. The FMan FLIB adds basic support for the DPAA FMan hardware register access. Igal Liberman (7): soc/fman: Add the FMan FLIB headers soc/fman: Add the FMan FLIB soc/fman: Add the FMan port FLIB soc/fman: Add the FMan MAC FLIB soc/fman: Add the FMan parser and KeyGen FLIB(s) soc/fman: Add the FMan RTC FLIB soc/fman: Add the FMan SP FLIB Madalin Bucur (4): soc/fman: Add the FMan port FLIB headers soc/fman: Add the FMan MAC FLIB headers soc/fman: Add the FMan parser and KeyGen FLIB headers soc/fman: Add the FMan RTC FLIB header drivers/soc/Kconfig|1 + drivers/soc/Makefile |1 + drivers/soc/fsl/Kconfig|1 + drivers/soc/fsl/Makefile |1 + drivers/soc/fsl/fman/Kconfig | 35 + drivers/soc/fsl/fman/Makefile | 11 + drivers/soc/fsl/fman/flib/common/general.h | 41 + drivers/soc/fsl/fman/flib/fman_common.h| 73 + drivers/soc/fsl/fman/flib/fsl_enet.h | 275 drivers/soc/fsl/fman/flib/fsl_fman.h | 802 ++ drivers/soc/fsl/fman/flib/fsl_fman_dtsec.h | 1016 + drivers/soc/fsl/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 ++ drivers/soc/fsl/fman/flib/fsl_fman_kg.h| 505 +++ drivers/soc/fsl/fman/flib/fsl_fman_memac.h | 494 +++ drivers/soc/fsl/fman/flib/fsl_fman_memac_mii_acc.h | 76 + drivers/soc/fsl/fman/flib/fsl_fman_port.h | 601 drivers/soc/fsl/fman/flib/fsl_fman_prs.h | 106 ++ drivers/soc/fsl/fman/flib/fsl_fman_rtc.h | 414 ++ drivers/soc/fsl/fman/flib/fsl_fman_sp.h| 132 ++ drivers/soc/fsl/fman/flib/fsl_fman_tgec.h | 483 ++ drivers/soc/fsl/fman/fman.c| 1355 + drivers/soc/fsl/fman/mac/Makefile |5 + drivers/soc/fsl/fman/mac/fman_crc32.c | 116 ++ drivers/soc/fsl/fman/mac/fman_crc32.h | 39 + drivers/soc/fsl/fman/mac/fman_dtsec.c | 838 +++ drivers/soc/fsl/fman/mac/fman_dtsec_mii_acc.c | 168 +++ drivers/soc/fsl/fman/mac/fman_memac.c | 510 +++ drivers/soc/fsl/fman/mac/fman_memac_mii_acc.c | 217 +++ drivers/soc/fsl/fman/mac/fman_tgec.c | 371 + drivers/soc/fsl/fman/pcd/Makefile |3 + drivers/soc/fsl/fman/pcd/fman_kg.c | 849 +++ drivers/soc/fsl/fman/pcd/fman_prs.c| 126 ++ drivers/soc/fsl/fman/port/Makefile |3 + drivers/soc/fsl/fman/port/fman_port.c | 1535 drivers/soc/fsl/fman/rtc/Makefile |3 + drivers/soc/fsl/fman/rtc/fman_rtc.c| 353 + drivers/soc/fsl/fman/sp/Makefile |3 + drivers/soc/fsl/fman/sp/fman_sp.c | 203 +++ 38 files changed, 11868 insertions(+) create mode 100644 drivers/soc/fsl/Kconfig create mode 100644 drivers/soc/fsl/Makefile create mode 100644 drivers/soc/fsl/fman/Kconfig create mode 100644 drivers/soc/fsl/fman/Makefile create mode 100644 drivers/soc/fsl/fman/flib/common/general.h create mode 100644 drivers/soc/fsl/fman/flib/fman_common.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_enet.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_dtsec.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_dtsec_mii_acc.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_kg.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_memac.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_memac_mii_acc.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_port.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_prs.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_rtc.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_sp.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_tgec.h create mode 100644 drivers/soc/fsl/fman/fman.c create mode 100644 drivers/soc/fsl/fman/mac/Makefile create mode 100644 drivers/soc/fsl/fman/mac/fman_crc32.c create mode 100644 drivers/soc/fsl/fman/mac/fman_crc32.h create mode 100644 drivers/soc/fsl/fman/mac/fman_dtsec.c create mode 100644 drivers/soc/fsl/fman/mac/fman_dtsec_mii_acc.c create mode 100644 drivers/soc/fsl/fman/mac/fman_memac.c create
[v2,01/11] soc/fman: Add the FMan FLIB headers
From: Igal Liberman The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which enables the Ethernet network interfaces. This patch presents the FMan Foundation Libraries (FLIB) headers. The FMan FLIB adds basic support for the DPAA FMan hardware register access. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/flib/common/general.h | 41 ++ drivers/soc/fsl/fman/flib/fsl_fman.h | 802 2 files changed, 843 insertions(+) create mode 100644 drivers/soc/fsl/fman/flib/common/general.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman.h diff --git a/drivers/soc/fsl/fman/flib/common/general.h b/drivers/soc/fsl/fman/flib/common/general.h new file mode 100644 index 000..0501f01 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/common/general.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __GENERAL_H +#define __GENERAL_H + +#include +#include + +#define iowrite32be(val, addr) out_be32(&(*addr), val) +#define ioread32be(addr) in_be32(&(*addr)) + +#endif /* __GENERAL_H */ diff --git a/drivers/soc/fsl/fman/flib/fsl_fman.h b/drivers/soc/fsl/fman/flib/fsl_fman.h new file mode 100644 index 000..a7ac707 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fsl_fman.h @@ -0,0 +1,802 @@ +/* + * Copyright 2008 - 2015 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 INTER
[v2,02/11] soc/fman: Add the FMan FLIB
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/Kconfig |1 + drivers/soc/Makefile |1 + drivers/soc/fsl/Kconfig |1 + drivers/soc/fsl/Makefile |1 + drivers/soc/fsl/fman/Kconfig |7 + drivers/soc/fsl/fman/Makefile |5 + drivers/soc/fsl/fman/fman.c | 1355 + 7 files changed, 1371 insertions(+) create mode 100644 drivers/soc/fsl/Kconfig create mode 100644 drivers/soc/fsl/Makefile create mode 100644 drivers/soc/fsl/fman/Kconfig create mode 100644 drivers/soc/fsl/fman/Makefile create mode 100644 drivers/soc/fsl/fman/fman.c diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index 76d6bd4..674a6e6 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -1,5 +1,6 @@ menu "SOC (System On Chip) specific Drivers" +source "drivers/soc/fsl/Kconfig" source "drivers/soc/qcom/Kconfig" source "drivers/soc/ti/Kconfig" source "drivers/soc/versatile/Kconfig" diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index 063113d..42836ee 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -2,6 +2,7 @@ # Makefile for the Linux Kernel SOC specific device drivers. # +obj-$(CONFIG_FSL_SOC) += fsl/ obj-$(CONFIG_ARCH_QCOM)+= qcom/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-$(CONFIG_SOC_TI) += ti/ diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig new file mode 100644 index 000..38c08ae --- /dev/null +++ b/drivers/soc/fsl/Kconfig @@ -0,0 +1 @@ +source "drivers/soc/fsl/fman/Kconfig" diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile new file mode 100644 index 000..20ab5d0 --- /dev/null +++ b/drivers/soc/fsl/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_FSL_FMAN) += fman/ diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig new file mode 100644 index 000..6e8b0a6 --- /dev/null +++ b/drivers/soc/fsl/fman/Kconfig @@ -0,0 +1,7 @@ +menuconfig FSL_FMAN + bool "Freescale DPAA Frame Manager" + depends on FSL_SOC || COMPILE_TEST + default n + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile new file mode 100644 index 000..e7a0575 --- /dev/null +++ b/drivers/soc/fsl/fman/Makefile @@ -0,0 +1,5 @@ +subdir-ccflags-$(CONFIG_FSL_FMAN) += -I$(srctree)/drivers/soc/fsl/fman/flib + +obj-$(CONFIG_FSL_FMAN) += fsl_fman.o + +fsl_fman-objs := fman.o diff --git a/drivers/soc/fsl/fman/fman.c b/drivers/soc/fsl/fman/fman.c new file mode 100644 index 000..138b2da --- /dev/null +++ b/drivers/soc/fsl/fman/fman.c @@ -0,0 +1,1355 @@ +/* + * Copyright 2008 - 2015 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_fman.h" + +uint32_t fman_get_bmi_err_event(struct fman_bmi_regs __iomem *bmi_rg) +{ + uint32_t event, mask, force; + + event = ioread32be(&bmi_rg->fmbm_ievr); + mask = ioread32be(&bmi_rg->fmbm_ier); + event &= mask; + /* clear the forced
[v2,03/11] soc/fman: Add the FMan port FLIB headers
From: Madalin Bucur --- drivers/soc/fsl/fman/flib/fman_common.h | 73 drivers/soc/fsl/fman/flib/fsl_fman_port.h | 601 + drivers/soc/fsl/fman/flib/fsl_fman_sp.h | 132 +++ 3 files changed, 806 insertions(+) create mode 100644 drivers/soc/fsl/fman/flib/fman_common.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_port.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_sp.h diff --git a/drivers/soc/fsl/fman/flib/fman_common.h b/drivers/soc/fsl/fman/flib/fman_common.h new file mode 100644 index 000..e186ed9 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fman_common.h @@ -0,0 +1,73 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FMAN_COMMON_H +#define __FMAN_COMMON_H + +/* NIA Description */ +#define NIA_ORDER_RESTOR 0x0080 +#define NIA_ENG_FM_CTL 0x +#define NIA_ENG_PRS0x0044 +#define NIA_ENG_KG 0x0048 +#define NIA_ENG_PLCR 0x004C +#define NIA_ENG_BMI0x0050 +#define NIA_ENG_QMI_ENQ0x0054 +#define NIA_ENG_QMI_DEQ0x0058 +#define NIA_ENG_MASK 0x007C + +#define NIA_FM_CTL_AC_CC 0x0006 +#define NIA_FM_CTL_AC_HC 0x000C +#define NIA_FM_CTL_AC_IND_MODE_TX 0x0008 +#define NIA_FM_CTL_AC_IND_MODE_RX 0x000A +#define NIA_FM_CTL_AC_FRAG 0x000e +#define NIA_FM_CTL_AC_PRE_FETCH0x0010 +#define NIA_FM_CTL_AC_POST_FETCH_PCD 0x0012 +#define NIA_FM_CTL_AC_POST_FETCH_PCD_UDP_LEN 0x0018 +#define NIA_FM_CTL_AC_POST_FETCH_NO_PCD0x0012 +#define NIA_FM_CTL_AC_FRAG_CHECK 0x0014 +#define NIA_FM_CTL_AC_PRE_CC 0x0020 + +#define NIA_BMI_AC_ENQ_FRAME 0x0002 +#define NIA_BMI_AC_TX_RELEASE 0x02C0 +#define NIA_BMI_AC_RELEASE 0x00C0 +#define NIA_BMI_AC_DISCARD 0x00C1 +#define NIA_BMI_AC_TX 0x0274 +#define NIA_BMI_AC_FETCH 0x0208 +#define NIA_BMI_AC_MASK0x03FF + +#define NIA_KG_DIRECT 0x0100 +#define NIA_KG_CC_EN 0x0200 +#define NIA_PLCR_ABSOLUTE 0x8000 + +#define NIA_BMI_AC_ENQ_FRAME_WITHOUT_DMA 0x0202 +#define NIA_BMI_AC_FETCH_ALL_FRAME 0x020c + +#endif /* __FMAN_COMMON_H */ diff --git a/drivers/soc/fsl/fman/flib/fsl_fman_port.h b/drivers/soc/fsl/fman/flib/fsl_fman_port.h new file mode 100644 index 000..770a2e1 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fsl_fman_port.h @@ -0,0 +1,601 @@ +/* + * Copyright 2008 - 2015 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
[v2,04/11] soc/fman: Add the FMan port FLIB
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Kconfig | 10 + drivers/soc/fsl/fman/Makefile |2 + drivers/soc/fsl/fman/port/Makefile|3 + drivers/soc/fsl/fman/port/fman_port.c | 1535 + 4 files changed, 1550 insertions(+) create mode 100644 drivers/soc/fsl/fman/port/Makefile create mode 100644 drivers/soc/fsl/fman/port/fman_port.c diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig index 6e8b0a6..b4c98ef 100644 --- a/drivers/soc/fsl/fman/Kconfig +++ b/drivers/soc/fsl/fman/Kconfig @@ -5,3 +5,13 @@ menuconfig FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + +if FSL_FMAN + +config FSL_FMAN_PORT + bool "FMan port" + default n + help + Freescale DPAA FMan port support + +endif # FSL_FMAN diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index e7a0575..437a325 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -3,3 +3,5 @@ subdir-ccflags-$(CONFIG_FSL_FMAN) += -I$(srctree)/drivers/soc/fsl/fman/flib obj-$(CONFIG_FSL_FMAN) += fsl_fman.o fsl_fman-objs := fman.o + +obj-$(CONFIG_FSL_FMAN_PORT)+= port/ diff --git a/drivers/soc/fsl/fman/port/Makefile b/drivers/soc/fsl/fman/port/Makefile new file mode 100644 index 000..0062fed --- /dev/null +++ b/drivers/soc/fsl/fman/port/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_FSL_FMAN_PORT)+= fsl_fman_port.o + +fsl_fman_port-objs := fman_port.o diff --git a/drivers/soc/fsl/fman/port/fman_port.c b/drivers/soc/fsl/fman/port/fman_port.c new file mode 100644 index 000..cc05dc0 --- /dev/null +++ b/drivers/soc/fsl/fman/port/fman_port.c @@ -0,0 +1,1535 @@ +/* + * Copyright 2008 - 2015 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 "common/general.h" + +#include "fman_common.h" +#include "fsl_fman_port.h" + +/* problem Eyal: the following should not be here*/ +#define NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME 0x0028 + +static uint32_t get_no_pcd_nia_bmi_ac_enc_frame(struct fman_port_cfg *cfg) +{ + if (cfg->errata_A006675) + return NIA_ENG_FM_CTL | + NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME; + else + return NIA_ENG_BMI | NIA_BMI_AC_ENQ_FRAME; +} + +static int init_bmi_rx(struct fman_port *port, + struct fman_port_cfg *cfg, + struct fman_port_params *params) +{ + struct fman_port_rx_bmi_regs __iomem *regs = &port->bmi_regs->rx; + uint32_t tmp; + + /* Rx Configuration register */ + tmp = 0; + if (cfg->discard_override) + tmp |= BMI_PORT_CFG_FDOVR; + iowrite32be(tmp, ®s->fmbm_rcfg); + + /* DMA attributes */ + tmp = (uint32_t)cfg->dma_swap_data << BMI_DMA_ATTR_SWP_SHIFT; + if (cfg->dma_ic_stash_on) + tmp |= BMI_DMA_ATTR_IC_STASH_ON; + if (cfg->dma_header_stash_on) + tmp |= BMI_DMA_ATTR_HDR_STASH_ON; + if (cfg->dma_
[v2,06/11] soc/fman: Add the FMan MAC FLIB
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Kconfig |6 + drivers/soc/fsl/fman/Makefile |1 + drivers/soc/fsl/fman/mac/Makefile |5 + drivers/soc/fsl/fman/mac/fman_crc32.c | 116 drivers/soc/fsl/fman/mac/fman_crc32.h | 39 ++ drivers/soc/fsl/fman/mac/fman_dtsec.c | 838 + drivers/soc/fsl/fman/mac/fman_dtsec_mii_acc.c | 168 + drivers/soc/fsl/fman/mac/fman_memac.c | 510 +++ drivers/soc/fsl/fman/mac/fman_memac_mii_acc.c | 217 +++ drivers/soc/fsl/fman/mac/fman_tgec.c | 371 +++ 10 files changed, 2271 insertions(+) create mode 100644 drivers/soc/fsl/fman/mac/Makefile create mode 100644 drivers/soc/fsl/fman/mac/fman_crc32.c create mode 100644 drivers/soc/fsl/fman/mac/fman_crc32.h create mode 100644 drivers/soc/fsl/fman/mac/fman_dtsec.c create mode 100644 drivers/soc/fsl/fman/mac/fman_dtsec_mii_acc.c create mode 100644 drivers/soc/fsl/fman/mac/fman_memac.c create mode 100644 drivers/soc/fsl/fman/mac/fman_memac_mii_acc.c create mode 100644 drivers/soc/fsl/fman/mac/fman_tgec.c diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig index b4c98ef..7489ff6 100644 --- a/drivers/soc/fsl/fman/Kconfig +++ b/drivers/soc/fsl/fman/Kconfig @@ -14,4 +14,10 @@ config FSL_FMAN_PORT help Freescale DPAA FMan port support +config FSL_FMAN_MAC + bool "FMan MAC" + default n + help + Freescale DPAA FMan MAC support + endif # FSL_FMAN diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index 437a325..a0f396f 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_FSL_FMAN) += fsl_fman.o fsl_fman-objs := fman.o obj-$(CONFIG_FSL_FMAN_PORT)+= port/ +obj-$(CONFIG_FSL_FMAN_MAC) += mac/ diff --git a/drivers/soc/fsl/fman/mac/Makefile b/drivers/soc/fsl/fman/mac/Makefile new file mode 100644 index 000..80b7048 --- /dev/null +++ b/drivers/soc/fsl/fman/mac/Makefile @@ -0,0 +1,5 @@ +obj-$(CONFIG_FSL_FMAN_MAC) += fsl_fman_mac.o + +fsl_fman_mac-objs := fman_dtsec.o fman_dtsec_mii_acc.o\ + fman_memac.o fman_tgec.o \ + fman_crc32.o fman_memac_mii_acc.o diff --git a/drivers/soc/fsl/fman/mac/fman_crc32.c b/drivers/soc/fsl/fman/mac/fman_crc32.c new file mode 100644 index 000..1536d12 --- /dev/null +++ b/drivers/soc/fsl/fman/mac/fman_crc32.c @@ -0,0 +1,116 @@ +/* + * Copyright 2008 - 2015 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 "fman_crc32.h" +#include "common/general.h" + +/* precomputed CRC values for address hashing */ +static const uint32_t crc_tbl[256] = { + 0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4
[v2,07/11] soc/fman: Add the FMan parser and KeyGen FLIB headers
From: Madalin Bucur --- drivers/soc/fsl/fman/flib/fsl_fman_kg.h | 505 ++ drivers/soc/fsl/fman/flib/fsl_fman_prs.h | 106 +++ 2 files changed, 611 insertions(+) create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_kg.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_prs.h diff --git a/drivers/soc/fsl/fman/flib/fsl_fman_kg.h b/drivers/soc/fsl/fman/flib/fsl_fman_kg.h new file mode 100644 index 000..782a50b --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fsl_fman_kg.h @@ -0,0 +1,505 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FSL_FMAN_KG_H +#define __FSL_FMAN_KG_H + +#include "common/general.h" + +#define FM_KG_NUM_OF_GENERIC_REGS 8 /* Num of generic KeyGen regs */ +#define FMAN_MAX_NUM_OF_HW_PORTS 64 +/* Total num of masks allowed on KG extractions */ +#define FM_KG_EXTRACT_MASKS_NUM4 +#define FM_KG_NUM_CLS_PLAN_ENTR8 /* Num of class. plan regs */ +#define FM_KG_CLS_PLAN_GRPS_NUM32 /* Max num of class. groups */ + +struct fman_kg_regs { + uint32_t fmkg_gcr; + uint32_t res004; + uint32_t res008; + uint32_t fmkg_eer; + uint32_t fmkg_eeer; + uint32_t res014; + uint32_t res018; + uint32_t fmkg_seer; + uint32_t fmkg_seeer; + uint32_t fmkg_gsr; + uint32_t fmkg_tpc; + uint32_t fmkg_serc; + uint32_t res030[4]; + uint32_t fmkg_fdor; + uint32_t fmkg_gdv0r; + uint32_t fmkg_gdv1r; + uint32_t res04c[6]; + uint32_t fmkg_feer; + uint32_t res068[38]; + uint32_t fmkg_indirect[63]; + uint32_t fmkg_ar; +}; + +struct fman_kg_scheme_regs { + uint32_t kgse_mode; /* MODE */ + uint32_t kgse_ekfc; /* Extract Known Fields Command */ + uint32_t kgse_ekdv; /* Extract Known Default Value */ + uint32_t kgse_bmch; /* Bit Mask Command High */ + uint32_t kgse_bmcl; /* Bit Mask Command Low */ + uint32_t kgse_fqb; /* Frame Queue Base */ + uint32_t kgse_hc; /* Hash Command */ + uint32_t kgse_ppc; /* Policer Profile Command */ + uint32_t kgse_gec[FM_KG_NUM_OF_GENERIC_REGS]; + /* Generic Extract Command */ + uint32_t kgse_spc; /* KeyGen Scheme Entry Statistic Packet Counter */ + uint32_t kgse_dv0; /* KeyGen Scheme Entry Default Value 0 */ + uint32_t kgse_dv1; /* KeyGen Scheme Entry Default Value 1 */ + uint32_t kgse_ccbs; /* KeyGen Scheme Entry Coarse Classification Bit*/ + uint32_t kgse_mv; /* KeyGen Scheme Entry Match vector */ + uint32_t kgse_om; /* KeyGen Scheme Entry Operation Mode bits */ + uint32_t kgse_vsp; /* KeyGen Scheme Entry Virtual Storage Profile */ +}; + +struct fman_kg_pe_regs { + uint32_t fmkg_pe_sp; + uint32_t fmkg_pe_cpp; +}; + +struct fman_kg_cp_regs { + uint32_t kgcpe[FM_KG_NUM_CLS_PLAN_ENTR]; +}; + +#define FM_KG_KGAR_GO 0x8000 +#define FM_KG_KGAR_READ0x4000 +#define FM_KG_KGAR_WRITE 0x +#define FM_KG_KGAR_SEL_SCHEME_ENTRY0x +#define FM_KG_KGAR_SCM_WSEL_UPDATE_CNT
[v2,09/11] soc/fman: Add the FMan RTC FLIB header
From: Madalin Bucur --- drivers/soc/fsl/fman/flib/fsl_fman_rtc.h | 414 ++ 1 file changed, 414 insertions(+) create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_rtc.h diff --git a/drivers/soc/fsl/fman/flib/fsl_fman_rtc.h b/drivers/soc/fsl/fman/flib/fsl_fman_rtc.h new file mode 100644 index 000..a084b11 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fsl_fman_rtc.h @@ -0,0 +1,414 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FSL_FMAN_RTC_H +#define __FSL_FMAN_RTC_H + +#include "common/general.h" + +/* FM RTC Registers definitions */ +#define FMAN_RTC_TMR_CTRL_ALMP1 0x8000 +#define FMAN_RTC_TMR_CTRL_ALMP2 0x4000 +#define FMAN_RTC_TMR_CTRL_FS0x1000 +#define FMAN_RTC_TMR_CTRL_PP1L 0x0800 +#define FMAN_RTC_TMR_CTRL_PP2L 0x0400 +#define FMAN_RTC_TMR_CTRL_TCLK_PERIOD_MASK 0x03FF +#define FMAN_RTC_TMR_CTRL_FRD 0x4000 +#define FMAN_RTC_TMR_CTRL_SLV 0x2000 +#define FMAN_RTC_TMR_CTRL_ETEP1 0x0100 +#define FMAN_RTC_TMR_CTRL_COPH 0x0080 +#define FMAN_RTC_TMR_CTRL_CIPH 0x0040 +#define FMAN_RTC_TMR_CTRL_TMSR 0x0020 +#define FMAN_RTC_TMR_CTRL_DBG 0x0010 +#define FMAN_RTC_TMR_CTRL_BYP 0x0008 +#define FMAN_RTC_TMR_CTRL_TE0x0004 +#define FMAN_RTC_TMR_CTRL_CKSEL_OSC_CLK 0x0003 +#define FMAN_RTC_TMR_CTRL_CKSEL_MAC_CLK 0x0001 +#define FMAN_RTC_TMR_CTRL_CKSEL_EXT_CLK 0x +#define FMAN_RTC_TMR_CTRL_TCLK_PERIOD_SHIFT 16 + +#define FMAN_RTC_TMR_TEVENT_ETS20x0200 +#define FMAN_RTC_TMR_TEVENT_ETS10x0100 +#define FMAN_RTC_TMR_TEVENT_ALM20x0002 +#define FMAN_RTC_TMR_TEVENT_ALM10x0001 +#define FMAN_RTC_TMR_TEVENT_PP1 0x0080 +#define FMAN_RTC_TMR_TEVENT_PP2 0x0040 +#define FMAN_RTC_TMR_TEVENT_PP3 0x0020 +#define FMAN_RTC_TMR_TEVENT_ALL (FMAN_RTC_TMR_TEVENT_ETS2 |\ + FMAN_RTC_TMR_TEVENT_ETS1 |\ + FMAN_RTC_TMR_TEVENT_ALM2 |\ + FMAN_RTC_TMR_TEVENT_ALM1 |\ + FMAN_RTC_TMR_TEVENT_PP1 |\ + FMAN_RTC_TMR_TEVENT_PP2 |\ + FMAN_RTC_TMR_TEVENT_PP3) + +#define FMAN_RTC_TMR_PRSC_OCK_MASK 0x + +/* FM RTC Alarm Polarity Options. */ +enum fman_rtc_alarm_polarity { + FMAN_RTC_ALARM_POLARITY_ACTIVE_HIGH, + /* Active-high output polarity */ + FMAN_RTC_ALARM_POLARITY_ACTIVE_LOW/* Active-low output polarity */ +}; + +/* FM RTC Trigger Polarity Options. */ +enum fman_rtc_trigger_polarity { + FMAN_RTC_TRIGGER_ON_RISING_EDGE,/* T
[v2,10/11] soc/fman: Add the FMan RTC FLIB
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Kconfig|6 + drivers/soc/fsl/fman/Makefile |1 + drivers/soc/fsl/fman/rtc/Makefile |3 + drivers/soc/fsl/fman/rtc/fman_rtc.c | 353 +++ 4 files changed, 363 insertions(+) create mode 100644 drivers/soc/fsl/fman/rtc/Makefile create mode 100644 drivers/soc/fsl/fman/rtc/fman_rtc.c diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig index f057b15..4a9f672 100644 --- a/drivers/soc/fsl/fman/Kconfig +++ b/drivers/soc/fsl/fman/Kconfig @@ -26,4 +26,10 @@ config FSL_FMAN_PCD help Freescale DPAA FMan Parse, Classify and Distribute support +config FSL_FMAN_RTC + bool "FMan RTC" + default n + help + Freescale DPAA FMan Real Time Clock (PTP) support + endif # FSL_FMAN diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index 2bb0e13..487f221 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -7,3 +7,4 @@ fsl_fman-objs := fman.o obj-$(CONFIG_FSL_FMAN_PORT)+= port/ obj-$(CONFIG_FSL_FMAN_MAC) += mac/ obj-$(CONFIG_FSL_FMAN_PCD) += pcd/ +obj-$(CONFIG_FSL_FMAN_RTC) += rtc/ diff --git a/drivers/soc/fsl/fman/rtc/Makefile b/drivers/soc/fsl/fman/rtc/Makefile new file mode 100644 index 000..c8b4477 --- /dev/null +++ b/drivers/soc/fsl/fman/rtc/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_FSL_FMAN_RTC) += fsl_fman_rtc.o + +fsl_fman_rtc-objs := fman_rtc.o diff --git a/drivers/soc/fsl/fman/rtc/fman_rtc.c b/drivers/soc/fsl/fman/rtc/fman_rtc.c new file mode 100644 index 000..7f287cc --- /dev/null +++ b/drivers/soc/fsl/fman/rtc/fman_rtc.c @@ -0,0 +1,353 @@ +/* + * Copyright 2008 - 2015 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_fman_rtc.h" + +void fman_rtc_defconfig(struct rtc_cfg *cfg) +{ + int i; + + cfg->src_clk = DEFAULT_SRC_CLOCK; + cfg->invert_input_clk_phase = DEFAULT_INVERT_INPUT_CLK_PHASE; + cfg->invert_output_clk_phase = DEFAULT_INVERT_OUTPUT_CLK_PHASE; + cfg->pulse_realign = DEFAULT_PULSE_REALIGN; + for (i = 0; i < FMAN_RTC_MAX_NUM_OF_ALARMS; i++) + cfg->alarm_polarity[i] = DEFAULT_ALARM_POLARITY; + for (i = 0; i < FMAN_RTC_MAX_NUM_OF_EXT_TRIGGERS; i++) + cfg->trigger_polarity[i] = DEFAULT_TRIGGER_POLARITY; +} + +uint32_t fman_rtc_get_events(struct rtc_regs __iomem *regs) +{ + return ioread32be(®s->tmr_tevent); +} + +uint32_t fman_rtc_get_event(struct rtc_regs __iomem *regs, uint32_t ev_mask) +{ + return ioread32be(®s->tmr_tevent) & ev_mask; +} + +uint32_t fman_rtc_get_interrupt_mask(struct rtc_regs __iomem *regs) +{ + return ioread32be(®s->tmr_temask); +} + +void fman_rtc_set_interrupt_mask(struct rtc_regs __iomem *regs, uint32_t mask) +{ + iowrite32be(mask, ®s->tmr_temask); +} + +void fman_rtc_ack_event(struct rtc_regs __iomem *regs, uint32_t events) +{ + iowrite32be(events, ®s->tmr_tevent); +} + +uint32_t fman_rtc_check_and_clear_event(struct rtc_regs __iomem *regs) +{
[v2,11/11] soc/fman: Add the FMan SP FLIB
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Makefile |1 + drivers/soc/fsl/fman/sp/Makefile |3 + drivers/soc/fsl/fman/sp/fman_sp.c | 203 + 3 files changed, 207 insertions(+) create mode 100644 drivers/soc/fsl/fman/sp/Makefile create mode 100644 drivers/soc/fsl/fman/sp/fman_sp.c diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index 487f221..b5ea613 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -8,3 +8,4 @@ obj-$(CONFIG_FSL_FMAN_PORT) += port/ obj-$(CONFIG_FSL_FMAN_MAC) += mac/ obj-$(CONFIG_FSL_FMAN_PCD) += pcd/ obj-$(CONFIG_FSL_FMAN_RTC) += rtc/ +obj-$(CONFIG_FSL_FMAN) += sp/ diff --git a/drivers/soc/fsl/fman/sp/Makefile b/drivers/soc/fsl/fman/sp/Makefile new file mode 100644 index 000..97e89c9 --- /dev/null +++ b/drivers/soc/fsl/fman/sp/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_FSL_FMAN) += fsl_fman_sp.o + +fsl_fman_sp-objs := fman_sp.o diff --git a/drivers/soc/fsl/fman/sp/fman_sp.c b/drivers/soc/fsl/fman/sp/fman_sp.c new file mode 100644 index 000..02e82c6 --- /dev/null +++ b/drivers/soc/fsl/fman/sp/fman_sp.c @@ -0,0 +1,203 @@ +/* + * Copyright 2008 - 2015 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_fman_sp.h" + +uint32_t fman_vsp_get_statistics(struct fm_pcd_storage_profile_regs *regs, +uint16_t index) +{ + struct fm_pcd_storage_profile_regs *sp_regs; + + sp_regs = ®s[index]; + return ioread32be(&sp_regs->fm_sp_acnt); +} + +void fman_vsp_set_statistics(struct fm_pcd_storage_profile_regs *regs, +uint16_t index, uint32_t value) +{ + struct fm_pcd_storage_profile_regs *sp_regs; + + sp_regs = ®s[index]; + iowrite32be(value, &sp_regs->fm_sp_acnt); +} + +void fman_vsp_defconfig(struct fm_storage_profile_params *cfg) +{ + cfg->dma_swap_data = DEFAULT_FMAN_SP_DMA_SWAP_DATA; + cfg->int_context_cache_attr = + DEFAULT_FMAN_SP_DMA_INT_CONTEXT_CACHE_ATTR; + cfg->header_cache_attr = DEFAULT_FMAN_SP_DMA_HEADER_CACHE_ATTR; + cfg->scatter_gather_cache_attr = + DEFAULT_FMAN_SP_DMA_SCATTER_GATHER_CACHE_ATTR; + cfg->dma_write_optimize = DEFAULT_FMAN_SP_DMA_WRITE_OPTIMIZE; + cfg->no_scather_gather = DEFAULT_FMAN_SP_NO_SCATTER_GATHER; +} + +static inline uint32_t calc_vec_dep(int max_pools, bool *pools, + struct fman_ext_pools *ext_buf_pools, + uint32_t mask) +{ + int i, j; + uint32_t vector = 0; + + for (i = 0; i < max_pools; i++) + if (pools[i]) + for (j = 0; j < ext_buf_pools->num_pools_used; j++) + if (i == ext_buf_pools->ext_buf_pool[j].id) { + vector |= mask >> j; + break; + } + return vector; +} + +void fman_vsp_init(struct fm_pcd_storage_profile_regs *regs, + uint16_t index, +
[RFC,1/8] soc/fman: Add FMan MURAM support
From: Igal Liberman Add Frame Manager Multi-User RAM support. Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Kconfig|1 + drivers/soc/fsl/fman/Makefile |5 +- drivers/soc/fsl/fman/fm_muram.c | 174 +++ drivers/soc/fsl/fman/inc/fm_muram_ext.h | 98 + 4 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 drivers/soc/fsl/fman/fm_muram.c create mode 100644 drivers/soc/fsl/fman/inc/fm_muram_ext.h diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig index 4a9f672..92593b7 100644 --- a/drivers/soc/fsl/fman/Kconfig +++ b/drivers/soc/fsl/fman/Kconfig @@ -1,6 +1,7 @@ menuconfig FSL_FMAN bool "Freescale DPAA Frame Manager" depends on FSL_SOC || COMPILE_TEST + select PPC_LIB_RHEAP default n help Freescale Data-Path Acceleration Architecture Frame Manager diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index b5ea613..89a84a7 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -1,8 +1,9 @@ -subdir-ccflags-$(CONFIG_FSL_FMAN) += -I$(srctree)/drivers/soc/fsl/fman/flib +subdir-ccflags-$(CONFIG_FSL_FMAN) += -I$(srctree)/drivers/soc/fsl/fman/flib \ +-I$(srctree)/drivers/soc/fsl/fman/inc obj-$(CONFIG_FSL_FMAN) += fsl_fman.o -fsl_fman-objs := fman.o +fsl_fman-objs := fman.o fm_muram.o obj-$(CONFIG_FSL_FMAN_PORT)+= port/ obj-$(CONFIG_FSL_FMAN_MAC) += mac/ diff --git a/drivers/soc/fsl/fman/fm_muram.c b/drivers/soc/fsl/fman/fm_muram.c new file mode 100644 index 000..2a67a2e --- /dev/null +++ b/drivers/soc/fsl/fman/fm_muram.c @@ -0,0 +1,174 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM MURAM ... */ +#include "fm_muram_ext.h" + +#include +#include +#include + +struct muram_info { + rh_block_t fm_boot_muram_rh_block[16]; + rh_info_t *fm_muram_info; + void __iomem *fm_muram_vbase; + /* Spinlock for MURAM accesses */ + spinlock_t fm_muram_lock; + uint64_tsize; +}; + +static void __iomem *fm_muram_addr(struct muram_info *p_muram, + unsigned long offset) +{ + return p_muram->fm_muram_vbase + offset; +} + +static unsigned long fm_muram_offset(struct muram_info *p_muram, +void __iomem *addr) +{ + return addr - p_muram->fm_muram_vbase; +} + +void fm_muram_clear(struct muram_info *p_muram) +{ + memset_io(p_muram->fm_muram_vbase, 0, p_muram->size); +} + +struct muram_info *fm_muram_init(phys_addr_t base_address, uint64_t size) +{ + int ret; + struct muram_info *p_muram; + + p_muram = kzalloc(sizeof(*p_muram), GFP_KERNEL); + if (!p_muram) + return NULL; + /* Create remote heap */ + p_muram->fm_muram_info = rh_create(sizeof(unsigned int)); + + /* Spinlock for MURAM accesses */ + spin_lock_init(&p_muram->fm_muram_lock); + + /* Initialize the info header */ + rh_
[RFC,4/8] soc/fman: Add FMan Parser and Keygen support
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/fm.c | 38 +++ drivers/soc/fsl/fman/fm.h |1 + drivers/soc/fsl/fman/fm_common.h | 32 +++ drivers/soc/fsl/fman/fm_drv.c | 89 ++- drivers/soc/fsl/fman/fm_drv.h | 18 ++ drivers/soc/fsl/fman/inc/fm_pcd_ext.h | 167 + drivers/soc/fsl/fman/pcd/Makefile |2 +- drivers/soc/fsl/fman/pcd/fm_pcd.c | 428 + drivers/soc/fsl/fman/pcd/fm_pcd.h | 145 +++ drivers/soc/fsl/fman/pcd/fm_prs.c | 276 + drivers/soc/fsl/fman/pcd/fm_prs.h | 163 + 11 files changed, 1357 insertions(+), 2 deletions(-) create mode 100644 drivers/soc/fsl/fman/inc/fm_pcd_ext.h create mode 100644 drivers/soc/fsl/fman/pcd/fm_pcd.c create mode 100644 drivers/soc/fsl/fman/pcd/fm_pcd.h create mode 100644 drivers/soc/fsl/fman/pcd/fm_prs.c create mode 100644 drivers/soc/fsl/fman/pcd/fm_prs.h diff --git a/drivers/soc/fsl/fman/fm.c b/drivers/soc/fsl/fman/fm.c index 56711cb..1d32d446 100644 --- a/drivers/soc/fsl/fman/fm.c +++ b/drivers/soc/fsl/fman/fm.c @@ -721,6 +721,17 @@ uint16_t fm_get_tnum_aging_period(void *h_fm) return p_fm->tnum_aging_period; } +uintptr_t fm_get_pcd_prs_base_addr(void *h_fm) +{ + struct fm_t *p_fm = (struct fm_t *)h_fm; + + if (!p_fm->base_addr) { + pr_err("No base-addr!\n"); + return 0; + } + return p_fm->base_addr + FM_MM_PRS; +} + struct muram_info *fm_get_muram_pointer(void *h_fm) { struct fm_t *p_fm = (struct fm_t *)h_fm; @@ -847,6 +858,33 @@ void fm_unregister_fman_ctrl_intr(void *h_fm, uint8_t event_reg_id) p_fm->fman_ctrl_intr[event_reg_id].h_src_handle = NULL; } +void fm_register_pcd(void *h_fm, void *h_fm_pcd) +{ + struct fm_t *p_fm = (struct fm_t *)h_fm; + + if (p_fm->h_pcd) + pr_err("PCD already set\n"); + + p_fm->h_pcd = h_fm_pcd; +} + +void fm_unregister_pcd(void *h_fm) +{ + struct fm_t *p_fm = (struct fm_t *)h_fm; + + if (!p_fm->h_pcd) + pr_err("PCD handle!\n"); + + p_fm->h_pcd = NULL; +} + +void *fm_get_pcd_handle(void *h_fm) +{ + struct fm_t *p_fm = (struct fm_t *)h_fm; + + return p_fm->h_pcd; +} + uint8_t fm_get_id(void *h_fm) { struct fm_t *p_fm = (struct fm_t *)h_fm; diff --git a/drivers/soc/fsl/fman/fm.h b/drivers/soc/fsl/fman/fm.h index 332f2e6..eb71103 100644 --- a/drivers/soc/fsl/fman/fm.h +++ b/drivers/soc/fsl/fman/fm.h @@ -452,6 +452,7 @@ struct fm_t { uintptr_t base_addr; /* un-needed for recovery */ + void *h_pcd; char fm_module_name[MODULE_NAME_SIZE]; /* FM exceptions user callback */ struct fm_intr_src_t intr_mng[FM_EV_DUMMY_LAST]; diff --git a/drivers/soc/fsl/fman/fm_common.h b/drivers/soc/fsl/fman/fm_common.h index f380133..1e3422c 100644 --- a/drivers/soc/fsl/fman/fm_common.h +++ b/drivers/soc/fsl/fman/fm_common.h @@ -38,6 +38,7 @@ #include "service.h" #include "fm_ext.h" +#include "fm_pcd_ext.h" #define CLS_PLAN_NUM_PER_GRP8 @@ -238,6 +239,27 @@ default:\ ((cls_plan_entries == 256) ? 8 : ((cls_plan_entries == 128) ? 7 : \ ((cls_plan_entries == 64) ? 6 : ((cls_plan_entries == 32) ? 5 : 0 +struct fm_pcd_lock_t { + spinlock_t *spinlock; + volatile bool flag; + struct list_head node; +}; + +#define FM_PCD_LOCK_OBJ(ptr) list_object(ptr, struct fm_pcd_lock_t, node) + +/* Common API for FM-PCD module */ +uint32_t fm_pcd_get_sw_prs_offset(void *h_fm_pcd, enum net_header_type hdr, + uint8_t index_per_hdr); +uint32_t fm_pcd_lock(void *h_fm_pcd); +void fm_pcd_unlock(void *h_fm_pcd, unsigned long int_flags); +bool fm_pcd_lock_try_lock_all(void *h_fm_pcd); +void fm_pcd_lock_unlock_all(void *h_fm_pcd); + +/* Common API for FM-PCD parser module */ +int fm_pcd_prs_include_port_in_statistics(void *p_fm_pcd, + uint8_t port_id, + bool include); + /* Function fm_register_intr * Description Used to register * an inter-module event handler to be processed by FM @@ -276,6 +298,13 @@ enum fm_mac_type { FM_MAC_1G /* 1G MAC */ }; +/* Function fm_get_pcd_prs_base_addr + * Description Get the base address of the Parser from the FM module + * Param[in] h_fmA handle to an FM Module. + * ReturnBase address. + */ +uintptr_t fm_get_pcd_prs_base_addr(void *h_fm); + /* Function fm_get_muram_pointer * Description Get the pointer of the MURAM from the FM module * Param[in] h_fmA handle to an FM Module. @@ -335,6 +364,9 @@ int fm_set_num_of_riscs_per_port(v
[RFC,6/8] soc/fman: Add FMan SP support
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/fm_sp_common.h | 112 + drivers/soc/fsl/fman/sp/Makefile|2 +- drivers/soc/fsl/fman/sp/fm_sp.c | 429 +++ 3 files changed, 542 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/fsl/fman/fm_sp_common.h create mode 100644 drivers/soc/fsl/fman/sp/fm_sp.c diff --git a/drivers/soc/fsl/fman/fm_sp_common.h b/drivers/soc/fsl/fman/fm_sp_common.h new file mode 100644 index 000..3809c24 --- /dev/null +++ b/drivers/soc/fsl/fman/fm_sp_common.h @@ -0,0 +1,112 @@ +/* + * Copyright 2008-2015 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. + */ + +/* FM SP ... */ +#ifndef __FM_SP_COMMON_H +#define __FM_SP_COMMON_H + +#include "service.h" +#include "fm_ext.h" +#include "fm_pcd_ext.h" +#include "fsl_fman.h" + +/* defaults */ +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_DATA_SIZE 0 +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_PASS_PRS_RESULT false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_PASS_TIME_STAMP false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_ALL_OTHER_PCD_INFO false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64 + +/* structure for defining internal context copying */ +struct fm_sp_int_context_data_copy_t { + /* < Offset in External buffer to which internal +* context is copied to (Rx) or taken from (Tx, Op). +*/ + uint16_t ext_buf_offset; + /* Offset within internal context to copy from +* (Rx) or to copy to (Tx, Op). +*/ + uint8_t int_context_offset; + /* Internal offset size to be copied */ + uint16_t size; +}; + +/* struct for defining external buffer margins */ +struct fm_sp_buf_margins_t { + /* Number of bytes to be left at the beginning +* of the external buffer (must be divisible by 16) +*/ + uint16_t start_margins; + /* number of bytes to be left at the end +* of the external buffer(must be divisible by 16) +*/ + uint16_t end_margins; +}; + +struct fm_sp_buffer_offsets_t { + uint32_t data_offset; + uint32_t prs_result_offset; + uint32_t time_stamp_offset; + uint32_t hash_result_offset; + uint32_t pcd_info_offset; +}; + +int fm_sp_build_buffer_structure(struct fm_sp_int_context_data_copy_t +*p_fm_port_int_context_data_copy, +struct fm_buffer_prefix_content_t +*p_buffer_prefix_content, +struct fm_sp_buf_margins_t +*p_fm_port_buf_margins, +struct fm_sp_buffer_offsets_t +*p_fm_port_buffer_offsets, +uint8_t *internal_buf_offset); + +int fm_sp_check_int_context_params(struct fm_sp_int_context_data_copy_t * + p_fm_sp_int_context_data_copy); +int fm_sp_check_buf_pools_params(struct fm_ext_pools_t *p_fm_ext_pools, +struct fm_backup_bm
[RFC,8/8] soc/fman: Add FMan MAC driver
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Kconfig | 10 + drivers/soc/fsl/fman/inc/mac.h | 142 drivers/soc/fsl/fman/mac/Makefile |3 +- drivers/soc/fsl/fman/mac/mac-api.c | 671 drivers/soc/fsl/fman/mac/mac.c | 522 5 files changed, 1347 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/fsl/fman/inc/mac.h create mode 100644 drivers/soc/fsl/fman/mac/mac-api.c create mode 100644 drivers/soc/fsl/fman/mac/mac.c diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig index c0b989b..c9f266c 100644 --- a/drivers/soc/fsl/fman/Kconfig +++ b/drivers/soc/fsl/fman/Kconfig @@ -35,6 +35,16 @@ config FSL_FMAN_RTC if FSL_FMAN_MAC +config FMAN_MIB_CNT_OVF_IRQ_EN + bool "Enable the dTSEC MIB counters overflow interrupt" + depends on FSL_FMAN_MAC + default n + help + Enable the dTSEC MIB counters overflow interrupt to get + accurate MIB counters values. Enabled it compensates + for the counters overflow but reduces performance and + triggers error messages in HV setups. + config FMAN_PFC bool "FMan v3 PFC support (EXPERIMENTAL)" depends on FSL_FMAN_MAC diff --git a/drivers/soc/fsl/fman/inc/mac.h b/drivers/soc/fsl/fman/inc/mac.h new file mode 100644 index 000..8d2d2ee --- /dev/null +++ b/drivers/soc/fsl/fman/inc/mac.h @@ -0,0 +1,142 @@ +/* Copyright 2008-2015 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. + */ + +#ifndef __MAC_H +#define __MAC_H + +#include /* struct device, BUS_ID_SIZE */ +#include /* ETH_ALEN */ +#include /* phy_interface_t, struct phy_device */ +#include + +#include "fsl_fman_drv.h" /* struct port_device */ +#include "fm_mac_ext.h"/* FM MAC API */ + +enum {DTSEC, XGMAC, MEMAC}; + +struct mac_device { + struct device *dev; + void*priv; + u8 cell_index; + struct resource *res; + void __iomem*vaddr; + u8 addr[ETH_ALEN]; + bool promisc; + + struct fm *fm_dev; + struct fm_port *port_dev[2]; + + phy_interface_t phy_if; + u32 if_support; + bool link; + bool half_duplex; + u16 speed; + u16 max_speed; + struct device_node *phy_node; + char fixed_bus_id[MII_BUS_ID_SIZE + 3]; + struct device_node *tbi_node; + struct phy_device *phy_dev; + void*fm; + /* List of multicast addresses */ + struct list_head mc_addr_list; + struct platform_device *eth_dev; + + bool autoneg_pause; + bool rx_pause_req; + bool tx_pause_req; + bool rx_pause_active; + bool tx_pause_active; + + struct fm_mac_dev * (*get_mac_handle)(struct mac_device *mac_dev); + int (*init_phy)(struct n
[v2,05/11] soc/fman: Add the FMan MAC FLIB headers
From: Madalin Bucur --- drivers/soc/fsl/fman/flib/fsl_enet.h | 275 ++ drivers/soc/fsl/fman/flib/fsl_fman_dtsec.h | 1016 drivers/soc/fsl/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 ++ drivers/soc/fsl/fman/flib/fsl_fman_memac.h | 494 ++ drivers/soc/fsl/fman/flib/fsl_fman_memac_mii_acc.h | 76 ++ drivers/soc/fsl/fman/flib/fsl_fman_tgec.h | 483 ++ 6 files changed, 2447 insertions(+) create mode 100644 drivers/soc/fsl/fman/flib/fsl_enet.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_dtsec.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_dtsec_mii_acc.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_memac.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_memac_mii_acc.h create mode 100644 drivers/soc/fsl/fman/flib/fsl_fman_tgec.h diff --git a/drivers/soc/fsl/fman/flib/fsl_enet.h b/drivers/soc/fsl/fman/flib/fsl_enet.h new file mode 100644 index 000..78e7d04 --- /dev/null +++ b/drivers/soc/fsl/fman/flib/fsl_enet.h @@ -0,0 +1,275 @@ +/* + * Copyright 2008 - 2015 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. + */ + +#ifndef __FSL_ENET_H +#define __FSL_ENET_H + +/*Ethernet MAC-PHY Interface */ + +enum enet_interface { + E_ENET_IF_MII = 0x0001, /* MII interface */ + E_ENET_IF_RMII = 0x0002, /* RMII interface */ + E_ENET_IF_SMII = 0x0003, /* SMII interface */ + E_ENET_IF_GMII = 0x0004, /* GMII interface */ + E_ENET_IF_RGMII = 0x0005, /* RGMII interface */ + E_ENET_IF_TBI = 0x0006, /* TBI interface */ + E_ENET_IF_RTBI = 0x0007, /* RTBI interface */ + E_ENET_IF_SGMII = 0x0008, /* SGMII interface */ + E_ENET_IF_XGMII = 0x0009, /* XGMII interface */ + E_ENET_IF_QSGMII = 0x000a,/* QSGMII interface */ + E_ENET_IF_XFI = 0x000b/* XFI interface */ +}; + +/* Ethernet Speed (nominal data rate) */ +enum enet_speed { + E_ENET_SPEED_10 = 10, /* 10 Mbps */ + E_ENET_SPEED_100 = 100, /* 100 Mbps */ + E_ENET_SPEED_1000 = 1000, /* 1000 Mbps = 1 Gbps */ + E_ENET_SPEED_1 = 1 /* 1 Mbps = 10 Gbps */ +}; + +enum mac_type { + E_MAC_DTSEC, + E_MAC_TGEC, + E_MAC_MEMAC +}; + +/* Enum for inter-module interrupts registration */ +enum fman_event_modules { + E_FMAN_MOD_PRS, /* Parser event */ + E_FMAN_MOD_KG,/* Keygen event */ + E_FMAN_MOD_PLCR, /* Policer event */ + E_FMAN_MOD_10G_MAC, /* 10G MAC event */ + E_FMAN_MOD_1G_MAC,/* 1G MAC event */ + E_FMAN_MOD_TMR, /* Timer event */ + E_FMAN_MOD_FMAN_CTRL, /* FMAN Controller Timer event */ + E_FMAN_MOD_MACSEC, + E_FMAN_MOD_DUMMY_LAST +}; + +/* Enum for interrupts types */ +enum fman_intr_type { + E_FMAN_INTR_TYPE_ERR, + E_FMAN_INTR_TYPE_NORMAL +}; + +/* enum for defining MAC types */ +enum fman_mac_type { + E_FMAN_MAC_10G = 0, /* 10G MAC */ + E_FMAN_MAC_1G
[v2,08/11] soc/fman: Add the FMan parser and KeyGen FLIB(s)
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/Kconfig|6 + drivers/soc/fsl/fman/Makefile |1 + drivers/soc/fsl/fman/pcd/Makefile |3 + drivers/soc/fsl/fman/pcd/fman_kg.c | 849 +++ drivers/soc/fsl/fman/pcd/fman_prs.c | 126 ++ 5 files changed, 985 insertions(+) create mode 100644 drivers/soc/fsl/fman/pcd/Makefile create mode 100644 drivers/soc/fsl/fman/pcd/fman_kg.c create mode 100644 drivers/soc/fsl/fman/pcd/fman_prs.c diff --git a/drivers/soc/fsl/fman/Kconfig b/drivers/soc/fsl/fman/Kconfig index 7489ff6..f057b15 100644 --- a/drivers/soc/fsl/fman/Kconfig +++ b/drivers/soc/fsl/fman/Kconfig @@ -20,4 +20,10 @@ config FSL_FMAN_MAC help Freescale DPAA FMan MAC support +config FSL_FMAN_PCD + bool "FMan PCD" + default n + help + Freescale DPAA FMan Parse, Classify and Distribute support + endif # FSL_FMAN diff --git a/drivers/soc/fsl/fman/Makefile b/drivers/soc/fsl/fman/Makefile index a0f396f..2bb0e13 100644 --- a/drivers/soc/fsl/fman/Makefile +++ b/drivers/soc/fsl/fman/Makefile @@ -6,3 +6,4 @@ fsl_fman-objs := fman.o obj-$(CONFIG_FSL_FMAN_PORT)+= port/ obj-$(CONFIG_FSL_FMAN_MAC) += mac/ +obj-$(CONFIG_FSL_FMAN_PCD) += pcd/ diff --git a/drivers/soc/fsl/fman/pcd/Makefile b/drivers/soc/fsl/fman/pcd/Makefile new file mode 100644 index 000..b50aeac --- /dev/null +++ b/drivers/soc/fsl/fman/pcd/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_FSL_FMAN_PCD) += fsl_fman_pcd.o + +fsl_fman_pcd-objs := fman_kg.o fman_prs.o diff --git a/drivers/soc/fsl/fman/pcd/fman_kg.c b/drivers/soc/fsl/fman/pcd/fman_kg.c new file mode 100644 index 000..a140adf --- /dev/null +++ b/drivers/soc/fsl/fman/pcd/fman_kg.c @@ -0,0 +1,849 @@ +/* + * Copyright 2008 - 2015 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_fman_kg.h" + +/* static functions */ + +static uint32_t build_ar_bind_scheme(uint8_t hwport_id, bool write) +{ + uint32_t rw; + + rw = write ? (uint32_t)FM_KG_KGAR_WRITE : (uint32_t)FM_KG_KGAR_READ; + + return (uint32_t)(FM_KG_KGAR_GO | rw | FM_PCD_KG_KGAR_SEL_PORT_ENTRY | + hwport_id | FM_PCD_KG_KGAR_SEL_PORT_WSEL_SP); +} + +static void clear_pe_all_scheme(struct fman_kg_regs __iomem *regs, + uint8_t hwport_id) +{ + uint32_t ar; + + fman_kg_write_sp(regs, 0x, 0); + + ar = build_ar_bind_scheme(hwport_id, true); + fman_kg_write_ar_wait(regs, ar); +} + +static uint32_t build_ar_bind_cls_plan(uint8_t hwport_id, bool write) +{ + uint32_t rw; + + rw = write ? (uint32_t)FM_KG_KGAR_WRITE : (uint32_t)FM_KG_KGAR_READ; + + return (uint32_t)(FM_KG_KGAR_GO | rw | FM_PCD_KG_KGAR_SEL_PORT_ENTRY | + hwport_id | FM_PCD_KG_KGAR_SEL_PORT_WSEL_CPP); +} + +static void clear_pe_all_cls_plan(struct fman_kg_regs __iomem *regs, + uint8_t hwport_id) +{ + uint32_t ar; + + fman_kg_write_cpp(regs, 0); + + ar = build_ar_bind_cls_plan(hwport_id, true); + fman_kg_write
[RFC,3/8] soc/fman: Add FMan Real Time Clock support
From: Igal Liberman Signed-off-by: Igal Liberman --- drivers/soc/fsl/fman/fm_drv.c | 98 drivers/soc/fsl/fman/fm_drv.h |9 +- drivers/soc/fsl/fman/inc/fm_rtc_ext.h | 398 drivers/soc/fsl/fman/inc/fsl_fman_drv.h |3 + drivers/soc/fsl/fman/rtc/Makefile |2 +- drivers/soc/fsl/fman/rtc/fm_rtc.c | 763 +++ drivers/soc/fsl/fman/rtc/fm_rtc.h | 89 7 files changed, 1360 insertions(+), 2 deletions(-) create mode 100644 drivers/soc/fsl/fman/inc/fm_rtc_ext.h create mode 100644 drivers/soc/fsl/fman/rtc/fm_rtc.c create mode 100644 drivers/soc/fsl/fman/rtc/fm_rtc.h diff --git a/drivers/soc/fsl/fman/fm_drv.c b/drivers/soc/fsl/fman/fm_drv.c index 9859ac6..ffeb223 100644 --- a/drivers/soc/fsl/fman/fm_drv.c +++ b/drivers/soc/fsl/fman/fm_drv.c @@ -423,6 +423,32 @@ static struct lnx_wrp_fm_dev_t *read_fm_dev_tree_node(struct platform_device } } +#ifdef CONFIG_FSL_FMAN_RTC + /* Get the RTC base address and size */ + memset(&name, 0, sizeof(name)); + if (WARN_ON(strlen("ptp-timer") >= sizeof(name.name))) + return NULL; + strcpy(name.name, "ptp-timer"); + if (WARN_ON(strlen("fsl,fman-ptp-timer") >= sizeof(name.compatible))) + return NULL; + strcpy(name.compatible, "fsl,fman-ptp-timer"); + for_each_child_of_node(fm_node, dev_node) { + if (likely(of_match_node(&name, dev_node) != NULL)) { + err = of_address_to_resource(dev_node, 0, &res); + if (unlikely(err < 0)) { + pr_err("of_address_to_resource() = %d", + err); + goto _return_null; + } + + p_lnx_wrp_fm_dev->fm_rtc_base_addr = 0; + p_lnx_wrp_fm_dev->fm_rtc_phys_base_addr = res.start; + p_lnx_wrp_fm_dev->fm_rtc_mem_size = res.end + 1 - + res.start; + } + } +#endif + of_node_put(fm_node); p_lnx_wrp_fm_dev->active = true; @@ -485,6 +511,9 @@ uint32_t get_qman_channel_id(struct lnx_wrp_fm_dev_t *p_lnx_wrp_fm_dev, static int configure_fm_dev(struct lnx_wrp_fm_dev_t *p_lnx_wrp_fm_dev) { +#ifdef CONFIG_FSL_FMAN_RTC + struct resource *dev_res; +#endif int err; if (!p_lnx_wrp_fm_dev->active) { @@ -551,6 +580,32 @@ static int configure_fm_dev(struct lnx_wrp_fm_dev_t *p_lnx_wrp_fm_dev) return -ENOSYS; } +#ifdef CONFIG_FSL_FMAN_RTC + if (p_lnx_wrp_fm_dev->fm_rtc_phys_base_addr) { + dev_res = + __devm_request_region(p_lnx_wrp_fm_dev->dev, + p_lnx_wrp_fm_dev->res, + p_lnx_wrp_fm_dev-> + fm_rtc_phys_base_addr, + p_lnx_wrp_fm_dev->fm_rtc_mem_size, + "fman-ptp-timer"); + if (unlikely(!dev_res)) { + pr_err("__devm_request_region() failed\n"); + return -ENOSYS; + } + + p_lnx_wrp_fm_dev->fm_rtc_base_addr = + PTR_TO_UINT(devm_ioremap + (p_lnx_wrp_fm_dev->dev, +p_lnx_wrp_fm_dev->fm_rtc_phys_base_addr, +p_lnx_wrp_fm_dev->fm_rtc_mem_size)); + if (unlikely(p_lnx_wrp_fm_dev->fm_rtc_base_addr == 0)) { + pr_err("devm_ioremap() failed\n"); + return -ENOSYS; + } + } +#endif + p_lnx_wrp_fm_dev->params.base_addr = p_lnx_wrp_fm_dev->fm_base_addr; p_lnx_wrp_fm_dev->params.fm_id = p_lnx_wrp_fm_dev->id; p_lnx_wrp_fm_dev->params.f_exception = lnxwrp_fm_dev_exceptions_cb; @@ -669,6 +724,34 @@ static int init_fm_dev(struct lnx_wrp_fm_dev_t *p_lnx_wrp_fm_dev) */ } +#ifdef CONFIG_FSL_FMAN_RTC + if (p_lnx_wrp_fm_dev->fm_rtc_base_addr) { + struct fm_rtc_params_t fm_rtc_param; + + memset(&fm_rtc_param, 0, sizeof(fm_rtc_param)); + fm_rtc_param.h_app = p_lnx_wrp_fm_dev; + fm_rtc_param.h_fm = p_lnx_wrp_fm_dev->h_dev; + fm_rtc_param.base_address = p_lnx_wrp_fm_dev->fm_rtc_base_addr; + p_lnx_wrp_fm_dev->h_rtc_dev = fm_rtc_config(&fm_rtc_param); + + if (!(p_lnx_wrp_fm_dev->h_rtc_dev)) { + pr_err("FM-RTC\n"); + return -ENOSYS;
[RFC,0/8] Freescale DPAA FMan
From: Igal Liberman The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which enables the Ethernet network interfaces. Igal Liberman (7): soc/fman: Add FMan MURAM support soc/fman: Add Frame Manager support soc/fman: Add FMan Real Time Clock support soc/fman: Add FMan Parser and Keygen support soc/fman: Add FMan MAC support soc/fman: Add FMan SP support soc/fman: Add FMan MAC driver Madalin Bucur (1): soc/fman: Add FMan Port Support drivers/soc/fsl/fman/Kconfig| 94 + drivers/soc/fsl/fman/Makefile |6 +- drivers/soc/fsl/fman/fm.c | 2483 +++ drivers/soc/fsl/fman/fm.h | 502 + drivers/soc/fsl/fman/fm_common.h| 644 ++ drivers/soc/fsl/fman/fm_drv.c | 1217 +++ drivers/soc/fsl/fman/fm_drv.h | 149 ++ drivers/soc/fsl/fman/fm_muram.c | 174 ++ drivers/soc/fsl/fman/fm_port_drv.c | 540 + drivers/soc/fsl/fman/fm_sp_common.h | 112 + drivers/soc/fsl/fman/inc/crc_mac_addr_ext.h | 343 drivers/soc/fsl/fman/inc/dpaa_ext.h | 253 +++ drivers/soc/fsl/fman/inc/dpaa_integration_ext.h | 126 ++ drivers/soc/fsl/fman/inc/enet_ext.h | 199 ++ drivers/soc/fsl/fman/inc/fm_ext.h | 749 +++ drivers/soc/fsl/fman/inc/fm_mac_ext.h | 660 ++ drivers/soc/fsl/fman/inc/fm_muram_ext.h | 98 + drivers/soc/fsl/fman/inc/fm_pcd_ext.h | 167 ++ drivers/soc/fsl/fman/inc/fm_port_ext.h | 650 ++ drivers/soc/fsl/fman/inc/fm_rtc_ext.h | 398 drivers/soc/fsl/fman/inc/fsl_fman_drv.h | 257 +++ drivers/soc/fsl/fman/inc/mac.h | 142 ++ drivers/soc/fsl/fman/inc/net_ext.h | 534 + drivers/soc/fsl/fman/inc/service.h | 90 + drivers/soc/fsl/fman/mac/Makefile | 10 +- drivers/soc/fsl/fman/mac/dtsec.c| 1655 +++ drivers/soc/fsl/fman/mac/dtsec.h| 187 ++ drivers/soc/fsl/fman/mac/dtsec_mii_acc.c| 82 + drivers/soc/fsl/fman/mac/dtsec_mii_acc.h| 43 + drivers/soc/fsl/fman/mac/fm_mac.c | 701 +++ drivers/soc/fsl/fman/mac/fm_mac.h | 203 ++ drivers/soc/fsl/fman/mac/mac-api.c | 671 ++ drivers/soc/fsl/fman/mac/mac.c | 522 + drivers/soc/fsl/fman/mac/memac.c| 1115 ++ drivers/soc/fsl/fman/mac/memac.h| 103 + drivers/soc/fsl/fman/mac/memac_mii_acc.c| 66 + drivers/soc/fsl/fman/mac/memac_mii_acc.h| 50 + drivers/soc/fsl/fman/mac/tgec.c | 1030 ++ drivers/soc/fsl/fman/mac/tgec.h | 112 + drivers/soc/fsl/fman/mac/tgec_mii_acc.h | 66 + drivers/soc/fsl/fman/pcd/Makefile |2 +- drivers/soc/fsl/fman/pcd/fm_pcd.c | 428 drivers/soc/fsl/fman/pcd/fm_pcd.h | 145 ++ drivers/soc/fsl/fman/pcd/fm_prs.c | 276 +++ drivers/soc/fsl/fman/pcd/fm_prs.h | 163 ++ drivers/soc/fsl/fman/port/Makefile |2 +- drivers/soc/fsl/fman/port/fm_port.c | 2427 ++ drivers/soc/fsl/fman/port/fm_port.h | 743 +++ drivers/soc/fsl/fman/rtc/Makefile |2 +- drivers/soc/fsl/fman/rtc/fm_rtc.c | 763 +++ drivers/soc/fsl/fman/rtc/fm_rtc.h | 89 + drivers/soc/fsl/fman/sp/Makefile|2 +- drivers/soc/fsl/fman/sp/fm_sp.c | 429 53 files changed, 22665 insertions(+), 9 deletions(-) create mode 100644 drivers/soc/fsl/fman/fm.c create mode 100644 drivers/soc/fsl/fman/fm.h create mode 100644 drivers/soc/fsl/fman/fm_common.h create mode 100644 drivers/soc/fsl/fman/fm_drv.c create mode 100644 drivers/soc/fsl/fman/fm_drv.h create mode 100644 drivers/soc/fsl/fman/fm_muram.c create mode 100644 drivers/soc/fsl/fman/fm_port_drv.c create mode 100644 drivers/soc/fsl/fman/fm_sp_common.h create mode 100644 drivers/soc/fsl/fman/inc/crc_mac_addr_ext.h create mode 100644 drivers/soc/fsl/fman/inc/dpaa_ext.h create mode 100644 drivers/soc/fsl/fman/inc/dpaa_integration_ext.h create mode 100644 drivers/soc/fsl/fman/inc/enet_ext.h create mode 100644 drivers/soc/fsl/fman/inc/fm_ext.h create mode 100644 drivers/soc/fsl/fman/inc/fm_mac_ext.h create mode 100644 drivers/soc/fsl/fman/inc/fm_muram_ext.h create mode 100644 drivers/soc/fsl/fman/inc/fm_pcd_ext.h create mode 100644 drivers/soc/fsl/fman/inc
RE: [v2] powerpc/fsl: Update fman dt binding with pcs-phy and tbi-phy
Hi Rob, > -Original Message- > From: Rob Herring [mailto:r...@kernel.org] > Sent: Wednesday, December 30, 2015 6:28 PM > To: Igal Liberman > Cc: devicet...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; Scott Wood > ; Madalin-Cristian Bucur > ; shaohui@freescale.com > Subject: Re: [v2] powerpc/fsl: Update fman dt binding with pcs-phy and tbi- > phy > > On Thu, Dec 24, 2015 at 03:42:11AM +0200, igal.liber...@freescale.com > wrote: > > From: Igal Liberman > > > > The FMan contains internal PHY devices used for SGMII connections to > > external PHYs. When these PHYs are in use a reference is needed for > > both the external PHY and the internal one. For the external PHY > > phy-handle provides the reference. For the internal PHY a new handle > > is required. > > In dTSEC, the internal PHY is a TBI (Ten Bit Interface) PHY, the > > handle used will be tbi-handle. > > In mEMAC, the internal PHY is a PCS (Physical Coding Sublayer) PHY, > > the handle used will be pcsphy-handle. > > This is fairly commom for 10G eth I think. Can't you use the common PHY > binding here in the case without internal MDIO bus? Just because you use it > that doesn't mean you have to use the generic phy subsystem in the kernel. > mEMAC and dTSEC always have internal MDIO bus. I was requested to use generic PHY API for internal PHY configuration by netdev, this part was accepted. > Perhaps phy-handle should be deprecated in favor of doing something like > this if you need a phandle to both: > > phys = <&internal-phy>, <&external-phy>; > I think that pcsphy-handle and tbi-handle represent the hardware in a good way. This is the actual name of the hardware. > > diff --git a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt > > b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt > > index 1fc5328..55c2c03 100644 > > --- a/Documentation/devicetree/bindings/powerpc/fsl/fman.txt > > +++ b/Documentation/devicetree/bindings/powerpc/fsl/fman.txt > > @@ -315,6 +315,16 @@ PROPERTIES > > Value type: > > Definition: A phandle for 1EEE1588 timer. > > > > +- pcsphy-handle > > + Usage required for "fsl,fman-memac" MACs > > + Value type: > > + Definition: A phandle for pcsphy. > > + > > +- tbi-handle > > + Usage required for "fsl,fman-dtsec" MACs > > + Value type: > > + Definition: A phandle for tbiphy. > > + > > EXAMPLE > > > > fman1_tx28: port@a8000 { > > @@ -340,6 +350,7 @@ ethernet@e { > > reg = <0xe 0x1000>; > > fsl,fman-ports = <&fman1_rx8 &fman1_tx28>; > > ptp-timer = <&ptp-timer>; > > + tbi-handle = <&tbi0>; > > What does the tbi0 node contain? It should be present in the example. > There is an example in under MDIO section: mdio@e3120 { compatible = "fsl,fman-mdio"; reg = <0xe3120 0xee0>; fsl,fman-internal-mdio; tbi1: tbi-phy@8 { reg = <0x8>; device_type = "tbi-phy"; }; }; I used different indexes to make sure that it's aligned to the other examples in the binding document. > Rob Thank you for your feedback, Igal ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev