From: Viresh KUMAR <viresh.kumar@st.com>
To: linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com,
a.zummo@towertech.it, dbrownell@users.sourceforge.net,
linux-usb@vger.kernel.org, linux-input@vger.kernel.org, dmitry
Cc: Viresh Kumar <viresh.kumar@st.com>,
shiraz.hashim@st.com, vipin.kumar@st.com, deepak.sikri@st.com,
armando.visconti@st.com, vipulkumar.samar@st.com,
rajeev-dlh.kumar@st.com, pratyush.anand@st.com,
bhupesh.sharma@st.com
Subject: [PATCH V2 63/69] ST SPEAr3xx: Updating plgpio and emi source to make it compliant with single image strategy
Date: Fri, 1 Oct 2010 17:26:23 +0530 [thread overview]
Message-ID: <ea27f60aea71a84a2c42e0c8c24144398c7e757b.1285933332.git.viresh.kumar@st.com> (raw)
In-Reply-To: <cover.1285933331.git.viresh.kumar@st.com>
In-Reply-To: <cover.1285933331.git.viresh.kumar@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
arch/arm/mach-spear3xx/emi.c | 18 ++++++++++-
arch/arm/mach-spear3xx/include/mach/emi.h | 19 ++++++-----
arch/arm/mach-spear3xx/include/mach/gpio.h | 27 ++++++++--------
arch/arm/plat-spear/plgpio.c | 46 ++++++++++++++++++++-------
4 files changed, 75 insertions(+), 35 deletions(-)
diff --git a/arch/arm/mach-spear3xx/emi.c b/arch/arm/mach-spear3xx/emi.c
index 7b62ff0..7d7cea7 100644
--- a/arch/arm/mach-spear3xx/emi.c
+++ b/arch/arm/mach-spear3xx/emi.c
@@ -15,6 +15,7 @@
#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
+#include <asm/mach-types.h>
#include <mach/emi.h>
int __init emi_init(struct platform_device *pdev, unsigned long base,
@@ -23,8 +24,23 @@ int __init emi_init(struct platform_device *pdev, unsigned long base,
void __iomem *emi_reg_base;
struct clk *clk;
int ret;
+ u32 ack_reg, max_banks;
+ /* u32 timeout_reg, irq_reg; */
+
+ /* fixing machine dependent values */
+ if (machine_is_spear310()) {
+ ack_reg = SPEAR310_ACK_REG;
+ max_banks = SPEAR310_EMI_MAX_BANKS;
+ /* timeout_reg = SPEAR310_TIMEOUT_REG; */
+ /* irq_reg = SPEAR310_IRQ_REG; */
+ } else {
+ ack_reg = SPEAR320_ACK_REG;
+ max_banks = SPEAR320_EMI_MAX_BANKS;
+ /* timeout_reg = SPEAR320_TIMEOUT_REG; */
+ /* irq_reg = SPEAR320_IRQ_REG; */
+ }
- if (bank > (EMI_MAX_BANKS - 1))
+ if (bank > (max_banks - 1))
return -EINVAL;
emi_reg_base = ioremap(base, EMI_REG_SIZE);
diff --git a/arch/arm/mach-spear3xx/include/mach/emi.h b/arch/arm/mach-spear3xx/include/mach/emi.h
index b620bf5..59f69c4 100644
--- a/arch/arm/mach-spear3xx/include/mach/emi.h
+++ b/arch/arm/mach-spear3xx/include/mach/emi.h
@@ -33,18 +33,19 @@
#define CTRL_REG (0x14)
#if defined(CONFIG_MACH_SPEAR310)
-#define TIMEOUT_REG (0x90)
-#define ACK_REG (0x94)
-#define IRQ_REG (0x98)
+#define SPEAR310_TIMEOUT_REG (0x90)
+#define SPEAR310_ACK_REG (0x94)
+#define SPEAR310_IRQ_REG (0x98)
-#define EMI_MAX_BANKS 6
+#define SPEAR310_EMI_MAX_BANKS 6
+#endif
-#elif defined(CONFIG_MACH_SPEAR320)
-#define TIMEOUT_REG (0x60)
-#define ACK_REG (0x64)
-#define IRQ_REG (0x68)
+#if defined(CONFIG_MACH_SPEAR320)
+#define SPEAR320_TIMEOUT_REG (0x60)
+#define SPEAR320_ACK_REG (0x64)
+#define SPEAR320_IRQ_REG (0x68)
-#define EMI_MAX_BANKS 4
+#define SPEAR320_EMI_MAX_BANKS 4
#endif
diff --git a/arch/arm/mach-spear3xx/include/mach/gpio.h b/arch/arm/mach-spear3xx/include/mach/gpio.h
index f15248c..0c13d8c 100644
--- a/arch/arm/mach-spear3xx/include/mach/gpio.h
+++ b/arch/arm/mach-spear3xx/include/mach/gpio.h
@@ -17,20 +17,21 @@
#include <plat/gpio.h>
#ifdef CONFIG_MACH_SPEAR310
-#define PLGPIO_ENB 0x0010
-#define PLGPIO_WDATA 0x0020
-#define PLGPIO_DIR 0x0030
-#define PLGPIO_IE 0x0040
-#define PLGPIO_RDATA 0x0050
-#define PLGPIO_MIS 0x0060
+#define SPEAR310_PLGPIO_ENB 0x0010
+#define SPEAR310_PLGPIO_WDATA 0x0020
+#define SPEAR310_PLGPIO_DIR 0x0030
+#define SPEAR310_PLGPIO_IE 0x0040
+#define SPEAR310_PLGPIO_RDATA 0x0050
+#define SPEAR310_PLGPIO_MIS 0x0060
+#endif
-#elif defined(CONFIG_MACH_SPEAR320)
-#define PLGPIO_ENB 0x0024
-#define PLGPIO_WDATA 0x0034
-#define PLGPIO_DIR 0x0044
-#define PLGPIO_RDATA 0x0054
-#define PLGPIO_IE 0x0064
-#define PLGPIO_MIS 0x0074
+#if defined(CONFIG_MACH_SPEAR320)
+#define SPEAR320_PLGPIO_ENB 0x0024
+#define SPEAR320_PLGPIO_WDATA 0x0034
+#define SPEAR320_PLGPIO_DIR 0x0044
+#define SPEAR320_PLGPIO_RDATA 0x0054
+#define SPEAR320_PLGPIO_IE 0x0064
+#define SPEAR320_PLGPIO_MIS 0x0074
#endif
#define BASIC_GPIO_0 0
diff --git a/arch/arm/plat-spear/plgpio.c b/arch/arm/plat-spear/plgpio.c
index 3080178..f5220c0 100644
--- a/arch/arm/plat-spear/plgpio.c
+++ b/arch/arm/plat-spear/plgpio.c
@@ -22,12 +22,16 @@
#include <linux/gpio.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
+#include <asm/mach-types.h>
#define MAX_GPIO_PER_REG 32
#define PIN_OFFSET(pin) (pin % MAX_GPIO_PER_REG)
#define REG_OFFSET(base, reg, pin) (base + reg + (pin / MAX_GPIO_PER_REG)\
* sizeof(int *))
+static u32 plgpio_enb, plgpio_wdata, plgpio_dir, plgpio_rdata, plgpio_ie,
+ plgpio_mis;
+
/*
* struct plgpio: plgpio driver specific structure
*
@@ -96,7 +100,7 @@ static int plgpio_direction_input(struct gpio_chip *chip, unsigned offset)
}
spin_lock_irqsave(&plgpio->lock, flags);
- plgpio_reg_set(plgpio->base, offset, PLGPIO_DIR);
+ plgpio_reg_set(plgpio->base, offset, plgpio_dir);
spin_unlock_irqrestore(&plgpio->lock, flags);
return 0;
@@ -125,11 +129,11 @@ static int plgpio_direction_output(struct gpio_chip *chip, unsigned offset,
}
spin_lock_irqsave(&plgpio->lock, flags);
- plgpio_reg_reset(plgpio->base, dir_offset, PLGPIO_DIR);
+ plgpio_reg_reset(plgpio->base, dir_offset, plgpio_dir);
if (value)
- plgpio_reg_set(plgpio->base, wdata_offset, PLGPIO_WDATA);
+ plgpio_reg_set(plgpio->base, wdata_offset, plgpio_wdata);
else
- plgpio_reg_reset(plgpio->base, wdata_offset, PLGPIO_WDATA);
+ plgpio_reg_reset(plgpio->base, wdata_offset, plgpio_wdata);
spin_unlock_irqrestore(&plgpio->lock, flags);
return 0;
@@ -149,7 +153,7 @@ static int plgpio_get_value(struct gpio_chip *chip, unsigned offset)
return -EINVAL;
}
- return is_plgpio_set(plgpio->base, offset, PLGPIO_RDATA);
+ return is_plgpio_set(plgpio->base, offset, plgpio_rdata);
}
static void plgpio_set_value(struct gpio_chip *chip, unsigned offset, int value)
@@ -167,9 +171,9 @@ static void plgpio_set_value(struct gpio_chip *chip, unsigned offset, int value)
}
if (value)
- plgpio_reg_set(plgpio->base, offset, PLGPIO_WDATA);
+ plgpio_reg_set(plgpio->base, offset, plgpio_wdata);
else
- plgpio_reg_reset(plgpio->base, offset, PLGPIO_WDATA);
+ plgpio_reg_reset(plgpio->base, offset, plgpio_wdata);
}
static int plgpio_request(struct gpio_chip *chip, unsigned offset)
@@ -196,7 +200,7 @@ static int plgpio_request(struct gpio_chip *chip, unsigned offset)
}
spin_lock_irqsave(&plgpio->lock, flags);
- plgpio_reg_set(plgpio->base, offset, PLGPIO_ENB);
+ plgpio_reg_set(plgpio->base, offset, plgpio_enb);
spin_unlock_irqrestore(&plgpio->lock, flags);
return 0;
@@ -218,7 +222,7 @@ static void plgpio_free(struct gpio_chip *chip, unsigned offset)
}
spin_lock_irqsave(&plgpio->lock, flags);
- plgpio_reg_reset(plgpio->base, offset, PLGPIO_ENB);
+ plgpio_reg_reset(plgpio->base, offset, plgpio_enb);
spin_unlock_irqrestore(&plgpio->lock, flags);
}
@@ -247,7 +251,7 @@ static void plgpio_irq_mask(unsigned irq)
}
spin_lock_irqsave(&plgpio->lock, flags);
- plgpio_reg_set(plgpio->base, offset, PLGPIO_IE);
+ plgpio_reg_set(plgpio->base, offset, plgpio_ie);
spin_unlock_irqrestore(&plgpio->lock, flags);
}
@@ -265,7 +269,7 @@ static void plgpio_irq_unmask(unsigned irq)
}
spin_lock_irqsave(&plgpio->lock, flags);
- plgpio_reg_reset(plgpio->base, offset, PLGPIO_IE);
+ plgpio_reg_reset(plgpio->base, offset, plgpio_ie);
spin_unlock_irqrestore(&plgpio->lock, flags);
}
@@ -298,7 +302,7 @@ static void plgpio_irq_handler(unsigned irq, struct irq_desc *desc)
/* check all plgpio MIS registers for a possible interrupt */
for (; i < regs_count; i++) {
- pending = readl(plgpio->base + PLGPIO_MIS + i * sizeof(int *));
+ pending = readl(plgpio->base + plgpio_mis + i * sizeof(int *));
if (!pending)
continue;
@@ -443,6 +447,24 @@ static struct platform_driver plgpio_driver = {
static int __init plgpio_init(void)
{
+ if (machine_is_spear310()) {
+ plgpio_enb = SPEAR310_PLGPIO_ENB;
+ plgpio_wdata = SPEAR310_PLGPIO_WDATA;
+ plgpio_dir = SPEAR310_PLGPIO_DIR;
+ plgpio_rdata = SPEAR310_PLGPIO_IE;
+ plgpio_ie = SPEAR310_PLGPIO_RDATA;
+ plgpio_mis = SPEAR310_PLGPIO_MIS;
+ } else if (machine_is_spear320()) {
+ plgpio_enb = SPEAR320_PLGPIO_ENB;
+ plgpio_wdata = SPEAR320_PLGPIO_WDATA;
+ plgpio_dir = SPEAR320_PLGPIO_DIR;
+ plgpio_rdata = SPEAR320_PLGPIO_IE;
+ plgpio_ie = SPEAR320_PLGPIO_RDATA;
+ plgpio_mis = SPEAR320_PLGPIO_MIS;
+ } else {
+ return 0;
+ }
+
return platform_driver_register(&plgpio_driver);
}
subsys_initcall(plgpio_init);
--
1.7.2.2
next prev parent reply other threads:[~2010-10-01 11:56 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1285933331.git.viresh.kumar@st.com>
2010-10-01 11:55 ` [PATCH V2 21/69] Keyboard: Adding support for spear-keyboard Viresh KUMAR
2010-10-05 15:47 ` Dmitry Torokhov
[not found] ` <20101005154737.GA19730-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>
2010-10-06 3:58 ` viresh kumar
[not found] ` <4CABF3E0.8010909-qxv4g6HH51o@public.gmane.org>
2010-10-06 6:16 ` Dmitry Torokhov
2010-10-06 7:11 ` viresh kumar
2010-11-10 6:44 ` viresh kumar
2010-10-01 11:55 ` [PATCH V2 22/69] ST SPEAr: Adding machine support for keyboard Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 25/69] ST SPEAr: Add smi driver for serial NOR flash Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 26/69] ST SPEAr: Adding support for serial nor flash in all spear platforms Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 27/69] ST SPEAr: Adding Watchdog support Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 42/69] SPEAr Power Management: Added the support for Standby mode Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 44/69] SPEAr CPU freq: Adding support for CPU Freq framework Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 45/69] ST SPEAr: PCIE gadget suppport Viresh KUMAR
2010-10-19 21:47 ` Andrew Morton
2010-10-21 14:18 ` Pratyush ANAND
2010-10-21 17:25 ` Andrew Morton
2010-10-01 11:56 ` [PATCH V2 46/69] ST SPEAr13xx: Adding machine support for pci gadget Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 47/69] ST SPEAr13xx: Adding CPU hotplug support added for SMP platforms Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 50/69] ST SPEAr13xx: Modified static mappings Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 52/69] SPEAr : Pad multiplexing handling modified Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 53/69] SPEAr13xx : Fixed part devices in SPEAr13xx addded to the generic implementation Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 55/69] ST SPEAr3xx: Passing pmx devices address from machine *.c files Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 56/69] ST SPEAr Clock Framework: Updating for single image solution Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 57/69] SPEAr3xx: Make local structures static Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 58/69] SPEAR3xx: Rename register/irq defines to remove naming conflicts Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 59/69] SPEAr3xx: Rework pmx_dev code to remove conflicts Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 60/69] SPEAr3xx: Rework KConfig to allow all boards to be compiled in Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 61/69] SPEAr3xx: Replace defconfigs with single unified defconfig Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 62/69] ST SPEAr: Appending spear3** with global structures Viresh KUMAR
2010-10-01 16:21 ` viresh kumar
[not found] ` <AANLkTi=xNoG2T1Q2JqB7TH+O7AjW++UnSt1Q85VgPbzp-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-04 6:01 ` viresh kumar
2010-10-01 11:56 ` Viresh KUMAR [this message]
2010-10-01 11:56 ` [PATCH V2 64/69] SPEAr6xx: Rework Kconfig for single image solution Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 65/69] ST SPEAR6xx: renaming spear600_defconfig as spear6xx_defconfig Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 66/69] ST SPEAr13xx: Pass default padmux settings as parameter to spear13**_init routine Viresh KUMAR
[not found] ` <cover.1285933331.git.viresh.kumar-qxv4g6HH51o@public.gmane.org>
2010-10-01 11:55 ` [PATCH V2 23/69] ST SPEAr: Added ARM PL061 GPIO Support on SPEAr13xx and modified resource size Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 24/69] ST SPEAr: Adding support for ST's PWM IP Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 28/69] ST SPEAr: Adding machine support for nand Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 29/69] Newly erased page read workaround Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 30/69] ST SPEAr: Added PCIE host controller base driver support Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 31/69] ST SPEAr: Adding support for SSP PL022 Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 32/69] ST SPEAr: Adding support for SDHCI (SDIO) Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 33/69] ST SPEAr: Changing resource size of amba devices to SZ_4K Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 34/69] ST SPEAr: Replacing SIZE macro's with actual required size Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 35/69] SPEAr: defines base addresses as ulong Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 36/69] ST SPEAr: Adding miscellaneous devices Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 37/69] ST SPEAr 13xx : Adding support for SPEAr1310 Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 38/69] ST SPEAr: Adding support for DDR in clock framework Viresh KUMAR
2010-10-01 11:55 ` [PATCH V2 39/69] ST SPEAr : EMI (Extrenal Memory Interface) controller driver Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 40/69] ST SPEAr : FSMC (Flexible Static Memory Controller) NOR interface driver Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 41/69] SPEAr Clock Framework: Adding support for PLL frequency change Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 43/69] GIC: Added dummy handlers for Power Management Suspend Resume Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 48/69] ST SPEAr: replace readl, writel with __raw_readl, __raw_writel in uncompress.h Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 49/69] ST SPEAr13xx: add L2 cache support Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 51/69] SPEAr: Adding and Updating Clock definitions Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 54/69] SPEAr : Updating pad multiplexing support Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 67/69] ST SPEAr: Adding devices & clocks Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 69/69] ST SPEAr: Updating defconfigs Viresh KUMAR
2010-10-01 11:56 ` [PATCH V2 68/69] ST SPEAr: Adding information in Documentation/ and MAINTAINERS 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=ea27f60aea71a84a2c42e0c8c24144398c7e757b.1285933332.git.viresh.kumar@st.com \
--to=viresh.kumar@st.com \
--cc=a.zummo@towertech.it \
--cc=armando.visconti@st.com \
--cc=bhupesh.sharma@st.com \
--cc=dbrownell@users.sourceforge.net \
--cc=deepak.sikri@st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pratyush.anand@st.com \
--cc=rajeev-dlh.kumar@st.com \
--cc=rtc-linux@googlegroups.com \
--cc=shiraz.hashim@st.com \
--cc=vipin.kumar@st.com \
--cc=vipulkumar.samar@st.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;
as well as URLs for NNTP newsgroup(s).