diff mbox

[U-Boot,v2,29/55] ahci: Add a disk-controller uclass

Message ID 1453072320-24298-30-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Bin Meng
Headers show

Commit Message

Simon Glass Jan. 17, 2016, 11:11 p.m. UTC
Add a uclass ID for a disk controller. This can be used by AHCI/SATA or
other controller types. There are no operations and no interface so far,
but it is possible to probe a SATA device.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Rename the AHCI uclass to DISK

 drivers/block/Kconfig       |  9 +++++++++
 drivers/block/Makefile      |  1 +
 drivers/block/disk-uclass.c | 14 ++++++++++++++
 include/dm/uclass-id.h      |  1 +
 4 files changed, 25 insertions(+)
 create mode 100644 drivers/block/disk-uclass.c

Comments

Bin Meng Jan. 21, 2016, 7:08 a.m. UTC | #1
On Mon, Jan 18, 2016 at 7:11 AM, Simon Glass <sjg@chromium.org> wrote:
> Add a uclass ID for a disk controller. This can be used by AHCI/SATA or
> other controller types. There are no operations and no interface so far,
> but it is possible to probe a SATA device.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Rename the AHCI uclass to DISK
>
>  drivers/block/Kconfig       |  9 +++++++++
>  drivers/block/Makefile      |  1 +
>  drivers/block/disk-uclass.c | 14 ++++++++++++++
>  include/dm/uclass-id.h      |  1 +
>  4 files changed, 25 insertions(+)
>  create mode 100644 drivers/block/disk-uclass.c
>
> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> index e69de29..989b21d 100644
> --- a/drivers/block/Kconfig
> +++ b/drivers/block/Kconfig
> @@ -0,0 +1,9 @@
> +config DISK
> +       bool "Support disk controllers with driver model"
> +       depends on DM
> +       default y if DM
> +       help
> +         This enables a uclass for disk controllers  in U-Boot. Various driver

nits: one more space before "in U-Boot"

I can fix this when applying.

> +         types can use this, such as AHCI/SATA. It does not provide any standard
> +         operations at present. The block device interface has not been converted
> +         to driver model.
> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> index eb8bda9..5eb87e0 100644
> --- a/drivers/block/Makefile
> +++ b/drivers/block/Makefile
> @@ -5,6 +5,7 @@
>  # SPDX-License-Identifier:     GPL-2.0+
>  #
>
> +obj-$(CONFIG_DISK) += disk-uclass.o
>  obj-$(CONFIG_SCSI_AHCI) += ahci.o
>  obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o
>  obj-$(CONFIG_FSL_SATA) += fsl_sata.o
> diff --git a/drivers/block/disk-uclass.c b/drivers/block/disk-uclass.c
> new file mode 100644
> index 0000000..d665b35
> --- /dev/null
> +++ b/drivers/block/disk-uclass.c
> @@ -0,0 +1,14 @@
> +/*
> + * Copyright (c) 2015 Google, Inc
> + * Written by Simon Glass <sjg@chromium.org>
> + *
> + * SPDX-License-Identifier:    GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <dm.h>
> +
> +UCLASS_DRIVER(disk) = {
> +       .id             = UCLASS_DISK,
> +       .name           = "disk",
> +};
> diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
> index 4a6827b..2e10953 100644
> --- a/include/dm/uclass-id.h
> +++ b/include/dm/uclass-id.h
> @@ -29,6 +29,7 @@ enum uclass_id {
>         UCLASS_CLK,             /* Clock source, e.g. used by peripherals */
>         UCLASS_CPU,             /* CPU, typically part of an SoC */
>         UCLASS_CROS_EC,         /* Chrome OS EC */
> +       UCLASS_DISK,            /* Disk controller, e.g. SATA */
>         UCLASS_DISPLAY_PORT,    /* Display port video */
>         UCLASS_RAM,             /* RAM controller */
>         UCLASS_ETH,             /* Ethernet device */
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng Jan. 21, 2016, 8:01 a.m. UTC | #2
On Thu, Jan 21, 2016 at 3:08 PM, Bin Meng <bmeng.cn@gmail.com> wrote:
> On Mon, Jan 18, 2016 at 7:11 AM, Simon Glass <sjg@chromium.org> wrote:
>> Add a uclass ID for a disk controller. This can be used by AHCI/SATA or
>> other controller types. There are no operations and no interface so far,
>> but it is possible to probe a SATA device.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> Changes in v2:
>> - Rename the AHCI uclass to DISK
>>
>>  drivers/block/Kconfig       |  9 +++++++++
>>  drivers/block/Makefile      |  1 +
>>  drivers/block/disk-uclass.c | 14 ++++++++++++++
>>  include/dm/uclass-id.h      |  1 +
>>  4 files changed, 25 insertions(+)
>>  create mode 100644 drivers/block/disk-uclass.c
>>
>> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
>> index e69de29..989b21d 100644
>> --- a/drivers/block/Kconfig
>> +++ b/drivers/block/Kconfig
>> @@ -0,0 +1,9 @@
>> +config DISK
>> +       bool "Support disk controllers with driver model"
>> +       depends on DM
>> +       default y if DM
>> +       help
>> +         This enables a uclass for disk controllers  in U-Boot. Various driver
>
> nits: one more space before "in U-Boot"
>
> I can fix this when applying.

Fixed nits, and

>
>> +         types can use this, such as AHCI/SATA. It does not provide any standard
>> +         operations at present. The block device interface has not been converted
>> +         to driver model.
>> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
>> index eb8bda9..5eb87e0 100644
>> --- a/drivers/block/Makefile
>> +++ b/drivers/block/Makefile
>> @@ -5,6 +5,7 @@
>>  # SPDX-License-Identifier:     GPL-2.0+
>>  #
>>
>> +obj-$(CONFIG_DISK) += disk-uclass.o
>>  obj-$(CONFIG_SCSI_AHCI) += ahci.o
>>  obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o
>>  obj-$(CONFIG_FSL_SATA) += fsl_sata.o
>> diff --git a/drivers/block/disk-uclass.c b/drivers/block/disk-uclass.c
>> new file mode 100644
>> index 0000000..d665b35
>> --- /dev/null
>> +++ b/drivers/block/disk-uclass.c
>> @@ -0,0 +1,14 @@
>> +/*
>> + * Copyright (c) 2015 Google, Inc
>> + * Written by Simon Glass <sjg@chromium.org>
>> + *
>> + * SPDX-License-Identifier:    GPL-2.0+
>> + */
>> +
>> +#include <common.h>
>> +#include <dm.h>
>> +
>> +UCLASS_DRIVER(disk) = {
>> +       .id             = UCLASS_DISK,
>> +       .name           = "disk",
>> +};
>> diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
>> index 4a6827b..2e10953 100644
>> --- a/include/dm/uclass-id.h
>> +++ b/include/dm/uclass-id.h
>> @@ -29,6 +29,7 @@ enum uclass_id {
>>         UCLASS_CLK,             /* Clock source, e.g. used by peripherals */
>>         UCLASS_CPU,             /* CPU, typically part of an SoC */
>>         UCLASS_CROS_EC,         /* Chrome OS EC */
>> +       UCLASS_DISK,            /* Disk controller, e.g. SATA */
>>         UCLASS_DISPLAY_PORT,    /* Display port video */
>>         UCLASS_RAM,             /* RAM controller */
>>         UCLASS_ETH,             /* Ethernet device */
>> --
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86/master, thanks!
diff mbox

Patch

diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index e69de29..989b21d 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -0,0 +1,9 @@ 
+config DISK
+	bool "Support disk controllers with driver model"
+	depends on DM
+	default y 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
+	  operations at present. The block device interface has not been converted
+	  to driver model.
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index eb8bda9..5eb87e0 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -5,6 +5,7 @@ 
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
+obj-$(CONFIG_DISK) += disk-uclass.o
 obj-$(CONFIG_SCSI_AHCI) += ahci.o
 obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o
 obj-$(CONFIG_FSL_SATA) += fsl_sata.o
diff --git a/drivers/block/disk-uclass.c b/drivers/block/disk-uclass.c
new file mode 100644
index 0000000..d665b35
--- /dev/null
+++ b/drivers/block/disk-uclass.c
@@ -0,0 +1,14 @@ 
+/*
+ * Copyright (c) 2015 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+
+UCLASS_DRIVER(disk) = {
+	.id		= UCLASS_DISK,
+	.name		= "disk",
+};
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index 4a6827b..2e10953 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -29,6 +29,7 @@  enum uclass_id {
 	UCLASS_CLK,		/* Clock source, e.g. used by peripherals */
 	UCLASS_CPU,		/* CPU, typically part of an SoC */
 	UCLASS_CROS_EC,		/* Chrome OS EC */
+	UCLASS_DISK,		/* Disk controller, e.g. SATA */
 	UCLASS_DISPLAY_PORT,	/* Display port video */
 	UCLASS_RAM,		/* RAM controller */
 	UCLASS_ETH,		/* Ethernet device */