From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752394AbcDQDOq (ORCPT ); Sat, 16 Apr 2016 23:14:46 -0400 Received: from mail-am1on0091.outbound.protection.outlook.com ([157.56.112.91]:40957 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751993AbcDQDOp convert rfc822-to-8bit (ORCPT ); Sat, 16 Apr 2016 23:14:45 -0400 From: Scott Wood To: Po Liu , "broonie@kernel.org" CC: "linux-spi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] dspi: config dspi master regmap with right mode depend on BE or LE Thread-Topic: [PATCH] dspi: config dspi master regmap with right mode depend on BE or LE Thread-Index: AQHRlXVjEneuAyregUu3aSpDtbVLSw== Date: Sun, 17 Apr 2016 02:41:40 +0000 Message-ID: References: <1460545402-8162-1-git-send-email-po.liu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [2601:448:8100:702f:12bf:48ff:fe84:c9a0] x-ms-office365-filtering-correlation-id: dd97c0e4-500b-4d48-f8d3-08d36669ce5d x-microsoft-exchange-diagnostics: 1;DB5PR0401MB1701;5:SAMdVwph2GF0QcuxE59loBjjC+ky1q1/utZ20gqJGROyuq3cQcyMtSxd+aTdrpnKSnMdCX7VKOlS2Q4O+mWtkDxuLzKj6t883TugFAC6g7MCRKS7NAqTc3ccfr59XN4LXdHjc1fj5m3aUW+cMx3QRg==;24:rfVGKMTPvM0UW7XnqVEZ/rQ8A6PkvJIIeDvYQGWSL6vLokq6YdH4MzU8XyTstbJcGfLusSMguMDURAmwY5eBmyKgK04M0qwGCY9Janq1mCU= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR0401MB1701; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026);SRVR:DB5PR0401MB1701;BCL:0;PCL:0;RULEID:;SRVR:DB5PR0401MB1701; x-forefront-prvs: 0915875B28 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(377454003)(24454002)(5008740100001)(87936001)(3660700001)(54356999)(5002640100001)(5003600100002)(586003)(50986999)(76176999)(4326007)(19580395003)(19580405001)(2501003)(3280700002)(1220700001)(11100500001)(102836003)(86362001)(1096002)(6116002)(106116001)(92566002)(122556002)(5004730100002)(74316001)(2906002)(33656002)(189998001)(10400500002)(9686002)(76576001)(2900100001)(81166005)(5001770100001)(77096005)(3826002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR0401MB1701;H:DB5PR0401MB1928.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Apr 2016 02:41:40.7986 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0401MB1701 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/13/2016 06:12 AM, Po Liu wrote: > When kernel config with big endian mode, spi master need > to config regmap data value to be little endian mode. Or else, > the kernel boot will hang. > > Signed-off-by: Po Liu > --- > drivers/spi/spi-fsl-dspi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c > index 39412c9..a1d893c 100644 > --- a/drivers/spi/spi-fsl-dspi.c > +++ b/drivers/spi/spi-fsl-dspi.c > @@ -637,6 +637,9 @@ static const struct regmap_config dspi_regmap_config = { > .val_bits = 32, > .reg_stride = 4, > .max_register = 0x88, > +#ifdef CONFIG_CPU_BIG_ENDIAN > + .val_format_endian = REGMAP_ENDIAN_LITTLE, > +#endif Drop this ifdef. It's little endian regardless of what mode the CPU is in. Are you sure this is correct on all platforms? E.g. ls1021a? Looking more closely, the binding has a big-endian property. It says the default if that property is absent is native endian, which is insane. Fix the binding to say that little endian is the default (this change shouldn't break any existing trees), and make sure that's what the code implements. I think you need val_format_endian_default, not val_format_endian. -Scott