From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AD92C433DF for ; Wed, 19 Aug 2020 02:14:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D7BF20738 for ; Wed, 19 Aug 2020 02:14:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726372AbgHSCOG (ORCPT ); Tue, 18 Aug 2020 22:14:06 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:60474 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726486AbgHSCOG (ORCPT ); Tue, 18 Aug 2020 22:14:06 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1k8Dc2-00A1KU-Cn; Wed, 19 Aug 2020 04:14:02 +0200 Date: Wed, 19 Aug 2020 04:14:02 +0200 From: Andrew Lunn To: Mohammed Billoo Cc: Peter Korsgaard , linux-i2c@vger.kernel.org Subject: Re: [PATCH] i2c: ocores: Allow endian-specific grlib accessors Message-ID: <20200819021402.GC2347062@lunn.ch> References: <20200814210154.14402-1-mab@mab-labs.com> <20200818013410.GG2294711@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On Tue, Aug 18, 2020 at 06:14:31PM -0400, Mohammed Billoo wrote: > Andrew, > > Thanks for your comments. Does it make sense to replace the big_endian > bool with a small_endian bool? The code to choose the appropriate > non-grlib accessors assumes that big_endian will be specified, either > in a device tree blob or via platform_data: > > if (!i2c->setreg || !i2c->getreg) { > bool be = pdata ? pdata->big_endian : > of_device_is_big_endian(pdev->dev.of_node); > . > . > . > case 2: > i2c->setreg = be ? oc_setreg_16be : oc_setreg_16; > > And so if endianess isn't specified (assuming the default is big > endian), it will actually default to small endian. You have to assume there is no indication of endianness in device tree by default. For your broken hardware you will indicate little endian in device tree. If you want, you could add support for DT indicating big endian, but it is not required. Andrew