From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751284AbdEaP1N (ORCPT ); Wed, 31 May 2017 11:27:13 -0400 Received: from avon.wwwdotorg.org ([70.85.31.133]:49394 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbdEaP1M (ORCPT ); Wed, 31 May 2017 11:27:12 -0400 Subject: Re: CLK_OF_DECLARE advice required To: Phil Elwell References: Cc: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, linux-rpi-kernel , "linux-kernel@vger.kernel.org" , Eric Anholt From: Stephen Warren Message-ID: <8b65e551-e6dd-cf5c-1b22-e1f1a5996d73@wwwdotorg.org> Date: Wed, 31 May 2017 09:27:07 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/30/2017 06:23 AM, Phil Elwell wrote: > Hi, > > I've run into a problem using the fixed-factor clock on Raspberry Pi and I'd > like some advice before I submit a patch. > > Some context: the aim is to use a standard UART and some external circuitry > as a MIDI interface. This would be straightforward except that Linux doesn't > recognise the required 31.25KHz as a valid UART baud rate. Rhe workaround is > to declare the UART clock such that the reported rate differs from the actual > rate. If one sets the reported rate to be (actual*38400)/31250 then > requesting a 38400 baud rate will result in an actual 31250 baud signal. This sounds like the wrong approach. Forcing the port to use a different clock rate than the user requests would prevent anyone from using that port for its standard purpose; it'd turn what should be a runtime decision into a compile-time decision. Are you sure there's no way to simply select the correct baud rate on the port? I see plenty of references to configuring custom baud rates under Linux when I search Google, e.g.: > https://stackoverflow.com/questions/12646324/how-to-set-a-custom-baud-rate-on-linux "How to set a custom baud rate on Linux?" > https://sourceware.org/ml/libc-help/2009-06/msg00016.html "Re: Terminal interface and non-standard baudrates"