Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D2C40C433EF for ; Mon, 31 Jan 2022 14:50:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EBCEB836C0; Mon, 31 Jan 2022 15:50:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="X6DJscRq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 88834836A9; Mon, 31 Jan 2022 15:49:57 +0100 (CET) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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 E2570836B4 for ; Mon, 31 Jan 2022 15:49:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id h7so17187311iof.3 for ; Mon, 31 Jan 2022 06:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nIMmbnIk7vQqAX/gnM6C0uvx2HlElgt6oY6wv2kgPD4=; b=X6DJscRqC4gPWdh4AP34Sv68Ck0elv33SAgMgk7F23YrUhFimpgMl/Zqi5QE8R7ChE uTuWO+GCsOhaJojQzIkUM5DIyrFWjLIOLDE1YuZ5yiCVCidXfG7Hqdfsc4u3lPv7vIqt fhgT3qXCi3W4AeQq5N+1GUHvDlNAaLpxaTKk8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nIMmbnIk7vQqAX/gnM6C0uvx2HlElgt6oY6wv2kgPD4=; b=MwIVOXQIYLQbh3/NjDpjEtKRbwoOYAJ4BfAAN+M5nNTASacyhMEZ7o+9WRNrB6z0OX EBTWdchGORR+JSFl1L+6FlHYx4NuxXQj+fMkEbxCLr4p5hXw8kezyhROo6NRRQ3P+UxS YbxH+7OUB84y3qy/gbvP24mkg8L2GBL4nSPtvYObEIMh9VTX/CgmTdUHNphGqo60pdYP CG6H6y1xAYWgj5QCpVzHW0nfj4GFcWGYVX7Gj2e6zmwx9gF3DvV92ufk6HqYi+CPKehH tdtSTGJqqQ2hTl7o1300d8B7hpoPrDkQRsHZ+qSc/PHZOqbTVVnJ8Fm+Q9hoEQF27DSa MFTQ== X-Gm-Message-State: AOAM533yeEowz1GI6O02aWZ20lqeOC8b/z6KD1TiWhK7VORD0qxIxlWw rcriYvcGj/WkfBliGaosByNuAwLI8OHggw== X-Google-Smtp-Source: ABdhPJyet/aw7eflWOkaYZ5hJjOBfdrYdQUqQhseCCZBdQyrv2H/4nU+7/y54o8GzXNx2OkMW7HOQQ== X-Received: by 2002:a05:6638:3047:: with SMTP id u7mr9633183jak.157.1643640587169; Mon, 31 Jan 2022 06:49:47 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id a10sm19698750ilv.44.2022.01.31.06.49.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 06:49:46 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Stefan Roese , Tom Rini , Michael Walle , Simon Glass Subject: [PATCH 4/8] sata: sata_sil: Only support BLK Date: Mon, 31 Jan 2022 07:49:34 -0700 Message-Id: <20220131144938.927349-5-sjg@chromium.org> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220131144938.927349-1-sjg@chromium.org> References: <20220131144938.927349-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean No boards use this driver without CONFIG_BLK, so clean up the dead code. Signed-off-by: Simon Glass --- drivers/ata/sata_sil.c | 118 ++--------------------------------------- 1 file changed, 3 insertions(+), 115 deletions(-) diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index dda712f42cb..a4f0dae4bbd 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c @@ -6,7 +6,9 @@ */ #include +#include #include +#include #include #include #include @@ -17,13 +19,8 @@ #include #include #include -#include - -#if CONFIG_IS_ENABLED(BLK) -#include -#include #include -#endif +#include #include "sata_sil.h" @@ -480,18 +477,12 @@ static void sil_sata_cmd_flush_cache_ext(struct sil_sata *sata) /* * SATA interface between low level driver and command layer */ -#if !CONFIG_IS_ENABLED(BLK) -ulong sata_read(int dev, ulong blknr, lbaint_t blkcnt, void *buffer) -{ - struct sil_sata *sata = (struct sil_sata *)sata_dev_desc[dev].priv; -#else static ulong sata_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer) { struct sil_sata_priv *priv = dev_get_plat(dev); int port_number = priv->port_num; struct sil_sata *sata = priv->sil_sata_desc[port_number]; -#endif ulong rc; if (sata->lba48) @@ -505,18 +496,12 @@ static ulong sata_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, /* * SATA interface between low level driver and command layer */ -#if !CONFIG_IS_ENABLED(BLK) -ulong sata_write(int dev, ulong blknr, lbaint_t blkcnt, const void *buffer) -{ - struct sil_sata *sata = (struct sil_sata *)sata_dev_desc[dev].priv; -#else ulong sata_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, const void *buffer) { struct sil_sata_priv *priv = dev_get_plat(dev); int port_number = priv->port_num; struct sil_sata *sata = priv->sil_sata_desc[port_number]; -#endif ulong rc; if (sata->lba48) { @@ -532,14 +517,9 @@ ulong sata_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, return rc; } -#if !CONFIG_IS_ENABLED(BLK) -static int sil_init_sata(int dev) -{ -#else static int sil_init_sata(struct udevice *uc_dev, int dev) { struct sil_sata_priv *priv = dev_get_plat(uc_dev); -#endif struct sil_sata *sata; void *port; u32 tmp; @@ -606,14 +586,9 @@ static int sil_init_sata(struct udevice *uc_dev, int dev) memset((void *)sata, 0, sizeof(struct sil_sata)); /* Save the private struct to block device struct */ -#if !CONFIG_IS_ENABLED(BLK) - sata_dev_desc[dev].priv = (void *)sata; - sata->devno = sata_info.devno; -#else priv->sil_sata_desc[dev] = sata; priv->port_num = dev; sata->devno = uc_dev->parent; -#endif sata->id = dev; sata->port = port; sprintf(sata->name, "SATA#%d", dev); @@ -625,85 +600,11 @@ static int sil_init_sata(struct udevice *uc_dev, int dev) return 0; } -#if !CONFIG_IS_ENABLED(BLK) -/* - * SATA interface between low level driver and command layer - */ -int init_sata(int dev) -{ - static int init_done, idx; - pci_dev_t devno; - u16 word; - - if (init_done == 1 && dev < sata_info.maxport) - goto init_start; - - init_done = 1; - - /* Find PCI device(s) */ - devno = pci_find_devices(supported, idx++); - if (devno == -1) - return 1; - - pci_read_config_word(devno, PCI_DEVICE_ID, &word); - - /* get the port count */ - word &= 0xf; - - sata_info.portbase = 0; - sata_info.maxport = sata_info.portbase + word; - sata_info.devno = devno; - - /* Read out all BARs */ - sata_info.iobase[0] = (ulong)pci_map_bar(devno, - PCI_BASE_ADDRESS_0, PCI_REGION_MEM); - sata_info.iobase[1] = (ulong)pci_map_bar(devno, - PCI_BASE_ADDRESS_2, PCI_REGION_MEM); - - /* mask out the unused bits */ - sata_info.iobase[0] &= 0xffffff80; - sata_info.iobase[1] &= 0xfffffc00; - - /* Enable Bus Mastering and memory region */ - pci_write_config_word(devno, PCI_COMMAND, - PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); - - /* Check if mem accesses and Bus Mastering are enabled. */ - pci_read_config_word(devno, PCI_COMMAND, &word); - if (!(word & PCI_COMMAND_MEMORY) || - (!(word & PCI_COMMAND_MASTER))) { - printf("Error: Can not enable MEM access or Bus Mastering.\n"); - debug("PCI command: %04x\n", word); - return 1; - } - - /* GPIO off */ - writel(0, (void *)(sata_info.iobase[0] + HOST_FLASH_CMD)); - /* clear global reset & mask interrupts during initialization */ - writel(0, (void *)(sata_info.iobase[0] + HOST_CTRL)); - -init_start: - return sil_init_sata(dev); -} - -int reset_sata(int dev) -{ - return 0; -} - -/* - * SATA interface between low level driver and command layer - */ -int scan_sata(int dev) -{ - struct sil_sata *sata = (struct sil_sata *)sata_dev_desc[dev].priv; -#else static int scan_sata(struct udevice *blk_dev, int dev) { struct blk_desc *desc = dev_get_uclass_plat(blk_dev); struct sil_sata_priv *priv = dev_get_plat(blk_dev); struct sil_sata *sata = priv->sil_sata_desc[dev]; -#endif unsigned char serial[ATA_ID_SERNO_LEN + 1]; unsigned char firmware[ATA_ID_FW_REV_LEN + 1]; unsigned char product[ATA_ID_PROD_LEN + 1]; @@ -727,16 +628,6 @@ static int scan_sata(struct udevice *blk_dev, int dev) /* Product model */ ata_id_c_string(id, product, ATA_ID_PROD, sizeof(product)); -#if !CONFIG_IS_ENABLED(BLK) - memcpy(sata_dev_desc[dev].product, serial, sizeof(serial)); - memcpy(sata_dev_desc[dev].revision, firmware, sizeof(firmware)); - memcpy(sata_dev_desc[dev].vendor, product, sizeof(product)); - /* Totoal sectors */ - sata_dev_desc[dev].lba = ata_id_n_sectors(id); -#ifdef CONFIG_LBA48 - sata_dev_desc[dev].lba48 = sata->lba48; -#endif -#else memcpy(desc->product, serial, sizeof(serial)); memcpy(desc->revision, firmware, sizeof(firmware)); memcpy(desc->vendor, product, sizeof(product)); @@ -744,7 +635,6 @@ static int scan_sata(struct udevice *blk_dev, int dev) #ifdef CONFIG_LBA48 desc->lba48 = sata->lba48; #endif -#endif #ifdef DEBUG ata_dump_id(id); @@ -754,7 +644,6 @@ static int scan_sata(struct udevice *blk_dev, int dev) return 0; } -#if CONFIG_IS_ENABLED(BLK) static const struct blk_ops sata_sil_blk_ops = { .read = sata_read, .write = sata_write, @@ -916,4 +805,3 @@ U_BOOT_DRIVER(sil_ahci_pci) = { }; U_BOOT_PCI_DEVICE(sil_ahci_pci, supported); -#endif -- 2.35.0.rc2.247.g8bbb082509-goog