From mboxrd@z Thu Jan 1 00:00:00 1970 From: zhangfei gao Subject: Re: [PATCH 2/2] sdhci-pxa: add call back interface to share sdhci-pxa Date: Tue, 17 May 2011 01:39:00 -0400 Message-ID: References: <487EBCAC-1795-4C69-ACDF-99EC9D7BF604@marvell.com> <583E304B-0E60-4F3E-8D92-0DE0B737A415@marvell.com> <08119C91-F5AA-4E6A-99D4-CFB253B1AE7B@marvell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-vw0-f46.google.com ([209.85.212.46]:42644 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751736Ab1EQFjB convert rfc822-to-8bit (ORCPT ); Tue, 17 May 2011 01:39:01 -0400 Received: by vws1 with SMTP id 1so105777vws.19 for ; Mon, 16 May 2011 22:39:00 -0700 (PDT) In-Reply-To: <08119C91-F5AA-4E6A-99D4-CFB253B1AE7B@marvell.com> Sender: linux-mmc-owner@vger.kernel.org List-Id: linux-mmc@vger.kernel.org To: Philip Rakity Cc: Wolfram Sang , Chris Ball , "linux-mmc@vger.kernel.org" , Jun Nie , Raymond Wu , Haojian Zhuang , "arnd@arndb.de Bergmann" , Mark Brown On Tue, May 17, 2011 at 12:27 AM, Philip Rakity w= rote: > > On May 16, 2011, at 7:02 PM, zhangfei gao wrote: > >> On Mon, May 16, 2011 at 9:51 AM, Philip Rakity = wrote: >>> >>> On May 15, 2011, at 11:26 PM, zhangfei gao wrote: >>> >>>> On Sat, May 14, 2011 at 1:01 PM, Philip Rakity wrote: >>>>> >>>>> On May 13, 2011, at 10:11 PM, zhangfei gao wrote: >>>>> >>>>>> On Fri, May 13, 2011 at 9:47 PM, Chris Ball wro= te: >>>>>>> Hi, >>>>>>> >>>>>>> On Thu, May 12 2011, Philip Rakity wrote: >>>>>>>> All other platform specific code is in the host/ directory. >>>>>>>> >>>>>>>> This moves it to arch/arm >>>>>>>> >>>>>>>> If that is the direction the group wants to go in --> then the= patch >>>>>>>> is fine provided the mmc group can review the patches. =A0Othe= rwise they >>>>>>>> are handled by the arm maintainer. >>>>>>> >>>>>>> Thanks. =A0Wolfram, do you have any ideas on what the best desi= gn is for >>>>>>> these SoC-specific changes to sdhci-pxa? >>>>>>> >>>>>>> - Chris. >>>>>> >>>>>> The code in arch/arm is >>>>>> 1. Accessing private register, take pxa910 and mmp2 we want to s= upport >>>>>> as example, there are several private registers differece, thoug= h they >>>>>> are same ip, with same issues and quirk. >>>>>> 2. Handle platform difference, for example, mmp2 used in two dif= ferent >>>>>> platform, one use wp pin, the other does not. >>>>> >>>>> The situation is a little more complicated. >>>> >>>> The interface is used for long time among mmp2, pxa910 and mmp3. >>>> Also could be used for new controller with minor register differen= ce >>>> but same ip, without adding new specific driver. >>> >>> applies to both approaches. =A0The mmp2 specific code can be applie= d to other marvell >>> platforms that share the same controller. =A0Just change Kconfig an= d the Makefile to use >>> the mmp2 code. =A0The name of the file is not the important thing. = =A0It is what it does. >>> >>> The pxa168 and pxa910 code are a little less sharable due to io acc= essors and some >>> other quirks. >>> >>> For other following the discussion we are probably talking about 10= 0 liens of code. >>> >>> The philosophical location of where the code belongs for host speci= fic drivers is >>> to me more important. >>> >>> Is it in arch/arm and not directly visible to the mmc list or is it= like all other platform drivers >>> in drivers/mmc/host. >> >> The code handle several register difference are located at >> arch/arm/mach-mmp/mmp2.c is for mmp2 >> arch/arm/mach-mmp/pxa910.c is for pxa910 serious, >> arch/arm/mach-mmp/mmp3.c is for mmp3 serious, considering there may >> still registers changing. >> >> The board difference are directly put in board.c >> For example ttc_dkb do not use wp pin, so get_ro is provided. > > embedding the code in these chip files stops code sharing. =A0For exa= mple, > mmp3 has same controller as mmp2. If register are totally same, they can share. If there is minor difference with chip upgrading, they can put in different file. >> >>> >>> >>> >>>> >>>>> >>>>> pxa168 and pxa910 share (almost) the same IP =A0The are both base= d on SD 2.0 >>>>> controller spec with extensions. =A0The pxa910 controller has fix= es to the >>>>> pxa168 controller. =A0They share the same private registers that = allow support >>>>> for clock gating and timing adjustments. >>>>> >>>>> mmp2 is based on SD 3.0 spec. =A0The private register space is di= fferent. >>>>> >>>>> mmc/host/Kconfig takes no account of these differences. =A0mmp2 a= nd pxa168/910 >>>>> cannot co-exist. =A0 What is currently submitted does not work. =A0= One cannot >>>>> compile mmp2 and pxa910 =A0nor would they work if one could. >>>>> >>>>> Mark Brown and I submitted patches to fix this. =A0We added code = to the host/ directory >>>>> that took into account these differences. =A0 It provided a commo= n interface layer >>>>> that then used platform specific code in the host/ directory to h= andle the different >>>>> behavior. >>>>> >>>>> Arng Bergmann provided advice and reviewed the patches to allow e= xplicit selection of the >>>>> pxa familty controller and board. =A0Based on this comments we su= bmitted a patch >>>>> to allow selection if the appropriate SoC. >>>>> >>>>> These are two approaches. >>>>> >>>>>> >>>>>> Thanks >>>>>>> -- >>>>>>> Chris Ball =A0 =A0 >>>>>>> One Laptop Per Child >>>>>>> >>>>> >>>>> >>> >>> > >