From patchwork Thu Jun 20 07:16:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 1119229 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="jP0BqJ2z"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45TtQk5Z2qz9s5c for ; Thu, 20 Jun 2019 17:16:14 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726084AbfFTHQN (ORCPT ); Thu, 20 Jun 2019 03:16:13 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:9560 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbfFTHQN (ORCPT ); Thu, 20 Jun 2019 03:16:13 -0400 Received-SPF: Pass (esa3.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa3.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com a:mx1.microchip.iphmx.com a:mx2.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa3.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa3.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa3.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com X-IronPort-AV: E=Sophos;i="5.63,396,1557212400"; d="scan'208";a="38329911" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Jun 2019 00:16:12 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex01.mchp-main.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 20 Jun 2019 00:16:12 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 20 Jun 2019 00:16:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aZiTGsCspM4ZRXpu3cgeu+2Bg+Vf4IZs//RWk877eZo=; b=jP0BqJ2ziJrjpGCZsay5Uzz0sdRIOBBUaw1FVtFQBsk0RJph+NbmJmf4A5MLtx3b2HRxNouKX30KYQg0K6VeY71iLp/NdSv3MtPeF4ABerv0Bmg2oNXWa2nhOzk9Vzc9dcOhfKwKT7iag2Kh5xPOqKJ4fgaOZ8EOWRo4TCOaNzY= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1802.namprd11.prod.outlook.com (10.175.87.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.12; Thu, 20 Jun 2019 07:16:05 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322%9]) with mapi id 15.20.1987.014; Thu, 20 Jun 2019 07:16:05 +0000 From: To: , , , , , , , , , CC: Subject: [PATCH 1/5] dt-bindings: i2c: at91: add new compatible Thread-Topic: [PATCH 1/5] dt-bindings: i2c: at91: add new compatible Thread-Index: AQHVJzgGMmYrS7k2UkW+U3UbXypBkg== Date: Thu, 20 Jun 2019 07:16:05 +0000 Message-ID: <1561014676-22446-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: ro-RO, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P195CA0054.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::43) To DM5PR11MB1242.namprd11.prod.outlook.com (2603:10b6:3:14::8) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6ee68f66-d65f-4236-b5da-08d6f54f284e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:DM5PR11MB1802; x-ms-traffictypediagnostic: DM5PR11MB1802: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-forefront-prvs: 0074BBE012 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(136003)(346002)(366004)(39860400002)(189003)(199004)(64756008)(73956011)(305945005)(3846002)(66556008)(8676002)(71200400001)(8936002)(81156014)(81166006)(66446008)(186003)(36756003)(110136005)(50226002)(2616005)(476003)(53936002)(102836004)(71190400001)(52116002)(14454004)(2501003)(107886003)(99286004)(26005)(316002)(2906002)(6486002)(6506007)(386003)(486006)(14444005)(256004)(66066001)(2201001)(68736007)(66946007)(6116002)(478600001)(7736002)(72206003)(6512007)(4326008)(25786009)(6436002)(4744005)(66476007)(86362001)(5660300002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR11MB1802; H:DM5PR11MB1242.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TTMVmsnNKdI2XkeaUQf2i90NhdcP3sxsiQjjAAhXUUe/cT9oMfcUT0iI1AWK6YdpkBsq607XNweqba0/ydYGO3gqMcEZW3kor2vu0WmIVF23pVjyd/YZQiPN1/53+vTxRW2uCynr1LxfIY3Cssco5LSYL18Q0eJCGPzyLkP6qAXeuCZ00PiyyXBU9dfmhwgSHVFRrIG84q5r1zacAjJ5gWnWYJCxjTZ/fypq5i1qaPyV3HGWYtcCTl6qik2NP+GUN1Bse9xr+4eq7+phj6V3cwnM6mH/rqfdicxiEWZEmP+lCmrnhzJQgg15R/UFAKBu9lKBC86/tCMlceDdM1YKbUGl2Nahcu5hOPha8D+lLGVoRo2BkXmC3iVE4MYssUY5x3T7kHe3VlnQIW/aVfFxhbGW19uoHvD39FpBrXfG5lY= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 6ee68f66-d65f-4236-b5da-08d6f54f284e X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2019 07:16:05.5009 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eugen.hristev@microchip.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1802 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Eugen Hristev Add compatible for new Microchip SoC, sam9x60 Signed-off-by: Eugen Hristev --- Documentation/devicetree/bindings/i2c/i2c-at91.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-at91.txt b/Documentation/devicetree/bindings/i2c/i2c-at91.txt index b7cec17..2210f43 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-at91.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-at91.txt @@ -3,7 +3,8 @@ I2C for Atmel platforms Required properties : - compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c", "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c", - "atmel,at91sam9x5-i2c", "atmel,sama5d4-i2c" or "atmel,sama5d2-i2c" + "atmel,at91sam9x5-i2c", "atmel,sama5d4-i2c", "atmel,sama5d2-i2c" or + "microchip,sam9x60-i2c" - reg: physical base address of the controller and length of memory mapped region. - interrupts: interrupt number to the cpu. From patchwork Thu Jun 20 07:16:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 1119234 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="PhN4sG78"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45TtRY1MTxz9s9y for ; Thu, 20 Jun 2019 17:16:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726351AbfFTHQo (ORCPT ); Thu, 20 Jun 2019 03:16:44 -0400 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:32239 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfFTHQo (ORCPT ); Thu, 20 Jun 2019 03:16:44 -0400 Received-SPF: Pass (esa1.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa1.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com a:mx1.microchip.iphmx.com a:mx2.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa1.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa1.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa1.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com X-IronPort-AV: E=Sophos;i="5.63,396,1557212400"; d="scan'208";a="39721222" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Jun 2019 00:16:38 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 20 Jun 2019 00:16:11 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 20 Jun 2019 00:16:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MpHS0J5OsHpYij8HC+sB0AGII92NtqEih9oHcnfEpxM=; b=PhN4sG784d+S04jseLn7PLzTuwz6Wapmq+bV5nkqr6pzWvaT0iM35cjOmU5ZapsqFHS3XtN7a0hnL3bptVMhDCU8pfreQW1v/Rhw6TBEqSeZeOpG5cqidHCofmru72E/BWANC89QCpCaZFcjH/k7uxaWo53WX2S7i3sfytJ2RoM= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1802.namprd11.prod.outlook.com (10.175.87.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.12; Thu, 20 Jun 2019 07:16:11 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322%9]) with mapi id 15.20.1987.014; Thu, 20 Jun 2019 07:16:11 +0000 From: To: , , , , , , , , , CC: Subject: [PATCH 2/5] i2c: at91: add new platform support for sam9x60 Thread-Topic: [PATCH 2/5] i2c: at91: add new platform support for sam9x60 Thread-Index: AQHVJzgI/tU6YnJNJ068U+d2AuEWdQ== Date: Thu, 20 Jun 2019 07:16:09 +0000 Message-ID: <1561014676-22446-2-git-send-email-eugen.hristev@microchip.com> References: <1561014676-22446-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1561014676-22446-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: ro-RO, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P195CA0054.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::43) To DM5PR11MB1242.namprd11.prod.outlook.com (2603:10b6:3:14::8) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d110d672-06a8-4906-cf9a-08d6f54f2ae3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:DM5PR11MB1802; x-ms-traffictypediagnostic: DM5PR11MB1802: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2657; x-forefront-prvs: 0074BBE012 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(136003)(346002)(366004)(39860400002)(189003)(199004)(64756008)(73956011)(305945005)(3846002)(66556008)(8676002)(71200400001)(8936002)(81156014)(81166006)(66446008)(186003)(36756003)(110136005)(50226002)(2616005)(76176011)(446003)(476003)(53936002)(102836004)(71190400001)(52116002)(14454004)(2501003)(107886003)(99286004)(26005)(316002)(2906002)(6486002)(11346002)(6506007)(386003)(486006)(256004)(66066001)(2201001)(68736007)(66946007)(6116002)(478600001)(7736002)(72206003)(6512007)(4326008)(25786009)(6436002)(4744005)(66476007)(86362001)(5660300002)(138113003)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR11MB1802; H:DM5PR11MB1242.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: vmcP6ir8MjAcIP+8hVcuViUkOejPBxcT9NPJufhswU2riKnDzWC3QFTUpxd+5oOcMXIE9TzAtK9TWNYYLcaswLTPLhXskZUCd5Fq8znonA8iD3xgVUNWoKnsNbUIfWcLCIQ4Nw/htPz9F5/ZnX3SPvcIhkstO1kuQ7F7r4FDP2om0NVXflKyn2LJjIMlwULJUzXPq9/NpBpKJmxhHVWdoqA8w7WpO+Kc8Zhcys/BfqLBvkjcx+JeFoxyp2ymLFT/n2dErxBV2emqcy8X86gcQZNCOTHf8GcWDS8Fh+RDjE7X+xEtvuood7H8KZIKs1TH59RBBZDfLOPfwVknDQWW2bIkiRGSl2r2Ej9fO7DSEqRPqrrOh2Ge+HU9b00J6q1ZkFmB3CD/UXHloHo2ipHeW/jcZ0R2jhl750ZbkR5rTnU= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d110d672-06a8-4906-cf9a-08d6f54f2ae3 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2019 07:16:10.1277 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eugen.hristev@microchip.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1802 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Eugen Hristev Add new platform data support for the sam9x60 SoC Signed-off-by: Eugen Hristev --- drivers/i2c/busses/i2c-at91-core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c index 8d55cdd..a663a7a 100644 --- a/drivers/i2c/busses/i2c-at91-core.c +++ b/drivers/i2c/busses/i2c-at91-core.c @@ -148,6 +148,14 @@ static struct at91_twi_pdata sama5d2_config = { .has_hold_field = true, }; +static struct at91_twi_pdata sam9x60_config = { + .clk_max_div = 7, + .clk_offset = 4, + .has_unre_flag = true, + .has_alt_cmd = true, + .has_hold_field = true, +}; + static const struct of_device_id atmel_twi_dt_ids[] = { { .compatible = "atmel,at91rm9200-i2c", @@ -174,6 +182,9 @@ static const struct of_device_id atmel_twi_dt_ids[] = { .compatible = "atmel,sama5d2-i2c", .data = &sama5d2_config, }, { + .compatible = "microchip,sam9x60-i2c", + .data = &sam9x60_config, + }, { /* sentinel */ } }; From patchwork Thu Jun 20 07:16:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 1119231 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="kkN0S/k1"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45TtQw3yFFz9s5c for ; Thu, 20 Jun 2019 17:16:24 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726353AbfFTHQY (ORCPT ); Thu, 20 Jun 2019 03:16:24 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:43228 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbfFTHQX (ORCPT ); Thu, 20 Jun 2019 03:16:23 -0400 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com a:mx1.microchip.iphmx.com a:mx2.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com X-IronPort-AV: E=Sophos;i="5.63,396,1557212400"; d="scan'208";a="38158413" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Jun 2019 00:16:22 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.87.151) by chn-vm-ex04.mchp-main.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 20 Jun 2019 00:16:14 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 20 Jun 2019 00:16:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cN+5xsPEDLvxd8OuF3X+j6jVmD8gBhULlm1qLztT5mk=; b=kkN0S/k10QazR8rIZGQZ74r1ak7JCCsZzQOVCCHnYPyNVEHThh2LNajPGMggXipbxzpdLlrbOz5OC551p5i+lvAdAxKm1DMW9Gf0gPSsV0MQhdtn8x70/4ieAnGvtgjRXH9yY5sOGEGHyG2qD7wHueVm0+ijPk1DbM+7UQYTuc4= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1802.namprd11.prod.outlook.com (10.175.87.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.12; Thu, 20 Jun 2019 07:16:13 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322%9]) with mapi id 15.20.1987.014; Thu, 20 Jun 2019 07:16:13 +0000 From: To: , , , , , , , , , CC: Subject: [PATCH 3/5] i2c: at91: add support for digital filtering Thread-Topic: [PATCH 3/5] i2c: at91: add support for digital filtering Thread-Index: AQHVJzgKQnaxfk8mV0C5xiMA7uCgiQ== Date: Thu, 20 Jun 2019 07:16:13 +0000 Message-ID: <1561014676-22446-3-git-send-email-eugen.hristev@microchip.com> References: <1561014676-22446-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1561014676-22446-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: ro-RO, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P195CA0054.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::43) To DM5PR11MB1242.namprd11.prod.outlook.com (2603:10b6:3:14::8) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3c40f75a-4cb1-4e70-24dd-08d6f54f2cfc x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:DM5PR11MB1802; x-ms-traffictypediagnostic: DM5PR11MB1802: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-forefront-prvs: 0074BBE012 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(136003)(346002)(366004)(39860400002)(189003)(199004)(64756008)(73956011)(305945005)(3846002)(66556008)(8676002)(71200400001)(8936002)(81156014)(81166006)(66446008)(186003)(36756003)(110136005)(50226002)(2616005)(76176011)(446003)(476003)(53936002)(102836004)(71190400001)(52116002)(14454004)(2501003)(107886003)(99286004)(26005)(316002)(2906002)(6486002)(11346002)(6506007)(386003)(486006)(256004)(66066001)(2201001)(68736007)(66946007)(6116002)(478600001)(7736002)(72206003)(6512007)(4326008)(25786009)(6436002)(66476007)(86362001)(5660300002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR11MB1802; H:DM5PR11MB1242.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: KV3Ob/RFCVpzeKMTeuQZ1p56urJTkTqgb3k4qfXA/knPgO9MvcxiyrTxNgfpey/nunHBKut1zS1UzteIgRy4L/r0iLxTkRUg2ESbsLOMTCRd+QJeshAsgVuPez6Si21cKVNRUVKlrLXn2kdyokHxGrVVClOFE8mU5hOudBBVDxT5E+ZRLsf0GUn7u0rcAzetKC3OJ1V5aoGdLKmoS82M0B39LYUePX2wmt9wc2KwiRpYmq8vWP8uSSxeBQfNufaCUSLjOwzQH8/iLH9g9h8z/glIxB98fAo7SdnoemQr1JaN9RnWkf6F9VLteK9YNvTW7IA2flAT76rmxB46+GZpkDuiwJC86IFNgKS/sLgNw9uaueSGNH+aIeFBVfakx/Zzkp86QZr0YMjkAQJo/YEWhebUIGEY8tKCVsqxGG3Q4L0= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 3c40f75a-4cb1-4e70-24dd-08d6f54f2cfc X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2019 07:16:13.4104 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eugen.hristev@microchip.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1802 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Eugen Hristev Add new platform data support for digital filtering for i2c. The sama5d4, sama5d2 and sam9x60 support this feature. Signed-off-by: Eugen Hristev --- drivers/i2c/busses/i2c-at91-core.c | 9 +++++++++ drivers/i2c/busses/i2c-at91-master.c | 6 ++++++ drivers/i2c/busses/i2c-at91.h | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c index a663a7a..62610af 100644 --- a/drivers/i2c/busses/i2c-at91-core.c +++ b/drivers/i2c/busses/i2c-at91-core.c @@ -68,6 +68,7 @@ static struct at91_twi_pdata at91rm9200_config = { .has_unre_flag = true, .has_alt_cmd = false, .has_hold_field = false, + .has_dig_filtr = false, }; static struct at91_twi_pdata at91sam9261_config = { @@ -76,6 +77,7 @@ static struct at91_twi_pdata at91sam9261_config = { .has_unre_flag = false, .has_alt_cmd = false, .has_hold_field = false, + .has_dig_filtr = false, }; static struct at91_twi_pdata at91sam9260_config = { @@ -84,6 +86,7 @@ static struct at91_twi_pdata at91sam9260_config = { .has_unre_flag = false, .has_alt_cmd = false, .has_hold_field = false, + .has_dig_filtr = false, }; static struct at91_twi_pdata at91sam9g20_config = { @@ -92,6 +95,7 @@ static struct at91_twi_pdata at91sam9g20_config = { .has_unre_flag = false, .has_alt_cmd = false, .has_hold_field = false, + .has_dig_filtr = false, }; static struct at91_twi_pdata at91sam9g10_config = { @@ -100,6 +104,7 @@ static struct at91_twi_pdata at91sam9g10_config = { .has_unre_flag = false, .has_alt_cmd = false, .has_hold_field = false, + .has_dig_filtr = false, }; static const struct platform_device_id at91_twi_devtypes[] = { @@ -130,6 +135,7 @@ static struct at91_twi_pdata at91sam9x5_config = { .has_unre_flag = false, .has_alt_cmd = false, .has_hold_field = false, + .has_dig_filtr = false, }; static struct at91_twi_pdata sama5d4_config = { @@ -138,6 +144,7 @@ static struct at91_twi_pdata sama5d4_config = { .has_unre_flag = false, .has_alt_cmd = false, .has_hold_field = true, + .has_dig_filtr = true, }; static struct at91_twi_pdata sama5d2_config = { @@ -146,6 +153,7 @@ static struct at91_twi_pdata sama5d2_config = { .has_unre_flag = true, .has_alt_cmd = true, .has_hold_field = true, + .has_dig_filtr = true, }; static struct at91_twi_pdata sam9x60_config = { @@ -154,6 +162,7 @@ static struct at91_twi_pdata sam9x60_config = { .has_unre_flag = true, .has_alt_cmd = true, .has_hold_field = true, + .has_dig_filtr = true, }; static const struct of_device_id atmel_twi_dt_ids[] = { diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c index e87232f..366e90f 100644 --- a/drivers/i2c/busses/i2c-at91-master.c +++ b/drivers/i2c/busses/i2c-at91-master.c @@ -31,12 +31,18 @@ void at91_init_twi_bus_master(struct at91_twi_dev *dev) { + struct at91_twi_pdata *pdata = dev->pdata; + /* FIFO should be enabled immediately after the software reset */ if (dev->fifo_size) at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_FIFOEN); at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_MSEN); at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_SVDIS); at91_twi_write(dev, AT91_TWI_CWGR, dev->twi_cwgr_reg); + + /* enable digital filter */ + if (pdata->has_dig_filtr) + at91_twi_write(dev, AT91_TWI_FILTR, AT91_TWI_FILTR_FILT); } /* diff --git a/drivers/i2c/busses/i2c-at91.h b/drivers/i2c/busses/i2c-at91.h index 499b506..3e80811 100644 --- a/drivers/i2c/busses/i2c-at91.h +++ b/drivers/i2c/busses/i2c-at91.h @@ -84,6 +84,9 @@ #define AT91_TWI_ACR_DATAL(len) ((len) & 0xff) #define AT91_TWI_ACR_DIR BIT(8) +#define AT91_TWI_FILTR 0x0044 +#define AT91_TWI_FILTR_FILT BIT(0) + #define AT91_TWI_FMR 0x0050 /* FIFO Mode Register */ #define AT91_TWI_FMR_TXRDYM(mode) (((mode) & 0x3) << 0) #define AT91_TWI_FMR_TXRDYM_MASK (0x3 << 0) @@ -108,6 +111,7 @@ struct at91_twi_pdata { bool has_unre_flag; bool has_alt_cmd; bool has_hold_field; + bool has_dig_filtr; struct at_dma_slave dma_slave; }; From patchwork Thu Jun 20 07:16:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 1119232 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="H8cgh2GA"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45TtR26n0wz9s9y for ; Thu, 20 Jun 2019 17:16:30 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730858AbfFTHQY (ORCPT ); Thu, 20 Jun 2019 03:16:24 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:43228 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfFTHQY (ORCPT ); Thu, 20 Jun 2019 03:16:24 -0400 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com a:mx1.microchip.iphmx.com a:mx2.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com X-IronPort-AV: E=Sophos;i="5.63,396,1557212400"; d="scan'208";a="38158416" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Jun 2019 00:16:23 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.87.71) by chn-vm-ex04.mchp-main.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 20 Jun 2019 00:16:17 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 20 Jun 2019 00:16:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=my+DQ0e+0Z+tOf376xw4mzsosx+Xxq4CzM2hvpyQs+s=; b=H8cgh2GAKSEL5QHFo6m+C5yvGrjAXHx96uKt2ZLTK26jy9BzrK4S35JccKt/szUOaEyOGc6NInRH2y/BTow1kEqzhQ/a9dGKW2CkE6mxehBhSIMxj7hrNZdc7ZKYgfriIdEbxembiVabzjsfCKfjh6jfx8r/w6wes7xaKs4L3vs= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1802.namprd11.prod.outlook.com (10.175.87.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.12; Thu, 20 Jun 2019 07:16:16 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322%9]) with mapi id 15.20.1987.014; Thu, 20 Jun 2019 07:16:16 +0000 From: To: , , , , , , , , , CC: Subject: [PATCH 4/5] i2c: at91: add support for advanced digital filtering Thread-Topic: [PATCH 4/5] i2c: at91: add support for advanced digital filtering Thread-Index: AQHVJzgMLxo/gDUwhUutQfkQdWnHNA== Date: Thu, 20 Jun 2019 07:16:16 +0000 Message-ID: <1561014676-22446-4-git-send-email-eugen.hristev@microchip.com> References: <1561014676-22446-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1561014676-22446-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: ro-RO, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P195CA0054.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::43) To DM5PR11MB1242.namprd11.prod.outlook.com (2603:10b6:3:14::8) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c5d83e54-05cf-4326-adb4-08d6f54f2f03 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:DM5PR11MB1802; x-ms-traffictypediagnostic: DM5PR11MB1802: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 0074BBE012 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(136003)(346002)(366004)(39860400002)(189003)(199004)(64756008)(73956011)(305945005)(3846002)(66556008)(8676002)(71200400001)(8936002)(81156014)(81166006)(66446008)(186003)(36756003)(110136005)(50226002)(2616005)(76176011)(446003)(476003)(53936002)(102836004)(71190400001)(52116002)(14454004)(2501003)(107886003)(99286004)(26005)(316002)(2906002)(6486002)(11346002)(6506007)(386003)(486006)(256004)(66066001)(2201001)(68736007)(66946007)(6116002)(478600001)(7736002)(72206003)(6512007)(4326008)(25786009)(6436002)(66476007)(86362001)(5660300002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR11MB1802; H:DM5PR11MB1242.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: nrMab4+kN/kniizX1GbeoI5aOt+MtZjz4/0Z9AilNDC+C6oAIxi4EMbENTS4oh+MWcCi+sAqLcckb4ri2hXBdnalDf+l+RTxYwyORPUgGeeMv4IwQWoif6dnevEddJdnU3uWV4hRFyCkEHKp7pz1xuitnE1RCaSlczY23EhjVP8V5aiAD+5N5ZZTEQjOaggTKbz+Fb8Ct8aNk6GWAKjyQMwQTHuRodNEdJ3UDoIsHlmnzBTCRRtZm1zSVNSlXukBfYtRnHCQnypaSewzxaQVInEEPmgdtGcgIJbfu1/g5SDrN5cEmrrv8mRrl4tYfd6VsJyFuucJyi6vKX3JY3D93pl+dpn8JzQlpYRN7uasm4TfiAKJthbR73vLIYr//oMuEn3vETlumcpHB/YArJhKUnMbyxIcvb0Y488ZQT4T36M= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c5d83e54-05cf-4326-adb4-08d6f54f2f03 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2019 07:16:16.3528 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eugen.hristev@microchip.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1802 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Eugen Hristev Add new platform data support for advanced digital filtering for i2c. The sama5d2 and sam9x60 support this feature. This digital filter allows the user to configure the maximum width of the spikes that can be filtered. Signed-off-by: Eugen Hristev --- drivers/i2c/busses/i2c-at91-core.c | 9 +++++++++ drivers/i2c/busses/i2c-at91-master.c | 6 ++++++ drivers/i2c/busses/i2c-at91.h | 3 +++ 3 files changed, 18 insertions(+) diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c index 62610af..3bbe37c 100644 --- a/drivers/i2c/busses/i2c-at91-core.c +++ b/drivers/i2c/busses/i2c-at91-core.c @@ -69,6 +69,7 @@ static struct at91_twi_pdata at91rm9200_config = { .has_alt_cmd = false, .has_hold_field = false, .has_dig_filtr = false, + .has_adv_dig_filtr = false, }; static struct at91_twi_pdata at91sam9261_config = { @@ -78,6 +79,7 @@ static struct at91_twi_pdata at91sam9261_config = { .has_alt_cmd = false, .has_hold_field = false, .has_dig_filtr = false, + .has_adv_dig_filtr = false, }; static struct at91_twi_pdata at91sam9260_config = { @@ -87,6 +89,7 @@ static struct at91_twi_pdata at91sam9260_config = { .has_alt_cmd = false, .has_hold_field = false, .has_dig_filtr = false, + .has_adv_dig_filtr = false, }; static struct at91_twi_pdata at91sam9g20_config = { @@ -96,6 +99,7 @@ static struct at91_twi_pdata at91sam9g20_config = { .has_alt_cmd = false, .has_hold_field = false, .has_dig_filtr = false, + .has_adv_dig_filtr = false, }; static struct at91_twi_pdata at91sam9g10_config = { @@ -105,6 +109,7 @@ static struct at91_twi_pdata at91sam9g10_config = { .has_alt_cmd = false, .has_hold_field = false, .has_dig_filtr = false, + .has_adv_dig_filtr = false, }; static const struct platform_device_id at91_twi_devtypes[] = { @@ -136,6 +141,7 @@ static struct at91_twi_pdata at91sam9x5_config = { .has_alt_cmd = false, .has_hold_field = false, .has_dig_filtr = false, + .has_adv_dig_filtr = false, }; static struct at91_twi_pdata sama5d4_config = { @@ -145,6 +151,7 @@ static struct at91_twi_pdata sama5d4_config = { .has_alt_cmd = false, .has_hold_field = true, .has_dig_filtr = true, + .has_adv_dig_filtr = false, }; static struct at91_twi_pdata sama5d2_config = { @@ -154,6 +161,7 @@ static struct at91_twi_pdata sama5d2_config = { .has_alt_cmd = true, .has_hold_field = true, .has_dig_filtr = true, + .has_adv_dig_filtr = true, }; static struct at91_twi_pdata sam9x60_config = { @@ -163,6 +171,7 @@ static struct at91_twi_pdata sam9x60_config = { .has_alt_cmd = true, .has_hold_field = true, .has_dig_filtr = true, + .has_adv_dig_filtr = true, }; static const struct of_device_id atmel_twi_dt_ids[] = { diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c index 366e90f..b9e601e 100644 --- a/drivers/i2c/busses/i2c-at91-master.c +++ b/drivers/i2c/busses/i2c-at91-master.c @@ -43,6 +43,12 @@ void at91_init_twi_bus_master(struct at91_twi_dev *dev) /* enable digital filter */ if (pdata->has_dig_filtr) at91_twi_write(dev, AT91_TWI_FILTR, AT91_TWI_FILTR_FILT); + + /* enable advanced digital filter */ + if (pdata->has_adv_dig_filtr) + at91_twi_write(dev, AT91_TWI_FILTR, AT91_TWI_FILTR_FILT | + (AT91_TWI_FILTR_THRES(7) & + AT91_TWI_FILTR_THRES_MASK)); } /* diff --git a/drivers/i2c/busses/i2c-at91.h b/drivers/i2c/busses/i2c-at91.h index 3e80811..ccf18ba 100644 --- a/drivers/i2c/busses/i2c-at91.h +++ b/drivers/i2c/busses/i2c-at91.h @@ -86,6 +86,8 @@ #define AT91_TWI_FILTR 0x0044 #define AT91_TWI_FILTR_FILT BIT(0) +#define AT91_TWI_FILTR_THRES(v) ((v) << 8) +#define AT91_TWI_FILTR_THRES_MASK GENMASK(10, 8) #define AT91_TWI_FMR 0x0050 /* FIFO Mode Register */ #define AT91_TWI_FMR_TXRDYM(mode) (((mode) & 0x3) << 0) @@ -112,6 +114,7 @@ struct at91_twi_pdata { bool has_alt_cmd; bool has_hold_field; bool has_dig_filtr; + bool has_adv_dig_filtr; struct at_dma_slave dma_slave; }; From patchwork Thu Jun 20 07:16:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 1119233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="Zkx090YD"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45TtRR1tsYz9sBp for ; Thu, 20 Jun 2019 17:16:51 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730936AbfFTHQp (ORCPT ); Thu, 20 Jun 2019 03:16:45 -0400 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:32239 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbfFTHQo (ORCPT ); Thu, 20 Jun 2019 03:16:44 -0400 Received-SPF: Pass (esa1.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa1.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com a:mx1.microchip.iphmx.com a:mx2.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa1.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa1.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa1.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com X-IronPort-AV: E=Sophos;i="5.63,396,1557212400"; d="scan'208";a="39721223" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Jun 2019 00:16:39 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 20 Jun 2019 00:16:19 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 20 Jun 2019 00:16:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sZ+/ZI2mttB38VcwyprwWQss7zYyEVesL9VDiTmclgQ=; b=Zkx090YDuFroqIhgQ+qH0+aVVggVL9iypyZqzsViEwoqC7ivWosPUa2YasKzqRGjH6rttOtKL91BSJoxC5IG8c1HmSsiukQvKhfR6LwbrsO3hZJbuf+Xbp3eULqO3NvHvz7nw0Oh0kSAGHBMuHjNVIn0WV+V40OoOUjY0io2Gfc= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1802.namprd11.prod.outlook.com (10.175.87.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.12; Thu, 20 Jun 2019 07:16:19 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::6476:ace0:bf3a:322%9]) with mapi id 15.20.1987.014; Thu, 20 Jun 2019 07:16:19 +0000 From: To: , , , , , , , , , CC: Subject: [PATCH 5/5] i2c: at91: add support for analog filtering Thread-Topic: [PATCH 5/5] i2c: at91: add support for analog filtering Thread-Index: AQHVJzgOY3GBRV9Q1Ueiq+RyIVbQng== Date: Thu, 20 Jun 2019 07:16:19 +0000 Message-ID: <1561014676-22446-5-git-send-email-eugen.hristev@microchip.com> References: <1561014676-22446-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1561014676-22446-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: ro-RO, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P195CA0054.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::43) To DM5PR11MB1242.namprd11.prod.outlook.com (2603:10b6:3:14::8) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a0129a79-d799-4faf-c2fd-08d6f54f30b6 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:DM5PR11MB1802; x-ms-traffictypediagnostic: DM5PR11MB1802: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-forefront-prvs: 0074BBE012 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(136003)(346002)(366004)(39860400002)(189003)(199004)(64756008)(73956011)(305945005)(3846002)(66556008)(8676002)(71200400001)(8936002)(81156014)(81166006)(66446008)(186003)(36756003)(110136005)(50226002)(2616005)(76176011)(446003)(476003)(53936002)(102836004)(71190400001)(52116002)(14454004)(2501003)(107886003)(99286004)(26005)(316002)(2906002)(6486002)(11346002)(6506007)(386003)(486006)(256004)(66066001)(2201001)(68736007)(66946007)(6116002)(478600001)(7736002)(72206003)(6512007)(4326008)(25786009)(6436002)(66476007)(86362001)(5660300002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR11MB1802; H:DM5PR11MB1242.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: RXlWfQ+FWkeCSx/L7YeAU1pZYMEK/QNwKsJmd6stTAWabW+uBedx6ZOl/kKA6Zssmz5LImpU8T41jDM09ImTqevszaQWFQdGFO3/GaS89a382YLmKlEEyV6/vx7RsgX7/Xum1MMUi8tdAtxb/3/Sx4GlT2/THVOOtJ8MreGkCkwJ+z6Rjvszf8mBhQxBgNtjH72MTsZTgFrA/rS76qqHJ2Y24eF5FcZcWOAm8mV+ZXaphweU47D/BtKp0SGwcAjdy8nc2u0P5i9rYN2A/DCcXaVMEJjNhpjuYoTy6/TLnjEFBm6IFULxBLREph+Q8KD60A61cozKE3A+hc5zwU8Qq5Syo1kCC9HKWkvaGlbGEIdoaVqaml9v8fyjn/7KSVOEZ0i8AOzNsJlEVeJExXzZGZTk8oBB0/gnv2InbmHmmcQ= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a0129a79-d799-4faf-c2fd-08d6f54f30b6 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2019 07:16:19.3743 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eugen.hristev@microchip.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1802 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Eugen Hristev Add new platform data support for analog filtering for i2c. The sama5d2 and sam9x60 support this feature. Signed-off-by: Eugen Hristev --- drivers/i2c/busses/i2c-at91-core.c | 9 +++++++++ drivers/i2c/busses/i2c-at91-master.c | 15 +++++++++++---- drivers/i2c/busses/i2c-at91.h | 3 +++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c index 3bbe37c..d2840ba 100644 --- a/drivers/i2c/busses/i2c-at91-core.c +++ b/drivers/i2c/busses/i2c-at91-core.c @@ -70,6 +70,7 @@ static struct at91_twi_pdata at91rm9200_config = { .has_hold_field = false, .has_dig_filtr = false, .has_adv_dig_filtr = false, + .has_ana_filtr = false, }; static struct at91_twi_pdata at91sam9261_config = { @@ -80,6 +81,7 @@ static struct at91_twi_pdata at91sam9261_config = { .has_hold_field = false, .has_dig_filtr = false, .has_adv_dig_filtr = false, + .has_ana_filtr = false, }; static struct at91_twi_pdata at91sam9260_config = { @@ -90,6 +92,7 @@ static struct at91_twi_pdata at91sam9260_config = { .has_hold_field = false, .has_dig_filtr = false, .has_adv_dig_filtr = false, + .has_ana_filtr = false, }; static struct at91_twi_pdata at91sam9g20_config = { @@ -100,6 +103,7 @@ static struct at91_twi_pdata at91sam9g20_config = { .has_hold_field = false, .has_dig_filtr = false, .has_adv_dig_filtr = false, + .has_ana_filtr = false, }; static struct at91_twi_pdata at91sam9g10_config = { @@ -110,6 +114,7 @@ static struct at91_twi_pdata at91sam9g10_config = { .has_hold_field = false, .has_dig_filtr = false, .has_adv_dig_filtr = false, + .has_ana_filtr = false, }; static const struct platform_device_id at91_twi_devtypes[] = { @@ -142,6 +147,7 @@ static struct at91_twi_pdata at91sam9x5_config = { .has_hold_field = false, .has_dig_filtr = false, .has_adv_dig_filtr = false, + .has_ana_filtr = false, }; static struct at91_twi_pdata sama5d4_config = { @@ -152,6 +158,7 @@ static struct at91_twi_pdata sama5d4_config = { .has_hold_field = true, .has_dig_filtr = true, .has_adv_dig_filtr = false, + .has_ana_filtr = false, }; static struct at91_twi_pdata sama5d2_config = { @@ -162,6 +169,7 @@ static struct at91_twi_pdata sama5d2_config = { .has_hold_field = true, .has_dig_filtr = true, .has_adv_dig_filtr = true, + .has_ana_filtr = true, }; static struct at91_twi_pdata sam9x60_config = { @@ -172,6 +180,7 @@ static struct at91_twi_pdata sam9x60_config = { .has_hold_field = true, .has_dig_filtr = true, .has_adv_dig_filtr = true, + .has_ana_filtr = true, }; static const struct of_device_id atmel_twi_dt_ids[] = { diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c index b9e601e..6b591ac 100644 --- a/drivers/i2c/busses/i2c-at91-master.c +++ b/drivers/i2c/busses/i2c-at91-master.c @@ -32,6 +32,7 @@ void at91_init_twi_bus_master(struct at91_twi_dev *dev) { struct at91_twi_pdata *pdata = dev->pdata; + u32 filtr = 0; /* FIFO should be enabled immediately after the software reset */ if (dev->fifo_size) @@ -42,13 +43,19 @@ void at91_init_twi_bus_master(struct at91_twi_dev *dev) /* enable digital filter */ if (pdata->has_dig_filtr) - at91_twi_write(dev, AT91_TWI_FILTR, AT91_TWI_FILTR_FILT); + filtr |= AT91_TWI_FILTR_FILT; /* enable advanced digital filter */ if (pdata->has_adv_dig_filtr) - at91_twi_write(dev, AT91_TWI_FILTR, AT91_TWI_FILTR_FILT | - (AT91_TWI_FILTR_THRES(7) & - AT91_TWI_FILTR_THRES_MASK)); + filtr |= AT91_TWI_FILTR_FILT | + (AT91_TWI_FILTR_THRES(7) & AT91_TWI_FILTR_THRES_MASK); + + /* enable analog filter */ + if (pdata->has_ana_filtr) + filtr |= AT91_TWI_FILTR_PADFEN | AT91_TWI_FILTR_PADFCFG; + + if (filtr) + at91_twi_write(dev, AT91_TWI_FILTR, filtr); } /* diff --git a/drivers/i2c/busses/i2c-at91.h b/drivers/i2c/busses/i2c-at91.h index ccf18ba..f009799 100644 --- a/drivers/i2c/busses/i2c-at91.h +++ b/drivers/i2c/busses/i2c-at91.h @@ -86,6 +86,8 @@ #define AT91_TWI_FILTR 0x0044 #define AT91_TWI_FILTR_FILT BIT(0) +#define AT91_TWI_FILTR_PADFEN BIT(1) +#define AT91_TWI_FILTR_PADFCFG BIT(2) #define AT91_TWI_FILTR_THRES(v) ((v) << 8) #define AT91_TWI_FILTR_THRES_MASK GENMASK(10, 8) @@ -115,6 +117,7 @@ struct at91_twi_pdata { bool has_hold_field; bool has_dig_filtr; bool has_adv_dig_filtr; + bool has_ana_filtr; struct at_dma_slave dma_slave; };