X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=blobdiff_plain;f=target%2Flinux%2Fatheros%2Fpatches-3.10%2F120-spiflash.patch;h=262af6094c95f0feff6ffba364f7def53e884e20;hp=ef9cb916221257a6ef70b1c20d4925420ce32449;hb=cf8ef86d5c7a4ff51d87e74e936a50e326ce0bcf;hpb=971ecf1a4cfd7442f8007dae25719f9c91e36314 diff --git a/target/linux/atheros/patches-3.10/120-spiflash.patch b/target/linux/atheros/patches-3.10/120-spiflash.patch index ef9cb91622..262af6094c 100644 --- a/target/linux/atheros/patches-3.10/120-spiflash.patch +++ b/target/linux/atheros/patches-3.10/120-spiflash.patch @@ -23,7 +23,7 @@ --- /dev/null +++ b/drivers/mtd/devices/ar2315.c -@@ -0,0 +1,515 @@ +@@ -0,0 +1,527 @@ + +/* + * MTD driver for the SPI Flash Memory support on Atheros AR2315 @@ -52,8 +52,7 @@ +#include +#include +#include -+#include -+#include ++#include + +#include +#include @@ -92,11 +91,16 @@ + +const struct flashconfig flashconfig_tbl[] = { + [FLASH_NONE] = { 0, 0, 0}, -+ [FLASH_1MB] = { STM_1MB_BYTE_COUNT, STM_1MB_SECTOR_COUNT, STM_1MB_SECTOR_SIZE}, -+ [FLASH_2MB] = { STM_2MB_BYTE_COUNT, STM_2MB_SECTOR_COUNT, STM_2MB_SECTOR_SIZE}, -+ [FLASH_4MB] = { STM_4MB_BYTE_COUNT, STM_4MB_SECTOR_COUNT, STM_4MB_SECTOR_SIZE}, -+ [FLASH_8MB] = { STM_8MB_BYTE_COUNT, STM_8MB_SECTOR_COUNT, STM_8MB_SECTOR_SIZE}, -+ [FLASH_16MB] = { STM_16MB_BYTE_COUNT, STM_16MB_SECTOR_COUNT, STM_16MB_SECTOR_SIZE} ++ [FLASH_1MB] = { STM_1MB_BYTE_COUNT, STM_1MB_SECTOR_COUNT, ++ STM_1MB_SECTOR_SIZE}, ++ [FLASH_2MB] = { STM_2MB_BYTE_COUNT, STM_2MB_SECTOR_COUNT, ++ STM_2MB_SECTOR_SIZE}, ++ [FLASH_4MB] = { STM_4MB_BYTE_COUNT, STM_4MB_SECTOR_COUNT, ++ STM_4MB_SECTOR_SIZE}, ++ [FLASH_8MB] = { STM_8MB_BYTE_COUNT, STM_8MB_SECTOR_COUNT, ++ STM_8MB_SECTOR_SIZE}, ++ [FLASH_16MB] = { STM_16MB_BYTE_COUNT, STM_16MB_SECTOR_COUNT, ++ STM_16MB_SECTOR_SIZE} +}; + +/* Mapping of generic opcodes to STM serial flash opcodes */ @@ -115,10 +119,11 @@ +}; + +struct opcodes { -+ __u16 code; -+ __s8 tx_cnt; -+ __s8 rx_cnt; ++ __u16 code; ++ __s8 tx_cnt; ++ __s8 rx_cnt; +}; ++ +const struct opcodes stm_opcodes[] = { + [SPI_WRITE_ENABLE] = {STM_OP_WR_ENABLE, 1, 0}, + [SPI_WRITE_DISABLE] = {STM_OP_WR_DISABLE, 1, 0}, @@ -152,7 +157,7 @@ + FL_WRITING +}; + -+/***************************************************************************************************/ ++/*****************************************************************************/ + +static u32 +spiflash_read_reg(struct spiflash_priv *priv, int reg) @@ -177,7 +182,7 @@ +} + +static u32 -+spiflash_sendcmd (struct spiflash_priv *priv, int opcode, u32 addr) ++spiflash_sendcmd(struct spiflash_priv *priv, int opcode, u32 addr) +{ + const struct opcodes *op; + u32 reg, mask; @@ -224,7 +229,7 @@ + * and flashconfig_tbl array index for success. + */ +static int -+spiflash_probe_chip (struct spiflash_priv *priv) ++spiflash_probe_chip(struct spiflash_priv *priv) +{ + u32 sig; + int flash_size; @@ -251,7 +256,7 @@ + flash_size = FLASH_16MB; + break; + default: -+ printk (KERN_WARNING SPIFLASH "Read of flash device signature failed!\n"); ++ pr_warn(SPIFLASH "Read of flash device signature failed!\n"); + return 0; + } + @@ -273,7 +278,7 @@ + schedule(); + remove_wait_queue(&priv->wq, &wait); + -+ if(signal_pending(current)) ++ if (signal_pending(current)) + return 0; + + goto retry; @@ -301,7 +306,7 @@ + + +static int -+spiflash_erase (struct mtd_info *mtd, struct erase_info *instr) ++spiflash_erase(struct mtd_info *mtd, struct erase_info *instr) +{ + struct spiflash_priv *priv = to_spiflash(mtd); + const struct opcodes *op; @@ -333,7 +338,8 @@ +} + +static int -+spiflash_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) ++spiflash_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, ++ u_char *buf) +{ + struct spiflash_priv *priv = to_spiflash(mtd); + u8 *read_addr; @@ -357,7 +363,8 @@ +} + +static int -+spiflash_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u8 *buf) ++spiflash_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, ++ const u8 *buf) +{ + struct spiflash_priv *priv = to_spiflash(mtd); + u32 opcode, bytes_left; @@ -434,7 +441,9 @@ + + +#if defined CONFIG_MTD_REDBOOT_PARTS || CONFIG_MTD_MYLOADER_PARTS -+static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "MyLoader", NULL }; ++static const char * const part_probe_types[] = { ++ "cmdlinepart", "RedBoot", "MyLoader", NULL ++}; +#endif + + @@ -454,19 +463,20 @@ + + priv->mmraddr = ioremap_nocache(SPI_FLASH_MMR, SPI_FLASH_MMR_SIZE); + if (!priv->mmraddr) { -+ printk(KERN_WARNING SPIFLASH "Failed to map flash device\n"); ++ dev_warn(&pdev->dev, SPIFLASH "Failed to map flash device\n"); + goto error; + } + + index = spiflash_probe_chip(priv); + if (!index) { -+ printk (KERN_WARNING SPIFLASH "Found no serial flash device\n"); ++ dev_warn(&pdev->dev, SPIFLASH "Found no flash device\n"); + goto error; + } + -+ priv->readaddr = ioremap_nocache(SPI_FLASH_READ, flashconfig_tbl[index].byte_cnt); ++ priv->readaddr = ioremap_nocache(SPI_FLASH_READ, ++ flashconfig_tbl[index].byte_cnt); + if (!priv->readaddr) { -+ printk (KERN_WARNING SPIFLASH "Failed to map flash device\n"); ++ dev_warn(&pdev->dev, SPIFLASH "Failed to map flash device\n"); + goto error; + } + @@ -484,6 +494,8 @@ + mtd->_write = spiflash_write; + mtd->owner = THIS_MODULE; + ++ dev_info(&pdev->dev, "%lld Kbytes flash detected\n", mtd->size >> 10); ++ +#if defined CONFIG_MTD_REDBOOT_PARTS || CONFIG_MTD_MYLOADER_PARTS + /* parse redboot partitions */ + @@ -501,7 +513,7 @@ +} + +static int -+spiflash_remove (struct platform_device *pdev) ++spiflash_remove(struct platform_device *pdev) +{ + struct spiflash_priv *priv = platform_get_drvdata(pdev); + struct mtd_info *mtd = &priv->mtd; @@ -521,19 +533,19 @@ +}; + +int __init -+spiflash_init (void) ++spiflash_init(void) +{ + return platform_driver_register(&spiflash_driver); +} + +void __exit -+spiflash_exit (void) ++spiflash_exit(void) +{ + return platform_driver_unregister(&spiflash_driver); +} + -+module_init (spiflash_init); -+module_exit (spiflash_exit); ++module_init(spiflash_init); ++module_exit(spiflash_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("OpenWrt.org, Atheros Communications Inc");