From: Robert Kaiser <rob@sysgo.de>
To: "David Woodhouse" <dwmw2@infradead.org>
Cc: <mtd@infradead.org>
Subject: Mapping for AMD SC520 CDP
Date: Mon, 5 Mar 2001 18:48:55 +0100 [thread overview]
Message-ID: <01030519195600.02909@rob> (raw)
[-- Attachment #1: Type: text/plain, Size: 700 bytes --]
Hi,
I have written a new flash mapping module for the SC520 CDP board by AMD, which
I would like to contribute (see attachment). Most of the code has obviously been
stol^H^H^H^H derived from various existing mapping modules. Hope I have not
introduced any bugs. It works for me so far.
The physmap.c driver works for that board too, but it seems I can only get
support for one of the two flash banks this way.
Cheers
Rob
----------------------------------------------------------------
Robert Kaiser email: rkaiser@sysgo.de
SYSGO RTS GmbH
Am Pfaffenstein 14 phone: (49) 6136 9948-762
D-55270 Klein-Winternheim / Germany fax: (49) 6136 9948-10
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: diffs --]
[-- Type: text/english; name="diffs", Size: 1465 bytes --]
--- patches/Configure.help.orig Sun Feb 18 00:00:06 2001
+++ patches/Configure.help Mon Mar 5 18:45:38 2001
@@ -177,6 +177,12 @@
devices. This board utilizes Intel StrataFlash. More info at
(http://www.arcomcontrols.com/products/icp/pc104/processors/).
+Flash chip mapping on AMD SC520 CDP board
+CONFIG_MTD_SC520CDP
+ The SC520 CDP board has two banks of CFI-compliant chips. This
+ 'mapping' driver supports that arrangement, implementing two
+ MTD devices.
+
Flash chip mapping on Arcom Control Systems' ELAN-104NC
CONFIG_MTD_ELAN_104NC
This provides a driver for the on-board flash of the Arcom Control
--- kernel/Config.in.orig Sun Feb 18 00:00:06 2001
+++ kernel/Config.in Mon Mar 5 18:44:04 2001
@@ -84,6 +84,7 @@
dep_tristate ' CFI Flash device mapped on Photron PNC-2000' CONFIG_MTD_PNC2000 $CONFIG_MTD_CFI
dep_tristate ' CFI Flash device mapped on RPX Lite or CLLF' CONFIG_MTD_RPXLITE $CONFIG_MTD_CFI
dep_tristate ' CFI Flash device mapped on Arcom SBC-MediaGX' CONFIG_MTD_SBC_MEDIAGX $CONFIG_MTD_CFI_INTELEXT
+ dep_tristate ' CFI Flash devices mapped on AMD SC520 CDP' CONFIG_MTD_SC520CDP $CONFIG_MTD_CFI
dep_tristate ' CFI Flash device mapped on Arcom ELAN-104NC' CONFIG_MTD_ELAN_104NC $CONFIG_MTD_CFI_INTELEXT
dep_tristate ' CFI Flash device mapped on StrongARM SA11x0' CONFIG_MTD_SA1100 $CONFIG_MTD_CFI
dep_tristate ' CFI Flash device mapped on DC21285 Footbridge' CONFIG_MTD_DC21285 $CONFIG_MTD_CFI
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: sc520cdp.c --]
[-- Type: text/english; name="sc520cdp.c", Size: 4357 bytes --]
/* sc520cdp.c -- MTD map driver for AMD SC520 Customer Development Platform
*
* Copyright (C) 2001 Sysgo Real-Time Solutions GmbH
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id$
*
*
* The SC520CDP is an evaluation board for the Elan SC520 processor available
* from AMD. It has two banks of 32-bit Flash ROM, each 8 Megabytes in size.
* For details see http://www.amd.com/products/epd/desiging/evalboards/18.elansc520/520_cdp_brief/index.html
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#define WINDOW_ADDR_0 0x08400000
#define WINDOW_ADDR_1 0x08C00000
#define WINDOW_SIZE 0x00800000
static __u8 sc520cdp_read8(struct map_info *map, unsigned long ofs)
{
return readb(map->map_priv_1 + ofs);
}
static __u16 sc520cdp_read16(struct map_info *map, unsigned long ofs)
{
return readw(map->map_priv_1 + ofs);
}
static __u32 sc520cdp_read32(struct map_info *map, unsigned long ofs)
{
return readl(map->map_priv_1 + ofs);
}
static void sc520cdp_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{
memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
}
static void sc520cdp_write8(struct map_info *map, __u8 d, unsigned long adr)
{
writeb(d, map->map_priv_1 + adr);
}
static void sc520cdp_write16(struct map_info *map, __u16 d, unsigned long adr)
{
writew(d, map->map_priv_1 + adr);
}
static void sc520cdp_write32(struct map_info *map, __u32 d, unsigned long adr)
{
writel(d, map->map_priv_1 + adr);
}
static void sc520cdp_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
{
memcpy_toio((void *)(map->map_priv_1 + to), from, len);
}
static struct map_info sc520cdp_map[] = {
{
name: "SC520CDP Flash Bank #0",
size: WINDOW_SIZE,
buswidth: 4,
read8: sc520cdp_read8,
read16: sc520cdp_read16,
read32: sc520cdp_read32,
copy_from: sc520cdp_copy_from,
write8: sc520cdp_write8,
write16: sc520cdp_write16,
write32: sc520cdp_write32,
copy_to: sc520cdp_copy_to,
map_priv_2: WINDOW_ADDR_0
},
{
name: "SC520CDP Flash Bank #1",
size: WINDOW_SIZE,
buswidth: 4,
read8: sc520cdp_read8,
read16: sc520cdp_read16,
read32: sc520cdp_read32,
copy_from: sc520cdp_copy_from,
write8: sc520cdp_write8,
write16: sc520cdp_write16,
write32: sc520cdp_write32,
copy_to: sc520cdp_copy_to,
map_priv_2: WINDOW_ADDR_1
},
};
#define NUM_FLASH_BANKS (sizeof(sc520cdp_map)/sizeof(struct map_info))
static struct mtd_info *mymtd[NUM_FLASH_BANKS];
#if LINUX_VERSION_CODE < 0x20212 && defined(MODULE)
#define init_sc520cdp init_module
#define cleanup_sc520cdp cleanup_module
#endif
static int __init init_sc520cdp(void)
{
int i;
for (i = 0; i < NUM_FLASH_BANKS; i++) {
printk(KERN_NOTICE "SC520 CDP flash device: %x at %lx\n", WINDOW_SIZE, sc520cdp_map[i].map_priv_2);
sc520cdp_map[i].map_priv_1 = (unsigned long)ioremap(sc520cdp_map[i].map_priv_2, WINDOW_SIZE);
if (!sc520cdp_map[i].map_priv_1) {
printk("Failed to ioremap\n");
return -EIO;
}
mymtd[i] = do_cfi_probe(&sc520cdp_map[i]);
if (mymtd[i]) {
#ifdef MODULE
mymtd[i]->module = &__this_module;
#endif
add_mtd_device(mymtd[i]);
}
else {
iounmap((void *)sc520cdp_map[i].map_priv_1);
return -ENXIO;
}
}
return 0;
}
static void __exit cleanup_sc520cdp(void)
{
int i;
for (i = 0; i < NUM_FLASH_BANKS; i++) {
if (mymtd[i]) {
del_mtd_device(mymtd[i]);
map_destroy(mymtd[i]);
}
if (sc520cdp_map[i].map_priv_1) {
iounmap((void *)sc520cdp_map[i].map_priv_1);
sc520cdp_map[i].map_priv_1 = 0;
}
}
}
module_init(init_sc520cdp);
module_exit(cleanup_sc520cdp);
reply other threads:[~2001-03-05 18:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=01030519195600.02909@rob \
--to=rob@sysgo.de \
--cc=dwmw2@infradead.org \
--cc=mtd@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.