From patchwork Sun Sep 10 12:12:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 812128 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VpRtqJ3b"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xqqbQ3QVQz9s7g for ; Sun, 10 Sep 2017 22:08:49 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E4BA6C21F70; Sun, 10 Sep 2017 12:08:35 +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=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 53E8FC21DEB; Sun, 10 Sep 2017 12:08:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3820FC21C4C; Sun, 10 Sep 2017 12:08:32 +0000 (UTC) Received: from mail-io0-f193.google.com (mail-io0-f193.google.com [209.85.223.193]) by lists.denx.de (Postfix) with ESMTPS id A1038C21C4C for ; Sun, 10 Sep 2017 12:08:31 +0000 (UTC) Received: by mail-io0-f193.google.com with SMTP id g32so25036ioj.1 for ; Sun, 10 Sep 2017 05:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=B8q8V6Mkwtn3UlkRHWB0XfDyiu4YcHFmVPFHVUP68kY=; b=VpRtqJ3bAFqB1LIzPOriNIXdA3n0SZjw/egB1j3BJcoJqZcxsfwgLMa1SDEwMXYNVi X8kQ4LJ1ruq50HKMlC8quZtwSPre5DvkHH2xzXcNPsTMYRciCwFWabsSzo4LXpXUKKJK 8NJEum3VZhkhJ2UU1jTRjtKzjoEl9e8EACy5rf4+di1es36olFm6sEr0HCHUvwvk2aSp 5pYOrVLKdxxF+I+AyzGOLJS/6+GF7VTL+zC63ypEMPjFesLwyBvn6OQDs+GKi4a3nUoZ 8u3Zi5kaE712YJLtubzn74MMc5acQzG4F8DM5l89w+a3UpmnJjIOMaDHtLKNRhuwX5qu fgaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=B8q8V6Mkwtn3UlkRHWB0XfDyiu4YcHFmVPFHVUP68kY=; b=p6NzBkjpP2RPiAtUub8sr+KQ8gYRN9JgiwMywLP1cwgu219uw7/dZkMDQ5fMCRapG1 gibjtmGxXtdErJGoGdD9O1ySj0wB/XrYwK5wa19iuA3TdsAvcX2U5G+2zrvDmAPBsxMm mC0P6ierxszBFrBAI/Po/NsrEIBW9eM5vhCd7W3Le2g1D30TUGvKgjSwXIuQ13pteiK6 VH8Ky56lrmIlVTpg2giI1oG4eIVZqD5v9nkswJExqFKF9mK+m1+2yv4jLP5kKFH0Kv2U 0Tg3ZJZFlPx3KgAvjFk7grDpPDGVi1CtiJ0WPrqslcvHNfWrdpRkgD9eur5dGAMxqUWG yzXQ== X-Gm-Message-State: AHPjjUjaYNO0BXHx6l5rC/9FzHPAiQ/n5WKOoJxSZmuu0ZjppFozFw5R 28WvaQb0Cf+z9A== X-Google-Smtp-Source: AOwi7QDFlNdrT3sc9MuMnGU+Dl7+TgFwOcG20PrlXTusltIrASNCw0/W32Hgyjs7mLoBa6sCb+6rog== X-Received: by 10.107.11.214 with SMTP id 83mr11324108iol.254.1505045310223; Sun, 10 Sep 2017 05:08:30 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id d3sm2992336iog.0.2017.09.10.05.08.28 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Sep 2017 05:08:28 -0700 (PDT) From: Bin Meng To: Tom Rini , U-Boot Mailing List Date: Sun, 10 Sep 2017 05:12:50 -0700 Message-Id: <1505045573-11552-1-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 Subject: [U-Boot] [PATCH v4 1/4] blk: Use macros for block device vendor/product/rev string size 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" So far these are using magic numbers. Replace them with macros. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- Changes in v4: None Changes in v3: - Change BLK_XXX_SIZE to not count the ending NULL Changes in v2: None include/blk.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/blk.h b/include/blk.h index a106f9c..27abfdd 100644 --- a/include/blk.h +++ b/include/blk.h @@ -36,6 +36,10 @@ enum if_type { IF_TYPE_COUNT, /* Number of interface types */ }; +#define BLK_VEN_SIZE 40 +#define BLK_PRD_SIZE 20 +#define BLK_REV_SIZE 8 + /* * With driver model (CONFIG_BLK) this is uclass platform data, accessible * with dev_get_uclass_platdata(dev) @@ -60,9 +64,9 @@ struct blk_desc { lbaint_t lba; /* number of blocks */ unsigned long blksz; /* block size */ int log2blksz; /* for convenience: log2(blksz) */ - char vendor[40+1]; /* IDE model, SCSI Vendor */ - char product[20+1]; /* IDE Serial no, SCSI product */ - char revision[8+1]; /* firmware revision */ + char vendor[BLK_VEN_SIZE + 1]; /* device vendor string */ + char product[BLK_PRD_SIZE + 1]; /* device product number */ + char revision[BLK_REV_SIZE + 1]; /* firmware revision */ #if CONFIG_IS_ENABLED(BLK) /* * For now we have a few functions which take struct blk_desc as a From patchwork Sun Sep 10 12:12:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 812129 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JUjivodl"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xqqcQ09smz9s7g for ; Sun, 10 Sep 2017 22:09:41 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C0318C21F6A; Sun, 10 Sep 2017 12:08:52 +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=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 5B478C21F3A; Sun, 10 Sep 2017 12:08:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4139FC21DC0; Sun, 10 Sep 2017 12:08:33 +0000 (UTC) Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) by lists.denx.de (Postfix) with ESMTPS id A5A59C21C4C for ; Sun, 10 Sep 2017 12:08:32 +0000 (UTC) Received: by mail-io0-f196.google.com with SMTP id 2so2935177ion.3 for ; Sun, 10 Sep 2017 05:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=Gib/bmKUucv5vOb+V+bCyjy7qv0YxUqhd54L1seldUI=; b=JUjivodlXzMnkn64ObOL/4yiK04pQWtCHTyevY12G9tXVd59zRf6UwvBVABfGgVLkw vcuG7PQ1qy+e7nO5q1o0Z4uk4nlpdGsnCCYCgCf8foPzi8Q7Bn0jYzRHrA0DNfnxamn7 9h/NgFwo2eXEn2ot1yzUzwNiWB13FKbMxizzmZ4E4S7Bay3E7UtPAm5oL+5c+uYuDk0e id49ChesIjIartR/5n7K6vK/a/zRr1zFRph5iVYnOgIJEaQfI0bebyjucT5SEApHyy6a Lpu3oypG04LrJim9lTTYMVIGtAjgUX9WGQwGb/6kyiW4VgsOV18j/6a4w5w7bkvYLDs1 T9aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Gib/bmKUucv5vOb+V+bCyjy7qv0YxUqhd54L1seldUI=; b=OUS8zhZ+beJGY432bQwWa8wdgRH76S6oRrTOVG5Ti31IyHmv9xf5fbiqIGF5X1Fs6t Z0PUpJF4zSJpYxpUbxzuXInIVD2Gv3XdxG7tkOTeYJYnCzHtdaDmuYAKTJlhxjSONu79 SSkKJZWkSC3BDBW6GcEH7UzEAmtoVK5SParZ3T3uKD7x/44ylrmqEvx9WwqrqHpW5p38 IbNDRtVUFxQ5sHpb92ITRuaa8fMFMqwf0fdSzIxLJaKnbAjlBsVUaWv03k+7S8NNXsTN kXGDS/sqlIYegZBZ0WfF8q45nrhmhT24yaMwAV0YqxT3uWPI/MWqsZVedrSbsSkuWM7Y t2HQ== X-Gm-Message-State: AHPjjUgqOc+Ze4kG6y/Qv2s+sU3f+Ri1b9vQj4Ur5tN+PzmLgmICHD/J ZV2nZMsZQkg0LOza X-Google-Smtp-Source: AOwi7QCAWZ9SdijgHC1FcsYAdJ5P7H70EgTqyvqoPGW3AIIBIbX8QFs3bVGdl+yaCnsRHC8OrUUUyg== X-Received: by 10.107.5.194 with SMTP id 185mr11659236iof.98.1505045311604; Sun, 10 Sep 2017 05:08:31 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id d3sm2992336iog.0.2017.09.10.05.08.30 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Sep 2017 05:08:30 -0700 (PDT) From: Bin Meng To: Tom Rini , U-Boot Mailing List Date: Sun, 10 Sep 2017 05:12:51 -0700 Message-Id: <1505045573-11552-2-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1505045573-11552-1-git-send-email-bmeng.cn@gmail.com> References: <1505045573-11552-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH v4 2/4] block: ide: Fix block read/write with driver model 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 converts the IDE driver to driver model so that block read and write are fully functional. Fixes: b7c6baef ("x86: Convert MMC to driver model") Reported-by: Heinrich Schuchardt Signed-off-by: Bin Meng Reviewed-by: Simon Glass Tested-by: Heinrich Schuchardt --- Changes in v4: - Ensure the strings end with '\0' Changes in v3: - Updated BLK_XXX_SIZE usage Changes in v2: - Fixed 'fatls ide 0' issue drivers/block/blk-uclass.c | 2 +- drivers/block/ide.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++ include/dm/uclass-id.h | 1 + 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index e5f00dc..8e58580 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -26,7 +26,7 @@ static const char *if_typename_str[IF_TYPE_COUNT] = { }; static enum uclass_id if_type_uclass_id[IF_TYPE_COUNT] = { - [IF_TYPE_IDE] = UCLASS_INVALID, + [IF_TYPE_IDE] = UCLASS_IDE, [IF_TYPE_SCSI] = UCLASS_SCSI, [IF_TYPE_ATAPI] = UCLASS_INVALID, [IF_TYPE_USB] = UCLASS_MASS_STORAGE, diff --git a/drivers/block/ide.c b/drivers/block/ide.c index ce51153..ed3b27e 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -827,12 +827,20 @@ void ide_init(void) ide_ident(&ide_dev_desc[i]); dev_print(&ide_dev_desc[i]); +#ifndef CONFIG_BLK if ((ide_dev_desc[i].lba > 0) && (ide_dev_desc[i].blksz > 0)) { /* initialize partition type */ part_init(&ide_dev_desc[i]); } +#endif } WATCHDOG_RESET(); + +#ifdef CONFIG_BLK + struct udevice *dev; + + uclass_first_device(UCLASS_IDE, &dev); +#endif } /* We only need to swap data if we are running on a big endian cpu. */ @@ -1147,6 +1155,26 @@ int ide_device_present(int dev) #endif #ifdef CONFIG_BLK +static int ide_blk_probe(struct udevice *udev) +{ + struct blk_desc *desc = dev_get_uclass_platdata(udev); + + /* fill in device vendor/product/rev strings */ + strncpy(desc->vendor, ide_dev_desc[desc->devnum].vendor, + BLK_VEN_SIZE); + desc->vendor[BLK_VEN_SIZE] = '\0'; + strncpy(desc->product, ide_dev_desc[desc->devnum].product, + BLK_PRD_SIZE); + desc->product[BLK_PRD_SIZE] = '\0'; + strncpy(desc->revision, ide_dev_desc[desc->devnum].revision, + BLK_REV_SIZE); + desc->revision[BLK_REV_SIZE] = '\0'; + + part_init(desc); + + return 0; +} + static const struct blk_ops ide_blk_ops = { .read = ide_read, .write = ide_write, @@ -1156,6 +1184,51 @@ U_BOOT_DRIVER(ide_blk) = { .name = "ide_blk", .id = UCLASS_BLK, .ops = &ide_blk_ops, + .probe = ide_blk_probe, +}; + +static int ide_probe(struct udevice *udev) +{ + struct udevice *blk_dev; + char name[20]; + int blksz; + lbaint_t size; + int i; + int ret; + + for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; i++) { + if (ide_dev_desc[i].type != DEV_TYPE_UNKNOWN) { + sprintf(name, "blk#%d", i); + + blksz = ide_dev_desc[i].blksz; + size = blksz * ide_dev_desc[i].lba; + ret = blk_create_devicef(udev, "ide_blk", name, + IF_TYPE_IDE, i, + blksz, size, &blk_dev); + if (ret) + return ret; + } + } + + return 0; +} + +U_BOOT_DRIVER(ide) = { + .name = "ide", + .id = UCLASS_IDE, + .probe = ide_probe, +}; + +struct pci_device_id ide_supported[] = { + { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_IDE << 8, 0xffff00) }, + { } +}; + +U_BOOT_PCI_DEVICE(ide, ide_supported); + +UCLASS_DRIVER(ide) = { + .name = "ide", + .id = UCLASS_IDE, }; #else U_BOOT_LEGACY_BLK(ide) = { diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 1a50199..3fc2083 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -41,6 +41,7 @@ enum uclass_id { UCLASS_I2C_EEPROM, /* I2C EEPROM device */ UCLASS_I2C_GENERIC, /* Generic I2C device */ UCLASS_I2C_MUX, /* I2C multiplexer */ + UCLASS_IDE, /* IDE device */ UCLASS_IRQ, /* Interrupt controller */ UCLASS_KEYBOARD, /* Keyboard input device */ UCLASS_LED, /* Light-emitting diode (LED) */ From patchwork Sun Sep 10 12:12:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 812130 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IIKdTxHz"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xqqcl49hBz9s7g for ; Sun, 10 Sep 2017 22:09:59 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 56D39C21F75; Sun, 10 Sep 2017 12:09:09 +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=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 7745AC21F50; Sun, 10 Sep 2017 12:08:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 42D72C21EBF; Sun, 10 Sep 2017 12:08:37 +0000 (UTC) Received: from mail-io0-f195.google.com (mail-io0-f195.google.com [209.85.223.195]) by lists.denx.de (Postfix) with ESMTPS id 26F4BC21E97 for ; Sun, 10 Sep 2017 12:08:34 +0000 (UTC) Received: by mail-io0-f195.google.com with SMTP id g32so25077ioj.1 for ; Sun, 10 Sep 2017 05:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=yQ+OuHzdo8IrcV+Ic6f/l4Qk8iNcx/+sJWC82jLPV0g=; b=IIKdTxHzd3ISYoCMoRPXOTIhWkYgNta1vMOqLp8z3Sm3ZMRfg6kr/GHR8NNzRHj7oq eu+yOlWLC7kjNVfOAAo7fonTKq0ddd6hiUWlJLoJOdJeklnl6JhULMIM7v8JFIfk7hp5 G7/4LcYoQ3ECU0QJdxh71RgPQfnfL4xHO8IXr9lkJ33WZMyvk+N3NxeAjf9eMV5zYBNu RC9C7J4ng82sDuc1caMNodjKajs3VjtP2fSyYV9+23gmIXgus2Rz9dqmlYVFAxJGjaqy +mo51SXD/KADvIZCQHGJwd9VrQeZFFnQZFU3mqWyefHQC699inh6XCEBH0bX1o9GgCHb iGOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=yQ+OuHzdo8IrcV+Ic6f/l4Qk8iNcx/+sJWC82jLPV0g=; b=sv2FrBbfwCDGgmOTBghvPe+ndcAb0WxXa0aqr3O+GkDDXzwH3nrmhzQVtxFDNNtFL2 jzZ8R47vh0FN+aJAFDVheSkA6l4EDl+LPobREazOi1TPG3hmF828xjPIuzyqb6Fs5qtM miozR9E8Ld+Ecslt8EDVsCoImcDS8apFCDcyF3w2H1bccMA9qDhUqw2v1SPX+yQdYufl poLM4R5IDP0UvOSBaixiUHnS5jWTMdWkBHbV0qrgF3DWj4FmMiB/F/0Q2fTGoc6mRBD1 fkwXnRESZYPoJ3lLuBcqAOEjxZSzVCtsHJjI+2B6pAX00fdw3EljeD6nTgWKgzeerlmP xDYQ== X-Gm-Message-State: AHPjjUirj50cS0jgIUVgtJa+xh9J+R7JalzSw618SU0xUzNw8F89597y JYSOmvDt7R1zmw== X-Google-Smtp-Source: AOwi7QAA4KerfK+eU/pWDSMj4ZlUlxvJd6AHggFl6BSLdNjvY+FXwl6RjD9MO0zGNq5QYy8XBdIQfg== X-Received: by 10.107.12.84 with SMTP id w81mr11818797ioi.194.1505045313149; Sun, 10 Sep 2017 05:08:33 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id d3sm2992336iog.0.2017.09.10.05.08.31 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Sep 2017 05:08:32 -0700 (PDT) From: Bin Meng To: Tom Rini , U-Boot Mailing List Date: Sun, 10 Sep 2017 05:12:52 -0700 Message-Id: <1505045573-11552-3-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1505045573-11552-1-git-send-email-bmeng.cn@gmail.com> References: <1505045573-11552-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH v4 3/4] block: ide: Don't bother to create BLK device if no CDROM inserted 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" When there is no CDROM inserted, the block size is zero hence there is no need to create a BLK device for it. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/block/ide.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/block/ide.c b/drivers/block/ide.c index ed3b27e..9ab01a9 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -1202,6 +1202,13 @@ static int ide_probe(struct udevice *udev) blksz = ide_dev_desc[i].blksz; size = blksz * ide_dev_desc[i].lba; + + /* + * With CDROM, if there is no CD inserted, blksz will + * be zero, don't bother to create IDE block device. + */ + if (!blksz) + continue; ret = blk_create_devicef(udev, "ide_blk", name, IF_TYPE_IDE, i, blksz, size, &blk_dev); From patchwork Sun Sep 10 12:12:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 812131 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Bl20ONcA"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xqqd96djCz9s7g for ; Sun, 10 Sep 2017 22:10:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A17C2C21C4C; Sun, 10 Sep 2017 12:09:23 +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=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 C5C15C21F16; Sun, 10 Sep 2017 12:08:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 630B8C21F16; Sun, 10 Sep 2017 12:08:39 +0000 (UTC) Received: from mail-io0-f194.google.com (mail-io0-f194.google.com [209.85.223.194]) by lists.denx.de (Postfix) with ESMTPS id 9E87FC21EA9 for ; Sun, 10 Sep 2017 12:08:35 +0000 (UTC) Received: by mail-io0-f194.google.com with SMTP id d16so1102546ioj.2 for ; Sun, 10 Sep 2017 05:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=jLte1IC6eQ/SUkIs4JescbqNupBbE88pH7Pn/bbySRY=; b=Bl20ONcARDOAWk6xfh6/xw6HDIbo6fr8HiVMD1wLw+uSjSgMEdZftsuWnJzzq4nQjW A1IRVtsnoThhpoKMgdG69pNKz/Y14APCEppZwL6xUn6kdAzqM1Nq7p7aip5kvQ22mEI4 geonN9KsKlB2PoZ0wiLVb47Pi3UJqU4exxn5Q5gIT29gDk5pADAVjVrLCKHswa3lh7NM 1faeTcXOPbw3wM8NJh0HGsdwxzd5QvNsQvMQAbz/60ZFgVNwI3HPgl2PaHzw16HLYkmi YAA5kK1gqx1/dxzalhSMF7voHmxr4FimsfUaRhFH4A1WtGd/vEjBu+iynAjVWe5Tmr/Z sxog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=jLte1IC6eQ/SUkIs4JescbqNupBbE88pH7Pn/bbySRY=; b=OZXr8gI808lmS2cv4FHL8tuhZugz3NP2e0oRtMsVgiPXhibY/pzlxjLdfJyWHWL9Ti htZ1gsJpr57gsDLtfiuGjL5Qgv3amR89WjQ/HS9Oih36Rcty4xMZL1pvuAjKGMuR2wiA PObhL188Qw+jZSC0Du3DRwNtPE1kS8I7LP/Jmki4val8hzt1N9bGNKjDt3+E8YOoKQk+ 2uh4duObvFwF5wNN80QPFlzoKUw6qSLDpOts4ILHAbGeACIHZH4KDq1I3d6XX8/HNU/X Ex4NgWD2IZfLZAVoUk15h4mXjxjegk79U5nzV3ivq/okc204UCe3EJP2K3hXBrRFQ2LH mVnQ== X-Gm-Message-State: AHPjjUgwRGVozEXMf8h9+1zMzZIKiZSL5v69AcIBmvY79b5kTRpC1UFx BRvDVAbpayOekQ1y X-Google-Smtp-Source: AOwi7QBLy529MxPBC2Nk1gBkdPgUCiu0GTk0p359mnuONsLEVcP7Xio3LMPc816LiYEfV5p8IC7yrg== X-Received: by 10.107.8.89 with SMTP id 86mr11700665ioi.234.1505045314609; Sun, 10 Sep 2017 05:08:34 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id d3sm2992336iog.0.2017.09.10.05.08.33 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Sep 2017 05:08:33 -0700 (PDT) From: Bin Meng To: Tom Rini , U-Boot Mailing List Date: Sun, 10 Sep 2017 05:12:53 -0700 Message-Id: <1505045573-11552-4-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1505045573-11552-1-git-send-email-bmeng.cn@gmail.com> References: <1505045573-11552-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH v4 4/4] cmd: ide: Make the first device the default one 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" At present the IDE device number is initialized to -1, which means we cannot type "ide read" command before setting the device number via "ide device #". For convenience, let's set the first device as the default one. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None cmd/ide.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ide.c b/cmd/ide.c index e3c3242..bdb5980 100644 --- a/cmd/ide.c +++ b/cmd/ide.c @@ -30,7 +30,7 @@ #endif /* Current I/O Device */ -static int curr_device = -1; +static int curr_device; int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) {