public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mugunthan V N <mugunthanvnm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 02/13] dm: core: Add a new api to get indexed device address
Date: Sat, 31 Oct 2015 11:51:41 +0530	[thread overview]
Message-ID: <56345DF5.6070701@ti.com> (raw)
In-Reply-To: <CAPnjgZ01Mu6ccZix5Ka5zqVz9_ThYbfvv4_8R+eJwdDSwxs9nQ@mail.gmail.com>

On Thursday 29 October 2015 10:47 PM, Simon Glass wrote:
> Hi Mugunthan,
> 
> On 27 October 2015 at 05:12, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>> Add new api to get device address based on index.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>> ---
>>  drivers/core/device.c | 20 ++++++++++++++++++++
>>  include/dm/device.h   |  9 +++++++++
>>  2 files changed, 29 insertions(+)
>>
>> diff --git a/drivers/core/device.c b/drivers/core/device.c
>> index a3dc2ca..7557e5c 100644
>> --- a/drivers/core/device.c
>> +++ b/drivers/core/device.c
>> @@ -620,6 +620,26 @@ fdt_addr_t dev_get_addr(struct udevice *dev)
>>  #endif
>>  }
>>
>> +fdt_addr_t dev_get_addr_index(struct udevice *dev, int index)
>> +{
>> +#if CONFIG_IS_ENABLED(OF_CONTROL)
>> +       fdt_addr_t addr;
>> +
> 
> I think you are missing the 'if (CONFIG_IS_ENABLED(OF_TRANSLATE)) {'
> logic from dev_get_addr(). Also that function should call your new
> function I think to avoid duplicated code.

Agreed, will fix in v2.

> 
>> +       addr = fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
>> +                                               dev->parent->of_offset,
>> +                                               dev->of_offset, "reg",
>> +                                               index, NULL);
>> +       if (CONFIG_IS_ENABLED(SIMPLE_BUS) && addr != FDT_ADDR_T_NONE) {
>> +               if (device_get_uclass_id(dev->parent) == UCLASS_SIMPLE_BUS)
>> +                       addr = simple_bus_translate(dev->parent, addr);
>> +       }
>> +
>> +       return addr;
>> +#else
>> +       return FDT_ADDR_T_NONE;
>> +#endif
>> +}
>> +
>>  bool device_has_children(struct udevice *dev)
>>  {
>>         return !list_empty(&dev->child_head);
>> diff --git a/include/dm/device.h b/include/dm/device.h
>> index 8519612..e6506b4 100644
>> --- a/include/dm/device.h
>> +++ b/include/dm/device.h
>> @@ -441,6 +441,15 @@ int device_find_next_child(struct udevice **devp);
>>  fdt_addr_t dev_get_addr(struct udevice *dev);
>>
>>  /**
>> + * dev_get_addr() - Get the reg property of a device
>> + *
>> + * @dev: Pointer to a device
>> + *
>> + * @return addr
> 
> Please update the comment here with the new parameter and what it does.

Will fix in v2.

Regards
Mugunthan V N

  reply	other threads:[~2015-10-31  6:21 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 11:12 [U-Boot] [PATCH 00/13] device model bringup of ti-qspi on dra72, dra74 and am437x-sk evm Mugunthan V N
2015-10-27 11:12 ` [U-Boot] [PATCH 01/13] drivers: spi: ti_qspi: prepare driver for DM conversion Mugunthan V N
2015-10-29 17:17   ` Simon Glass
2015-10-27 11:12 ` [U-Boot] [PATCH 02/13] dm: core: Add a new api to get indexed device address Mugunthan V N
2015-10-29 17:17   ` Simon Glass
2015-10-31  6:21     ` Mugunthan V N [this message]
2015-10-27 11:12 ` [U-Boot] [PATCH 03/13] spi: Add support for dual and quad mode Mugunthan V N
2015-10-29 17:17   ` Simon Glass
2015-10-27 11:12 ` [U-Boot] [PATCH 04/13] drivers: spi: spi-uclass: fix spi slave device register Mugunthan V N
2015-10-29 17:17   ` Simon Glass
2015-10-31 11:28     ` Mugunthan V N
2015-10-27 11:13 ` [U-Boot] [PATCH 05/13] dra7xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl Mugunthan V N
2015-10-29 17:17   ` Simon Glass
2015-10-31 11:39     ` Mugunthan V N
2015-11-06  3:16       ` Simon Glass
2015-10-27 11:13 ` [U-Boot] [PATCH 06/13] dts: dra7: add spi alias for qspi Mugunthan V N
2015-10-29 17:18   ` Simon Glass
2015-10-31 11:40     ` Mugunthan V N
2015-10-27 11:13 ` [U-Boot] [PATCH 07/13] drivers: spi: ti_qspi: convert driver to adopt device driver model Mugunthan V N
2015-10-29 17:18   ` Simon Glass
2015-10-31 11:46     ` Mugunthan V N
2015-10-27 11:13 ` [U-Boot] [PATCH 08/13] arm: dts: dra7: add qspi register maps for memory map and control module Mugunthan V N
2015-10-29 17:18   ` Simon Glass
2015-10-27 11:13 ` [U-Boot] [PATCH 09/13] defconfig: dra72_evm: enable spi driver model Mugunthan V N
2015-10-29 17:18   ` Simon Glass
2015-10-27 11:13 ` [U-Boot] [PATCH 10/13] defconfig: dra74_evm: " Mugunthan V N
2015-10-29 17:18   ` Simon Glass
2015-10-27 11:13 ` [U-Boot] [PATCH 11/13] am43xx_evm: qspi: do not define DM_SPI and DM_SPI_FLASH for spl Mugunthan V N
2015-10-29 17:18   ` Simon Glass
2015-10-27 11:13 ` [U-Boot] [PATCH 12/13] arm: dts: am4372: add qspi register maps for memory map Mugunthan V N
2015-10-29 17:18   ` Simon Glass
2015-10-27 11:13 ` [U-Boot] [PATCH 13/13] defconfig: am437x_sk_evm: enable spi driver model Mugunthan V N
2015-10-29 17:18   ` Simon Glass

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=56345DF5.6070701@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox