public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Fuzzey <mfuzzey@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Portable drivers for 8 bit devices
Date: Sat, 19 Dec 2009 13:21:30 +0100	[thread overview]
Message-ID: <4B2CC54A.9020507@gmail.com> (raw)

Hi,

I recently posted a patch for the sc26xx serial driver (which is
currently only enabled for SNI_RM 32 bit MIPS), enabling it for all
architectures (and adding support for 268x devices). I tested this on ARM.

However I was contacted (off list) by someone trying to use the driver
on 64 bit MIPS.
Turned out this didn't work because the driver (both the current main
line and my patched version) assume the UART chip (which is a 8 bit
device) is mapped into a 32 bit port (ie the first 3 8 bit register
offsets are defined as):

#define WR_PORT_MRx 0x00
#define WR_PORT_CSR 0x04
#define WR_PORT_CR  0x08

On the 64 bit MIPS system (a CISCO router..) these offsets needed to be
doubled.

What is the best way to fix this properly? Some ideas:
1) Compile time #ifdef based on CPU bus size
2) Add a driver specific KConfig option for the address shift
3) Add an address shift element to platform data

I don't think #1 is the right solution since the port size is often
configurable (especially on SoCs) independently of the CPU bus size.
My preference is #3

Cheers,

Martin





                 reply	other threads:[~2009-12-19 12:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4B2CC54A.9020507@gmail.com \
    --to=mfuzzey@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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