From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 05/37] Blackfin: unify gpio cfi implementations
Date: Sat, 2 Oct 2010 16:05:31 -0400 [thread overview]
Message-ID: <1286049958-4125-4-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1286049958-4125-1-git-send-email-vapier@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
board/cm-bf527/cm-bf527.c | 2 +-
board/cm-bf527/gpio_cfi_flash.c | 63 ++------------------------------------
board/cm-bf527/gpio_cfi_flash.h | 10 ------
board/cm-bf537e/gpio_cfi_flash.c | 20 +++++++++---
board/cm-bf537u/cm-bf537u.c | 2 +-
board/cm-bf537u/gpio_cfi_flash.c | 60 +-----------------------------------
board/cm-bf537u/gpio_cfi_flash.h | 10 ------
board/tcm-bf537/gpio_cfi_flash.c | 63 ++------------------------------------
board/tcm-bf537/gpio_cfi_flash.h | 10 ------
board/tcm-bf537/tcm-bf537.c | 2 +-
10 files changed, 26 insertions(+), 216 deletions(-)
delete mode 100644 board/cm-bf527/gpio_cfi_flash.h
delete mode 100644 board/cm-bf537u/gpio_cfi_flash.h
delete mode 100644 board/tcm-bf537/gpio_cfi_flash.h
diff --git a/board/cm-bf527/cm-bf527.c b/board/cm-bf527/cm-bf527.c
index b6815b1..a5f70a4 100644
--- a/board/cm-bf527/cm-bf527.c
+++ b/board/cm-bf527/cm-bf527.c
@@ -13,7 +13,7 @@
#include <asm/blackfin.h>
#include <asm/net.h>
#include <asm/mach-common/bits/otp.h>
-#include "gpio_cfi_flash.h"
+#include "../cm-bf537e/gpio_cfi_flash.h"
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/cm-bf527/gpio_cfi_flash.c b/board/cm-bf527/gpio_cfi_flash.c
index f8ccc07..6e62fff 100644
--- a/board/cm-bf527/gpio_cfi_flash.c
+++ b/board/cm-bf527/gpio_cfi_flash.c
@@ -1,60 +1,3 @@
-/*
- * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <asm/blackfin.h>
-#include <asm/gpio.h>
-#include <asm/io.h>
-#include "gpio_cfi_flash.h"
-
-#define GPIO_PIN_1 GPIO_PH9
-#define GPIO_MASK_1 (1 << 21)
-#define GPIO_PIN_2 GPIO_PG11
-#define GPIO_MASK_2 (1 << 22)
-#define GPIO_MASK (GPIO_MASK_1 | GPIO_MASK_2)
-
-void *gpio_cfi_flash_swizzle(void *vaddr)
-{
- unsigned long addr = (unsigned long)vaddr;
-
- gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
-
-#ifdef GPIO_MASK_2
- gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
-#endif
-
- SSYNC();
-
- return (void *)(addr & ~GPIO_MASK);
-}
-
-#define __raw_writeq(value, addr) *(volatile u64 *)addr = value
-#define __raw_readq(addr) *(volatile u64 *)addr
-
-#define MAKE_FLASH(size, sfx) \
-void flash_write##size(u##size value, void *addr) \
-{ \
- __raw_write##sfx(value, gpio_cfi_flash_swizzle(addr)); \
-} \
-u##size flash_read##size(void *addr) \
-{ \
- return __raw_read##sfx(gpio_cfi_flash_swizzle(addr)); \
-}
-MAKE_FLASH(8, b) /* flash_write8() flash_read8() */
-MAKE_FLASH(16, w) /* flash_write16() flash_read16() */
-MAKE_FLASH(32, l) /* flash_write32() flash_read32() */
-MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
-
-void gpio_cfi_flash_init(void)
-{
- gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
-#ifdef GPIO_MASK_2
- gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
-#endif
- gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
-}
+#define GPIO_PIN_1 GPIO_PH9
+#define GPIO_PIN_2 GPIO_PG11
+#include "../cm-bf537e/gpio_cfi_flash.c"
diff --git a/board/cm-bf527/gpio_cfi_flash.h b/board/cm-bf527/gpio_cfi_flash.h
deleted file mode 100644
index 5211e97..0000000
--- a/board/cm-bf527/gpio_cfi_flash.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-void *gpio_cfi_flash_swizzle(void *vaddr);
-void gpio_cfi_flash_init(void);
diff --git a/board/cm-bf537e/gpio_cfi_flash.c b/board/cm-bf537e/gpio_cfi_flash.c
index 79ee844..ab6af81 100644
--- a/board/cm-bf537e/gpio_cfi_flash.c
+++ b/board/cm-bf537e/gpio_cfi_flash.c
@@ -1,7 +1,7 @@
/*
* gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
*
- * Copyright (c) 2009 Analog Devices Inc.
+ * Copyright (c) 2009-2010 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
@@ -12,9 +12,17 @@
#include <asm/io.h>
#include "gpio_cfi_flash.h"
+/* Allow this driver to be shared among boards */
+#ifndef GPIO_PIN_1
#define GPIO_PIN_1 GPIO_PF4
+#endif
#define GPIO_MASK_1 (1 << 21)
-#define GPIO_MASK (GPIO_MASK_1)
+#ifndef GPIO_PIN_2
+#define GPIO_MASK_2 (0)
+#else
+#define GPIO_MASK_2 (1 << 22)
+#endif
+#define GPIO_MASK (GPIO_MASK_1 | GPIO_MASK_2)
void *gpio_cfi_flash_swizzle(void *vaddr)
{
@@ -22,11 +30,12 @@ void *gpio_cfi_flash_swizzle(void *vaddr)
gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
-#ifdef GPIO_MASK_2
+#ifdef GPIO_PIN_2
gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
#endif
SSYNC();
+ udelay(1);
return (void *)(addr & ~GPIO_MASK);
}
@@ -51,8 +60,9 @@ MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
void gpio_cfi_flash_init(void)
{
gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
-#ifdef GPIO_MASK_2
+ gpio_direction_output(GPIO_PIN_1, 0);
+#ifdef GPIO_PIN_2
gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
+ gpio_direction_output(GPIO_PIN_2, 0);
#endif
- gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
}
diff --git a/board/cm-bf537u/cm-bf537u.c b/board/cm-bf537u/cm-bf537u.c
index 92fa5a0..4b7e864 100644
--- a/board/cm-bf537u/cm-bf537u.c
+++ b/board/cm-bf537u/cm-bf537u.c
@@ -13,7 +13,7 @@
#include <netdev.h>
#include <asm/blackfin.h>
#include <asm/net.h>
-#include "gpio_cfi_flash.h"
+#include "../cm-bf537e/gpio_cfi_flash.h"
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/cm-bf537u/gpio_cfi_flash.c b/board/cm-bf537u/gpio_cfi_flash.c
index 416c689..ef5ea8b 100644
--- a/board/cm-bf537u/gpio_cfi_flash.c
+++ b/board/cm-bf537u/gpio_cfi_flash.c
@@ -1,58 +1,2 @@
-/*
- * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <asm/blackfin.h>
-#include <asm/gpio.h>
-#include <asm/io.h>
-#include "gpio_cfi_flash.h"
-
-#define GPIO_PIN_1 GPIO_PH0
-#define GPIO_MASK_1 (1 << 21)
-#define GPIO_MASK (GPIO_MASK_1)
-
-void *gpio_cfi_flash_swizzle(void *vaddr)
-{
- unsigned long addr = (unsigned long)vaddr;
-
- gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
-
-#ifdef GPIO_MASK_2
- gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
-#endif
-
- SSYNC();
-
- return (void *)(addr & ~GPIO_MASK);
-}
-
-#define __raw_writeq(value, addr) *(volatile u64 *)addr = value
-#define __raw_readq(addr) *(volatile u64 *)addr
-
-#define MAKE_FLASH(size, sfx) \
-void flash_write##size(u##size value, void *addr) \
-{ \
- __raw_write##sfx(value, gpio_cfi_flash_swizzle(addr)); \
-} \
-u##size flash_read##size(void *addr) \
-{ \
- return __raw_read##sfx(gpio_cfi_flash_swizzle(addr)); \
-}
-MAKE_FLASH(8, b) /* flash_write8() flash_read8() */
-MAKE_FLASH(16, w) /* flash_write16() flash_read16() */
-MAKE_FLASH(32, l) /* flash_write32() flash_read32() */
-MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
-
-void gpio_cfi_flash_init(void)
-{
- gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
-#ifdef GPIO_MASK_2
- gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
-#endif
- gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
-}
+#define GPIO_PIN_1 GPIO_PH0
+#include "../cm-bf537e/gpio_cfi_flash.c"
diff --git a/board/cm-bf537u/gpio_cfi_flash.h b/board/cm-bf537u/gpio_cfi_flash.h
deleted file mode 100644
index 5211e97..0000000
--- a/board/cm-bf537u/gpio_cfi_flash.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-void *gpio_cfi_flash_swizzle(void *vaddr);
-void gpio_cfi_flash_init(void);
diff --git a/board/tcm-bf537/gpio_cfi_flash.c b/board/tcm-bf537/gpio_cfi_flash.c
index 08ea7af..c4fef9f 100644
--- a/board/tcm-bf537/gpio_cfi_flash.c
+++ b/board/tcm-bf537/gpio_cfi_flash.c
@@ -1,60 +1,3 @@
-/*
- * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <asm/blackfin.h>
-#include <asm/gpio.h>
-#include <asm/io.h>
-#include "gpio_cfi_flash.h"
-
-#define GPIO_PIN_1 GPIO_PF4
-#define GPIO_MASK_1 (1 << 21)
-#define GPIO_PIN_2 GPIO_PF5
-#define GPIO_MASK_2 (1 << 22)
-#define GPIO_MASK (GPIO_MASK_1 | GPIO_MASK_2)
-
-void *gpio_cfi_flash_swizzle(void *vaddr)
-{
- unsigned long addr = (unsigned long)vaddr;
-
- gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
-
-#ifdef GPIO_MASK_2
- gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
-#endif
-
- SSYNC();
-
- return (void *)(addr & ~GPIO_MASK);
-}
-
-#define __raw_writeq(value, addr) *(volatile u64 *)addr = value
-#define __raw_readq(addr) *(volatile u64 *)addr
-
-#define MAKE_FLASH(size, sfx) \
-void flash_write##size(u##size value, void *addr) \
-{ \
- __raw_write##sfx(value, gpio_cfi_flash_swizzle(addr)); \
-} \
-u##size flash_read##size(void *addr) \
-{ \
- return __raw_read##sfx(gpio_cfi_flash_swizzle(addr)); \
-}
-MAKE_FLASH(8, b) /* flash_write8() flash_read8() */
-MAKE_FLASH(16, w) /* flash_write16() flash_read16() */
-MAKE_FLASH(32, l) /* flash_write32() flash_read32() */
-MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
-
-void gpio_cfi_flash_init(void)
-{
- gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
-#ifdef GPIO_MASK_2
- gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
-#endif
- gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE);
-}
+#define GPIO_PIN_1 GPIO_PF4
+#define GPIO_PIN_2 GPIO_PF5
+#include "../cm-bf537e/gpio_cfi_flash.c"
diff --git a/board/tcm-bf537/gpio_cfi_flash.h b/board/tcm-bf537/gpio_cfi_flash.h
deleted file mode 100644
index 5211e97..0000000
--- a/board/tcm-bf537/gpio_cfi_flash.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-void *gpio_cfi_flash_swizzle(void *vaddr);
-void gpio_cfi_flash_init(void);
diff --git a/board/tcm-bf537/tcm-bf537.c b/board/tcm-bf537/tcm-bf537.c
index 60742df..04d6bdb 100644
--- a/board/tcm-bf537/tcm-bf537.c
+++ b/board/tcm-bf537/tcm-bf537.c
@@ -13,7 +13,7 @@
#include <netdev.h>
#include <asm/blackfin.h>
#include <asm/net.h>
-#include "gpio_cfi_flash.h"
+#include "../cm-bf537e/gpio_cfi_flash.h"
DECLARE_GLOBAL_DATA_PTR;
--
1.7.3.1
next prev parent reply other threads:[~2010-10-02 20:05 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-02 20:05 [U-Boot] [PATCH 00/37] Blackfin updates for v2010.12-rc1 Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 03/37] Blackfin: bfin_spi: add optional DMA support Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 04/37] Blackfin: bfin_sdh: clean up send_cmd Mike Frysinger
2010-10-02 20:05 ` Mike Frysinger [this message]
2010-10-02 20:05 ` [U-Boot] [PATCH 06/37] Blackfin: punt headers for non-existent BF541 Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 07/37] Blackfin: bfin_mac: convert from old style MMR macros Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 08/37] Blackfin: bf537-stamp: post: update old MMR style macros Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 09/37] Blackfin: bf527-ezkit: video: convert from old style MMR macros Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 10/37] Blackfin: bf548-ezkit: " Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 11/37] Blackfin: cm-bf548: " Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 12/37] Blackfin: bf527-ad7160-eval: " Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 14/37] Blackfin: bf537: unify arch header duplication Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 19/37] Blackfin: move CONFIG_BFIN_CPU to board config.mk Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 20/37] Blackfin: cmd_gpio: document/extend input sub-option Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 21/37] Blackfin: support a 3rd gpio cfi pin Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 22/37] Blackfin: adi config: add an "all spi flashes" option to unify board lists Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 23/37] Blackfin: adi config: add a hook for boards to append the env Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 24/37] Blackfin: bf527-sdp: new board port Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 25/37] Blackfin: cmd_gpio: return gpio value to caller Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 26/37] Blackfin: adi config: allow boards to tweak a little more Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 27/37] Blackfin: bct-brettl2: new board port Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 28/37] Blackfin: adi config: enable nand lock/unlock support Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 29/37] Blackfin: bf526-ezbrd: enable BootROM-OOB layout when booting from NAND Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 30/37] Blackfin: cmd_gpio: accept upper case pin names Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 31/37] Blackfin: propagate target cpu defines when building embedded env Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 32/37] Blackfin: blackvme: new board port Mike Frysinger
2010-10-03 1:52 ` Wojtek Skulski
2010-10-02 20:05 ` [U-Boot] [PATCH 33/37] Blackfin: fix MMC init output alignment Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 34/37] Blackfin: bf548-ezkit: bump SPI flash size up Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 35/37] Blackfin: bf527-ad7160-eval: fix GPIO CS define Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 36/37] Blackfin: bf537-pnav: increase monitor len Mike Frysinger
2010-10-02 20:05 ` [U-Boot] [PATCH 37/37] Blackfin: otp: fix build after constification of args[] Mike Frysinger
2010-10-04 17:33 ` [U-Boot] Pull request u-boot-blackfin.git Mike Frysinger
2010-10-05 12:43 ` Wolfgang Denk
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=1286049958-4125-4-git-send-email-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=u-boot@lists.denx.de \
/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.