From patchwork Sun Aug 27 13:13:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Madalin Bucur X-Patchwork-Id: 806240 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xgFmB0Bc5z9s7M for ; Sun, 27 Aug 2017 23:16:42 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xgFm96G7ZzDrCw for ; Sun, 27 Aug 2017 23:16:41 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0056.outbound.protection.outlook.com [104.47.40.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xgFhx5cktzDqg5 for ; Sun, 27 Aug 2017 23:13:53 +1000 (AEST) Received: from BN3PR03CA0115.namprd03.prod.outlook.com (10.174.66.33) by DM5PR03MB3323.namprd03.prod.outlook.com (10.174.241.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1385.9; Sun, 27 Aug 2017 13:13:48 +0000 Received: from BN1AFFO11FD033.protection.gbl (2a01:111:f400:7c10::116) by BN3PR03CA0115.outlook.office365.com (2603:10b6:400:4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.18 via Frontend Transport; Sun, 27 Aug 2017 13:13:47 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD033.mail.protection.outlook.com (10.58.52.246) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1341.15 via Frontend Transport; Sun, 27 Aug 2017 13:13:47 +0000 Received: from fsr-fed2164-101.ea.freescale.net (fsr-fed2164-101.ea.freescale.net [10.171.73.197]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v7RDDhJj028627; Sun, 27 Aug 2017 06:13:45 -0700 From: Madalin Bucur To: , Subject: [PATCH v4 1/7] fsl/fman: move struct fman to header file Date: Sun, 27 Aug 2017 16:13:37 +0300 Message-ID: <1503839623-3906-2-git-send-email-madalin.bucur@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1503839623-3906-1-git-send-email-madalin.bucur@nxp.com> References: <1503839623-3906-1-git-send-email-madalin.bucur@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131483132275448289; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(8676002)(81166006)(2950100002)(626005)(356003)(4326008)(76176999)(50986999)(97736004)(498600001)(189998001)(33646002)(6666003)(105606002)(106466001)(43066003)(50226002)(68736007)(8936002)(53936002)(77096006)(2906002)(47776003)(305945005)(3450700001)(48376002)(5660300001)(86362001)(81156014)(50466002)(5003940100001)(54906002)(85426001)(104016004)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB3323; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD033; 1:HXZFL7c8vW2GSDRZC5webV4xQ2wTi2b24v7KDsDvs+EhoWRDyI+5v+B2U//j+Cls2bLwCEdm5U8l+3qhKBBrLg6a1YUAVc0uXmv/l9hZ0xcVtEHi9NfukhTY70MfA+tT MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa1ef732-a0e6-45e5-787f-08d4ed4d73b0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR03MB3323; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3323; 3:Sz+TNxmA9cCXnT/eXT08FQzIUSN2n52kxFYCKeIjZpcUP0c0HCpsV7s65NGYYssac+69FjkTCm1pYRkXR8nWM4k7IGdM0lVa6lJzyFHfXMNcCKWZ0g6PxIP7mR+C/E+6TvxNM5j+k+ROmSOmMyQ76GqZrc20Xz/tkSfhPTQhwCTm9eH0SNddrPByPN0m5k2mFMj9OHti4CEuWon09lp9XxuLcK+FeWOkUka6KF00DTrN9RuGY4bpNh84ewH7p/ejigDoD1WfRoxMOeoL+VLEyChfohFetOWtN3BvvJMVktYrE6ZiFXVI9Ez1jfvbTYFLdROJ0lHRJg14wGxLTStu73CgyV56eW8IQYZrfW8ZPJg=; 25:le7TW+7eWGHfYxscWlZuaOOULOmS9YPwhhBvpavbGWtadUxmxMR0mTGy+PXwSu2lMFEZtMLqpSuZlvQmVV9PyTbXisvjsZfF7J+r1BqzhMARCZqaa1+4YpG8zbSRdeBPVqnx5j74Va8TVCWVCR74JIguf4pj6jjdtr00cQqK0hCTn387ZuwryzUNd/SEUgbfOm690LOZPuCUsdf/Pl4N6MhEZ2Ln+WAZ+cLmDTlJC9oXZbpkK73XLsC1uOZ1urFsfO7+ojPfwVy2Mj45zdJSblPWs64yEdSMRq5cVpg9Ocz/SAJDWBZzkCFUvHV7ZAVGdwA12Rc/TBORJh9A72o4kQ== X-MS-TrafficTypeDiagnostic: DM5PR03MB3323: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3323; 31:X51BwmUZxfj6vT7iPvn1Flr+z8sfAiewRBgIBCPUV1d+52OCturUEOZUfKzGgAGISRP9raju9JkCyi5dPGR1YN8Ywt9sDzgjQ1T7JLpQpNGLlgJ3O7n/v1Vn0FrseiHor04RfjUuStvzCCTq5gXLzoV/QYqwMsKG81PmgUQCt3BeTqDs9HAyCGufzUHr/mKISPP8E5YHyROOantWYOGFZzao1ZcoTdYqJWh7KlVwj6I=; 4:/altaCIMni9aB2iblkE3G+b+eTWhvDfBxPq1yZzYEuA2xwWvHiK+mNDlxIG5x8e2aSTA3fjGDfTyAn3AdgzTvS45G7KuSn2iltQQrpfd+lY+YDuv7MQ9vAbjQRPo9nrqHjyhsnJG9e//UXNj7JspeMZE3X6u1ch4gc2xoWv2jVyND1YNq7LHsrO4GFl5+C729ddMWUNFKb8L0xOLTraG3+HZjjxarLXkjUiVJgRxWELFX9v1/1lhzthvn6ZRh041PwAFjfclmzTHXU1EGVbZPDW1C45iPfB5cEs3DvdmCks= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(13018025)(8121501046)(13016025)(5005006)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(20161123565025)(20161123563025)(20161123556025)(20161123561025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR03MB3323; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR03MB3323; X-Forefront-PRVS: 0412A98A59 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB3323; 23:SGlRjBj52uUxNJPBYMyLJJsonfdQItvfrpCYrsHCX?= qIJ1nhapauddLUJctcJk187UsqHHCjpMVurrUfbcHjE062vBAwXZN1zur+S3L5Q1Zecrjver9ZElO2Nvya5IPpQLNbK13b2+TcBuEj0rX82hsPtFUFcNHfOmUM6BmKcFfGOjta9Bckbgk65ndZbXKI1SupbCKO15VP6MBIs4IsK7wrrK6L2qtLGTjn5CBXoiJVlTFB4FcjaJLk73vlRHzGYyXDXRAKeYU8p7ly+Dn4sMT9ISgMEKJAyfA+CWXqohtZP32+ZAs3tLvWyR78cIYfkpr1npNxrzRIur7nHbWobRJITH3JzM93M3+9AS8pg7rXX0UUlN4ln4fI8X6rgKv7tXX/beGUB9ViIcIWHV/dlHd9aHAvmwqt/NUtmDwY7QdZL/su5+rnZ2EzbG3FK2dLR887AFbRQvr2hHavTfGXbic2DZgbuFarcJ8Z+1XFSkoGnhGdwb6OLokDJkdOJdPjSSqeWdYXvvMX82zs49SZKfeUB62UMc3C/D+V1LF/p7K3fjFVU4JN5m7rQsR2CF7cI77kYEs8UcwCbqzTI6aUbf+VaWJP3lJUyR/+sQRgDIDra6HyDdhQNQXgkVEbXUj6IiBaO936Ym+dy4ojTu3B0PON9hbUWP/TB2EfXisAYqBVYGrpPuT4fnFB8so4irv+HDxg7Hmik/hpiNFXsSZZdZ3tRNMiGQvVVANJ4s1v8Shw9NaEziafV/A3F3OHy98zgNn/PUgiMbtZD2oGvUVzQx6zW4Y6bim6eUBadj+ijqpooINTM1lD93wykSLnF6+ADf1+fS57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knYteY+UCx5nzSd9SNDEhyPTrZm8WIWKRUIjgmRVo86/ZEPe0SMh34YenwSUrxA57EcTeMerjMV6kLU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2017 13:13:47.3576 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB3323 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: madalin.bucur@nxp.com Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Signed-off-by: Madalin Bucur --- drivers/net/ethernet/freescale/fman/fman.c | 80 +------------------------ drivers/net/ethernet/freescale/fman/fman.h | 75 +++++++++++++++++++++++ drivers/net/ethernet/freescale/fman/fman_port.c | 8 +-- 3 files changed, 82 insertions(+), 81 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c index e714b8f..8179cc1 100644 --- a/drivers/net/ethernet/freescale/fman/fman.c +++ b/drivers/net/ethernet/freescale/fman/fman.c @@ -32,9 +32,6 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include "fman.h" -#include "fman_muram.h" - #include #include #include @@ -46,6 +43,9 @@ #include #include +#include "fman.h" +#include "fman_muram.h" + /* General defines */ #define FMAN_LIODN_TBL 64 /* size of LIODN table */ #define MAX_NUM_OF_MACS 10 @@ -564,80 +564,6 @@ struct fman_cfg { u32 qmi_def_tnums_thresh; }; -/* Structure that holds information received from device tree */ -struct fman_dts_params { - void __iomem *base_addr; /* FMan virtual address */ - struct resource *res; /* FMan memory resource */ - u8 id; /* FMan ID */ - - int err_irq; /* FMan Error IRQ */ - - u16 clk_freq; /* FMan clock freq (In Mhz) */ - - u32 qman_channel_base; /* QMan channels base */ - u32 num_of_qman_channels; /* Number of QMan channels */ - - struct resource muram_res; /* MURAM resource */ -}; - -/** fman_exceptions_cb - * fman - Pointer to FMan - * exception - The exception. - * - * Exceptions user callback routine, will be called upon an exception - * passing the exception identification. - * - * Return: irq status - */ -typedef irqreturn_t (fman_exceptions_cb)(struct fman *fman, - enum fman_exceptions exception); - -/** fman_bus_error_cb - * fman - Pointer to FMan - * port_id - Port id - * addr - Address that caused the error - * tnum - Owner of error - * liodn - Logical IO device number - * - * Bus error user callback routine, will be called upon bus error, - * passing parameters describing the errors and the owner. - * - * Return: IRQ status - */ -typedef irqreturn_t (fman_bus_error_cb)(struct fman *fman, u8 port_id, - u64 addr, u8 tnum, u16 liodn); - -struct fman { - struct device *dev; - void __iomem *base_addr; - struct fman_intr_src intr_mng[FMAN_EV_CNT]; - - struct fman_fpm_regs __iomem *fpm_regs; - struct fman_bmi_regs __iomem *bmi_regs; - struct fman_qmi_regs __iomem *qmi_regs; - struct fman_dma_regs __iomem *dma_regs; - struct fman_hwp_regs __iomem *hwp_regs; - fman_exceptions_cb *exception_cb; - fman_bus_error_cb *bus_error_cb; - /* Spinlock for FMan use */ - spinlock_t spinlock; - struct fman_state_struct *state; - - struct fman_cfg *cfg; - struct muram_info *muram; - /* cam section in muram */ - unsigned long cam_offset; - size_t cam_size; - /* Fifo in MURAM */ - unsigned long fifo_offset; - size_t fifo_size; - - u32 liodn_base[64]; - u32 liodn_offset[64]; - - struct fman_dts_params dts_params; -}; - static irqreturn_t fman_exceptions(struct fman *fman, enum fman_exceptions exception) { diff --git a/drivers/net/ethernet/freescale/fman/fman.h b/drivers/net/ethernet/freescale/fman/fman.h index f53e147..1015dac 100644 --- a/drivers/net/ethernet/freescale/fman/fman.h +++ b/drivers/net/ethernet/freescale/fman/fman.h @@ -34,6 +34,8 @@ #define __FM_H #include +#include +#include /* FM Frame descriptor macros */ /* Frame queue Context Override */ @@ -274,6 +276,79 @@ struct fman_intr_src { void *src_handle; }; +/** fman_exceptions_cb + * fman - Pointer to FMan + * exception - The exception. + * + * Exceptions user callback routine, will be called upon an exception + * passing the exception identification. + * + * Return: irq status + */ +typedef irqreturn_t (fman_exceptions_cb)(struct fman *fman, + enum fman_exceptions exception); +/** fman_bus_error_cb + * fman - Pointer to FMan + * port_id - Port id + * addr - Address that caused the error + * tnum - Owner of error + * liodn - Logical IO device number + * + * Bus error user callback routine, will be called upon bus error, + * passing parameters describing the errors and the owner. + * + * Return: IRQ status + */ +typedef irqreturn_t (fman_bus_error_cb)(struct fman *fman, u8 port_id, + u64 addr, u8 tnum, u16 liodn); + +/* Structure that holds information received from device tree */ +struct fman_dts_params { + void __iomem *base_addr; /* FMan virtual address */ + struct resource *res; /* FMan memory resource */ + u8 id; /* FMan ID */ + + int err_irq; /* FMan Error IRQ */ + + u16 clk_freq; /* FMan clock freq (In Mhz) */ + + u32 qman_channel_base; /* QMan channels base */ + u32 num_of_qman_channels; /* Number of QMan channels */ + + struct resource muram_res; /* MURAM resource */ +}; + +struct fman { + struct device *dev; + void __iomem *base_addr; + struct fman_intr_src intr_mng[FMAN_EV_CNT]; + + struct fman_fpm_regs __iomem *fpm_regs; + struct fman_bmi_regs __iomem *bmi_regs; + struct fman_qmi_regs __iomem *qmi_regs; + struct fman_dma_regs __iomem *dma_regs; + struct fman_hwp_regs __iomem *hwp_regs; + fman_exceptions_cb *exception_cb; + fman_bus_error_cb *bus_error_cb; + /* Spinlock for FMan use */ + spinlock_t spinlock; + struct fman_state_struct *state; + + struct fman_cfg *cfg; + struct muram_info *muram; + /* cam section in muram */ + unsigned long cam_offset; + size_t cam_size; + /* Fifo in MURAM */ + unsigned long fifo_offset; + size_t fifo_size; + + u32 liodn_base[64]; + u32 liodn_offset[64]; + + struct fman_dts_params dts_params; +}; + /* Structure for port-FM communication during fman_port_init. */ struct fman_port_init_params { u8 port_id; /* port Id */ diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c index 49bfa11..d51e6aa 100644 --- a/drivers/net/ethernet/freescale/fman/fman_port.c +++ b/drivers/net/ethernet/freescale/fman/fman_port.c @@ -32,10 +32,6 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include "fman_port.h" -#include "fman.h" -#include "fman_sp.h" - #include #include #include @@ -45,6 +41,10 @@ #include #include +#include "fman.h" +#include "fman_port.h" +#include "fman_sp.h" + /* Queue ID */ #define DFLT_FQ_ID 0x00FFFFFF