mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v7 13/15] MIPS: add initial D-Link DIR-320 wireless router support
Date: Wed, 20 Jul 2011 18:03:07 +0400	[thread overview]
Message-ID: <CAA4bVAGmqKrnFMcLqPGVDsmKT2xJ5ka1puvQVtdBuBLSO_BoXg@mail.gmail.com> (raw)
In-Reply-To: <20110720041118.GD15388@game.jcrosoft.org>

On 20 July 2011 08:11, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
>> diff --git a/arch/mips/boards/dlink-dir-320/serial.c b/arch/mips/boards/dlink-dir-320/serial.c
>> new file mode 100644
>> index 0000000..6e878cd
>> --- /dev/null
>> +++ b/arch/mips/boards/dlink-dir-320/serial.c
...

>> +/** to work with the 8250 UART driver implementation we need this function */
>> +static unsigned int dir320_uart_read(unsigned long base, unsigned char reg_idx)
>> +{
>> +     return __raw_readb((char *)base + reg_idx);
>> +}
>> +
>> +/** to work with the 8250 UART driver implementation we need this function */
>> +static void dir320_uart_write(unsigned int val, unsigned long base, unsigned char reg_idx)
>> +{
>> +     __raw_writeb(val, (char *)base + reg_idx);
>> +}
> can we drop those duplicated function with malta and other

I think, that it is much better to improve ns16550 driver.

e.g.
   reg_write(val, base, reg_idx) -> reg_write(struct device_d *dev,
val, reg_idx)

there

struct device_d {
   ...
   .map_base = ... ; /* FIXME: use resource */

}

struct NS16550_plat {
   ...
   unsigned int (*reg_read)(struct device_d *dev, reg_idx);
   void (*reg_write)(struct device_d *dev, val, reg_idx);
   ...
   unsigned int regshift;
   unsigned int offset;
   ...
};

generic_ns16550_write works like this:

generic_ns16550_write(struct device_d *dev, val, reg_idx)
{
  struct NS16550_plat * plat = dev->platform_data;

  writeb(val, dev->map_base + (reg_idx << plat->regshift) + plat->offset);
}

so platform-depended initialization set plat->base, plat->regshift and
plat->offset;
also most times it set plat->reg_write=generic_ns16550_write and
plat->reg_read=generic_ns16550_read.

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-07-20 14:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-19 21:38 [PATCH v7 01/15] MIPS: initial commit: add empty but required header files Antony Pavlov
2011-07-19 21:38 ` [PATCH v7 02/15] MIPS: import libgcc-related files from linux-2.6.39 Antony Pavlov
2011-07-19 21:38 ` [PATCH v7 03/15] MIPS: update libgcc-related files for barebox Antony Pavlov
2011-07-20  4:12   ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-20 14:11     ` Antony Pavlov
2011-07-21  3:10       ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-19 21:38 ` [PATCH v7 04/15] MIPS: import header files from linux-2.6.39 Antony Pavlov
2011-07-19 21:38 ` [PATCH v7 05/15] MIPS: update io.h for barebox Antony Pavlov
2011-07-19 21:38 ` [PATCH v7 06/15] MIPS: update elf.h " Antony Pavlov
2011-07-19 21:38 ` [PATCH v7 07/15] MIPS: update mipsregs.h " Antony Pavlov
2011-07-19 21:38 ` [PATCH v7 08/15] MIPS: import header files from barebox-2011.06.0 arch/x86 Antony Pavlov
2011-07-19 21:39 ` [PATCH v7 09/15] MIPS: add start.S, CP0 clocksource, linker script and memory layout function Antony Pavlov
2011-07-19 21:39 ` [PATCH v7 10/15] MIPS: add Malta machine support to barebox Antony Pavlov
2011-07-19 21:39 ` [PATCH v7 11/15] MIPS: add qemu malta board " Antony Pavlov
2011-07-19 21:39 ` [PATCH v7 12/15] MIPS: add initial BCM47xx-based boards support Antony Pavlov
2011-07-19 21:39 ` [PATCH v7 13/15] MIPS: add initial D-Link DIR-320 wireless router support Antony Pavlov
2011-07-20  4:11   ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-20 14:03     ` Antony Pavlov [this message]
2011-07-20 18:55       ` Antony Pavlov
2011-07-19 21:39 ` [PATCH v7 14/15] MIPS: add draft cpuinfo command Antony Pavlov
2011-07-19 21:39 ` [PATCH v7 15/15] MIPS: add documentation Antony Pavlov

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=CAA4bVAGmqKrnFMcLqPGVDsmKT2xJ5ka1puvQVtdBuBLSO_BoXg@mail.gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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