Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757753AbcCUUMU (ORCPT ); Mon, 21 Mar 2016 16:12:20 -0400 Received: from mail-am1hn0254.outbound.protection.outlook.com ([157.56.112.254]:4862 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754735AbcCUUMS (ORCPT ); Mon, 21 Mar 2016 16:12:18 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=bhuvanchandra.dv@toradex.com; From: Bhuvanchandra DV To: , , CC: , , , , , Bhuvanchandra DV Subject: [PATCH] spi: fsl-dspi: Set max_speed_hz for master Date: Tue, 22 Mar 2016 01:41:52 +0530 Message-ID: <1458591112-2743-1-git-send-email-bhuvanchandra.dv@toradex.com> X-Mailer: git-send-email 2.7.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [106.51.143.201] X-ClientProxiedBy: MAXPR01CA0040.INDPRD01.PROD.OUTLOOK.COM (25.164.146.140) To AMSPR05MB261.eurprd05.prod.outlook.com (10.242.95.18) X-MS-Office365-Filtering-Correlation-Id: a9fa3272-3ea6-4cc1-bfa5-08d351c51884 X-Microsoft-Exchange-Diagnostics: 1;AMSPR05MB261;2:DpiieTbw7qyKm0B3v49pV7X2WiZ6xpw1HRssDgxZKTNkxrAKffQbrtanvMY+fp8q8hF7UcJKGfdeEvpyaEUCIR5Z6UEsBl27EccwCIhW7Lom/Znaj9F5x2JOx/Oeq5sVnapDVsCAcIt9pE/GB2vPyBgMs1YA25AVMztaCXG/KkjR4S1NapOtE9qNJ9WZlN+N;3:AewOFZRVUIl1raNofZVARc9POavd0RN9GZbsaVycVkXHFwQV0qvN2kmzl2TpQOrQCJXENOHl2TQzFgHevqabAVOymdfNK67JzphxBqVn21tOunB11uy3RD7JiLcpCtdP;25:jAuuGNMKPKp654iMIonLegoQjdL8YCANEdFIUHJOkZGCA8zx81iuk3JVRtt88eLGX/AgSGgJOhO1IM8j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d+G/cKBfHrvp1z/9nZlPy0EfFknJ0aFwZWyaD0fVwTRyjRrjyxhNyA6MC6a44sTH+hKzuORDVnxsLV9uwSQxKRumHZ22h/WI+kJWTISj8zdhkP6FOOcA3Z6NDcaiocALuN7DVh8XQCU3okM2s3qyiA77wO5X X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:AMSPR05MB261;BCL:0;PCL:0;RULEID:;SRVR:AMSPR05MB261; X-Forefront-PRVS: 0888B1D284 X-Forefront-Antispam-Report: SFV:SPM;SFS:(10019020)(4630300001)(6009001)(4326007)(5004730100002)(92566002)(107886002)(81166005)(81156013)(2906002)(86362001)(42186005)(19580395003)(48376002)(19580405001)(5008740100001)(50986999)(36756003)(6116002)(586003)(47776003)(229853001)(50226001)(5009440100003)(4001430100002)(3846002)(77096005)(33646002)(5001770100001)(189998001)(50466002)(66066001)(2201001)(1096002)(5003940100001)(20860200002)(32040200001);DIR:OUT;SFP:1501;SCL:5;SRVR:AMSPR05MB261;H:linuxdev-in.localdomain;FPR:;SPF:None;MLV:nov;PTR:InfoNoRecords;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AMSPR05MB261;23:uupPjSKlHg3qPgQ+7TR+6v7K3Eypys7CbzjTO6cHx9?= =?us-ascii?Q?QGWoBBDs7PduOvdSg8mIqqP2hwwaCZGmYlmnxzxjsjvRNkJwlTytDhYCRkfh?= =?us-ascii?Q?9/Da9TSZ9U9hUaT7/fWSOHPvvomgO6O7cpetLOTApUSz50sF/okO1b4ZPcUh?= =?us-ascii?Q?5RM5h9Xz/glTO7tOXdNKtCZPNVmzZ27r4fGScTqlZ5DoWeZeDIrB61VNaij4?= =?us-ascii?Q?dgi/KmpHcCfXzoq4xS84XB4DJqLbnVP5zeitpMFQfe7GdShNYaR10iV4OGtp?= =?us-ascii?Q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sMq/hyav829b9qVJz8dQ9NUFji/NI6nGhPKIDfaVWIArilMifO+kUC32LWvY9DfhTBw7GNJbjTEr2zXSAXtIzw==;24:K+zy267+GU5kk1vpZHPuRhj5dJoJNq74alnquSv8HdeEmV3chHGZ9APtcLEd29G2KKzsE/NVK86cEnuuHO/blg== SpamDiagnosticOutput: 1:22 SpamDiagnosticMetadata: 00000000%2D0000%2D0000%2D0000%2D000000000000 X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2016 20:12:13.4725 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AMSPR05MB261 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1278 Lines: 50 Calculate and update max speed from bus clock for SoC's using DSPI IP. The bus clock factor's are taken from the data sheet's of respective SoC's. Signed-off-by: Bhuvanchandra DV --- drivers/spi/spi-fsl-dspi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 59a1143..8753276 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -121,18 +121,22 @@ enum dspi_trans_mode { struct fsl_dspi_devtype_data { enum dspi_trans_mode trans_mode; + u8 max_clock_factor; }; static const struct fsl_dspi_devtype_data vf610_data = { .trans_mode = DSPI_EOQ_MODE, + .max_clock_factor = 2, }; static const struct fsl_dspi_devtype_data ls1021a_v1_data = { .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, }; static const struct fsl_dspi_devtype_data ls2085a_data = { .trans_mode = DSPI_TCFQ_MODE, + .max_clock_factor = 8, }; struct fsl_dspi { @@ -726,6 +730,9 @@ static int dspi_probe(struct platform_device *pdev) } clk_prepare_enable(dspi->clk); + master->max_speed_hz = + clk_get_rate(dspi->clk) / dspi->devtype_data->max_clock_factor; + init_waitqueue_head(&dspi->waitq); platform_set_drvdata(pdev, master); -- 2.7.3