From patchwork Thu Jun 15 03:28:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 776084 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wp8QH2YM6z9s65 for ; Thu, 15 Jun 2017 13:39:51 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="mlkLUec1"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id 17794C21CBD; Thu, 15 Jun 2017 03:38:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5F635C21D17; Thu, 15 Jun 2017 03:30:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 580B2C21D10; Thu, 15 Jun 2017 03:30:35 +0000 (UTC) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by lists.denx.de (Postfix) with ESMTPS id 87EB4C21C8A for ; Thu, 15 Jun 2017 03:30:05 +0000 (UTC) Received: by mail-oi0-f52.google.com with SMTP id s3so1286718oia.0 for ; Wed, 14 Jun 2017 20:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=IMeNb4HQ4fS112BY9VbqqN6EldhbrZSbKEULn9vJ2pI=; b=mlkLUec1zXHBBybCFIphxNoJGARS6O42QASDOiwqs6gtkIAbDwerD4y2llmbixssON y01cC8/+AxDXnCLxDS+0c9a2GAwXB68U8dJnVbx2k/NfBYnf7+zO6gAjx4RAuXzR4FmH +0xiUyypKi+ZSm2SW3GOwNd/10IjTjJtoyb9/29BSGmmXDIKoDC0GoCWft/vkS4zkcZk j8jfotHjNgLV7AYD0ETPKWx3WZN9dp41i8rwzRoxBV9Mtym89MGGEsH58653lPs9bWGl joUnyhwlfZ6Fo1/W1Y74C9IPzPmXpyPhtdhF1M5nRC52H2gjH/BdYfGoOsJRaaPtrWD6 PkGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=IMeNb4HQ4fS112BY9VbqqN6EldhbrZSbKEULn9vJ2pI=; b=L+PtpQjC5Z9WojsxXNwtT84zkczB6XRMBxEAVB81Z5A6cAyx2XGT9JT4D7DkDDrv39 KITa22gluNMZS2cjz91cIg0PbglLrnFZ81Jk2RKMPFmhR+mu4yuyfoARNZxq90uzrzKa hrVSD0hzogq6As7MBGg7JhYj7Uib3NUp1eznXhZCyFe8yBUcHgf1G/ew3uT6i5wq1QpR 45MwwtERYKXBgcec4msZJQ3ETA+FpX2PZudI9W0F+g56jqum0XA1TejOSy1oh13CtUDD vVZv/wU7kj7sOYH8Yf+ApUmMQHPfgDN6668NLa3Mthl9S/YYvSupGN5twPbcsMbri3uQ X+wg== X-Gm-Message-State: AKS2vOzY/toNN8/7bzbIzDJNH3DfEMMiPFQ0x5KohuO4bFVgYDQ4kGtI 24LJuw5WS41dDo/0 X-Received: by 10.202.95.6 with SMTP id t6mr1748584oib.43.1497497404166; Wed, 14 Jun 2017 20:30:04 -0700 (PDT) Received: from kaki.bld.corp.google.com ([100.100.197.131]) by smtp.gmail.com with ESMTPSA id s141sm984530oie.40.2017.06.14.20.30.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 20:30:03 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 098DA40139; Wed, 14 Jun 2017 21:30:03 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 14 Jun 2017 21:28:32 -0600 Message-Id: <20170615032848.9343-14-sjg@chromium.org> X-Mailer: git-send-email 2.13.1.518.g3df882009-goog In-Reply-To: <20170615032848.9343-1-sjg@chromium.org> References: <20170615032848.9343-1-sjg@chromium.org> Cc: Rob Herring Subject: [U-Boot] [PATCH v2 13/29] dm: ahci: Rename struct ahci_probe_ent X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This is not a very useful name since once it is probed it still hangs around. With driver model we will use uclass data for this, so rename the struct. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None board/highbank/ahci.c | 2 +- drivers/ata/ahci.c | 16 +++++------ drivers/ata/dwc_ahsata.c | 74 ++++++++++++++++++++++++------------------------ include/ahci.h | 13 ++++++++- 4 files changed, 58 insertions(+), 47 deletions(-) diff --git a/board/highbank/ahci.c b/board/highbank/ahci.c index 1578a33fd1..dadfbdd315 100644 --- a/board/highbank/ahci.c +++ b/board/highbank/ahci.c @@ -172,7 +172,7 @@ static void cphy_override_lane(u8 port) #define WAIT_MS_LINKUP 4 -int ahci_link_up(struct ahci_probe_ent *probe_ent, int port) +int ahci_link_up(struct ahci_uc_priv *probe_ent, int port) { u32 tmp; int j = 0; diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 2cc604b3f4..2caa29b4c5 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -24,7 +24,7 @@ static int ata_io_flush(u8 port); -struct ahci_probe_ent *probe_ent = NULL; +struct ahci_uc_priv *probe_ent = NULL; u16 *ataid[AHCI_MAX_PORTS]; #define writel_with_flush(a,b) do { writel(a,b); readl(b); } while (0) @@ -109,7 +109,7 @@ static int waiting_for_cmd_completed(void __iomem *offset, return (i < timeout_msec) ? 0 : -1; } -int __weak ahci_link_up(struct ahci_probe_ent *probe_ent, u8 port) +int __weak ahci_link_up(struct ahci_uc_priv *probe_ent, u8 port) { u32 tmp; int j = 0; @@ -166,7 +166,7 @@ int ahci_reset(void __iomem *base) return 0; } -static int ahci_host_init(struct ahci_probe_ent *probe_ent) +static int ahci_host_init(struct ahci_uc_priv *probe_ent) { #if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI) # ifdef CONFIG_DM_PCI @@ -344,7 +344,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) } -static void ahci_print_info(struct ahci_probe_ent *probe_ent) +static void ahci_print_info(struct ahci_uc_priv *probe_ent) { #if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI) # if defined(CONFIG_DM_PCI) @@ -437,13 +437,13 @@ static int ahci_init_one(pci_dev_t dev) #endif int rc; - probe_ent = malloc(sizeof(struct ahci_probe_ent)); + probe_ent = malloc(sizeof(struct ahci_uc_priv)); if (!probe_ent) { printf("%s: No memory for probe_ent\n", __func__); return -ENOMEM; } - memset(probe_ent, 0, sizeof(struct ahci_probe_ent)); + memset(probe_ent, 0, sizeof(struct ahci_uc_priv)); probe_ent->dev = dev; probe_ent->host_flags = ATA_FLAG_SATA @@ -1006,13 +1006,13 @@ int ahci_init(void __iomem *base) int i, rc = 0; u32 linkmap; - probe_ent = malloc(sizeof(struct ahci_probe_ent)); + probe_ent = malloc(sizeof(struct ahci_uc_priv)); if (!probe_ent) { printf("%s: No memory for probe_ent\n", __func__); return -ENOMEM; } - memset(probe_ent, 0, sizeof(struct ahci_probe_ent)); + memset(probe_ent, 0, sizeof(struct ahci_uc_priv)); probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c index c306e927db..78572a5b73 100644 --- a/drivers/ata/dwc_ahsata.c +++ b/drivers/ata/dwc_ahsata.c @@ -100,7 +100,7 @@ static int waiting_for_cmd_completed(u8 *offset, return (i < timeout_msec) ? 0 : -1; } -static int ahci_setup_oobr(struct ahci_probe_ent *probe_ent, +static int ahci_setup_oobr(struct ahci_uc_priv *probe_ent, int clk) { struct sata_host_regs *host_mmio = @@ -112,7 +112,7 @@ static int ahci_setup_oobr(struct ahci_probe_ent *probe_ent, return 0; } -static int ahci_host_init(struct ahci_probe_ent *probe_ent) +static int ahci_host_init(struct ahci_uc_priv *probe_ent) { u32 tmp, cap_save, num_ports; int i, j, timeout = 1000; @@ -275,7 +275,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) return 0; } -static void ahci_print_info(struct ahci_probe_ent *probe_ent) +static void ahci_print_info(struct ahci_uc_priv *probe_ent) { struct sata_host_regs *host_mmio = (struct sata_host_regs *)probe_ent->mmio_base; @@ -331,10 +331,10 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent) static int ahci_init_one(int pdev) { int rc; - struct ahci_probe_ent *probe_ent = NULL; + struct ahci_uc_priv *probe_ent = NULL; - probe_ent = malloc(sizeof(struct ahci_probe_ent)); - memset(probe_ent, 0, sizeof(struct ahci_probe_ent)); + probe_ent = malloc(sizeof(struct ahci_uc_priv)); + memset(probe_ent, 0, sizeof(struct ahci_uc_priv)); probe_ent->dev = pdev; probe_ent->host_flags = ATA_FLAG_SATA @@ -361,7 +361,7 @@ err_out: return rc; } -static int ahci_fill_sg(struct ahci_probe_ent *probe_ent, +static int ahci_fill_sg(struct ahci_uc_priv *probe_ent, u8 port, unsigned char *buf, int buf_len) { struct ahci_ioports *pp = &(probe_ent->port[port]); @@ -408,7 +408,7 @@ static void ahci_fill_cmd_slot(struct ahci_ioports *pp, u32 cmd_slot, u32 opts) #define AHCI_GET_CMD_SLOT(c) ((c) ? ffs(c) : 0) -static int ahci_exec_ata_cmd(struct ahci_probe_ent *probe_ent, +static int ahci_exec_ata_cmd(struct ahci_uc_priv *probe_ent, u8 port, struct sata_fis_h2d *cfis, u8 *buf, u32 buf_len, s32 is_write) { @@ -461,8 +461,8 @@ static int ahci_exec_ata_cmd(struct ahci_probe_ent *probe_ent, static void ahci_set_feature(u8 dev, u8 port) { - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); struct sata_fis_h2d *cfis = &h2d; @@ -476,7 +476,7 @@ static void ahci_set_feature(u8 dev, u8 port) ahci_exec_ata_cmd(probe_ent, port, cfis, NULL, 0, READ_CMD); } -static int ahci_port_start(struct ahci_probe_ent *probe_ent, +static int ahci_port_start(struct ahci_uc_priv *probe_ent, u8 port) { struct ahci_ioports *pp = &(probe_ent->port[port]); @@ -560,7 +560,7 @@ int init_sata(int dev) { int i; u32 linkmap; - struct ahci_probe_ent *probe_ent = NULL; + struct ahci_uc_priv *probe_ent = NULL; #if defined(CONFIG_MX6) if (!is_mx6dq() && !is_mx6dqp()) @@ -573,7 +573,7 @@ int init_sata(int dev) ahci_init_one(dev); - probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + probe_ent = (struct ahci_uc_priv *)sata_dev_desc[dev].priv; linkmap = probe_ent->link_port_map; if (0 == linkmap) { @@ -597,7 +597,7 @@ int init_sata(int dev) int reset_sata(int dev) { - struct ahci_probe_ent *probe_ent; + struct ahci_uc_priv *probe_ent; struct sata_host_regs *host_mmio; if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1)) { @@ -605,7 +605,7 @@ int reset_sata(int dev) return -1; } - probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + probe_ent = (struct ahci_uc_priv *)sata_dev_desc[dev].priv; if (NULL == probe_ent) /* not initialized, so nothing to reset */ return 0; @@ -636,8 +636,8 @@ static void dwc_ahsata_print_info(int dev) static void dwc_ahsata_identify(int dev, u16 *id) { - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; @@ -655,8 +655,8 @@ static void dwc_ahsata_identify(int dev, u16 *id) static void dwc_ahsata_xfer_mode(int dev, u16 *id) { - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; probe_ent->pio_mask = id[ATA_ID_PIO_MODES]; probe_ent->udma_mask = id[ATA_ID_UDMA_MODES]; @@ -667,8 +667,8 @@ static void dwc_ahsata_xfer_mode(int dev, u16 *id) static u32 dwc_ahsata_rw_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write) { - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; @@ -698,8 +698,8 @@ static u32 dwc_ahsata_rw_cmd(int dev, u32 start, u32 blkcnt, void dwc_ahsata_flush_cache(int dev) { - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; @@ -716,8 +716,8 @@ void dwc_ahsata_flush_cache(int dev) static u32 dwc_ahsata_rw_cmd_ext(int dev, u32 start, lbaint_t blkcnt, u8 *buffer, int is_write) { - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; @@ -753,8 +753,8 @@ static u32 dwc_ahsata_rw_cmd_ext(int dev, u32 start, lbaint_t blkcnt, u32 dwc_ahsata_rw_ncq_cmd(int dev, u32 start, lbaint_t blkcnt, u8 *buffer, int is_write) { - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; @@ -795,8 +795,8 @@ u32 dwc_ahsata_rw_ncq_cmd(int dev, u32 start, lbaint_t blkcnt, void dwc_ahsata_flush_cache_ext(int dev) { - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; @@ -812,8 +812,8 @@ void dwc_ahsata_flush_cache_ext(int dev) static void dwc_ahsata_init_wcache(int dev, u16 *id) { - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; if (ata_id_has_wcache(id) && ata_id_wcache_enabled(id)) probe_ent->flags |= SATA_FLAG_WCACHE; @@ -893,7 +893,7 @@ u32 ata_low_level_rw_lba28(int dev, u32 blknr, lbaint_t blkcnt, int sata_port_status(int dev, int port) { struct sata_port_regs *port_mmio; - struct ahci_probe_ent *probe_ent = NULL; + struct ahci_uc_priv *probe_ent = NULL; if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1)) return -EINVAL; @@ -901,7 +901,7 @@ int sata_port_status(int dev, int port) if (sata_dev_desc[dev].priv == NULL) return -ENODEV; - probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + probe_ent = (struct ahci_uc_priv *)sata_dev_desc[dev].priv; port_mmio = (struct sata_port_regs *)probe_ent->port[port].port_mmio; return readl(&(port_mmio->ssts)) & SATA_PORT_SSTS_DET_MASK; @@ -926,8 +926,8 @@ ulong sata_read(int dev, ulong blknr, lbaint_t blkcnt, void *buffer) ulong sata_write(int dev, ulong blknr, lbaint_t blkcnt, const void *buffer) { u32 rc; - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; u32 flags = probe_ent->flags; if (sata_dev_desc[dev].lba48) { @@ -953,8 +953,8 @@ int scan_sata(int dev) u8 product[ATA_ID_PROD_LEN + 1] = { 0 }; u16 *id; u64 n_sectors; - struct ahci_probe_ent *probe_ent = - (struct ahci_probe_ent *)sata_dev_desc[dev].priv; + struct ahci_uc_priv *probe_ent = + (struct ahci_uc_priv *)sata_dev_desc[dev].priv; u8 port = probe_ent->hard_port_no; struct blk_desc *pdev = &(sata_dev_desc[dev]); diff --git a/include/ahci.h b/include/ahci.h index 4876b41e90..1f441d1c80 100644 --- a/include/ahci.h +++ b/include/ahci.h @@ -144,8 +144,19 @@ struct ahci_ioports { u32 rx_fis; }; -struct ahci_probe_ent { +/** + * struct ahci_uc_priv - information about an AHCI controller + * + * When driver model is used, this is accessible using dev_get_uclass_priv(dev) + * where dev is the controller (although at present it sometimes stands alone). + */ +struct ahci_uc_priv { #if defined(CONFIG_DM_PCI) || defined(CONFIG_DM_SCSI) + /* + * TODO(sjg@chromium.org): Drop this once this structure is only used + * in a driver-model context (i.e. attached to a device with + * dev_get_uclass_priv() + */ struct udevice *dev; #else pci_dev_t dev;