Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp326753imu; Mon, 5 Nov 2018 01:20:07 -0800 (PST) X-Google-Smtp-Source: AJdET5c+wMGumaE+dglTj3A7AR8Mece8wmTIi2tbSdfYh9CjGGPvuNupyevpPwf154s0hyS5+APE X-Received: by 2002:a17:902:147:: with SMTP id 65-v6mr12856599plb.140.1541409607182; Mon, 05 Nov 2018 01:20:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541409607; cv=none; d=google.com; s=arc-20160816; b=w65kFvZdVpaDjzQYmpvWtvm+fddjmWvqdKToY4+IZ6DpHwadUWjYpStOzNcEMCsrse OPwr3kfcO5kVPUElaf/qni0L5F78FyVB9+2MuNQzkk2Dgq5NUoaYYovdR39ZlYgUCvW9 xCteBCiY6ioAVgcJ+W2Iu0EYkP7TfotcxCC6xnZ5rUdvwlQLxEv6O2HZtXz6g2RC5sMP /2r4T9kyfXGh6D7eur3sR0ymXBY7vgZ9CuhseC2M8Iz5JyWe/HNBDadHXWoOVX06xOX5 OLDXKon0LIytFA9AdWiI1gd6329ILapNJLHBOEUCaJxRuBHNlwIhMbBjshiV1PbY1P6L D86g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=1gtfamZyqQMtB8MN8ZvoxUBxqN9dupqwO+3k0c96wmQ=; b=ViCVKMIzL1Ak0FqgKmJqe1ArG3WAt9ZA8FaBXCYa2IgTiuhmOSMrL9ib6FvOaHXCWb E0x6mVoVVKQxjNEQfhLqtdhioqgeUOnClc7LA98rCYv3gmUDRIA8jyQyV0yNDy1XTCSv k0kBVVxycOhH4QSb+CGaGr7BzYlXv8e5R8I8p/t/SSBIgkOCa24m871x2gFMqdhAMvlm 4h1VnNSSVdX2V3EeyWy08Mp2/0Ak/NE+XRTzcZn9DA00iVhp2JxetDN058w+76fOG+Dp wpwMFI1QHfDNdU8xxZAh6Mx18SanD5NT6iSI1zxwlUIHg1R9P2wswM2wyDk2z22rDMpc q/0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23-v6si42071710pgl.207.2018.11.05.01.19.52; Mon, 05 Nov 2018 01:20:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729172AbeKESiK (ORCPT + 99 others); Mon, 5 Nov 2018 13:38:10 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:9400 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbeKESiG (ORCPT ); Mon, 5 Nov 2018 13:38:06 -0500 X-IronPort-AV: E=Sophos;i="5.54,467,1534834800"; d="scan'208";a="19933660" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Nov 2018 02:19:20 -0700 Received: from localhost (10.10.76.4) by chn-sv-exch03.mchp-main.com (10.10.76.49) with Microsoft SMTP Server id 14.3.352.0; Mon, 5 Nov 2018 02:19:19 -0700 Date: Mon, 5 Nov 2018 10:19:22 +0100 From: Ludovic Desroches To: Jean-Michel Hautbois CC: , Nicolas Ferre , linux-kernel , Subject: Re: sama5d: using the ebi interface from another driver Message-ID: <20181105091922.gws52ledkqwc46xx@M43218.corp.atmel.com> Mail-Followup-To: Jean-Michel Hautbois , boris.brezillon@bootlin.com, Nicolas Ferre , linux-kernel , linux-arm-kernel@lists.infradead.org References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jean-Michel, On Fri, Nov 02, 2018 at 02:35:26PM +0100, Jean-Michel Hautbois wrote: > Hi all, > > I have a custom board based on a sama5d3 chip. The SoC is connected to > 2 pef24628 SHDSL transceivers, the first one on ebi@40000000 and the > second one on ebi@50000000. > I tried to write a basic char driver, using request_mem_region and > ioremap but I can't read or write into the device. > I have to say that the driver is based on a proprietary one, and > tested years ago on a PowerPC board. > > Then, after looking into deeper details in the datasheet I understand > it is connected through EBI and it sounds not so easy :D. > > I would appreciate some help/pointers on this, as there is (at least, > I could find) few documentation on how to use it except for NAND > cases. > > I have something like that in my DTS, but not sure this is the correct > way to do it : > > ebi: ebi@10000000 { > pinctrl-0 = <&pinctrl_ebi_nand_addr>; > pinctrl-names = "default"; > status = "okay"; > > dsp0: pef24628@1 { > status = "okay"; > compatible = "intel,pef24628"; > #address-cells = <1>; > #size-cells = <1>; > reg = <0x1 0x0 0x8000>; > pinctrl-0 = <&pinctrl_dsp_cs1>; > }; > > dsp1: pef24628@2 { > status = "okay"; > compatible = "intel,pef24628"; > #address-cells = <1>; > #size-cells = <1>; > reg = <0x2 0x0 0x8000>; > pinctrl-0 = <&pinctrl_dsp_cs2>; > }; > > nand_controller: nand-controller { > status = "okay"; > > nand@3 { > reg = <0x3 0x0 0x2>; > atmel,rb = <0>; > nand-bus-width = <8>; > nand-ecc-mode = "hw"; > nand-ecc-strength = <4>; > nand-ecc-step-size = <512>; > nand-on-flash-bbt; > label = "atmel_nand"; > > partitions { > compatible = "fixed-partitions"; > #address-cells = <1>; > #size-cells = <1>; > [...] > }; > }; > }; > > The pinctrl for ebi should probably be changed however, I am wondering > how the (platform ?) driver can access the adress ? Should it parse > itself the parent, and find range, etc. Or is there an accessor for it > ? At first look, your DT seems correct. You have nothing special to do, the usual platform_get_resource() and devm_ioremap_resource() calls are enough. The address translation should be done automatically according to ranges property. Another hint is to check and specify the signals timings. Regards Ludovic > > Maybe can I just manually toggle the CS GPIO, and don't try to make > anything more complex than what it should be ? The driver should not > be atmel dependant... > > Thanks ! > JM > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel