Received: by 10.223.164.202 with SMTP id h10csp60289wrb; Tue, 7 Nov 2017 02:54:32 -0800 (PST) X-Google-Smtp-Source: ABhQp+QAau8Gra/suPPJ7eYmsvP0uJ8qjLEMccWjXDH97RlNlQOEoRwIhh8z39XnJsCg2NJx9vsu X-Received: by 10.101.70.201 with SMTP id n9mr14866158pgr.197.1510052072590; Tue, 07 Nov 2017 02:54:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510052072; cv=none; d=google.com; s=arc-20160816; b=LZ0AzUVkvWmbecsUa37gsJ5siixIHVu9V6dsNSzDO+G6/PHWzkg6HP6HCmc+hfVnxq m5EJbjA38/Ko3caYGq+zbepltYY1LOqy+uhnx55dSwHvk9GMbbbM6L/y/SZpLd3a/W8K 580Hi98pdDRpfpnBoZYG4rJGusowO2Tiy/mAvVKK1IOHCukFgANr7D2oI1PNNBkssFsj ggUvh/8rOosp7K95TYOw7ccGmpDrI5K257oLX3WuqrZzGI8HgY6bgZ1ViGXCYs9Yn6Ls 9p2lfu96UFXKbgZ6kw115y27o8/wFsKl50sKNfrjMM+4x2e2k9kuKQ7YEOGSG5sLDbk/ /pgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:arc-authentication-results; bh=UJX31q5J28bf/rMHZ1K69SWHsUh3ZJOiTQ8dvTRh2Ec=; b=R0upSBaz3jNwpbv9qUjRhWrRXjDZz55NgiVTmIVY0wXCVaz4oZXf1bayl/VHbrjPfQ VcwfRU/N/Zo5KyIs/7X2G0mi1DBQPQ5CyBmdz3c4uhozRgPgIvGxA8HiABGNBTeRx6pj NFQFb4aQ2oE7HD98PdAwT8j0sNsQV1ojgYrEBJjwg3SclHkdTWBDhnPmdlhLdwYBVrt9 GEOTVYwllt9vsvLgv4Joi6ooWpE7wYx2SLdC3oUZrJxAns2ev7AeXICuPZEzxWNVXsEs CJpVs0BwsOo2wdC4tKTK47FsPVnq97f0kX60zGh7Hxw+hO1GRhs2Q9hkskOBX3EaJ4OR nbxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23si856207pgd.261.2017.11.07.02.54.19; Tue, 07 Nov 2017 02:54:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755450AbdKGHjk (ORCPT + 91 others); Tue, 7 Nov 2017 02:39:40 -0500 Received: from mail-sn1nam02on0066.outbound.protection.outlook.com ([104.47.36.66]:51931 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753543AbdKGHjd (ORCPT ); Tue, 7 Nov 2017 02:39:33 -0500 Received: from DM5PR03CA0042.namprd03.prod.outlook.com (10.174.189.159) by DM5PR03MB2697.namprd03.prod.outlook.com (10.168.197.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Tue, 7 Nov 2017 07:39:31 +0000 Received: from BY2FFO11FD043.protection.gbl (2a01:111:f400:7c0c::150) by DM5PR03CA0042.outlook.office365.com (2603:10b6:4:3b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.197.13 via Frontend Transport; Tue, 7 Nov 2017 07:39:31 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; 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 BY2FFO11FD043.mail.protection.outlook.com (10.1.14.228) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.178.5 via Frontend Transport; Tue, 7 Nov 2017 07:39:31 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vA77dN0E019819; Tue, 7 Nov 2017 00:39:24 -0700 From: Ran Wang To: , , , , Felipe Balbi CC: , , , , , , , , , , , Shawn Guo , Sriram Dash , Li Yang , Hongtao Jia , Ran Wang Subject: [PATCH v2 1/3] drivers: usb: phy: Add qoriq usb 3.0 phy driver support Date: Tue, 7 Nov 2017 15:20:53 +0800 Message-ID: <20171107072055.26945-1-ran.wang_1@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131545139716297075;(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)(7966004)(336005)(39380400002)(376002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(106466001)(498600001)(6666003)(50226002)(8656006)(8676002)(47776003)(105606002)(8936002)(81156014)(81166006)(5003940100001)(316002)(575784001)(86362001)(39060400002)(4326008)(53936002)(5660300001)(16586007)(68736007)(110136005)(54906003)(2201001)(33646002)(48376002)(305945005)(50466002)(77096006)(104016004)(36756003)(85426001)(7416002)(1076002)(356003)(2906002)(97736004)(50986999)(189998001)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR03MB2697;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD043;1:alUm5fAd7UprFWsPc1BO6LSjsak6FNof+je06tCjDHhD22UXf9OiYxyrdVBmCyXjgbkCw5V0o1rB2m708TpwBpPEctuy3r68CzC+to+mHrnqKso5dRnlimscTAxgBpeg MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31266c5c-9692-4cef-b012-08d525b2af2c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199);SRVR:DM5PR03MB2697; X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2697;3:uU7TFjEgGHM/43OrfItMoAEXuXMq7+aDWnqwuf4E9IPtOGxmhtb34fJMOqhZE491OS6Jo0ArtGahK0bV1Ngv1s2+eVsPnvQsLC9AaIH+hjE8drwf69+FcxLCRTUd0aPDQXKUJ1jUz4ac4FBM60ON86aryFm0iWsNqbf/2WMjNGAvkJ6Xvt8bzOlpFZX10lp5E+e688ljmHs8bLLoIWzCkT+c5+b4V1W7QsrPeXdKellTfKgfuVCT5CO9asaOFjwzkakmbtlVHPSzrxj7sj+2qbEFFTT3+AhY6z7yRs3hNJDfBFyeDCWJ+INKrTSblG+XYPlzK7w4xV7w15yPg+xpqSupxzcYYFZ5QBSbCJZinkM=;25:YWQ4cF7Cpv9eLzZVjeoNEjkcy4Wo4CigetPIU6bSoRs0XDlqaUXv5Qzjjg2KkGHB+mGw9CH93w53QPglAd8oE9NxI0gbkxO/PQzE8fYwNHu9oSqHVeprIaOgTYm244PJh4l6kYbDK+pLJEPsLFZB4i9erm6XErmOqnzp3RiVExD/hd4pLwYl9x8bXScG0TNh67xmixoUoVoQbroQvth/OEZeQJ2LCJXnc2HOWlsm/IWWIjWyNTGm9eWW+JW2zE+skhFYJigiVqhP49uOp643bAOK/b0NMIgrLFqK9Xw0OhIbqTODpvFztVoDe+ppik7ATBbg2VrlIc90mYZZOqBoBg== X-MS-TrafficTypeDiagnostic: DM5PR03MB2697: X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2697;31:DHKiFsZ4IKkKwuiwn2NHBxRDgDY2T09Xl77cexBDfhwmM5TBEDzCPPNPDENQytYIouUcNcJbajZQwFO0K+bHvm1LMub0ieL6eRz1hiFHPAiVvo0i/b3OjR9t2tKZxG8CFFlEXyVkBn7QrZML1n86tQGDin2UdhKsfxZdBpG92UumZxP/Yiwe/Zjn+Y3l8ah5Kv1BHl4tjN9kjiAIZOKFr2ekatwv0Rr/oWzJO+cUv+s=;4:U8E37HtWlBWo8J5TanVA3xGbUx8crodsGxO9hb/FxDtFO0U2QVTRoEd/i1dx+IUImlYqwrfPVmo4Aq9nREJTzMctBPxBQVcPH2iJnGFZicub3Nxmi7whh96ed7+Z+wE7hTeXmbA+rXkPW+SRIBE3t8ZK4715ztdECaTccm6xCMnaeGoXd7cDR4ashYXhmX5VKoY2/uFHHELrFaoB/aVXc9nXZp6Txhx7J4+2T60OEhAoW9SGDGhytIdL+HLck1o28ZJ5wL4M6M/Euqj19GRr0QwqZ1StTZsGRasy30kQYcqJTPj9AvQm9tCYPdtxJN1mVdERKDjURbIbmpdhU4XQ/Q== X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(788757137089); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(3231021)(6055026)(2017110403001)(6096035)(20161123556025)(20161123563025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123561025)(20161123559100)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM5PR03MB2697;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM5PR03MB2697; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM5PR03MB2697;23:J0WFUzXYSdMGkV2IhjSnPUBdEa5tYKWrA9jUoxNrX?= =?us-ascii?Q?HJsyYtzLzNdiVuUP/29SvTU6L3h53kGnte4+BIGmLk3rY7ivwFIDQ2gxJqPb?= =?us-ascii?Q?ye5g7NKZA9vU6uDeQC01Zu9rRKqstQa1WwShr1oH3FrgLaQ9KiQjCqfVn4/L?= =?us-ascii?Q?v8N2G3CiGruXbPxImiyYndX+MyLteuSYTr98BHRjQbf77b0b9LWv7xEFd2B4?= =?us-ascii?Q?ngJmOkvD7eZRpaWDH0/Hl1t9Of3Lqy3JyiJLYqkl9TLX2fx4x+FCRzlVZy2e?= =?us-ascii?Q?XTMV5Dg5KGXRQPvtpxx73hmuKdHi0wGh0KHxtCCAPw4D6k46JVDfujDS+ZZC?= =?us-ascii?Q?ysyAKszgISg79FhIK8zhc5LzGBeEURQ00DT69s5o5VY8jflWqki7QMMHvyR0?= =?us-ascii?Q?DPTy5d6ZqPJZ6jfNvqbdqhEg9LLIzW/fHgWEOzxSTJnlLi+DVPDlar6+RK25?= =?us-ascii?Q?Hpk39/b/p5U4flfE0xGLqA2EMpKBDl+0Vv0xGCm+8euxCFTO5ZYf98kl0NEZ?= =?us-ascii?Q?BQggkPl29NaBE8614ac1QvHT3MsOirXUjRbEXcYKxC3wcz5nZo7dytW4Cn1H?= =?us-ascii?Q?P7Z2a3WYcJzCPVhNk3mFkRexgEZgzSOJm3lBxu1S42BWyB5vOlEd9mzIsUTN?= =?us-ascii?Q?RpP1+Ph8zdnMbEPzqzN68uycRPIPRDjo1qdHltjzOXctf7ZUJ1VEPw1IX5EC?= =?us-ascii?Q?Fn37LtFmhMc0Z39zEZGpeRphxXCERF1V61BNpPXUyrrmNR0kzBHAk5L1/hwV?= =?us-ascii?Q?xfPoDfIyuFr1lA0SqduwyrrcOWuIUb5ZkX9tXqSosbFqr4UwxWiY6Tfv5DqV?= =?us-ascii?Q?566vTIKY/pG3zIJ9E83hulDcYAkLfT4gLl/fqEM66sxjxgcyxxk3LxmHvuCt?= =?us-ascii?Q?AGx4A44xx3Emhe3tpyPQc+3UcyX2Fhv+Ev9iJg9o5wztUhLgeAx55s8D9NGm?= =?us-ascii?Q?9tk2/p59/C04FLLLSCZwEVdVb7tDgxFKta8khSe+QfZh70j3KR3RP18BnP69?= =?us-ascii?Q?22TuJUvA2gP4F3O7JR+BffJZ8j37uahuNrBC4Uh0yVzCV9TDRpUgPiXaNN6b?= =?us-ascii?Q?yZmRG9WYC5gqwlLztm6cR6jq9lB3wK5iW+Rx8ATXXkrobghiSOdVJHRfblyH?= =?us-ascii?Q?NNnPBzrqgMpyKFZrvHRzqNnDwftNRfLuxC6F7oEsSv3KrI0AFCWk2M+/NFvK?= =?us-ascii?Q?LeyrUhD6D4izYQe5GdhLIHqPFmg/qHuG+AS5VSBBAW92yFXQytmcW3oHrDGa?= =?us-ascii?Q?uv5KZl7vyhB/y1E1kw=3D?= X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2697;6:mcz6+g6ZzfvTTpu25JtO72p8CI7blSCIwdRhqhSPIEEQvJYWGhcK8z1EYnI5tTy6Agyef2a1g4l5WwmcVbzMQxKg+rSt1SM2KStmbbbS3zwTlSOzhIzhfzMsct9q1vW2Vp2bRXlr89fL07YVfjFU/J7AueOVt0RhztkMNwafOBXYh+LJZJpHglYSlYLVqEojqRqkTxDZV7sX5BeoF/9eMcFHwPk2NWNjho+qP8i1zOVHlavRw43sbeX162SkeeybHaen0xeTwJscnrZwIiNzprD1Mu2UyPyzq5caw5I+CxxiaWvvYJ++XA7IwB+62BDxe296JeMvOsXB/p03bj8hWtIA5UIKfknT9vAdJVEEsqg=;5:U//kchr84U+oafub2DHiTarx5IfDmgca9lAMlEuqpLI7wtNJHZ+Aw3vGrS1kuViw75Ius6PTJF7tDPIh5CIpyIO5fwAPBex/r0Jl0wi33sLdnRPqBkBqeJrCa9xk76S6qsH4SPHOqA6fIDNjE1XKNISJZZEhEA8Hyscr/ZzJhzA=;24:QFjDbp7LSVWctBf/5RJ2F0lFJ/d/wGmsBM5n53oIiHBfaLFdLx9Q6x4LTdeocpivCODqp4hU5EJsIRAZnJ/dAwHGcPozLI6ODJSEIJBrvbg=;7:giPOlJPiaWVWh2drjLI9zpFtUpEQ0vc8JFll1jVNyKZE+Mas0XftiYlvd23fVr7rNH5My0ON52/O3NwTssHTji9ascXBs/SAl+WbZyAY3lTfO0spyLFSdj5ZO1+ZHXN8WBTuOE2TrTFNbfvYVo3//EAjRychNHWwISXgNI2YmgIyAj+DNXR1lQHbcYIaYmB25lrOPl7xDX/R8AKxfFmSJI/g0yVsX62MrjkUTBk0WWJPRO0zZEhTtX7RArdEEG7t SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 07:39:31.3333 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31266c5c-9692-4cef-b012-08d525b2af2c 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: DM5PR03MB2697 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adds qoriq usb 3.0 phy driver to implement erratum related workaround for qoriq SoC. Signed-off-by: Sriram Dash Signed-off-by: Ran Wang --- Change in v2: - Replace funciont __raw_writel() by iowrite32be() - Remove qoriq_usb3_phy_read() and qoriq_usb3_phy_write() - Remove USB3PRM1CR_VAL define, use numbers directly - Use C-style numeric constants on 32'h27672B2A in annotation - Add prefix 'static' to struct qoriq_usb3_phy_erratum .../devicetree/bindings/phy/phy-qoriq-usb3.txt | 36 ++++ drivers/phy/Kconfig | 9 + drivers/phy/Makefile | 1 + drivers/phy/phy-qoriq-usb3.c | 191 +++++++++++++++++++++ 4 files changed, 237 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt create mode 100644 drivers/phy/phy-qoriq-usb3.c diff --git a/Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt b/Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt new file mode 100644 index 000000000000..d956f9c89fbf --- /dev/null +++ b/Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt @@ -0,0 +1,36 @@ +Driver for Freescale USB 3.0 PHY + +Required properties: + +- compatible : fsl,qoriq-usb3-phy +- reg : register mappings for Parameter Configuration Register + and Phy base offset. +- reg-names : "param_ctrl" and "phy_base" +- phy_type : For multi port host USB controllers, should be one of + "ulpi", or "serial". For dual role USB controllers, + should be one of "ulpi", "utmi", "utmi_wide", or "serial". + +Example: + usbphy0: usb-phy@084F0000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x01570070 0x0 0xC>, <0x0 0x084F0000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; + + usbphy1: usb-phy@08500000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x0157007C 0x0 0xC>, <0x0 0x08500000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; + + usbphy2: usb-phy@08510000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x01570088 0x0 0xC>, <0x0 0x08510000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index c1807d4a0079..077e6765d2df 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -41,6 +41,15 @@ config PHY_PISTACHIO_USB help Enable this to support the USB2.0 PHY on the IMG Pistachio SoC. + +config PHY_QORIQ_USB3 + tristate "Freescale QorIQ USB 3.0 PHY driver" + depends on ARCH_LAYERSCAPE + depends on OF + select GENERIC_PHY + help + Enable this to support the USB3.0 PHY on the QorIQ SoC. + config PHY_XGENE tristate "APM X-Gene 15Gbps PHY support" depends on HAS_IOMEM && OF && (ARM64 || COMPILE_TEST) diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index f252201e0ec9..94712e066cde 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -21,3 +21,4 @@ obj-y += broadcom/ \ samsung/ \ st/ \ ti/ +obj-$(CONFIG_PHY_QORIQ_USB3) += phy-qoriq-usb3.o diff --git a/drivers/phy/phy-qoriq-usb3.c b/drivers/phy/phy-qoriq-usb3.c new file mode 100644 index 000000000000..f9302fc59f05 --- /dev/null +++ b/drivers/phy/phy-qoriq-usb3.c @@ -0,0 +1,191 @@ +/* + * Freescale QorIQ USB3 phy driver + * + * Copyright 2016 Freescale Semiconductor, Inc. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Author: Sriram Dash + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* Parameter control */ +#define USB3PRM1CR 0x000 + +/* + * struct qoriq_usb3_phy - driver data for USB 3.0 PHY + * @dev: pointer to device instance of this platform device + * @param_ctrl: usb3 phy parameter control register base + * @phy_base: usb3 phy register memory base + * @has_erratum_flag: keeps track of erratum applicable on device + */ +struct qoriq_usb3_phy { + struct device *dev; + void __iomem *param_ctrl; + void __iomem *phy_base; + u32 has_erratum_flag; +}; + +/* + * Erratum A008751 + * SCFG USB3PRM1CR has incorrect default value + * SCFG USB3PRM1CR reset value should be 0x27672B2A instead of 32'h25E72B2A. + */ +static void erratum_a008751(struct qoriq_usb3_phy *phy) +{ + iowrite32be(0x27672B2A, phy->param_ctrl + USB3PRM1CR); +} + +/* + * qoriq_usb3_phy_erratum - List of phy erratum + * @qoriq_phy_erratum - erratum application + * @prop - string of property name for erratum + */ + +struct qoriq_usb3_phy_erratum { + void (*qoriq_phy_erratum)(struct qoriq_usb3_phy *phy); + char *prop; +}; + +/* Erratum list */ +static struct qoriq_usb3_phy_erratum phy_erratum_tbl[] = { + {erratum_a008751, "fsl,usb-erratum-a008751"}, + /* Add init time erratum here */ +}; + +static int qoriq_usb3_phy_init(struct phy *x) +{ + struct qoriq_usb3_phy *phy = phy_get_drvdata(x); + int i; + + for (i = 0; i < ARRAY_SIZE(phy_erratum_tbl); i++) + if (phy->has_erratum_flag & 1 << i) + phy_erratum_tbl[i].qoriq_phy_erratum(phy); + + return 0; +} + +static const struct phy_ops ops = { + .init = qoriq_usb3_phy_init, + .owner = THIS_MODULE, +}; + +static int qoriq_usb3_phy_probe(struct platform_device *pdev) +{ + struct qoriq_usb3_phy *phy; + struct phy *generic_phy; + struct phy_provider *phy_provider; + const struct of_device_id *of_id; + struct device *dev = &pdev->dev; + struct resource *res; + int i, ret; + + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + phy->dev = dev; + + of_id = of_match_device(dev->driver->of_match_table, dev); + if (!of_id) { + dev_err(dev, "failed to get device match\n"); + ret = -EINVAL; + goto err_out; + } + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "param_ctrl"); + if (!res) { + dev_err(dev, "failed to get param_ctrl memory\n"); + ret = -ENOENT; + goto err_out; + } + + phy->param_ctrl = devm_ioremap_resource(dev, res); + if (!phy->param_ctrl) { + dev_err(dev, "failed to remap param_ctrl memory\n"); + ret = -ENOMEM; + goto err_out; + } + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy_base"); + if (!res) { + dev_err(dev, "failed to get phy_base memory\n"); + ret = -ENOENT; + goto err_out; + } + + phy->phy_base = devm_ioremap_resource(dev, res); + if (!phy->phy_base) { + dev_err(dev, "failed to remap phy_base memory\n"); + ret = -ENOMEM; + goto err_out; + } + + phy->has_erratum_flag = 0; + for (i = 0; i < ARRAY_SIZE(phy_erratum_tbl); i++) { + phy->has_erratum_flag |= device_property_read_bool(dev, + phy_erratum_tbl[i].prop) << i; + } + + platform_set_drvdata(pdev, phy); + + generic_phy = devm_phy_create(dev, NULL, &ops); + if (IS_ERR(generic_phy)) + return PTR_ERR(generic_phy); + + phy_set_drvdata(generic_phy, phy); + + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + return PTR_ERR(phy_provider); + + return 0; +err_out: + return ret; +} + +static const struct of_device_id qoriq_usb3_phy_dt_ids[] = { + { + .compatible = "fsl,qoriq-usb3-phy" + }, + {} +}; +MODULE_DEVICE_TABLE(of, qoriq_usb3_phy_dt_ids); + +static struct platform_driver qoriq_usb3_phy_driver = { + .probe = qoriq_usb3_phy_probe, + .driver = { + .name = "qoriq_usb3_phy", + .of_match_table = qoriq_usb3_phy_dt_ids, + }, +}; + +module_platform_driver(qoriq_usb3_phy_driver); + +MODULE_ALIAS("platform:qoriq_usb3_phy"); +MODULE_AUTHOR("Sriram Dash "); +MODULE_DESCRIPTION("Freescale QorIQ USB3 phy driver"); +MODULE_LICENSE("GPL v2"); -- 2.14.1 From 1583600215019834098@xxx Thu Nov 09 14:47:32 +0000 2017 X-GM-THRID: 1583600215019834098 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread