"Subrahmanya, Chaithrika" <[email protected]> writes:

> Kevin,
>
> Few comments on the patch.
>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf
>> Of Kevin Hilman
>> Sent: Friday, January 30, 2009 4:32 AM
>> To: [email protected]
>> Subject: [PATCH 2/2] NET: davinci emac: convert to using ioremap()
>>
>> Cc: Chaithrika Subrahmanya <[email protected]>
>> Signed-off-by: Kevin Hilman <[email protected]>
>> ---
>>  drivers/net/davinci_emac.c |   69 +++++++++++++++++++++++++++++++--------
>> -----
>>  1 files changed, 49 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
>> index 1f86256..7431479 100644
>> --- a/drivers/net/davinci_emac.c
>> +++ b/drivers/net/davinci_emac.c
>> @@ -29,9 +29,8 @@
>>   */
>>
>>  /** Pending Items in this driver:
>> - * 1. use ioremap(), remove davinci_readl()/etc, minimize __force
>> - * 2. Use Linux cache infrastcture for DMA'ed memory (dma_xxx functions)
>> - * 3. Add DM646x support (gigabit included)
>> + * 1. Use Linux cache infrastcture for DMA'ed memory (dma_xxx functions)
>> + * 2. Add DM646x support (gigabit included)
>
> The gigabit support has been added already.
>
>>  */
>>
>>  #include <linux/module.h>
>> @@ -66,6 +65,7 @@
>>
>>  #include <asm/irq.h>
>>  #include <asm/page.h>
>> +#include <asm/io.h>
>>
>>  #include <mach/memory.h>
>>  #include <mach/cpu.h>
>> @@ -485,8 +485,10 @@ struct emac_priv {
>>       char mac_addr[6];
>>       spinlock_t tx_lock;
>>       spinlock_t rx_lock;
>> -     u32 emac_base_regs;
>> -     u32 emac_ctrl_regs;
>> +     u32 emac_base_phys;
>> +     void __iomem *emac_base;
>> +     u32 emac_ctrl_phys;
>> +     void __iomem *ctrl_base;
>>       void __iomem *emac_ctrl_ram;
>>       u32 ctrl_ram_size;
>>       struct emac_txch *txch[EMAC_DEF_MAX_TX_CH];
>> @@ -557,16 +559,15 @@ static char *emac_rxhost_errcodes[16] = {
>>  #define EMAC_DEV (&(priv)->ndev->dev)
>>
>>  /* Helper macros */
>> -#define emac_read(reg)               davinci_readl((priv->emac_base_regs +
>> (reg)))
>> -#define emac_write(reg, val) \
>> -     davinci_writel(val, (priv->emac_base_regs + (reg)))
>> +#define emac_read(reg)                 ioread32(priv->emac_base + (reg))
>> +#define emac_write(reg, val)      iowrite32(val, priv->emac_base + (reg))
>>
>> -#define emac_ctrl_read(reg)  davinci_readl((priv->emac_ctrl_regs +
>> (reg)))
>> -#define emac_ctrl_write(reg, val) \
>> -     davinci_writel(val, (priv->emac_ctrl_regs + (reg)))
>> +#define emac_ctrl_read(reg)    ioread32((priv->ctrl_base + (reg)))
>> +#define emac_ctrl_write(reg, val) iowrite32(val, (priv->ctrl_base +
>> (reg)))
>> +
>> +#define emac_mdio_read(reg)    ioread32(bus->priv + (reg))
>> +#define emac_mdio_write(reg, val) iowrite32(val, (bus->priv + (reg)))
>>
>> -#define emac_mdio_read(reg)  davinci_readl((bus->priv + (reg)))
>> -#define emac_mdio_write(reg, val)    davinci_writel(val, (bus->priv +
>> (reg)))
>>  /**
>>   * emac_dump_regs: Dump important EMAC registers to debug terminal
>>   * @priv: The DaVinci EMAC private adapter structure
>> @@ -2644,9 +2645,16 @@ static int __devinit davinci_emac_probe(struct
>> platform_device *pdev)
>>               rc = -ENOENT;
>>               goto probe_quit;
>>       }
>> -     priv->emac_base_regs = res->start;
>> -     ndev->base_addr = (unsigned long)IO_ADDRESS(res->start);
>> -     if (!request_mem_region((u32)priv->emac_base_regs,
>> +     priv->emac_base_phys = res->start;
>> +     priv->emac_base = ioremap(res->start, res->end);
>
> The 'end' members of the resource structure for EMAC has the ending address 
> value of module,
> therefore in ioremap calls, the size has to be passed in a manner similar to 
> request_mem_region.

Thanks, nice catch.  Will re-submit.

Kevin

>> +     if (!priv->emac_base) {
>> +             dev_err(EMAC_DEV, "Unable to map IO\n");
>> +             rc = -ENOMEM;
>> +             goto probe_quit;
>> +     }
>> +     printk("EMAC bas @ 0x%p\n", priv->emac_base);
>> +     ndev->base_addr = (unsigned long)priv->emac_base;
>> +     if (!request_mem_region(priv->emac_base_phys,
>>                               (res->end - res->start + 1),
>>                               ndev->name)) {
>
> Thanks,
> Chaithrika

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to