From patchwork Thu Feb 25 09:34:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mugunthan V N X-Patchwork-Id: 587994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id C8084140325 for ; Thu, 25 Feb 2016 20:34:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 68D55A7517; Thu, 25 Feb 2016 10:34:33 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZRza0nhBh2qj; Thu, 25 Feb 2016 10:34:33 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 04435A74F1; Thu, 25 Feb 2016 10:34:33 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7DD71A74F1 for ; Thu, 25 Feb 2016 10:34:29 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pykZ3HV6PVWw for ; Thu, 25 Feb 2016 10:34:29 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by theia.denx.de (Postfix) with ESMTPS id 0B81DA748F for ; Thu, 25 Feb 2016 10:34:23 +0100 (CET) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id u1P9YHLX028784; Thu, 25 Feb 2016 03:34:18 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u1P9YHeD020418; Thu, 25 Feb 2016 03:34:17 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Thu, 25 Feb 2016 03:34:17 -0600 Received: from [172.24.190.143] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u1P9YFh1030303; Thu, 25 Feb 2016 03:34:16 -0600 To: Tom Rini References: <1454500780-20751-4-git-send-email-mugunthanvnm@ti.com> <20160224162038.GA7705@bill-the-cat> From: Mugunthan V N Message-ID: <56CECA97.8070100@ti.com> Date: Thu, 25 Feb 2016 15:04:15 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160224162038.GA7705@bill-the-cat> Cc: u-boot@lists.denx.de, Stefan Roese , Sekhar Nori Subject: Re: [U-Boot] [U-Boot, v2, 3/7] drivers: block: disk-uclass: implement scsi_init() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" On Wednesday 24 February 2016 09:50 PM, Tom Rini wrote: > On Wed, Feb 03, 2016 at 05:29:36PM +0530, Mugunthan V N wrote: > >> Implement scsi_init() api to probe driver model based sata >> devices. >> >> Signed-off-by: Mugunthan V N >> Reviewed-by: Simon Glass >> --- >> drivers/block/disk-uclass.c | 39 +++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 39 insertions(+) >> >> diff --git a/drivers/block/disk-uclass.c b/drivers/block/disk-uclass.c >> index d665b35..4bd7b56 100644 >> --- a/drivers/block/disk-uclass.c >> +++ b/drivers/block/disk-uclass.c >> @@ -7,6 +7,45 @@ >> >> #include >> #include >> +#include >> +#include >> +#include >> + >> +int scsi_get_device(int index, struct udevice **devp) >> +{ >> + struct udevice *dev; >> + int ret; >> + >> + ret = uclass_find_device(UCLASS_DISK, index, &dev); >> + if (ret || !dev) { >> + printf("%d device not found\n", index); >> + return ret; >> + } >> + >> + ret = device_probe(dev); >> + if (ret) { >> + error("device probe error\n"); >> + return ret; >> + } >> + >> + *devp = dev; >> + >> + return ret; >> +} >> + >> +void scsi_init(void) >> +{ >> + struct udevice *dev; >> + int ret; >> + >> + ret = scsi_get_device(0, &dev); >> + if (ret || !dev) { >> + error("scsi device not found\n"); >> + return; >> + } >> + >> + scsi_scan(1); >> +} >> >> UCLASS_DRIVER(disk) = { >> .id = UCLASS_DISK, > > OK, this patch is a problem. Many platforms already define scsi_init() > and aren't moved over so now fail to build. Mele_M5 is one of many > examples here, thanks! > Oops, sorry I didn't run buildman before submitting the patches, will make sure running buildman before submitting patches in future. Issue is when a platform is converted to DM, by default CONFIG_DISK is selected through Kconfig whether the platform has block device or not, disk_uclass driver is compile which results in build break when the platform has scsi_init already defined and not not converted to DM. The following diff solves the issue, and CONFIG_DISK has to be selected for platforms which supports disk (sata, ide etc) Simon, Are you Okay with the patch, so that I can send it as a separate fixup patch. Regards Mugunthan V N diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 915c1eb..e62bf75 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -1,7 +1,7 @@ config DISK bool "Support disk controllers with driver model" depends on DM - default y if DM + default n if DM help This enables a uclass for disk controllers in U-Boot. Various driver types can use this, such as AHCI/SATA. It does not provide any standard