Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182035
b: refs/heads/master
c: 206aa6c
h: refs/heads/master
i:
  182033: 2a15cf5
  182031: 37433f1
v: v3
  • Loading branch information
Manuel Lauss authored and Ralf Baechle committed Feb 27, 2010
1 parent 40ac79e commit 723a42a
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 174 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8facefd0907ae16f96a35bef7ce654206d87c2fc
refs/heads/master: 206aa6cdadad8bbedee5649f1346fe47e922a039
20 changes: 20 additions & 0 deletions trunk/arch/mips/alchemy/devboards/db1x00/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/platform_device.h>

#include <asm/mach-au1x00/au1xxx.h>
#include <asm/mach-db1x00/bcsr.h>
#include "../platform.h"

/* DB1xxx PCMCIA interrupt sources:
Expand All @@ -32,6 +33,7 @@
*/

#define DB1XXX_HAS_PCMCIA
#define F_SWAPPED (bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT)

#if defined(CONFIG_MIPS_DB1000)
#define DB1XXX_PCMCIA_CD0 AU1000_GPIO0_INT
Expand All @@ -40,30 +42,47 @@
#define DB1XXX_PCMCIA_CD1 AU1000_GPIO3_INT
#define DB1XXX_PCMCIA_STSCHG1 AU1000_GPIO4_INT
#define DB1XXX_PCMCIA_CARD1 AU1000_GPIO5_INT
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#elif defined(CONFIG_MIPS_DB1100)
#define DB1XXX_PCMCIA_CD0 AU1100_GPIO0_INT
#define DB1XXX_PCMCIA_STSCHG0 AU1100_GPIO1_INT
#define DB1XXX_PCMCIA_CARD0 AU1100_GPIO2_INT
#define DB1XXX_PCMCIA_CD1 AU1100_GPIO3_INT
#define DB1XXX_PCMCIA_STSCHG1 AU1100_GPIO4_INT
#define DB1XXX_PCMCIA_CARD1 AU1100_GPIO5_INT
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#elif defined(CONFIG_MIPS_DB1500)
#define DB1XXX_PCMCIA_CD0 AU1500_GPIO0_INT
#define DB1XXX_PCMCIA_STSCHG0 AU1500_GPIO1_INT
#define DB1XXX_PCMCIA_CARD0 AU1500_GPIO2_INT
#define DB1XXX_PCMCIA_CD1 AU1500_GPIO3_INT
#define DB1XXX_PCMCIA_STSCHG1 AU1500_GPIO4_INT
#define DB1XXX_PCMCIA_CARD1 AU1500_GPIO5_INT
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#elif defined(CONFIG_MIPS_DB1550)
#define DB1XXX_PCMCIA_CD0 AU1550_GPIO0_INT
#define DB1XXX_PCMCIA_STSCHG0 AU1550_GPIO21_INT
#define DB1XXX_PCMCIA_CARD0 AU1550_GPIO3_INT
#define DB1XXX_PCMCIA_CD1 AU1550_GPIO1_INT
#define DB1XXX_PCMCIA_STSCHG1 AU1550_GPIO22_INT
#define DB1XXX_PCMCIA_CARD1 AU1550_GPIO5_INT
#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#else
/* other board: no PCMCIA */
#undef DB1XXX_HAS_PCMCIA
#undef F_SWAPPED
#define F_SWAPPED 0
#if defined(CONFIG_MIPS_BOSPORUS)
#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */
#define BOARD_FLASH_WIDTH 2 /* 16-bits */
#elif defined(CONFIG_MIPS_MIRAGE)
#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif
#endif

static int __init db1xxx_dev_init(void)
Expand Down Expand Up @@ -93,6 +112,7 @@ static int __init db1xxx_dev_init(void)
0,
1);
#endif
db1x_register_norflash(BOARD_FLASH_SIZE, BOARD_FLASH_WIDTH, F_SWAPPED);
return 0;
}
device_initcall(db1xxx_dev_init);
7 changes: 7 additions & 0 deletions trunk/arch/mips/alchemy/devboards/pb1000/board_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <asm/mach-pb1x00/pb1000.h>
#include <prom.h>

#include "../platform.h"

const char *get_system_type(void)
{
Expand Down Expand Up @@ -194,3 +195,9 @@ static int __init pb1000_init_irq(void)
return 0;
}
arch_initcall(pb1000_init_irq);

static int __init pb1000_device_init(void)
{
return db1x_register_norflash(8 * 1024 * 1024, 4, 0);
}
device_initcall(pb1000_device_init);
7 changes: 7 additions & 0 deletions trunk/arch/mips/alchemy/devboards/pb1100/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
#include <linux/init.h>

#include <asm/mach-au1x00/au1000.h>
#include <asm/mach-db1x00/bcsr.h>

#include "../platform.h"

static int __init pb1100_dev_init(void)
{
int swapped;

/* PCMCIA. single socket, identical to Pb1500 */
db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS,
PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1,
Expand All @@ -38,6 +41,10 @@ static int __init pb1100_dev_init(void)
/*AU1100_GPIO10_INT*/0, /* stschg */
0, /* eject */
0); /* id */

swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT;
db1x_register_norflash(64 * 1024 * 1024, 4, swapped);

return 0;
}
device_initcall(pb1100_dev_init);
9 changes: 9 additions & 0 deletions trunk/arch/mips/alchemy/devboards/pb1200/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ static struct platform_device *board_platform_devices[] __initdata = {

static int __init board_register_devices(void)
{
int swapped;

#ifdef CONFIG_MIPS_PB1200
db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS,
PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1,
Expand Down Expand Up @@ -222,6 +224,13 @@ static int __init board_register_devices(void)
1);
#endif

swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT;
#ifdef CONFIG_MIPS_PB1200
db1x_register_norflash(128 * 1024 * 1024, 2, swapped);
#else
db1x_register_norflash(64 * 1024 * 1024, 2, swapped);
#endif

return platform_add_devices(board_platform_devices,
ARRAY_SIZE(board_platform_devices));
}
Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/mips/alchemy/devboards/pb1500/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@

#include <linux/init.h>
#include <asm/mach-au1x00/au1000.h>
#include <asm/mach-db1x00/bcsr.h>

#include "../platform.h"

static int __init pb1500_dev_init(void)
{
int swapped;

/* PCMCIA. single socket, identical to Pb1500 */
db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS,
PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1,
Expand All @@ -37,6 +40,10 @@ static int __init pb1500_dev_init(void)
/*AU1500_GPIO10_INT*/0, /* stschg */
0, /* eject */
0); /* id */

swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT;
db1x_register_norflash(64 * 1024 * 1024, 4, swapped);

return 0;
}
device_initcall(pb1500_dev_init);
6 changes: 6 additions & 0 deletions trunk/arch/mips/alchemy/devboards/pb1550/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@

#include <asm/mach-au1x00/au1000.h>
#include <asm/mach-pb1x00/pb1550.h>
#include <asm/mach-db1x00/bcsr.h>

#include "../platform.h"

static int __init pb1550_dev_init(void)
{
int swapped;

/* Pb1550, like all others, also has statuschange irqs; however they're
* wired up on one of the Au1550's shared GPIO201_205 line, which also
* services the PCMCIA card interrupts. So we ignore statuschange and
Expand Down Expand Up @@ -58,6 +61,9 @@ static int __init pb1550_dev_init(void)
0,
1);

swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_PB1550_SWAPBOOT;
db1x_register_norflash(128 * 1024 * 1024, 4, swapped);

return 0;
}
device_initcall(pb1550_dev_init);
104 changes: 104 additions & 0 deletions trunk/arch/mips/alchemy/devboards/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*/

#include <linux/init.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/physmap.h>
#include <linux/slab.h>
#include <linux/platform_device.h>

Expand Down Expand Up @@ -87,3 +90,104 @@ int __init db1x_register_pcmcia_socket(unsigned long pseudo_attr_start,
kfree(sr);
return ret;
}

#define YAMON_SIZE 0x00100000
#define YAMON_ENV_SIZE 0x00040000

int __init db1x_register_norflash(unsigned long size, int width,
int swapped)
{
struct physmap_flash_data *pfd;
struct platform_device *pd;
struct mtd_partition *parts;
struct resource *res;
int ret, i;

if (size < (8 * 1024 * 1024))
return -EINVAL;

ret = -ENOMEM;
parts = kzalloc(sizeof(struct mtd_partition) * 5, GFP_KERNEL);
if (!parts)
goto out;

res = kzalloc(sizeof(struct resource), GFP_KERNEL);
if (!res)
goto out1;

pfd = kzalloc(sizeof(struct physmap_flash_data), GFP_KERNEL);
if (!pfd)
goto out2;

pd = platform_device_alloc("physmap-flash", 0);
if (!pd)
goto out3;

/* NOR flash ends at 0x20000000, regardless of size */
res->start = 0x20000000 - size;
res->end = 0x20000000 - 1;
res->flags = IORESOURCE_MEM;

/* partition setup. Most Develboards have a switch which allows
* to swap the physical locations of the 2 NOR flash banks.
*/
i = 0;
if (!swapped) {
/* first NOR chip */
parts[i].offset = 0;
parts[i].name = "User FS";
parts[i].size = size / 2;
i++;
}

parts[i].offset = MTDPART_OFS_APPEND;
parts[i].name = "User FS 2";
parts[i].size = (size / 2) - (0x20000000 - 0x1fc00000);
i++;

parts[i].offset = MTDPART_OFS_APPEND;
parts[i].name = "YAMON";
parts[i].size = YAMON_SIZE;
parts[i].mask_flags = MTD_WRITEABLE;
i++;

parts[i].offset = MTDPART_OFS_APPEND;
parts[i].name = "raw kernel";
parts[i].size = 0x00400000 - YAMON_SIZE - YAMON_ENV_SIZE;
i++;

parts[i].offset = MTDPART_OFS_APPEND;
parts[i].name = "YAMON Env";
parts[i].size = YAMON_ENV_SIZE;
parts[i].mask_flags = MTD_WRITEABLE;
i++;

if (swapped) {
parts[i].offset = MTDPART_OFS_APPEND;
parts[i].name = "User FS";
parts[i].size = size / 2;
i++;
}

pfd->width = width;
pfd->parts = parts;
pfd->nr_parts = 5;

pd->dev.platform_data = pfd;
pd->resource = res;
pd->num_resources = 1;

ret = platform_device_add(pd);
if (!ret)
return ret;

platform_device_put(pd);
out3:
kfree(pfd);
out2:
kfree(res);
out1:
kfree(parts);
out:
return ret;
}
3 changes: 3 additions & 0 deletions trunk/arch/mips/alchemy/devboards/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ int __init db1x_register_pcmcia_socket(unsigned long pseudo_attr_start,
int eject_irq,
int id);

int __init db1x_register_norflash(unsigned long size, int width,
int swapped);

#endif
6 changes: 0 additions & 6 deletions trunk/drivers/mtd/maps/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,6 @@ config MTD_NETtel
help
Support for flash chips on NETtel/SecureEdge/SnapGear boards.

config MTD_ALCHEMY
tristate "AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support"
depends on SOC_AU1X00 && MTD_PARTITIONS && MTD_CFI
help
Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards

config MTD_DILNETPC
tristate "CFI Flash device mapped on DIL/Net PC"
depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT && BROKEN
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/mtd/maps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o
obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o
obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
obj-$(CONFIG_MTD_PCI) += pci.o
obj-$(CONFIG_MTD_ALCHEMY) += alchemy-flash.o
obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o
obj-$(CONFIG_MTD_EDB7312) += edb7312.o
obj-$(CONFIG_MTD_IMPA7) += impa7.o
Expand Down
Loading

0 comments on commit 723a42a

Please sign in to comment.