All of lore.kernel.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/9] SPEAr13xx: Add header files
Date: Sat, 21 Apr 2012 18:37:34 +0000	[thread overview]
Message-ID: <201204211837.35023.arnd@arndb.de> (raw)
In-Reply-To: <CAOh2x=ncefojSYBPUVgL1EKcQ+wPFzfCmo+TZ+3BEmwD+=Q=Gg@mail.gmail.com>

On Saturday 21 April 2012, viresh kumar wrote:
> On 4/20/12, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Friday 20 April 2012, Viresh Kumar wrote:
> >> +/* RAS Area Control Register */
> >> +#define SPEAR1310_RAS_CTRL_REG0			(VA_SPEAR1310_RAS_BASE + 0x000)
> >> +	#define SPEAR1310_GPT64_SYNC_ENB		0
> >> +	#define SPEAR1310_GPT64_SYNC_ENB_MASK		1
> >> +	#define SPEAR1310_GPT64_SYNC_ENB_SHIFT		31
> >> +	#define SPEAR1310_SSP1_CS_SEL_CS0		0
> >> +	#define SPEAR1310_SSP1_CS_SEL_CS1		1
> >> +	#define SPEAR1310_SSP1_CS_SEL_MASK		3
> >> +	#define SPEAR1310_SSP1_CS_SEL_SHIFT		30
> >> +	#define SPEAR1310_SSP1_CS_VAL_MASK		1
> >> +	#define SPEAR1310_SSP1_CS_VAL_SHIFT		28
> >> +	#define SPEAR1310_SSP1_CS_CTL_HW		0
> >> +	#define SPEAR1310_SSP1_CS_CTL_SW		1
> >
> > Why are the RAS control registers in a global header? It looks like you
> > only use them from the clock driver, so they can be moved into a local
> > header file there.
> 
> Actually registers serves many different features. Clock, software controlled
> chip selects for spi, etc. So really can't move to clock drivers.
> 
> I didn't wanted half part of a register in one file and other half in other.
> So kept them here, so that these are accessible from all users.

It's still really ugly to have that in a global header file, including the
hardcoded register addresses.

What I'd suggest you do instead here is export a function to access the
registers from device drivers and add a new header file that contains
only this interface, the register offsets and the register definitions.
Then you can use proper of_iomap calls to get the area from the device
tree in the machine init code and it will be clear which drivers use the
interface because they have to explicitly include that header.

	Arnd

  reply	other threads:[~2012-04-21 18:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20 17:22 [PATCH 0/9] Add support for SPEAr13xx SoCs Viresh Kumar
2012-04-20 17:22 ` [PATCH 1/9] SPEAr13xx: Add header files Viresh Kumar
2012-04-20 17:52   ` Arnd Bergmann
2012-04-21 12:27     ` viresh kumar
2012-04-21 18:37       ` Arnd Bergmann [this message]
2012-04-23 11:47         ` viresh kumar
2012-04-23 12:25           ` viresh kumar
2012-04-20 17:22 ` [PATCH 2/9] SPEAr13xx: Add source files Viresh Kumar
2012-04-20 18:15   ` Arnd Bergmann
2012-04-21 12:23     ` viresh kumar
2012-04-21 18:31       ` Arnd Bergmann
2012-04-20 17:22 ` [PATCH 3/9] SPEAr13xx: Add common clock framework support Viresh Kumar
2012-04-23 21:43   ` Turquette, Mike
2012-04-24  3:57     ` Viresh Kumar
2012-04-20 17:22 ` [PATCH 4/9] pinctrl: SPEAr: Create macro for declaring GPIO PINS Viresh Kumar
2012-04-20 17:22 ` [PATCH 6/9] SPEAr13xx: Add dts and dtsi files Viresh Kumar
2012-04-20 17:22 ` [PATCH 7/9] SPEAr13xx: Add compilation support Viresh Kumar
2012-04-20 17:22 ` [PATCH 8/9] SPEAr13xx: Add defconfig Viresh Kumar
2012-04-20 17:22 ` [PATCH 9/9] SPEAr: Update MAINTAINERS and Documentation Viresh Kumar
2012-04-20 18:21 ` [PATCH 0/9] Add support for SPEAr13xx SoCs Arnd Bergmann
2012-04-21 12:17   ` viresh kumar
2012-04-21 12:24     ` Arnd Bergmann
2012-04-21 12:29       ` viresh kumar

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=201204211837.35023.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.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 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.