From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 24FF7A0545 for ; Wed, 15 Jul 2020 13:21:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1A8F03B5; Wed, 15 Jul 2020 13:21:31 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 00B481BEDC; Wed, 15 Jul 2020 13:21:28 +0200 (CEST) IronPort-SDR: mAvQrI8GlN5L6DFKbKx6DM8IMmab0t4THQxV7ViJ2/bchXTGFoBMIZIBkBn038qpf0xl6q3ynu axraY+e29e8A== X-IronPort-AV: E=McAfee;i="6000,8403,9682"; a="167242504" X-IronPort-AV: E=Sophos;i="5.75,355,1589266800"; d="scan'208";a="167242504" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2020 04:21:27 -0700 IronPort-SDR: 3yV3D85eWRPmVudlTTHnMkSFHiDlo4PpOau7YpQowU8T434DNwH/vGwaRWY6FADy2P9rX5I2me 2mOyQfIm14Ww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,355,1589266800"; d="scan'208";a="286076732" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 15 Jul 2020 04:21:27 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 15 Jul 2020 04:21:26 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 15 Jul 2020 04:21:26 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.58) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 15 Jul 2020 04:21:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VgcLWTToCpllapiM8ieBKfXxWxjhu96sgqXlBexTtvStBgMY2e+h/8yULlL72sWc5dd/mloO5w31/J6CA1Lf7vHtkDwwoMlzN7yVDOWa6e38CvjicVKEocfBrp8SjlGX3m+UVNc5dscJ1FX0UwpsIBZ//B9aCF6SiafeTwoYpzxRibsHWm/qp7q2W5VcWdjy+Y09WM1i56rn2VXtrWbEUoARzgx+Stf0CwWtS/znXUxcK5bcdSIvitJpLA2E0wwaZIu8JJncz9tmQjpPUtBqkfrd1tCoYLW+Y39OoBa+EXgISuVAbz3YP2K+/HxpVHR+dViofdhxafVZX6cnrlPO0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VEaWUR5X2gULyY80OQn5QEl5Vpv/FaP0rfvKVKpt/jc=; b=UzWLqyhMPfNZNW3h+EUOpDOQHrbiOECn6NyKjWfMrbhF68KW60ie/VirZdQdlH/HJ4fHEDnbj3FXnvQSBUbCfhHvZEY+re7zcsXZxSTWvrf//Ho3EKB6EptBftekc1KkLvDJ17HfiO6H8O9LDCd7UFbbqUjZS5tn5pKv+OlHZ7R5nl2smZvnPn0Qp5QykhEhzr6zeA51u9UK/NS8i+Q/Z9ejWeyS/VB7u5o53idzGJQxDhkoGZ+mTHPp7hn6Pjod3Bgiy1ABgH8Hvqbie7UomAw8KdyT7b9pHGpTBJKTBKG50ghTKJ7Yl0iL/zZeT0FOv0z3pQQWwrLStkjhvhA/DQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VEaWUR5X2gULyY80OQn5QEl5Vpv/FaP0rfvKVKpt/jc=; b=yTg7TzHnDBFBwv1MdGsMlFAPPAfiVtkX6cJ9ugsU8Gq1N5HOCqvQ2uY9zEAwv4RSWVjjHl9f3cPl7+3DIratZcJGRdz60+YPGF6NT/VYsY8V2bnZfBctImjF+53SkgjzQQQYUtzzr3kzT7k6YWm0cuENRyt9A8Ffp8Ldztc1SDw= Received: from BYAPR11MB2901.namprd11.prod.outlook.com (2603:10b6:a03:91::23) by BYAPR11MB2808.namprd11.prod.outlook.com (2603:10b6:a02:c8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.23; Wed, 15 Jul 2020 11:21:25 +0000 Received: from BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::6552:92f9:74a5:412]) by BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::6552:92f9:74a5:412%4]) with mapi id 15.20.3174.026; Wed, 15 Jul 2020 11:21:25 +0000 From: "Xu, Rosen" To: "Zhang, Tianfei" , "dev@dpdk.org" CC: "stable@dpdk.org" Thread-Topic: [PATCH v3 2/2] raw/ifpga/base: fix NIOS SPI initial Thread-Index: AQHWWeU4ajLTVWefO0Gu7hi5PuQS26kIgE6Q Date: Wed, 15 Jul 2020 11:21:24 +0000 Message-ID: References: <20200709163553.8677-1-tianfei.zhang@intel.com> <20200714213509.13650-1-tianfei.zhang@intel.com> <20200714213509.13650-2-tianfei.zhang@intel.com> In-Reply-To: <20200714213509.13650-2-tianfei.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.45] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dc62b299-576b-4577-d441-08d828b135dd x-ms-traffictypediagnostic: BYAPR11MB2808: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2958; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XxPiDH1fooDvcU9d3Q+2uo0gzwHiQvW0xll5AKKoxcQh/nP0PW13BM6lcnYfP5GorQrsO0gL83Dkgme4YaxA68V7suKBnVI3UWI/stMVjbkTGYkeSbkivctd1bI0r2kzY2pA0yErt23Oj1dhq2lK/+Zdm3b2JDnnRDer8ITrHeOsa50+YFaevHMxQlqKtGW361Hmta5eRSmq07/KGoS43QRARExh+rxSwrccYSwJw+d+fz5gW9Gmy2Lq+48eJrVmu2s6VLq8nKX58icgLmDD5/03cdm5GV91N413kYBufZPkTUIwa7wy42RhtMG+D9xuXpPUfqa1kA87s01fbI/c7Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB2901.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(366004)(39860400002)(376002)(346002)(136003)(316002)(8676002)(110136005)(186003)(9686003)(55016002)(71200400001)(2906002)(33656002)(478600001)(86362001)(450100002)(4326008)(7696005)(83380400001)(26005)(6506007)(53546011)(64756008)(76116006)(66556008)(66946007)(52536014)(5660300002)(66476007)(8936002)(66446008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: xqlk6Bj+IrGsdPLfO1glXNBy0p5TCfdbYXPSokZD2yQYrjuim0OaFIDlYhBAvFOeaLjlA59KLgjR3r4qIRvqUCV4G+M9jtt49OHU7sZnaVBX5Ovx62Gq7ujDN3Nh/laqRKR2kNR79zUvPbje5LOTLQHHQWyOWzdW4VbeFy5xcy9uOF0bwJmp4PjtpxI0MdjTmWY/6AS8vFk9g/jzfjNEpEXTvglU2S+RrdrFpXQtb/XcVy/EeM7xnoADXBWfOtustdLzUnGRpE6VOx4U4iuwblWdi+kd/di8LdPtagqfdDlvtIzL03OdyRL3x7ykmH4h3bEICHMyNuDS4xmB1Nh+l0lSllHmK3b/RgZceNd6cbM75k0I/8T0AOKJWS7ndzrID+VygC+ipqNGsUwFKSdAWF0NgnVFe3Yg89R1plNwx5sfXE7BuIXTDGAndTyVjtq1XiiZiixLHVUSFWfxILINZujOdnEzuyaRKZnS1j0VVIS9PjCvmIP8gWb2xIH7feHB Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB2901.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc62b299-576b-4577-d441-08d828b135dd X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jul 2020 11:21:24.8539 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: DWEIPkeCsugqbwFATPjyVgCYqD5H5vb4/S4RC5uKCXivPYdETAT09NJO/PCbMZwQGH761uvozwdCcgV/KeJo2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2808 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [PATCH v3 2/2] raw/ifpga/base: fix NIOS SPI initial X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" -----Original Message----- From: Zhang, Tianfei =20 Sent: Wednesday, July 15, 2020 5:35 AM To: dev@dpdk.org; Xu, Rosen Cc: Zhang, Tianfei ; stable@dpdk.org Subject: [PATCH v3 2/2] raw/ifpga/base: fix NIOS SPI initial From: Tianfei Zhang Add fecmode setting on NIOS SPI primary initialization. this SPI is shared by NIOS core inside FPGA, NIOS will use this SPI primary= to do some one-time initialization after power up, and then release the co= ntrol to DPDK. Fix the timeout initialization for polling the NIOS_INIT_DONE. Fixes: bc44402f ("raw/ifpga/base: configure FEC mode") Cc: stable@dpdk.org Signed-off-by: Tianfei Zhang --- v3: resend the patch with threaded option for git send-email v2: fix coding style issue --- drivers/raw/ifpga/base/ifpga_fme.c | 27 ++++++++++++++++++++------- drive= rs/raw/ifpga/base/opae_spi.h | 1 + 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/raw/ifpga/base/ifpga_fme.c b/drivers/raw/ifpga/base/if= pga_fme.c index c31a94cf8..9057087b5 100644 --- a/drivers/raw/ifpga/base/ifpga_fme.c +++ b/drivers/raw/ifpga/base/ifpga_fme.c @@ -979,28 +979,32 @@ struct ifpga_feature_ops fme_spi_master_ops =3D { st= atic int nios_spi_wait_init_done(struct altera_spi_device *dev) { u32 val =3D 0; - unsigned long timeout =3D msecs_to_timer_cycles(10000); + unsigned long timeout =3D rte_get_timer_cycles() + + msecs_to_timer_cycles(10000); unsigned long ticks; int major_version; + int fecmode =3D FEC_MODE_NO; =20 if (spi_reg_read(dev, NIOS_VERSION, &val)) return -EIO; =20 - major_version =3D (val >> NIOS_VERSION_MAJOR_SHIFT) & - NIOS_VERSION_MAJOR; - dev_debug(dev, "A10 NIOS FW version %d\n", major_version); + major_version =3D + (val & NIOS_VERSION_MAJOR) >> NIOS_VERSION_MAJOR_SHIFT; + dev_info(dev, "A10 NIOS FW version %d\n", major_version); =20 if (major_version >=3D 3) { /* read NIOS_INIT to check if PKVL INIT done or not */ if (spi_reg_read(dev, NIOS_INIT, &val)) return -EIO; =20 + dev_debug(dev, "read NIOS_INIT: 0x%x\n", val); + /* check if PKVLs are initialized already */ if (val & NIOS_INIT_DONE || val & NIOS_INIT_START) goto nios_init_done; =20 /* start to config the default FEC mode */ - val =3D NIOS_INIT_START; + val =3D fecmode | NIOS_INIT_START; =20 if (spi_reg_write(dev, NIOS_INIT, val)) return -EIO; @@ -1010,14 +1014,23 @@ static int nios_spi_wait_init_done(struct altera_sp= i_device *dev) do { if (spi_reg_read(dev, NIOS_INIT, &val)) return -EIO; - if (val) + if (val & NIOS_INIT_DONE) break; =20 ticks =3D rte_get_timer_cycles(); if (time_after(ticks, timeout)) return -ETIMEDOUT; msleep(100); - } while (!val); + } while (1); + + /* get the fecmode */ + if (spi_reg_read(dev, NIOS_INIT, &val)) + return -EIO; + dev_debug(dev, "read NIOS_INIT: 0x%x\n", val); + fecmode =3D (val & REQ_FEC_MODE) >> REQ_FEC_MODE_SHIFT; + dev_info(dev, "fecmode: 0x%x, %s\n", fecmode, + (fecmode =3D=3D FEC_MODE_KR) ? "kr" : + ((fecmode =3D=3D FEC_MODE_RS) ? "rs" : "no")); =20 return 0; } diff --git a/drivers/raw/ifpga/base/opae_spi.h b/drivers/raw/ifpga/base/opa= e_spi.h index d20a4c3ed..73a227673 100644 --- a/drivers/raw/ifpga/base/opae_spi.h +++ b/drivers/raw/ifpga/base/opae_spi.h @@ -153,6 +153,7 @@ int spi_reg_read(struct altera_spi_device *dev, u32 reg= , u32 *val); =20 #define NIOS_INIT 0x1000 #define REQ_FEC_MODE GENMASK(23, 8) +#define REQ_FEC_MODE_SHIFT 8 #define FEC_MODE_NO 0x0 #define FEC_MODE_KR 0x5555 #define FEC_MODE_RS 0xaaaa -- 2.17.1 Acked-by: Rosen Xu