From: Tony Lindgren <tony@atomide.com>
To: linux-kernel@vger.kernel.org
Cc: David Brownell <dbrownell@users.sourceforge.net>,
Tony Lindgren <tony@atomide.com>
Subject: [PATCH 8/18] ARM: OMAP: omap2/gpmc updates
Date: Mon, 9 Apr 2007 17:30:51 -0400 [thread overview]
Message-ID: <11761542912185-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1176154286590-git-send-email-tony@atomide.com>
From: David Brownell <dbrownell@users.sourceforge.net>
GPMC updates:
- bugfixes: wrong/missing flags, omitted write, wrong test
- don't map memory segments starting at zero
- improve debug messaging
- export gpmc_get_fclk_perio]d() since it's needed to calc timings
- expect gpmc_cs_set_timings() caller to have initialized sync vs async
Note that this API is glitchy; likely the best fix would be to add
a member to "struct gpmc_timings" to hold GPMC_CONFIG1, since that
holds one key aspect of the GPMC timings (the gpmc_fclk divisor,
and sync vs. async == whether that divisor matters).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/gpmc.c | 33 ++++++++++++++++++++++-----------
include/asm-arm/arch-omap/gpmc.h | 3 ++-
2 files changed, 24 insertions(+), 12 deletions(-)
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -88,7 +88,7 @@ u32 gpmc_cs_read_reg(int cs, int idx)
}
/* TODO: Add support for gpmc_fck to clock framework and use it */
-static unsigned long gpmc_get_fclk_period(void)
+unsigned long gpmc_get_fclk_period(void)
{
/* In picoseconds */
return 1000000000 / ((clk_get_rate(gpmc_l3_clk)) / 1000);
@@ -120,15 +120,21 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
else
ticks = gpmc_ns_to_ticks(time);
nr_bits = end_bit - st_bit + 1;
- if (ticks >= 1 << nr_bits)
+ if (ticks >= 1 << nr_bits) {
+#ifdef DEBUG
+ printk(KERN_INFO "GPMC CS%d: %-10s* %3d ns, %3d ticks >= %d\n",
+ cs, name, time, ticks, 1 << nr_bits);
+#endif
return -1;
+ }
mask = (1 << nr_bits) - 1;
l = gpmc_cs_read_reg(cs, reg);
#ifdef DEBUG
- printk(KERN_INFO "GPMC CS%d: %-10s: %d ticks, %3lu ns (was %i ticks)\n",
+ printk(KERN_INFO
+ "GPMC CS%d: %-10s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n",
cs, name, ticks, gpmc_get_fclk_period() * ticks / 1000,
- (l >> st_bit) & mask);
+ (l >> st_bit) & mask, time);
#endif
l &= ~(mask << st_bit);
l |= ticks << st_bit;
@@ -157,7 +163,7 @@ int gpmc_cs_calc_divider(int cs, unsigned int sync_clk)
div = l / gpmc_get_fclk_period();
if (div > 4)
return -1;
- if (div < 0)
+ if (div <= 0)
div = 1;
return div;
@@ -191,14 +197,19 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access);
+ /* caller is expected to have initialized CONFIG1 to cover
+ * at least sync vs async
+ */
+ l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
+ if (l & (GPMC_CONFIG1_READTYPE_SYNC | GPMC_CONFIG1_WRITETYPE_SYNC)) {
#ifdef DEBUG
- printk(KERN_INFO "GPMC CS%d CLK period is %lu (div %d)\n",
- cs, gpmc_get_fclk_period(), div);
+ printk(KERN_INFO "GPMC CS%d CLK period is %lu ns (div %d)\n",
+ cs, (div * gpmc_get_fclk_period()) / 1000, div);
#endif
-
- l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
- l &= ~0x03;
- l |= (div - 1);
+ l &= ~0x03;
+ l |= (div - 1);
+ gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l);
+ }
return 0;
}
--- a/include/asm-arm/arch-omap/gpmc.h
+++ b/include/asm-arm/arch-omap/gpmc.h
@@ -23,9 +23,10 @@
#define GPMC_CS_NAND_DATA 0x24
#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
-#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 20)
+#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
#define GPMC_CONFIG1_READTYPE_ASYNC (0 << 29)
#define GPMC_CONFIG1_READTYPE_SYNC (1 << 29)
+#define GPMC_CONFIG1_WRITEMULTIPLE_SUPP (1 << 28)
#define GPMC_CONFIG1_WRITETYPE_ASYNC (0 << 27)
#define GPMC_CONFIG1_WRITETYPE_SYNC (1 << 27)
#define GPMC_CONFIG1_CLKACTIVATIONTIME(val) ((val & 3) << 25)
--
1.4.4.2
next prev parent reply other threads:[~2007-04-09 21:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-09 21:30 [PATCH 0/18] ARM: OMAP: Updates for OMAP2 common code Tony Lindgren
2007-04-09 21:30 ` [PATCH 1/18] ARM: OMAP2: Place SMS and SDRC into smart idle mode Tony Lindgren
2007-04-09 21:30 ` [PATCH 2/18] ARM: OMAP2: Force APLLs always active Tony Lindgren
2007-04-09 21:30 ` [PATCH 3/18] ARM: OMAP: Enable serial idling and wakeup features Tony Lindgren
2007-04-09 21:30 ` [PATCH 4/18] ARM: OMAP: Optimize INTC register accesses and enable autoidling Tony Lindgren
2007-04-09 21:30 ` [PATCH 5/18] ARM: OMAP: Board Apollon update, fix boot Tony Lindgren
2007-04-09 21:30 ` [PATCH 6/18] ARM: OMAP: omap2/memory.c compile fixes Tony Lindgren
2007-04-09 21:30 ` [PATCH 7/18] ARM: OMAP: 24xx pinmux updates Tony Lindgren
2007-04-09 21:30 ` Tony Lindgren [this message]
2007-04-09 21:30 ` [PATCH 9/18] ARM: OMAP: abstract debug card setup (smc, leds) Tony Lindgren
2007-04-09 21:30 ` [PATCH 10/18] ARM: OMAP: Add minimal OMAP2430 support Tony Lindgren
2007-04-09 21:30 ` [PATCH 11/18] ARM: OMAP: Tabify mux.c Tony Lindgren
2007-04-09 21:30 ` [PATCH 12/18] ARM: OMAP: TUSB EVM init Tony Lindgren
2007-04-09 21:30 ` [PATCH 13/18] ARM: OMAP: Merge gpmc changes from N800 tree Tony Lindgren
2007-04-09 21:30 ` [PATCH 14/18] ARM: OMAP: Merge driver headers " Tony Lindgren
2007-04-09 21:30 ` [PATCH 15/18] ARM: OMAP: Merge PM code " Tony Lindgren
2007-04-09 21:30 ` [PATCH 16/18] ARM: OMAP: 243x: Add mappings for SDRC and SMS Tony Lindgren
2007-04-09 21:31 ` [PATCH 17/18] ARM: OMAP: Device init for OMAP24xx Enhanced Audio Controller Tony Lindgren
2007-04-09 21:31 ` [PATCH 18/18] ARM: OMAP: Fix PRCM base register usage for 243x Tony Lindgren
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=11761542912185-git-send-email-tony@atomide.com \
--to=tony@atomide.com \
--cc=dbrownell@users.sourceforge.net \
--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