All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mugunthan V N <mugunthanvnm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/6] dm: implement a SATA uclass
Date: Tue, 19 Jan 2016 10:39:13 +0530	[thread overview]
Message-ID: <569DC4F9.2080702@ti.com> (raw)
In-Reply-To: <CAEUhbmV_O0FR81gqkvPBQRafSvXEnKDsz=OWWneuia+jEUJ--g@mail.gmail.com>

On Monday 18 January 2016 02:53 PM, Bin Meng wrote:
> +Simon
> 
> On Mon, Jan 18, 2016 at 4:47 PM, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>> Implement a SATA uclass that can represent a SATA controller.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>> ---
>>  drivers/block/Kconfig       | 10 +++++++
>>  drivers/block/Makefile      |  2 ++
>>  drivers/block/sata-uclass.c | 69 +++++++++++++++++++++++++++++++++++++++++++++
>>  include/dm/uclass-id.h      |  1 +
>>  4 files changed, 82 insertions(+)
>>  create mode 100644 drivers/block/sata-uclass.c
>>
>> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
>> index e69de29..44d8a6b 100644
>> --- a/drivers/block/Kconfig
>> +++ b/drivers/block/Kconfig
>> @@ -0,0 +1,10 @@
>> +menu "SATA Device Support"
>> +
>> +config SATA
>> +       bool "Enable driver model for SATA drivers"
>> +       depends on DM
>> +       help
>> +         Enable driver model for block devices like SCSI. It uses the
>> +         same API as block, but now implemented by the uclass.
>> +
>> +endmenu
>> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
>> index eb8bda9..c2dae17 100644
>> --- a/drivers/block/Makefile
>> +++ b/drivers/block/Makefile
>> @@ -5,6 +5,8 @@
>>  # SPDX-License-Identifier:     GPL-2.0+
>>  #
>>
>> +obj-$(CONFIG_SATA) += sata-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/sata-uclass.c b/drivers/block/sata-uclass.c
>> new file mode 100644
>> index 0000000..62773b6
>> --- /dev/null
>> +++ b/drivers/block/sata-uclass.c
>> @@ -0,0 +1,69 @@
>> +/*
>> + * SATA device U-Class driver
>> + *
>> + * (C) Copyright 2016
>> + *     Texas Instruments Incorporated, <www.ti.com>
>> + *
>> + * Author: Mugunthan V N <mugunthanvnm@ti.com>
>> + *
>> + * SPDX-License-Identifier:     GPL-2.0+
>> + */
>> +
>> +#include <common.h>
>> +#include <dm.h>
>> +#include <dm/uclass-internal.h>
>> +#include <dm/device-internal.h>
>> +#include <errno.h>
>> +#include <scsi.h>
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +/*
>> + * struct mmc_uclass_priv - Holds information about a device used by the uclass
>> + */
> 
> Please use single-line comment when it fits just one line. Also it's not mmc.

Will fix it in next version.

> 
>> +struct sata_uclass_priv {
>> +       struct block_dev_desc_t *block_dev;
>> +};
>> +
>> +int scsi_get_device(int index, struct udevice **devp)
>> +{
>> +       struct udevice *dev;
>> +       int ret;
>> +
>> +       ret = uclass_find_device(UCLASS_SATA, index, &dev);
>> +       if (ret || !dev) {
>> +               printf("%d device not found\n", index);
>> +               return ret;
>> +       }
>> +
>> +       ret = device_probe(dev);
>> +       if (ret) {
>> +               error("device probe error\n");
>> +               return ret;
>> +       }
>> +
>> +       *devp = dev;
>> +
>> +       return ret;
>> +}
>> +
>> +void scsi_init(void)
>> +{
>> +       struct udevice *dev;
>> +       int ret;
>> +
>> +       ret = scsi_get_device(0, &dev);
>> +       if (ret || !dev) {
>> +               error("scsi device not found\n");
>> +               return;
>> +       }
>> +
>> +       scsi_scan(1);
>> +}
>> +
>> +UCLASS_DRIVER(sata) = {
>> +       .id             = UCLASS_SATA,
>> +       .name           = "sata",
>> +       .flags          = DM_UC_FLAG_SEQ_ALIAS,
>> +       .per_device_auto_alloc_size = sizeof(struct sata_uclass_priv),
>> +};
>> diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
>> index 27fa0b6..80977ca 100644
>> --- a/include/dm/uclass-id.h
>> +++ b/include/dm/uclass-id.h
>> @@ -55,6 +55,7 @@ enum uclass_id {
>>         UCLASS_RESET,           /* Reset device */
>>         UCLASS_REMOTEPROC,      /* Remote Processor device */
>>         UCLASS_RTC,             /* Real time clock device */
>> +       UCLASS_SATA,            /* SATA devices */
>>         UCLASS_SERIAL,          /* Serial UART */
>>         UCLASS_SPI,             /* SPI bus */
>>         UCLASS_SPI_FLASH,       /* SPI flash */
>> --
> 
> I would like to see a full DM conversion of the SCSI codes. But this
> patch looks to me it's just a place holder?

Ultimately that will be the final goal, now this is just a place holder
to move towards DM conversion.

Regards
Mugunthan V N

  reply	other threads:[~2016-01-19  5:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18  8:47 [U-Boot] [PATCH 0/6] driver model bring-up of sata device on dra72 and dra74 evm Mugunthan V N
2016-01-18  8:47 ` [U-Boot] [PATCH 1/6] arm: omap: sata: move enable sata clocks to enable_basic_clocks() Mugunthan V N
2016-01-19 18:09   ` Tom Rini
2016-01-18  8:47 ` [U-Boot] [PATCH 2/6] dm: implement a SATA uclass Mugunthan V N
2016-01-18  9:23   ` Bin Meng
2016-01-19  5:09     ` Mugunthan V N [this message]
2016-01-20  4:35       ` Simon Glass
2016-01-18  8:47 ` [U-Boot] [PATCH 3/6] arm: omap-common: sata: prepare driver for DM conversion Mugunthan V N
2016-01-19 18:10   ` Tom Rini
2016-01-18  8:47 ` [U-Boot] [PATCH 4/6] drivers: block: dwc_ahci: Implement a driver for Synopsys DWC sata device Mugunthan V N
2016-01-19 18:11   ` Tom Rini
2016-01-18  8:47 ` [U-Boot] [PATCH 5/6] defconfig: dra74_evm: enable sata driver model Mugunthan V N
2016-01-19 18:11   ` Tom Rini
2016-01-18  8:47 ` [U-Boot] [PATCH 6/6] defconfig: dra72_evm: " Mugunthan V N
2016-01-19 18:11   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=569DC4F9.2080702@ti.com \
    --to=mugunthanvnm@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.