Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937868AbdCJOWS (ORCPT ); Fri, 10 Mar 2017 09:22:18 -0500 Received: from mail-sn1nam02on0068.outbound.protection.outlook.com ([104.47.36.68]:56592 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936268AbdCJOWO (ORCPT ); Fri, 10 Mar 2017 09:22:14 -0500 From: Artur Jedrysek To: Marek Vasut , "linux-mtd@lists.infradead.org" CC: "linux-kernel@vger.kernel.org" , Cyrille Pitchen , David Woodhouse , Brian Norris , Boris Brezillon , Richard Weinberger , Dinh Nguyen Subject: RE: [v2, 2/4] mtd: spi-nor: Add Octal SPI support to Cadence QSPI driver. Thread-Topic: [v2, 2/4] mtd: spi-nor: Add Octal SPI support to Cadence QSPI driver. Thread-Index: AQHSl+J0sYoB0K7MN0ue0U4PecUqKKGNb3QAgACJu8CAABCVAIAAE1aggAAEmICAAAGO0A== Date: Fri, 10 Mar 2017 14:22:11 +0000 Message-ID: References: <1488959932-6657-1-git-send-email-jartur@cadence.com> <1488960178-11079-1-git-send-email-jartur@cadence.com> <891f9177-e03c-85e0-ebab-2dc7df2ce9e0@gmail.com> <8315061c-716d-89c9-3f04-687b48fbac22@gmail.com> <23371579-495a-1336-cce9-3860a2e2a4c1@gmail.com> In-Reply-To: <23371579-495a-1336-cce9-3860a2e2a4c1@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-dg-ref: PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNcamFydHVyXGFwcGRhdGFccm9hbWluZ1wwOWQ4NDliNi0zMmQzLTRhNDAtODVlZS02Yjg0YmEyOWUzNWJcbXNnc1xtc2ctZjIxYzk3MTUtMDU5Yy0xMWU3LWJlMjktMjhkMjQ0YjA2ODYyXGFtZS10ZXN0XGYyMWM5NzE3LTA1OWMtMTFlNy1iZTI5LTI4ZDI0NGIwNjg2MmJvZHkudHh0IiBzej0iMjc2MiIgdD0iMTMxMzM2MjkzMzAzMzk4NDg1IiBoPSJjVituZGkwWnd5ZXEyZUp2VDl5b3dVcmVkM2M9IiBpZD0iIiBibD0iMCIgYm89IjEiLz48L21ldGE+ authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=cadence.com; x-originating-ip: [213.131.238.28] x-ms-office365-filtering-correlation-id: faaea771-640b-4d29-083d-08d467c0d7a7 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DM5PR07MB2777; x-microsoft-exchange-diagnostics: 1;DM5PR07MB2777;7:VGAT5gHaE3Uigs24gJUWQuvMbDvhD19jeCEjZXT9gsais9fTfcumaVj2QNjdn4/G/6EHUK5737hKFGRQ/Us5IhzW0pPqUFgEVJg7cwMxJxpIF9Ft005jLPPTV80XKnA4BBEctVczNJwYuMoyV3EvE91xUODoAZR8y5vYKAHOaINSAdyB2Z+3nfwXgL5illcFhjMuxGis16JQ3hXmJY3DMVJ7L70LIXT3P7l3+5noURyMnbzGueYT8QAjJYWjipeRs8E808CdWC3W8j8sIFPaqPUkS+q5XXhzYsJmPpKeGzLt1aUDd0UOlEPa2qkOk/phal0FwTncm/lghC8ZGvyQiw==;20:UYUmLXiqJrAP2Nvy1hVP30EfSOOw3LPEVi7F1/ai8YhAFaX7AqTdc4RkuqXn2+jEPIrzr/kf2SpllyzkTxfhNQlZwi1miMhG1XxDu9IVvrxNwPmlj4WmXiBzogo4jZyPYzBSbWVg75Xew1OyuhAKLzKBAU6AZnR64njh1a/5C3nBMms/Pvvni8UBZ+vILO8SvMEJws6otrVg3EPms0FYx40b7bVLOiixOSKEa383jMiplWrFxQRH/dMTkklwAz7G x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123560025)(20161123555025)(20161123558025)(20161123564025)(20161123562025)(6072148);SRVR:DM5PR07MB2777;BCL:0;PCL:0;RULEID:;SRVR:DM5PR07MB2777; x-forefront-prvs: 02426D11FE x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39450400003)(377454003)(24454002)(36092001)(53546006)(39060400002)(106116001)(189998001)(86362001)(50986999)(54356999)(8676002)(76176999)(81166006)(8936002)(6506006)(77096006)(6436002)(4326008)(229853002)(38730400002)(2950100002)(93886004)(25786008)(66066001)(7696004)(68736007)(2906002)(5660300001)(3280700002)(99286003)(122556002)(3660700001)(55016002)(6116002)(9686003)(6246003)(7736002)(102836003)(3846002)(74316002)(53936002)(2900100001)(2501003)(33656002)(54906002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB2777;H:DM5PR07MB2780.namprd07.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Mar 2017 14:22:11.3150 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB2777 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v2AEMR1H028164 Content-Length: 2585 Lines: 74 From: Marek Vasut [mailto:marek.vasut@gmail.com] Sent: 10 marca 2017 15:15 > On 03/10/2017 03:09 PM, Artur Jedrysek wrote: > > CCing Dinh. > > [...] > > >>>>> + /* Determine, whether or not octal transfer MAY be supported */ > >>>> > >>>> But you already know that from DT, no ? > >>>> > >>> > >>> Cadence Octal (formerly Quad) SPI Controller is sold as an IP, and is > >>> configurable. This includes max SPI mode. It is possible to detect, that > >>> Octal SPI controller is configured (during hardware compilation) to support > >>> up to Quad mode, using revision register. > >> > >> So the octal-spi controller always has this config register, but the > >> quad-spi controller may or may not have this register ? > >> > > > > This register was always present. In Quad-SPI, however, it didn't contain > > information about maximum possible mode, as only quad was possible, and > > meaning of bits checked here was different. > > OK > > >>>>> + rev_reg = readl(cqspi->iobase + CQSPI_REG_MODULEID); > >>>>> + dev_info(dev, "CQSPI Module id %x\n", rev_reg); > >>>>> + > >>>>> + switch (rev_reg & CQSPI_REG_MODULEID_CONF_ID_MASK) { > >>>>> + case CQSPI_REG_MODULEID_CONF_ID_OCTAL_PHY: > >>>>> + case CQSPI_REG_MODULEID_CONF_ID_OCTAL: > >>>>> + mode = SPI_NOR_OCTAL; > >>>>> + break; > >>>>> + case CQSPI_REG_MODULEID_CONF_ID_QUAD: > >>>>> + case CQSPI_REG_MODULEID_CONF_ID_QUAD_PHY: > >>>> > >>>> Does this work on all revisions of CQSPI ? > >>>> > >>> > >>> After having a more thorough look at specification of older IP version > >>> (quad only) it seems, that revision register format has indeed changed. > >>> This will be fixed in the next version of the patch. > >> > >> Can the quad-spi controller be configured only as dual or single ? > >> What about the octal one ? These cases should probably be handled > >> somehow too, right ? > >> > > > > Quad-SPI controller can always support single, dual and quad. There was > > no option to configure max mode. Octal-SPI controller can be configured > > to support either octal or quad mode. No controller could be configured > > (during hardware compilation/synthesis) to support only single/dual > > SPI mode. To put it shortly: single, dual and quad is always supported. > > So basically the whole check you need to perform here is > > mode = quad; > if (controller->flags & CAN_DO_OCTAL) { > if (readl(ID_REGISTER) & IS_CONFIGURED_AS_OCTAL) > mode = octal; > } > Yes. Something similar was already written and tested, and will be sent in the next version of the patch instead. > -- > Best regards, > Marek Vasut