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=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 37B6CC4338F for ; Mon, 2 Aug 2021 21:59:22 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B46DC60E78 for ; Mon, 2 Aug 2021 21:59:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B46DC60E78 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 98A6182D9B; Mon, 2 Aug 2021 23:59:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="XpTKEPwN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B2C9782D94; Mon, 2 Aug 2021 23:59:17 +0200 (CEST) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5081182D94 for ; Mon, 2 Aug 2021 23:59:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x82d.google.com with SMTP id d2so12709902qto.6 for ; Mon, 02 Aug 2021 14:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RrdwOq1SrPzHWSVZ8eDpQPY3hkAguQj7sN4FSo9RCKc=; b=XpTKEPwNNwLAH3HJLcZR2+k27ZyWmd85f1g2HZZuWQB2fAY6UMX70wqSLjElfQJK1A L6160mCw1xXZyYZnRWUifqRTyZ9lkXAx2HeG1+73lDCGuqDkPVa+UEmlnYuqjHupJ+6j 3CCBWu10yk6GXNkOwgvazm8EaDXLaOdf/ruZc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RrdwOq1SrPzHWSVZ8eDpQPY3hkAguQj7sN4FSo9RCKc=; b=hQM51K5qQKkeuaxkG+FZIXzjLzL2mmLXgiLTmGTtZiuWWaSR7tJpReuQUpHLEI+V7M kCLVzs9CYXjMhft2NS6tWCbAycGh9P58uwtdBAmkrFNbcoRkdMxfVqUt9w9a3H687KQT YlkIXDXKl7SEAVkTGbywpYu0VYROM/Byi9x2aR8OOROwUeWFdtukubjgvIQ5zzcv96lb vhNKOPosf0Mc2hi9doqwG4gt8W8DUaCk57s2snPPWHrkGeWV24t5tGlhJrY35tBjbT+3 OCHa9p6MDaqHZpW8hysEzGS9JqhPIX4gHiR4kztT6VQfRJHLptw13kXxywad9UGj+AOZ 4wXg== X-Gm-Message-State: AOAM533ImhAtm5OK6Bs8HhE9RzWy+1jWtz6FKcoBtMdiorcJ2qxYEZUc R0fQvla3e0nNYnKHexWroErGjg== X-Google-Smtp-Source: ABdhPJz9HKWs/nNKwympHEs2RBFaE3MoeBP5YeSvw4gMbX+EKcZLyGOUKqBxJHU8uvHa/GfFGcFeAw== X-Received: by 2002:ac8:7601:: with SMTP id t1mr15898894qtq.381.1627941548206; Mon, 02 Aug 2021 14:59:08 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-a0a3-ef76-0712-405d.res6.spectrum.com. [2603:6081:7b01:cbda:a0a3:ef76:712:405d]) by smtp.gmail.com with ESMTPSA id f13sm6600105qkk.29.2021.08.02.14.59.07 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Aug 2021 14:59:07 -0700 (PDT) Date: Mon, 2 Aug 2021 17:59:05 -0400 From: Tom Rini To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Simon Glass , Stefan Roese , Masami Hiramatsu , Frank Wunderlich , Marek =?iso-8859-1?Q?Beh=FAn?= , U-Boot Mailing List Subject: Re: Broken CONFIG_SPL_SATA_SUPPORT=y Message-ID: <20210802215905.GK9379@bill-the-cat> References: <20210801122516.dl6vykk22aumzjfd@pali> <20210802205534.GC9379@bill-the-cat> <20210802210903.y4oufo37jidvt6qq@pali> <20210802211806.segctj325v5argwj@pali> <20210802212554.knnm6ndingwooz5k@pali> <20210802214129.iqp6ezhowfzmehzq@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4VDEB6YSSWzYVmQj" Content-Disposition: inline In-Reply-To: <20210802214129.iqp6ezhowfzmehzq@pali> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --4VDEB6YSSWzYVmQj Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 02, 2021 at 11:41:29PM +0200, Pali Roh=E1r wrote: > On Monday 02 August 2021 15:30:20 Simon Glass wrote: > > Hi Pali, > >=20 > > On Mon, 2 Aug 2021 at 15:26, Pali Roh=E1r wrote:> > > > On Monday 02 August 2021 15:23:22 Simon Glass wrote: > > > > () Hi Pali, > > > > > > > > On Mon, 2 Aug 2021 at 15:18, Pali Roh=E1r wrote: > > > > > > > > > > On Monday 02 August 2021 15:14:30 Simon Glass wrote: > > > > > > Hi Pali, > > > > > > > > > > > > On Mon, 2 Aug 2021 at 15:09, Pali Roh=E1r wro= te: > > > > > > > > > > > > > > On Monday 02 August 2021 16:55:34 Tom Rini wrote: > > > > > > > > On Sun, Aug 01, 2021 at 02:25:16PM +0200, Pali Roh=E1r wrot= e: > > > > > > > > > > > > > > > > > Hello! > > > > > > > > > > > > > > > > > > Option CONFIG_SPL_SATA_SUPPORT=3Dy is currently broken in= u-boot master > > > > > > > > > branch. If I try to enable it for A38x platform I'm getti= ng following > > > > > > > > > compiler error: > > > > > > > > > > > > > > > > > > LD spl/u-boot-spl > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci.o: in func= tion `ahci_probe_scsi_pci': > > > > > > > > > drivers/ata/ahci.c:1205: undefined reference to `dm_pci= _map_bar' > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci.c:1215: un= defined reference to `dm_pci_read_config16' > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci.c:1216: un= defined reference to `dm_pci_read_config16' > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci.c:1220: un= defined reference to `dm_pci_map_bar' > > > > > > > > > make[1]: *** [scripts/Makefile.spl:512: spl/u-boot-spl]= Error 1 > > > > > > > > > make: *** [Makefile:1977: spl/u-boot-spl] Error 2 > > > > > > > > > > > > > > > > > > You can reproduce it by running following commands: > > > > > > > > > > > > > > > > > > $ make turris_omnia_defconfig > > > > > > > > > $ echo CONFIG_SPL_SATA_SUPPORT=3Dy >> .config > > > > > > > > > $ make CROSS_COMPILE=3Darm-linux-gnueabihf- > > > > > > > > > > > > > > > > > > I workaround it by following patch: > > > > > > > > > > > > > > > > > > diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c > > > > > > > > > index d4047c04f5d0..6bad72e4cfa4 100644 > > > > > > > > > --- a/drivers/ata/ahci.c > > > > > > > > > +++ b/drivers/ata/ahci.c > > > > > > > > > @@ -1196,7 +1196,7 @@ int ahci_probe_scsi(struct udevice = *ahci_dev, ulong base) > > > > > > > > > return 0; > > > > > > > > > } > > > > > > > > > > > > > > > > > > -#ifdef CONFIG_DM_PCI > > > > > > > > > +#if CONFIG_IS_ENABLED(DM_PCI) > > > > > > > > > int ahci_probe_scsi_pci(struct udevice *ahci_dev) > > > > > > > > > { > > > > > > > > > ulong base; > > > > > > > > > > > > > > > > > > It fixed this particular problem. So it looks like that C= ONFIG_DM_PCI is > > > > > > > > > defined also when building SPL even when it is not enable= d for SPL. > > > > > > > > > Whole PCI is disabled in SPL. > > > > > > > > > > > > > > > > > > But then I got another compile error: > > > > > > > > > > > > > > > > > > LD spl/u-boot-spl > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci-pci.o: in = function `ahci_pci_probe': > > > > > > > > > drivers/ata/ahci-pci.c:21: undefined reference to `ahci= _probe_scsi_pci' > > > > > > > > > make[1]: *** [scripts/Makefile.spl:512: spl/u-boot-spl]= Error 1 > > > > > > > > > make: *** [Makefile:1977: spl/u-boot-spl] Error 2 > > > > > > > > > > > > > > > > > > Seems that u-boot is trying to compile and link ahci-pci.= o into SPL > > > > > > > > > binary even when it is not enabled nor used. PCI is compl= eted disabled > > > > > > > > > in SPL for this case. > > > > > > > > > > > > > > > > > > I workaround it by putting whole ahci-pci.c file into one= big #idef: > > > > > > > > > > > > > > > > > > diff --git a/drivers/ata/ahci-pci.c b/drivers/ata/ahci-pc= i.c > > > > > > > > > index b1d231e0f9e1..34afebd2f87f 100644 > > > > > > > > > --- a/drivers/ata/ahci-pci.c > > > > > > > > > +++ b/drivers/ata/ahci-pci.c > > > > > > > > > @@ -9,6 +9,8 @@ > > > > > > > > > #include > > > > > > > > > #include > > > > > > > > > > > > > > > > > > +#if CONFIG_IS_ENABLED(DM_PCI) > > > > > > > > > + > > > > > > > > > static int ahci_pci_bind(struct udevice *dev) > > > > > > > > > { > > > > > > > > > struct udevice *scsi_dev; > > > > > > > > > @@ -42,3 +44,5 @@ static struct pci_device_id ahci_pci_su= pported[] =3D { > > > > > > > > > }; > > > > > > > > > > > > > > > > > > U_BOOT_PCI_DEVICE(ahci_pci, ahci_pci_supported); > > > > > > > > > + > > > > > > > > > +#endif > > > > > > > > > > > > > > > > > > And then finally U-Boot produced final target image u-boo= t-spl.kwb: > > > > > > > > > > > > > > > > > > LD spl/u-boot-spl > > > > > > > > > OBJCOPY spl/u-boot-spl-nodtb.bin > > > > > > > > > SYM spl/u-boot-spl.sym > > > > > > > > > CAT spl/u-boot-spl-dtb.bin > > > > > > > > > COPY spl/u-boot-spl.bin > > > > > > > > > MKIMAGE u-boot-spl.kwb > > > > > > > > > > > > > > > > > > So this looks like a bug in Kconfig or Makefile dependenc= es that build > > > > > > > > > system is trying to compile and link also files which sho= uld not be > > > > > > > > > linked at all. > > > > > > > > > > > > > > > > Yes, it's a missing dependency in Kconfig. You need to ena= ble SPL_DM > > > > > > > > and then quite possibly SPL_OF_CONTROL (I forget if that wa= s a hard > > > > > > > > dependency on the main conversion or not) on the platform. > > > > > > > > > > > > > > CONFIG_SPL_DM=3Dy is already enabled > > > > > > > > > > > > CONFIG_SPL_PCI ? > > > > > > > > > > > > It seems that pci-uclass.c is not being built for SPL. > > > > > > > > > > CONFIG_SPL_PCI is not enabled. > > > > > > > > > > But why should be CONFIG_SPL_PCI needed for SATA? As above my pat= ches > > > > > show no PCI is required for SATA... > > > > > > > > I suggest investigating what is calling those functions you mention= =2E.. > > > > > > > > If you look at ahci_probe_scsi_pci() it is bracketed by: > > > > > > > > #ifdef CONFIG_DM_PCI > > > > > > > > Perhaps it should be: > > > > > > > > #if CONFIG_IS_ENABLED(DM_PCI) > > > > > > > > so it takes account of SPL? > > > > > > And this is exactly what I did in first patch attempt. > >=20 > > Then how about changing the Makefile rule to: > >=20 > > obj-$(CONFIG_$(SPL_TPL_)AHCI_PCI) +=3D ahci-pci.o >=20 > Ok, this patch also fixes above compile errors: >=20 > diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile > index 4811b2f82c4e..d48001b51848 100644 > --- a/drivers/ata/Makefile > +++ b/drivers/ata/Makefile > @@ -5,7 +5,7 @@ > =20 > obj-$(CONFIG_DWC_AHCI) +=3D dwc_ahci.o > obj-$(CONFIG_AHCI) +=3D ahci-uclass.o > -obj-$(CONFIG_AHCI_PCI) +=3D ahci-pci.o > +obj-$(CONFIG_$(SPL_TPL_)AHCI_PCI) +=3D ahci-pci.o > obj-$(CONFIG_SCSI_AHCI) +=3D ahci.o > obj-$(CONFIG_DWC_AHSATA) +=3D dwc_ahsata.o > obj-$(CONFIG_FSL_SATA) +=3D fsl_sata.o > diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c > index d4047c04f5d0..6bad72e4cfa4 100644 > --- a/drivers/ata/ahci.c > +++ b/drivers/ata/ahci.c > @@ -1196,7 +1196,7 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong= base) > return 0; > } > =20 > -#ifdef CONFIG_DM_PCI > +#if CONFIG_IS_ENABLED(DM_PCI) > int ahci_probe_scsi_pci(struct udevice *ahci_dev) > { > ulong base; >=20 > But it is correct to use this > 'obj-$(CONFIG_$(SPL_TPL_)AHCI_PCI) +=3D ahci-pci.o' > part in Makefile? And why other object files do not have that > $(SPL_TPL_) guard? I think before we can figure out what the right solution is, we need to know the answer to what I asked in another part of the thread (and maybe our mails are just about to cross..) which is how SATA is hooked up on this board? --=20 Tom --4VDEB6YSSWzYVmQj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmEIaqUACgkQFHw5/5Y0 tyzmAQv/RtblZAsKFJN/cRnoiXT92DGRRGzG9z8gsdVhb+uAFUFXL7afJg3RDoqJ /oM3bXQhRMKKlh0zBDbq+tPpdVyct3RAq5vS19QIU0JH6uS2aV5+I7VcXKPV+Z68 gwgK880/0N3L8oUmRW4Rfr/myIXpEcFGgpFfV4p+jq5IvjBSyCTpg6ub9Z40azoR J0oTh2jnwqupm0ng9VzNtdRgMhaIGBnf44muiow1oSPdcmaeLlv0+ZG06uOzeK1i 2t92jfKz5tA56CxxivGcYhBkLBiNWr4LMFuD2ubHP+fG7UzFOWbB/aboc/Fl0OI8 75zs3XpuM2E890p+ziuaEQ2reTDUccJOjR6TNOTj4ZpwcArL58gJNGyuKTrCGq58 KO39ibVRRA6/rN1XZSgjjBRog7JeUOleX36QH5D1OCltsIRDhQfAOaso5u8j2jvL O0oHi/NHWkAj5ViTgZOHWj+dbPoqFpNKOzF1Z3OXIBuYiXGnSTIBOk67P8N15+aS U5H/cnYZ =y9ms -----END PGP SIGNATURE----- --4VDEB6YSSWzYVmQj--