From: "Shilimkar, Santosh" <santosh.shilimkar@ti.com> To: Tony Lindgren <tony@atomide.com>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org> Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>, Mike Rapoport <mike@compulab.co.il> Subject: RE: [PATCH 1/8] omap2: mux: intoduce omap_mux_{read,write} Date: Sun, 29 Nov 2009 15:33:27 +0530 [thread overview] Message-ID: <EAF47CD23C76F840A9E7FCE10091EFAB02BBE6475E@dbde02.ent.ti.com> (raw) In-Reply-To: <20091126001849.1546.76887.stgit@localhost> > -----Original Message----- > From: linux-omap-owner@vger.kernel.org [mailto:linux-omap- > owner@vger.kernel.org] On Behalf Of Tony Lindgren > Sent: Thursday, November 26, 2009 5:49 AM > To: linux-arm-kernel@lists.infradead.org > Cc: linux-omap@vger.kernel.org; Mike Rapoport > Subject: [PATCH 1/8] omap2: mux: intoduce omap_mux_{read,write} > > From: Mike Rapoport <mike@compulab.co.il> > > intoduce omap_mux_{read,write} > > Signed-off-by: Mike Rapoport <mike@compulab.co.il> > Signed-off-by: Tony Lindgren <tony@atomide.com> > --- > arch/arm/mach-omap2/mux.c | 44 > ++++++++++++++++++++++++++++++++++++++------ > 1 files changed, 38 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c > index c18a94e..64250c5 100644 > --- a/arch/arm/mach-omap2/mux.c > +++ b/arch/arm/mach-omap2/mux.c > @@ -35,7 +35,27 @@ > > #ifdef CONFIG_OMAP_MUX > > +#define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE > */ > +#define OMAP_MUX_BASE_SZ 0x5ca > + > static struct omap_mux_cfg arch_mux_cfg; > +static void __iomem *mux_base; > + > +static inline u16 omap_mux_read(u16 reg) > +{ > + if (cpu_is_omap24xx()) > + return __raw_readb(mux_base + reg); > + else > + return __raw_readw(mux_base + reg); > +} > + > +static inline void omap_mux_write(u16 val, u16 reg) > +{ > + if (cpu_is_omap24xx()) > + __raw_writeb(val, mux_base + reg); This will work on board but the code relies on underneath function typecast here. OMAP24xx reg write suppose to be 8 bit and __raw_writeb will take care of this with forced typecast. > + else > + __raw_writew(val, mux_base + reg); > +} > > /* NOTE: See mux.h for the enumeration */ > > @@ -581,10 +601,7 @@ static void __init_or_module > omap2_cfg_debug(const struct pin_config *cfg, u16 r > u16 orig; > u8 warn = 0, debug = 0; > > - if (cpu_is_omap24xx()) > - orig = omap_ctrl_readb(cfg->mux_reg); > - else > - orig = omap_ctrl_readw(cfg->mux_reg); > + orig = omap_mux_read(cfg->mux_reg - OMAP_MUX_BASE_OFFSET); > > #ifdef CONFIG_OMAP_MUX_DEBUG > debug = cfg->debug; > @@ -614,7 +631,7 @@ static int __init_or_module > omap24xx_cfg_reg(const struct pin_config *cfg) > if (cfg->pu_pd_val) > reg |= OMAP2_PULL_UP; > omap2_cfg_debug(cfg, reg); > - omap_ctrl_writeb(reg, cfg->mux_reg); > + omap_mux_write(reg, cfg->mux_reg - OMAP_MUX_BASE_OFFSET); > spin_unlock_irqrestore(&mux_spin_lock, flags); > > return 0; > @@ -633,7 +650,7 @@ static int __init_or_module > omap34xx_cfg_reg(const struct pin_config *cfg) > spin_lock_irqsave(&mux_spin_lock, flags); > reg |= cfg->mux_val; > omap2_cfg_debug(cfg, reg); > - omap_ctrl_writew(reg, cfg->mux_reg); > + omap_mux_write(reg, cfg->mux_reg - OMAP_MUX_BASE_OFFSET); > spin_unlock_irqrestore(&mux_spin_lock, flags); > > return 0; > @@ -644,6 +661,21 @@ static int __init_or_module > omap34xx_cfg_reg(const struct pin_config *cfg) > > int __init omap2_mux_init(void) > { > + u32 mux_pbase; > + > + if (cpu_is_omap2420()) > + mux_pbase = OMAP2420_CTRL_BASE + OMAP_MUX_BASE_OFFSET; > + else if (cpu_is_omap2430()) > + mux_pbase = OMAP243X_CTRL_BASE + OMAP_MUX_BASE_OFFSET; > + else if (cpu_is_omap34xx()) > + mux_pbase = OMAP343X_CTRL_BASE + OMAP_MUX_BASE_OFFSET; > + > + mux_base = ioremap(mux_pbase, OMAP_MUX_BASE_SZ); The control modules on OMAP's divided into 2 domains with different base address 1. pads in CORE power domain 2. Pads in wakeup domain. If we map these two separately, then we can differentiate the wakeup capable pads. Not sure whether I am making any sense here but just thought it would be useful. > + if (!mux_base) { > + printk(KERN_ERR "mux: Could not ioremap\n"); > + return -ENODEV; > + } > + > if (cpu_is_omap24xx()) { > arch_mux_cfg.pins = omap24xx_pins; > arch_mux_cfg.size = OMAP24XX_PINS_SZ; > > -- > To unsubscribe from this list: send the line "unsubscribe linux- > omap" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: santosh.shilimkar@ti.com (Shilimkar, Santosh) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/8] omap2: mux: intoduce omap_mux_{read,write} Date: Sun, 29 Nov 2009 15:33:27 +0530 [thread overview] Message-ID: <EAF47CD23C76F840A9E7FCE10091EFAB02BBE6475E@dbde02.ent.ti.com> (raw) In-Reply-To: <20091126001849.1546.76887.stgit@localhost> > -----Original Message----- > From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- > owner at vger.kernel.org] On Behalf Of Tony Lindgren > Sent: Thursday, November 26, 2009 5:49 AM > To: linux-arm-kernel at lists.infradead.org > Cc: linux-omap at vger.kernel.org; Mike Rapoport > Subject: [PATCH 1/8] omap2: mux: intoduce omap_mux_{read,write} > > From: Mike Rapoport <mike@compulab.co.il> > > intoduce omap_mux_{read,write} > > Signed-off-by: Mike Rapoport <mike@compulab.co.il> > Signed-off-by: Tony Lindgren <tony@atomide.com> > --- > arch/arm/mach-omap2/mux.c | 44 > ++++++++++++++++++++++++++++++++++++++------ > 1 files changed, 38 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c > index c18a94e..64250c5 100644 > --- a/arch/arm/mach-omap2/mux.c > +++ b/arch/arm/mach-omap2/mux.c > @@ -35,7 +35,27 @@ > > #ifdef CONFIG_OMAP_MUX > > +#define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE > */ > +#define OMAP_MUX_BASE_SZ 0x5ca > + > static struct omap_mux_cfg arch_mux_cfg; > +static void __iomem *mux_base; > + > +static inline u16 omap_mux_read(u16 reg) > +{ > + if (cpu_is_omap24xx()) > + return __raw_readb(mux_base + reg); > + else > + return __raw_readw(mux_base + reg); > +} > + > +static inline void omap_mux_write(u16 val, u16 reg) > +{ > + if (cpu_is_omap24xx()) > + __raw_writeb(val, mux_base + reg); This will work on board but the code relies on underneath function typecast here. OMAP24xx reg write suppose to be 8 bit and __raw_writeb will take care of this with forced typecast. > + else > + __raw_writew(val, mux_base + reg); > +} > > /* NOTE: See mux.h for the enumeration */ > > @@ -581,10 +601,7 @@ static void __init_or_module > omap2_cfg_debug(const struct pin_config *cfg, u16 r > u16 orig; > u8 warn = 0, debug = 0; > > - if (cpu_is_omap24xx()) > - orig = omap_ctrl_readb(cfg->mux_reg); > - else > - orig = omap_ctrl_readw(cfg->mux_reg); > + orig = omap_mux_read(cfg->mux_reg - OMAP_MUX_BASE_OFFSET); > > #ifdef CONFIG_OMAP_MUX_DEBUG > debug = cfg->debug; > @@ -614,7 +631,7 @@ static int __init_or_module > omap24xx_cfg_reg(const struct pin_config *cfg) > if (cfg->pu_pd_val) > reg |= OMAP2_PULL_UP; > omap2_cfg_debug(cfg, reg); > - omap_ctrl_writeb(reg, cfg->mux_reg); > + omap_mux_write(reg, cfg->mux_reg - OMAP_MUX_BASE_OFFSET); > spin_unlock_irqrestore(&mux_spin_lock, flags); > > return 0; > @@ -633,7 +650,7 @@ static int __init_or_module > omap34xx_cfg_reg(const struct pin_config *cfg) > spin_lock_irqsave(&mux_spin_lock, flags); > reg |= cfg->mux_val; > omap2_cfg_debug(cfg, reg); > - omap_ctrl_writew(reg, cfg->mux_reg); > + omap_mux_write(reg, cfg->mux_reg - OMAP_MUX_BASE_OFFSET); > spin_unlock_irqrestore(&mux_spin_lock, flags); > > return 0; > @@ -644,6 +661,21 @@ static int __init_or_module > omap34xx_cfg_reg(const struct pin_config *cfg) > > int __init omap2_mux_init(void) > { > + u32 mux_pbase; > + > + if (cpu_is_omap2420()) > + mux_pbase = OMAP2420_CTRL_BASE + OMAP_MUX_BASE_OFFSET; > + else if (cpu_is_omap2430()) > + mux_pbase = OMAP243X_CTRL_BASE + OMAP_MUX_BASE_OFFSET; > + else if (cpu_is_omap34xx()) > + mux_pbase = OMAP343X_CTRL_BASE + OMAP_MUX_BASE_OFFSET; > + > + mux_base = ioremap(mux_pbase, OMAP_MUX_BASE_SZ); The control modules on OMAP's divided into 2 domains with different base address 1. pads in CORE power domain 2. Pads in wakeup domain. If we map these two separately, then we can differentiate the wakeup capable pads. Not sure whether I am making any sense here but just thought it would be useful. > + if (!mux_base) { > + printk(KERN_ERR "mux: Could not ioremap\n"); > + return -ENODEV; > + } > + > if (cpu_is_omap24xx()) { > arch_mux_cfg.pins = omap24xx_pins; > arch_mux_cfg.size = OMAP24XX_PINS_SZ; > > -- > To unsubscribe from this list: send the line "unsubscribe linux- > omap" in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-11-29 10:04 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-11-26 0:18 [PATCH 0/8] Series short description Tony Lindgren 2009-11-26 0:18 ` Tony Lindgren 2009-11-26 0:18 ` [PATCH 1/8] omap2: mux: intoduce omap_mux_{read,write} Tony Lindgren 2009-11-26 0:18 ` Tony Lindgren 2009-11-29 10:03 ` Shilimkar, Santosh [this message] 2009-11-29 10:03 ` Shilimkar, Santosh 2009-11-30 18:54 ` Tony Lindgren 2009-11-30 18:54 ` Tony Lindgren 2009-11-26 0:19 ` [PATCH 2/8] omap: mux: Add new style pin multiplexing code for omap3 Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren 2009-11-26 0:19 ` [PATCH 3/8] omap: mux: Add new style pin multiplexing data for 34xx Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren 2009-11-26 0:19 ` [PATCH 4/8] omap: mux: Add new style init functions to omap3 board-*.c files Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren 2009-11-26 0:19 ` [PATCH 5/8] omap: mux: Add debugfs support for new mux code Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren 2009-11-26 0:19 ` [PATCH 6/8] omap: Split i2c platform init for mach-omap1 and mach-omap2 Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren 2009-11-27 17:44 ` Tony Lindgren 2009-11-27 17:44 ` Tony Lindgren 2009-11-26 0:20 ` [PATCH 7/8] omap: mux: Replace omap_cfg_reg() with new style signal or gpio functions Tony Lindgren 2009-11-26 0:20 ` Tony Lindgren 2009-11-26 0:20 ` [PATCH 8/8] omap: mux: Remove old mux code for 34xx Tony Lindgren 2009-11-26 0:20 ` Tony Lindgren 2009-11-26 0:20 ` [PATCH 0/8] Omap mux changes for v2.6.33 merge window (Series short description) Tony Lindgren 2009-11-26 0:20 ` Tony Lindgren 2009-11-26 11:20 ` Mike Rapoport 2009-11-26 11:20 ` Mike Rapoport 2009-11-26 18:15 ` Tony Lindgren 2009-11-26 18:15 ` Tony Lindgren 2009-11-27 16:16 ` Tony Lindgren 2009-11-27 16:16 ` Tony Lindgren 2009-11-26 6:44 ` [PATCH 0/8] Series short description Hemanth V 2009-11-26 6:44 ` Hemanth V 2009-11-26 8:27 ` Tony Lindgren 2009-11-26 8:27 ` Tony Lindgren 2009-11-29 10:03 ` Shilimkar, Santosh 2009-11-29 10:03 ` Shilimkar, Santosh
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=EAF47CD23C76F840A9E7FCE10091EFAB02BBE6475E@dbde02.ent.ti.com \ --to=santosh.shilimkar@ti.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=mike@compulab.co.il \ --cc=tony@atomide.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: linkBe 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.